@ngtools/webpack 19.1.0-rc.0 → 19.1.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
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ngtools/webpack",
|
3
|
-
"version": "19.1.0
|
3
|
+
"version": "19.1.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",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
},
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
27
27
|
"peerDependencies": {
|
28
|
-
"@angular/compiler-cli": "^19.0.0
|
28
|
+
"@angular/compiler-cli": "^19.0.0",
|
29
29
|
"typescript": ">=5.5 <5.8",
|
30
30
|
"webpack": "^5.54.0"
|
31
31
|
},
|
package/src/ivy/paths.d.ts
CHANGED
@@ -6,4 +6,6 @@
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
7
7
|
*/
|
8
8
|
export declare function normalizePath(path: string): string;
|
9
|
-
|
9
|
+
declare function externalizeForWindows(path: string): string;
|
10
|
+
export declare const externalizePath: typeof externalizeForWindows;
|
11
|
+
export {};
|
package/src/resource_loader.d.ts
CHANGED
@@ -19,8 +19,8 @@ export declare class WebpackResourceLoader {
|
|
19
19
|
update(parentCompilation: Compilation, changedFiles?: Iterable<string>): void;
|
20
20
|
clearParentCompilation(): void;
|
21
21
|
getModifiedResourceFiles(): Set<string>;
|
22
|
-
getResourceDependencies(filePath: string):
|
23
|
-
getAffectedResources(file: string):
|
22
|
+
getResourceDependencies(filePath: string): Iterable<string>;
|
23
|
+
getAffectedResources(file: string): Iterable<string>;
|
24
24
|
setAffectedResources(file: string, resources: Iterable<string>): void;
|
25
25
|
private _compile;
|
26
26
|
private _evaluate;
|
@@ -5,7 +5,7 @@
|
|
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.dev/license
|
7
7
|
*/
|
8
|
-
import
|
8
|
+
import ts from 'typescript';
|
9
9
|
export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean, extraCompilerOptions?: ts.CompilerOptions, jsxFile?: boolean): {
|
10
10
|
compilerHost: ts.CompilerHost;
|
11
11
|
program: ts.Program;
|
@@ -6,44 +6,14 @@
|
|
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.dev/license
|
8
8
|
*/
|
9
|
-
var
|
10
|
-
|
11
|
-
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
14
|
-
}
|
15
|
-
Object.defineProperty(o, k2, desc);
|
16
|
-
}) : (function(o, m, k, k2) {
|
17
|
-
if (k2 === undefined) k2 = k;
|
18
|
-
o[k2] = m[k];
|
19
|
-
}));
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
22
|
-
}) : function(o, v) {
|
23
|
-
o["default"] = v;
|
24
|
-
});
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
26
|
-
var ownKeys = function(o) {
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
28
|
-
var ar = [];
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
30
|
-
return ar;
|
31
|
-
};
|
32
|
-
return ownKeys(o);
|
33
|
-
};
|
34
|
-
return function (mod) {
|
35
|
-
if (mod && mod.__esModule) return mod;
|
36
|
-
var result = {};
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
38
|
-
__setModuleDefault(result, mod);
|
39
|
-
return result;
|
40
|
-
};
|
41
|
-
})();
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
11
|
+
};
|
42
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
43
13
|
exports.createTypescriptContext = createTypescriptContext;
|
44
14
|
exports.transformTypescript = transformTypescript;
|
45
|
-
const
|
46
|
-
const
|
15
|
+
const node_path_1 = require("node:path");
|
16
|
+
const typescript_1 = __importDefault(require("typescript"));
|
47
17
|
// Test transform helpers.
|
48
18
|
const basefileName = 'test-file.ts';
|
49
19
|
function createTypescriptContext(content, additionalFiles, useLibs = false, extraCompilerOptions = {}, jsxFile = false) {
|
@@ -52,10 +22,10 @@ function createTypescriptContext(content, additionalFiles, useLibs = false, extr
|
|
52
22
|
const compilerOptions = {
|
53
23
|
noEmitOnError: useLibs,
|
54
24
|
allowJs: true,
|
55
|
-
newLine:
|
56
|
-
moduleResolution:
|
57
|
-
module:
|
58
|
-
target:
|
25
|
+
newLine: typescript_1.default.NewLineKind.LineFeed,
|
26
|
+
moduleResolution: typescript_1.default.ModuleResolutionKind.Node10,
|
27
|
+
module: typescript_1.default.ModuleKind.ES2020,
|
28
|
+
target: typescript_1.default.ScriptTarget.ES2020,
|
59
29
|
skipLibCheck: true,
|
60
30
|
sourceMap: false,
|
61
31
|
importHelpers: true,
|
@@ -64,11 +34,11 @@ function createTypescriptContext(content, additionalFiles, useLibs = false, extr
|
|
64
34
|
...extraCompilerOptions,
|
65
35
|
};
|
66
36
|
// Create compiler host.
|
67
|
-
const compilerHost =
|
37
|
+
const compilerHost = typescript_1.default.createCompilerHost(compilerOptions, true);
|
68
38
|
const baseFileExists = compilerHost.fileExists;
|
69
39
|
compilerHost.fileExists = function (compilerFileName) {
|
70
40
|
return (compilerFileName === fileName ||
|
71
|
-
!!additionalFiles?.[(0,
|
41
|
+
!!additionalFiles?.[(0, node_path_1.basename)(compilerFileName)] ||
|
72
42
|
baseFileExists(compilerFileName));
|
73
43
|
};
|
74
44
|
const baseReadFile = compilerHost.readFile;
|
@@ -76,15 +46,15 @@ function createTypescriptContext(content, additionalFiles, useLibs = false, extr
|
|
76
46
|
if (compilerFileName === fileName) {
|
77
47
|
return content;
|
78
48
|
}
|
79
|
-
else if (additionalFiles?.[(0,
|
80
|
-
return additionalFiles[(0,
|
49
|
+
else if (additionalFiles?.[(0, node_path_1.basename)(compilerFileName)]) {
|
50
|
+
return additionalFiles[(0, node_path_1.basename)(compilerFileName)];
|
81
51
|
}
|
82
52
|
else {
|
83
53
|
return baseReadFile(compilerFileName);
|
84
54
|
}
|
85
55
|
};
|
86
56
|
// Create the TypeScript program.
|
87
|
-
const program =
|
57
|
+
const program = typescript_1.default.createProgram([fileName], compilerOptions, compilerHost);
|
88
58
|
return { compilerHost, program };
|
89
59
|
}
|
90
60
|
function transformTypescript(content, transformers, program, compilerHost) {
|
@@ -111,7 +81,7 @@ function transformTypescript(content, transformers, program, compilerHost) {
|
|
111
81
|
}, undefined, undefined, { before: transformers });
|
112
82
|
// Throw error with diagnostics if emit wasn't successfull.
|
113
83
|
if (emitSkipped) {
|
114
|
-
throw new Error(
|
84
|
+
throw new Error(typescript_1.default.formatDiagnostics(diagnostics, compilerHost));
|
115
85
|
}
|
116
86
|
// Return the transpiled js.
|
117
87
|
return outputContent;
|