@ts-liveserver/ts-transpiler
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -11,2 +11,3 @@ "use strict"; | ||
KEYNAME["module"] = "module"; | ||
KEYNAME["default"] = "default"; | ||
})(KEYNAME || (KEYNAME = {})); | ||
@@ -391,8 +392,3 @@ /* | ||
], typescript_1.default.NodeFlags.Let)); | ||
const exportDefaultStatement = typescript_1.default.factory.createExportAssignment(undefined, undefined, undefined, typescript_1.default.factory.createIdentifier(KEYNAME.exports)); | ||
const statements = [ | ||
moduleExportStatement, | ||
...sourceFile.statements, | ||
exportDefaultStatement, | ||
]; | ||
const statements = [moduleExportStatement, ...sourceFile.statements]; | ||
if (exportedNames.length) { | ||
@@ -409,2 +405,5 @@ const variableDeclarations = []; | ||
} | ||
if (!exportedNames.includes(KEYNAME.default)) { | ||
statements.push(typescript_1.default.factory.createExportAssignment(undefined, undefined, undefined, typescript_1.default.factory.createIdentifier(KEYNAME.exports))); | ||
} | ||
return typescript_1.default.factory.updateSourceFile(sourceFile, statements); | ||
@@ -411,0 +410,0 @@ } |
{ | ||
"name": "@ts-liveserver/ts-transpiler", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -6,2 +6,3 @@ import TypeScript from 'typescript' | ||
module = 'module', | ||
default = 'default', | ||
} | ||
@@ -667,13 +668,4 @@ /* | ||
) | ||
const exportDefaultStatement: TypeScript.ExportAssignment = TypeScript.factory.createExportAssignment( | ||
undefined, | ||
undefined, | ||
undefined, | ||
TypeScript.factory.createIdentifier(KEYNAME.exports), | ||
) | ||
const statements = [ | ||
moduleExportStatement, | ||
...sourceFile.statements, | ||
exportDefaultStatement, | ||
] | ||
const statements = [moduleExportStatement, ...sourceFile.statements] | ||
if (exportedNames.length) { | ||
@@ -718,4 +710,14 @@ const variableDeclarations: TypeScript.VariableDeclaration[] = [] | ||
} | ||
if (!exportedNames.includes(KEYNAME.default)) { | ||
statements.push( | ||
TypeScript.factory.createExportAssignment( | ||
undefined, | ||
undefined, | ||
undefined, | ||
TypeScript.factory.createIdentifier(KEYNAME.exports), | ||
), | ||
) | ||
} | ||
return TypeScript.factory.updateSourceFile(sourceFile, statements) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
144765