@ngtools/webpack 15.1.0-next.0 → 15.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngtools/webpack",
3
- "version": "15.1.0-next.0",
3
+ "version": "15.1.0-next.2",
4
4
  "description": "Webpack plugin that AoT compiles your Angular components and modules.",
5
5
  "main": "./src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -94,7 +94,7 @@ function replaceBootstrap(getTypeChecker) {
94
94
  if (target.text === PLATFORM_BROWSER_DYNAMIC_NAME) {
95
95
  if (!bootstrapNamespace) {
96
96
  bootstrapNamespace = nodeFactory.createUniqueName('__NgCli_bootstrap_');
97
- bootstrapImport = nodeFactory.createImportDeclaration(undefined, undefined, nodeFactory.createImportClause(false, undefined, nodeFactory.createNamespaceImport(bootstrapNamespace)), nodeFactory.createStringLiteral('@angular/platform-browser'));
97
+ bootstrapImport = nodeFactory.createImportDeclaration(undefined, nodeFactory.createImportClause(false, undefined, nodeFactory.createNamespaceImport(bootstrapNamespace)), nodeFactory.createStringLiteral('@angular/platform-browser'));
98
98
  }
99
99
  replacedNodes.push(target);
100
100
  return nodeFactory.updateCallExpression(node, nodeFactory.createPropertyAccessExpression(bootstrapNamespace, 'platformBrowser'), node.typeArguments, node.arguments);
@@ -66,31 +66,33 @@ function elideImports(sourceFile, removedNodes, getTypeChecker, compilerOptions)
66
66
  }
67
67
  return;
68
68
  }
69
- if (!ts.isTypeReferenceNode(node)) {
70
- let symbol;
71
- switch (node.kind) {
72
- case ts.SyntaxKind.Identifier:
73
- const parent = node.parent;
74
- if (parent && ts.isShorthandPropertyAssignment(parent)) {
75
- const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(parent);
76
- if (shorthandSymbol) {
77
- symbol = shorthandSymbol;
78
- }
79
- }
80
- else {
81
- symbol = typeChecker.getSymbolAtLocation(node);
69
+ // Type reference imports do not need to be emitted when emitDecoratorMetadata is disabled.
70
+ if (ts.isTypeReferenceNode(node) && !compilerOptions.emitDecoratorMetadata) {
71
+ return;
72
+ }
73
+ let symbol;
74
+ switch (node.kind) {
75
+ case ts.SyntaxKind.Identifier:
76
+ const parent = node.parent;
77
+ if (parent && ts.isShorthandPropertyAssignment(parent)) {
78
+ const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(parent);
79
+ if (shorthandSymbol) {
80
+ symbol = shorthandSymbol;
82
81
  }
83
- break;
84
- case ts.SyntaxKind.ExportSpecifier:
85
- symbol = typeChecker.getExportSpecifierLocalTargetSymbol(node);
86
- break;
87
- case ts.SyntaxKind.ShorthandPropertyAssignment:
88
- symbol = typeChecker.getShorthandAssignmentValueSymbol(node);
89
- break;
90
- }
91
- if (symbol) {
92
- usedSymbols.add(symbol);
93
- }
82
+ }
83
+ else {
84
+ symbol = typeChecker.getSymbolAtLocation(node);
85
+ }
86
+ break;
87
+ case ts.SyntaxKind.ExportSpecifier:
88
+ symbol = typeChecker.getExportSpecifierLocalTargetSymbol(node);
89
+ break;
90
+ case ts.SyntaxKind.ShorthandPropertyAssignment:
91
+ symbol = typeChecker.getShorthandAssignmentValueSymbol(node);
92
+ break;
93
+ }
94
+ if (symbol) {
95
+ usedSymbols.add(symbol);
94
96
  }
95
97
  ts.forEachChild(node, visit);
96
98
  });
@@ -214,7 +214,7 @@ function createResourceImport(nodeFactory, url, resourceImportDeclarations, modu
214
214
  }
215
215
  else {
216
216
  const importName = nodeFactory.createIdentifier(`__NG_CLI_RESOURCE__${resourceImportDeclarations.length}`);
217
- resourceImportDeclarations.push(nodeFactory.createImportDeclaration(undefined, undefined, nodeFactory.createImportClause(false, importName, undefined), urlLiteral));
217
+ resourceImportDeclarations.push(nodeFactory.createImportDeclaration(undefined, nodeFactory.createImportClause(false, importName, undefined), urlLiteral));
218
218
  return importName;
219
219
  }
220
220
  }