@angular/core 19.1.0-next.0 → 19.1.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/fesm2022/core.mjs +207 -210
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +4 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +4 -4
- package/index.d.ts +56 -38
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +10 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/{checker-3cbc9cc1.js → checker-a00b735e.js} +22 -23
- package/schematics/bundles/{combine_units-ab03aca8.js → combine_units-4983dfd3.js} +3 -3
- package/schematics/bundles/{compiler_host-087c5caa.js → compiler_host-3e96c3f7.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +5 -5
- package/schematics/bundles/{imports-4ac08251.js → imports-44987700.js} +1 -1
- package/schematics/bundles/inject-migration.js +60 -39
- package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-efb52bf2.js → migrate_ts_type_references-58326be5.js} +5 -5
- package/schematics/bundles/{nodes-0e7d45ca.js → nodes-b12e919a.js} +2 -2
- package/schematics/bundles/output-migration.js +5 -5
- package/schematics/bundles/pending-tasks.js +5 -5
- package/schematics/bundles/{program-ed10d149.js → program-37562cc3.js} +53 -29
- package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
- package/schematics/bundles/provide-initializer.js +5 -5
- package/schematics/bundles/route-lazy-loading.js +4 -4
- package/schematics/bundles/signal-input-migration.js +7 -7
- package/schematics/bundles/signal-queries-migration.js +7 -7
- package/schematics/bundles/signals.js +7 -7
- package/schematics/bundles/standalone-migration.js +8 -8
- package/testing/index.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10693,6 +10693,7 @@ function createDeferOp(xref, main, mainSlot, ownResolverFn, resolverFn, sourceSp
|
|
|
10693
10693
|
errorSlot: null,
|
|
10694
10694
|
ownResolverFn,
|
|
10695
10695
|
resolverFn,
|
|
10696
|
+
flags: null,
|
|
10696
10697
|
sourceSpan,
|
|
10697
10698
|
...NEW_OP,
|
|
10698
10699
|
...TRAIT_CONSUMES_SLOT,
|
|
@@ -22110,7 +22111,7 @@ function text(slot, initialValue, sourceSpan) {
|
|
|
22110
22111
|
}
|
|
22111
22112
|
return call(Identifiers.text, args, sourceSpan);
|
|
22112
22113
|
}
|
|
22113
|
-
function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan) {
|
|
22114
|
+
function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan, flags) {
|
|
22114
22115
|
const args = [
|
|
22115
22116
|
literal$1(selfSlot),
|
|
22116
22117
|
literal$1(primarySlot),
|
|
@@ -22121,6 +22122,7 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
|
|
|
22121
22122
|
loadingConfig ?? literal$1(null),
|
|
22122
22123
|
placeholderConfig ?? literal$1(null),
|
|
22123
22124
|
enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal$1(null),
|
|
22125
|
+
literal$1(flags),
|
|
22124
22126
|
];
|
|
22125
22127
|
let expr;
|
|
22126
22128
|
while ((expr = args[args.length - 1]) !== null &&
|
|
@@ -22714,7 +22716,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
22714
22716
|
break;
|
|
22715
22717
|
case OpKind.Defer:
|
|
22716
22718
|
const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
|
|
22717
|
-
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, op.resolverFn, op.loadingSlot?.slot ?? null, op.placeholderSlot?.slot ?? null, op.errorSlot?.slot ?? null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan));
|
|
22719
|
+
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, op.resolverFn, op.loadingSlot?.slot ?? null, op.placeholderSlot?.slot ?? null, op.errorSlot?.slot ?? null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan, op.flags));
|
|
22718
22720
|
break;
|
|
22719
22721
|
case OpKind.DeferOn:
|
|
22720
22722
|
let args = [];
|
|
@@ -25293,6 +25295,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
25293
25295
|
deferOp.placeholderMinimumTime = deferBlock.placeholder?.minimumTime ?? null;
|
|
25294
25296
|
deferOp.loadingMinimumTime = deferBlock.loading?.minimumTime ?? null;
|
|
25295
25297
|
deferOp.loadingAfterTime = deferBlock.loading?.afterTime ?? null;
|
|
25298
|
+
deferOp.flags = calcDeferBlockFlags(deferBlock);
|
|
25296
25299
|
unit.create.push(deferOp);
|
|
25297
25300
|
// Configure all defer `on` conditions.
|
|
25298
25301
|
// TODO: refactor prefetch triggers to use a separate op type, with a shared superclass. This will
|
|
@@ -25312,6 +25315,12 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
25312
25315
|
unit.create.push(deferOnOps);
|
|
25313
25316
|
unit.update.push(deferWhenOps);
|
|
25314
25317
|
}
|
|
25318
|
+
function calcDeferBlockFlags(deferBlockDetails) {
|
|
25319
|
+
if (Object.keys(deferBlockDetails.hydrateTriggers).length > 0) {
|
|
25320
|
+
return 1 /* ir.TDeferDetailsFlags.HasHydrateTriggers */;
|
|
25321
|
+
}
|
|
25322
|
+
return null;
|
|
25323
|
+
}
|
|
25315
25324
|
function ingestDeferTriggers(modifier, triggers, onOps, whenOps, unit, deferXref) {
|
|
25316
25325
|
if (triggers.idle !== undefined) {
|
|
25317
25326
|
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, modifier, triggers.idle.sourceSpan);
|
|
@@ -26161,13 +26170,11 @@ class BindingParser {
|
|
|
26161
26170
|
_interpolationConfig;
|
|
26162
26171
|
_schemaRegistry;
|
|
26163
26172
|
errors;
|
|
26164
|
-
|
|
26165
|
-
constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors, _allowInvalidAssignmentEvents = false) {
|
|
26173
|
+
constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors) {
|
|
26166
26174
|
this._exprParser = _exprParser;
|
|
26167
26175
|
this._interpolationConfig = _interpolationConfig;
|
|
26168
26176
|
this._schemaRegistry = _schemaRegistry;
|
|
26169
26177
|
this.errors = errors;
|
|
26170
|
-
this._allowInvalidAssignmentEvents = _allowInvalidAssignmentEvents;
|
|
26171
26178
|
}
|
|
26172
26179
|
get interpolationConfig() {
|
|
26173
26180
|
return this._interpolationConfig;
|
|
@@ -26551,16 +26558,7 @@ class BindingParser {
|
|
|
26551
26558
|
if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
|
|
26552
26559
|
return true;
|
|
26553
26560
|
}
|
|
26554
|
-
|
|
26555
|
-
// from invalid bindings. It should be removed once the migration is deleted.
|
|
26556
|
-
if (!this._allowInvalidAssignmentEvents) {
|
|
26557
|
-
return false;
|
|
26558
|
-
}
|
|
26559
|
-
if (ast instanceof Binary) {
|
|
26560
|
-
return ((ast.operation === '&&' || ast.operation === '||' || ast.operation === '??') &&
|
|
26561
|
-
(ast.right instanceof PropertyRead || ast.right instanceof KeyedRead));
|
|
26562
|
-
}
|
|
26563
|
-
return ast instanceof Conditional || ast instanceof PrefixNot;
|
|
26561
|
+
return false;
|
|
26564
26562
|
}
|
|
26565
26563
|
}
|
|
26566
26564
|
function isAnimationLabel(name) {
|
|
@@ -28184,8 +28182,8 @@ const LEADING_TRIVIA_CHARS = [' ', '\n', '\r', '\t'];
|
|
|
28184
28182
|
* @param options options to modify how the template is parsed
|
|
28185
28183
|
*/
|
|
28186
28184
|
function parseTemplate(template, templateUrl, options = {}) {
|
|
28187
|
-
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat
|
|
28188
|
-
const bindingParser = makeBindingParser(interpolationConfig
|
|
28185
|
+
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
28186
|
+
const bindingParser = makeBindingParser(interpolationConfig);
|
|
28189
28187
|
const htmlParser = new HtmlParser();
|
|
28190
28188
|
const parseResult = htmlParser.parse(template, templateUrl, {
|
|
28191
28189
|
leadingTriviaChars: LEADING_TRIVIA_CHARS,
|
|
@@ -28291,8 +28289,8 @@ const elementRegistry = new DomElementSchemaRegistry();
|
|
|
28291
28289
|
/**
|
|
28292
28290
|
* Construct a `BindingParser` with a default configuration.
|
|
28293
28291
|
*/
|
|
28294
|
-
function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG
|
|
28295
|
-
return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []
|
|
28292
|
+
function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
28293
|
+
return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []);
|
|
28296
28294
|
}
|
|
28297
28295
|
|
|
28298
28296
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
@@ -30323,7 +30321,7 @@ function publishFacade(global) {
|
|
|
30323
30321
|
* @description
|
|
30324
30322
|
* Entry point for all public APIs of the compiler package.
|
|
30325
30323
|
*/
|
|
30326
|
-
new Version('19.1.0-next.
|
|
30324
|
+
new Version('19.1.0-next.1');
|
|
30327
30325
|
|
|
30328
30326
|
const _I18N_ATTR = 'i18n';
|
|
30329
30327
|
const _I18N_ATTR_PREFIX = 'i18n-';
|
|
@@ -31731,7 +31729,7 @@ class NodeJSPathManipulation {
|
|
|
31731
31729
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
31732
31730
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
31733
31731
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
31734
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-
|
|
31732
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT' && document.currentScript.src || new URL('checker-a00b735e.js', document.baseURI).href));
|
|
31735
31733
|
const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
|
|
31736
31734
|
/**
|
|
31737
31735
|
* A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
|
|
@@ -32340,7 +32338,7 @@ const patchedReferencedAliasesSymbol = Symbol('patchedReferencedAliases');
|
|
|
32340
32338
|
* results in a slow-down due to the type checker being involved multiple times. The CLI worked
|
|
32341
32339
|
* around this import preserving issue by having another complex post-process step that detects and
|
|
32342
32340
|
* elides unused imports. Note that these unused imports could cause unused chunks being generated
|
|
32343
|
-
* by
|
|
32341
|
+
* by webpack if the application or library is not marked as side-effect free.
|
|
32344
32342
|
*
|
|
32345
32343
|
* This is not ideal though, as we basically re-implement the complex import usage resolution
|
|
32346
32344
|
* from TypeScript. We can do better by letting TypeScript do the import eliding, but providing
|
|
@@ -45815,6 +45813,7 @@ exports.DEFAULT_INTERPOLATION_CONFIG = DEFAULT_INTERPOLATION_CONFIG;
|
|
|
45815
45813
|
exports.DYNAMIC_TYPE = DYNAMIC_TYPE;
|
|
45816
45814
|
exports.Declaration = Declaration;
|
|
45817
45815
|
exports.DeclareFunctionStmt = DeclareFunctionStmt;
|
|
45816
|
+
exports.DeclareVarStmt = DeclareVarStmt;
|
|
45818
45817
|
exports.DefaultImportTracker = DefaultImportTracker;
|
|
45819
45818
|
exports.DefinitionMap = DefinitionMap;
|
|
45820
45819
|
exports.DomElementSchemaRegistry = DomElementSchemaRegistry;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,8 +10,8 @@ var core = require('@angular-devkit/core');
|
|
|
10
10
|
var posixPath = require('node:path/posix');
|
|
11
11
|
var os = require('os');
|
|
12
12
|
var ts = require('typescript');
|
|
13
|
-
var checker = require('./checker-
|
|
14
|
-
var program = require('./program-
|
|
13
|
+
var checker = require('./checker-a00b735e.js');
|
|
14
|
+
var program = require('./program-37562cc3.js');
|
|
15
15
|
require('path');
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
var checker = require('./checker-
|
|
10
|
+
var checker = require('./checker-a00b735e.js');
|
|
11
11
|
require('os');
|
|
12
12
|
var p = require('path');
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,8 +10,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var compiler_host = require('./compiler_host-
|
|
14
|
-
var checker = require('./checker-
|
|
13
|
+
var compiler_host = require('./compiler_host-3e96c3f7.js');
|
|
14
|
+
var checker = require('./checker-a00b735e.js');
|
|
15
15
|
var ts = require('typescript');
|
|
16
16
|
require('os');
|
|
17
17
|
require('fs');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
14
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
|
|
14
|
+
var compiler_host = require('./compiler_host-3e96c3f7.js');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var imports = require('./imports-
|
|
16
|
+
var imports = require('./imports-44987700.js');
|
|
17
17
|
require('@angular-devkit/core');
|
|
18
|
-
require('./checker-
|
|
18
|
+
require('./checker-a00b735e.js');
|
|
19
19
|
require('os');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
+
var compiler_host = require('./compiler_host-3e96c3f7.js');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var nodes = require('./nodes-
|
|
16
|
-
var imports = require('./imports-
|
|
17
|
-
var leading_space = require('./leading_space-
|
|
18
|
-
require('./checker-
|
|
15
|
+
var nodes = require('./nodes-b12e919a.js');
|
|
16
|
+
var imports = require('./imports-44987700.js');
|
|
17
|
+
var leading_space = require('./leading_space-6e7a8ec6.js');
|
|
18
|
+
require('./checker-a00b735e.js');
|
|
19
19
|
require('os');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|
|
@@ -50,6 +50,15 @@ const DI_PARAM_SYMBOLS = new Set([
|
|
|
50
50
|
'Host',
|
|
51
51
|
'forwardRef',
|
|
52
52
|
]);
|
|
53
|
+
/** Kinds of nodes which aren't injectable when set as a type of a parameter. */
|
|
54
|
+
const UNINJECTABLE_TYPE_KINDS = new Set([
|
|
55
|
+
ts__default["default"].SyntaxKind.TrueKeyword,
|
|
56
|
+
ts__default["default"].SyntaxKind.FalseKeyword,
|
|
57
|
+
ts__default["default"].SyntaxKind.NumberKeyword,
|
|
58
|
+
ts__default["default"].SyntaxKind.StringKeyword,
|
|
59
|
+
ts__default["default"].SyntaxKind.NullKeyword,
|
|
60
|
+
ts__default["default"].SyntaxKind.VoidKeyword,
|
|
61
|
+
]);
|
|
53
62
|
/**
|
|
54
63
|
* Finds the necessary information for the `inject` migration in a file.
|
|
55
64
|
* @param sourceFile File which to analyze.
|
|
@@ -76,12 +85,23 @@ function analyzeFile(sourceFile, localTypeChecker, options) {
|
|
|
76
85
|
if (ts__default["default"].isImportDeclaration(node)) {
|
|
77
86
|
return;
|
|
78
87
|
}
|
|
79
|
-
// Only visit the initializer of parameters, because we won't exclude
|
|
80
|
-
// their decorators from the identifier counting result below.
|
|
81
88
|
if (ts__default["default"].isParameter(node)) {
|
|
89
|
+
const closestConstructor = nodes.closestNode(node, ts__default["default"].isConstructorDeclaration);
|
|
90
|
+
// Visiting the same parameters that we're about to remove can throw off the reference
|
|
91
|
+
// counting logic below. If we run into an initializer, we always visit its initializer
|
|
92
|
+
// and optionally visit the modifiers/decorators if it's not due to be deleted. Note that
|
|
93
|
+
// here we technically aren't dealing with the the full list of classes, but the parent class
|
|
94
|
+
// will have been visited by the time we reach the parameters.
|
|
82
95
|
if (node.initializer) {
|
|
83
96
|
walk(node.initializer);
|
|
84
97
|
}
|
|
98
|
+
if (closestConstructor === null ||
|
|
99
|
+
// This is meant to avoid the case where this is a
|
|
100
|
+
// parameter inside a function placed in a constructor.
|
|
101
|
+
!closestConstructor.parameters.includes(node) ||
|
|
102
|
+
!classes.some((c) => c.constructor === closestConstructor)) {
|
|
103
|
+
node.modifiers?.forEach(walk);
|
|
104
|
+
}
|
|
85
105
|
return;
|
|
86
106
|
}
|
|
87
107
|
if (ts__default["default"].isIdentifier(node) && importsToSpecifiers.size > 0) {
|
|
@@ -111,9 +131,21 @@ function analyzeFile(sourceFile, localTypeChecker, options) {
|
|
|
111
131
|
const constructorNode = node.members.find((member) => ts__default["default"].isConstructorDeclaration(member) &&
|
|
112
132
|
member.body != null &&
|
|
113
133
|
member.parameters.length > 0);
|
|
134
|
+
// Basic check to determine if all parameters are injectable. This isn't exhaustive, but it
|
|
135
|
+
// should catch the majority of cases. An exhaustive check would require a full type checker
|
|
136
|
+
// which we don't have in this migration.
|
|
137
|
+
const allParamsInjectable = !!constructorNode?.parameters.every((param) => {
|
|
138
|
+
if (!param.type || !UNINJECTABLE_TYPE_KINDS.has(param.type.kind)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
return nodes.getAngularDecorators(localTypeChecker, ts__default["default"].getDecorators(param) || []).some((dec) => dec.name === 'Inject' || dec.name === 'Attribute');
|
|
142
|
+
});
|
|
114
143
|
// Don't migrate abstract classes by default, because
|
|
115
144
|
// their parameters aren't guaranteed to be injectable.
|
|
116
|
-
if (supportsDI &&
|
|
145
|
+
if (supportsDI &&
|
|
146
|
+
constructorNode &&
|
|
147
|
+
allParamsInjectable &&
|
|
148
|
+
(!isAbstract || options.migrateAbstractClasses)) {
|
|
117
149
|
classes.push({
|
|
118
150
|
node,
|
|
119
151
|
constructor: constructorNode,
|
|
@@ -666,7 +698,7 @@ function migrateClass(node, constructor, superCall, options, memberIndentation,
|
|
|
666
698
|
// the text if the statement after the `super` call is being deleted. This appears to be because
|
|
667
699
|
// the full start of the next statement appears to always be the end of the `super` call plus 1.
|
|
668
700
|
const nextStatement = getNextPreservedStatement(superCall, removedStatements);
|
|
669
|
-
tracker.insertText(sourceFile, nextStatement ? nextStatement.getFullStart() :
|
|
701
|
+
tracker.insertText(sourceFile, nextStatement ? nextStatement.getFullStart() : constructor.getEnd() - 1, `\n${afterSuper.join('\n')}\n` + (nextStatement ? '' : memberIndentation));
|
|
670
702
|
}
|
|
671
703
|
// Need to resolve this once all constructor signatures have been removed.
|
|
672
704
|
const memberReference = node.members.find((m) => !removedMembers.has(m)) || node.members[0];
|
|
@@ -688,7 +720,12 @@ function migrateClass(node, constructor, superCall, options, memberIndentation,
|
|
|
688
720
|
prependToClass.push(...afterInjectCalls);
|
|
689
721
|
if (prependToClass.length > 0) {
|
|
690
722
|
if (removedMembers.size === node.members.length) {
|
|
691
|
-
tracker.insertText(sourceFile,
|
|
723
|
+
tracker.insertText(sourceFile,
|
|
724
|
+
// If all members were deleted, insert after the last one.
|
|
725
|
+
// This allows us to preserve the indentation.
|
|
726
|
+
node.members.length > 0
|
|
727
|
+
? node.members[node.members.length - 1].getEnd() + 1
|
|
728
|
+
: node.getEnd() - 1, `${prependToClass.join('\n')}\n`);
|
|
692
729
|
}
|
|
693
730
|
else {
|
|
694
731
|
// Insert the new properties after the first member that hasn't been deleted.
|
|
@@ -902,15 +939,10 @@ function migrateInjectDecorator(firstArg, type, localTypeChecker) {
|
|
|
902
939
|
}
|
|
903
940
|
}
|
|
904
941
|
}
|
|
905
|
-
else if (
|
|
906
|
-
// Pass the type for cases like `@Inject(FOO_TOKEN) foo: Foo`, because:
|
|
907
|
-
// 1. It guarantees that the type stays the same as before.
|
|
908
|
-
// 2. Avoids leaving unused imports behind.
|
|
909
|
-
// We only do this for type references since the `@Inject` pattern above is fairly common and
|
|
910
|
-
// apps don't necessarily type their injection tokens correctly, whereas doing it for literal
|
|
911
|
-
// types will add a lot of noise to the generated code.
|
|
912
|
-
type &&
|
|
942
|
+
else if (type &&
|
|
913
943
|
(ts__default["default"].isTypeReferenceNode(type) ||
|
|
944
|
+
ts__default["default"].isTypeLiteralNode(type) ||
|
|
945
|
+
ts__default["default"].isTupleTypeNode(type) ||
|
|
914
946
|
(ts__default["default"].isUnionTypeNode(type) && type.types.some(ts__default["default"].isTypeReferenceNode)))) {
|
|
915
947
|
typeArguments = [type];
|
|
916
948
|
}
|
|
@@ -932,28 +964,17 @@ function stripConstructorParameters(node, tracker) {
|
|
|
932
964
|
const constructorText = node.getText();
|
|
933
965
|
const lastParamText = node.parameters[node.parameters.length - 1].getText();
|
|
934
966
|
const lastParamStart = constructorText.indexOf(lastParamText);
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
break;
|
|
945
|
-
}
|
|
946
|
-
else if (!whitespacePattern.test(char)) {
|
|
947
|
-
// The end of the last parameter won't include
|
|
948
|
-
// any trailing commas which we need to account for.
|
|
949
|
-
lastParamEnd = i + 1;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
if (closeParenIndex > -1) {
|
|
953
|
-
trailingCharacters = closeParenIndex - lastParamEnd;
|
|
967
|
+
// This shouldn't happen, but bail out just in case so we don't mangle the code.
|
|
968
|
+
if (lastParamStart === -1) {
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
for (let i = lastParamStart + lastParamText.length; i < constructorText.length; i++) {
|
|
972
|
+
const char = constructorText[i];
|
|
973
|
+
if (char === ')') {
|
|
974
|
+
tracker.replaceText(node.getSourceFile(), node.parameters.pos, node.getStart() + i - node.parameters.pos, '');
|
|
975
|
+
break;
|
|
954
976
|
}
|
|
955
977
|
}
|
|
956
|
-
tracker.replaceText(node.getSourceFile(), node.parameters.pos, node.parameters.end - node.parameters.pos + trailingCharacters, '');
|
|
957
978
|
}
|
|
958
979
|
/**
|
|
959
980
|
* Creates a type checker scoped to a specific file.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var checker = require('./checker-
|
|
9
|
+
var checker = require('./checker-a00b735e.js');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var combine_units = require('./combine_units-
|
|
14
|
-
var leading_space = require('./leading_space-
|
|
15
|
-
require('./program-
|
|
13
|
+
var combine_units = require('./combine_units-4983dfd3.js');
|
|
14
|
+
var leading_space = require('./leading_space-6e7a8ec6.js');
|
|
15
|
+
require('./program-37562cc3.js');
|
|
16
16
|
require('path');
|
|
17
17
|
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
var imports = require('./imports-
|
|
10
|
+
var imports = require('./imports-44987700.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
13
|
-
var combine_units = require('./combine_units-
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
|
|
13
|
+
var combine_units = require('./combine_units-4983dfd3.js');
|
|
14
14
|
require('os');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var checker = require('./checker-
|
|
17
|
-
var program = require('./program-
|
|
16
|
+
var checker = require('./checker-a00b735e.js');
|
|
17
|
+
var program = require('./program-37562cc3.js');
|
|
18
18
|
require('path');
|
|
19
19
|
require('@angular-devkit/core');
|
|
20
20
|
require('node:path/posix');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.1.0-next.
|
|
3
|
+
* @license Angular v19.1.0-next.1
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,12 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
14
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
|
|
14
|
+
var compiler_host = require('./compiler_host-3e96c3f7.js');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var imports = require('./imports-
|
|
16
|
+
var imports = require('./imports-44987700.js');
|
|
17
17
|
require('@angular-devkit/core');
|
|
18
|
-
require('./checker-
|
|
18
|
+
require('./checker-a00b735e.js');
|
|
19
19
|
require('os');
|
|
20
20
|
require('fs');
|
|
21
21
|
require('module');
|