@ngtools/webpack 12.0.0-rc.0 → 12.0.0
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/README.md +13 -12
- package/package.json +2 -2
- package/src/benchmark.d.ts +7 -0
- package/src/benchmark.js +4 -4
- package/src/index.d.ts +1 -1
- package/src/index.js +4 -3
- package/src/ivy/cache.d.ts +1 -1
- package/src/ivy/cache.js +7 -0
- package/src/ivy/diagnostics.d.ts +1 -1
- package/src/ivy/diagnostics.js +3 -3
- package/src/ivy/host.d.ts +7 -0
- package/src/ivy/host.js +8 -3
- package/src/ivy/index.d.ts +1 -1
- package/src/ivy/index.js +3 -3
- package/src/ivy/loader.d.ts +7 -0
- package/src/ivy/loader.js +6 -5
- package/src/ivy/paths.d.ts +7 -0
- package/src/ivy/paths.js +3 -3
- package/src/ivy/plugin.d.ts +1 -1
- package/src/ivy/plugin.js +26 -16
- package/src/ivy/symbol.d.ts +1 -1
- package/src/ivy/symbol.js +7 -7
- package/src/ivy/system.d.ts +2 -2
- package/src/ivy/system.js +3 -3
- package/src/ivy/transformation.d.ts +7 -0
- package/src/ivy/transformation.js +4 -4
- package/src/ngcc_processor.d.ts +1 -1
- package/src/ngcc_processor.js +13 -11
- package/src/paths-plugin.d.ts +7 -0
- package/src/paths-plugin.js +8 -6
- package/src/resource_loader.d.ts +9 -2
- package/src/resource_loader.js +3 -3
- package/src/transformers/elide_imports.d.ts +1 -1
- package/src/transformers/elide_imports.js +6 -7
- package/src/transformers/index.d.ts +1 -1
- package/src/transformers/index.js +7 -7
- package/src/transformers/interfaces.d.ts +1 -1
- package/src/transformers/interfaces.js +7 -0
- package/src/transformers/remove-ivy-jit-support-calls.d.ts +1 -1
- package/src/transformers/remove-ivy-jit-support-calls.js +3 -3
- package/src/transformers/replace_resources.d.ts +1 -1
- package/src/transformers/replace_resources.js +9 -11
- package/src/transformers/spec_helpers.d.ts +7 -0
- package/src/transformers/spec_helpers.js +3 -3
- package/src/webpack-diagnostics.d.ts +2 -2
- package/src/webpack-diagnostics.js +4 -4
package/README.md
CHANGED
|
@@ -9,21 +9,22 @@ In your webpack config, add the following plugin and loader.
|
|
|
9
9
|
```typescript
|
|
10
10
|
import { AngularWebpackPlugin } from '@ngtools/webpack';
|
|
11
11
|
|
|
12
|
-
exports = {
|
|
12
|
+
exports = {
|
|
13
|
+
/* ... */
|
|
13
14
|
module: {
|
|
14
15
|
rules: [
|
|
15
16
|
{
|
|
16
17
|
test: /\.[jt]sx?$/,
|
|
17
|
-
loader: '@ngtools/webpack'
|
|
18
|
-
}
|
|
19
|
-
]
|
|
18
|
+
loader: '@ngtools/webpack',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
20
21
|
},
|
|
21
22
|
|
|
22
23
|
plugins: [
|
|
23
24
|
new AngularWebpackPlugin({
|
|
24
25
|
tsconfig: 'path/to/tsconfig.json',
|
|
25
|
-
})
|
|
26
|
-
]
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
27
28
|
};
|
|
28
29
|
```
|
|
29
30
|
|
|
@@ -31,9 +32,9 @@ The loader works with webpack plugin to compile the application's TypeScript. It
|
|
|
31
32
|
|
|
32
33
|
## Options
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
- `tsconfig` [default: `tsconfig.json`] - The path to the application's TypeScript Configuration file. In the `tsconfig.json`, you can pass options to the Angular Compiler with `angularCompilerOptions`. Relative paths will be resolved from the Webpack compilation's context.
|
|
36
|
+
- `compilerOptions` [default: none] - Overrides options in the application's TypeScript Configuration file (`tsconfig.json`).
|
|
37
|
+
- `jitMode` [default: `false`] - Enables JIT compilation and do not refactor the code to bootstrap. This replaces `templateUrl: "string"` with `template: require("string")` (and similar for styles) to allow for webpack to properly link the resources.
|
|
38
|
+
- `directTemplateLoading` [default: `true`] - Causes the plugin to load component templates (HTML) directly from the filesystem. This is more efficient if only using the `raw-loader` to load component templates. Do not enable this option if additional loaders are configured for component templates.
|
|
39
|
+
- `fileReplacements` [default: none] - Allows replacing TypeScript files with other TypeScript files in the build. This option acts on fully resolved file paths.
|
|
40
|
+
- `inlineStyleMimeType` [default: none] - When set to a valid MIME type, enables conversion of an Angular Component's inline styles into data URIs. This allows a Webpack 5 configuration rule to use the `mimetype` condition to process the inline styles. A valid MIME type is a string starting with `text/` (Example for CSS: `text/css`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngtools/webpack",
|
|
3
|
-
"version": "12.0.0
|
|
3
|
+
"version": "12.0.0",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"webpack": "^5.30.0"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": "
|
|
36
|
+
"node": "^12.14.1 || ^14.0.0",
|
|
37
37
|
"npm": "^6.11.0 || ^7.5.6",
|
|
38
38
|
"yarn": ">= 1.13.0"
|
|
39
39
|
}
|
package/src/benchmark.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
export declare function time(label: string): void;
|
|
2
9
|
export declare function timeEnd(label: string): void;
|
package/src/benchmark.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timeEnd = exports.time = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.timeEnd = exports.time = void 0;
|
|
11
11
|
// Internal benchmark reporting flag.
|
|
12
12
|
// Use with CLI --no-progress flag for best results.
|
|
13
13
|
// This should be false for commited code.
|
|
14
14
|
const _benchmark = false;
|
|
15
|
-
|
|
15
|
+
/* eslint-disable no-console */
|
|
16
16
|
function time(label) {
|
|
17
17
|
if (_benchmark) {
|
|
18
18
|
console.time(label);
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ivy = exports.default = exports.AngularWebpackPlugin = exports.AngularWebpackLoaderPath = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ivy = exports.default = exports.AngularWebpackPlugin = exports.AngularWebpackLoaderPath = void 0;
|
|
11
11
|
const ivyInternal = require("./ivy");
|
|
12
12
|
var ivy_1 = require("./ivy");
|
|
13
13
|
Object.defineProperty(exports, "AngularWebpackLoaderPath", { enumerable: true, get: function () { return ivy_1.AngularWebpackLoaderPath; } });
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "default", { enumerable: true, get: function () {
|
|
|
16
16
|
/** @deprecated Deprecated as of v12, please use the direct exports
|
|
17
17
|
* (`AngularWebpackPlugin` instead of `ivy.AngularWebpackPlugin`)
|
|
18
18
|
*/
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
19
20
|
var ivy;
|
|
20
21
|
(function (ivy) {
|
|
21
22
|
ivy.AngularWebpackLoaderPath = ivyInternal.AngularWebpackLoaderPath;
|
package/src/ivy/cache.d.ts
CHANGED
package/src/ivy/cache.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.SourceFileCache = void 0;
|
|
4
11
|
class SourceFileCache extends Map {
|
package/src/ivy/diagnostics.d.ts
CHANGED
package/src/ivy/diagnostics.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDiagnosticsReporter = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createDiagnosticsReporter = void 0;
|
|
11
11
|
const compiler_cli_1 = require("@angular/compiler-cli");
|
|
12
12
|
const typescript_1 = require("typescript");
|
|
13
13
|
const webpack_diagnostics_1 = require("../webpack-diagnostics");
|
package/src/ivy/host.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import * as ts from 'typescript';
|
|
2
9
|
import { NgccProcessor } from '../ngcc_processor';
|
|
3
10
|
import { WebpackResourceLoader } from '../resource_loader';
|
package/src/ivy/host.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.augmentHostWithCaching = exports.augmentProgramWithVersioning = exports.augmentHostWithVersioning = exports.augmentHostWithSubstitutions = exports.augmentHostWithReplacements = exports.augmentHostWithNgcc = exports.augmentHostWithDependencyCollection = exports.augmentHostWithResources = void 0;
|
|
4
11
|
const crypto_1 = require("crypto");
|
|
@@ -216,9 +223,7 @@ function augmentProgramWithVersioning(program) {
|
|
|
216
223
|
exports.augmentProgramWithVersioning = augmentProgramWithVersioning;
|
|
217
224
|
function augmentHostWithCaching(host, cache) {
|
|
218
225
|
const baseGetSourceFile = host.getSourceFile;
|
|
219
|
-
host.getSourceFile = function (fileName, languageVersion, onError, shouldCreateNewSourceFile,
|
|
220
|
-
// tslint:disable-next-line: trailing-comma
|
|
221
|
-
...parameters) {
|
|
226
|
+
host.getSourceFile = function (fileName, languageVersion, onError, shouldCreateNewSourceFile, ...parameters) {
|
|
222
227
|
if (!shouldCreateNewSourceFile && cache.has(fileName)) {
|
|
223
228
|
return cache.get(fileName);
|
|
224
229
|
}
|
package/src/ivy/index.d.ts
CHANGED
package/src/ivy/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AngularWebpackLoaderPath = exports.AngularWebpackPlugin = exports.default = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AngularWebpackLoaderPath = exports.AngularWebpackPlugin = exports.default = void 0;
|
|
11
11
|
var loader_1 = require("./loader");
|
|
12
12
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return loader_1.angularWebpackLoader; } });
|
|
13
13
|
var plugin_1 = require("./plugin");
|
package/src/ivy/loader.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
export declare function angularWebpackLoader(this: any, content: string, map: any): void;
|
|
2
9
|
export { angularWebpackLoader as default };
|
package/src/ivy/loader.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = exports.angularWebpackLoader = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.default = exports.angularWebpackLoader = void 0;
|
|
11
11
|
const path = require("path");
|
|
12
12
|
const symbol_1 = require("./symbol");
|
|
13
13
|
function angularWebpackLoader(content,
|
|
14
14
|
// Source map types are broken in the webpack type definitions
|
|
15
|
-
//
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
map) {
|
|
17
17
|
const callback = this.async();
|
|
18
18
|
if (!callback) {
|
|
@@ -28,7 +28,8 @@ map) {
|
|
|
28
28
|
callback(new Error('The Angular Webpack loader requires the AngularWebpackPlugin.'));
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
fileEmitter
|
|
31
|
+
fileEmitter
|
|
32
|
+
.emit(this.resourcePath)
|
|
32
33
|
.then((result) => {
|
|
33
34
|
if (!result) {
|
|
34
35
|
if (this.resourcePath.endsWith('.js')) {
|
package/src/ivy/paths.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
export declare function normalizePath(path: string): string;
|
|
2
9
|
export declare const externalizePath: (path: string) => string;
|
package/src/ivy/paths.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.externalizePath = exports.normalizePath = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.externalizePath = exports.normalizePath = void 0;
|
|
11
11
|
const nodePath = require("path");
|
|
12
12
|
const normalizationCache = new Map();
|
|
13
13
|
function normalizePath(path) {
|
package/src/ivy/plugin.d.ts
CHANGED
package/src/ivy/plugin.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AngularWebpackPlugin = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AngularWebpackPlugin = void 0;
|
|
11
11
|
const compiler_cli_1 = require("@angular/compiler-cli");
|
|
12
12
|
const program_1 = require("@angular/compiler-cli/src/ngtsc/program");
|
|
13
13
|
const crypto_1 = require("crypto");
|
|
@@ -165,11 +165,20 @@ class AngularWebpackPlugin {
|
|
|
165
165
|
const { fileEmitter, builder, internalFiles } = this.pluginOptions.jitMode
|
|
166
166
|
? this.updateJitProgram(compilerOptions, rootNames, host, diagnosticsReporter)
|
|
167
167
|
: this.updateAotProgram(compilerOptions, rootNames, host, diagnosticsReporter, resourceLoader);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
// Set of files used during the unused TypeScript file analysis
|
|
169
|
+
const currentUnused = new Set();
|
|
170
|
+
for (const sourceFile of builder.getSourceFiles()) {
|
|
171
|
+
if (internalFiles === null || internalFiles === void 0 ? void 0 : internalFiles.has(sourceFile)) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
// Ensure all program files are considered part of the compilation and will be watched
|
|
175
|
+
compilation.fileDependencies.add(sourceFile.fileName);
|
|
176
|
+
// Add all non-declaration files to the initial set of unused files. The set will be
|
|
177
|
+
// analyzed and pruned after all Webpack modules are finished building.
|
|
178
|
+
if (!sourceFile.isDeclarationFile) {
|
|
179
|
+
currentUnused.add(paths_1.normalizePath(sourceFile.fileName));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
173
182
|
compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
|
|
174
183
|
// Rebuild any remaining AOT required modules
|
|
175
184
|
await this.rebuildRequiredFiles(modules, compilation, fileEmitter);
|
|
@@ -179,14 +188,12 @@ class AngularWebpackPlugin {
|
|
|
179
188
|
if (compilation.errors.length > 0) {
|
|
180
189
|
return;
|
|
181
190
|
}
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
.map((sourceFile) => paths_1.normalizePath(sourceFile.fileName)));
|
|
185
|
-
Array.from(modules).forEach(({ resource }) => {
|
|
191
|
+
for (const webpackModule of modules) {
|
|
192
|
+
const resource = webpackModule.resource;
|
|
186
193
|
if (resource) {
|
|
187
194
|
this.markResourceUsed(paths_1.normalizePath(resource), currentUnused);
|
|
188
195
|
}
|
|
189
|
-
}
|
|
196
|
+
}
|
|
190
197
|
for (const unused of currentUnused) {
|
|
191
198
|
if (previousUnused && previousUnused.has(unused)) {
|
|
192
199
|
continue;
|
|
@@ -217,7 +224,6 @@ class AngularWebpackPlugin {
|
|
|
217
224
|
if (this.requiredFilesToEmit.size === 0) {
|
|
218
225
|
return;
|
|
219
226
|
}
|
|
220
|
-
const rebuild = (webpackModule) => new Promise((resolve) => compilation.rebuildModule(webpackModule, () => resolve()));
|
|
221
227
|
const filesToRebuild = new Set();
|
|
222
228
|
for (const requiredFile of this.requiredFilesToEmit) {
|
|
223
229
|
const history = this.fileEmitHistory.get(requiredFile);
|
|
@@ -238,12 +244,15 @@ class AngularWebpackPlugin {
|
|
|
238
244
|
}
|
|
239
245
|
}
|
|
240
246
|
if (filesToRebuild.size > 0) {
|
|
241
|
-
|
|
247
|
+
const rebuild = (webpackModule) => new Promise((resolve) => compilation.rebuildModule(webpackModule, () => resolve()));
|
|
248
|
+
const modulesToRebuild = [];
|
|
249
|
+
for (const webpackModule of modules) {
|
|
242
250
|
const resource = webpackModule.resource;
|
|
243
251
|
if (resource && filesToRebuild.has(paths_1.normalizePath(resource))) {
|
|
244
|
-
|
|
252
|
+
modulesToRebuild.push(webpackModule);
|
|
245
253
|
}
|
|
246
254
|
}
|
|
255
|
+
await Promise.all(modulesToRebuild.map((webpackModule) => rebuild(webpackModule)));
|
|
247
256
|
}
|
|
248
257
|
this.requiredFilesToEmit.clear();
|
|
249
258
|
this.requiredFilesToEmitCache.clear();
|
|
@@ -286,6 +295,7 @@ class AngularWebpackPlugin {
|
|
|
286
295
|
}
|
|
287
296
|
// Update semantic diagnostics cache
|
|
288
297
|
const affectedFiles = new Set();
|
|
298
|
+
// eslint-disable-next-line no-constant-condition
|
|
289
299
|
while (true) {
|
|
290
300
|
const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
|
|
291
301
|
// If the affected file is a TTC shim, add the shim's original source file.
|
package/src/ivy/symbol.d.ts
CHANGED
package/src/ivy/symbol.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
3
10
|
if (!privateMap.has(receiver)) {
|
|
4
11
|
throw new TypeError("attempted to set private field on non-instance");
|
|
@@ -15,13 +22,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
22
|
var _fileEmitter, _registrations;
|
|
16
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
24
|
exports.FileEmitterCollection = exports.FileEmitterRegistration = exports.AngularPluginSymbol = void 0;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
21
|
-
*
|
|
22
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
23
|
-
* found in the LICENSE file at https://angular.io/license
|
|
24
|
-
*/
|
|
25
25
|
exports.AngularPluginSymbol = Symbol.for('@angular-devkit/build-angular[angular-compiler]');
|
|
26
26
|
class FileEmitterRegistration {
|
|
27
27
|
constructor() {
|
package/src/ivy/system.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
4
|
*
|
|
6
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
6
|
* found in the LICENSE file at https://angular.io/license
|
|
8
7
|
*/
|
|
8
|
+
/// <reference types="node" />
|
|
9
9
|
import * as ts from 'typescript';
|
|
10
10
|
import { Compiler } from 'webpack';
|
|
11
11
|
export declare type InputFileSystem = Compiler['inputFileSystem'];
|
package/src/ivy/system.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWebpackSystem = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createWebpackSystem = void 0;
|
|
11
11
|
const ts = require("typescript");
|
|
12
12
|
const paths_1 = require("./paths");
|
|
13
13
|
function shouldNotWrite() {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import * as ts from 'typescript';
|
|
2
9
|
export declare function createAotTransformers(builder: ts.BuilderProgram, options: {
|
|
3
10
|
emitClassMetadata?: boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceBootstrap = exports.mergeTransformers = exports.createJitTransformers = exports.createAotTransformers = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.replaceBootstrap = exports.mergeTransformers = exports.createJitTransformers = exports.createAotTransformers = void 0;
|
|
11
11
|
const compiler_cli_1 = require("@angular/compiler-cli");
|
|
12
12
|
const ts = require("typescript");
|
|
13
13
|
const elide_imports_1 = require("../transformers/elide_imports");
|
|
@@ -22,7 +22,7 @@ function createAotTransformers(builder, options) {
|
|
|
22
22
|
const removeClassMetadata = !options.emitClassMetadata;
|
|
23
23
|
const removeNgModuleScope = !options.emitNgModuleScope;
|
|
24
24
|
if (removeClassMetadata || removeNgModuleScope) {
|
|
25
|
-
//
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
26
26
|
transformers.before.push(remove_ivy_jit_support_calls_1.removeIvyJitSupportCalls(removeClassMetadata, removeNgModuleScope, getTypeChecker));
|
|
27
27
|
}
|
|
28
28
|
return transformers;
|
package/src/ngcc_processor.d.ts
CHANGED
package/src/ngcc_processor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -36,7 +36,7 @@ class NgccProcessor {
|
|
|
36
36
|
this._nodeModulesDirectory = this.findNodeModulesDirectory(this.basePath);
|
|
37
37
|
this._resolver = enhanced_resolve_1.ResolverFactory.createResolver({
|
|
38
38
|
// NOTE: @types/webpack InputFileSystem is missing some methods
|
|
39
|
-
//
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
40
|
fileSystem: this.inputFileSystem,
|
|
41
41
|
extensions: ['.json'],
|
|
42
42
|
useSyncFileSystemCalls: true,
|
|
@@ -111,14 +111,14 @@ class NgccProcessor {
|
|
|
111
111
|
// as NGCC will create a lock file for both builds and it will cause builds to fails.
|
|
112
112
|
const { status, error } = child_process_1.spawnSync(process.execPath, [
|
|
113
113
|
require.resolve('@angular/compiler-cli/ngcc/main-ngcc.js'),
|
|
114
|
-
'--source'
|
|
114
|
+
'--source' /** basePath */,
|
|
115
115
|
this._nodeModulesDirectory,
|
|
116
|
-
'--properties'
|
|
116
|
+
'--properties' /** propertiesToConsider */,
|
|
117
117
|
...this.propertiesToConsider,
|
|
118
|
-
'--first-only'
|
|
119
|
-
'--create-ivy-entry-points'
|
|
118
|
+
'--first-only' /** compileAllFormats */,
|
|
119
|
+
'--create-ivy-entry-points' /** createNewEntryPointFormats */,
|
|
120
120
|
'--async',
|
|
121
|
-
'--tsconfig'
|
|
121
|
+
'--tsconfig' /** tsConfigPath */,
|
|
122
122
|
this.tsConfigPath,
|
|
123
123
|
'--use-program-dependencies',
|
|
124
124
|
], {
|
|
@@ -145,8 +145,9 @@ class NgccProcessor {
|
|
|
145
145
|
/** Process a module and it's depedencies. */
|
|
146
146
|
processModule(moduleName, resolvedModule) {
|
|
147
147
|
const resolvedFileName = resolvedModule.resolvedFileName;
|
|
148
|
-
if (!resolvedFileName ||
|
|
149
|
-
|
|
148
|
+
if (!resolvedFileName ||
|
|
149
|
+
moduleName.startsWith('.') ||
|
|
150
|
+
this._processedModules.has(resolvedFileName)) {
|
|
150
151
|
// Skip when module is unknown, relative or NGCC compiler is not found or already processed.
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
@@ -173,7 +174,7 @@ class NgccProcessor {
|
|
|
173
174
|
// Purge this file from cache, since NGCC add new mainFields. Ex: module_ivy_ngcc
|
|
174
175
|
// which are unknown in the cached file.
|
|
175
176
|
if (this.inputFileSystem.purge) {
|
|
176
|
-
//
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
178
|
this.inputFileSystem.purge(packageJsonPath);
|
|
178
179
|
}
|
|
179
180
|
this._processedModules.add(resolvedFileName);
|
|
@@ -215,7 +216,8 @@ class NgccLogger {
|
|
|
215
216
|
this.compilationErrors = compilationErrors;
|
|
216
217
|
this.level = ngcc_1.LogLevel.info;
|
|
217
218
|
}
|
|
218
|
-
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
220
|
+
debug() { }
|
|
219
221
|
info(...args) {
|
|
220
222
|
// Log to stderr because it's a progress-like info message.
|
|
221
223
|
process.stderr.write(`\n${args.join(' ')}\n`);
|
package/src/paths-plugin.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { CompilerOptions } from 'typescript';
|
|
2
9
|
export interface TypeScriptPathsPluginOptions extends Pick<CompilerOptions, 'paths' | 'baseUrl'> {
|
|
3
10
|
}
|
package/src/paths-plugin.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeScriptPathsPlugin = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TypeScriptPathsPlugin = void 0;
|
|
11
11
|
const path = require("path");
|
|
12
12
|
const getInnerRequest = require('enhanced-resolve/lib/getInnerRequest');
|
|
13
13
|
class TypeScriptPathsPlugin {
|
|
@@ -17,7 +17,7 @@ class TypeScriptPathsPlugin {
|
|
|
17
17
|
update(options) {
|
|
18
18
|
this.options = options;
|
|
19
19
|
}
|
|
20
|
-
//
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
apply(resolver) {
|
|
22
22
|
const target = resolver.ensureHook('resolve');
|
|
23
23
|
const resolveAsync = (request, requestContext) => {
|
|
@@ -32,7 +32,9 @@ class TypeScriptPathsPlugin {
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
-
resolver
|
|
35
|
+
resolver
|
|
36
|
+
.getHook('described-resolve')
|
|
37
|
+
.tapPromise('TypeScriptPathsPlugin', async (request, resolveContext) => {
|
|
36
38
|
if (!this.options) {
|
|
37
39
|
throw new Error('TypeScriptPathsPlugin options were not provided.');
|
|
38
40
|
}
|
|
@@ -139,7 +141,7 @@ function findReplacements(originalRequest, paths) {
|
|
|
139
141
|
}
|
|
140
142
|
});
|
|
141
143
|
const replacements = [];
|
|
142
|
-
pathMapOptions.forEach(option => {
|
|
144
|
+
pathMapOptions.forEach((option) => {
|
|
143
145
|
for (const potential of option.potentials) {
|
|
144
146
|
let replacement;
|
|
145
147
|
const starIndex = potential.indexOf('*');
|
package/src/resource_loader.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Compilation } from 'webpack';
|
|
2
9
|
export declare class WebpackResourceLoader {
|
|
3
10
|
private _parentCompilation?;
|
|
@@ -11,8 +18,8 @@ export declare class WebpackResourceLoader {
|
|
|
11
18
|
update(parentCompilation: Compilation, changedFiles?: Iterable<string>): void;
|
|
12
19
|
clearParentCompilation(): void;
|
|
13
20
|
getModifiedResourceFiles(): Set<string>;
|
|
14
|
-
getResourceDependencies(filePath: string): never[]
|
|
15
|
-
getAffectedResources(file: string): never[]
|
|
21
|
+
getResourceDependencies(filePath: string): Set<string> | never[];
|
|
22
|
+
getAffectedResources(file: string): Set<string> | never[];
|
|
16
23
|
setAffectedResources(file: string, resources: Iterable<string>): void;
|
|
17
24
|
private _compile;
|
|
18
25
|
private _evaluate;
|
package/src/resource_loader.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebpackResourceLoader = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.WebpackResourceLoader = void 0;
|
|
11
11
|
const crypto_1 = require("crypto");
|
|
12
12
|
const path = require("path");
|
|
13
13
|
const vm = require("vm");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.elideImports = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.elideImports = void 0;
|
|
11
11
|
const ts = require("typescript");
|
|
12
12
|
const interfaces_1 = require("./interfaces");
|
|
13
13
|
// Remove imports for which all identifiers have been removed.
|
|
@@ -64,7 +64,8 @@ function elideImports(sourceFile, removedNodes, getTypeChecker, compilerOptions)
|
|
|
64
64
|
// In all cases we need the type reference not to be elided.
|
|
65
65
|
isTypeReferenceForDecoratoredNode = !!(((_c = parent.decorators) === null || _c === void 0 ? void 0 : _c.length) ||
|
|
66
66
|
(ts.isSetAccessor(parent.parent) && !!((_d = parent.parent.decorators) === null || _d === void 0 ? void 0 : _d.length)) ||
|
|
67
|
-
(ts.isConstructorDeclaration(parent.parent) &&
|
|
67
|
+
(ts.isConstructorDeclaration(parent.parent) &&
|
|
68
|
+
!!((_e = parent.parent.parent.decorators) === null || _e === void 0 ? void 0 : _e.length)));
|
|
68
69
|
break;
|
|
69
70
|
}
|
|
70
71
|
if (isTypeReferenceForDecoratoredNode) {
|
|
@@ -132,9 +133,7 @@ function elideImports(sourceFile, removedNodes, getTypeChecker, compilerOptions)
|
|
|
132
133
|
if (isUnused(specifier.name)) {
|
|
133
134
|
removedClausesCount++;
|
|
134
135
|
// in case we don't have any more namedImports we should remove the parent ie the {}
|
|
135
|
-
const nodeToRemove = clausesCount === removedClausesCount
|
|
136
|
-
? specifier.parent
|
|
137
|
-
: specifier;
|
|
136
|
+
const nodeToRemove = clausesCount === removedClausesCount ? specifier.parent : specifier;
|
|
138
137
|
specifierOps.push(new interfaces_1.RemoveNodeOperation(sourceFile, nodeToRemove));
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
10
|
if (k2 === undefined) k2 = k;
|
|
4
11
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -10,12 +17,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
17
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
18
|
};
|
|
12
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
16
|
-
*
|
|
17
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
18
|
-
* found in the LICENSE file at https://angular.io/license
|
|
19
|
-
*/
|
|
20
20
|
__exportStar(require("./elide_imports"), exports);
|
|
21
21
|
__exportStar(require("./replace_resources"), exports);
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.ReplaceNodeOperation = exports.AddNodeOperation = exports.RemoveNodeOperation = exports.TransformOperation = exports.OPERATION_KIND = void 0;
|
|
4
11
|
var OPERATION_KIND;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeIvyJitSupportCalls = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.removeIvyJitSupportCalls = void 0;
|
|
11
11
|
const ts = require("typescript");
|
|
12
12
|
const elide_imports_1 = require("./elide_imports");
|
|
13
13
|
function removeIvyJitSupportCalls(classMetadata, ngModuleScope, getTypeChecker) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.workaroundStylePreprocessing = exports.getResourceUrl = exports.replaceResources = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.workaroundStylePreprocessing = exports.getResourceUrl = exports.replaceResources = void 0;
|
|
11
11
|
const ts = require("typescript");
|
|
12
12
|
function replaceResources(shouldTransform, getTypeChecker, directTemplateLoading = false, inlineStyleMimeType) {
|
|
13
13
|
if (inlineStyleMimeType && !/^text\/[-.\w]+$/.test(inlineStyleMimeType)) {
|
|
@@ -68,9 +68,7 @@ function visitDecorator(nodeFactory, node, typeChecker, directTemplateLoading, r
|
|
|
68
68
|
const styleProperty = nodeFactory.createPropertyAssignment(nodeFactory.createIdentifier('styles'), nodeFactory.createArrayLiteralExpression(styleReplacements));
|
|
69
69
|
properties = nodeFactory.createNodeArray([...properties, styleProperty]);
|
|
70
70
|
}
|
|
71
|
-
return nodeFactory.updateDecorator(node, nodeFactory.updateCallExpression(decoratorFactory, decoratorFactory.expression, decoratorFactory.typeArguments, [
|
|
72
|
-
nodeFactory.updateObjectLiteralExpression(objectExpression, properties),
|
|
73
|
-
]));
|
|
71
|
+
return nodeFactory.updateDecorator(node, nodeFactory.updateCallExpression(decoratorFactory, decoratorFactory.expression, decoratorFactory.typeArguments, [nodeFactory.updateObjectLiteralExpression(objectExpression, properties)]));
|
|
74
72
|
}
|
|
75
73
|
function visitComponentMetadata(nodeFactory, node, styleReplacements, directTemplateLoading, resourceImportDeclarations, moduleKind, inlineStyleMimeType) {
|
|
76
74
|
if (!ts.isPropertyAssignment(node) || ts.isComputedPropertyName(node.name)) {
|
|
@@ -96,7 +94,7 @@ function visitComponentMetadata(nodeFactory, node, styleReplacements, directTemp
|
|
|
96
94
|
return node;
|
|
97
95
|
}
|
|
98
96
|
const isInlineStyle = name === 'styles';
|
|
99
|
-
const styles = ts.visitNodes(node.initializer.elements, node => {
|
|
97
|
+
const styles = ts.visitNodes(node.initializer.elements, (node) => {
|
|
100
98
|
if (!ts.isStringLiteral(node) && !ts.isNoSubstitutionTemplateLiteral(node)) {
|
|
101
99
|
return node;
|
|
102
100
|
}
|
|
@@ -246,13 +244,13 @@ function visitDecoratorWorkaround(node) {
|
|
|
246
244
|
const emptyArray = nodeFactory.createArrayLiteralExpression();
|
|
247
245
|
const stylePropertyName = nodeFactory.createIdentifier('styles');
|
|
248
246
|
const styleProperty = nodeFactory.createPropertyAssignment(stylePropertyName, emptyArray);
|
|
249
|
-
//
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
248
|
stylePropertyName.parent = styleProperty;
|
|
251
|
-
//
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
252
250
|
emptyArray.parent = styleProperty;
|
|
253
|
-
//
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
254
252
|
styleProperty.parent = objectExpression;
|
|
255
|
-
//
|
|
253
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
256
254
|
objectExpression.properties = nodeFactory.createNodeArray([
|
|
257
255
|
...objectExpression.properties,
|
|
258
256
|
styleProperty,
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import * as ts from 'typescript';
|
|
2
9
|
export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean, extraCompilerOptions?: ts.CompilerOptions, jsxFile?: boolean): {
|
|
3
10
|
compilerHost: ts.CompilerHost;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformTypescript = exports.createTypescriptContext = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.transformTypescript = exports.createTypescriptContext = void 0;
|
|
11
11
|
const path_1 = require("path");
|
|
12
12
|
const ts = require("typescript");
|
|
13
13
|
// Test transform helpers.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
7
|
+
*/
|
|
8
8
|
import { Compilation } from 'webpack';
|
|
9
9
|
export declare function addWarning(compilation: Compilation, message: string): void;
|
|
10
10
|
export declare function addError(compilation: Compilation, message: string): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addError = exports.addWarning = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
|
-
*/
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.addError = exports.addWarning = void 0;
|
|
11
11
|
const webpack_1 = require("webpack");
|
|
12
12
|
function addWarning(compilation, message) {
|
|
13
13
|
compilation.warnings.push(new webpack_1.WebpackError(message));
|