@angular/language-service 13.1.0-next.2 → 13.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/language-service.js +141 -190
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v13.1.0-next.
|
|
2
|
+
* @license Angular v13.1.0-next.3
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -27,7 +27,7 @@ module.exports = function(provided) {
|
|
|
27
27
|
return results;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', 'module', 'path', 'url'], (function (exports, ts$1, os, ts, fs$1, module,
|
|
30
|
+
define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', 'module', 'path', 'url'], (function (exports, ts$1, os, ts, fs$1, module, p, url) { 'use strict';
|
|
31
31
|
|
|
32
32
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
33
33
|
|
|
@@ -53,7 +53,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
53
53
|
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
54
54
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs$1);
|
|
55
55
|
var module__default = /*#__PURE__*/_interopDefaultLegacy(module);
|
|
56
|
-
var
|
|
56
|
+
var p__namespace = /*#__PURE__*/_interopNamespace(p);
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* The default `FileSystem` that will always fail.
|
|
@@ -342,28 +342,28 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
342
342
|
process.chdir(dir);
|
|
343
343
|
}
|
|
344
344
|
resolve(...paths) {
|
|
345
|
-
return this.normalize(
|
|
345
|
+
return this.normalize(p__namespace.resolve(...paths));
|
|
346
346
|
}
|
|
347
347
|
dirname(file) {
|
|
348
|
-
return this.normalize(
|
|
348
|
+
return this.normalize(p__namespace.dirname(file));
|
|
349
349
|
}
|
|
350
350
|
join(basePath, ...paths) {
|
|
351
|
-
return this.normalize(
|
|
351
|
+
return this.normalize(p__namespace.join(basePath, ...paths));
|
|
352
352
|
}
|
|
353
353
|
isRoot(path) {
|
|
354
354
|
return this.dirname(path) === this.normalize(path);
|
|
355
355
|
}
|
|
356
356
|
isRooted(path) {
|
|
357
|
-
return
|
|
357
|
+
return p__namespace.isAbsolute(path);
|
|
358
358
|
}
|
|
359
359
|
relative(from, to) {
|
|
360
|
-
return this.normalize(
|
|
360
|
+
return this.normalize(p__namespace.relative(from, to));
|
|
361
361
|
}
|
|
362
362
|
basename(filePath, extension) {
|
|
363
|
-
return
|
|
363
|
+
return p__namespace.basename(filePath, extension);
|
|
364
364
|
}
|
|
365
365
|
extname(path) {
|
|
366
|
-
return
|
|
366
|
+
return p__namespace.extname(path);
|
|
367
367
|
}
|
|
368
368
|
normalize(path) {
|
|
369
369
|
// Convert backslashes to forward slashes
|
|
@@ -20077,7 +20077,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20077
20077
|
* Use of this source code is governed by an MIT-style license that can be
|
|
20078
20078
|
* found in the LICENSE file at https://angular.io/license
|
|
20079
20079
|
*/
|
|
20080
|
-
new Version('13.1.0-next.
|
|
20080
|
+
new Version('13.1.0-next.3');
|
|
20081
20081
|
|
|
20082
20082
|
/**
|
|
20083
20083
|
* @license
|
|
@@ -20706,7 +20706,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20706
20706
|
function compileDeclareClassMetadata(metadata) {
|
|
20707
20707
|
const definitionMap = new DefinitionMap();
|
|
20708
20708
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
20709
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
20709
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
20710
20710
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
20711
20711
|
definitionMap.set('type', metadata.type);
|
|
20712
20712
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -20823,7 +20823,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
20823
20823
|
function createDirectiveDefinitionMap(meta) {
|
|
20824
20824
|
const definitionMap = new DefinitionMap();
|
|
20825
20825
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
20826
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
20826
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
20827
20827
|
// e.g. `type: MyDirective`
|
|
20828
20828
|
definitionMap.set('type', meta.internalType);
|
|
20829
20829
|
// e.g. `selector: 'some-dir'`
|
|
@@ -21041,7 +21041,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21041
21041
|
function compileDeclareFactoryFunction(meta) {
|
|
21042
21042
|
const definitionMap = new DefinitionMap();
|
|
21043
21043
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
21044
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
21044
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21045
21045
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21046
21046
|
definitionMap.set('type', meta.internalType);
|
|
21047
21047
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -21083,7 +21083,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21083
21083
|
function createInjectableDefinitionMap(meta) {
|
|
21084
21084
|
const definitionMap = new DefinitionMap();
|
|
21085
21085
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
21086
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
21086
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21087
21087
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21088
21088
|
definitionMap.set('type', meta.internalType);
|
|
21089
21089
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -21141,7 +21141,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21141
21141
|
function createInjectorDefinitionMap(meta) {
|
|
21142
21142
|
const definitionMap = new DefinitionMap();
|
|
21143
21143
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
21144
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
21144
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21145
21145
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21146
21146
|
definitionMap.set('type', meta.internalType);
|
|
21147
21147
|
definitionMap.set('providers', meta.providers);
|
|
@@ -21178,7 +21178,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21178
21178
|
function createNgModuleDefinitionMap(meta) {
|
|
21179
21179
|
const definitionMap = new DefinitionMap();
|
|
21180
21180
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
21181
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
21181
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21182
21182
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21183
21183
|
definitionMap.set('type', meta.internalType);
|
|
21184
21184
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -21236,7 +21236,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21236
21236
|
function createPipeDefinitionMap(meta) {
|
|
21237
21237
|
const definitionMap = new DefinitionMap();
|
|
21238
21238
|
definitionMap.set('minVersion', literal$1(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
21239
|
-
definitionMap.set('version', literal$1('13.1.0-next.
|
|
21239
|
+
definitionMap.set('version', literal$1('13.1.0-next.3'));
|
|
21240
21240
|
definitionMap.set('ngImport', importExpr(Identifiers$1.core));
|
|
21241
21241
|
// e.g. `type: MyPipe`
|
|
21242
21242
|
definitionMap.set('type', meta.internalType);
|
|
@@ -21268,18 +21268,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21268
21268
|
* Use of this source code is governed by an MIT-style license that can be
|
|
21269
21269
|
* found in the LICENSE file at https://angular.io/license
|
|
21270
21270
|
*/
|
|
21271
|
-
new Version('13.1.0-next.
|
|
21272
|
-
|
|
21273
|
-
/**
|
|
21274
|
-
* @license
|
|
21275
|
-
* Copyright Google LLC All Rights Reserved.
|
|
21276
|
-
*
|
|
21277
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
21278
|
-
* found in the LICENSE file at https://angular.io/license
|
|
21279
|
-
*/
|
|
21280
|
-
// In TypeScript 2.1 the spread element kind was renamed.
|
|
21281
|
-
ts__default["default"].SyntaxKind.SpreadElement || ts__default["default"].SyntaxKind.SpreadElementExpression;
|
|
21282
|
-
ts__default["default"].createNodeArray();
|
|
21271
|
+
new Version('13.1.0-next.3');
|
|
21283
21272
|
|
|
21284
21273
|
/**
|
|
21285
21274
|
* @license
|
|
@@ -21300,6 +21289,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21300
21289
|
EmitFlags[EmitFlags["All"] = 31] = "All";
|
|
21301
21290
|
})(EmitFlags || (EmitFlags = {}));
|
|
21302
21291
|
|
|
21292
|
+
/**
|
|
21293
|
+
* @license
|
|
21294
|
+
* Copyright Google LLC All Rights Reserved.
|
|
21295
|
+
*
|
|
21296
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
21297
|
+
* found in the LICENSE file at https://angular.io/license
|
|
21298
|
+
*/
|
|
21299
|
+
/**
|
|
21300
|
+
* The currently used version of TypeScript, which can be adjusted for testing purposes using
|
|
21301
|
+
* `setTypeScriptVersionForTesting` and `restoreTypeScriptVersionForTesting` below.
|
|
21302
|
+
*/
|
|
21303
|
+
ts__default["default"].version;
|
|
21304
|
+
|
|
21303
21305
|
/**
|
|
21304
21306
|
* @license
|
|
21305
21307
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -21596,6 +21598,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21596
21598
|
* found in the LICENSE file at https://angular.io/license
|
|
21597
21599
|
*/
|
|
21598
21600
|
const D_TS = /\.d\.ts$/i;
|
|
21601
|
+
const PARSED_TS_VERSION = parseFloat(ts__default["default"].versionMajorMinor);
|
|
21599
21602
|
function isSymbolWithValueDeclaration(symbol) {
|
|
21600
21603
|
// If there is a value declaration set, then the `declarations` property is never undefined. We
|
|
21601
21604
|
// still check for the property to exist as this matches with the type that `symbol` is narrowed
|
|
@@ -21709,6 +21712,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
21709
21712
|
}
|
|
21710
21713
|
return redirectInfo.unredirected;
|
|
21711
21714
|
}
|
|
21715
|
+
/**
|
|
21716
|
+
* Backwards-compatible version of `ts.createExportSpecifier`
|
|
21717
|
+
* to handle a breaking change between 4.4 and 4.5.
|
|
21718
|
+
*/
|
|
21719
|
+
function createExportSpecifier(propertyName, name, isTypeOnly = false) {
|
|
21720
|
+
return PARSED_TS_VERSION > 4.4 ?
|
|
21721
|
+
// TODO(crisbeto): the function is cast to `any` here since g3 is still on TS 4.4.
|
|
21722
|
+
// Should be cleaned up when g3 has been updated.
|
|
21723
|
+
ts__default["default"].createExportSpecifier(isTypeOnly, propertyName, name) :
|
|
21724
|
+
// TODO(crisbeto): backwards-compatibility layer for TS 4.4.
|
|
21725
|
+
// Should be cleaned up when we drop support for it.
|
|
21726
|
+
ts__default["default"].createExportSpecifier(propertyName, name);
|
|
21727
|
+
}
|
|
21712
21728
|
|
|
21713
21729
|
/**
|
|
21714
21730
|
* @license
|
|
@@ -23040,8 +23056,15 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
23040
23056
|
// import {Foo} from 'foo';
|
|
23041
23057
|
// or
|
|
23042
23058
|
// import {Foo as Bar} from 'foo';
|
|
23059
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
23060
|
+
// Should be cleaned up when g3 has been updated.
|
|
23061
|
+
if (firstDecl.isTypeOnly) {
|
|
23062
|
+
// The import specifier can't be type-only (e.g. `import {type Foo} from '...')`.
|
|
23063
|
+
return typeOnlyImport(typeNode, firstDecl);
|
|
23064
|
+
}
|
|
23043
23065
|
if (firstDecl.parent.parent.isTypeOnly) {
|
|
23044
|
-
//
|
|
23066
|
+
// The import specifier can't be inside a type-only import clause
|
|
23067
|
+
// (e.g. `import type {Foo} from '...')`.
|
|
23045
23068
|
return typeOnlyImport(typeNode, firstDecl.parent.parent);
|
|
23046
23069
|
}
|
|
23047
23070
|
// Determine the name to import (`Foo`) from the import specifier, as the symbol names of
|
|
@@ -23109,10 +23132,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
23109
23132
|
reason: { kind: 1 /* NO_VALUE_DECLARATION */, typeNode, decl },
|
|
23110
23133
|
};
|
|
23111
23134
|
}
|
|
23112
|
-
function typeOnlyImport(typeNode,
|
|
23135
|
+
function typeOnlyImport(typeNode, node) {
|
|
23113
23136
|
return {
|
|
23114
23137
|
kind: 2 /* UNAVAILABLE */,
|
|
23115
|
-
reason: { kind: 2 /* TYPE_ONLY_IMPORT */, typeNode,
|
|
23138
|
+
reason: { kind: 2 /* TYPE_ONLY_IMPORT */, typeNode, node },
|
|
23116
23139
|
};
|
|
23117
23140
|
}
|
|
23118
23141
|
function unknownReference(typeNode) {
|
|
@@ -24896,6 +24919,28 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
24896
24919
|
return result;
|
|
24897
24920
|
}
|
|
24898
24921
|
}
|
|
24922
|
+
class StringConcatBuiltinFn extends KnownFn {
|
|
24923
|
+
constructor(lhs) {
|
|
24924
|
+
super();
|
|
24925
|
+
this.lhs = lhs;
|
|
24926
|
+
}
|
|
24927
|
+
evaluate(node, args) {
|
|
24928
|
+
let result = this.lhs;
|
|
24929
|
+
for (const arg of args) {
|
|
24930
|
+
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
24931
|
+
if (typeof resolved === 'string' || typeof resolved === 'number' ||
|
|
24932
|
+
typeof resolved === 'boolean' || resolved == null) {
|
|
24933
|
+
// Cast to `any`, because `concat` will convert
|
|
24934
|
+
// anything to a string, but TS only allows strings.
|
|
24935
|
+
result = result.concat(resolved);
|
|
24936
|
+
}
|
|
24937
|
+
else {
|
|
24938
|
+
return DynamicValue.fromUnknown(node);
|
|
24939
|
+
}
|
|
24940
|
+
}
|
|
24941
|
+
return result;
|
|
24942
|
+
}
|
|
24943
|
+
}
|
|
24899
24944
|
class ObjectAssignBuiltinFn extends KnownFn {
|
|
24900
24945
|
evaluate(node, args) {
|
|
24901
24946
|
if (args.length === 0) {
|
|
@@ -25401,6 +25446,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
25401
25446
|
}
|
|
25402
25447
|
return lhs[rhs];
|
|
25403
25448
|
}
|
|
25449
|
+
else if (typeof lhs === 'string' && rhs === 'concat') {
|
|
25450
|
+
return new StringConcatBuiltinFn(lhs);
|
|
25451
|
+
}
|
|
25404
25452
|
else if (lhs instanceof Reference) {
|
|
25405
25453
|
const ref = lhs.node;
|
|
25406
25454
|
if (this.host.isClass(ref)) {
|
|
@@ -26268,9 +26316,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
26268
26316
|
const stmt = ts__default["default"].createExportDeclaration(
|
|
26269
26317
|
/* decorators */ undefined,
|
|
26270
26318
|
/* modifiers */ undefined,
|
|
26271
|
-
/* exportClause */ ts__default["default"].createNamedExports([
|
|
26272
|
-
/* propertyName */ symbolName,
|
|
26273
|
-
/* name */ aliasName)]),
|
|
26319
|
+
/* exportClause */ ts__default["default"].createNamedExports([createExportSpecifier(symbolName, aliasName)]),
|
|
26274
26320
|
/* moduleSpecifier */ ts__default["default"].createStringLiteral(moduleName));
|
|
26275
26321
|
statements.push(stmt);
|
|
26276
26322
|
});
|
|
@@ -28512,7 +28558,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
|
|
|
28512
28558
|
'Consider changing the type-only import to a regular import, or use the @Inject decorator to specify an injection token.';
|
|
28513
28559
|
hints = [
|
|
28514
28560
|
makeRelatedInformation(reason.typeNode, 'This type is imported using a type-only import, which prevents it from being usable as an injection token.'),
|
|
28515
|
-
makeRelatedInformation(reason.
|
|
28561
|
+
makeRelatedInformation(reason.node, 'The type-only import occurs here.'),
|
|
28516
28562
|
];
|
|
28517
28563
|
break;
|
|
28518
28564
|
case 4 /* NAMESPACE */:
|
|
@@ -32107,7 +32153,7 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
32107
32153
|
continue;
|
|
32108
32154
|
}
|
|
32109
32155
|
if (ts__default["default"].isImportDeclaration(stmt) && stmt.importClause !== undefined &&
|
|
32110
|
-
stmt.importClause
|
|
32156
|
+
isTypeOnlyImportClause(stmt.importClause)) {
|
|
32111
32157
|
// Exclude type-only imports as they are always elided, so they don't contribute to
|
|
32112
32158
|
// cycles.
|
|
32113
32159
|
continue;
|
|
@@ -32130,6 +32176,20 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
32130
32176
|
function isLocalFile(sf) {
|
|
32131
32177
|
return !sf.isDeclarationFile;
|
|
32132
32178
|
}
|
|
32179
|
+
function isTypeOnlyImportClause(node) {
|
|
32180
|
+
// The clause itself is type-only (e.g. `import type {foo} from '...'`).
|
|
32181
|
+
if (node.isTypeOnly) {
|
|
32182
|
+
return true;
|
|
32183
|
+
}
|
|
32184
|
+
// All the specifiers in the cause are type-only (e.g. `import {type a, type b} from '...'`).
|
|
32185
|
+
if (node.namedBindings !== undefined && ts__default["default"].isNamedImports(node.namedBindings) &&
|
|
32186
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
32187
|
+
// Should be cleaned up when g3 has been updated.
|
|
32188
|
+
node.namedBindings.elements.every(specifier => specifier.isTypeOnly)) {
|
|
32189
|
+
return true;
|
|
32190
|
+
}
|
|
32191
|
+
return false;
|
|
32192
|
+
}
|
|
32133
32193
|
/**
|
|
32134
32194
|
* A helper class to track which SourceFiles are being processed when searching for a path in
|
|
32135
32195
|
* `getPath()` above.
|
|
@@ -32450,7 +32510,9 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
32450
32510
|
// Update the import path to point to the correct file using the ImportRewriter.
|
|
32451
32511
|
const rewrittenModuleSpecifier = importRewriter.rewriteSpecifier('@angular/core', sourceFilePath);
|
|
32452
32512
|
if (rewrittenModuleSpecifier !== stmt.moduleSpecifier.text) {
|
|
32453
|
-
|
|
32513
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
32514
|
+
// Should be cleaned up when g3 has been updated.
|
|
32515
|
+
transformedStatements.push(ts__default["default"].updateImportDeclaration(stmt, stmt.decorators, stmt.modifiers, stmt.importClause, ts__default["default"].createStringLiteral(rewrittenModuleSpecifier), undefined));
|
|
32454
32516
|
// Record the identifier by which this imported module goes, so references to its symbols
|
|
32455
32517
|
// can be discovered later.
|
|
32456
32518
|
if (stmt.importClause !== undefined && stmt.importClause.namedBindings !== undefined &&
|
|
@@ -33622,6 +33684,8 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
33622
33684
|
* marker and does not go to the filesystem for these requests, as they are known not to exist.
|
|
33623
33685
|
*/
|
|
33624
33686
|
function createLookupResolutionHost(adapter) {
|
|
33687
|
+
// TODO(crisbeto): the cast to `any` is here since g3 is still on TS 4.4.
|
|
33688
|
+
// Should be cleaned up when g3 has been updated.
|
|
33625
33689
|
return {
|
|
33626
33690
|
directoryExists(directoryName) {
|
|
33627
33691
|
if (directoryName.includes(RESOURCE_MARKER)) {
|
|
@@ -33649,6 +33713,9 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
33649
33713
|
getDirectories: adapter.getDirectories?.bind(adapter),
|
|
33650
33714
|
realpath: adapter.realpath?.bind(adapter),
|
|
33651
33715
|
trace: adapter.trace?.bind(adapter),
|
|
33716
|
+
useCaseSensitiveFileNames: typeof adapter.useCaseSensitiveFileNames === 'function' ?
|
|
33717
|
+
adapter.useCaseSensitiveFileNames.bind(adapter) :
|
|
33718
|
+
adapter.useCaseSensitiveFileNames
|
|
33652
33719
|
};
|
|
33653
33720
|
}
|
|
33654
33721
|
|
|
@@ -34396,120 +34463,6 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
34396
34463
|
}
|
|
34397
34464
|
}
|
|
34398
34465
|
|
|
34399
|
-
/**
|
|
34400
|
-
* @license
|
|
34401
|
-
* Copyright Google LLC All Rights Reserved.
|
|
34402
|
-
*
|
|
34403
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
34404
|
-
* found in the LICENSE file at https://angular.io/license
|
|
34405
|
-
*/
|
|
34406
|
-
const IVY_SWITCH_PRE_SUFFIX = '__PRE_R3__';
|
|
34407
|
-
const IVY_SWITCH_POST_SUFFIX = '__POST_R3__';
|
|
34408
|
-
function ivySwitchTransform(_) {
|
|
34409
|
-
return flipIvySwitchInFile;
|
|
34410
|
-
}
|
|
34411
|
-
function flipIvySwitchInFile(sf) {
|
|
34412
|
-
// To replace the statements array, it must be copied. This only needs to happen if a statement
|
|
34413
|
-
// must actually be replaced within the array, so the newStatements array is lazily initialized.
|
|
34414
|
-
let newStatements = undefined;
|
|
34415
|
-
// Iterate over the statements in the file.
|
|
34416
|
-
for (let i = 0; i < sf.statements.length; i++) {
|
|
34417
|
-
const statement = sf.statements[i];
|
|
34418
|
-
// Skip over everything that isn't a variable statement.
|
|
34419
|
-
if (!ts__default["default"].isVariableStatement(statement) || !hasIvySwitches(statement)) {
|
|
34420
|
-
continue;
|
|
34421
|
-
}
|
|
34422
|
-
// This statement needs to be replaced. Check if the newStatements array needs to be lazily
|
|
34423
|
-
// initialized to a copy of the original statements.
|
|
34424
|
-
if (newStatements === undefined) {
|
|
34425
|
-
newStatements = [...sf.statements];
|
|
34426
|
-
}
|
|
34427
|
-
// Flip any switches in the VariableStatement. If there were any, a new statement will be
|
|
34428
|
-
// returned; otherwise the old statement will be.
|
|
34429
|
-
newStatements[i] = flipIvySwitchesInVariableStatement(statement, sf.statements);
|
|
34430
|
-
}
|
|
34431
|
-
// Only update the statements in the SourceFile if any have changed.
|
|
34432
|
-
if (newStatements !== undefined) {
|
|
34433
|
-
return ts__default["default"].updateSourceFileNode(sf, newStatements);
|
|
34434
|
-
}
|
|
34435
|
-
return sf;
|
|
34436
|
-
}
|
|
34437
|
-
/**
|
|
34438
|
-
* Look for the ts.Identifier of a ts.Declaration with this name.
|
|
34439
|
-
*
|
|
34440
|
-
* The real identifier is needed (rather than fabricating one) as TypeScript decides how to
|
|
34441
|
-
* reference this identifier based on information stored against its node in the AST, which a
|
|
34442
|
-
* synthetic node would not have. In particular, since the post-switch variable is often exported,
|
|
34443
|
-
* TypeScript needs to know this so it can write `exports.VAR` instead of just `VAR` when emitting
|
|
34444
|
-
* code.
|
|
34445
|
-
*
|
|
34446
|
-
* Only variable, function, and class declarations are currently searched.
|
|
34447
|
-
*/
|
|
34448
|
-
function findPostSwitchIdentifier(statements, name) {
|
|
34449
|
-
for (const stmt of statements) {
|
|
34450
|
-
if (ts__default["default"].isVariableStatement(stmt)) {
|
|
34451
|
-
const decl = stmt.declarationList.declarations.find(decl => ts__default["default"].isIdentifier(decl.name) && decl.name.text === name);
|
|
34452
|
-
if (decl !== undefined) {
|
|
34453
|
-
return decl.name;
|
|
34454
|
-
}
|
|
34455
|
-
}
|
|
34456
|
-
else if (ts__default["default"].isFunctionDeclaration(stmt) || ts__default["default"].isClassDeclaration(stmt)) {
|
|
34457
|
-
if (stmt.name !== undefined && ts__default["default"].isIdentifier(stmt.name) && stmt.name.text === name) {
|
|
34458
|
-
return stmt.name;
|
|
34459
|
-
}
|
|
34460
|
-
}
|
|
34461
|
-
}
|
|
34462
|
-
return null;
|
|
34463
|
-
}
|
|
34464
|
-
/**
|
|
34465
|
-
* Flip any Ivy switches which are discovered in the given ts.VariableStatement.
|
|
34466
|
-
*/
|
|
34467
|
-
function flipIvySwitchesInVariableStatement(stmt, statements) {
|
|
34468
|
-
// Build a new list of variable declarations. Specific declarations that are initialized to a
|
|
34469
|
-
// pre-switch identifier will be replaced with a declaration initialized to the post-switch
|
|
34470
|
-
// identifier.
|
|
34471
|
-
const newDeclarations = [...stmt.declarationList.declarations];
|
|
34472
|
-
for (let i = 0; i < newDeclarations.length; i++) {
|
|
34473
|
-
const decl = newDeclarations[i];
|
|
34474
|
-
// Skip declarations that aren't initialized to an identifier.
|
|
34475
|
-
if (decl.initializer === undefined || !ts__default["default"].isIdentifier(decl.initializer)) {
|
|
34476
|
-
continue;
|
|
34477
|
-
}
|
|
34478
|
-
// Skip declarations that aren't Ivy switches.
|
|
34479
|
-
if (!decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX)) {
|
|
34480
|
-
continue;
|
|
34481
|
-
}
|
|
34482
|
-
// Determine the name of the post-switch variable.
|
|
34483
|
-
const postSwitchName = decl.initializer.text.replace(IVY_SWITCH_PRE_SUFFIX, IVY_SWITCH_POST_SUFFIX);
|
|
34484
|
-
// Find the post-switch variable identifier. If one can't be found, it's an error. This is
|
|
34485
|
-
// reported as a thrown error and not a diagnostic as transformers cannot output diagnostics.
|
|
34486
|
-
const newIdentifier = findPostSwitchIdentifier(statements, postSwitchName);
|
|
34487
|
-
if (newIdentifier === null) {
|
|
34488
|
-
throw new Error(`Unable to find identifier ${postSwitchName} in ${stmt.getSourceFile().fileName} for the Ivy switch.`);
|
|
34489
|
-
}
|
|
34490
|
-
newDeclarations[i] = ts__default["default"].updateVariableDeclaration(
|
|
34491
|
-
/* node */ decl,
|
|
34492
|
-
/* name */ decl.name,
|
|
34493
|
-
/* type */ decl.type,
|
|
34494
|
-
/* initializer */ newIdentifier);
|
|
34495
|
-
}
|
|
34496
|
-
const newDeclList = ts__default["default"].updateVariableDeclarationList(
|
|
34497
|
-
/* declarationList */ stmt.declarationList,
|
|
34498
|
-
/* declarations */ newDeclarations);
|
|
34499
|
-
const newStmt = ts__default["default"].updateVariableStatement(
|
|
34500
|
-
/* statement */ stmt,
|
|
34501
|
-
/* modifiers */ stmt.modifiers,
|
|
34502
|
-
/* declarationList */ newDeclList);
|
|
34503
|
-
return newStmt;
|
|
34504
|
-
}
|
|
34505
|
-
/**
|
|
34506
|
-
* Check whether the given VariableStatement has any Ivy switch variables.
|
|
34507
|
-
*/
|
|
34508
|
-
function hasIvySwitches(stmt) {
|
|
34509
|
-
return stmt.declarationList.declarations.some(decl => decl.initializer !== undefined && ts__default["default"].isIdentifier(decl.initializer) &&
|
|
34510
|
-
decl.initializer.text.endsWith(IVY_SWITCH_PRE_SUFFIX));
|
|
34511
|
-
}
|
|
34512
|
-
|
|
34513
34466
|
/**
|
|
34514
34467
|
* @license
|
|
34515
34468
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -40723,7 +40676,6 @@ Either add the @Injectable() decorator to '${provider.node.name
|
|
|
40723
40676
|
if (this.adapter.factoryTracker !== null) {
|
|
40724
40677
|
before.push(generatedFactoryTransform(this.adapter.factoryTracker.sourceInfo, importRewriter));
|
|
40725
40678
|
}
|
|
40726
|
-
before.push(ivySwitchTransform);
|
|
40727
40679
|
return { transformers: { before, afterDeclarations } };
|
|
40728
40680
|
}
|
|
40729
40681
|
/**
|
|
@@ -41202,19 +41154,6 @@ https://v9.angular.io/guide/template-typecheck#template-type-checking`,
|
|
|
41202
41154
|
return versions;
|
|
41203
41155
|
}
|
|
41204
41156
|
|
|
41205
|
-
/**
|
|
41206
|
-
* @license
|
|
41207
|
-
* Copyright Google LLC All Rights Reserved.
|
|
41208
|
-
*
|
|
41209
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
41210
|
-
* found in the LICENSE file at https://angular.io/license
|
|
41211
|
-
*/
|
|
41212
|
-
/**
|
|
41213
|
-
* The currently used version of TypeScript, which can be adjusted for testing purposes using
|
|
41214
|
-
* `setTypeScriptVersionForTesting` and `restoreTypeScriptVersionForTesting` below.
|
|
41215
|
-
*/
|
|
41216
|
-
ts__default["default"].version;
|
|
41217
|
-
|
|
41218
41157
|
/**
|
|
41219
41158
|
* @license
|
|
41220
41159
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -41719,15 +41658,20 @@ https://angular.io/guide/ivy for more information.
|
|
|
41719
41658
|
return undefined;
|
|
41720
41659
|
}
|
|
41721
41660
|
/**
|
|
41722
|
-
* Given an attribute node, converts it to string form.
|
|
41661
|
+
* Given an attribute node, converts it to string form for use as a CSS selector.
|
|
41723
41662
|
*/
|
|
41724
|
-
function
|
|
41663
|
+
function toAttributeCssSelector(attribute) {
|
|
41664
|
+
let selector;
|
|
41725
41665
|
if (attribute instanceof BoundEvent || attribute instanceof BoundAttribute) {
|
|
41726
|
-
|
|
41666
|
+
selector = `[${attribute.name}]`;
|
|
41727
41667
|
}
|
|
41728
41668
|
else {
|
|
41729
|
-
|
|
41669
|
+
selector = `[${attribute.name}=${attribute.valueSpan?.toString() ?? ''}]`;
|
|
41730
41670
|
}
|
|
41671
|
+
// Any dollar signs that appear in the attribute name and/or value need to be escaped because they
|
|
41672
|
+
// need to be taken as literal characters rather than special selector behavior of dollar signs in
|
|
41673
|
+
// CSS.
|
|
41674
|
+
return selector.replace('$', '\\$');
|
|
41731
41675
|
}
|
|
41732
41676
|
function getNodeName(node) {
|
|
41733
41677
|
return node instanceof Template ? node.tagName : node.name;
|
|
@@ -41768,14 +41712,14 @@ https://angular.io/guide/ivy for more information.
|
|
|
41768
41712
|
// TODO(atscott): Add unit tests for this and the one for attributes
|
|
41769
41713
|
function getDirectiveMatchesForElementTag(element, directives) {
|
|
41770
41714
|
const attributes = getAttributes(element);
|
|
41771
|
-
const allAttrs = attributes.map(
|
|
41715
|
+
const allAttrs = attributes.map(toAttributeCssSelector);
|
|
41772
41716
|
const allDirectiveMatches = getDirectiveMatchesForSelector(directives, getNodeName(element) + allAttrs.join(''));
|
|
41773
41717
|
const matchesWithoutElement = getDirectiveMatchesForSelector(directives, allAttrs.join(''));
|
|
41774
41718
|
return difference(allDirectiveMatches, matchesWithoutElement);
|
|
41775
41719
|
}
|
|
41776
41720
|
function makeElementSelector(element) {
|
|
41777
41721
|
const attributes = getAttributes(element);
|
|
41778
|
-
const allAttrs = attributes.map(
|
|
41722
|
+
const allAttrs = attributes.map(toAttributeCssSelector);
|
|
41779
41723
|
return getNodeName(element) + allAttrs.join('');
|
|
41780
41724
|
}
|
|
41781
41725
|
/**
|
|
@@ -41791,9 +41735,9 @@ https://angular.io/guide/ivy for more information.
|
|
|
41791
41735
|
*/
|
|
41792
41736
|
function getDirectiveMatchesForAttribute(name, hostNode, directives) {
|
|
41793
41737
|
const attributes = getAttributes(hostNode);
|
|
41794
|
-
const allAttrs = attributes.map(
|
|
41738
|
+
const allAttrs = attributes.map(toAttributeCssSelector);
|
|
41795
41739
|
const allDirectiveMatches = getDirectiveMatchesForSelector(directives, getNodeName(hostNode) + allAttrs.join(''));
|
|
41796
|
-
const attrsExcludingName = attributes.filter(a => a.name !== name).map(
|
|
41740
|
+
const attrsExcludingName = attributes.filter(a => a.name !== name).map(toAttributeCssSelector);
|
|
41797
41741
|
const matchesWithoutAttr = getDirectiveMatchesForSelector(directives, getNodeName(hostNode) + attrsExcludingName.join(''));
|
|
41798
41742
|
return difference(allDirectiveMatches, matchesWithoutAttr);
|
|
41799
41743
|
}
|
|
@@ -41802,18 +41746,25 @@ https://angular.io/guide/ivy for more information.
|
|
|
41802
41746
|
* for the selector.
|
|
41803
41747
|
*/
|
|
41804
41748
|
function getDirectiveMatchesForSelector(directives, selector) {
|
|
41805
|
-
|
|
41806
|
-
|
|
41749
|
+
try {
|
|
41750
|
+
const selectors = CssSelector.parse(selector);
|
|
41751
|
+
if (selectors.length === 0) {
|
|
41752
|
+
return new Set();
|
|
41753
|
+
}
|
|
41754
|
+
return new Set(directives.filter((dir) => {
|
|
41755
|
+
if (dir.selector === null) {
|
|
41756
|
+
return false;
|
|
41757
|
+
}
|
|
41758
|
+
const matcher = new SelectorMatcher();
|
|
41759
|
+
matcher.addSelectables(CssSelector.parse(dir.selector));
|
|
41760
|
+
return selectors.some(selector => matcher.match(selector, null));
|
|
41761
|
+
}));
|
|
41762
|
+
}
|
|
41763
|
+
catch {
|
|
41764
|
+
// An invalid selector may throw an error. There would be no directive matches for an invalid
|
|
41765
|
+
// selector.
|
|
41807
41766
|
return new Set();
|
|
41808
41767
|
}
|
|
41809
|
-
return new Set(directives.filter((dir) => {
|
|
41810
|
-
if (dir.selector === null) {
|
|
41811
|
-
return false;
|
|
41812
|
-
}
|
|
41813
|
-
const matcher = new SelectorMatcher();
|
|
41814
|
-
matcher.addSelectables(CssSelector.parse(dir.selector));
|
|
41815
|
-
return selectors.some(selector => matcher.match(selector, null));
|
|
41816
|
-
}));
|
|
41817
41768
|
}
|
|
41818
41769
|
/**
|
|
41819
41770
|
* Returns a new `ts.SymbolDisplayPart` array which has the alias imports from the tcb filtered
|
|
@@ -41938,7 +41889,7 @@ https://angular.io/guide/ivy for more information.
|
|
|
41938
41889
|
// same name instead. That way, we can provide go-to-definition for the pre-compiled files which
|
|
41939
41890
|
// would generally be the desired behavior.
|
|
41940
41891
|
if (url.endsWith('.css')) {
|
|
41941
|
-
const styleUrl =
|
|
41892
|
+
const styleUrl = p__namespace.resolve(fromFile, '..', url);
|
|
41942
41893
|
for (const ext of PRE_COMPILED_STYLE_EXTENSIONS) {
|
|
41943
41894
|
const precompiledFileUrl = styleUrl.replace(/\.css$/, ext);
|
|
41944
41895
|
if (this.fileExists(precompiledFileUrl)) {
|
|
@@ -42043,16 +41994,16 @@ https://angular.io/guide/ivy for more information.
|
|
|
42043
41994
|
return this.serverHost.getCurrentDirectory();
|
|
42044
41995
|
}
|
|
42045
41996
|
extname(path) {
|
|
42046
|
-
return
|
|
41997
|
+
return p__namespace.extname(path);
|
|
42047
41998
|
}
|
|
42048
41999
|
resolve(...paths) {
|
|
42049
|
-
return
|
|
42000
|
+
return p__namespace.resolve(...paths);
|
|
42050
42001
|
}
|
|
42051
42002
|
dirname(file) {
|
|
42052
|
-
return
|
|
42003
|
+
return p__namespace.dirname(file);
|
|
42053
42004
|
}
|
|
42054
42005
|
join(basePath, ...paths) {
|
|
42055
|
-
return
|
|
42006
|
+
return p__namespace.join(basePath, ...paths);
|
|
42056
42007
|
}
|
|
42057
42008
|
}
|
|
42058
42009
|
|