@angular/core 20.0.0-next.4 → 20.0.0-next.6
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/api.d-DQLNOR5l.d.ts +297 -0
- package/discovery.d-CFs2MaLO.d.ts +7383 -0
- package/{event_dispatcher.d-pVP0-wST.d.ts → event_dispatcher.d-DlbccpYq.d.ts} +3 -2
- package/fesm2022/attribute-BWp59EjE.mjs +24 -0
- package/fesm2022/attribute-BWp59EjE.mjs.map +1 -0
- package/fesm2022/core.mjs +586 -36873
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node-z_3NG8qT.mjs +32079 -0
- package/fesm2022/debug_node-z_3NG8qT.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +18 -4
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -16
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +5 -3
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource-CPPwEcg7.mjs +619 -0
- package/fesm2022/resource-CPPwEcg7.mjs.map +1 -0
- package/fesm2022/root_effect_scheduler-VSXfCzDX.mjs +3847 -0
- package/fesm2022/root_effect_scheduler-VSXfCzDX.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +16 -9
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/{untracked-DkcXpNb_.mjs → signal-B6pMq7KS.mjs} +16 -114
- package/fesm2022/signal-B6pMq7KS.mjs.map +1 -0
- package/fesm2022/testing.mjs +265 -201
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-Bz5WMeU1.mjs +117 -0
- package/fesm2022/untracked-Bz5WMeU1.mjs.map +1 -0
- package/fesm2022/weak_ref-BaIq-pgY.mjs +12 -0
- package/fesm2022/weak_ref-BaIq-pgY.mjs.map +1 -0
- package/{weak_ref.d-BZ7gyRag.d.ts → graph.d-BcIOep_B.d.ts} +3 -24
- package/index.d.ts +2624 -10909
- package/ng_i18n_closure_mode.d-C9d2CaSt.d.ts +832 -0
- package/package.json +3 -3
- package/primitives/di/index.d.ts +3 -2
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +8 -4
- package/rxjs-interop/index.d.ts +10 -7
- package/schematics/bundles/{apply_import_manager-CeNv8GIG.js → apply_import_manager-DnMqg1pY.js} +6 -6
- package/schematics/bundles/{compiler_host-DwM3ugW3.js → change_tracker-UMPkv-eH.js} +3 -121
- package/schematics/bundles/checker-BFBQyesT.js +17719 -0
- package/schematics/bundles/cleanup-unused-imports.js +25 -19
- package/schematics/bundles/{checker-k591b6WQ.js → compiler-BQ7R7w2v.js} +1325 -18286
- package/schematics/bundles/compiler_host-CAfDJO3W.js +129 -0
- package/schematics/bundles/control-flow-migration.js +28 -40
- package/schematics/bundles/document-core.js +96 -0
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{index-B4OAlHh8.js → index-Cv4Q415G.js} +641 -547
- package/schematics/bundles/{index-BhELUmYx.js → index-D8tMJPKa.js} +35 -34
- package/schematics/bundles/inject-flags.js +14 -13
- package/schematics/bundles/inject-migration.js +29 -10
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Be0TNYen.js → migrate_ts_type_references-Cq_ZBuT4.js} +21 -20
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +88 -25
- package/schematics/bundles/{run_in_devkit-CkvEksWP.js → project_paths-ql6qcf_c.js} +254 -243
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
- package/schematics/bundles/route-lazy-loading.js +7 -5
- package/schematics/bundles/self-closing-tags-migration.js +25 -19
- package/schematics/bundles/signal-input-migration.js +26 -20
- package/schematics/bundles/signal-queries-migration.js +51 -33
- package/schematics/bundles/signals.js +8 -7
- package/schematics/bundles/standalone-migration.js +11 -9
- package/schematics/bundles/symbol-VPWguRxr.js +1 -1
- package/schematics/bundles/test-bed-get.js +13 -12
- package/schematics/collection.json +0 -6
- package/schematics/migrations.json +11 -0
- package/signal.d-E0e5nW1p.d.ts +31 -0
- package/testing/index.d.ts +16 -28
- package/weak_ref.d-eGOEP9S1.d.ts +9 -0
- package/fesm2022/injector-BlLwZ2sr.mjs +0 -24
- package/fesm2022/injector-BlLwZ2sr.mjs.map +0 -1
- package/fesm2022/untracked-DkcXpNb_.mjs.map +0 -1
- package/navigation_types.d-DgDrF5rp.d.ts +0 -121
- package/schematics/ng-generate/control-flow-migration/schema.json +0 -20
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/core",
|
|
3
|
-
"version": "20.0.0-next.
|
|
3
|
+
"version": "20.0.0-next.6",
|
|
4
4
|
"description": "Angular - the core framework",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^
|
|
8
|
+
"node": "^20.11.1 || >=22.11.0"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
"./schematics/*": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"tslib": "^2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@angular/compiler": "20.0.0-next.
|
|
49
|
+
"@angular/compiler": "20.0.0-next.6",
|
|
50
50
|
"rxjs": "^6.5.3 || ^7.4.0",
|
|
51
51
|
"zone.js": "~0.15.0"
|
|
52
52
|
},
|
package/primitives/di/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.6
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -103,4 +103,5 @@ interface Injector {
|
|
|
103
103
|
declare function getCurrentInjector(): Injector | undefined | null;
|
|
104
104
|
declare function setCurrentInjector(injector: Injector | null | undefined): Injector | undefined | null;
|
|
105
105
|
|
|
106
|
-
export {
|
|
106
|
+
export { NOT_FOUND, NotFoundError, getCurrentInjector, isNotFound, setCurrentInjector };
|
|
107
|
+
export type { InjectionToken, Injector, NotFound, ɵɵInjectableDeclaration };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.6
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { EarlyJsactionDataContainer, EventInfo, Restriction } from '../../event_dispatcher.d-DlbccpYq.js';
|
|
8
|
+
export { EventContract, EventContractContainer, EventDispatcher, EventInfoWrapper, EventPhase, registerDispatcher } from '../../event_dispatcher.d-DlbccpYq.js';
|
|
9
9
|
|
|
10
10
|
declare const Attribute: {
|
|
11
11
|
/**
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.6
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { ReactiveNode, ValueEqualityFn, SIGNAL } from '../../graph.d-BcIOep_B.js';
|
|
8
|
+
export { REACTIVE_NODE, Reactive, ReactiveHookFn, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerIncrementEpoch, producerMarkClean, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, runPostProducerCreatedFn, setActiveConsumer, setPostProducerCreatedFn } from '../../graph.d-BcIOep_B.js';
|
|
9
|
+
import { SignalNode } from '../../signal.d-E0e5nW1p.js';
|
|
10
|
+
export { SIGNAL_NODE, SignalGetter, createSignal, runPostSignalSetFn, setPostSignalSetFn, signalGetFn, signalSetFn, signalUpdateFn } from '../../signal.d-E0e5nW1p.js';
|
|
11
|
+
export { setAlternateWeakRefImpl } from '../../weak_ref.d-eGOEP9S1.js';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* A computation, which derives a value from a declarative reactive expression.
|
|
@@ -117,4 +120,5 @@ declare function createWatch(fn: (onCleanup: WatchCleanupRegisterFn) => void, sc
|
|
|
117
120
|
*/
|
|
118
121
|
declare function untracked<T>(nonReactiveReadsFn: () => T): T;
|
|
119
122
|
|
|
120
|
-
export {
|
|
123
|
+
export { ReactiveNode, SIGNAL, SignalNode, ValueEqualityFn, createComputed, createLinkedSignal, createWatch, linkedSignalSetFn, linkedSignalUpdateFn, setThrowInvalidWriteToSignalError, untracked };
|
|
124
|
+
export type { ComputationFn, ComputedNode, LinkedSignalGetter, LinkedSignalNode, Watch, WatchCleanupFn, WatchCleanupRegisterFn };
|
package/rxjs-interop/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.6
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { OutputRef, DestroyRef, Signal, Injector } from '../ng_i18n_closure_mode.d-C9d2CaSt.js';
|
|
8
|
+
import { OutputOptions, BaseResourceOptions, ResourceLoaderParams, ResourceRef } from '../api.d-DQLNOR5l.js';
|
|
8
9
|
import { Observable, MonoTypeOperatorFunction, Subscribable } from 'rxjs';
|
|
9
|
-
import { ValueEqualityFn } from '
|
|
10
|
+
import { ValueEqualityFn } from '../graph.d-BcIOep_B.js';
|
|
11
|
+
import '../event_dispatcher.d-DlbccpYq.js';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Declares an Angular output that is using an RxJS observable as a source
|
|
@@ -59,7 +61,7 @@ declare function takeUntilDestroyed<T>(destroyRef?: DestroyRef): MonoTypeOperato
|
|
|
59
61
|
/**
|
|
60
62
|
* Options for `toObservable`.
|
|
61
63
|
*
|
|
62
|
-
* @
|
|
64
|
+
* @publicApi
|
|
63
65
|
*/
|
|
64
66
|
interface ToObservableOptions {
|
|
65
67
|
/**
|
|
@@ -77,7 +79,7 @@ interface ToObservableOptions {
|
|
|
77
79
|
*
|
|
78
80
|
* `toObservable` must be called in an injection context unless an injector is provided via options.
|
|
79
81
|
*
|
|
80
|
-
* @
|
|
82
|
+
* @publicApi
|
|
81
83
|
*/
|
|
82
84
|
declare function toObservable<T>(source: Signal<T>, options?: ToObservableOptions): Observable<T>;
|
|
83
85
|
|
|
@@ -143,7 +145,7 @@ declare function toSignal<T, const U extends T>(source: Observable<T> | Subscrib
|
|
|
143
145
|
}): Signal<T | U>;
|
|
144
146
|
|
|
145
147
|
/**
|
|
146
|
-
* Operator which makes the application unstable until the observable emits,
|
|
148
|
+
* Operator which makes the application unstable until the observable emits, completes, errors, or is unsubscribed.
|
|
147
149
|
*
|
|
148
150
|
* Use this operator in observables whose subscriptions are important for rendering and should be included in SSR serialization.
|
|
149
151
|
*
|
|
@@ -178,4 +180,5 @@ declare function rxResource<T, R>(opts: RxResourceOptions<T, R> & {
|
|
|
178
180
|
*/
|
|
179
181
|
declare function rxResource<T, R>(opts: RxResourceOptions<T, R>): ResourceRef<T | undefined>;
|
|
180
182
|
|
|
181
|
-
export {
|
|
183
|
+
export { outputFromObservable, outputToObservable, pendingUntilEvent, rxResource, takeUntilDestroyed, toObservable, toSignal };
|
|
184
|
+
export type { RxResourceOptions, ToObservableOptions, ToSignalOptions };
|
package/schematics/bundles/{apply_import_manager-CeNv8GIG.js → apply_import_manager-DnMqg1pY.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
var
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
12
|
+
var project_paths = require('./project_paths-ql6qcf_c.js');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Applies import manager changes, and writes them as replacements the
|
|
@@ -23,7 +23,7 @@ function applyImportManagerChanges(importManager, replacements, sourceFiles, inf
|
|
|
23
23
|
newImports.forEach((newImports, fileName) => {
|
|
24
24
|
newImports.forEach((newImport) => {
|
|
25
25
|
const printedImport = printer.printNode(ts.EmitHint.Unspecified, newImport, pathToFile.get(fileName));
|
|
26
|
-
replacements.push(new
|
|
26
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(checker.absoluteFrom(fileName), info), new project_paths.TextUpdate({ position: 0, end: 0, toInsert: `${printedImport}\n` })));
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
// Capture updated imports
|
|
@@ -46,7 +46,7 @@ function applyImportManagerChanges(importManager, replacements, sourceFiles, inf
|
|
|
46
46
|
formatFlags &= ~ts.ListFormat.SpaceBetweenBraces;
|
|
47
47
|
}
|
|
48
48
|
const printedBindings = printer.printList(formatFlags, newBindings.elements, oldBindings.getSourceFile());
|
|
49
|
-
replacements.push(new
|
|
49
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(oldBindings.getSourceFile(), info), new project_paths.TextUpdate({
|
|
50
50
|
position: oldBindings.getStart(),
|
|
51
51
|
end: oldBindings.getEnd(),
|
|
52
52
|
// TS uses four spaces as indent. We migrate to two spaces as we
|
|
@@ -56,7 +56,7 @@ function applyImportManagerChanges(importManager, replacements, sourceFiles, inf
|
|
|
56
56
|
}
|
|
57
57
|
// Update removed imports
|
|
58
58
|
for (const removedImport of deletedImports) {
|
|
59
|
-
replacements.push(new
|
|
59
|
+
replacements.push(new project_paths.Replacement(project_paths.projectFile(removedImport.getSourceFile(), info), new project_paths.TextUpdate({
|
|
60
60
|
position: removedImport.getStart(),
|
|
61
61
|
end: removedImport.getEnd(),
|
|
62
62
|
toInsert: '',
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.6
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
|
|
10
|
+
require('./compiler-BQ7R7w2v.js');
|
|
11
|
+
var checker = require('./checker-BFBQyesT.js');
|
|
11
12
|
require('os');
|
|
12
|
-
var p = require('path');
|
|
13
|
-
|
|
14
|
-
function _interopNamespaceDefault(e) {
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var p__namespace = /*#__PURE__*/_interopNamespaceDefault(p);
|
|
32
13
|
|
|
33
14
|
/** Tracks changes that have to be made for specific files. */
|
|
34
15
|
class ChangeTracker {
|
|
@@ -216,104 +197,5 @@ function normalizePath(path) {
|
|
|
216
197
|
return path.replace(/\\/g, '/');
|
|
217
198
|
}
|
|
218
199
|
|
|
219
|
-
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
220
|
-
const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
221
|
-
const parseConfigHost = {
|
|
222
|
-
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
223
|
-
fileExists: ts.sys.fileExists,
|
|
224
|
-
readDirectory: ts.sys.readDirectory,
|
|
225
|
-
readFile: ts.sys.readFile,
|
|
226
|
-
};
|
|
227
|
-
// Throw if incorrect arguments are passed to this function. Passing relative base paths
|
|
228
|
-
// results in root directories not being resolved and in later type checking runtime errors.
|
|
229
|
-
// More details can be found here: https://github.com/microsoft/TypeScript/issues/37731.
|
|
230
|
-
if (!p__namespace.isAbsolute(basePath)) {
|
|
231
|
-
throw Error('Unexpected relative base path has been specified.');
|
|
232
|
-
}
|
|
233
|
-
return ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Creates a TypeScript program instance for a TypeScript project within
|
|
238
|
-
* the virtual file system tree.
|
|
239
|
-
* @param tree Virtual file system tree that contains the source files.
|
|
240
|
-
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
241
|
-
* @param basePath Base path for the virtual file system tree.
|
|
242
|
-
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
243
|
-
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
244
|
-
* @param additionalFiles Additional file paths that should be added to the program.
|
|
245
|
-
*/
|
|
246
|
-
function createMigrationProgram(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles) {
|
|
247
|
-
const { rootNames, options, host } = createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead);
|
|
248
|
-
return ts.createProgram(rootNames, options, host);
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Creates the options necessary to instantiate a TypeScript program.
|
|
252
|
-
* @param tree Virtual file system tree that contains the source files.
|
|
253
|
-
* @param tsconfigPath Virtual file system path that resolves to the TypeScript project.
|
|
254
|
-
* @param basePath Base path for the virtual file system tree.
|
|
255
|
-
* @param fakeFileRead Optional file reader function. Can be used to overwrite files in
|
|
256
|
-
* the TypeScript program, or to add in-memory files (e.g. to add global types).
|
|
257
|
-
* @param additionalFiles Additional file paths that should be added to the program.
|
|
258
|
-
* @param optionOverrides Overrides of the parsed compiler options.
|
|
259
|
-
*/
|
|
260
|
-
function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additionalFiles, optionOverrides) {
|
|
261
|
-
// Resolve the tsconfig path to an absolute path. This is needed as TypeScript otherwise
|
|
262
|
-
// is not able to resolve root directories in the given tsconfig. More details can be found
|
|
263
|
-
// in the following issue: https://github.com/microsoft/TypeScript/issues/37731.
|
|
264
|
-
tsconfigPath = p.resolve(basePath, tsconfigPath);
|
|
265
|
-
const parsed = parseTsconfigFile(tsconfigPath, p.dirname(tsconfigPath));
|
|
266
|
-
const options = optionOverrides ? { ...parsed.options, ...optionOverrides } : parsed.options;
|
|
267
|
-
const host = createMigrationCompilerHost(tree, options, basePath, fakeFileRead);
|
|
268
|
-
return { rootNames: parsed.fileNames.concat([]), options, host };
|
|
269
|
-
}
|
|
270
|
-
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
271
|
-
const host = ts.createCompilerHost(options, true);
|
|
272
|
-
const defaultReadFile = host.readFile;
|
|
273
|
-
// We need to overwrite the host "readFile" method, as we want the TypeScript
|
|
274
|
-
// program to be based on the file contents in the virtual file tree. Otherwise
|
|
275
|
-
// if we run multiple migrations we might have intersecting changes and
|
|
276
|
-
// source files.
|
|
277
|
-
host.readFile = (fileName) => {
|
|
278
|
-
const treeRelativePath = p.relative(basePath, fileName);
|
|
279
|
-
let result = fakeRead?.(treeRelativePath);
|
|
280
|
-
if (typeof result !== 'string') {
|
|
281
|
-
// If the relative path resolved to somewhere outside of the tree, fall back to
|
|
282
|
-
// TypeScript's default file reading function since the `tree` will throw an error.
|
|
283
|
-
result = treeRelativePath.startsWith('..')
|
|
284
|
-
? defaultReadFile.call(host, fileName)
|
|
285
|
-
: tree.read(treeRelativePath)?.toString();
|
|
286
|
-
}
|
|
287
|
-
// Strip BOM as otherwise TSC methods (Ex: getWidth) will return an offset,
|
|
288
|
-
// which breaks the CLI UpdateRecorder.
|
|
289
|
-
// See: https://github.com/angular/angular/pull/30719
|
|
290
|
-
return typeof result === 'string' ? result.replace(/^\uFEFF/, '') : undefined;
|
|
291
|
-
};
|
|
292
|
-
return host;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Checks whether a file can be migrate by our automated migrations.
|
|
296
|
-
* @param basePath Absolute path to the project.
|
|
297
|
-
* @param sourceFile File being checked.
|
|
298
|
-
* @param program Program that includes the source file.
|
|
299
|
-
*/
|
|
300
|
-
function canMigrateFile(basePath, sourceFile, program) {
|
|
301
|
-
// We shouldn't migrate .d.ts files, files from an external library or type checking files.
|
|
302
|
-
if (sourceFile.fileName.endsWith('.ngtypecheck.ts') ||
|
|
303
|
-
sourceFile.isDeclarationFile ||
|
|
304
|
-
program.isSourceFileFromExternalLibrary(sourceFile)) {
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
// Our migrations are set up to create a `Program` from the project's tsconfig and to migrate all
|
|
308
|
-
// the files within the program. This can include files that are outside of the Angular CLI
|
|
309
|
-
// project. We can't migrate files outside of the project, because our file system interactions
|
|
310
|
-
// go through the CLI's `Tree` which assumes that all files are within the project. See:
|
|
311
|
-
// https://github.com/angular/angular-cli/blob/0b0961c9c233a825b6e4bb59ab7f0790f9b14676/packages/angular_devkit/schematics/src/tree/host-tree.ts#L131
|
|
312
|
-
return !p.relative(basePath, sourceFile.fileName).startsWith('..');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
200
|
exports.ChangeTracker = ChangeTracker;
|
|
316
|
-
exports.canMigrateFile = canMigrateFile;
|
|
317
|
-
exports.createMigrationProgram = createMigrationProgram;
|
|
318
|
-
exports.createProgramOptions = createProgramOptions;
|
|
319
201
|
exports.normalizePath = normalizePath;
|