diff --git a/sites/svelte.dev/scripts/type-gen/compile-types.js b/sites/svelte.dev/scripts/type-gen/compile-types.js index ca9374fb42..08dd58b9bb 100644 --- a/sites/svelte.dev/scripts/type-gen/compile-types.js +++ b/sites/svelte.dev/scripts/type-gen/compile-types.js @@ -62,6 +62,14 @@ function useExportDeclarations(str) { (element) => element.name.text ); + // // find the elements who are being exported as alias, like `export { VERSION as __VERSION__ }` + // const aliasedExportedSymbols = new Map( + // // @ts-ignore Why does TS not identify `elements` + // exportDeclaration?.exportClause?.elements + // .filter((element) => element.propertyName) + // .map((element) => [element.name.text, element.propertyName.text]) + // ); + for (const statement of sourceFile.statements) { if ( !( @@ -73,6 +81,18 @@ function useExportDeclarations(str) { ) continue; + // // Now rewrite the aliased exports to be inline. This risk collision, so hope that doesn't happen + // if ( + // (ts.isVariableStatement(statement) && + // aliasedExportedSymbols.has(statement.declarationList.declarations[0].name.getText())) || + // // @ts-ignore + // aliasedExportedSymbols.has(statement.name?.getText()) + // ) + // for (const [og, exported] of aliasedExportedSymbols) { + // // Modify the current statement, change the variable name + // magicStr.overwrite(); + // } + for (const exportedSymbol of exportedSymbols) { if ( (ts.isVariableStatement(statement) &&