@ngtools/webpack 12.1.0-next.5 → 12.1.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/README.md +1 -1
- package/package.json +1 -1
- package/src/index.js +24 -2
- package/src/inline-data-loader.js +1 -1
- package/src/ivy/host.js +21 -7
- package/src/ivy/loader.js +20 -1
- package/src/ivy/paths.js +20 -1
- package/src/ivy/plugin.d.ts +1 -0
- package/src/ivy/plugin.js +24 -5
- package/src/ivy/symbol.js +1 -1
- package/src/ivy/system.js +20 -1
- package/src/ivy/transformation.js +20 -1
- package/src/ngcc_processor.js +20 -1
- package/src/paths-plugin.js +20 -1
- package/src/resource_loader.js +55 -29
- package/src/transformers/elide_imports.js +20 -1
- package/src/transformers/remove-ivy-jit-support-calls.js +20 -1
- package/src/transformers/replace_resources.d.ts +0 -1
- package/src/transformers/replace_resources.js +22 -62
- package/src/transformers/spec_helpers.js +20 -1
package/README.md
CHANGED
|
@@ -37,4 +37,4 @@ The loader works with webpack plugin to compile the application's TypeScript. It
|
|
|
37
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
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
39
|
- `fileReplacements` [default: none] - Allows replacing TypeScript files with other TypeScript files in the build. This option acts on fully resolved file paths.
|
|
40
|
-
- `
|
|
40
|
+
- `inlineStyleFileExtension` [default: none] - When set inline component styles will be processed by Webpack as files with the provided extension.
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -6,13 +6,35 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
9
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
32
|
exports.ivy = exports.default = exports.AngularWebpackPlugin = exports.AngularWebpackLoaderPath = void 0;
|
|
11
|
-
const ivyInternal = require("./ivy");
|
|
33
|
+
const ivyInternal = __importStar(require("./ivy"));
|
|
12
34
|
var ivy_1 = require("./ivy");
|
|
13
35
|
Object.defineProperty(exports, "AngularWebpackLoaderPath", { enumerable: true, get: function () { return ivy_1.AngularWebpackLoaderPath; } });
|
|
14
36
|
Object.defineProperty(exports, "AngularWebpackPlugin", { enumerable: true, get: function () { return ivy_1.AngularWebpackPlugin; } });
|
|
15
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return ivy_1.default; } });
|
|
37
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ivy_1).default; } });
|
|
16
38
|
/** @deprecated Deprecated as of v12, please use the direct exports
|
|
17
39
|
* (`AngularWebpackPlugin` instead of `ivy.AngularWebpackPlugin`)
|
|
18
40
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.InlineAngularResourceSymbol = void 0;
|
|
11
|
-
exports.InlineAngularResourceSymbol = Symbol();
|
|
11
|
+
exports.InlineAngularResourceSymbol = Symbol('@ngtools/webpack[angular-resource]');
|
|
12
12
|
function default_1() {
|
|
13
13
|
const callback = this.async();
|
|
14
14
|
const { data } = this.getOptions();
|
package/src/ivy/host.js
CHANGED
|
@@ -6,12 +6,30 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.augmentHostWithCaching = exports.augmentProgramWithVersioning = exports.augmentHostWithVersioning = exports.augmentHostWithSubstitutions = exports.augmentHostWithReplacements = exports.augmentHostWithNgcc = exports.augmentHostWithDependencyCollection = exports.augmentHostWithResources = void 0;
|
|
11
30
|
const crypto_1 = require("crypto");
|
|
12
|
-
const path = require("path");
|
|
13
|
-
const ts = require("typescript");
|
|
14
|
-
const transformers_1 = require("../transformers");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const ts = __importStar(require("typescript"));
|
|
15
33
|
const paths_1 = require("./paths");
|
|
16
34
|
function augmentHostWithResources(host, resourceLoader, options = {}) {
|
|
17
35
|
const resourceHost = host;
|
|
@@ -229,10 +247,6 @@ function augmentHostWithCaching(host, cache) {
|
|
|
229
247
|
}
|
|
230
248
|
const file = baseGetSourceFile.call(host, fileName, languageVersion, onError, true, ...parameters);
|
|
231
249
|
if (file) {
|
|
232
|
-
// Temporary workaround for upstream transform resource defect
|
|
233
|
-
if (file && !file.isDeclarationFile && file.text.includes('@Component')) {
|
|
234
|
-
transformers_1.workaroundStylePreprocessing(file);
|
|
235
|
-
}
|
|
236
250
|
cache.set(fileName, file);
|
|
237
251
|
}
|
|
238
252
|
return file;
|
package/src/ivy/loader.js
CHANGED
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.default = exports.angularWebpackLoader = void 0;
|
|
11
|
-
const path = require("path");
|
|
30
|
+
const path = __importStar(require("path"));
|
|
12
31
|
const symbol_1 = require("./symbol");
|
|
13
32
|
function angularWebpackLoader(content, map) {
|
|
14
33
|
const callback = this.async();
|
package/src/ivy/paths.js
CHANGED
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.externalizePath = exports.normalizePath = void 0;
|
|
11
|
-
const nodePath = require("path");
|
|
30
|
+
const nodePath = __importStar(require("path"));
|
|
12
31
|
const normalizationCache = new Map();
|
|
13
32
|
function normalizePath(path) {
|
|
14
33
|
let result = normalizationCache.get(path);
|
package/src/ivy/plugin.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface AngularWebpackPluginOptions {
|
|
|
16
16
|
emitClassMetadata: boolean;
|
|
17
17
|
emitNgModuleScope: boolean;
|
|
18
18
|
jitMode: boolean;
|
|
19
|
+
/** @deprecated use `inlineStyleFileExtension` instead. */
|
|
19
20
|
inlineStyleMimeType?: string;
|
|
20
21
|
inlineStyleFileExtension?: string;
|
|
21
22
|
}
|
package/src/ivy/plugin.js
CHANGED
|
@@ -6,12 +6,31 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.AngularWebpackPlugin = void 0;
|
|
11
30
|
const compiler_cli_1 = require("@angular/compiler-cli");
|
|
12
31
|
const program_1 = require("@angular/compiler-cli/src/ngtsc/program");
|
|
13
32
|
const crypto_1 = require("crypto");
|
|
14
|
-
const ts = require("typescript");
|
|
33
|
+
const ts = __importStar(require("typescript"));
|
|
15
34
|
const ngcc_processor_1 = require("../ngcc_processor");
|
|
16
35
|
const paths_plugin_1 = require("../paths-plugin");
|
|
17
36
|
const resource_loader_1 = require("../resource_loader");
|
|
@@ -77,7 +96,7 @@ class AngularWebpackPlugin {
|
|
|
77
96
|
}
|
|
78
97
|
// Set resolver options
|
|
79
98
|
const pathsPlugin = new paths_plugin_1.TypeScriptPathsPlugin();
|
|
80
|
-
compiler.hooks.afterResolvers.tap(
|
|
99
|
+
compiler.hooks.afterResolvers.tap(PLUGIN_NAME, (compiler) => {
|
|
81
100
|
// When Ivy is enabled we need to add the fields added by NGCC
|
|
82
101
|
// to take precedence over the provided mainFields.
|
|
83
102
|
// NGCC adds fields in package.json suffixed with '_ivy_ngcc'
|
|
@@ -343,17 +362,17 @@ class AngularWebpackPlugin {
|
|
|
343
362
|
affectedFiles.add(result.affected);
|
|
344
363
|
}
|
|
345
364
|
}
|
|
346
|
-
// Collect
|
|
365
|
+
// Collect program level diagnostics
|
|
347
366
|
const diagnostics = [
|
|
348
367
|
...angularCompiler.getOptionDiagnostics(),
|
|
349
368
|
...builder.getOptionsDiagnostics(),
|
|
350
369
|
...builder.getGlobalDiagnostics(),
|
|
351
|
-
...builder.getSyntacticDiagnostics(),
|
|
352
370
|
];
|
|
353
371
|
diagnosticsReporter(diagnostics);
|
|
354
|
-
// Collect
|
|
372
|
+
// Collect source file specific diagnostics
|
|
355
373
|
for (const sourceFile of builder.getSourceFiles()) {
|
|
356
374
|
if (!ignoreForDiagnostics.has(sourceFile)) {
|
|
375
|
+
diagnosticsReporter(builder.getSyntacticDiagnostics(sourceFile));
|
|
357
376
|
diagnosticsReporter(builder.getSemanticDiagnostics(sourceFile));
|
|
358
377
|
}
|
|
359
378
|
}
|
package/src/ivy/symbol.js
CHANGED
|
@@ -20,7 +20,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
20
20
|
var _FileEmitterRegistration_fileEmitter, _FileEmitterCollection_registrations;
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.FileEmitterCollection = exports.FileEmitterRegistration = exports.AngularPluginSymbol = void 0;
|
|
23
|
-
exports.AngularPluginSymbol = Symbol.for('@
|
|
23
|
+
exports.AngularPluginSymbol = Symbol.for('@ngtools/webpack[angular-compiler]');
|
|
24
24
|
class FileEmitterRegistration {
|
|
25
25
|
constructor() {
|
|
26
26
|
_FileEmitterRegistration_fileEmitter.set(this, void 0);
|
package/src/ivy/system.js
CHANGED
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.createWebpackSystem = void 0;
|
|
11
|
-
const ts = require("typescript");
|
|
30
|
+
const ts = __importStar(require("typescript"));
|
|
12
31
|
const paths_1 = require("./paths");
|
|
13
32
|
function shouldNotWrite() {
|
|
14
33
|
throw new Error('Webpack TypeScript System should not write.');
|
|
@@ -6,10 +6,29 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.replaceBootstrap = exports.mergeTransformers = exports.createJitTransformers = exports.createAotTransformers = void 0;
|
|
11
30
|
const compiler_cli_1 = require("@angular/compiler-cli");
|
|
12
|
-
const ts = require("typescript");
|
|
31
|
+
const ts = __importStar(require("typescript"));
|
|
13
32
|
const elide_imports_1 = require("../transformers/elide_imports");
|
|
14
33
|
const remove_ivy_jit_support_calls_1 = require("../transformers/remove-ivy-jit-support-calls");
|
|
15
34
|
const replace_resources_1 = require("../transformers/replace_resources");
|
package/src/ngcc_processor.js
CHANGED
|
@@ -6,13 +6,32 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.NgccProcessor = void 0;
|
|
11
30
|
const ngcc_1 = require("@angular/compiler-cli/ngcc");
|
|
12
31
|
const child_process_1 = require("child_process");
|
|
13
32
|
const crypto_1 = require("crypto");
|
|
14
33
|
const fs_1 = require("fs");
|
|
15
|
-
const path = require("path");
|
|
34
|
+
const path = __importStar(require("path"));
|
|
16
35
|
const benchmark_1 = require("./benchmark");
|
|
17
36
|
// We cannot create a plugin for this, because NGTSC requires addition type
|
|
18
37
|
// information which ngcc creates when processing a package which was compiled with NGC.
|
package/src/paths-plugin.js
CHANGED
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.TypeScriptPathsPlugin = void 0;
|
|
11
|
-
const path = require("path");
|
|
30
|
+
const path = __importStar(require("path"));
|
|
12
31
|
const getInnerRequest = require('enhanced-resolve/lib/getInnerRequest');
|
|
13
32
|
class TypeScriptPathsPlugin {
|
|
14
33
|
constructor(options) {
|
package/src/resource_loader.js
CHANGED
|
@@ -6,11 +6,30 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.WebpackResourceLoader = void 0;
|
|
11
30
|
const crypto_1 = require("crypto");
|
|
12
|
-
const path = require("path");
|
|
13
|
-
const vm = require("vm");
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const vm = __importStar(require("vm"));
|
|
14
33
|
const inline_data_loader_1 = require("./inline-data-loader");
|
|
15
34
|
const paths_1 = require("./ivy/paths");
|
|
16
35
|
class WebpackResourceLoader {
|
|
@@ -169,13 +188,38 @@ class WebpackResourceLoader {
|
|
|
169
188
|
const parent = childCompiler.parentCompilation;
|
|
170
189
|
if (parent) {
|
|
171
190
|
parent.children = parent.children.filter((child) => child !== childCompilation);
|
|
172
|
-
|
|
173
|
-
|
|
191
|
+
let fileDependencies;
|
|
192
|
+
for (const dependency of childCompilation.fileDependencies) {
|
|
193
|
+
// Skip paths that do not appear to be files (have no extension).
|
|
194
|
+
// `fileDependencies` can contain directories and not just files which can
|
|
195
|
+
// cause incorrect cache invalidation on rebuilds.
|
|
196
|
+
if (!path.extname(dependency)) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (data && containingFile && dependency.endsWith(entry)) {
|
|
174
200
|
// use containing file if the resource was inline
|
|
175
201
|
parent.fileDependencies.add(containingFile);
|
|
176
202
|
}
|
|
177
203
|
else {
|
|
178
|
-
parent.fileDependencies.add(
|
|
204
|
+
parent.fileDependencies.add(dependency);
|
|
205
|
+
}
|
|
206
|
+
// Save the dependencies for this resource.
|
|
207
|
+
if (filePath) {
|
|
208
|
+
const resolvedFile = paths_1.normalizePath(dependency);
|
|
209
|
+
const entry = this._reverseDependencies.get(resolvedFile);
|
|
210
|
+
if (entry) {
|
|
211
|
+
entry.add(filePath);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
this._reverseDependencies.set(resolvedFile, new Set([filePath]));
|
|
215
|
+
}
|
|
216
|
+
if (fileDependencies) {
|
|
217
|
+
fileDependencies.add(dependency);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
fileDependencies = new Set([dependency]);
|
|
221
|
+
this._fileDependencies.set(filePath, fileDependencies);
|
|
222
|
+
}
|
|
179
223
|
}
|
|
180
224
|
}
|
|
181
225
|
parent.contextDependencies.addAll(childCompilation.contextDependencies);
|
|
@@ -183,30 +227,12 @@ class WebpackResourceLoader {
|
|
|
183
227
|
parent.buildDependencies.addAll(childCompilation.buildDependencies);
|
|
184
228
|
parent.warnings.push(...childCompilation.warnings);
|
|
185
229
|
parent.errors.push(...childCompilation.errors);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
// Save the dependencies for this resource.
|
|
194
|
-
if (filePath) {
|
|
195
|
-
this._fileDependencies.set(filePath, new Set(childCompilation.fileDependencies));
|
|
196
|
-
for (const file of childCompilation.fileDependencies) {
|
|
197
|
-
const resolvedFile = paths_1.normalizePath(file);
|
|
198
|
-
// Skip paths that do not appear to be files (have no extension).
|
|
199
|
-
// `fileDependencies` can contain directories and not just files which can
|
|
200
|
-
// cause incorrect cache invalidation on rebuilds.
|
|
201
|
-
if (!path.extname(resolvedFile)) {
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
const entry = this._reverseDependencies.get(resolvedFile);
|
|
205
|
-
if (entry) {
|
|
206
|
-
entry.add(filePath);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
this._reverseDependencies.set(resolvedFile, new Set([filePath]));
|
|
230
|
+
if (this.assetCache) {
|
|
231
|
+
for (const { info, name, source } of childCompilation.getAssets()) {
|
|
232
|
+
// Use the originating file as the cache key if present
|
|
233
|
+
// Otherwise, generate a cache key based on the generated name
|
|
234
|
+
const cacheKey = (_a = info.sourceFilename) !== null && _a !== void 0 ? _a : `!![GENERATED]:${name}`;
|
|
235
|
+
this.assetCache.set(cacheKey, { info, name, source });
|
|
210
236
|
}
|
|
211
237
|
}
|
|
212
238
|
}
|
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.elideImports = void 0;
|
|
11
|
-
const ts = require("typescript");
|
|
30
|
+
const ts = __importStar(require("typescript"));
|
|
12
31
|
// Remove imports for which all identifiers have been removed.
|
|
13
32
|
// Needs type checker, and works even if it's not the first transformer.
|
|
14
33
|
// Works by removing imports for symbols whose identifiers have all been removed.
|
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.removeIvyJitSupportCalls = void 0;
|
|
11
|
-
const ts = require("typescript");
|
|
30
|
+
const ts = __importStar(require("typescript"));
|
|
12
31
|
const elide_imports_1 = require("./elide_imports");
|
|
13
32
|
function removeIvyJitSupportCalls(classMetadata, ngModuleScope, getTypeChecker) {
|
|
14
33
|
return (context) => {
|
|
@@ -8,4 +8,3 @@
|
|
|
8
8
|
import * as ts from 'typescript';
|
|
9
9
|
export declare function replaceResources(shouldTransform: (fileName: string) => boolean, getTypeChecker: () => ts.TypeChecker, directTemplateLoading?: boolean, inlineStyleMimeType?: string, inlineStyleFileExtension?: string): ts.TransformerFactory<ts.SourceFile>;
|
|
10
10
|
export declare function getResourceUrl(node: ts.Node, loader?: string): string | null;
|
|
11
|
-
export declare function workaroundStylePreprocessing(sourceFile: ts.SourceFile): void;
|
|
@@ -6,9 +6,28 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
const ts = require("typescript");
|
|
29
|
+
exports.getResourceUrl = exports.replaceResources = void 0;
|
|
30
|
+
const ts = __importStar(require("typescript"));
|
|
12
31
|
const inlineDataLoaderPath = require.resolve('../inline-data-loader');
|
|
13
32
|
function replaceResources(shouldTransform, getTypeChecker, directTemplateLoading = false, inlineStyleMimeType, inlineStyleFileExtension) {
|
|
14
33
|
if (inlineStyleMimeType && !/^text\/[-.\w]+$/.test(inlineStyleMimeType)) {
|
|
@@ -108,7 +127,7 @@ function visitComponentMetadata(nodeFactory, node, styleReplacements, directTemp
|
|
|
108
127
|
else if (inlineStyleFileExtension) {
|
|
109
128
|
const data = Buffer.from(node.text).toString('base64');
|
|
110
129
|
const containingFile = node.getSourceFile().fileName;
|
|
111
|
-
url = `${containingFile}.${inlineStyleFileExtension}!=!${inlineDataLoaderPath}?data=${data}!${containingFile}`;
|
|
130
|
+
url = `${containingFile}.${inlineStyleFileExtension}!=!${inlineDataLoaderPath}?data=${encodeURIComponent(data)}!${containingFile}`;
|
|
112
131
|
}
|
|
113
132
|
else {
|
|
114
133
|
return nodeFactory.createStringLiteral(node.text);
|
|
@@ -203,62 +222,3 @@ function getDecoratorOrigin(decorator, typeChecker) {
|
|
|
203
222
|
}
|
|
204
223
|
return null;
|
|
205
224
|
}
|
|
206
|
-
function workaroundStylePreprocessing(sourceFile) {
|
|
207
|
-
const visitNode = (node) => {
|
|
208
|
-
var _a;
|
|
209
|
-
if (ts.isClassDeclaration(node) && ((_a = node.decorators) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
210
|
-
for (const decorator of node.decorators) {
|
|
211
|
-
visitDecoratorWorkaround(decorator);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return ts.forEachChild(node, visitNode);
|
|
215
|
-
};
|
|
216
|
-
ts.forEachChild(sourceFile, visitNode);
|
|
217
|
-
}
|
|
218
|
-
exports.workaroundStylePreprocessing = workaroundStylePreprocessing;
|
|
219
|
-
function visitDecoratorWorkaround(node) {
|
|
220
|
-
if (!ts.isCallExpression(node.expression)) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const decoratorFactory = node.expression;
|
|
224
|
-
if (!ts.isIdentifier(decoratorFactory.expression) ||
|
|
225
|
-
decoratorFactory.expression.text !== 'Component') {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
const args = decoratorFactory.arguments;
|
|
229
|
-
if (args.length !== 1 || !ts.isObjectLiteralExpression(args[0])) {
|
|
230
|
-
// Unsupported component metadata
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const objectExpression = args[0];
|
|
234
|
-
// check if a `styles` property is present
|
|
235
|
-
let hasStyles = false;
|
|
236
|
-
for (const element of objectExpression.properties) {
|
|
237
|
-
if (!ts.isPropertyAssignment(element) || ts.isComputedPropertyName(element.name)) {
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
if (element.name.text === 'styles') {
|
|
241
|
-
hasStyles = true;
|
|
242
|
-
break;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (hasStyles) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
const nodeFactory = ts.factory;
|
|
249
|
-
// add a `styles` property to workaround upstream compiler defect
|
|
250
|
-
const emptyArray = nodeFactory.createArrayLiteralExpression();
|
|
251
|
-
const stylePropertyName = nodeFactory.createIdentifier('styles');
|
|
252
|
-
const styleProperty = nodeFactory.createPropertyAssignment(stylePropertyName, emptyArray);
|
|
253
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
254
|
-
stylePropertyName.parent = styleProperty;
|
|
255
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
256
|
-
emptyArray.parent = styleProperty;
|
|
257
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
258
|
-
styleProperty.parent = objectExpression;
|
|
259
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
|
-
objectExpression.properties = nodeFactory.createNodeArray([
|
|
261
|
-
...objectExpression.properties,
|
|
262
|
-
styleProperty,
|
|
263
|
-
]);
|
|
264
|
-
}
|
|
@@ -6,10 +6,29 @@
|
|
|
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
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.transformTypescript = exports.createTypescriptContext = void 0;
|
|
11
30
|
const path_1 = require("path");
|
|
12
|
-
const ts = require("typescript");
|
|
31
|
+
const ts = __importStar(require("typescript"));
|
|
13
32
|
// Test transform helpers.
|
|
14
33
|
const basefileName = 'test-file.ts';
|
|
15
34
|
function createTypescriptContext(content, additionalFiles, useLibs = false, extraCompilerOptions = {}, jsxFile = false) {
|