mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-12-01 19:35:08 +03:00
parse entire project for variant shapes
This commit is contained in:
parent
a8de97e073
commit
10928a8bf8
@ -39,7 +39,11 @@ export const transform = async (
|
||||
): Promise<string> => {
|
||||
// Compile examples in `testcases/*` folder as js
|
||||
// Run whatever transformations we want on them, saving steps as `elm.{transformation}.js`
|
||||
|
||||
let source = ts.createSourceFile(
|
||||
'elm.js',
|
||||
jsSource,
|
||||
ts.ScriptTarget.ES2018
|
||||
);
|
||||
|
||||
const elmSource = fs.readFileSync(elmfile, 'utf8');
|
||||
let parsedVariants = parseElm({
|
||||
@ -48,13 +52,12 @@ export const transform = async (
|
||||
source: elmSource,
|
||||
}).concat(primitives);
|
||||
|
||||
let parsed = parseDir('elm-packages');
|
||||
parsedVariants = parsedVariants.concat(parsed);
|
||||
let source = ts.createSourceFile(
|
||||
'elm.js',
|
||||
jsSource,
|
||||
ts.ScriptTarget.ES2018
|
||||
);
|
||||
|
||||
parsedVariants = parsedVariants.concat(parseDir('elm-packages')).concat(parseDir(dir));
|
||||
|
||||
// we dont care about types that have no slots on any variants
|
||||
parsedVariants = parsedVariants.filter((variant) => { return variant.totalTypeSlotCount != 0 });
|
||||
|
||||
|
||||
const normalizeVariantShapes = createCustomTypesTransformer(
|
||||
parsedVariants,
|
||||
|
Loading…
Reference in New Issue
Block a user