@angular-devkit/build-optimizer
Advanced tools
Comparing version 0.0.20 to 0.0.21
{ | ||
"name": "@angular-devkit/build-optimizer", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Angular Build Optimizer", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -0,1 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import { RawSourceMap } from 'source-map'; | ||
@@ -2,0 +9,0 @@ import * as ts from 'typescript'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
const fs_1 = require("fs"); | ||
const path_1 = require("path"); | ||
const ts = require("typescript"); | ||
@@ -35,25 +26,13 @@ function transformJavascript(options) { | ||
}; | ||
// Make a in-memory host and populate it with a single file | ||
const fileMap = new Map(); | ||
const sourcesMap = new Map(); | ||
const outputs = new Map(); | ||
// We're not actually writing anything to disk, but still need to define an outDir | ||
// because otherwise TS will fail to emit JS since it would overwrite the original. | ||
const tempOutDir = '$$_temp/'; | ||
const tempFilename = 'bo-default-file.js'; | ||
fileMap.set(tempFilename, content); | ||
// We need to load the default lib for noEmitOnError to work properly. | ||
const defaultLibFileName = 'lib.d.ts'; | ||
const defaultLibContent = fs_1.readFileSync(path_1.join(path_1.dirname(require.resolve('typescript')), defaultLibFileName), 'UTF-8'); | ||
fileMap.set(defaultLibFileName, defaultLibContent); | ||
fileMap.forEach((v, k) => sourcesMap.set(k, ts.createSourceFile(k, v, ts.ScriptTarget.ES2015))); | ||
const tempSourceFile = ts.createSourceFile(tempFilename, content, ts.ScriptTarget.Latest); | ||
const host = { | ||
getSourceFile: (fileName) => { | ||
const sourceFile = sourcesMap.get(fileName); | ||
if (!sourceFile) { | ||
if (fileName !== tempFilename) { | ||
throw new Error(`File ${fileName} does not have a sourceFile.`); | ||
} | ||
return sourceFile; | ||
return tempSourceFile; | ||
}, | ||
getDefaultLibFileName: () => defaultLibFileName, | ||
getDefaultLibFileName: () => 'lib.d.ts', | ||
getCurrentDirectory: () => '', | ||
@@ -64,21 +43,14 @@ getDirectories: () => [], | ||
getNewLine: () => '\n', | ||
fileExists: (fileName) => fileMap.has(fileName), | ||
readFile: (fileName) => { | ||
const content = fileMap.get(fileName); | ||
if (!content) { | ||
throw new Error(`File ${fileName} does not exist.`); | ||
} | ||
return content; | ||
}, | ||
fileExists: (fileName) => fileName === tempFilename, | ||
readFile: (_fileName) => '', | ||
writeFile: (fileName, text) => outputs.set(fileName, text), | ||
}; | ||
const tsOptions = { | ||
noEmitOnError: true, | ||
allowJs: true, | ||
// Using just line feed makes test comparisons easier, and doesn't matter for generated files. | ||
newLine: ts.NewLineKind.LineFeed, | ||
// We target next so that there is no downleveling. | ||
target: ts.ScriptTarget.ESNext, | ||
skipLibCheck: true, | ||
outDir: '$$_temp/', | ||
// We target latest so that there is no downleveling. | ||
target: ts.ScriptTarget.Latest, | ||
isolatedModules: true, | ||
suppressOutputPathCheck: true, | ||
allowNonTsExtensions: true, | ||
noLib: true, | ||
noResolve: true, | ||
sourceMap: emitSourceMap, | ||
@@ -88,8 +60,6 @@ inlineSources: emitSourceMap, | ||
}; | ||
const program = ts.createProgram(Array.from(fileMap.keys()), tsOptions, host); | ||
// We need the checker inside transforms. | ||
const transforms = getTransforms.map((getTf) => getTf(program)); | ||
const { emitSkipped, diagnostics } = program.emit(undefined, host.writeFile, undefined, undefined, { before: transforms, after: [] }); | ||
let transformedContent = outputs.get(`${tempOutDir}${tempFilename}`); | ||
if (emitSkipped || !transformedContent) { | ||
const program = ts.createProgram([tempFilename], tsOptions, host); | ||
const diagnostics = program.getSyntacticDiagnostics(tempSourceFile); | ||
const hasError = diagnostics.some(diag => diag.category === ts.DiagnosticCategory.Error); | ||
if (hasError) { | ||
// Throw only if we're in strict mode, otherwise return original content. | ||
@@ -111,5 +81,16 @@ if (strict) { | ||
} | ||
// We need the checker inside transforms. | ||
const transforms = getTransforms.map((getTf) => getTf(program)); | ||
program.emit(undefined, undefined, undefined, undefined, { before: transforms, after: [] }); | ||
let transformedContent = outputs.get(tempFilename); | ||
if (!transformedContent) { | ||
return { | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
} | ||
let sourceMap = null; | ||
if (emitSourceMap) { | ||
const tsSourceMap = outputs.get(`${tempOutDir}${tempFilename}.map`); | ||
const tsSourceMap = outputs.get(`${tempFilename}.map`); | ||
if (emitSourceMap && tsSourceMap) { | ||
const urlRegExp = /^\/\/# sourceMappingURL=[^\r\n]*/gm; | ||
@@ -142,2 +123,2 @@ sourceMap = JSON.parse(tsSourceMap); | ||
exports.transformJavascript = transformJavascript; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWphdmFzY3JpcHQuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hhbnNsL1NvdXJjZXMvZGV2a2l0LyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy9oZWxwZXJzL3RyYW5zZm9ybS1qYXZhc2NyaXB0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7OztHQU1HO0FBQ0gsMkJBQWtDO0FBQ2xDLCtCQUFxQztBQUVyQyxpQ0FBaUM7QUFrQmpDLDZCQUNFLE9BQW1DO0lBR25DLE1BQU0sRUFDSixPQUFPLEVBQ1AsYUFBYSxFQUNiLGFBQWEsRUFDYixhQUFhLEVBQ2IsY0FBYyxFQUNkLE1BQU0sR0FDUCxHQUFHLE9BQU8sQ0FBQztJQUVaLHNDQUFzQztJQUN0QyxFQUFFLENBQUMsQ0FBQyxhQUFhLENBQ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bWFwcyBmaWxlIHJlZmVyZW5jZXMuXG4gICAgaWYgKG91dHB1dEZpbGVQYXRoKSB7XG4gICAgICBzb3VyY2VNYXAuZmlsZSA9IG91dHB1dEZpbGVQYXRoO1xuICAgICAgdHJhbnNmb3JtZWRDb250ZW50ID0gdHJhbnNmb3JtZWRDb250ZW50LnJlcGxhY2UodXJsUmVnRXhwLFxuICAgICAgICBgLy8jIHNvdXJjZU1hcHBpbmdVUkw9JHtzb3VyY2VNYXAuZmlsZX0ubWFwXFxuYCk7XG4gICAgICBpZiAoaW5wdXRGaWxlUGF0aCkge1xuICAgICAgICBzb3VyY2VNYXAuc291cmNlcyA9IFtpbnB1dEZpbGVQYXRoXTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHNvdXJjZU1hcC5zb3VyY2VzID0gWycnXTtcbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgLy8gVE9ETzogZmlndXJlIG91dCBpZiB3ZSBzaG91bGQgaW5saW5lIHNvdXJjZXMgaGVyZS5cbiAgICAgIHRyYW5zZm9ybWVkQ29udGVudCA9IHRyYW5zZm9ybWVkQ29udGVudC5yZXBsYWNlKHVybFJlZ0V4cCwgJycpO1xuICAgICAgc291cmNlTWFwLmZpbGUgPSAnJztcbiAgICAgIHNvdXJjZU1hcC5zb3VyY2VzID0gWycnXTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4ge1xuICAgIGNvbnRlbnQ6IHRyYW5zZm9ybWVkQ29udGVudCxcbiAgICBzb3VyY2VNYXAsXG4gICAgZW1pdFNraXBwZWQ6IGZhbHNlLFxuICB9O1xufVxuIl19 |
@@ -0,1 +1,7 @@ | ||
export interface Replacement { | ||
start: number; | ||
end: number; | ||
content: string; | ||
} | ||
export declare function purifyReplacements(content: string): Replacement[]; | ||
export declare function purify(content: string): string; |
@@ -10,14 +10,49 @@ "use strict"; | ||
*/ | ||
const webpack_sources_1 = require("webpack-sources"); | ||
// This matches a comment left by the build-optimizer that contains pure import paths | ||
const importCommentRegex = /\/\*\* PURE_IMPORTS_START (\S+) PURE_IMPORTS_END \*\//mg; | ||
// TODO: handle sourcemaps | ||
function purify(content) { | ||
function purifyReplacements(content) { | ||
const pureImportMatches = getMatches(content, importCommentRegex, 1).join('|'); | ||
const newContent = content | ||
.replace(new RegExp(`(_(${pureImportMatches})__ = )(__webpack_require__\\(\\S+\\);)`, 'mg'), '$1/*@__PURE__*/$3') | ||
.replace(new RegExp(`(_(${pureImportMatches})___default = )(__webpack_require__\\.\\w\\(\\S+\\);)`, 'mg'), '$1/*@__PURE__*/$3') | ||
.replace(/\w*__WEBPACK_IMPORTED_MODULE_\d+__angular_core__\["\w+" \/\* (ɵccf|ɵcmf|ɵcrt) \*\/\]\(/mg, '/*@__PURE__*/$&') | ||
.replace(/new \w*__WEBPACK_IMPORTED_MODULE_\d+__angular_core__\["\w+" \/\* NgModuleFactory \*\/\]/mg, '/*@__PURE__*/$&'); | ||
return newContent; | ||
const replacements = []; | ||
const addReplacement = (start, length, content) => replacements.push({ | ||
start, | ||
end: start + length - 1, | ||
content, | ||
}); | ||
/* Prefix safe imports with pure */ | ||
content.replace(new RegExp(`(_(${pureImportMatches})__ = )(__webpack_require__\\(\\S+\\);)`, 'mg'), (match, p1, _p2, p3, offset) => { | ||
const newContent = `${p1}/*@__PURE__*/${p3}`; | ||
addReplacement(offset, match.length, newContent); | ||
return newContent; | ||
}); | ||
/* Prefix default safe imports with pure */ | ||
content.replace(new RegExp(`(_(${pureImportMatches})___default = )(__webpack_require__\\.\\w\\(\\S+\\);)`, 'mg'), (match, p1, _p2, p3, offset) => { | ||
const newContent = `${p1}/*@__PURE__*/${p3}`; | ||
addReplacement(offset, match.length, newContent); | ||
return newContent; | ||
}); | ||
/* Prefix CCF and CMF statements */ | ||
content.replace(/\w*__WEBPACK_IMPORTED_MODULE_\d+__angular_core__\["\w+" \/\* (ɵccf|ɵcmf|ɵcrt) \*\/\]\(/mg, (match, _p1, offset) => { | ||
const newContent = `/*@__PURE__*/${match}`; | ||
addReplacement(offset, match.length, newContent); | ||
return newContent; | ||
}); | ||
/* Prefix module statements */ | ||
content.replace(/new \w*__WEBPACK_IMPORTED_MODULE_\d+__angular_core__\["\w+" \/\* NgModuleFactory \*\/\]/mg, (match, offset) => { | ||
const newContent = `/*@__PURE__*/${match}`; | ||
addReplacement(offset, match.length, newContent); | ||
return newContent; | ||
}); | ||
return replacements; | ||
} | ||
exports.purifyReplacements = purifyReplacements; | ||
function purify(content) { | ||
const rawSource = new webpack_sources_1.RawSource(content); | ||
const replaceSource = new webpack_sources_1.ReplaceSource(rawSource, 'file.js'); | ||
const replacements = purifyReplacements(content); | ||
replacements.forEach((replacement) => { | ||
replaceSource.replace(replacement.start, replacement.end, replacement.content); | ||
}); | ||
return replaceSource.source(); | ||
} | ||
exports.purify = purify; | ||
@@ -33,2 +68,2 @@ function getMatches(str, regex, index) { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVyaWZ5LmpzIiwic291cmNlUm9vdCI6Ii9Vc2Vycy9oYW5zbC9Tb3VyY2VzL2RldmtpdC8iLCJzb3VyY2VzIjpbInBhY2thZ2VzL2FuZ3VsYXJfZGV2a2l0L2J1aWxkX29wdGltaXplci9zcmMvcHVyaWZ5L3B1cmlmeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7R0FNRztBQUNILHFGQUFxRjtBQUNyRixNQUFNLGtCQUFrQixHQUFHLHlEQUF5RCxDQUFDO0FBRXJGLDBCQUEwQjtBQUMxQixnQkFBdUIsT0FBZTtJQUVwQyxNQUFNLGlCQUFpQixHQUFHLFVBQVUsQ0FBQyxPQUFPLEVBQUUsa0JBQWtCLEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBRS9FLE1BQU0sVUFBVSxHQUFHLE9BQU87U0FFdkIsT0FBTyxDQUFDLElBQUksTUFBTSx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Jhd1NvdXJjZShjb250ZW50KTtcbiAgY29uc3QgcmVwbGFjZVNvdXJjZSA9IG5ldyBSZXBsYWNlU291cmNlKHJhd1NvdXJjZSwgJ2ZpbGUuanMnKTtcblxuICBjb25zdCByZXBsYWNlbWVudHMgPSBwdXJpZnlSZXBsYWNlbWVudHMoY29udGVudCk7XG4gIHJlcGxhY2VtZW50cy5mb3JFYWNoKChyZXBsYWNlbWVudCkgPT4ge1xuICAgIHJlcGxhY2VTb3VyY2UucmVwbGFjZShyZXBsYWNlbWVudC5zdGFydCwgcmVwbGFjZW1lbnQuZW5kLCByZXBsYWNlbWVudC5jb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHJlcGxhY2VTb3VyY2Uuc291cmNlKCk7XG59XG5cbmZ1bmN0aW9uIGdldE1hdGNoZXMoc3RyOiBzdHJpbmcsIHJlZ2V4OiBSZWdFeHAsIGluZGV4OiBudW1iZXIpIHtcbiAgbGV0IG1hdGNoZXM6IHN0cmluZ1tdID0gW107XG4gIGxldCBtYXRjaDtcbiAgLy8gdHNsaW50OmRpc2FibGUtbmV4dC1saW5lOm5vLWNvbmRpdGlvbmFsLWFzc2lnbm1lbnRcbiAgd2hpbGUgKG1hdGNoID0gcmVnZXguZXhlYyhzdHIpKSB7XG4gICAgbWF0Y2hlcyA9IG1hdGNoZXMuY29uY2F0KG1hdGNoW2luZGV4XS5zcGxpdCgnLCcpKTtcbiAgfVxuXG4gIHJldHVybiBtYXRjaGVzO1xufVxuIl19 |
@@ -15,4 +15,8 @@ "use strict"; | ||
.forEach((fileName) => { | ||
const purified = purify_1.purify(compilation.assets[fileName].source()); | ||
compilation.assets[fileName] = new webpack_sources_1.ConcatSource(new webpack_sources_1.RawSource(purified)); | ||
const replacements = purify_1.purifyReplacements(compilation.assets[fileName].source()); | ||
const replaceSource = new webpack_sources_1.ReplaceSource(compilation.assets[fileName], fileName); | ||
replacements.forEach((replacement) => { | ||
replaceSource.replace(replacement.start, replacement.end, replacement.content); | ||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0cycsIChjaHVua3M6IENodW5rW10sIGNhbGxiYWNrOiAoKSA9PiB2b2lkKSA9PiB7XG4gICAgICAgIGNodW5rcy5mb3JFYWNoKChjaHVuazogQ2h1bmspID0+IHtcbiAgICAgICAgICBjaHVuay5maWxlc1xuICAgICAgICAgICAgLmZpbHRlcigoZmlsZU5hbWU6IHN0cmluZykgPT4gZmlsZU5hbWUuZW5kc1dpdGgoJy5qcycpKVxuICAgICAgICAgICAgLmZvckVhY2goKGZpbGVOYW1lOiBzdHJpbmcpID0+IHtcbiAgICAgICAgICAgICAgY29uc3QgcHVyaWZpZWQ6IHN0cmluZyA9IHB1cmlmeShjb21waWxhdGlvbi5hc3NldHNbZmlsZU5hbWVdLnNvdXJjZSgpKTtcbiAgICAgICAgICAgICAgY29tcGlsYXRpb24uYXNzZXRzW2ZpbGVOYW1lXSA9IG5ldyBDb25jYXRTb3VyY2UobmV3IFJhd1NvdXJjZShwdXJpZmllZCkpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBjYWxsYmFjaygpO1xuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2VicGFjay1wbHVnaW4uanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hhbnNsL1NvdXJjZXMvZGV2a2l0LyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy9wdXJpZnkvd2VicGFjay1wbHVnaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFRQSxxREFBZ0Q7QUFDaEQscUNBQThDO0FBTzlDO0lBQ0UsZ0JBQWdCLENBQUM7SUFDVixLQUFLLENBQUMsUUFBMEI7UUFDckMsa0NBQWtDO1FBQ2xDLFFBQVEsQ0FBQyxNQUFNLENBQUMsYUFBYSxFQUFFLENBQUMsV0FB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9yRWFjaCgoZmlsZU5hbWU6IHN0cmluZykgPT4ge1xuICAgICAgICAgICAgICBjb25zdCByZXBsYWNlbWVudHMgPSBwdXJpZnlSZXBsYWNlbWVudHMoY29tcGlsYXRpb24uYXNzZXRzW2ZpbGVOYW1lXS5zb3VyY2UoKSk7XG4gICAgICAgICAgICAgIGNvbnN0IHJlcGxhY2VTb3VyY2UgPSBuZXcgUmVwbGFjZVNvdXJjZShjb21waWxhdGlvbi5hc3NldHNbZmlsZU5hbWVdLCBmaWxlTmFtZSk7XG4gICAgICAgICAgICAgIHJlcGxhY2VtZW50cy5mb3JFYWNoKChyZXBsYWNlbWVudCkgPT4ge1xuICAgICAgICAgICAgICAgIHJlcGxhY2VTb3VyY2UucmVwbGFjZShyZXBsYWNlbWVudC5zdGFydCwgcmVwbGFjZW1lbnQuZW5kLCByZXBsYWNlbWVudC5jb250ZW50KTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIGNvbXBpbGF0aW9uLmFzc2V0c1tmaWxlTmFtZV0gPSByZXBsYWNlU291cmNlO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBjYWxsYmFjaygpO1xuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ== |
@@ -21,24 +21,24 @@ "use strict"; | ||
exports.testWrapEnums = testWrapEnums; | ||
function isBlockLike(node) { | ||
return node.kind === ts.SyntaxKind.Block | ||
|| node.kind === ts.SyntaxKind.ModuleBlock | ||
|| node.kind === ts.SyntaxKind.CaseClause | ||
|| node.kind === ts.SyntaxKind.DefaultClause | ||
|| node.kind === ts.SyntaxKind.SourceFile; | ||
} | ||
// NOTE: 'isXXXX' helper functions can be replaced with native TS helpers with TS 2.4+ | ||
function isVariableStatement(node) { | ||
return node.kind === ts.SyntaxKind.VariableStatement; | ||
} | ||
function isIdentifier(node) { | ||
return node.kind === ts.SyntaxKind.Identifier; | ||
} | ||
function isObjectLiteralExpression(node) { | ||
return node.kind === ts.SyntaxKind.ObjectLiteralExpression; | ||
} | ||
function getWrapEnumsTransformer() { | ||
return (context) => { | ||
const transformer = (sf) => { | ||
const enums = findEnumDeclarations(sf); | ||
const dropNodes = enums.reduce((acc, curr) => acc.concat(curr.dropNodes), []); | ||
const visitor = (node) => { | ||
const enumData = enums.find((e) => e.hostNode === node); | ||
if (enumData) { | ||
// Replace node with a wrapped enum. | ||
return ts.visitEachChild(createWrappedEnum(enumData), visitor, context); | ||
} | ||
// Drop enum nodes we relocated. | ||
if (dropNodes.find((n) => n === node)) { | ||
// According to @mhegazy returning undefined is supported. | ||
// https://github.com/Microsoft/TypeScript/pull/17044 | ||
// tslint:disable-next-line:no-any | ||
return undefined; | ||
} | ||
// Otherwise return node as is. | ||
return ts.visitEachChild(node, visitor, context); | ||
}; | ||
return ts.visitNode(sf, visitor); | ||
const result = visitBlockStatements(sf.statements, context); | ||
return ts.updateSourceFileNode(sf, result); | ||
}; | ||
@@ -49,63 +49,92 @@ return transformer; | ||
exports.getWrapEnumsTransformer = getWrapEnumsTransformer; | ||
// Find all enum declarations, build a EnumData for each. | ||
function findEnumDeclarations(sourceFile) { | ||
const enums = []; | ||
const enumHoldingNodes = [ | ||
sourceFile, | ||
...ast_utils_1.collectDeepNodes(sourceFile, ts.SyntaxKind.Block), | ||
]; | ||
enumHoldingNodes.forEach((node) => { | ||
const stmts = node.statements; | ||
stmts.forEach((stmt, idx) => { | ||
// We're looking for a variable statement with more statements after it. | ||
if (idx >= stmts.length - 1 | ||
|| stmt.kind !== ts.SyntaxKind.VariableStatement) { | ||
return; | ||
function visitBlockStatements(statements, context) { | ||
// copy of statements to modify; lazy initialized | ||
let updatedStatements; | ||
const visitor = (node) => { | ||
if (isBlockLike(node)) { | ||
const result = visitBlockStatements(node.statements, context); | ||
if (result === node.statements) { | ||
return node; | ||
} | ||
const varStmt = stmt; | ||
if (varStmt.declarationList.declarations.length !== 1) { | ||
return; | ||
switch (node.kind) { | ||
case ts.SyntaxKind.Block: | ||
return ts.updateBlock(node, result); | ||
case ts.SyntaxKind.ModuleBlock: | ||
return ts.updateModuleBlock(node, result); | ||
case ts.SyntaxKind.CaseClause: | ||
const clause = node; | ||
return ts.updateCaseClause(clause, clause.expression, result); | ||
case ts.SyntaxKind.DefaultClause: | ||
return ts.updateDefaultClause(node, result); | ||
default: | ||
return node; | ||
} | ||
// We've found a single variable declaration statement, it might be the start of an enum. | ||
const maybeHostNode = varStmt; | ||
const varDecl = maybeHostNode.declarationList.declarations[0]; | ||
if (varDecl.name.kind !== ts.SyntaxKind.Identifier) { | ||
return; | ||
} | ||
else { | ||
return ts.visitEachChild(node, visitor, context); | ||
} | ||
}; | ||
// 'oIndex' is the original statement index; 'uIndex' is the updated statement index | ||
for (let oIndex = 0, uIndex = 0; oIndex < statements.length; oIndex++, uIndex++) { | ||
const currentStatement = statements[oIndex]; | ||
// these can't contain an enum declaration | ||
if (currentStatement.kind === ts.SyntaxKind.ImportDeclaration) { | ||
continue; | ||
} | ||
// enum declarations must: | ||
// * not be last statement | ||
// * be a variable statement | ||
// * have only one declaration | ||
// * have an identifer as a declaration name | ||
if (oIndex < statements.length - 1 | ||
&& isVariableStatement(currentStatement) | ||
&& currentStatement.declarationList.declarations.length === 1) { | ||
const variableDeclaration = currentStatement.declarationList.declarations[0]; | ||
if (isIdentifier(variableDeclaration.name)) { | ||
const name = variableDeclaration.name.text; | ||
if (!variableDeclaration.initializer) { | ||
const enumStatements = findTs2_3EnumStatements(name, statements[oIndex + 1]); | ||
if (enumStatements.length > 0) { | ||
// found an enum | ||
if (!updatedStatements) { | ||
updatedStatements = statements.slice(); | ||
} | ||
// create wrapper and replace variable statement and IIFE | ||
updatedStatements.splice(uIndex, 2, createWrappedEnum(name, currentStatement, enumStatements)); | ||
// skip IIFE statement | ||
oIndex++; | ||
continue; | ||
} | ||
} | ||
else if (isObjectLiteralExpression(variableDeclaration.initializer) | ||
&& variableDeclaration.initializer.properties.length === 0) { | ||
const nextStatements = statements.slice(oIndex + 1); | ||
const enumStatements = findTs2_2EnumStatements(name, nextStatements); | ||
if (enumStatements.length > 0) { | ||
// found an enum | ||
if (!updatedStatements) { | ||
updatedStatements = statements.slice(); | ||
} | ||
// create wrapper and replace variable statement and enum member statements | ||
updatedStatements.splice(uIndex, enumStatements.length + 1, createWrappedEnum(name, currentStatement, enumStatements)); | ||
// skip enum member declarations | ||
oIndex += enumStatements.length; | ||
continue; | ||
} | ||
} | ||
} | ||
const maybeName = varDecl.name.text; | ||
const enumStatements = [], enumDropNodes = []; | ||
// Try to figure out the enum type from the variable declaration. | ||
if (!varDecl.initializer) { | ||
// Typescript 2.3 enums have no initializer. | ||
const nextStatement = stmts[idx + 1]; | ||
enumStatements.push(...findTs2_3EnumStatements(maybeName, nextStatement)); | ||
enumDropNodes.push(nextStatement); | ||
} | ||
const result = ts.visitNode(currentStatement, visitor); | ||
if (result !== currentStatement) { | ||
if (!updatedStatements) { | ||
updatedStatements = statements.slice(); | ||
} | ||
else if (varDecl.initializer | ||
&& varDecl.initializer.kind === ts.SyntaxKind.ObjectLiteralExpression | ||
&& varDecl.initializer.properties.length === 0) { | ||
// Typescript 2.2 enums have a {} initializer. | ||
const nextStatements = stmts.slice(idx + 1); | ||
const statements = findTs2_2EnumStatements(maybeName, nextStatements); | ||
// We have to create new statements so we can keep new ones and drop old ones. | ||
enumStatements.push(...statements.map(stmt => ts.createStatement(stmt.expression))); | ||
enumDropNodes.push(...statements); | ||
} | ||
else { | ||
return; | ||
} | ||
if (enumStatements.length === 0) { | ||
return; | ||
} | ||
enums.push({ | ||
name: maybeName, | ||
hostNode: maybeHostNode, | ||
statements: enumStatements, | ||
dropNodes: enumDropNodes, | ||
}); | ||
}); | ||
}); | ||
return enums; | ||
updatedStatements[uIndex] = result; | ||
} | ||
} | ||
// if changes, return updated statements | ||
// otherwise, return original array instance | ||
return updatedStatements ? updatedStatements : statements; | ||
} | ||
// TS 2.3 enums have statements are inside a IIFE. | ||
// TS 2.3 enums have statements that are inside a IIFE. | ||
function findTs2_3EnumStatements(name, statement) { | ||
@@ -197,5 +226,4 @@ const enumStatements = []; | ||
} | ||
function createWrappedEnum(enumData) { | ||
function createWrappedEnum(name, hostNode, statements) { | ||
const pureFunctionComment = '@__PURE__'; | ||
const { name, statements } = enumData; | ||
const innerVarStmt = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ | ||
@@ -205,2 +233,3 @@ ts.createVariableDeclaration(name, undefined, ts.createObjectLiteral()), | ||
const innerReturn = ts.createReturn(ts.createIdentifier(name)); | ||
// NOTE: TS 2.4+ has a create IIFE helper method | ||
const iife = ts.createCall(ts.createParen(ts.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, ts.createBlock([ | ||
@@ -211,8 +240,9 @@ innerVarStmt, | ||
]))), undefined, []); | ||
// Create a new node with the pure comment before the variable declaration initializer. | ||
const outerVarStmt = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ | ||
ts.createVariableDeclaration(name, undefined, ts.addSyntheticLeadingComment(iife, ts.SyntaxKind.MultiLineCommentTrivia, pureFunctionComment, false)), | ||
// Update existing host node with the pure comment before the variable declaration initializer. | ||
const variableDeclaration = hostNode.declarationList.declarations[0]; | ||
const outerVarStmt = ts.updateVariableStatement(hostNode, hostNode.modifiers, ts.updateVariableDeclarationList(hostNode.declarationList, [ | ||
ts.updateVariableDeclaration(variableDeclaration, variableDeclaration.name, variableDeclaration.type, ts.addSyntheticLeadingComment(iife, ts.SyntaxKind.MultiLineCommentTrivia, pureFunctionComment, false)), | ||
])); | ||
return outerVarStmt; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3JhcC1lbnVtcy5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvaGFuc2wvU291cmNlcy9kZXZraXQvIiwic291cmNlcyI6WyJwYWNrYWdlcy9hbmd1bGFyX2RldmtpdC9idWlsZF9vcHRpbWl6ZXIvc3JjL3RyYW5zZm9ybXMvd3JhcC1lbnVtcy50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0ZW1lbnRzLFxuICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICAvLyBza2lwIElJRkUgc3RhdGVtZW50XG4gICAgICAgICAgICBvSW5kZXgrKztcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChpc09iamVjdExpdGVyYWxFeHByZXNzaW9uKHZhcmlhYmxlRGVjbGFyYXRpb24uaW5pdGlhbGl6ZXIpXG4gICAgICAgICAgICAgICAgICAgJiYgdmFyaWFibGVEZWNsYXJhdGlvbi5pbml0aWFsaXplci5wcm9wZXJ0aWVzLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgIGNvbnN0IG5leHRTdGF0ZW1lbnRzID0gc3RhdGVtZW50cy5zbGljZShvSW5kZXggKyAxKTtcbiAgICAgICAgICBjb25zdCBlbnVtU3RhdGVtZW50cyA9IGZpbmRUczJfMkVudW1TdGF0ZW1lbnRzKG5hbWUsIG5leHRTdGF0ZW1lbnRzKTtcbiAgICAgICAgICBpZiAoZW51bVN0YXRlbWVudHMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgLy8gZm91bmQgYW4gZW51bVxuICAgICAgICAgICAgaWYgKCF1cGRhdGVkU3RhdGVtZW50cykge1xuICAgICAgICAgICAgICB1cGRhdGVkU3RhdGVtZW50cyA9IHN0YXRlbWVudHMuc2xpY2UoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGNyZWF0ZSB3cmFwcGVyIGFuZCByZXBsYWNlIHZhcmlhYmxlIHN0YXRlbWVudCBhbmQgZW51bSBtZW1iZXIgc3RhdGVtZW50c1xuICAgICAgICAgICAgdXBkYXRlZFN0YXRlbWVudHMuc3BsaWNlKHVJbmRleCwgZW51bVN0YXRlbWVudHMubGVuZ3RoICsgMSwgY3JlYXRlV3JhcHBlZEVudW0oXG4gICAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICAgIGN1cnJlbnRTdGF0ZW1lbnQsXG4g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0ZW1lbnRzLFxuICAgICAgICAgIGlubmVyUmV0dXJuLFxuICAgICAgICBdKSxcbiAgICAgICksXG4gICAgKSxcbiAgICB1bmRlZmluZWQsXG4gICAgW10sXG4gICk7XG5cbiAgLy8gVXBkYXRlIGV4aXN0aW5nIGhvc3Qgbm9kZSB3aXRoIHRoZSBwdXJlIGNvbW1lbnQgYmVmb3JlIHRoZSB2YXJpYWJsZSBkZWNsYXJhdGlvbiBpbml0aWFsaXplci5cbiAgY29uc3QgdmFyaWFibGVEZWNsYXJhdGlvbiA9IGhvc3ROb2RlLmRlY2xhcmF0aW9uTGlzdC5kZWNsYXJhdGlvbnNbMF07XG4gIGNvbnN0IG91dGVyVmFyU3RtdCA9IHRzLnVwZGF0ZVZhcmlhYmxlU3RhdGVtZW50KFxuICAgIGhvc3ROb2RlLFxuICAgIGhvc3ROb2RlLm1vZGlmaWVycyxcbiAgICB0cy51cGRhdGVWYXJpYWJsZURlY2xhcmF0aW9uTGlzdChcbiAgICAgIGhvc3ROb2RlLmRlY2xhcmF0aW9uTGlzdCxcbiAgICAgIFtcbiAgICAgICAgdHMudXBkYXRlVmFyaWFibGVEZWNsYXJhdGlvbihcbiAgICAgICAgICB2YXJpYWJsZURlY2xhcmF0aW9uLFxuICAgICAgICAgIHZhcmlhYmxlRGVjbGFyYXRpb24ubmFtZSxcbiAgICAgICAgICB2YXJpYWJsZURlY2xhcmF0aW9uLnR5cGUsXG4gICAgICAgICAgdHMuYWRkU3ludGhldGljTGVhZGluZ0NvbW1lbnQoXG4gICAgICAgICAgICBpaWZlLCB0cy5TeW50YXhLaW5kLk11bHRpTGluZUNvbW1lbnRUcml2aWEsIHB1cmVGdW5jdGlvbkNvbW1lbnQsIGZhbHNlLFxuICAgICAgICAgICksXG4gICAgICAgICksXG4gICAgICBdLFxuICAgICksXG4gICk7XG5cbiAgcmV0dXJuIG91dGVyVmFyU3RtdDtcbn1cbiJdfQ== |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227757
1619
3