@angular-devkit/build-optimizer
Advanced tools
Comparing version 0.0.36 to 0.0.37
{ | ||
"name": "@angular-devkit/build-optimizer", | ||
"version": "0.0.36", | ||
"version": "0.0.37", | ||
"description": "Angular Build Optimizer", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -67,11 +67,3 @@ "use strict"; | ||
const getTransforms = []; | ||
if (wrap_enums_1.testWrapEnums(content)) { | ||
getTransforms.push(wrap_enums_1.getWrapEnumsTransformer); | ||
} | ||
if (import_tslib_1.testImportTslib(content)) { | ||
getTransforms.push(import_tslib_1.getImportTslibTransformer); | ||
} | ||
if (prefix_classes_1.testPrefixClasses(content)) { | ||
getTransforms.push(prefix_classes_1.getPrefixClassesTransformer); | ||
} | ||
let typeCheck = false; | ||
if (options.isSideEffectFree || originalFilePath && isKnownSideEffectFree(originalFilePath)) { | ||
@@ -84,6 +76,20 @@ getTransforms.push( | ||
prefix_functions_1.getPrefixFunctionsTransformer, scrub_file_1.getScrubFileTransformer, class_fold_1.getFoldFileTransformer); | ||
typeCheck = true; | ||
} | ||
else if (scrub_file_1.testScrubFile(content)) { | ||
// Always test as these require the type checker | ||
getTransforms.push(scrub_file_1.getScrubFileTransformer, class_fold_1.getFoldFileTransformer); | ||
typeCheck = true; | ||
} | ||
// tests are not needed for fast path | ||
const ignoreTest = !options.emitSourceMap && !typeCheck; | ||
if (ignoreTest || prefix_classes_1.testPrefixClasses(content)) { | ||
getTransforms.unshift(prefix_classes_1.getPrefixClassesTransformer); | ||
} | ||
if (ignoreTest || import_tslib_1.testImportTslib(content)) { | ||
getTransforms.unshift(import_tslib_1.getImportTslibTransformer); | ||
} | ||
if (ignoreTest || wrap_enums_1.testWrapEnums(content)) { | ||
getTransforms.unshift(wrap_enums_1.getWrapEnumsTransformer); | ||
} | ||
const transformJavascriptOpts = { | ||
@@ -96,2 +102,3 @@ content: content, | ||
getTransforms, | ||
typeCheck, | ||
}; | ||
@@ -101,2 +108,2 @@ return transform_javascript_1.transformJavascript(transformJav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6IGNvbnRlbnQsXG4gICAgaW5wdXRGaWxlUGF0aDogb3B0aW9ucy5pbnB1dEZpbGVQYXRoLFxuICAgIG91dHB1dEZpbGVQYXRoOiBvcHRpb25zLm91dHB1dEZpbGVQYXRoLFxuICAgIGVtaXRTb3VyY2VNYXA6IG9wdGlvbnMuZW1pdFNvdXJjZU1hcCxcbiAgICBzdHJpY3Q6IG9wdGlvbnMuc3RyaWN0LFxuICAgIGdldFRyYW5zZm9ybXMsXG4gICAgdHlwZUNoZWNrLFxuICB9O1xuXG4gIHJldHVybiB0cmFuc2Zvcm1KYXZhc2NyaXB0KHRyYW5zZm9ybUphdmFzY3JpcHRPcHRzKTtcbn1cbiJdfQ== |
@@ -16,3 +16,4 @@ /** | ||
strict?: boolean; | ||
getTransforms: Array<(program: ts.Program) => ts.TransformerFactory<ts.SourceFile>>; | ||
typeCheck?: boolean; | ||
getTransforms: Array<(program?: ts.Program) => ts.TransformerFactory<ts.SourceFile>>; | ||
} | ||
@@ -19,0 +20,0 @@ export interface TransformJavascriptOutput { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ts = require("typescript"); | ||
function transformJavascript(options) { | ||
const { content, getTransforms, emitSourceMap, inputFilePath, outputFilePath, strict, } = options; | ||
// Bail if there's no transform to do. | ||
if (getTransforms.length === 0) { | ||
return { | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
} | ||
function validateDiagnostics(diagnostics, strict) { | ||
// Print error diagnostics. | ||
@@ -26,22 +17,33 @@ const checkDiagnostics = (diagnostics) => { | ||
}; | ||
const hasError = diagnostics.some(diag => diag.category === ts.DiagnosticCategory.Error); | ||
if (hasError) { | ||
// Throw only if we're in strict mode, otherwise return original content. | ||
if (strict) { | ||
throw new Error(` | ||
TS failed with the following error messages: | ||
${checkDiagnostics(diagnostics)} | ||
`); | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
function transformJavascript(options) { | ||
const { content, getTransforms, emitSourceMap, inputFilePath, outputFilePath, strict, } = options; | ||
// Bail if there's no transform to do. | ||
if (getTransforms.length === 0) { | ||
return { | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
} | ||
const allowFastPath = options.typeCheck === false && !emitSourceMap; | ||
const outputs = new Map(); | ||
const tempFilename = 'bo-default-file.js'; | ||
const tempSourceFile = ts.createSourceFile(tempFilename, content, ts.ScriptTarget.Latest); | ||
const host = { | ||
getSourceFile: (fileName) => { | ||
if (fileName !== tempFilename) { | ||
throw new Error(`File ${fileName} does not have a sourceFile.`); | ||
} | ||
return tempSourceFile; | ||
}, | ||
getDefaultLibFileName: () => 'lib.d.ts', | ||
getCurrentDirectory: () => '', | ||
getDirectories: () => [], | ||
getCanonicalFileName: (fileName) => fileName, | ||
useCaseSensitiveFileNames: () => true, | ||
getNewLine: () => '\n', | ||
fileExists: (fileName) => fileName === tempFilename, | ||
readFile: (_fileName) => '', | ||
writeFile: (fileName, text) => outputs.set(fileName, text), | ||
}; | ||
const tempSourceFile = ts.createSourceFile(tempFilename, content, ts.ScriptTarget.Latest, allowFastPath); | ||
const parseDiagnostics = tempSourceFile.parseDiagnostics; | ||
const tsOptions = { | ||
@@ -59,15 +61,13 @@ // We target latest so that there is no downleveling. | ||
}; | ||
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. | ||
if (strict) { | ||
throw new Error(` | ||
TS failed with the following error messages: | ||
${checkDiagnostics(diagnostics)} | ||
`); | ||
if (allowFastPath && parseDiagnostics) { | ||
if (!validateDiagnostics(parseDiagnostics, strict)) { | ||
return { | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
} | ||
else { | ||
const transforms = getTransforms.map((getTf) => getTf(undefined)); | ||
const result = ts.transform(tempSourceFile, transforms, tsOptions); | ||
if (result.transformed.length === 0 || result.transformed[0] === tempSourceFile) { | ||
return { | ||
@@ -79,3 +79,40 @@ content: null, | ||
} | ||
const printer = ts.createPrinter(undefined, { | ||
onEmitNode: result.emitNodeWithNotification, | ||
substituteNode: result.substituteNode, | ||
}); | ||
const output = printer.printFile(result.transformed[0]); | ||
result.dispose(); | ||
return { | ||
content: output, | ||
sourceMap: null, | ||
emitSkipped: false, | ||
}; | ||
} | ||
const host = { | ||
getSourceFile: (fileName) => { | ||
if (fileName !== tempFilename) { | ||
throw new Error(`File ${fileName} does not have a sourceFile.`); | ||
} | ||
return tempSourceFile; | ||
}, | ||
getDefaultLibFileName: () => 'lib.d.ts', | ||
getCurrentDirectory: () => '', | ||
getDirectories: () => [], | ||
getCanonicalFileName: (fileName) => fileName, | ||
useCaseSensitiveFileNames: () => true, | ||
getNewLine: () => '\n', | ||
fileExists: (fileName) => fileName === tempFilename, | ||
readFile: (_fileName) => '', | ||
writeFile: (fileName, text) => outputs.set(fileName, text), | ||
}; | ||
const program = ts.createProgram([tempFilename], tsOptions, host); | ||
const diagnostics = program.getSyntacticDiagnostics(tempSourceFile); | ||
if (!validateDiagnostics(diagnostics, strict)) { | ||
return { | ||
content: null, | ||
sourceMap: null, | ||
emitSkipped: true, | ||
}; | ||
} | ||
// We need the checker inside transforms. | ||
@@ -122,2 +159,2 @@ const transforms = getTransforms.map((getTf) => getTf(program)); | ||
exports.transformJavascript = transformJavascript; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWphdmFzY3JpcHQuanMiLCJzb3VyY2VSb290IjoiL1VzZXJzL2hhbnNsL1NvdXJjZXMvaGFuc2wvZGV2a2l0LyIsInNvdXJjZXMiOlsicGFja2FnZXMvYW5ndWxhcl9kZXZraXQvYnVpbGRfb3B0aW1pemVyL3NyYy9oZWxwZXJzL3RyYW5zZm9ybS1qYXZhc2NyaXB0LnRzIl0sIm5hb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VNYXAsXG4gICAgZW1pdFNraXBwZWQ6IGZhbHNlLFxuICB9O1xufVxuIl19 |
@@ -42,3 +42,2 @@ "use strict"; | ||
const topLevelFunctions = []; | ||
let previousNode; | ||
function cb(node) { | ||
@@ -50,26 +49,19 @@ // Stop recursing into this branch if it's a function expression or declaration | ||
} | ||
// We need to check specially for IIFEs formatted as call expressions inside parenthesized | ||
// expressions: `(function() {}())` Their start pos doesn't include the opening paren | ||
// and must be adjusted. | ||
if (isIIFE(node) | ||
&& previousNode.kind === ts.SyntaxKind.ParenthesizedExpression | ||
&& node.parent | ||
&& !hasPureComment(node.parent)) { | ||
topLevelFunctions.push(node.parent); | ||
let noPureComment = !hasPureComment(node); | ||
let innerNode = node; | ||
while (innerNode && ts.isParenthesizedExpression(innerNode)) { | ||
innerNode = innerNode.expression; | ||
noPureComment = noPureComment && !hasPureComment(innerNode); | ||
} | ||
else if ((node.kind === ts.SyntaxKind.CallExpression | ||
|| node.kind === ts.SyntaxKind.NewExpression) | ||
&& !hasPureComment(node)) { | ||
topLevelFunctions.push(node); | ||
if (!innerNode) { | ||
return; | ||
} | ||
previousNode = node; | ||
ts.forEachChild(node, cb); | ||
if (noPureComment) { | ||
if (innerNode.kind === ts.SyntaxKind.CallExpression | ||
|| innerNode.kind === ts.SyntaxKind.NewExpression) { | ||
topLevelFunctions.push(node); | ||
} | ||
} | ||
ts.forEachChild(innerNode, cb); | ||
} | ||
function isIIFE(node) { | ||
return node.kind === ts.SyntaxKind.CallExpression | ||
// This check was in the old ngo but it doesn't seem to make sense with the typings. | ||
// TODO(filipesilva): ask Alex Rickabaugh about it. | ||
// && !(<ts.CallExpression>node).expression.text | ||
&& node.expression.kind !== ts.SyntaxKind.PropertyAccessExpression; | ||
} | ||
ts.forEachChild(parentNode, cb); | ||
@@ -98,5 +90,8 @@ return topLevelFunctions; | ||
function hasPureComment(node) { | ||
if (!node) { | ||
return false; | ||
} | ||
const leadingComment = ts.getSyntheticLeadingComments(node); | ||
return leadingComment && leadingComment.some((comment) => comment.text === pureFunctionComment); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlZml4LWZ1bmN0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvaGFuc2wvU291cmNlcy9oYW5zbC9kZXZraXQvIiwic291cmNlcyI6WyJwYWNrYWdlcy9hbmd1bGFyX2RldmtpdC9idWlsZF9vcHRpbWl6ZXIvc3JjL3RyYW5zZm9ybXMvcHJlZml4LWZ1bmN0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7R0FNRztBQUNILGlDQUFpQztBQUdqQyxNQUFNLG1CQUFtQixHQUFHLFdBQVcsQ0FBQztBQUV4QztJQUNFLE1BQU0sQ0FBQyxDQUFDLE9BQWlDLEVBQWlDLEVBQUU7UUFDMUUsTUFBTSxXQUFXLEdBQWtDLENBQUMsRUFBaUIsRUFBRSxFQUFFO1lBRXZFLE1BQU0saUJBQWlCLEdBQUcscUJBQXFCLENBQUMsRUFBRSxDQUFDLENBQUM7WUFDcEQsTUFBTSxXQUFXLEdBQUcsZUFBZSxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQ3hDLE1BQU0sa0JBQWtCLEdBQUcsd0JBQXdCLFdBQVcsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLG9CQUFvQixDQUFDO1lBRTdGLE1BQU0sT0FBTyxHQUFlLENBQUMsSUFBYSxFQUFXLEVBQUU7Z0JBRXJELGtEQUFrRDtnQkFDbEQsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sSUFBSSxJQUFJLENBQUMsTUFBTSxDQUFDLE1BQU0sS0FBSyxTQUFTLElBQUksSUFBSSxDQUFDLEdBQUcsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDO29CQUN0RSxNQUFNLE9BQU8sR0FBRyxFQUFFLENBQUMsMEJBQTBCLENBQzNDLElBQUksR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5yZXBsYWNlKC9eXFwuKy8sICcnKTtcbiAgICAgIHB1cmVJbXBvcnRzLnB1c2gocHVyZUltcG9ydCk7XG4gICAgfVxuXG4gICAgdHMuZm9yRWFjaENoaWxkKG5vZGUsIGNiKTtcbiAgfVxuXG4gIHJldHVybiBwdXJlSW1wb3J0cztcbn1cblxuZnVuY3Rpb24gaGFzUHVyZUNvbW1lbnQobm9kZTogdHMuTm9kZSkge1xuICBpZiAoIW5vZGUpIHtcbiAgICByZXR1cm4gZmFsc2U7XG4gIH1cbiAgY29uc3QgbGVhZGluZ0NvbW1lbnQgPSB0cy5nZXRTeW50aGV0aWNMZWFkaW5nQ29tbWVudHMobm9kZSk7XG5cbiAgcmV0dXJuIGxlYWRpbmdDb21tZW50ICYmIGxlYWRpbmdDb21tZW50LnNvbWUoKGNvbW1lbnQpID0+IGNvbW1lbnQudGV4dCA9PT0gcHVyZUZ1bmN0aW9uQ29tbWVudCk7XG59XG4iXX0= |
@@ -33,3 +33,3 @@ "use strict"; | ||
const result = visitBlockStatements(sf.statements, context); | ||
return ts.updateSourceFileNode(sf, result); | ||
return ts.updateSourceFileNode(sf, ts.setTextRange(result, sf.statements)); | ||
}; | ||
@@ -45,6 +45,7 @@ return transformer; | ||
if (isBlockLike(node)) { | ||
const result = visitBlockStatements(node.statements, context); | ||
let result = visitBlockStatements(node.statements, context); | ||
if (result === node.statements) { | ||
return node; | ||
} | ||
result = ts.setTextRange(result, node.statements); | ||
switch (node.kind) { | ||
@@ -87,4 +88,4 @@ case ts.SyntaxKind.Block: | ||
if (!variableDeclaration.initializer) { | ||
const enumStatements = findTs2_3EnumStatements(name, statements[oIndex + 1]); | ||
if (enumStatements.length > 0) { | ||
const iife = findTs2_3EnumIife(name, statements[oIndex + 1]); | ||
if (iife) { | ||
// found an enum | ||
@@ -94,4 +95,4 @@ if (!updatedStatements) { | ||
} | ||
// create wrapper and replace variable statement and IIFE | ||
updatedStatements.splice(uIndex, 2, createWrappedEnum(name, currentStatement, enumStatements, undefined)); | ||
// update IIFE and replace variable statement and old IIFE | ||
updatedStatements.splice(uIndex, 2, updateEnumIife(currentStatement, iife)); | ||
// skip IIFE statement | ||
@@ -104,4 +105,3 @@ oIndex++; | ||
&& variableDeclaration.initializer.properties.length === 0) { | ||
const nextStatements = statements.slice(oIndex + 1); | ||
const enumStatements = findTs2_2EnumStatements(name, nextStatements); | ||
const enumStatements = findTs2_2EnumStatements(name, statements, oIndex + 1); | ||
if (enumStatements.length > 0) { | ||
@@ -122,4 +122,3 @@ // found an enum | ||
const literalPropertyCount = variableDeclaration.initializer.properties.length; | ||
const nextStatements = statements.slice(oIndex + 1); | ||
const enumStatements = findTsickleEnumStatements(name, nextStatements); | ||
const enumStatements = findTsickleEnumStatements(name, statements, oIndex + 1); | ||
if (enumStatements.length === literalPropertyCount) { | ||
@@ -152,5 +151,6 @@ // found an enum | ||
// TS 2.3 enums have statements that are inside a IIFE. | ||
function findTs2_3EnumStatements(name, statement) { | ||
const enumStatements = []; | ||
const noNodes = []; | ||
function findTs2_3EnumIife(name, statement) { | ||
if (!ts.isExpressionStatement(statement) || !ts.isCallExpression(statement.expression)) { | ||
return null; | ||
} | ||
const funcExpr = ast_utils_1.drilldownNodes(statement, [ | ||
@@ -163,3 +163,3 @@ { prop: null, kind: ts.SyntaxKind.ExpressionStatement }, | ||
if (funcExpr === null) { | ||
return noNodes; | ||
return null; | ||
} | ||
@@ -169,3 +169,3 @@ if (!(funcExpr.parameters.length === 1 | ||
&& funcExpr.parameters[0].name.text === name)) { | ||
return noNodes; | ||
return null; | ||
} | ||
@@ -180,8 +180,7 @@ // In TS 2.3 enums, the IIFE contains only expressions with a certain format. | ||
if (innerBinExpr === null) { | ||
return noNodes; | ||
return null; | ||
} | ||
const exprStmt = innerStmt; | ||
if (!(innerBinExpr.operatorToken.kind === ts.SyntaxKind.FirstAssignment | ||
&& innerBinExpr.left.kind === ts.SyntaxKind.ElementAccessExpression)) { | ||
return noNodes; | ||
return null; | ||
} | ||
@@ -193,7 +192,7 @@ const innerElemAcc = innerBinExpr.left; | ||
&& innerElemAcc.argumentExpression.kind === ts.SyntaxKind.BinaryExpression)) { | ||
return noNodes; | ||
return null; | ||
} | ||
const innerArgBinExpr = innerElemAcc.argumentExpression; | ||
if (innerArgBinExpr.left.kind !== ts.SyntaxKind.ElementAccessExpression) { | ||
return noNodes; | ||
return null; | ||
} | ||
@@ -203,17 +202,16 @@ const innerArgElemAcc = innerArgBinExpr.left; | ||
&& innerArgElemAcc.expression.text === name)) { | ||
return noNodes; | ||
return null; | ||
} | ||
enumStatements.push(exprStmt); | ||
} | ||
return enumStatements; | ||
return statement.expression; | ||
} | ||
// TS 2.2 enums have statements after the variable declaration, with index statements followed | ||
// by value statements. | ||
function findTs2_2EnumStatements(name, statements) { | ||
function findTs2_2EnumStatements(name, statements, statementOffset) { | ||
const enumStatements = []; | ||
let beforeValueStatements = true; | ||
for (const stmt of statements) { | ||
for (let index = statementOffset; index < statements.length; index++) { | ||
// Ensure all statements are of the expected format and using the right identifer. | ||
// When we find a statement that isn't part of the enum, return what we collected so far. | ||
const binExpr = ast_utils_1.drilldownNodes(stmt, [ | ||
const binExpr = ast_utils_1.drilldownNodes(statements[index], [ | ||
{ prop: null, kind: ts.SyntaxKind.ExpressionStatement }, | ||
@@ -227,3 +225,3 @@ { prop: 'expression', kind: ts.SyntaxKind.BinaryExpression }, | ||
} | ||
const exprStmt = stmt; | ||
const exprStmt = statements[index]; | ||
const leftExpr = binExpr.left; | ||
@@ -247,27 +245,52 @@ if (!(leftExpr.expression.kind === ts.SyntaxKind.Identifier | ||
// See https://github.com/angular/devkit/issues/229#issuecomment-338512056 fore more information. | ||
function findTsickleEnumStatements(name, statements) { | ||
function findTsickleEnumStatements(name, statements, statementOffset) { | ||
const enumStatements = []; | ||
// let beforeValueStatements = true; | ||
for (const stmt of statements) { | ||
for (let index = statementOffset; index < statements.length; index++) { | ||
// Ensure all statements are of the expected format and using the right identifer. | ||
// When we find a statement that isn't part of the enum, return what we collected so far. | ||
const binExpr = ast_utils_1.drilldownNodes(stmt, [ | ||
const access = ast_utils_1.drilldownNodes(statements[index], [ | ||
{ prop: null, kind: ts.SyntaxKind.ExpressionStatement }, | ||
{ prop: 'expression', kind: ts.SyntaxKind.BinaryExpression }, | ||
{ prop: 'left', kind: ts.SyntaxKind.ElementAccessExpression }, | ||
]); | ||
if (binExpr === null || binExpr.left.kind !== ts.SyntaxKind.ElementAccessExpression) { | ||
return enumStatements; | ||
if (!access) { | ||
break; | ||
} | ||
const exprStmt = stmt; | ||
const leftExpr = binExpr.left; | ||
if (!(leftExpr.expression.kind === ts.SyntaxKind.Identifier | ||
&& leftExpr.expression.text === name)) { | ||
return enumStatements; | ||
if (!ts.isIdentifier(access.expression) || access.expression.text !== name) { | ||
break; | ||
} | ||
enumStatements.push(exprStmt); | ||
if (!access.argumentExpression || !ts.isPropertyAccessExpression(access.argumentExpression)) { | ||
break; | ||
} | ||
const enumExpression = access.argumentExpression.expression; | ||
if (!ts.isIdentifier(enumExpression) || enumExpression.text !== name) { | ||
break; | ||
} | ||
enumStatements.push(statements[index]); | ||
} | ||
return enumStatements; | ||
} | ||
function updateHostNode(hostNode, expression) { | ||
const pureFunctionComment = '@__PURE__'; | ||
// 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(expression, ts.SyntaxKind.MultiLineCommentTrivia, pureFunctionComment, false)), | ||
])); | ||
return outerVarStmt; | ||
} | ||
function updateEnumIife(hostNode, iife) { | ||
if (!ts.isParenthesizedExpression(iife.expression) | ||
|| !ts.isFunctionExpression(iife.expression.expression)) { | ||
throw new Error('Invalid IIFE Structure'); | ||
} | ||
const expression = iife.expression.expression; | ||
const updatedFunction = ts.updateFunctionExpression(expression, expression.modifiers, expression.asteriskToken, expression.name, expression.typeParameters, expression.parameters, expression.type, ts.updateBlock(expression.body, [ | ||
...expression.body.statements, | ||
ts.createReturn(expression.parameters[0].name), | ||
])); | ||
const updatedIife = ts.updateCall(iife, ts.updateParen(iife.expression, updatedFunction), iife.typeArguments, [ts.createObjectLiteral()]); | ||
return updateHostNode(hostNode, updatedIife); | ||
} | ||
function createWrappedEnum(name, hostNode, statements, literalInitializer) { | ||
const pureFunctionComment = '@__PURE__'; | ||
literalInitializer = literalInitializer || ts.createObjectLiteral(); | ||
@@ -278,15 +301,9 @@ const innerVarStmt = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ | ||
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([ | ||
const iife = ts.createImmediatelyInvokedFunctionExpression([ | ||
innerVarStmt, | ||
...statements, | ||
innerReturn, | ||
]))), undefined, []); | ||
// 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; | ||
]); | ||
return updateHostNode(hostNode, ts.createParen(iife)); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3JhcC1lbnVtcy5qcyIsInNvdXJjZVJvb3QiOiIvVXNlcnMvaGFuc2wvU291cmNlcy9oYW5zbC9kZXZraXQvIiwic291cmNlcyI6WyJwYWNrYWdlcy9hbmd1bGFyX2RldmtpdC9idWlsZF9vcHR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AgICAgICAgIG9JbmRleCsrO1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKHRzLmlzT2JqZWN0TGl0ZXJhbEV4cHJlc3Npb24odmFyaWFibGVEZWNsYXJhdGlvbi5pbml0aWFsaXplcilcbiAgICAgICAgICAgICAgICAgICAmJiB2YXJpYWJsZURlY2xhcmF0aW9uLmluaXRpYWxpemVyLnByb3BlcnRpZXMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgY29uc3QgbmV4dFN0YXRlbWVudHMgPSBzdGF0ZW1lbnRzLnNsaWNlKG9JbmRleCArIDEpO1xuICAgICAgICAgIGNvbnN0IGVudW1TdGF0ZW1lbnRzID0gZmluZFRzMl8yRW51bVN0YXRlbWVudHMobmFtZSwgbmV4dFN0YXRlbWVudHMpO1xuICAgICAgICAgIGlmIChlbnVtU3RhdGVtZW50cy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgICAvLyBmb3VuZCBhbiBlbnVtXG4gICAgICAgICAgICBpZiAoIXVwZGF0ZWRTdGF0ZW1lbnRzKSB7XG4gICAgICAgICAgICAgIHVwZGF0ZWRTdGF0ZW1lbnRzID0gc3RhdGVtZW50cy5zbGljZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gY3JlYXRlIHdyYXBwZXIgYW5kIHJlcGxhY2UgdmFyaWFibGUgc3RhdGVtZW50IGFuZCBlbnVtIG1lbWJlciBzdGF0ZW1lbnRzXG4gICAgICAgICAgICB1cGRhdGVkU3RhdGVtZW50cy5zcGxpY2UodUluZGV4LCBlbnVtU3RhdGVtZW50cy5sZW5ndGggKyAxLCBjcmVhdGVXcmFwcGVkRW51bShcbiAgICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgICAgY3VycmVudFN0YXRlbWVudCxcbiAgICAgICAgICAgICAgZW51bVN0YXRlbWVudHMsXG4gICAgICAgICAgICAgIHZhcmlhYmxlRGVjbGFyYXRpb24uaW5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HZhcmlhYmxlRGVjbGFyYXRpb24ubmFtZS50ZXh0O1xuXG4gICAgICAgIGlmICghdmFyaWFibGVEZWNsYXJhdGlvbi5pbml0aWFsaXplcikge1xuICAgICAgICAgIGNvbnN0IGlpZmUgPSBmaW5kVHMyXzNFbnVtSWlmZShuYW1lLCBzdGF0ZW1lbnRzW29JbmRleCArIDFdKTtcbiAgICAgICAgICBpZiAoaWlmZSkge1xuICAgICAgICAgICAgLy8gZm91bmQgYW4gZW51bVxuICAgICAgICAgICAgaWYgKCF1cGRhdGVkU3RhdGVtZW50cykge1xuICAgICAgICAgICAgICB1cGRhdGVkU3RhdGVtZW50cyA9IHN0YXRlbWVudHMuc2xpY2UoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIHVwZGF0ZSBJSUZFIGFuZCByZXBsYWNlIHZhcmlhYmxlIHN0YXRlbWVudCBhbmQgb2xkIElJRkVcbiAgICAgICAgICAgIHVwZGF0ZWRTdGF0ZW1lbnRzLnNwbGljZSh1SW5kZXgsIDIsIHVwZGF0ZUVudW1JaWZlKFxuICAgICAgICAgICAgICBjdXJyZW50U3RhdGVtZW50LFxuICAgICAgICAgICAgICBpaWZlLFxuICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICAvLyBza2lwIElJRkUgc3RhdGVtZW50XG4gICAgICAgICAgICBvSW5kZXgrKztcbiAgICAgICAgICAgIGNvbnRpbnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmICh0cy5pc09iamVjdExpdGVyYWxFeHByZXNzaW9uKHZhcmlhYmxlRGVjbGFyYXRpb24uaW5pdGlhbGl6ZXIpXG4gICAgICAgICAgICAgICAgICAgJiYgdmFyaWFibGVEZWNsYXJhdGlvbi5pbml0aWFsaXplci5wcm9wZXJ0aWVzLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgIGNvbnN0IGVudW1TdGF0ZW1lbnRzID0gZmluZFRzMl8yRW51bVN0YXRlbWVudHMobmFtZSwgc3RhdGVtZW50cywgb0luZGV4ICsgMSk7XG4gICAgICAgICAgaWYgKGVudW1TdGF0ZW1lbnRzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgIC8vIGZvdW5kIGFuIGVudW1cbiAgICAgICAgICAgIGlmICghdXBkYXRlZFN0YXRlbWVudHMpIHtcbiAgICAgICAgICAgICAgdXBkYXRlZFN0YXRlbWVudHMgPSBzdGF0ZW1lbnRzLnNsaWNlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBjcmVhdGUgd3JhcHBlciBhbmQgcmVwbGFjZSB2YXJpYWJsZSBzdGF0ZW1lbnQgYW5kIGVudW0gbWVtYmVyIHN0YXRlbWVudHNcbiAgICAgICAgICAgIHVwZGF0ZWRTdGF0ZW1lbnRzLnNwbGljZSh1SW5kZXgsIGVudW1TdGF0ZW1lbnRzLmxlbmd0aCArIDEsIGNyZWF0ZVdyYXBwZWRFbnVtKFxuICAgICAgICAgICAgICBuYW1lLFxuICAgICAgICAgICAgICBjdXJyZW50U3RhdGVtZW50LFxuICAgICAgICAgICAgICBlbnVtU3RhdGVtZW50cyxcbiAgICAgICAgICAgICAgdmFyaWFibGVEZWNsYXJhdGlvbi5pbml0aWFsaXplcixcbiAgICAgICAgICAgICkpO1xuICAgICAgICAgICAgLy8gc2tpcCBlbnVtIG1lbWJlciBkZWNsYXJhdGlvbnNcbiAgICAgICAgICAgIG9JbmRleCArPSBlbnVtU3RhdGVtZW50cy5sZW5ndGg7XG4gICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSBpZiAodHMuaXNPYmplY3RMaXRlcmFsRXhwcmVzc2lvbih2YXJpYWJsZURlY2xhcmF0aW9uLmluaXRpYWxpemVyKVxuICAgICAgICAgICYmIHZhcmlhYmxlRGVjbGFyYXRpb24uaW5pdGlhbGl6ZXIucHJvcGVydGllcy5sZW5ndGggIT09IDApIHtcbiAgICAgICAgICBjb25zdCBsaXRlcmFsUHJvcGVydHlDb3VudCA9IHZhcmlhYmxlRGVjbGFyYXRpb24uaW5pdGlhbGl6ZXIucHJvcGVydGllcy5sZW5ndGg7XG4gICAgICAgICAgY29uc3QgZW51bVN0YXRlbWVudHMgPSBmaW5kVHNpY2tsZUVudW1TdGF0ZW1lbnRzKG5hbWUsIHN0YXRlbWVudHMsIG9JbmRleCArIDEpO1xuICAgICAgICAgIGlmIChlbnVtU3RhdGVtZW50cy5sZW5ndGggPT09IGxpdGVyYWxQcm9wZXJ0eUNvdW50KSB7XG4gICAgICAgICAgICAvLyBmb3VuZCBhbiBlbnVtXG4gICAgICAgICAgICBpZiAoIXVwZGF0ZWRTdGF0ZW1lbnRzKSB7XG4gICAgICAgICAgICAgIHVwZGF0ZWRTdGF0ZW1lbnRzID0gc3RhdGVtZW50cy5zbGljZSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gY3JlYXRlIHdyYXBwZXIgYW5kIHJlcGxhY2UgdmFyaWFibGUgc3RhdGVtZW50IGFuZCBlbnVtIG1lbWJlciBzdGF0ZW1lbnRzXG4gICAgICAgICAgICB1cGRhdGVkU3RhdGVtZW50cy5zcGxpY2UodUluZGV4LCBlbnVtU3RhdGVtZW50cy5sZW5ndGggKyAxLCBjcmVhdGVXcmFwcGVkRW51bShcbiAgICAgICAgICAgICAgbmFtZSxcbiAgICAgICAgICAgICAgY3VycmVudFN0YXRlbWVudCxcbiAgICAgICAgICAgICAgZW51bVN0YXRlbWVudHMsXG4gICAgICAgICAgICAgIHZhcmlhYmxlRGVjbGFyYXRpb24uaW5pdGlhbGl6ZXIsXG4gICAgICAgICAgICApKTtcbiAgICAgICAgICAgIC8vIHNraXAgZW51bSBtZW1iZXIgZGVjbGFyYXRpb25zXG4gICAgICAgICAgICBvSW5kZXggKz0gZW51bVN0YXRlbWVudHMubGVuZ3RoO1xuICAgICAgICAgICAgY29udGludWU7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4g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WYXJpYWJsZVN0YXRlbWVudCxcbiAgc3RhdGVtZW50czogQXJyYXk8dHMuU3RhdGVtZW50PixcbiAgbGl0ZXJhbEluaXRpYWxpemVyOiB0cy5PYmplY3RMaXRlcmFsRXhwcmVzc2lvbiB8IHVuZGVmaW5lZCxcbik6IHRzLlN0YXRlbWVudCB7XG4gIGxpdGVyYWxJbml0aWFsaXplciA9IGxpdGVyYWxJbml0aWFsaXplciB8fCB0cy5jcmVhdGVPYmplY3RMaXRlcmFsKCk7XG4gIGNvbnN0IGlubmVyVmFyU3RtdCA9IHRzLmNyZWF0ZVZhcmlhYmxlU3RhdGVtZW50KFxuICAgIHVuZGVmaW5lZCxcbiAgICB0cy5jcmVhdGVWYXJpYWJsZURlY2xhcmF0aW9uTGlzdChbXG4gICAgICB0cy5jcmVhdGVWYXJpYWJsZURlY2xhcmF0aW9uKG5hbWUsIHVuZGVmaW5lZCwgbGl0ZXJhbEluaXRpYWxpemVyKSxcbiAgICBdKSxcbiAgKTtcblxuICBjb25zdCBpbm5lclJldHVybiA9IHRzLmNyZWF0ZVJldHVybih0cy5jcmVhdGVJZGVudGlmaWVyKG5hbWUpKTtcblxuICBjb25zdCBpaWZlID0gdHMuY3JlYXRlSW1tZWRpYXRlbHlJbnZva2VkRnVuY3Rpb25FeHByZXNzaW9uKFtcbiAgICBpbm5lclZhclN0bXQsXG4gICAgLi4uc3RhdGVtZW50cyxcbiAgICBpbm5lclJldHVybixcbiAgXSk7XG5cbiAgcmV0dXJuIHVwZGF0ZUhvc3ROb2RlKGhvc3ROb2RlLCB0cy5jcmVhdGVQYXJlbihpaWZlKSk7XG59XG4iXX0= |
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
281172
1951