@ngtools/webpack 11.1.0 → 11.1.1

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": "11.1.0",
3
+ "version": "11.1.1",
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",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/angular/angular-cli",
27
27
  "dependencies": {
28
- "@angular-devkit/core": "11.1.0",
28
+ "@angular-devkit/core": "11.1.1",
29
29
  "enhanced-resolve": "5.6.0",
30
30
  "webpack-sources": "2.2.0"
31
31
  },
@@ -23,7 +23,7 @@ function createAotTransformers(builder, options) {
23
23
  const removeNgModuleScope = !options.emitNgModuleScope;
24
24
  if (removeClassMetadata || removeNgModuleScope) {
25
25
  // tslint:disable-next-line: no-non-null-assertion
26
- transformers.after.push(remove_ivy_jit_support_calls_1.removeIvyJitSupportCalls(removeClassMetadata, removeNgModuleScope, getTypeChecker));
26
+ transformers.before.push(remove_ivy_jit_support_calls_1.removeIvyJitSupportCalls(removeClassMetadata, removeNgModuleScope, getTypeChecker));
27
27
  }
28
28
  return transformers;
29
29
  }
@@ -102,6 +102,10 @@ function elideImports(sourceFile, removedNodes, getTypeChecker, compilerOptions)
102
102
  return [];
103
103
  }
104
104
  const isUnused = (node) => {
105
+ // Do not remove JSX factory imports
106
+ if (node.text === compilerOptions.jsxFactory) {
107
+ return false;
108
+ }
105
109
  const symbol = typeChecker.getSymbolAtLocation(node);
106
110
  return symbol && !usedSymbols.has(symbol);
107
111
  };
@@ -1,6 +1,6 @@
1
1
  import * as ts from 'typescript';
2
2
  import { WebpackCompilerHost } from '../compiler_host';
3
- export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean, extraCompilerOptions?: ts.CompilerOptions): {
3
+ export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean, extraCompilerOptions?: ts.CompilerOptions, jsxFile?: boolean): {
4
4
  compilerHost: WebpackCompilerHost;
5
5
  program: ts.Program;
6
6
  };
@@ -15,10 +15,11 @@ const ts = require("typescript");
15
15
  const compiler_host_1 = require("../compiler_host");
16
16
  // Test transform helpers.
17
17
  const basePath = '/project/src/';
18
- const fileName = basePath + 'test-file.ts';
18
+ const basefileName = basePath + 'test-file.ts';
19
19
  const typeScriptLibFiles = loadTypeScriptLibFiles();
20
20
  const tsLibFiles = loadTsLibFiles();
21
- function createTypescriptContext(content, additionalFiles, useLibs = false, extraCompilerOptions = {}) {
21
+ function createTypescriptContext(content, additionalFiles, useLibs = false, extraCompilerOptions = {}, jsxFile = false) {
22
+ const fileName = basefileName + (jsxFile ? 'x' : '');
22
23
  // Set compiler options.
23
24
  const compilerOptions = {
24
25
  noEmitOnError: useLibs,
@@ -81,7 +82,7 @@ function transformTypescript(content, transformers, program, compilerHost) {
81
82
  throw new Error(ts.formatDiagnostics(diagnostics, compilerHost));
82
83
  }
83
84
  // Return the transpiled js.
84
- return compilerHost.readFile(fileName.replace(/\.tsx?$/, '.js'));
85
+ return compilerHost.readFile(basefileName.replace(/\.tsx?$/, '.js'));
85
86
  }
86
87
  exports.transformTypescript = transformTypescript;
87
88
  function loadTypeScriptLibFiles() {