@ngtools/webpack 8.0.0-rc.4 → 8.0.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 +2 -2
- package/src/angular_compiler_plugin.d.ts +1 -0
- package/src/angular_compiler_plugin.js +4 -14
- package/src/compiler_host.js +5 -3
- package/src/interfaces.d.ts +2 -1
- package/src/ngcc_processor.d.ts +1 -2
- package/src/ngcc_processor.js +3 -3
- package/src/transformers/import_factory.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngtools/webpack",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.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.0.
|
|
28
|
+
"@angular-devkit/core": "8.0.3",
|
|
29
29
|
"enhanced-resolve": "4.1.0",
|
|
30
30
|
"rxjs": "6.4.0",
|
|
31
31
|
"tree-kill": "1.2.1",
|
|
@@ -68,8 +68,9 @@ class AngularCompilerPlugin {
|
|
|
68
68
|
const tsProgram = this._getTsProgram();
|
|
69
69
|
return tsProgram ? tsProgram.getTypeChecker() : null;
|
|
70
70
|
}
|
|
71
|
+
/** @deprecated From 8.0.2 */
|
|
71
72
|
static isSupported() {
|
|
72
|
-
return compiler_cli_1.VERSION && parseInt(compiler_cli_1.VERSION.major) >=
|
|
73
|
+
return compiler_cli_1.VERSION && parseInt(compiler_cli_1.VERSION.major) >= 8;
|
|
73
74
|
}
|
|
74
75
|
_setupOptions(options) {
|
|
75
76
|
benchmark_1.time('AngularCompilerPlugin._setupOptions');
|
|
@@ -487,17 +488,7 @@ class AngularCompilerPlugin {
|
|
|
487
488
|
}
|
|
488
489
|
let ngccProcessor;
|
|
489
490
|
if (this._compilerOptions.enableIvy) {
|
|
490
|
-
|
|
491
|
-
try {
|
|
492
|
-
// this is done for the sole reason that @ngtools/webpack
|
|
493
|
-
// support versions of Angular that don't have NGCC API
|
|
494
|
-
ngcc = require('@angular/compiler-cli/ngcc');
|
|
495
|
-
}
|
|
496
|
-
catch (_a) {
|
|
497
|
-
}
|
|
498
|
-
if (ngcc) {
|
|
499
|
-
ngccProcessor = new ngcc_processor_1.NgccProcessor(ngcc, this._mainFields, compilerWithFileSystems.inputFileSystem, this._warnings, this._errors, this._basePath);
|
|
500
|
-
}
|
|
491
|
+
ngccProcessor = new ngcc_processor_1.NgccProcessor(this._mainFields, compilerWithFileSystems.inputFileSystem, this._warnings, this._errors, this._basePath);
|
|
501
492
|
}
|
|
502
493
|
// Create the webpack compiler host.
|
|
503
494
|
const webpackCompilerHost = new compiler_host_1.WebpackCompilerHost(this._compilerOptions, this._basePath, host, true, this._options.directTemplateLoading, ngccProcessor);
|
|
@@ -635,7 +626,6 @@ class AngularCompilerPlugin {
|
|
|
635
626
|
}
|
|
636
627
|
async _make(compilation) {
|
|
637
628
|
benchmark_1.time('AngularCompilerPlugin._make');
|
|
638
|
-
this._emitSkipped = true;
|
|
639
629
|
// tslint:disable-next-line:no-any
|
|
640
630
|
if (compilation._ngToolsWebpackPluginInstance) {
|
|
641
631
|
throw new Error('An @ngtools/webpack plugin already exist for this compilation.');
|
|
@@ -928,7 +918,7 @@ class AngularCompilerPlugin {
|
|
|
928
918
|
}
|
|
929
919
|
allDiagnostics.push(...gather_diagnostics_1.gatherDiagnostics(tsProgram, this._JitMode, 'AngularCompilerPlugin._emit.ts', diagMode));
|
|
930
920
|
if (!gather_diagnostics_1.hasErrors(allDiagnostics)) {
|
|
931
|
-
if (this._firstRun || changedTsFiles.size > 20) {
|
|
921
|
+
if (this._firstRun || changedTsFiles.size > 20 || this._emitSkipped) {
|
|
932
922
|
emitResult = tsProgram.emit(undefined, undefined, undefined, undefined, { before: this._transformers });
|
|
933
923
|
allDiagnostics.push(...emitResult.diagnostics);
|
|
934
924
|
}
|
package/src/compiler_host.js
CHANGED
|
@@ -106,13 +106,15 @@ class WebpackCompilerHost {
|
|
|
106
106
|
readFile(fileName) {
|
|
107
107
|
const filePath = this.resolve(fileName);
|
|
108
108
|
try {
|
|
109
|
+
let content;
|
|
109
110
|
if (this._memoryHost.isFile(filePath)) {
|
|
110
|
-
|
|
111
|
+
content = this._memoryHost.read(filePath);
|
|
111
112
|
}
|
|
112
113
|
else {
|
|
113
|
-
|
|
114
|
-
return core_1.virtualFs.fileBufferToString(content);
|
|
114
|
+
content = this._syncHost.read(filePath);
|
|
115
115
|
}
|
|
116
|
+
// strip BOM
|
|
117
|
+
return core_1.virtualFs.fileBufferToString(content).replace(/^\uFEFF/, '');
|
|
116
118
|
}
|
|
117
119
|
catch (_a) {
|
|
118
120
|
return undefined;
|
package/src/interfaces.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
9
|
import { logging, virtualFs } from '@angular-devkit/core';
|
|
10
|
+
import { CompilerOptions } from '@angular/compiler-cli';
|
|
10
11
|
import * as fs from 'fs';
|
|
11
12
|
import * as ts from 'typescript';
|
|
12
13
|
export declare enum PLATFORM {
|
|
@@ -48,7 +49,7 @@ export interface AngularCompilerPluginOptions {
|
|
|
48
49
|
};
|
|
49
50
|
additionalLazyModuleResources?: string[];
|
|
50
51
|
contextElementDependencyConstructor?: ContextElementDependencyConstructor;
|
|
51
|
-
compilerOptions?:
|
|
52
|
+
compilerOptions?: CompilerOptions;
|
|
52
53
|
host?: virtualFs.Host<fs.Stats>;
|
|
53
54
|
platformTransformers?: ts.TransformerFactory<ts.SourceFile>[];
|
|
54
55
|
}
|
package/src/ngcc_processor.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import * as ts from 'typescript';
|
|
9
9
|
import { InputFileSystem } from 'webpack';
|
|
10
10
|
export declare class NgccProcessor {
|
|
11
|
-
private readonly ngcc;
|
|
12
11
|
private readonly propertiesToConsider;
|
|
13
12
|
private readonly inputFileSystem;
|
|
14
13
|
private readonly compilationWarnings;
|
|
@@ -17,7 +16,7 @@ export declare class NgccProcessor {
|
|
|
17
16
|
private _processedModules;
|
|
18
17
|
private _logger;
|
|
19
18
|
private _nodeModulesDirectory;
|
|
20
|
-
constructor(
|
|
19
|
+
constructor(propertiesToConsider: string[], inputFileSystem: InputFileSystem, compilationWarnings: (Error | string)[], compilationErrors: (Error | string)[], basePath: string);
|
|
21
20
|
processModule(moduleName: string, resolvedModule: ts.ResolvedModule | ts.ResolvedTypeReferenceDirective): void;
|
|
22
21
|
/**
|
|
23
22
|
* Try resolve a package.json file from the resolved .d.ts file.
|
package/src/ngcc_processor.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const ngcc_1 = require("@angular/compiler-cli/ngcc");
|
|
10
11
|
const fs_1 = require("fs");
|
|
11
12
|
const path = require("path");
|
|
12
13
|
const benchmark_1 = require("./benchmark");
|
|
@@ -18,8 +19,7 @@ const benchmark_1 = require("./benchmark");
|
|
|
18
19
|
// but could not be resolved to an NgModule class
|
|
19
20
|
// We now transform a package and it's typings when NGTSC is resolving a module.
|
|
20
21
|
class NgccProcessor {
|
|
21
|
-
constructor(
|
|
22
|
-
this.ngcc = ngcc;
|
|
22
|
+
constructor(propertiesToConsider, inputFileSystem, compilationWarnings, compilationErrors, basePath) {
|
|
23
23
|
this.propertiesToConsider = propertiesToConsider;
|
|
24
24
|
this.inputFileSystem = inputFileSystem;
|
|
25
25
|
this.compilationWarnings = compilationWarnings;
|
|
@@ -45,7 +45,7 @@ class NgccProcessor {
|
|
|
45
45
|
}
|
|
46
46
|
const timeLabel = `NgccProcessor.processModule.ngcc.process+${moduleName}`;
|
|
47
47
|
benchmark_1.time(timeLabel);
|
|
48
|
-
|
|
48
|
+
ngcc_1.process({
|
|
49
49
|
basePath: this._nodeModulesDirectory,
|
|
50
50
|
targetEntryPointPath: path.dirname(packageJsonPath),
|
|
51
51
|
propertiesToConsider: this.propertiesToConsider,
|
|
@@ -62,7 +62,7 @@ loadChildren: () => import('IMPORT_STRING').then(M => M.EXPORT_NAME)
|
|
|
62
62
|
|
|
63
63
|
Please note that only IMPORT_STRING, M, and EXPORT_NAME can be replaced in this format.
|
|
64
64
|
|
|
65
|
-
Visit https://
|
|
65
|
+
Visit https://v8.angular.io/guide/ivy for more information on using Ivy.
|
|
66
66
|
`;
|
|
67
67
|
const emitWarning = () => warningCb(warning);
|
|
68
68
|
const visitVariableStatement = (node) => {
|