@angular/core 19.0.0-next.8 → 19.0.0-next.9
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 +93 -13
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +6 -4
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +41 -18
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +5 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/{checker-e68dd7ce.js → checker-3b2ea20f.js} +124 -76
- package/schematics/bundles/{compiler_host-9a4d0c2b.js → compiler_host-b4ba5a28.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +3 -3
- package/schematics/bundles/{group_replacements-472b2387.js → group_replacements-e1b5cbf8.js} +234 -108
- package/schematics/bundles/imports-4ac08251.js +1 -1
- package/schematics/bundles/inject-migration.js +3 -3
- package/schematics/bundles/leading_space-d190b83b.js +1 -1
- package/schematics/bundles/nodes-0e7d45ca.js +1 -1
- package/schematics/bundles/pending-tasks.js +3 -3
- package/schematics/bundles/{program-105283c5.js → program-6534a30a.js} +67 -21
- package/schematics/bundles/project_tsconfig_paths-e9ccccbf.js +1 -1
- package/schematics/bundles/route-lazy-loading.js +3 -3
- package/schematics/bundles/signal-input-migration.js +147 -171
- package/schematics/bundles/signal-queries-migration.js +93 -74
- package/schematics/bundles/standalone-migration.js +5 -5
- package/testing/index.d.ts +3 -1
package/schematics/bundles/{group_replacements-472b2387.js → group_replacements-e1b5cbf8.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.0.0-next.
|
|
3
|
+
* @license Angular v19.0.0-next.9
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
var os = require('os');
|
|
10
10
|
var ts = require('typescript');
|
|
11
|
-
var checker = require('./checker-
|
|
12
|
-
var program = require('./program-
|
|
11
|
+
var checker = require('./checker-3b2ea20f.js');
|
|
12
|
+
var program = require('./program-6534a30a.js');
|
|
13
13
|
require('path');
|
|
14
14
|
var assert = require('assert');
|
|
15
15
|
var core = require('@angular-devkit/core');
|
|
16
|
-
var
|
|
16
|
+
var posixPath = require('node:path/posix');
|
|
17
17
|
|
|
18
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
19
|
|
|
@@ -38,7 +38,7 @@ function _interopNamespace(e) {
|
|
|
38
38
|
var os__namespace = /*#__PURE__*/_interopNamespace(os);
|
|
39
39
|
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
40
40
|
var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert);
|
|
41
|
-
var
|
|
41
|
+
var posixPath__namespace = /*#__PURE__*/_interopNamespace(posixPath);
|
|
42
42
|
|
|
43
43
|
/// <reference types="node" />
|
|
44
44
|
class NgtscCompilerHost {
|
|
@@ -252,40 +252,40 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
|
-
* Reasons why
|
|
255
|
+
* Reasons why a field cannot be migrated.
|
|
256
256
|
*
|
|
257
257
|
* Higher values of incompatibility reasons indicate a more significant
|
|
258
258
|
* incompatibility reason. Lower ones may be overridden by higher ones.
|
|
259
259
|
* */
|
|
260
|
-
exports.
|
|
261
|
-
(function (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
})(exports.
|
|
275
|
-
/** Reasons why a whole class and its
|
|
260
|
+
exports.FieldIncompatibilityReason = void 0;
|
|
261
|
+
(function (FieldIncompatibilityReason) {
|
|
262
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["OverriddenByDerivedClass"] = 1] = "OverriddenByDerivedClass";
|
|
263
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["RedeclaredViaDerivedClassInputsArray"] = 2] = "RedeclaredViaDerivedClassInputsArray";
|
|
264
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["TypeConflictWithBaseClass"] = 3] = "TypeConflictWithBaseClass";
|
|
265
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["ParentIsIncompatible"] = 4] = "ParentIsIncompatible";
|
|
266
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["SpyOnThatOverwritesField"] = 5] = "SpyOnThatOverwritesField";
|
|
267
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["PotentiallyNarrowedInTemplateButNoSupportYet"] = 6] = "PotentiallyNarrowedInTemplateButNoSupportYet";
|
|
268
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["SignalInput__RequiredButNoGoodExplicitTypeExtractable"] = 7] = "SignalInput__RequiredButNoGoodExplicitTypeExtractable";
|
|
269
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["SignalInput__QuestionMarkButNoGoodExplicitTypeExtractable"] = 8] = "SignalInput__QuestionMarkButNoGoodExplicitTypeExtractable";
|
|
270
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["WriteAssignment"] = 9] = "WriteAssignment";
|
|
271
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["Accessor"] = 10] = "Accessor";
|
|
272
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["OutsideOfMigrationScope"] = 11] = "OutsideOfMigrationScope";
|
|
273
|
+
FieldIncompatibilityReason[FieldIncompatibilityReason["SkippedViaConfigFilter"] = 12] = "SkippedViaConfigFilter";
|
|
274
|
+
})(exports.FieldIncompatibilityReason || (exports.FieldIncompatibilityReason = {}));
|
|
275
|
+
/** Reasons why a whole class and its fields cannot be migrated. */
|
|
276
276
|
exports.ClassIncompatibilityReason = void 0;
|
|
277
277
|
(function (ClassIncompatibilityReason) {
|
|
278
278
|
ClassIncompatibilityReason[ClassIncompatibilityReason["ClassManuallyInstantiated"] = 0] = "ClassManuallyInstantiated";
|
|
279
|
-
ClassIncompatibilityReason[ClassIncompatibilityReason["
|
|
279
|
+
ClassIncompatibilityReason[ClassIncompatibilityReason["OwningClassReferencedInClassProperty"] = 1] = "OwningClassReferencedInClassProperty";
|
|
280
280
|
})(exports.ClassIncompatibilityReason || (exports.ClassIncompatibilityReason = {}));
|
|
281
|
-
/** Whether the given value refers to an
|
|
282
|
-
function
|
|
281
|
+
/** Whether the given value refers to an field incompatibility. */
|
|
282
|
+
function isFieldIncompatibility(value) {
|
|
283
283
|
return (value.reason !== undefined &&
|
|
284
284
|
value.context !== undefined &&
|
|
285
|
-
exports.
|
|
285
|
+
exports.FieldIncompatibilityReason.hasOwnProperty(value.reason));
|
|
286
286
|
}
|
|
287
|
-
/** Picks the more significant
|
|
288
|
-
function
|
|
287
|
+
/** Picks the more significant field compatibility. */
|
|
288
|
+
function pickFieldIncompatibility(a, b) {
|
|
289
289
|
if (b === null) {
|
|
290
290
|
return a;
|
|
291
291
|
}
|
|
@@ -484,7 +484,7 @@ class SpyOnFieldPattern {
|
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
this.fields.markFieldIncompatible(fieldTarget, {
|
|
487
|
-
reason: exports.
|
|
487
|
+
reason: exports.FieldIncompatibilityReason.SpyOnThatOverwritesField,
|
|
488
488
|
context: node,
|
|
489
489
|
});
|
|
490
490
|
}
|
|
@@ -551,7 +551,7 @@ function checkIncompatiblePatterns(inheritanceGraph, checker$1, groupedTsAstVisi
|
|
|
551
551
|
if (derivedMembers.length === 0 && inherited === undefined) {
|
|
552
552
|
break problematicReferencesCheck;
|
|
553
553
|
}
|
|
554
|
-
fields.markClassIncompatible(inputClassSymbolsToClass.get(newTarget), exports.ClassIncompatibilityReason.
|
|
554
|
+
fields.markClassIncompatible(inputClassSymbolsToClass.get(newTarget), exports.ClassIncompatibilityReason.OwningClassReferencedInClassProperty);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
};
|
|
@@ -3232,6 +3232,10 @@ class Identifiers {
|
|
|
3232
3232
|
name: 'ɵɵInputTransformsFeature',
|
|
3233
3233
|
moduleName: CORE,
|
|
3234
3234
|
}; }
|
|
3235
|
+
static { this.ExternalStylesFeature = {
|
|
3236
|
+
name: 'ɵɵExternalStylesFeature',
|
|
3237
|
+
moduleName: CORE,
|
|
3238
|
+
}; }
|
|
3235
3239
|
static { this.listener = { name: 'ɵɵlistener', moduleName: CORE }; }
|
|
3236
3240
|
static { this.getInheritedFactory = {
|
|
3237
3241
|
name: 'ɵɵgetInheritedFactory',
|
|
@@ -6905,7 +6909,7 @@ class ShadowCss {
|
|
|
6905
6909
|
* captures how many (if any) leading whitespaces are present or a comma
|
|
6906
6910
|
* - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
|
|
6907
6911
|
* captures two different possible keyframes, ones which are quoted or ones which are valid css
|
|
6908
|
-
*
|
|
6912
|
+
* indents (custom properties excluded)
|
|
6909
6913
|
* - (?=[,\s;]|$)
|
|
6910
6914
|
* simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
|
|
6911
6915
|
* semicolon or the end of the string
|
|
@@ -7134,7 +7138,7 @@ class ShadowCss {
|
|
|
7134
7138
|
*/
|
|
7135
7139
|
_scopeCssText(cssText, scopeSelector, hostSelector) {
|
|
7136
7140
|
const unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
|
|
7137
|
-
// replace :host and :host-context -shadowcsshost and -
|
|
7141
|
+
// replace :host and :host-context with -shadowcsshost and -shadowcsshostcontext respectively
|
|
7138
7142
|
cssText = this._insertPolyfillHostInCssText(cssText);
|
|
7139
7143
|
cssText = this._convertColonHost(cssText);
|
|
7140
7144
|
cssText = this._convertColonHostContext(cssText);
|
|
@@ -7212,7 +7216,7 @@ class ShadowCss {
|
|
|
7212
7216
|
* .foo<scopeName> .bar { ... }
|
|
7213
7217
|
*/
|
|
7214
7218
|
_convertColonHostContext(cssText) {
|
|
7215
|
-
return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
|
|
7219
|
+
return cssText.replace(_cssColonHostContextReGlobal, (selectorText, pseudoPrefix) => {
|
|
7216
7220
|
// We have captured a selector that contains a `:host-context` rule.
|
|
7217
7221
|
// For backward compatibility `:host-context` may contain a comma separated list of selectors.
|
|
7218
7222
|
// Each context selector group will contain a list of host-context selectors that must match
|
|
@@ -7261,10 +7265,10 @@ class ShadowCss {
|
|
|
7261
7265
|
selectorText = match[2];
|
|
7262
7266
|
}
|
|
7263
7267
|
// The context selectors now must be combined with each other to capture all the possible
|
|
7264
|
-
// selectors that `:host-context` can match. See `
|
|
7268
|
+
// selectors that `:host-context` can match. See `_combineHostContextSelectors()` for more
|
|
7265
7269
|
// info about how this is done.
|
|
7266
7270
|
return contextSelectorGroups
|
|
7267
|
-
.map((contextSelectors) =>
|
|
7271
|
+
.map((contextSelectors) => _combineHostContextSelectors(contextSelectors, selectorText, pseudoPrefix))
|
|
7268
7272
|
.join(', ');
|
|
7269
7273
|
});
|
|
7270
7274
|
}
|
|
@@ -7281,7 +7285,12 @@ class ShadowCss {
|
|
|
7281
7285
|
let selector = rule.selector;
|
|
7282
7286
|
let content = rule.content;
|
|
7283
7287
|
if (rule.selector[0] !== '@') {
|
|
7284
|
-
selector = this._scopeSelector(
|
|
7288
|
+
selector = this._scopeSelector({
|
|
7289
|
+
selector,
|
|
7290
|
+
scopeSelector,
|
|
7291
|
+
hostSelector,
|
|
7292
|
+
isParentSelector: true,
|
|
7293
|
+
});
|
|
7285
7294
|
}
|
|
7286
7295
|
else if (scopedAtRuleIdentifiers.some((atRule) => rule.selector.startsWith(atRule))) {
|
|
7287
7296
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
@@ -7321,15 +7330,29 @@ class ShadowCss {
|
|
|
7321
7330
|
return new CssRule(selector, rule.content);
|
|
7322
7331
|
});
|
|
7323
7332
|
}
|
|
7324
|
-
|
|
7333
|
+
// `isParentSelector` is used to distinguish the selectors which are coming from
|
|
7334
|
+
// the initial selector string and any nested selectors, parsed recursively,
|
|
7335
|
+
// for example `selector = 'a:where(.one)'` could be the parent, while recursive call
|
|
7336
|
+
// would have `selector = '.one'`.
|
|
7337
|
+
_scopeSelector({ selector, scopeSelector, hostSelector, isParentSelector = false, }) {
|
|
7338
|
+
// Split the selector into independent parts by `,` (comma) unless
|
|
7339
|
+
// comma is within parenthesis, for example `:is(.one, two)`.
|
|
7340
|
+
// Negative lookup after comma allows not splitting inside nested parenthesis,
|
|
7341
|
+
// up to three levels (((,))).
|
|
7342
|
+
const selectorSplitRe = / ?,(?!(?:[^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\))) ?/;
|
|
7325
7343
|
return selector
|
|
7326
|
-
.split(
|
|
7344
|
+
.split(selectorSplitRe)
|
|
7327
7345
|
.map((part) => part.split(_shadowDeepSelectors))
|
|
7328
7346
|
.map((deepParts) => {
|
|
7329
7347
|
const [shallowPart, ...otherParts] = deepParts;
|
|
7330
7348
|
const applyScope = (shallowPart) => {
|
|
7331
7349
|
if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {
|
|
7332
|
-
return this._applySelectorScope(
|
|
7350
|
+
return this._applySelectorScope({
|
|
7351
|
+
selector: shallowPart,
|
|
7352
|
+
scopeSelector,
|
|
7353
|
+
hostSelector,
|
|
7354
|
+
isParentSelector,
|
|
7355
|
+
});
|
|
7333
7356
|
}
|
|
7334
7357
|
else {
|
|
7335
7358
|
return shallowPart;
|
|
@@ -7356,8 +7379,8 @@ class ShadowCss {
|
|
|
7356
7379
|
if (_polyfillHostRe.test(selector)) {
|
|
7357
7380
|
const replaceBy = `[${hostSelector}]`;
|
|
7358
7381
|
return selector
|
|
7359
|
-
.replace(
|
|
7360
|
-
return selector.replace(/([
|
|
7382
|
+
.replace(_polyfillHostNoCombinatorReGlobal, (_hnc, selector) => {
|
|
7383
|
+
return selector.replace(/([^:\)]*)(:*)(.*)/, (_, before, colon, after) => {
|
|
7361
7384
|
return before + replaceBy + colon + after;
|
|
7362
7385
|
});
|
|
7363
7386
|
})
|
|
@@ -7367,7 +7390,7 @@ class ShadowCss {
|
|
|
7367
7390
|
}
|
|
7368
7391
|
// return a selector with [name] suffix on each simple selector
|
|
7369
7392
|
// e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
|
|
7370
|
-
_applySelectorScope(selector, scopeSelector, hostSelector) {
|
|
7393
|
+
_applySelectorScope({ selector, scopeSelector, hostSelector, isParentSelector, }) {
|
|
7371
7394
|
const isRe = /\[is=([^\]]*)\]/g;
|
|
7372
7395
|
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
7373
7396
|
const attrName = '[' + scopeSelector + ']';
|
|
@@ -7378,6 +7401,10 @@ class ShadowCss {
|
|
|
7378
7401
|
}
|
|
7379
7402
|
if (p.includes(_polyfillHostNoCombinator)) {
|
|
7380
7403
|
scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
|
|
7404
|
+
if (_polyfillHostNoCombinatorWithinPseudoFunction.test(p)) {
|
|
7405
|
+
const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)(.*)/);
|
|
7406
|
+
scopedP = before + attrName + colon + after;
|
|
7407
|
+
}
|
|
7381
7408
|
}
|
|
7382
7409
|
else {
|
|
7383
7410
|
// remove :host since it should be unnecessary
|
|
@@ -7391,12 +7418,50 @@ class ShadowCss {
|
|
|
7391
7418
|
}
|
|
7392
7419
|
return scopedP;
|
|
7393
7420
|
};
|
|
7394
|
-
|
|
7395
|
-
selector
|
|
7421
|
+
// Wraps `_scopeSelectorPart()` to not use it directly on selectors with
|
|
7422
|
+
// pseudo selector functions like `:where()`. Selectors within pseudo selector
|
|
7423
|
+
// functions are recursively sent to `_scopeSelector()`.
|
|
7424
|
+
const _pseudoFunctionAwareScopeSelectorPart = (selectorPart) => {
|
|
7425
|
+
let scopedPart = '';
|
|
7426
|
+
const cssPrefixWithPseudoSelectorFunctionMatch = selectorPart.match(_cssPrefixWithPseudoSelectorFunction);
|
|
7427
|
+
if (cssPrefixWithPseudoSelectorFunctionMatch) {
|
|
7428
|
+
const [cssPseudoSelectorFunction] = cssPrefixWithPseudoSelectorFunctionMatch;
|
|
7429
|
+
// Unwrap the pseudo selector to scope its contents.
|
|
7430
|
+
// For example,
|
|
7431
|
+
// - `:where(selectorToScope)` -> `selectorToScope`;
|
|
7432
|
+
// - `:is(.foo, .bar)` -> `.foo, .bar`.
|
|
7433
|
+
const selectorToScope = selectorPart.slice(cssPseudoSelectorFunction.length, -1);
|
|
7434
|
+
if (selectorToScope.includes(_polyfillHostNoCombinator)) {
|
|
7435
|
+
this._shouldScopeIndicator = true;
|
|
7436
|
+
}
|
|
7437
|
+
const scopedInnerPart = this._scopeSelector({
|
|
7438
|
+
selector: selectorToScope,
|
|
7439
|
+
scopeSelector,
|
|
7440
|
+
hostSelector,
|
|
7441
|
+
});
|
|
7442
|
+
// Put the result back into the pseudo selector function.
|
|
7443
|
+
scopedPart = `${cssPseudoSelectorFunction}${scopedInnerPart})`;
|
|
7444
|
+
}
|
|
7445
|
+
else {
|
|
7446
|
+
this._shouldScopeIndicator =
|
|
7447
|
+
this._shouldScopeIndicator || selectorPart.includes(_polyfillHostNoCombinator);
|
|
7448
|
+
scopedPart = this._shouldScopeIndicator ? _scopeSelectorPart(selectorPart) : selectorPart;
|
|
7449
|
+
}
|
|
7450
|
+
return scopedPart;
|
|
7451
|
+
};
|
|
7452
|
+
if (isParentSelector) {
|
|
7453
|
+
this._safeSelector = new SafeSelector(selector);
|
|
7454
|
+
selector = this._safeSelector.content();
|
|
7455
|
+
}
|
|
7396
7456
|
let scopedSelector = '';
|
|
7397
7457
|
let startIndex = 0;
|
|
7398
7458
|
let res;
|
|
7399
|
-
|
|
7459
|
+
// Combinators aren't used as a delimiter if they are within parenthesis,
|
|
7460
|
+
// for example `:where(.one .two)` stays intact.
|
|
7461
|
+
// Similarly to selector separation by comma initially, negative lookahead
|
|
7462
|
+
// is used here to not break selectors within nested parenthesis up to three
|
|
7463
|
+
// nested layers.
|
|
7464
|
+
const sep = /( |>|\+|~(?!=))(?!([^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\)))\s*/g;
|
|
7400
7465
|
// If a selector appears before :host it should not be shimmed as it
|
|
7401
7466
|
// matches on ancestor elements and not on elements in the host's shadow
|
|
7402
7467
|
// `:host-context(div)` is transformed to
|
|
@@ -7409,8 +7474,13 @@ class ShadowCss {
|
|
|
7409
7474
|
// - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
|
|
7410
7475
|
// `:host-context(tag)`)
|
|
7411
7476
|
const hasHost = selector.includes(_polyfillHostNoCombinator);
|
|
7412
|
-
// Only scope parts after the first `-shadowcsshost-no-combinator`
|
|
7413
|
-
|
|
7477
|
+
// Only scope parts after or on the same level as the first `-shadowcsshost-no-combinator`
|
|
7478
|
+
// when it is present. The selector has the same level when it is a part of a pseudo
|
|
7479
|
+
// selector, like `:where()`, for example `:where(:host, .foo)` would result in `.foo`
|
|
7480
|
+
// being scoped.
|
|
7481
|
+
if (isParentSelector || this._shouldScopeIndicator) {
|
|
7482
|
+
this._shouldScopeIndicator = !hasHost;
|
|
7483
|
+
}
|
|
7414
7484
|
while ((res = sep.exec(selector)) !== null) {
|
|
7415
7485
|
const separator = res[1];
|
|
7416
7486
|
// Do not trim the selector, as otherwise this will break sourcemaps
|
|
@@ -7426,16 +7496,15 @@ class ShadowCss {
|
|
|
7426
7496
|
if (part.match(/__esc-ph-(\d+)__/) && selector[res.index + 1]?.match(/[a-fA-F\d]/)) {
|
|
7427
7497
|
continue;
|
|
7428
7498
|
}
|
|
7429
|
-
|
|
7430
|
-
const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
|
|
7499
|
+
const scopedPart = _pseudoFunctionAwareScopeSelectorPart(part);
|
|
7431
7500
|
scopedSelector += `${scopedPart} ${separator} `;
|
|
7432
7501
|
startIndex = sep.lastIndex;
|
|
7433
7502
|
}
|
|
7434
7503
|
const part = selector.substring(startIndex);
|
|
7435
|
-
|
|
7436
|
-
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
7504
|
+
scopedSelector += _pseudoFunctionAwareScopeSelectorPart(part);
|
|
7437
7505
|
// replace the placeholders with their original values
|
|
7438
|
-
|
|
7506
|
+
// using values stored inside the `safeSelector` instance.
|
|
7507
|
+
return this._safeSelector.restore(scopedSelector);
|
|
7439
7508
|
}
|
|
7440
7509
|
_insertPolyfillHostInCssText(selector) {
|
|
7441
7510
|
return selector
|
|
@@ -7490,6 +7559,8 @@ class SafeSelector {
|
|
|
7490
7559
|
});
|
|
7491
7560
|
}
|
|
7492
7561
|
}
|
|
7562
|
+
const _cssScopedPseudoFunctionPrefix = '(:(where|is)\\()?';
|
|
7563
|
+
const _cssPrefixWithPseudoSelectorFunction = /^:(where|is)\(/i;
|
|
7493
7564
|
const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
|
|
7494
7565
|
const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
7495
7566
|
const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
|
|
@@ -7498,10 +7569,12 @@ const _polyfillHost = '-shadowcsshost';
|
|
|
7498
7569
|
const _polyfillHostContext = '-shadowcsscontext';
|
|
7499
7570
|
const _parenSuffix = '(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
|
|
7500
7571
|
const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');
|
|
7501
|
-
const _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, 'gim');
|
|
7572
|
+
const _cssColonHostContextReGlobal = new RegExp(_cssScopedPseudoFunctionPrefix + '(' + _polyfillHostContext + _parenSuffix + ')', 'gim');
|
|
7502
7573
|
const _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');
|
|
7503
7574
|
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
7575
|
+
const _polyfillHostNoCombinatorWithinPseudoFunction = new RegExp(`:.*\\(.*${_polyfillHostNoCombinator}.*\\)`);
|
|
7504
7576
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
7577
|
+
const _polyfillHostNoCombinatorReGlobal = new RegExp(_polyfillHostNoCombinatorRe, 'g');
|
|
7505
7578
|
const _shadowDOMSelectorsRe = [
|
|
7506
7579
|
/::shadow/g,
|
|
7507
7580
|
/::content/g,
|
|
@@ -7735,7 +7808,7 @@ function unescapeQuotes(str, isQuoted) {
|
|
|
7735
7808
|
* @param contextSelectors an array of context selectors that will be combined.
|
|
7736
7809
|
* @param otherSelectors the rest of the selectors that are not context selectors.
|
|
7737
7810
|
*/
|
|
7738
|
-
function
|
|
7811
|
+
function _combineHostContextSelectors(contextSelectors, otherSelectors, pseudoPrefix = '') {
|
|
7739
7812
|
const hostMarker = _polyfillHostNoCombinator;
|
|
7740
7813
|
_polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test
|
|
7741
7814
|
const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);
|
|
@@ -7761,8 +7834,8 @@ function combineHostContextSelectors(contextSelectors, otherSelectors) {
|
|
|
7761
7834
|
// (A<hostMarker>) or as an ancestor (A <hostMarker>).
|
|
7762
7835
|
return combined
|
|
7763
7836
|
.map((s) => otherSelectorsHasHost
|
|
7764
|
-
? `${s}${otherSelectors}`
|
|
7765
|
-
: `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`)
|
|
7837
|
+
? `${pseudoPrefix}${s}${otherSelectors}`
|
|
7838
|
+
: `${pseudoPrefix}${s}${hostMarker}${otherSelectors}, ${pseudoPrefix}${s} ${hostMarker}${otherSelectors}`)
|
|
7766
7839
|
.join(',');
|
|
7767
7840
|
}
|
|
7768
7841
|
/**
|
|
@@ -24613,29 +24686,9 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
24613
24686
|
return convertAst(ast.ast, job, baseSourceSpan);
|
|
24614
24687
|
}
|
|
24615
24688
|
else if (ast instanceof PropertyRead) {
|
|
24616
|
-
const isThisReceiver = ast.receiver instanceof ThisReceiver;
|
|
24617
24689
|
// Whether this is an implicit receiver, *excluding* explicit reads of `this`.
|
|
24618
24690
|
const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
|
|
24619
|
-
|
|
24620
|
-
// receiver.
|
|
24621
|
-
const isSpecialNode = ast.name === '$any' || ast.name === '$event';
|
|
24622
|
-
// TODO: The most sensible condition here would be simply `isImplicitReceiver`, to convert only
|
|
24623
|
-
// actual implicit `this` reads, and not explicit ones. However, TemplateDefinitionBuilder (and
|
|
24624
|
-
// the Typecheck block!) both have the same bug, in which they also consider explicit `this`
|
|
24625
|
-
// reads to be implicit. This causes problems when the explicit `this` read is inside a
|
|
24626
|
-
// template with a context that also provides the variable name being read:
|
|
24627
|
-
// ```
|
|
24628
|
-
// <ng-template let-a>{{this.a}}</ng-template>
|
|
24629
|
-
// ```
|
|
24630
|
-
// The whole point of the explicit `this` was to access the class property, but TDB and the
|
|
24631
|
-
// current TCB treat the read as implicit, and give you the context property instead!
|
|
24632
|
-
//
|
|
24633
|
-
// For now, we emulate this old behavior by aggressively converting explicit reads to to
|
|
24634
|
-
// implicit reads, except for the special cases that TDB and the current TCB protect. However,
|
|
24635
|
-
// it would be an improvement to fix this.
|
|
24636
|
-
//
|
|
24637
|
-
// See also the corresponding comment for the TCB, in `type_check_block.ts`.
|
|
24638
|
-
if (isImplicitReceiver || (isThisReceiver && !isSpecialNode)) {
|
|
24691
|
+
if (isImplicitReceiver) {
|
|
24639
24692
|
return new LexicalReadExpr(ast.name);
|
|
24640
24693
|
}
|
|
24641
24694
|
else {
|
|
@@ -27484,6 +27537,10 @@ function addFeatures(definitionMap, meta) {
|
|
|
27484
27537
|
if (meta.hasOwnProperty('template') && meta.isStandalone) {
|
|
27485
27538
|
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
27486
27539
|
}
|
|
27540
|
+
if ('externalStyles' in meta && meta.externalStyles?.length) {
|
|
27541
|
+
const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal(externalStyle));
|
|
27542
|
+
features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
|
|
27543
|
+
}
|
|
27487
27544
|
if (features.length) {
|
|
27488
27545
|
definitionMap.set('features', literalArr(features));
|
|
27489
27546
|
}
|
|
@@ -27559,6 +27616,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
27559
27616
|
if (meta.encapsulation === null) {
|
|
27560
27617
|
meta.encapsulation = ViewEncapsulation.Emulated;
|
|
27561
27618
|
}
|
|
27619
|
+
let hasStyles = !!meta.externalStyles?.length;
|
|
27562
27620
|
// e.g. `styles: [str1, str2]`
|
|
27563
27621
|
if (meta.styles && meta.styles.length) {
|
|
27564
27622
|
const styleValues = meta.encapsulation == ViewEncapsulation.Emulated
|
|
@@ -27571,10 +27629,11 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
27571
27629
|
return result;
|
|
27572
27630
|
}, []);
|
|
27573
27631
|
if (styleNodes.length > 0) {
|
|
27632
|
+
hasStyles = true;
|
|
27574
27633
|
definitionMap.set('styles', literalArr(styleNodes));
|
|
27575
27634
|
}
|
|
27576
27635
|
}
|
|
27577
|
-
|
|
27636
|
+
if (!hasStyles && meta.encapsulation === ViewEncapsulation.Emulated) {
|
|
27578
27637
|
// If there is no style, don't generate css selectors on elements
|
|
27579
27638
|
meta.encapsulation = ViewEncapsulation.None;
|
|
27580
27639
|
}
|
|
@@ -28500,18 +28559,12 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
28500
28559
|
maybeMap(ast, name) {
|
|
28501
28560
|
// If the receiver of the expression isn't the `ImplicitReceiver`, this isn't the root of an
|
|
28502
28561
|
// `AST` expression that maps to a `Variable` or `Reference`.
|
|
28503
|
-
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
28562
|
+
if (!(ast.receiver instanceof ImplicitReceiver) || ast.receiver instanceof ThisReceiver) {
|
|
28504
28563
|
return;
|
|
28505
28564
|
}
|
|
28506
28565
|
// Check whether the name exists in the current scope. If so, map it. Otherwise, the name is
|
|
28507
28566
|
// probably a property on the top-level component context.
|
|
28508
28567
|
const target = this.scope.lookup(name);
|
|
28509
|
-
// It's not allowed to read template entities via `this`, however it previously worked by
|
|
28510
|
-
// accident (see #55115). Since `@let` declarations are new, we can fix it from the beginning,
|
|
28511
|
-
// whereas pre-existing template entities will be fixed in #55115.
|
|
28512
|
-
if (target instanceof LetDeclaration$1 && ast.receiver instanceof ThisReceiver) {
|
|
28513
|
-
return;
|
|
28514
|
-
}
|
|
28515
28568
|
if (target !== null) {
|
|
28516
28569
|
this.bindings.set(ast, target);
|
|
28517
28570
|
}
|
|
@@ -29368,7 +29421,7 @@ function publishFacade(global) {
|
|
|
29368
29421
|
* @description
|
|
29369
29422
|
* Entry point for all public APIs of the compiler package.
|
|
29370
29423
|
*/
|
|
29371
|
-
new Version('19.0.0-next.
|
|
29424
|
+
new Version('19.0.0-next.9');
|
|
29372
29425
|
|
|
29373
29426
|
var _VisitorMode;
|
|
29374
29427
|
(function (_VisitorMode) {
|
|
@@ -29432,7 +29485,7 @@ function lookupPropertyAccess(checker, type, path, options = {}) {
|
|
|
29432
29485
|
* that will be migrated to signal inputs.
|
|
29433
29486
|
*/
|
|
29434
29487
|
class TemplateReferenceVisitor extends RecursiveVisitor {
|
|
29435
|
-
constructor(typeChecker, templateTypeChecker, componentClass, knownFields) {
|
|
29488
|
+
constructor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
29436
29489
|
super();
|
|
29437
29490
|
this.result = [];
|
|
29438
29491
|
/**
|
|
@@ -29443,7 +29496,7 @@ class TemplateReferenceVisitor extends RecursiveVisitor {
|
|
|
29443
29496
|
*/
|
|
29444
29497
|
this.templateAttributeReferencedFields = null;
|
|
29445
29498
|
this.seenKnownFieldsCount = new Map();
|
|
29446
|
-
this.expressionVisitor = new TemplateExpressionReferenceVisitor(typeChecker, templateTypeChecker, componentClass, knownFields);
|
|
29499
|
+
this.expressionVisitor = new TemplateExpressionReferenceVisitor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
29447
29500
|
}
|
|
29448
29501
|
checkExpressionForReferencedFields(activeNode, expressionNode) {
|
|
29449
29502
|
const referencedFields = this.expressionVisitor.checkTemplateExpression(activeNode, expressionNode);
|
|
@@ -29559,15 +29612,17 @@ class TemplateReferenceVisitor extends RecursiveVisitor {
|
|
|
29559
29612
|
* that will be migrated to signal inputs.
|
|
29560
29613
|
*/
|
|
29561
29614
|
class TemplateExpressionReferenceVisitor extends RecursiveAstVisitor {
|
|
29562
|
-
constructor(typeChecker, templateTypeChecker, componentClass, knownFields) {
|
|
29615
|
+
constructor(typeChecker, templateTypeChecker, componentClass, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
29563
29616
|
super();
|
|
29564
29617
|
this.typeChecker = typeChecker;
|
|
29565
29618
|
this.templateTypeChecker = templateTypeChecker;
|
|
29566
29619
|
this.componentClass = componentClass;
|
|
29567
29620
|
this.knownFields = knownFields;
|
|
29621
|
+
this.fieldNamesToConsiderForReferenceLookup = fieldNamesToConsiderForReferenceLookup;
|
|
29568
29622
|
this.activeTmplAstNode = null;
|
|
29569
29623
|
this.detectedInputReferences = [];
|
|
29570
29624
|
this.isInsideObjectShorthandExpression = false;
|
|
29625
|
+
this.insideConditionalExpressionsWithReads = [];
|
|
29571
29626
|
}
|
|
29572
29627
|
/** Checks the given AST expression. */
|
|
29573
29628
|
checkTemplateExpression(activeNode, expressionNode) {
|
|
@@ -29601,11 +29656,22 @@ class TemplateExpressionReferenceVisitor extends RecursiveAstVisitor {
|
|
|
29601
29656
|
this._inspectPropertyAccess(ast, context);
|
|
29602
29657
|
super.visitPropertyWrite(ast, context);
|
|
29603
29658
|
}
|
|
29659
|
+
visitConditional(ast, context) {
|
|
29660
|
+
this.visit(ast.condition, context);
|
|
29661
|
+
this.insideConditionalExpressionsWithReads.push(ast.condition);
|
|
29662
|
+
this.visit(ast.trueExp, context);
|
|
29663
|
+
this.visit(ast.falseExp, context);
|
|
29664
|
+
this.insideConditionalExpressionsWithReads.pop();
|
|
29665
|
+
}
|
|
29604
29666
|
/**
|
|
29605
29667
|
* Inspects the property access and attempts to resolve whether they access
|
|
29606
29668
|
* a known field. If so, the result is captured.
|
|
29607
29669
|
*/
|
|
29608
29670
|
_inspectPropertyAccess(ast, astPath) {
|
|
29671
|
+
if (this.fieldNamesToConsiderForReferenceLookup !== null &&
|
|
29672
|
+
!this.fieldNamesToConsiderForReferenceLookup.has(ast.name)) {
|
|
29673
|
+
return;
|
|
29674
|
+
}
|
|
29609
29675
|
const isWrite = !!(ast instanceof PropertyWrite ||
|
|
29610
29676
|
(this.activeTmplAstNode && isTwoWayBindingNode(this.activeTmplAstNode)));
|
|
29611
29677
|
this._checkAccessViaTemplateTypeCheckBlock(ast, isWrite, astPath) ||
|
|
@@ -29637,7 +29703,7 @@ class TemplateExpressionReferenceVisitor extends RecursiveAstVisitor {
|
|
|
29637
29703
|
read: ast,
|
|
29638
29704
|
readAstPath: astPath,
|
|
29639
29705
|
context: this.activeTmplAstNode,
|
|
29640
|
-
isLikelyNarrowed:
|
|
29706
|
+
isLikelyNarrowed: this._isPartOfNarrowingTernary(ast),
|
|
29641
29707
|
isObjectShorthandExpression: this.isInsideObjectShorthandExpression,
|
|
29642
29708
|
isWrite,
|
|
29643
29709
|
});
|
|
@@ -29675,11 +29741,19 @@ class TemplateExpressionReferenceVisitor extends RecursiveAstVisitor {
|
|
|
29675
29741
|
read: ast,
|
|
29676
29742
|
readAstPath: astPath,
|
|
29677
29743
|
context: this.activeTmplAstNode,
|
|
29678
|
-
isLikelyNarrowed:
|
|
29744
|
+
isLikelyNarrowed: this._isPartOfNarrowingTernary(ast),
|
|
29679
29745
|
isObjectShorthandExpression: this.isInsideObjectShorthandExpression,
|
|
29680
29746
|
isWrite,
|
|
29681
29747
|
});
|
|
29682
29748
|
}
|
|
29749
|
+
_isPartOfNarrowingTernary(read) {
|
|
29750
|
+
// Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
|
|
29751
|
+
// as worst case we just skip an input from being migrated. This is very unlikely too.
|
|
29752
|
+
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof PropertyRead ||
|
|
29753
|
+
r instanceof PropertyWrite ||
|
|
29754
|
+
r instanceof SafePropertyRead) &&
|
|
29755
|
+
r.name === read.name);
|
|
29756
|
+
}
|
|
29683
29757
|
}
|
|
29684
29758
|
/**
|
|
29685
29759
|
* Emulates an access to a given field using the TypeScript `ts.Type`
|
|
@@ -29740,7 +29814,7 @@ function isTsClassTypeReference(ref) {
|
|
|
29740
29814
|
* Checks host bindings of the given class and tracks all
|
|
29741
29815
|
* references to inputs within bindings.
|
|
29742
29816
|
*/
|
|
29743
|
-
function identifyHostBindingReferences(node, programInfo, checker$1, reflector, result, knownFields) {
|
|
29817
|
+
function identifyHostBindingReferences(node, programInfo, checker$1, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
29744
29818
|
if (node.name === undefined) {
|
|
29745
29819
|
return;
|
|
29746
29820
|
}
|
|
@@ -29786,7 +29860,7 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
29786
29860
|
}
|
|
29787
29861
|
const hostMap = checker.reflectObjectLiteral(hostField);
|
|
29788
29862
|
const expressionResult = [];
|
|
29789
|
-
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker$1, null, node, knownFields);
|
|
29863
|
+
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker$1, null, node, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
29790
29864
|
for (const [rawName, expression] of hostMap.entries()) {
|
|
29791
29865
|
if (!ts__default["default"].isStringLiteralLike(expression)) {
|
|
29792
29866
|
continue;
|
|
@@ -29898,14 +29972,14 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
29898
29972
|
* Checks whether the given class has an Angular template, and resolves
|
|
29899
29973
|
* all of the references to inputs.
|
|
29900
29974
|
*/
|
|
29901
|
-
function identifyTemplateReferences(programInfo, node, reflector, checker$1, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields) {
|
|
29902
|
-
const template = templateTypeChecker.getTemplate(node) ??
|
|
29975
|
+
function identifyTemplateReferences(programInfo, node, reflector, checker$1, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
29976
|
+
const template = templateTypeChecker.getTemplate(node, checker.OptimizeFor.WholeProgram) ??
|
|
29903
29977
|
// If there is no template registered in the TCB or compiler, the template may
|
|
29904
29978
|
// be skipped due to an explicit `jit: true` setting. We try to detect this case
|
|
29905
29979
|
// and parse the template manually.
|
|
29906
29980
|
extractTemplateWithoutCompilerAnalysis(node, checker$1, reflector, resourceLoader, evaluator, options);
|
|
29907
29981
|
if (template !== null) {
|
|
29908
|
-
const visitor = new TemplateReferenceVisitor(checker$1, templateTypeChecker, node, knownFields);
|
|
29982
|
+
const visitor = new TemplateReferenceVisitor(checker$1, templateTypeChecker, node, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
29909
29983
|
template.forEach((node) => node.visit(visitor));
|
|
29910
29984
|
for (const res of visitor.result) {
|
|
29911
29985
|
const templateFilePath = res.context.sourceSpan.start.file.url;
|
|
@@ -29915,7 +29989,7 @@ function identifyTemplateReferences(programInfo, node, reflector, checker$1, eva
|
|
|
29915
29989
|
// as those cannot be migrated, but print an error for now.
|
|
29916
29990
|
if (templateFilePath === '') {
|
|
29917
29991
|
// TODO: Incorporate a TODO potentially.
|
|
29918
|
-
console.error(`Found reference to
|
|
29992
|
+
console.error(`Found reference to field ${res.targetField.key} that cannot be ` +
|
|
29919
29993
|
`migrated because the template cannot be parsed with source map information ` +
|
|
29920
29994
|
`(in file: ${node.getSourceFile().fileName}).`);
|
|
29921
29995
|
continue;
|
|
@@ -30100,8 +30174,10 @@ function identifyPotentialTypeScriptReference(node, programInfo, checker, knownF
|
|
|
30100
30174
|
if (targetInput === null) {
|
|
30101
30175
|
return;
|
|
30102
30176
|
}
|
|
30103
|
-
const
|
|
30177
|
+
const access = unwrapParent(traverseAccess(node));
|
|
30178
|
+
const accessParent = access.parent;
|
|
30104
30179
|
const isWriteReference = ts__default["default"].isBinaryExpression(accessParent) &&
|
|
30180
|
+
accessParent.left === access &&
|
|
30105
30181
|
writeBinaryOperators.includes(accessParent.operatorToken.kind);
|
|
30106
30182
|
// track accesses from source files to known fields.
|
|
30107
30183
|
result.references.push({
|
|
@@ -30144,10 +30220,10 @@ function createFindAllSourceFileReferencesVisitor(programInfo, checker, reflecto
|
|
|
30144
30220
|
const visitor = (node) => {
|
|
30145
30221
|
let lastTime = currentTimeInMs();
|
|
30146
30222
|
if (ts__default["default"].isClassDeclaration(node)) {
|
|
30147
|
-
identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, programInfo.userOptions, result, knownFields);
|
|
30223
|
+
identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, programInfo.userOptions, result, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
30148
30224
|
perfCounters.template += (currentTimeInMs() - lastTime) / 1000;
|
|
30149
30225
|
lastTime = currentTimeInMs();
|
|
30150
|
-
identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields);
|
|
30226
|
+
identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
30151
30227
|
perfCounters.hostBindings += (currentTimeInMs() - lastTime) / 1000;
|
|
30152
30228
|
lastTime = currentTimeInMs();
|
|
30153
30229
|
}
|
|
@@ -30351,6 +30427,7 @@ class GroupedTsAstVisitor {
|
|
|
30351
30427
|
for (const doneFn of this.doneFns) {
|
|
30352
30428
|
doneFn();
|
|
30353
30429
|
}
|
|
30430
|
+
this.visitors = [];
|
|
30354
30431
|
}
|
|
30355
30432
|
}
|
|
30356
30433
|
|
|
@@ -30509,6 +30586,8 @@ function isNodeDescendantOf(node, ancestor) {
|
|
|
30509
30586
|
return false;
|
|
30510
30587
|
}
|
|
30511
30588
|
|
|
30589
|
+
/** Symbol that can be used to mark a variable as reserved, synthetically. */
|
|
30590
|
+
const ReservedMarker = Symbol();
|
|
30512
30591
|
/**
|
|
30513
30592
|
* Gets whether the given identifier name is free for use in the
|
|
30514
30593
|
* given location, avoiding shadowed variable names.
|
|
@@ -30554,8 +30633,8 @@ function isIdentifierFreeInContainer(name, container) {
|
|
|
30554
30633
|
// Note: This check is similar to the check by the TypeScript emitter.
|
|
30555
30634
|
// typescript/stable/src/compiler/emitter.ts;l=5436;rcl=651008033
|
|
30556
30635
|
const local = container.locals.get(name);
|
|
30557
|
-
return
|
|
30558
|
-
(ts__default["default"].SymbolFlags.Value | ts__default["default"].SymbolFlags.ExportValue | ts__default["default"].SymbolFlags.Alias));
|
|
30636
|
+
return (local !== ReservedMarker &&
|
|
30637
|
+
!(local.flags & (ts__default["default"].SymbolFlags.Value | ts__default["default"].SymbolFlags.ExportValue | ts__default["default"].SymbolFlags.Alias)));
|
|
30559
30638
|
}
|
|
30560
30639
|
/**
|
|
30561
30640
|
* Whether the given node can contain local variables.
|
|
@@ -30619,7 +30698,8 @@ class UniqueNamesGenerator {
|
|
|
30619
30698
|
return false;
|
|
30620
30699
|
}
|
|
30621
30700
|
// Claim the locals to avoid conflicts with future generations.
|
|
30622
|
-
freeInfo.container.locals
|
|
30701
|
+
freeInfo.container.locals ??= new Map();
|
|
30702
|
+
freeInfo.container.locals.set(name, ReservedMarker);
|
|
30623
30703
|
return true;
|
|
30624
30704
|
};
|
|
30625
30705
|
// Check the base name. Ideally, we'd use this one.
|
|
@@ -31261,6 +31341,52 @@ function migrateTypeScriptReferences(host, references, checker, info) {
|
|
|
31261
31341
|
migrateStandardTsReference(tsReferencesWithNarrowing, checker, info, host.replacements);
|
|
31262
31342
|
}
|
|
31263
31343
|
|
|
31344
|
+
/**
|
|
31345
|
+
* Migrates TypeScript "ts.Type" references. E.g.
|
|
31346
|
+
|
|
31347
|
+
* - `Partial<MyComp>` will be converted to `UnwrapSignalInputs<Partial<MyComp>>`.
|
|
31348
|
+
in Catalyst test files.
|
|
31349
|
+
*/
|
|
31350
|
+
function migrateTypeScriptTypeReferences(host, references, importManager, info) {
|
|
31351
|
+
const seenTypeNodes = new WeakSet();
|
|
31352
|
+
for (const reference of references) {
|
|
31353
|
+
// This pass only deals with TS input class type references.
|
|
31354
|
+
if (!isTsClassTypeReference(reference)) {
|
|
31355
|
+
continue;
|
|
31356
|
+
}
|
|
31357
|
+
// Skip references to classes that are not fully migrated.
|
|
31358
|
+
if (!host.shouldMigrateReferencesToClass(reference.target)) {
|
|
31359
|
+
continue;
|
|
31360
|
+
}
|
|
31361
|
+
// Skip duplicate references. E.g. in batching.
|
|
31362
|
+
if (seenTypeNodes.has(reference.from.node)) {
|
|
31363
|
+
continue;
|
|
31364
|
+
}
|
|
31365
|
+
seenTypeNodes.add(reference.from.node);
|
|
31366
|
+
if (reference.isPartialReference && reference.isPartOfCatalystFile) {
|
|
31367
|
+
assert__default["default"](reference.from.node.typeArguments, 'Expected type arguments for partial reference.');
|
|
31368
|
+
assert__default["default"](reference.from.node.typeArguments.length === 1, 'Expected an argument for reference.');
|
|
31369
|
+
const firstArg = reference.from.node.typeArguments[0];
|
|
31370
|
+
const sf = firstArg.getSourceFile();
|
|
31371
|
+
// Naive detection of the import. Sufficient for this test file migration.
|
|
31372
|
+
const catalystImport = sf.text.includes('google3/javascript/angular2/testing/catalyst/fake_async')
|
|
31373
|
+
? 'google3/javascript/angular2/testing/catalyst/fake_async'
|
|
31374
|
+
: 'google3/javascript/angular2/testing/catalyst/async';
|
|
31375
|
+
const unwrapImportExpr = importManager.addImport({
|
|
31376
|
+
exportModuleSpecifier: catalystImport,
|
|
31377
|
+
exportSymbolName: 'UnwrapSignalInputs',
|
|
31378
|
+
requestedFile: sf,
|
|
31379
|
+
});
|
|
31380
|
+
host.replacements.push(new Replacement(projectFile(sf, info), new TextUpdate({
|
|
31381
|
+
position: firstArg.getStart(),
|
|
31382
|
+
end: firstArg.getStart(),
|
|
31383
|
+
toInsert: `${host.printer.printNode(ts__default["default"].EmitHint.Unspecified, unwrapImportExpr, sf)}<`,
|
|
31384
|
+
})));
|
|
31385
|
+
host.replacements.push(new Replacement(projectFile(sf, info), new TextUpdate({ position: firstArg.getEnd(), end: firstArg.getEnd(), toInsert: '>' })));
|
|
31386
|
+
}
|
|
31387
|
+
}
|
|
31388
|
+
}
|
|
31389
|
+
|
|
31264
31390
|
/**
|
|
31265
31391
|
* Angular compiler file system implementation that leverages an
|
|
31266
31392
|
* CLI schematic virtual file tree.
|
|
@@ -31288,7 +31414,7 @@ class DevkitMigrationFilesystem {
|
|
|
31288
31414
|
return this.normalize(core.relative(from, to));
|
|
31289
31415
|
}
|
|
31290
31416
|
basename(filePath, extension) {
|
|
31291
|
-
return
|
|
31417
|
+
return posixPath__namespace.basename(filePath, extension);
|
|
31292
31418
|
}
|
|
31293
31419
|
normalize(path) {
|
|
31294
31420
|
return core.normalize(path);
|
|
@@ -31297,7 +31423,7 @@ class DevkitMigrationFilesystem {
|
|
|
31297
31423
|
const normalizedPaths = paths.map((p) => core.normalize(p));
|
|
31298
31424
|
// In dev-kit, the NodeJS working directory should never be
|
|
31299
31425
|
// considered, so `/` is the last resort over `cwd`.
|
|
31300
|
-
return this.normalize(
|
|
31426
|
+
return this.normalize(posixPath__namespace.resolve(core.normalize('/'), ...normalizedPaths));
|
|
31301
31427
|
}
|
|
31302
31428
|
pwd() {
|
|
31303
31429
|
return '/';
|
|
@@ -31432,14 +31558,14 @@ exports.confirmAsSerializable = confirmAsSerializable;
|
|
|
31432
31558
|
exports.createFindAllSourceFileReferencesVisitor = createFindAllSourceFileReferencesVisitor;
|
|
31433
31559
|
exports.createNgtscProgram = createNgtscProgram;
|
|
31434
31560
|
exports.groupReplacementsByFile = groupReplacementsByFile;
|
|
31561
|
+
exports.isFieldIncompatibility = isFieldIncompatibility;
|
|
31435
31562
|
exports.isHostBindingReference = isHostBindingReference;
|
|
31436
31563
|
exports.isInputContainerNode = isInputContainerNode;
|
|
31437
|
-
exports.isInputMemberIncompatibility = isInputMemberIncompatibility;
|
|
31438
31564
|
exports.isTemplateReference = isTemplateReference;
|
|
31439
|
-
exports.isTsClassTypeReference = isTsClassTypeReference;
|
|
31440
31565
|
exports.isTsReference = isTsReference;
|
|
31441
31566
|
exports.migrateTypeScriptReferences = migrateTypeScriptReferences;
|
|
31442
|
-
exports.
|
|
31567
|
+
exports.migrateTypeScriptTypeReferences = migrateTypeScriptTypeReferences;
|
|
31568
|
+
exports.pickFieldIncompatibility = pickFieldIncompatibility;
|
|
31443
31569
|
exports.projectFile = projectFile;
|
|
31444
31570
|
exports.removeFromUnionIfPossible = removeFromUnionIfPossible;
|
|
31445
31571
|
exports.traverseAccess = traverseAccess;
|