@ngtools/webpack 8.3.0-rc.0 → 8.3.3
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": "8.3.
|
|
3
|
+
"version": "8.3.3",
|
|
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": "8.3.
|
|
28
|
+
"@angular-devkit/core": "8.3.3",
|
|
29
29
|
"enhanced-resolve": "4.1.0",
|
|
30
30
|
"rxjs": "6.4.0",
|
|
31
31
|
"tree-kill": "1.2.1",
|
|
@@ -3,7 +3,7 @@ import { WebpackCompilerHost } from '../compiler_host';
|
|
|
3
3
|
export declare function collectDeepNodes<T extends ts.Node>(node: ts.Node, kind: ts.SyntaxKind | ts.SyntaxKind[]): T[];
|
|
4
4
|
export declare function getFirstNode(sourceFile: ts.SourceFile): ts.Node;
|
|
5
5
|
export declare function getLastNode(sourceFile: ts.SourceFile): ts.Node | null;
|
|
6
|
-
export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean): {
|
|
6
|
+
export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean, importHelpers?: boolean): {
|
|
7
7
|
compilerHost: WebpackCompilerHost;
|
|
8
8
|
program: ts.Program;
|
|
9
9
|
};
|
|
@@ -44,7 +44,7 @@ exports.getLastNode = getLastNode;
|
|
|
44
44
|
const basePath = '/project/src/';
|
|
45
45
|
const fileName = basePath + 'test-file.ts';
|
|
46
46
|
const tsLibFiles = loadTsLibFiles();
|
|
47
|
-
function createTypescriptContext(content, additionalFiles, useLibs = false) {
|
|
47
|
+
function createTypescriptContext(content, additionalFiles, useLibs = false, importHelpers = true) {
|
|
48
48
|
// Set compiler options.
|
|
49
49
|
const compilerOptions = {
|
|
50
50
|
noEmitOnError: useLibs,
|
|
@@ -55,7 +55,7 @@ function createTypescriptContext(content, additionalFiles, useLibs = false) {
|
|
|
55
55
|
target: ts.ScriptTarget.ESNext,
|
|
56
56
|
skipLibCheck: true,
|
|
57
57
|
sourceMap: false,
|
|
58
|
-
importHelpers
|
|
58
|
+
importHelpers,
|
|
59
59
|
};
|
|
60
60
|
// Create compiler host.
|
|
61
61
|
const compilerHost = new compiler_host_1.WebpackCompilerHost(compilerOptions, basePath, new core_1.virtualFs.SimpleMemoryHost(), false);
|
|
@@ -83,8 +83,12 @@ function transformTypescript(content, transformers, program, compilerHost) {
|
|
|
83
83
|
// Use given context or create a new one.
|
|
84
84
|
if (content !== undefined) {
|
|
85
85
|
const typescriptContext = createTypescriptContext(content);
|
|
86
|
-
program
|
|
87
|
-
|
|
86
|
+
if (!program) {
|
|
87
|
+
program = typescriptContext.program;
|
|
88
|
+
}
|
|
89
|
+
if (!compilerHost) {
|
|
90
|
+
compilerHost = typescriptContext.compilerHost;
|
|
91
|
+
}
|
|
88
92
|
}
|
|
89
93
|
else if (!program || !compilerHost) {
|
|
90
94
|
throw new Error('transformTypescript needs either `content` or a `program` and `compilerHost');
|
|
@@ -215,7 +215,7 @@ function decoratorDownlevelTransformer(typeChecker, diagnostics) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
function visitor(node) {
|
|
218
|
-
if (ts.isClassDeclaration(node)) {
|
|
218
|
+
if (ts.isClassDeclaration(node) && node.decorators && node.decorators.length > 0) {
|
|
219
219
|
return ts.updateClassDeclaration(node, node.decorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses, ts.visitNodes(node.members, classMemberVisitor));
|
|
220
220
|
}
|
|
221
221
|
else {
|