@angular/compiler-cli 20.2.0-next.0 → 20.2.0-next.1
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/bundles/{chunk-SEKYV57I.js → chunk-6HOSNZU5.js} +2 -3
- package/bundles/{chunk-FPHHL4UV.js → chunk-BPDNYZBC.js} +253 -49
- package/bundles/chunk-DWRM7PIK.js +14 -0
- package/bundles/{chunk-JXYBFWGA.js → chunk-F7QVREVY.js} +19 -7
- package/bundles/{chunk-TPEB2IXF.js → chunk-GWZQLAGK.js} +35 -7
- package/bundles/{chunk-PML5JK7B.js → chunk-HYJ2H3FU.js} +120 -7
- package/bundles/{chunk-6ECVYRSU.js → chunk-I2BHWRAU.js} +11 -6
- package/bundles/{chunk-5TMRGUHP.js → chunk-PLUBZWSY.js} +27 -11
- package/bundles/{chunk-5JF7HF3W.js → chunk-SZY7NM6F.js} +2 -3
- package/bundles/{chunk-UZOSFHTN.js → chunk-TMIC4MKN.js} +2312 -736
- package/bundles/{chunk-YNE6T2TY.js → chunk-U3R42CLJ.js} +569 -103
- package/bundles/index.js +34 -19
- package/bundles/linker/babel/index.js +70 -18
- package/bundles/linker/index.js +11 -5
- package/bundles/private/localize.js +5 -6
- package/bundles/private/migrations.js +5 -6
- package/bundles/private/tooling.js +27 -11
- package/bundles/src/bin/ng_xi18n.js +11 -12
- package/bundles/src/bin/ngc.js +9 -10
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +3 -3
- package/src/ngtsc/perf/src/api.d.ts +24 -16
- package/src/ngtsc/typecheck/api/api.d.ts +1 -1
- package/src/ngtsc/typecheck/api/checker.d.ts +15 -0
- package/src/ngtsc/typecheck/diagnostics/src/diagnostic.d.ts +7 -1
- package/src/ngtsc/typecheck/src/checker.d.ts +2 -0
- package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
- package/bundles/chunk-2FHBFXPC.js +0 -34
- package/bundles/chunk-2FHBFXPC.js.map +0 -6
- package/bundles/chunk-5JF7HF3W.js.map +0 -6
- package/bundles/chunk-5TMRGUHP.js.map +0 -6
- package/bundles/chunk-6ECVYRSU.js.map +0 -6
- package/bundles/chunk-FPHHL4UV.js.map +0 -6
- package/bundles/chunk-JXYBFWGA.js.map +0 -6
- package/bundles/chunk-KPQ72R34.js +0 -23
- package/bundles/chunk-KPQ72R34.js.map +0 -6
- package/bundles/chunk-PML5JK7B.js.map +0 -6
- package/bundles/chunk-SEKYV57I.js.map +0 -6
- package/bundles/chunk-TPEB2IXF.js.map +0 -6
- package/bundles/chunk-UZOSFHTN.js.map +0 -6
- package/bundles/chunk-YNE6T2TY.js.map +0 -6
- package/bundles/index.js.map +0 -6
- package/bundles/linker/babel/index.js.map +0 -6
- package/bundles/linker/index.js.map +0 -6
- package/bundles/private/localize.js.map +0 -6
- package/bundles/private/migrations.js.map +0 -6
- package/bundles/private/tooling.js.map +0 -6
- package/bundles/src/bin/ng_xi18n.js.map +0 -6
- package/bundles/src/bin/ngc.js.map +0 -6
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import {createRequire as __cjsCompatRequire} from 'module';
|
|
3
|
+
const require = __cjsCompatRequire(import.meta.url);
|
|
4
|
+
|
|
5
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
6
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
7
|
+
}) : x)(function(x) {
|
|
8
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
9
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
__require
|
|
14
|
+
};
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
formatDiagnostics,
|
|
13
13
|
performCompilation,
|
|
14
14
|
readConfiguration
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-U3R42CLJ.js";
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// packages/compiler-cli/src/main.js
|
|
18
18
|
import ts2 from "typescript";
|
|
19
19
|
import yargs from "yargs";
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// packages/compiler-cli/src/perform_watch.js
|
|
22
22
|
import * as chokidar from "chokidar";
|
|
23
23
|
import * as path from "path";
|
|
24
24
|
import ts from "typescript";
|
|
@@ -68,6 +68,8 @@ function createPerformWatchHost(configFileName, reportDiagnostics, existingOptio
|
|
|
68
68
|
} };
|
|
69
69
|
}
|
|
70
70
|
const watcher = chokidar.watch(options.basePath, {
|
|
71
|
+
// ignore .dotfiles, .js and .map files.
|
|
72
|
+
// can't ignore other files as we e.g. want to recompile if an `.html` file changes as well.
|
|
71
73
|
ignored: (path2) => /((^[\/\\])\..)|(\.js$)|(\.map$)|(\.metadata\.json|node_modules)/.test(path2),
|
|
72
74
|
ignoreInitial: true,
|
|
73
75
|
persistent: true
|
|
@@ -207,7 +209,10 @@ function performWatchCompilation(host) {
|
|
|
207
209
|
}
|
|
208
210
|
function watchedFileChanged(event, fileName) {
|
|
209
211
|
const normalizedPath = path.normalize(fileName);
|
|
210
|
-
if (cachedOptions && event === FileChangeEvent.Change &&
|
|
212
|
+
if (cachedOptions && event === FileChangeEvent.Change && // TODO(chuckj): validate that this is sufficient to skip files that were written.
|
|
213
|
+
// This assumes that the file path we write is the same file path we will receive in the
|
|
214
|
+
// change notification.
|
|
215
|
+
normalizedPath === path.normalize(cachedOptions.project)) {
|
|
211
216
|
resetOptions();
|
|
212
217
|
} else if (event === FileChangeEvent.CreateDelete || event === FileChangeEvent.CreateDeleteDir) {
|
|
213
218
|
cachedOptions = void 0;
|
|
@@ -242,11 +247,16 @@ function performWatchCompilation(host) {
|
|
|
242
247
|
}
|
|
243
248
|
}
|
|
244
249
|
|
|
245
|
-
//
|
|
250
|
+
// packages/compiler-cli/src/main.js
|
|
246
251
|
function main(args, consoleError = console.error, config, customTransformers, programReuse, modifiedResourceFiles) {
|
|
247
252
|
let { project, rootNames, options, errors: configErrors, watch: watch2, emitFlags } = config || readNgcCommandLineAndConfiguration(args);
|
|
248
253
|
if (configErrors.length) {
|
|
249
|
-
return reportErrorsAndExit(
|
|
254
|
+
return reportErrorsAndExit(
|
|
255
|
+
configErrors,
|
|
256
|
+
/*options*/
|
|
257
|
+
void 0,
|
|
258
|
+
consoleError
|
|
259
|
+
);
|
|
250
260
|
}
|
|
251
261
|
if (watch2) {
|
|
252
262
|
const result = watchMode(project, options, consoleError);
|
|
@@ -325,6 +335,9 @@ function getFormatDiagnosticsHost(options) {
|
|
|
325
335
|
const basePath = options ? options.basePath : void 0;
|
|
326
336
|
return {
|
|
327
337
|
getCurrentDirectory: () => basePath || ts2.sys.getCurrentDirectory(),
|
|
338
|
+
// We need to normalize the path separators here because by default, TypeScript
|
|
339
|
+
// compiler hosts use posix canonical paths. In order to print consistent diagnostics,
|
|
340
|
+
// we also normalize the paths.
|
|
328
341
|
getCanonicalFileName: (fileName) => fileName.replace(/\\/g, "/"),
|
|
329
342
|
getNewLine: () => {
|
|
330
343
|
if (options && options.newLine !== void 0) {
|
|
@@ -363,4 +376,3 @@ export {
|
|
|
363
376
|
* Use of this source code is governed by an MIT-style license that can be
|
|
364
377
|
* found in the LICENSE file at https://angular.dev/license
|
|
365
378
|
*/
|
|
366
|
-
//# sourceMappingURL=chunk-JXYBFWGA.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const require = __cjsCompatRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/invalid_file_system.js
|
|
7
7
|
var InvalidFileSystem = class {
|
|
8
8
|
exists(path) {
|
|
9
9
|
throw makeError();
|
|
@@ -91,7 +91,7 @@ function makeError() {
|
|
|
91
91
|
return new Error("FileSystem has not been configured. Please call `setFileSystem()` before calling this method.");
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
//
|
|
94
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/util.js
|
|
95
95
|
var TS_DTS_JS_EXTENSION = /(?:\.d)?\.ts$|\.js$/;
|
|
96
96
|
function normalizeSeparators(path) {
|
|
97
97
|
return path.replace(/\\/g, "/");
|
|
@@ -107,7 +107,7 @@ function getSourceFileOrError(program, fileName) {
|
|
|
107
107
|
return sf;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
//
|
|
110
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/helpers.js
|
|
111
111
|
var fs = new InvalidFileSystem();
|
|
112
112
|
function getFileSystem() {
|
|
113
113
|
return fs;
|
|
@@ -164,7 +164,7 @@ function toRelativeImport(relativePath) {
|
|
|
164
164
|
return isLocalRelativePath(relativePath) ? `./${relativePath}` : relativePath;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
//
|
|
167
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/compiler_host.js
|
|
168
168
|
import * as os from "os";
|
|
169
169
|
import ts from "typescript";
|
|
170
170
|
var NgtscCompilerHost = class {
|
|
@@ -224,8 +224,14 @@ var NgtscCompilerHost = class {
|
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
//
|
|
227
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/logical.js
|
|
228
228
|
var LogicalProjectPath = {
|
|
229
|
+
/**
|
|
230
|
+
* Get the relative path between two `LogicalProjectPath`s.
|
|
231
|
+
*
|
|
232
|
+
* This will return a `PathSegment` which would be a valid module specifier to use in `from` when
|
|
233
|
+
* importing from `to`.
|
|
234
|
+
*/
|
|
229
235
|
relativePathBetween: function(from, to) {
|
|
230
236
|
const relativePath = relative(dirname(resolve(from)), resolve(to));
|
|
231
237
|
return toRelativeImport(relativePath);
|
|
@@ -233,17 +239,40 @@ var LogicalProjectPath = {
|
|
|
233
239
|
};
|
|
234
240
|
var LogicalFileSystem = class {
|
|
235
241
|
compilerHost;
|
|
242
|
+
/**
|
|
243
|
+
* The root directories of the project, sorted with the longest path first.
|
|
244
|
+
*/
|
|
236
245
|
rootDirs;
|
|
246
|
+
/**
|
|
247
|
+
* The same root directories as `rootDirs` but with each one converted to its
|
|
248
|
+
* canonical form for matching in case-insensitive file-systems.
|
|
249
|
+
*/
|
|
237
250
|
canonicalRootDirs;
|
|
251
|
+
/**
|
|
252
|
+
* A cache of file paths to project paths, because computation of these paths is slightly
|
|
253
|
+
* expensive.
|
|
254
|
+
*/
|
|
238
255
|
cache = /* @__PURE__ */ new Map();
|
|
239
256
|
constructor(rootDirs, compilerHost) {
|
|
240
257
|
this.compilerHost = compilerHost;
|
|
241
258
|
this.rootDirs = rootDirs.concat([]).sort((a, b) => b.length - a.length);
|
|
242
259
|
this.canonicalRootDirs = this.rootDirs.map((dir) => this.compilerHost.getCanonicalFileName(dir));
|
|
243
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Get the logical path in the project of a `ts.SourceFile`.
|
|
263
|
+
*
|
|
264
|
+
* This method is provided as a convenient alternative to calling
|
|
265
|
+
* `logicalPathOfFile(absoluteFromSourceFile(sf))`.
|
|
266
|
+
*/
|
|
244
267
|
logicalPathOfSf(sf) {
|
|
245
268
|
return this.logicalPathOfFile(absoluteFromSourceFile(sf));
|
|
246
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Get the logical path in the project of a source file.
|
|
272
|
+
*
|
|
273
|
+
* @returns A `LogicalProjectPath` to the source file, or `null` if the source file is not in any
|
|
274
|
+
* of the TS project's root directories.
|
|
275
|
+
*/
|
|
247
276
|
logicalPathOfFile(physicalFile) {
|
|
248
277
|
if (!this.cache.has(physicalFile)) {
|
|
249
278
|
const canonicalFilePath = this.compilerHost.getCanonicalFileName(physicalFile);
|
|
@@ -273,7 +302,7 @@ function isWithinBasePath(base, path) {
|
|
|
273
302
|
return isLocalRelativePath(relative(base, path));
|
|
274
303
|
}
|
|
275
304
|
|
|
276
|
-
//
|
|
305
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/ts_read_directory.js
|
|
277
306
|
import ts2 from "typescript";
|
|
278
307
|
function createFileSystemTsReadDirectoryFn(fs2) {
|
|
279
308
|
if (ts2.matchFiles === void 0) {
|
|
@@ -335,4 +364,3 @@ export {
|
|
|
335
364
|
* Use of this source code is governed by an MIT-style license that can be
|
|
336
365
|
* found in the LICENSE file at https://angular.dev/license
|
|
337
366
|
*/
|
|
338
|
-
//# sourceMappingURL=chunk-TPEB2IXF.js.map
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
const require = __cjsCompatRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file.js
|
|
7
7
|
import { decode, encode } from "@jridgewell/sourcemap-codec";
|
|
8
8
|
import mapHelpers from "convert-source-map";
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// packages/compiler-cli/src/ngtsc/sourcemaps/src/segment_marker.js
|
|
11
11
|
function compareSegments(a, b) {
|
|
12
12
|
return a.position - b.position;
|
|
13
13
|
}
|
|
@@ -27,7 +27,7 @@ function offsetSegment(startOfLinePositions, marker, offset) {
|
|
|
27
27
|
return { line, column, position, next: void 0 };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file.js
|
|
31
31
|
function removeSourceMapComments(contents) {
|
|
32
32
|
return mapHelpers.removeMapFileComments(mapHelpers.removeComments(contents)).replace(/\n\n$/, "\n");
|
|
33
33
|
}
|
|
@@ -37,6 +37,13 @@ var SourceFile = class {
|
|
|
37
37
|
rawMap;
|
|
38
38
|
sources;
|
|
39
39
|
fs;
|
|
40
|
+
/**
|
|
41
|
+
* The parsed mappings that have been flattened so that any intermediate source mappings have been
|
|
42
|
+
* flattened.
|
|
43
|
+
*
|
|
44
|
+
* The result is that any source file mentioned in the flattened mappings have no source map (are
|
|
45
|
+
* pure original source files).
|
|
46
|
+
*/
|
|
40
47
|
flattenedMappings;
|
|
41
48
|
startOfLinePositions;
|
|
42
49
|
constructor(sourcePath, contents, rawMap, sources, fs) {
|
|
@@ -49,6 +56,9 @@ var SourceFile = class {
|
|
|
49
56
|
this.startOfLinePositions = computeStartOfLinePositions(this.contents);
|
|
50
57
|
this.flattenedMappings = this.flattenMappings();
|
|
51
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Render the raw source map generated from the flattened mappings.
|
|
61
|
+
*/
|
|
52
62
|
renderFlattenedSourceMap() {
|
|
53
63
|
const sources = new IndexedMap();
|
|
54
64
|
const names = new IndexedSet();
|
|
@@ -83,6 +93,14 @@ var SourceFile = class {
|
|
|
83
93
|
};
|
|
84
94
|
return sourceMap;
|
|
85
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Find the original mapped location for the given `line` and `column` in the generated file.
|
|
98
|
+
*
|
|
99
|
+
* First we search for a mapping whose generated segment is at or directly before the given
|
|
100
|
+
* location. Then we compute the offset between the given location and the matching generated
|
|
101
|
+
* segment. Finally we apply this offset to the original source segment to get the desired
|
|
102
|
+
* original location.
|
|
103
|
+
*/
|
|
86
104
|
getOriginalLocation(line, column) {
|
|
87
105
|
if (this.flattenedMappings.length === 0) {
|
|
88
106
|
return null;
|
|
@@ -107,6 +125,10 @@ var SourceFile = class {
|
|
|
107
125
|
column: offsetOriginalSegment.column
|
|
108
126
|
};
|
|
109
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Flatten the parsed mappings for this source file, so that all the mappings are to pure original
|
|
130
|
+
* source files with no transitive source maps.
|
|
131
|
+
*/
|
|
110
132
|
flattenMappings() {
|
|
111
133
|
const mappings = parseMappings(this.rawMap && this.rawMap.map, this.sources, this.startOfLinePositions);
|
|
112
134
|
ensureOriginalSegmentLinks(mappings);
|
|
@@ -244,8 +266,30 @@ function computeLineLengths(str) {
|
|
|
244
266
|
}
|
|
245
267
|
var IndexedMap = class {
|
|
246
268
|
map = /* @__PURE__ */ new Map();
|
|
269
|
+
/**
|
|
270
|
+
* An array of keys added to this map.
|
|
271
|
+
*
|
|
272
|
+
* This array is guaranteed to be in the order of the first time the key was added to the map.
|
|
273
|
+
*/
|
|
247
274
|
keys = [];
|
|
275
|
+
/**
|
|
276
|
+
* An array of values added to this map.
|
|
277
|
+
*
|
|
278
|
+
* This array is guaranteed to be in the order of the first time the associated key was added to
|
|
279
|
+
* the map.
|
|
280
|
+
*/
|
|
248
281
|
values = [];
|
|
282
|
+
/**
|
|
283
|
+
* Associate the `value` with the `key` and return the index of the key in the collection.
|
|
284
|
+
*
|
|
285
|
+
* If the `key` already exists then the `value` is not set and the index of that `key` is
|
|
286
|
+
* returned; otherwise the `key` and `value` are stored and the index of the new `key` is
|
|
287
|
+
* returned.
|
|
288
|
+
*
|
|
289
|
+
* @param key the key to associated with the `value`.
|
|
290
|
+
* @param value the value to associated with the `key`.
|
|
291
|
+
* @returns the index of the `key` in the `keys` array.
|
|
292
|
+
*/
|
|
249
293
|
set(key, value) {
|
|
250
294
|
if (this.map.has(key)) {
|
|
251
295
|
return this.map.get(key);
|
|
@@ -258,7 +302,21 @@ var IndexedMap = class {
|
|
|
258
302
|
};
|
|
259
303
|
var IndexedSet = class {
|
|
260
304
|
map = /* @__PURE__ */ new Map();
|
|
305
|
+
/**
|
|
306
|
+
* An array of values added to this set.
|
|
307
|
+
* This array is guaranteed to be in the order of the first time the value was added to the set.
|
|
308
|
+
*/
|
|
261
309
|
values = [];
|
|
310
|
+
/**
|
|
311
|
+
* Add the `value` to the `values` array, if it doesn't already exist; returning the index of the
|
|
312
|
+
* `value` in the `values` array.
|
|
313
|
+
*
|
|
314
|
+
* If the `value` already exists then the index of that `value` is returned, otherwise the new
|
|
315
|
+
* `value` is stored and the new index returned.
|
|
316
|
+
*
|
|
317
|
+
* @param value the value to add to the set.
|
|
318
|
+
* @returns the index of the `value` in the `values` array.
|
|
319
|
+
*/
|
|
262
320
|
add(value) {
|
|
263
321
|
if (this.map.has(value)) {
|
|
264
322
|
return this.map.get(value);
|
|
@@ -282,10 +340,10 @@ var Cache = class {
|
|
|
282
340
|
}
|
|
283
341
|
};
|
|
284
342
|
|
|
285
|
-
//
|
|
343
|
+
// packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file_loader.js
|
|
286
344
|
import mapHelpers2 from "convert-source-map";
|
|
287
345
|
|
|
288
|
-
//
|
|
346
|
+
// packages/compiler-cli/src/ngtsc/sourcemaps/src/content_origin.js
|
|
289
347
|
var ContentOrigin;
|
|
290
348
|
(function(ContentOrigin2) {
|
|
291
349
|
ContentOrigin2[ContentOrigin2["Provided"] = 0] = "Provided";
|
|
@@ -293,7 +351,7 @@ var ContentOrigin;
|
|
|
293
351
|
ContentOrigin2[ContentOrigin2["FileSystem"] = 2] = "FileSystem";
|
|
294
352
|
})(ContentOrigin || (ContentOrigin = {}));
|
|
295
353
|
|
|
296
|
-
//
|
|
354
|
+
// packages/compiler-cli/src/ngtsc/sourcemaps/src/source_file_loader.js
|
|
297
355
|
var SCHEME_MATCHER = /^([a-z][a-z0-9.-]*):\/\//i;
|
|
298
356
|
var SourceFileLoader = class {
|
|
299
357
|
fs;
|
|
@@ -313,6 +371,22 @@ var SourceFileLoader = class {
|
|
|
313
371
|
};
|
|
314
372
|
return this.loadSourceFileInternal(sourcePath, contents, contentsOrigin, sourceMapInfo);
|
|
315
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* The overload used internally to load source files referenced in a source-map.
|
|
376
|
+
*
|
|
377
|
+
* In this case there is no guarantee that it will return a non-null SourceMap.
|
|
378
|
+
*
|
|
379
|
+
* @param sourcePath The path to the source file to load.
|
|
380
|
+
* @param contents The contents of the source file to load, if provided inline. If `null`,
|
|
381
|
+
* the contents will be read from the file at the `sourcePath`.
|
|
382
|
+
* @param sourceOrigin Describes where the source content came from.
|
|
383
|
+
* @param sourceMapInfo The raw contents and path of the source-map file. If `null` the
|
|
384
|
+
* source-map will be computed from the contents of the source file, either inline or loaded
|
|
385
|
+
* from the file-system.
|
|
386
|
+
*
|
|
387
|
+
* @returns a SourceFile if the content for one was provided or was able to be loaded from disk,
|
|
388
|
+
* `null` otherwise.
|
|
389
|
+
*/
|
|
316
390
|
loadSourceFileInternal(sourcePath, contents, sourceOrigin, sourceMapInfo) {
|
|
317
391
|
const previousPaths = this.currentPaths.slice();
|
|
318
392
|
try {
|
|
@@ -338,6 +412,19 @@ var SourceFileLoader = class {
|
|
|
338
412
|
this.currentPaths = previousPaths;
|
|
339
413
|
}
|
|
340
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Find the source map associated with the source file whose `sourcePath` and `contents` are
|
|
417
|
+
* provided.
|
|
418
|
+
*
|
|
419
|
+
* Source maps can be inline, as part of a base64 encoded comment, or external as a separate file
|
|
420
|
+
* whose path is indicated in a comment or implied from the name of the source file itself.
|
|
421
|
+
*
|
|
422
|
+
* @param sourcePath the path to the source file.
|
|
423
|
+
* @param sourceContents the contents of the source file.
|
|
424
|
+
* @param sourceOrigin where the content of the source file came from.
|
|
425
|
+
* @returns the parsed contents and path of the source-map, if loading was successful, null
|
|
426
|
+
* otherwise.
|
|
427
|
+
*/
|
|
341
428
|
loadSourceMap(sourcePath, sourceContents, sourceOrigin) {
|
|
342
429
|
const lastLine = this.getLastNonEmptyLine(sourceContents);
|
|
343
430
|
const inline = mapHelpers2.commentRegex.exec(lastLine);
|
|
@@ -376,6 +463,10 @@ var SourceFileLoader = class {
|
|
|
376
463
|
}
|
|
377
464
|
return null;
|
|
378
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* Iterate over each of the "sources" for this source file's source map, recursively loading each
|
|
468
|
+
* source file and its associated source map.
|
|
469
|
+
*/
|
|
379
470
|
processSources(basePath, { map, origin: sourceMapOrigin }) {
|
|
380
471
|
const sourceRoot = this.fs.resolve(this.fs.dirname(basePath), this.replaceSchemeWithPath(map.sourceRoot || ""));
|
|
381
472
|
return map.sources.map((source, index) => {
|
|
@@ -385,14 +476,29 @@ var SourceFileLoader = class {
|
|
|
385
476
|
return this.loadSourceFileInternal(path, content, sourceOrigin, null);
|
|
386
477
|
});
|
|
387
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Load the contents of the source file from disk.
|
|
481
|
+
*
|
|
482
|
+
* @param sourcePath The path to the source file.
|
|
483
|
+
*/
|
|
388
484
|
readSourceFile(sourcePath) {
|
|
389
485
|
this.trackPath(sourcePath);
|
|
390
486
|
return this.fs.readFile(sourcePath);
|
|
391
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Load the source map from the file at `mapPath`, parsing its JSON contents into a `RawSourceMap`
|
|
490
|
+
* object.
|
|
491
|
+
*
|
|
492
|
+
* @param mapPath The path to the source-map file.
|
|
493
|
+
*/
|
|
392
494
|
readRawSourceMap(mapPath) {
|
|
393
495
|
this.trackPath(mapPath);
|
|
394
496
|
return JSON.parse(this.fs.readFile(mapPath));
|
|
395
497
|
}
|
|
498
|
+
/**
|
|
499
|
+
* Track source file paths if we have loaded them from disk so that we don't get into an infinite
|
|
500
|
+
* recursion.
|
|
501
|
+
*/
|
|
396
502
|
trackPath(path) {
|
|
397
503
|
if (this.currentPaths.includes(path)) {
|
|
398
504
|
throw new Error(`Circular source file mapping dependency: ${this.currentPaths.join(" -> ")} -> ${path}`);
|
|
@@ -410,6 +516,14 @@ var SourceFileLoader = class {
|
|
|
410
516
|
}
|
|
411
517
|
return contents.slice(lastRealLineIndex + 1);
|
|
412
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* Replace any matched URL schemes with their corresponding path held in the schemeMap.
|
|
521
|
+
*
|
|
522
|
+
* Some build tools replace real file paths with scheme prefixed paths - e.g. `webpack://`.
|
|
523
|
+
* We use the `schemeMap` passed to this class to convert such paths to "real" file paths.
|
|
524
|
+
* In some cases, this is not possible, since the file was actually synthesized by the build tool.
|
|
525
|
+
* But the end result is better than prefixing the sourceRoot in front of the scheme.
|
|
526
|
+
*/
|
|
413
527
|
replaceSchemeWithPath(path) {
|
|
414
528
|
return path.replace(SCHEME_MATCHER, (_, scheme) => this.schemeMap[scheme.toLowerCase()] || "");
|
|
415
529
|
}
|
|
@@ -426,4 +540,3 @@ export {
|
|
|
426
540
|
* Use of this source code is governed by an MIT-style license that can be
|
|
427
541
|
* found in the LICENSE file at https://angular.dev/license
|
|
428
542
|
*/
|
|
429
|
-
//# sourceMappingURL=chunk-PML5JK7B.js.map
|
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
const require = __cjsCompatRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
var Context = class {
|
|
6
|
+
// packages/compiler-cli/src/ngtsc/translator/src/context.js
|
|
7
|
+
var Context = class _Context {
|
|
8
8
|
isStatement;
|
|
9
9
|
constructor(isStatement) {
|
|
10
10
|
this.isStatement = isStatement;
|
|
11
11
|
}
|
|
12
12
|
get withExpressionMode() {
|
|
13
|
-
return this.isStatement ? new
|
|
13
|
+
return this.isStatement ? new _Context(false) : this;
|
|
14
14
|
}
|
|
15
15
|
get withStatementMode() {
|
|
16
|
-
return !this.isStatement ? new
|
|
16
|
+
return !this.isStatement ? new _Context(true) : this;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// packages/compiler-cli/src/ngtsc/translator/src/translator.js
|
|
21
21
|
import * as o from "@angular/compiler";
|
|
22
22
|
var UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
23
23
|
[o.UnaryOperator.Minus, "-"],
|
|
@@ -121,6 +121,10 @@ var ExpressionTranslatorVisitor = class {
|
|
|
121
121
|
createTaggedTemplateExpression(tag, template) {
|
|
122
122
|
return this.downlevelTaggedTemplates ? this.createES5TaggedTemplateFunctionCall(tag, template) : this.factory.createTaggedTemplate(tag, template);
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Translate the tagged template literal into a call that is compatible with ES5, using the
|
|
126
|
+
* imported `__makeTemplateObject` helper for ES5 formatted output.
|
|
127
|
+
*/
|
|
124
128
|
createES5TaggedTemplateFunctionCall(tagHandler, { elements, expressions }) {
|
|
125
129
|
const __makeTemplateObjectHelper = this.imports.addImport({
|
|
126
130
|
exportModuleSpecifier: "tslib",
|
|
@@ -136,11 +140,13 @@ var ExpressionTranslatorVisitor = class {
|
|
|
136
140
|
const templateHelperCall = this.factory.createCallExpression(
|
|
137
141
|
__makeTemplateObjectHelper,
|
|
138
142
|
[this.factory.createArrayLiteral(cooked), this.factory.createArrayLiteral(raw)],
|
|
143
|
+
/* pure */
|
|
139
144
|
false
|
|
140
145
|
);
|
|
141
146
|
return this.factory.createCallExpression(
|
|
142
147
|
tagHandler,
|
|
143
148
|
[templateHelperCall, ...expressions],
|
|
149
|
+
/* pure */
|
|
144
150
|
false
|
|
145
151
|
);
|
|
146
152
|
}
|
|
@@ -293,4 +299,3 @@ export {
|
|
|
293
299
|
* Use of this source code is governed by an MIT-style license that can be
|
|
294
300
|
* found in the LICENSE file at https://angular.dev/license
|
|
295
301
|
*/
|
|
296
|
-
//# sourceMappingURL=chunk-6ECVYRSU.js.map
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
tryParseSignalInputMapping,
|
|
17
17
|
tryParseSignalModelMapping,
|
|
18
18
|
tryParseSignalQueryFromInitializer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-TMIC4MKN.js";
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/downlevel_decorators_transform.js
|
|
22
22
|
import ts from "typescript";
|
|
23
23
|
function isAngularDecorator2(decorator, isCore) {
|
|
24
24
|
return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
|
|
@@ -323,10 +323,10 @@ function cloneClassElementWithModifiers(node, modifiers) {
|
|
|
323
323
|
return ts.setOriginalNode(clone, node);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
//
|
|
326
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
|
|
327
327
|
import ts4 from "typescript";
|
|
328
328
|
|
|
329
|
-
//
|
|
329
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform_api.js
|
|
330
330
|
import ts2 from "typescript";
|
|
331
331
|
function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngClassDecorator, sourceFile, decoratorName) {
|
|
332
332
|
const classDecoratorIdentifier = ts2.isIdentifier(ngClassDecorator.identifier) ? ngClassDecorator.identifier : ngClassDecorator.identifier.expression;
|
|
@@ -336,6 +336,9 @@ function createSyntheticAngularCoreDecoratorAccess(factory, importManager, ngCla
|
|
|
336
336
|
exportSymbolName: null,
|
|
337
337
|
requestedFile: sourceFile
|
|
338
338
|
}),
|
|
339
|
+
// The synthetic identifier may be checked later by the downlevel decorators
|
|
340
|
+
// transform to resolve to an Angular import using `getSymbolAtLocation`. We trick
|
|
341
|
+
// the transform to think it's not synthetic and comes from Angular core.
|
|
339
342
|
ts2.setOriginalNode(factory.createIdentifier(decoratorName), classDecoratorIdentifier)
|
|
340
343
|
);
|
|
341
344
|
}
|
|
@@ -343,7 +346,7 @@ function castAsAny(factory, expr) {
|
|
|
343
346
|
return factory.createAsExpression(expr, factory.createKeywordTypeNode(ts2.SyntaxKind.AnyKeyword));
|
|
344
347
|
}
|
|
345
348
|
|
|
346
|
-
//
|
|
349
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/input_function.js
|
|
347
350
|
var signalInputsTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
|
|
348
351
|
if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => isAngularDecorator(d, "Input", isCore))) {
|
|
349
352
|
return member.node;
|
|
@@ -356,15 +359,21 @@ var signalInputsTransform = (member, sourceFile, host, factory, importTracker, i
|
|
|
356
359
|
"isSignal": factory.createTrue(),
|
|
357
360
|
"alias": factory.createStringLiteral(inputMapping.bindingPropertyName),
|
|
358
361
|
"required": inputMapping.required ? factory.createTrue() : factory.createFalse(),
|
|
362
|
+
// For signal inputs, transforms are captured by the input signal. The runtime will
|
|
363
|
+
// determine whether a transform needs to be run via the input signal, so the `transform`
|
|
364
|
+
// option is always `undefined`.
|
|
359
365
|
"transform": factory.createIdentifier("undefined")
|
|
360
366
|
};
|
|
361
367
|
const newDecorator = factory.createDecorator(factory.createCallExpression(createSyntheticAngularCoreDecoratorAccess(factory, importManager, classDecorator, sourceFile, "Input"), void 0, [
|
|
368
|
+
// Cast to `any` because `isSignal` will be private, and in case this
|
|
369
|
+
// transform is used directly as a pre-compilation step, the decorator should
|
|
370
|
+
// not fail. It is already validated now due to us parsing the input metadata.
|
|
362
371
|
castAsAny(factory, factory.createObjectLiteralExpression(Object.entries(fields).map(([name, value]) => factory.createPropertyAssignment(name, value))))
|
|
363
372
|
]));
|
|
364
373
|
return factory.updatePropertyDeclaration(member.node, [newDecorator, ...member.node.modifiers ?? []], member.name, member.node.questionToken, member.node.type, member.node.initializer);
|
|
365
374
|
};
|
|
366
375
|
|
|
367
|
-
//
|
|
376
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/model_function.js
|
|
368
377
|
import ts3 from "typescript";
|
|
369
378
|
var signalModelTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
|
|
370
379
|
if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => {
|
|
@@ -383,6 +392,9 @@ var signalModelTransform = (member, sourceFile, host, factory, importTracker, im
|
|
|
383
392
|
]);
|
|
384
393
|
const inputDecorator = createDecorator(
|
|
385
394
|
"Input",
|
|
395
|
+
// Config is cast to `any` because `isSignal` will be private, and in case this
|
|
396
|
+
// transform is used directly as a pre-compilation step, the decorator should
|
|
397
|
+
// not fail. It is already validated now due to us parsing the input metadata.
|
|
386
398
|
factory.createAsExpression(inputConfig, factory.createKeywordTypeNode(ts3.SyntaxKind.AnyKeyword)),
|
|
387
399
|
classDecorator,
|
|
388
400
|
factory,
|
|
@@ -397,7 +409,7 @@ function createDecorator(name, config, classDecorator, factory, sourceFile, impo
|
|
|
397
409
|
return factory.createDecorator(factory.createCallExpression(callTarget, void 0, [config]));
|
|
398
410
|
}
|
|
399
411
|
|
|
400
|
-
//
|
|
412
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/output_function.js
|
|
401
413
|
var initializerApiOutputTransform = (member, sourceFile, host, factory, importTracker, importManager, classDecorator, isCore) => {
|
|
402
414
|
if (host.getDecoratorsOfDeclaration(member.node)?.some((d) => isAngularDecorator(d, "Output", isCore))) {
|
|
403
415
|
return member.node;
|
|
@@ -410,7 +422,7 @@ var initializerApiOutputTransform = (member, sourceFile, host, factory, importTr
|
|
|
410
422
|
return factory.updatePropertyDeclaration(member.node, [newDecorator, ...member.node.modifiers ?? []], member.node.name, member.node.questionToken, member.node.type, member.node.initializer);
|
|
411
423
|
};
|
|
412
424
|
|
|
413
|
-
//
|
|
425
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/query_functions.js
|
|
414
426
|
var queryFunctionToDecorator = {
|
|
415
427
|
viewChild: "ViewChild",
|
|
416
428
|
viewChildren: "ViewChildren",
|
|
@@ -431,8 +443,12 @@ var queryFunctionsTransforms = (member, sourceFile, host, factory, importTracker
|
|
|
431
443
|
const newDecorator = factory.createDecorator(factory.createCallExpression(
|
|
432
444
|
createSyntheticAngularCoreDecoratorAccess(factory, importManager, classDecorator, sourceFile, queryFunctionToDecorator[queryDefinition.name]),
|
|
433
445
|
void 0,
|
|
446
|
+
// All positional arguments of the query functions can be mostly re-used as is
|
|
447
|
+
// for the decorator. i.e. predicate is always first argument. Options are second.
|
|
434
448
|
[
|
|
435
449
|
queryDefinition.call.arguments[0],
|
|
450
|
+
// Note: Casting as `any` because `isSignal` is not publicly exposed and this
|
|
451
|
+
// transform might pre-transform TS sources.
|
|
436
452
|
castAsAny(factory, factory.createObjectLiteralExpression([
|
|
437
453
|
...callArgs.length > 1 ? [factory.createSpreadAssignment(callArgs[1])] : [],
|
|
438
454
|
factory.createPropertyAssignment("isSignal", factory.createTrue())
|
|
@@ -442,7 +458,7 @@ var queryFunctionsTransforms = (member, sourceFile, host, factory, importTracker
|
|
|
442
458
|
return factory.updatePropertyDeclaration(member.node, [newDecorator, ...member.node.modifiers ?? []], member.node.name, member.node.questionToken, member.node.type, member.node.initializer);
|
|
443
459
|
};
|
|
444
460
|
|
|
445
|
-
//
|
|
461
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/initializer_api_transforms/transform.js
|
|
446
462
|
var decoratorsWithInputs = ["Directive", "Component"];
|
|
447
463
|
var propertyTransforms = [
|
|
448
464
|
signalInputsTransform,
|
|
@@ -494,7 +510,7 @@ function createTransformVisitor(ctx, host, importManager, importTracker, isCore,
|
|
|
494
510
|
return visitor;
|
|
495
511
|
}
|
|
496
512
|
|
|
497
|
-
//
|
|
513
|
+
// packages/compiler-cli/src/ngtsc/transform/jit/src/index.js
|
|
498
514
|
function angularJitApplicationTransform(program, isCore = false, shouldTransformClass) {
|
|
499
515
|
const typeChecker = program.getTypeChecker();
|
|
500
516
|
const reflectionHost = new TypeScriptReflectionHost(typeChecker);
|
|
@@ -504,6 +520,7 @@ function angularJitApplicationTransform(program, isCore = false, shouldTransform
|
|
|
504
520
|
reflectionHost,
|
|
505
521
|
[],
|
|
506
522
|
isCore,
|
|
523
|
+
/* enableClosureCompiler */
|
|
507
524
|
false,
|
|
508
525
|
shouldTransformClass
|
|
509
526
|
);
|
|
@@ -529,4 +546,3 @@ export {
|
|
|
529
546
|
* Use of this source code is governed by an MIT-style license that can be
|
|
530
547
|
* found in the LICENSE file at https://angular.dev/license
|
|
531
548
|
*/
|
|
532
|
-
//# sourceMappingURL=chunk-5TMRGUHP.js.map
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
__require
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DWRM7PIK.js";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// packages/compiler-cli/src/ngtsc/file_system/src/node_js_file_system.js
|
|
10
10
|
import fs from "fs";
|
|
11
11
|
import { createRequire } from "module";
|
|
12
12
|
import * as p from "path";
|
|
@@ -120,4 +120,3 @@ export {
|
|
|
120
120
|
* Use of this source code is governed by an MIT-style license that can be
|
|
121
121
|
* found in the LICENSE file at https://angular.dev/license
|
|
122
122
|
*/
|
|
123
|
-
//# sourceMappingURL=chunk-5JF7HF3W.js.map
|