some other mistakes fixed

This commit is contained in:
lionel benychou 2019-11-01 22:22:43 +01:00
parent 6e4b291f32
commit 2bd6aad28b
2 changed files with 1007 additions and 39 deletions

View File

@ -16,9 +16,10 @@ export function insertAfterImports(classLoader, insert, source) {
}
if (!ast) return `${insert}${source}`;
const endOfImportsIndex = endOfImports(ast);
return `${source.substring(0, endOfImportsIndex)}\n${insert}\n${source.substring(
endOfImports + 1
const result = `${source.substring(0, endOfImportsIndex)}\n${insert}\n${source.substring(
endOfImportsIndex + 1
)}`;
return result;
}
export function transform(inputSource) {
@ -36,7 +37,7 @@ export function transform(inputSource) {
idsToFrameworks,
}) => {
const preamble = `
/* eslint-disable no-unused-vars,@typescript-eslint/no-unused-vars */
/* eslint-disable no-unused-vars,@typescript-eslint/no-unused-vars */
// @ts-ignore
var withSourceLoader = require('@storybook/source-loader/preview').withSource;
// @ts-ignore
@ -55,10 +56,10 @@ var __MODULE_DEPENDENCIES__ = ${JSON.stringify(dependencies)};
var __LOCAL_DEPENDENCIES__ = ${JSON.stringify(localDependencies)};
// @ts-ignore
var __IDS_TO_FRAMEWORKS__ = ${JSON.stringify(idsToFrameworks)};
/* eslint-enable no-unused-vars,@typescript-eslint/no-unused-vars */
/* eslint-enable no-unused-vars,@typescript-eslint/no-unused-vars */
`;
// return insertAfterImports(preamble, source);
return `${preamble}${source}`;
return insertAfterImports(this, preamble, source);
// return `${preamble}${source}`;
}
);
}

1033
yarn.lock

File diff suppressed because it is too large Load Diff