@ngtools/webpack 12.2.0-next.0 → 12.2.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/package.json +3 -5
- package/src/ivy/diagnostics.d.ts +3 -1
- package/src/ivy/diagnostics.js +11 -4
- package/src/ivy/loader.d.ts +2 -4
- package/src/ivy/plugin.js +6 -7
- package/src/loaders/direct-resource.d.ts +9 -0
- package/src/loaders/direct-resource.js +15 -0
- package/src/{inline-data-loader.d.ts → loaders/inline-resource.d.ts} +1 -0
- package/src/{inline-data-loader.js → loaders/inline-resource.js} +2 -1
- package/src/ngcc_processor.d.ts +4 -2
- package/src/paths-plugin.d.ts +4 -1
- package/src/paths-plugin.js +1 -3
- package/src/resource_loader.js +38 -33
- package/src/transformers/replace_resources.js +4 -3
- package/src/webpack-diagnostics.d.ts +0 -10
- package/src/webpack-diagnostics.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngtools/webpack",
|
|
3
|
-
"version": "12.2.0
|
|
3
|
+
"version": "12.2.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",
|
|
@@ -24,11 +24,9 @@
|
|
|
24
24
|
"url": "https://github.com/angular/angular-cli/issues"
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"enhanced-resolve": "5.8.2"
|
|
29
|
-
},
|
|
27
|
+
"dependencies": {},
|
|
30
28
|
"peerDependencies": {
|
|
31
|
-
"@angular/compiler-cli": "^12.0.0 || ^12.
|
|
29
|
+
"@angular/compiler-cli": "^12.0.0 || ^12.2.0-next",
|
|
32
30
|
"typescript": "~4.2.3 || ~4.3.2",
|
|
33
31
|
"webpack": "^5.30.0"
|
|
34
32
|
},
|
package/src/ivy/diagnostics.d.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { Diagnostics } from '@angular/compiler-cli';
|
|
9
|
-
import { Compilation } from 'webpack';
|
|
9
|
+
import type { Compilation } from 'webpack';
|
|
10
10
|
export declare type DiagnosticsReporter = (diagnostics: Diagnostics) => void;
|
|
11
11
|
export declare function createDiagnosticsReporter(compilation: Compilation): DiagnosticsReporter;
|
|
12
|
+
export declare function addWarning(compilation: Compilation, message: string): void;
|
|
13
|
+
export declare function addError(compilation: Compilation, message: string): void;
|
package/src/ivy/diagnostics.js
CHANGED
|
@@ -7,21 +7,28 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.createDiagnosticsReporter = void 0;
|
|
10
|
+
exports.addError = exports.addWarning = exports.createDiagnosticsReporter = void 0;
|
|
11
11
|
const compiler_cli_1 = require("@angular/compiler-cli");
|
|
12
12
|
const typescript_1 = require("typescript");
|
|
13
|
-
const webpack_diagnostics_1 = require("../webpack-diagnostics");
|
|
14
13
|
function createDiagnosticsReporter(compilation) {
|
|
15
14
|
return (diagnostics) => {
|
|
16
15
|
for (const diagnostic of diagnostics) {
|
|
17
16
|
const text = compiler_cli_1.formatDiagnostics([diagnostic]);
|
|
18
17
|
if (diagnostic.category === typescript_1.DiagnosticCategory.Error) {
|
|
19
|
-
|
|
18
|
+
addError(compilation, text);
|
|
20
19
|
}
|
|
21
20
|
else {
|
|
22
|
-
|
|
21
|
+
addWarning(compilation, text);
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
exports.createDiagnosticsReporter = createDiagnosticsReporter;
|
|
27
|
+
function addWarning(compilation, message) {
|
|
28
|
+
compilation.warnings.push(new compilation.compiler.webpack.WebpackError(message));
|
|
29
|
+
}
|
|
30
|
+
exports.addWarning = addWarning;
|
|
31
|
+
function addError(compilation, message) {
|
|
32
|
+
compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
|
|
33
|
+
}
|
|
34
|
+
exports.addError = addError;
|
package/src/ivy/loader.d.ts
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
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
|
-
import {
|
|
9
|
-
export declare function angularWebpackLoader(this:
|
|
10
|
-
[AngularPluginSymbol]?: FileEmitterCollection;
|
|
11
|
-
}, content: string, map: string): void;
|
|
8
|
+
import type { LoaderContext } from 'webpack';
|
|
9
|
+
export declare function angularWebpackLoader(this: LoaderContext<unknown>, content: string, map: string): void;
|
|
12
10
|
export { angularWebpackLoader as default };
|
package/src/ivy/plugin.js
CHANGED
|
@@ -34,7 +34,6 @@ const ts = __importStar(require("typescript"));
|
|
|
34
34
|
const ngcc_processor_1 = require("../ngcc_processor");
|
|
35
35
|
const paths_plugin_1 = require("../paths-plugin");
|
|
36
36
|
const resource_loader_1 = require("../resource_loader");
|
|
37
|
-
const webpack_diagnostics_1 = require("../webpack-diagnostics");
|
|
38
37
|
const cache_1 = require("./cache");
|
|
39
38
|
const diagnostics_1 = require("./diagnostics");
|
|
40
39
|
const host_1 = require("./host");
|
|
@@ -128,8 +127,8 @@ class AngularWebpackPlugin {
|
|
|
128
127
|
if (!ngccProcessor) {
|
|
129
128
|
const { processor, errors, warnings } = initializeNgccProcessor(compiler, this.pluginOptions.tsconfig);
|
|
130
129
|
processor.process();
|
|
131
|
-
warnings.forEach((warning) =>
|
|
132
|
-
errors.forEach((error) =>
|
|
130
|
+
warnings.forEach((warning) => diagnostics_1.addWarning(compilation, warning));
|
|
131
|
+
errors.forEach((error) => diagnostics_1.addError(compilation, error));
|
|
133
132
|
ngccProcessor = processor;
|
|
134
133
|
}
|
|
135
134
|
// Setup and read TypeScript and Angular compiler configuration
|
|
@@ -220,7 +219,7 @@ class AngularWebpackPlugin {
|
|
|
220
219
|
if (previousUnused && previousUnused.has(unused)) {
|
|
221
220
|
continue;
|
|
222
221
|
}
|
|
223
|
-
|
|
222
|
+
diagnostics_1.addWarning(compilation, `${unused} is part of the TypeScript compilation but it's unused.\n` +
|
|
224
223
|
`Add only entry points to the 'files' or 'include' properties in your tsconfig.`);
|
|
225
224
|
}
|
|
226
225
|
previousUnused = currentUnused;
|
|
@@ -362,17 +361,17 @@ class AngularWebpackPlugin {
|
|
|
362
361
|
affectedFiles.add(result.affected);
|
|
363
362
|
}
|
|
364
363
|
}
|
|
365
|
-
// Collect
|
|
364
|
+
// Collect program level diagnostics
|
|
366
365
|
const diagnostics = [
|
|
367
366
|
...angularCompiler.getOptionDiagnostics(),
|
|
368
367
|
...builder.getOptionsDiagnostics(),
|
|
369
368
|
...builder.getGlobalDiagnostics(),
|
|
370
|
-
...builder.getSyntacticDiagnostics(),
|
|
371
369
|
];
|
|
372
370
|
diagnosticsReporter(diagnostics);
|
|
373
|
-
// Collect
|
|
371
|
+
// Collect source file specific diagnostics
|
|
374
372
|
for (const sourceFile of builder.getSourceFiles()) {
|
|
375
373
|
if (!ignoreForDiagnostics.has(sourceFile)) {
|
|
374
|
+
diagnosticsReporter(builder.getSyntacticDiagnostics(sourceFile));
|
|
376
375
|
diagnosticsReporter(builder.getSemanticDiagnostics(sourceFile));
|
|
377
376
|
}
|
|
378
377
|
}
|
|
@@ -0,0 +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
|
+
*/
|
|
8
|
+
export declare const DirectAngularResourceLoaderPath: string;
|
|
9
|
+
export default function (content: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DirectAngularResourceLoaderPath = void 0;
|
|
11
|
+
exports.DirectAngularResourceLoaderPath = __filename;
|
|
12
|
+
function default_1(content) {
|
|
13
|
+
return `export default ${JSON.stringify(content)};`;
|
|
14
|
+
}
|
|
15
|
+
exports.default = default_1;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Compilation, LoaderContext } from 'webpack';
|
|
9
|
+
export declare const InlineAngularResourceLoaderPath: string;
|
|
9
10
|
export declare const InlineAngularResourceSymbol: unique symbol;
|
|
10
11
|
export interface CompilationWithInlineAngularResource extends Compilation {
|
|
11
12
|
[InlineAngularResourceSymbol]: string;
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.InlineAngularResourceSymbol = void 0;
|
|
10
|
+
exports.InlineAngularResourceSymbol = exports.InlineAngularResourceLoaderPath = void 0;
|
|
11
|
+
exports.InlineAngularResourceLoaderPath = __filename;
|
|
11
12
|
exports.InlineAngularResourceSymbol = Symbol('@ngtools/webpack[angular-resource]');
|
|
12
13
|
function default_1() {
|
|
13
14
|
const callback = this.async();
|
package/src/ngcc_processor.d.ts
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
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
|
-
import { Resolver } from 'enhanced-resolve';
|
|
9
8
|
import * as ts from 'typescript';
|
|
9
|
+
import type { Compiler } from 'webpack';
|
|
10
10
|
import { InputFileSystem } from './ivy/system';
|
|
11
|
+
declare type ResolverWithOptions = ReturnType<Compiler['resolverFactory']['get']>;
|
|
11
12
|
export declare class NgccProcessor {
|
|
12
13
|
private readonly propertiesToConsider;
|
|
13
14
|
private readonly compilationWarnings;
|
|
@@ -19,7 +20,7 @@ export declare class NgccProcessor {
|
|
|
19
20
|
private _processedModules;
|
|
20
21
|
private _logger;
|
|
21
22
|
private _nodeModulesDirectory;
|
|
22
|
-
constructor(propertiesToConsider: string[], compilationWarnings: (Error | string)[], compilationErrors: (Error | string)[], basePath: string, tsConfigPath: string, inputFileSystem: InputFileSystem, resolver:
|
|
23
|
+
constructor(propertiesToConsider: string[], compilationWarnings: (Error | string)[], compilationErrors: (Error | string)[], basePath: string, tsConfigPath: string, inputFileSystem: InputFileSystem, resolver: ResolverWithOptions);
|
|
23
24
|
/** Process the entire node modules tree. */
|
|
24
25
|
process(): void;
|
|
25
26
|
/** Process a module and it's depedencies. */
|
|
@@ -31,3 +32,4 @@ export declare class NgccProcessor {
|
|
|
31
32
|
private tryResolvePackage;
|
|
32
33
|
private findNodeModulesDirectory;
|
|
33
34
|
}
|
|
35
|
+
export {};
|
package/src/paths-plugin.d.ts
CHANGED
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { CompilerOptions } from 'typescript';
|
|
9
|
+
import type { Configuration } from 'webpack';
|
|
9
10
|
export interface TypeScriptPathsPluginOptions extends Pick<CompilerOptions, 'paths' | 'baseUrl'> {
|
|
10
11
|
}
|
|
12
|
+
declare type Resolver = Exclude<Exclude<Configuration['resolve'], undefined>['resolver'], undefined>;
|
|
11
13
|
export declare class TypeScriptPathsPlugin {
|
|
12
14
|
private options?;
|
|
13
15
|
constructor(options?: TypeScriptPathsPluginOptions | undefined);
|
|
14
16
|
update(options: TypeScriptPathsPluginOptions): void;
|
|
15
|
-
apply(resolver:
|
|
17
|
+
apply(resolver: Resolver): void;
|
|
16
18
|
}
|
|
19
|
+
export {};
|
package/src/paths-plugin.js
CHANGED
|
@@ -28,7 +28,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.TypeScriptPathsPlugin = void 0;
|
|
30
30
|
const path = __importStar(require("path"));
|
|
31
|
-
const getInnerRequest = require('enhanced-resolve/lib/getInnerRequest');
|
|
32
31
|
class TypeScriptPathsPlugin {
|
|
33
32
|
constructor(options) {
|
|
34
33
|
this.options = options;
|
|
@@ -36,7 +35,6 @@ class TypeScriptPathsPlugin {
|
|
|
36
35
|
update(options) {
|
|
37
36
|
this.options = options;
|
|
38
37
|
}
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
38
|
apply(resolver) {
|
|
41
39
|
const target = resolver.ensureHook('resolve');
|
|
42
40
|
resolver.getHook('described-resolve').tapAsync('TypeScriptPathsPlugin',
|
|
@@ -50,7 +48,7 @@ class TypeScriptPathsPlugin {
|
|
|
50
48
|
callback();
|
|
51
49
|
return;
|
|
52
50
|
}
|
|
53
|
-
const originalRequest =
|
|
51
|
+
const originalRequest = request.request || request.path;
|
|
54
52
|
if (!originalRequest) {
|
|
55
53
|
callback();
|
|
56
54
|
return;
|
package/src/resource_loader.js
CHANGED
|
@@ -30,15 +30,15 @@ exports.WebpackResourceLoader = void 0;
|
|
|
30
30
|
const crypto_1 = require("crypto");
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const vm = __importStar(require("vm"));
|
|
33
|
-
const inline_data_loader_1 = require("./inline-data-loader");
|
|
34
33
|
const paths_1 = require("./ivy/paths");
|
|
34
|
+
const inline_resource_1 = require("./loaders/inline-resource");
|
|
35
35
|
class WebpackResourceLoader {
|
|
36
36
|
constructor(shouldCache) {
|
|
37
37
|
this._fileDependencies = new Map();
|
|
38
38
|
this._reverseDependencies = new Map();
|
|
39
39
|
this.modifiedResources = new Set();
|
|
40
40
|
this.outputPathCounter = 1;
|
|
41
|
-
this.inlineDataLoaderPath =
|
|
41
|
+
this.inlineDataLoaderPath = inline_resource_1.InlineAngularResourceLoaderPath;
|
|
42
42
|
if (shouldCache) {
|
|
43
43
|
this.fileCache = new Map();
|
|
44
44
|
this.assetCache = new Map();
|
|
@@ -141,7 +141,7 @@ class WebpackResourceLoader {
|
|
|
141
141
|
NormalModule.getCompilationHooks(compilation)
|
|
142
142
|
.readResourceForScheme.for('angular-resource')
|
|
143
143
|
.tap('angular-compiler', () => data);
|
|
144
|
-
compilation[
|
|
144
|
+
compilation[inline_resource_1.InlineAngularResourceSymbol] = data;
|
|
145
145
|
}
|
|
146
146
|
compilation.hooks.additionalAssets.tap('angular-compiler', () => {
|
|
147
147
|
const asset = compilation.assets[outputFilePath];
|
|
@@ -161,12 +161,10 @@ class WebpackResourceLoader {
|
|
|
161
161
|
});
|
|
162
162
|
});
|
|
163
163
|
let finalContent;
|
|
164
|
-
let finalMap;
|
|
165
164
|
childCompiler.hooks.compilation.tap('angular-compiler', (childCompilation) => {
|
|
166
165
|
childCompilation.hooks.processAssets.tap({ name: 'angular-compiler', stage: webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT }, () => {
|
|
167
|
-
var _a
|
|
166
|
+
var _a;
|
|
168
167
|
finalContent = (_a = childCompilation.assets[outputFilePath]) === null || _a === void 0 ? void 0 : _a.source().toString();
|
|
169
|
-
finalMap = (_b = childCompilation.assets[outputFilePath + '.map']) === null || _b === void 0 ? void 0 : _b.source().toString();
|
|
170
168
|
delete childCompilation.assets[outputFilePath];
|
|
171
169
|
delete childCompilation.assets[outputFilePath + '.map'];
|
|
172
170
|
});
|
|
@@ -188,13 +186,38 @@ class WebpackResourceLoader {
|
|
|
188
186
|
const parent = childCompiler.parentCompilation;
|
|
189
187
|
if (parent) {
|
|
190
188
|
parent.children = parent.children.filter((child) => child !== childCompilation);
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
let fileDependencies;
|
|
190
|
+
for (const dependency of childCompilation.fileDependencies) {
|
|
191
|
+
// Skip paths that do not appear to be files (have no extension).
|
|
192
|
+
// `fileDependencies` can contain directories and not just files which can
|
|
193
|
+
// cause incorrect cache invalidation on rebuilds.
|
|
194
|
+
if (!path.extname(dependency)) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (data && containingFile && dependency.endsWith(entry)) {
|
|
193
198
|
// use containing file if the resource was inline
|
|
194
199
|
parent.fileDependencies.add(containingFile);
|
|
195
200
|
}
|
|
196
201
|
else {
|
|
197
|
-
parent.fileDependencies.add(
|
|
202
|
+
parent.fileDependencies.add(dependency);
|
|
203
|
+
}
|
|
204
|
+
// Save the dependencies for this resource.
|
|
205
|
+
if (filePath) {
|
|
206
|
+
const resolvedFile = paths_1.normalizePath(dependency);
|
|
207
|
+
const entry = this._reverseDependencies.get(resolvedFile);
|
|
208
|
+
if (entry) {
|
|
209
|
+
entry.add(filePath);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
this._reverseDependencies.set(resolvedFile, new Set([filePath]));
|
|
213
|
+
}
|
|
214
|
+
if (fileDependencies) {
|
|
215
|
+
fileDependencies.add(dependency);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
fileDependencies = new Set([dependency]);
|
|
219
|
+
this._fileDependencies.set(filePath, fileDependencies);
|
|
220
|
+
}
|
|
198
221
|
}
|
|
199
222
|
}
|
|
200
223
|
parent.contextDependencies.addAll(childCompilation.contextDependencies);
|
|
@@ -202,30 +225,12 @@ class WebpackResourceLoader {
|
|
|
202
225
|
parent.buildDependencies.addAll(childCompilation.buildDependencies);
|
|
203
226
|
parent.warnings.push(...childCompilation.warnings);
|
|
204
227
|
parent.errors.push(...childCompilation.errors);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
// Save the dependencies for this resource.
|
|
213
|
-
if (filePath) {
|
|
214
|
-
this._fileDependencies.set(filePath, new Set(childCompilation.fileDependencies));
|
|
215
|
-
for (const file of childCompilation.fileDependencies) {
|
|
216
|
-
const resolvedFile = paths_1.normalizePath(file);
|
|
217
|
-
// Skip paths that do not appear to be files (have no extension).
|
|
218
|
-
// `fileDependencies` can contain directories and not just files which can
|
|
219
|
-
// cause incorrect cache invalidation on rebuilds.
|
|
220
|
-
if (!path.extname(resolvedFile)) {
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
const entry = this._reverseDependencies.get(resolvedFile);
|
|
224
|
-
if (entry) {
|
|
225
|
-
entry.add(filePath);
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
this._reverseDependencies.set(resolvedFile, new Set([filePath]));
|
|
228
|
+
if (this.assetCache) {
|
|
229
|
+
for (const { info, name, source } of childCompilation.getAssets()) {
|
|
230
|
+
// Use the originating file as the cache key if present
|
|
231
|
+
// Otherwise, generate a cache key based on the generated name
|
|
232
|
+
const cacheKey = (_a = info.sourceFilename) !== null && _a !== void 0 ? _a : `!![GENERATED]:${name}`;
|
|
233
|
+
this.assetCache.set(cacheKey, { info, name, source });
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
236
|
}
|
|
@@ -28,7 +28,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.getResourceUrl = exports.replaceResources = void 0;
|
|
30
30
|
const ts = __importStar(require("typescript"));
|
|
31
|
-
const
|
|
31
|
+
const direct_resource_1 = require("../loaders/direct-resource");
|
|
32
|
+
const inline_resource_1 = require("../loaders/inline-resource");
|
|
32
33
|
function replaceResources(shouldTransform, getTypeChecker, directTemplateLoading = false, inlineStyleMimeType, inlineStyleFileExtension) {
|
|
33
34
|
if (inlineStyleMimeType && !/^text\/[-.\w]+$/.test(inlineStyleMimeType)) {
|
|
34
35
|
throw new Error('Invalid inline style MIME type.');
|
|
@@ -99,7 +100,7 @@ function visitComponentMetadata(nodeFactory, node, styleReplacements, directTemp
|
|
|
99
100
|
case 'moduleId':
|
|
100
101
|
return undefined;
|
|
101
102
|
case 'templateUrl':
|
|
102
|
-
const url = getResourceUrl(node.initializer, directTemplateLoading ?
|
|
103
|
+
const url = getResourceUrl(node.initializer, directTemplateLoading ? `!${direct_resource_1.DirectAngularResourceLoaderPath}!` : '');
|
|
103
104
|
if (!url) {
|
|
104
105
|
return node;
|
|
105
106
|
}
|
|
@@ -127,7 +128,7 @@ function visitComponentMetadata(nodeFactory, node, styleReplacements, directTemp
|
|
|
127
128
|
else if (inlineStyleFileExtension) {
|
|
128
129
|
const data = Buffer.from(node.text).toString('base64');
|
|
129
130
|
const containingFile = node.getSourceFile().fileName;
|
|
130
|
-
url = `${containingFile}.${inlineStyleFileExtension}!=!${
|
|
131
|
+
url = `${containingFile}.${inlineStyleFileExtension}!=!${inline_resource_1.InlineAngularResourceLoaderPath}?data=${encodeURIComponent(data)}!${containingFile}`;
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
133
134
|
return nodeFactory.createStringLiteral(node.text);
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
import type { Compilation } from 'webpack';
|
|
9
|
-
export declare function addWarning(compilation: Compilation, message: string): void;
|
|
10
|
-
export declare function addError(compilation: Compilation, message: string): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.addError = exports.addWarning = void 0;
|
|
11
|
-
function addWarning(compilation, message) {
|
|
12
|
-
compilation.warnings.push(new compilation.compiler.webpack.WebpackError(message));
|
|
13
|
-
}
|
|
14
|
-
exports.addWarning = addWarning;
|
|
15
|
-
function addError(compilation, message) {
|
|
16
|
-
compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
|
|
17
|
-
}
|
|
18
|
-
exports.addError = addError;
|