@angular/compiler-cli 18.0.0-next.0 → 18.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-SQY7XLGB.js → chunk-ALDR4XSX.js} +1107 -57
- package/bundles/chunk-ALDR4XSX.js.map +6 -0
- package/bundles/{chunk-4A7ZWBEL.js → chunk-AWB4ZG2D.js} +24 -24
- package/bundles/chunk-AWB4ZG2D.js.map +6 -0
- package/bundles/{chunk-64VF23SF.js → chunk-B454JZVO.js} +2 -2
- package/bundles/{chunk-NB6ZWAGP.js → chunk-C4L7A7U3.js} +16 -16
- package/bundles/chunk-C4L7A7U3.js.map +6 -0
- package/bundles/{chunk-6X7GQ6BQ.js → chunk-GGJA4IFT.js} +475 -197
- package/bundles/chunk-GGJA4IFT.js.map +6 -0
- package/bundles/{chunk-A46CQFUG.js → chunk-OHOBDHII.js} +174 -217
- package/bundles/chunk-OHOBDHII.js.map +6 -0
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/linker/src/file_linker/translator.d.ts +2 -2
- package/linker/src/linker_import_generator.d.ts +5 -5
- package/package.json +3 -3
- package/src/ngtsc/core/src/core_version.d.ts +11 -0
- package/src/ngtsc/imports/index.d.ts +1 -1
- package/src/ngtsc/imports/src/core.d.ts +0 -9
- package/src/ngtsc/imports/src/patch_alias_reference_resolution.d.ts +3 -1
- package/src/ngtsc/transform/index.d.ts +0 -1
- package/src/ngtsc/transform/src/declaration.d.ts +1 -1
- package/src/ngtsc/translator/index.d.ts +2 -2
- package/src/ngtsc/translator/src/api/import_generator.d.ts +22 -10
- package/src/ngtsc/translator/src/import_manager/check_unique_identifier_name.d.ts +13 -0
- package/src/ngtsc/translator/src/import_manager/import_manager.d.ts +94 -0
- package/src/ngtsc/translator/src/import_manager/import_typescript_transform.d.ts +17 -0
- package/src/ngtsc/translator/src/import_manager/reuse_generated_imports.d.ts +32 -0
- package/src/ngtsc/translator/src/import_manager/reuse_source_file_imports.d.ts +38 -0
- package/src/ngtsc/translator/src/translator.d.ts +3 -2
- package/src/ngtsc/translator/src/type_translator.d.ts +1 -1
- package/src/ngtsc/translator/src/typescript_translator.d.ts +2 -2
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +1 -1
- package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -2
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +1 -1
- package/bundles/chunk-4A7ZWBEL.js.map +0 -6
- package/bundles/chunk-6X7GQ6BQ.js.map +0 -6
- package/bundles/chunk-A46CQFUG.js.map +0 -6
- package/bundles/chunk-NB6ZWAGP.js.map +0 -6
- package/bundles/chunk-SQY7XLGB.js.map +0 -6
- package/src/ngtsc/transform/src/utils.d.ts +0 -15
- package/src/ngtsc/translator/src/import_manager.d.ts +0 -47
- /package/bundles/{chunk-64VF23SF.js.map → chunk-B454JZVO.js.map} +0 -0
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
declarationTransformFactory,
|
|
40
40
|
isHostDirectiveMetaForGlobalMode,
|
|
41
41
|
ivyTransformFactory
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-OHOBDHII.js";
|
|
43
43
|
import {
|
|
44
44
|
AbsoluteModuleStrategy,
|
|
45
45
|
AliasStrategy,
|
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
toUnredirectedSourceFile,
|
|
90
90
|
translateExpression,
|
|
91
91
|
translateType
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-GGJA4IFT.js";
|
|
93
93
|
import {
|
|
94
94
|
ActivePerfRecorder,
|
|
95
95
|
DelegatingPerfRecorder,
|
|
@@ -286,6 +286,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
286
286
|
}
|
|
287
287
|
|
|
288
288
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
289
|
+
import { R3Identifiers as R3Identifiers5 } from "@angular/compiler";
|
|
289
290
|
import ts38 from "typescript";
|
|
290
291
|
|
|
291
292
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
@@ -1002,8 +1003,8 @@ function extractEnumMembers(declaration, checker) {
|
|
|
1002
1003
|
}
|
|
1003
1004
|
function getEnumMemberValue(memberNode) {
|
|
1004
1005
|
var _a;
|
|
1005
|
-
const literal = memberNode.getChildren().find((
|
|
1006
|
-
return ts9.isNumericLiteral(
|
|
1006
|
+
const literal = memberNode.getChildren().find((n2) => {
|
|
1007
|
+
return ts9.isNumericLiteral(n2) || ts9.isStringLiteral(n2) || ts9.isPrefixUnaryExpression(n2) && n2.operator === ts9.SyntaxKind.MinusToken && ts9.isNumericLiteral(n2.operand);
|
|
1007
1008
|
});
|
|
1008
1009
|
return (_a = literal == null ? void 0 : literal.getText()) != null ? _a : "";
|
|
1009
1010
|
}
|
|
@@ -2954,7 +2955,7 @@ var CompletionEngine = class {
|
|
|
2954
2955
|
}
|
|
2955
2956
|
} else {
|
|
2956
2957
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2957
|
-
filter: (
|
|
2958
|
+
filter: (n2) => ts18.isStringLiteral(n2) || ts18.isNumericLiteral(n2),
|
|
2958
2959
|
withSpan: expr.sourceSpan
|
|
2959
2960
|
});
|
|
2960
2961
|
}
|
|
@@ -2996,6 +2997,1016 @@ var CompletionEngine = class {
|
|
|
2996
2997
|
}
|
|
2997
2998
|
};
|
|
2998
2999
|
|
|
3000
|
+
// node_modules/magic-string/dist/magic-string.es.mjs
|
|
3001
|
+
import { encode } from "@jridgewell/sourcemap-codec";
|
|
3002
|
+
var BitSet = class {
|
|
3003
|
+
constructor(arg) {
|
|
3004
|
+
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
3005
|
+
}
|
|
3006
|
+
add(n2) {
|
|
3007
|
+
this.bits[n2 >> 5] |= 1 << (n2 & 31);
|
|
3008
|
+
}
|
|
3009
|
+
has(n2) {
|
|
3010
|
+
return !!(this.bits[n2 >> 5] & 1 << (n2 & 31));
|
|
3011
|
+
}
|
|
3012
|
+
};
|
|
3013
|
+
var Chunk = class {
|
|
3014
|
+
constructor(start, end, content) {
|
|
3015
|
+
this.start = start;
|
|
3016
|
+
this.end = end;
|
|
3017
|
+
this.original = content;
|
|
3018
|
+
this.intro = "";
|
|
3019
|
+
this.outro = "";
|
|
3020
|
+
this.content = content;
|
|
3021
|
+
this.storeName = false;
|
|
3022
|
+
this.edited = false;
|
|
3023
|
+
{
|
|
3024
|
+
this.previous = null;
|
|
3025
|
+
this.next = null;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
appendLeft(content) {
|
|
3029
|
+
this.outro += content;
|
|
3030
|
+
}
|
|
3031
|
+
appendRight(content) {
|
|
3032
|
+
this.intro = this.intro + content;
|
|
3033
|
+
}
|
|
3034
|
+
clone() {
|
|
3035
|
+
const chunk = new Chunk(this.start, this.end, this.original);
|
|
3036
|
+
chunk.intro = this.intro;
|
|
3037
|
+
chunk.outro = this.outro;
|
|
3038
|
+
chunk.content = this.content;
|
|
3039
|
+
chunk.storeName = this.storeName;
|
|
3040
|
+
chunk.edited = this.edited;
|
|
3041
|
+
return chunk;
|
|
3042
|
+
}
|
|
3043
|
+
contains(index) {
|
|
3044
|
+
return this.start < index && index < this.end;
|
|
3045
|
+
}
|
|
3046
|
+
eachNext(fn) {
|
|
3047
|
+
let chunk = this;
|
|
3048
|
+
while (chunk) {
|
|
3049
|
+
fn(chunk);
|
|
3050
|
+
chunk = chunk.next;
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
eachPrevious(fn) {
|
|
3054
|
+
let chunk = this;
|
|
3055
|
+
while (chunk) {
|
|
3056
|
+
fn(chunk);
|
|
3057
|
+
chunk = chunk.previous;
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
edit(content, storeName, contentOnly) {
|
|
3061
|
+
this.content = content;
|
|
3062
|
+
if (!contentOnly) {
|
|
3063
|
+
this.intro = "";
|
|
3064
|
+
this.outro = "";
|
|
3065
|
+
}
|
|
3066
|
+
this.storeName = storeName;
|
|
3067
|
+
this.edited = true;
|
|
3068
|
+
return this;
|
|
3069
|
+
}
|
|
3070
|
+
prependLeft(content) {
|
|
3071
|
+
this.outro = content + this.outro;
|
|
3072
|
+
}
|
|
3073
|
+
prependRight(content) {
|
|
3074
|
+
this.intro = content + this.intro;
|
|
3075
|
+
}
|
|
3076
|
+
reset() {
|
|
3077
|
+
this.intro = "";
|
|
3078
|
+
this.outro = "";
|
|
3079
|
+
if (this.edited) {
|
|
3080
|
+
this.content = this.original;
|
|
3081
|
+
this.storeName = false;
|
|
3082
|
+
this.edited = false;
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
split(index) {
|
|
3086
|
+
const sliceIndex = index - this.start;
|
|
3087
|
+
const originalBefore = this.original.slice(0, sliceIndex);
|
|
3088
|
+
const originalAfter = this.original.slice(sliceIndex);
|
|
3089
|
+
this.original = originalBefore;
|
|
3090
|
+
const newChunk = new Chunk(index, this.end, originalAfter);
|
|
3091
|
+
newChunk.outro = this.outro;
|
|
3092
|
+
this.outro = "";
|
|
3093
|
+
this.end = index;
|
|
3094
|
+
if (this.edited) {
|
|
3095
|
+
newChunk.edit("", false);
|
|
3096
|
+
this.content = "";
|
|
3097
|
+
} else {
|
|
3098
|
+
this.content = originalBefore;
|
|
3099
|
+
}
|
|
3100
|
+
newChunk.next = this.next;
|
|
3101
|
+
if (newChunk.next)
|
|
3102
|
+
newChunk.next.previous = newChunk;
|
|
3103
|
+
newChunk.previous = this;
|
|
3104
|
+
this.next = newChunk;
|
|
3105
|
+
return newChunk;
|
|
3106
|
+
}
|
|
3107
|
+
toString() {
|
|
3108
|
+
return this.intro + this.content + this.outro;
|
|
3109
|
+
}
|
|
3110
|
+
trimEnd(rx) {
|
|
3111
|
+
this.outro = this.outro.replace(rx, "");
|
|
3112
|
+
if (this.outro.length)
|
|
3113
|
+
return true;
|
|
3114
|
+
const trimmed = this.content.replace(rx, "");
|
|
3115
|
+
if (trimmed.length) {
|
|
3116
|
+
if (trimmed !== this.content) {
|
|
3117
|
+
this.split(this.start + trimmed.length).edit("", void 0, true);
|
|
3118
|
+
if (this.edited) {
|
|
3119
|
+
this.edit(trimmed, this.storeName, true);
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
return true;
|
|
3123
|
+
} else {
|
|
3124
|
+
this.edit("", void 0, true);
|
|
3125
|
+
this.intro = this.intro.replace(rx, "");
|
|
3126
|
+
if (this.intro.length)
|
|
3127
|
+
return true;
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
trimStart(rx) {
|
|
3131
|
+
this.intro = this.intro.replace(rx, "");
|
|
3132
|
+
if (this.intro.length)
|
|
3133
|
+
return true;
|
|
3134
|
+
const trimmed = this.content.replace(rx, "");
|
|
3135
|
+
if (trimmed.length) {
|
|
3136
|
+
if (trimmed !== this.content) {
|
|
3137
|
+
const newChunk = this.split(this.end - trimmed.length);
|
|
3138
|
+
if (this.edited) {
|
|
3139
|
+
newChunk.edit(trimmed, this.storeName, true);
|
|
3140
|
+
}
|
|
3141
|
+
this.edit("", void 0, true);
|
|
3142
|
+
}
|
|
3143
|
+
return true;
|
|
3144
|
+
} else {
|
|
3145
|
+
this.edit("", void 0, true);
|
|
3146
|
+
this.outro = this.outro.replace(rx, "");
|
|
3147
|
+
if (this.outro.length)
|
|
3148
|
+
return true;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
function getBtoa() {
|
|
3153
|
+
if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
|
|
3154
|
+
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
3155
|
+
} else if (typeof Buffer === "function") {
|
|
3156
|
+
return (str) => Buffer.from(str, "utf-8").toString("base64");
|
|
3157
|
+
} else {
|
|
3158
|
+
return () => {
|
|
3159
|
+
throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
|
|
3160
|
+
};
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
var btoa = /* @__PURE__ */ getBtoa();
|
|
3164
|
+
var SourceMap = class {
|
|
3165
|
+
constructor(properties) {
|
|
3166
|
+
this.version = 3;
|
|
3167
|
+
this.file = properties.file;
|
|
3168
|
+
this.sources = properties.sources;
|
|
3169
|
+
this.sourcesContent = properties.sourcesContent;
|
|
3170
|
+
this.names = properties.names;
|
|
3171
|
+
this.mappings = encode(properties.mappings);
|
|
3172
|
+
if (typeof properties.x_google_ignoreList !== "undefined") {
|
|
3173
|
+
this.x_google_ignoreList = properties.x_google_ignoreList;
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
toString() {
|
|
3177
|
+
return JSON.stringify(this);
|
|
3178
|
+
}
|
|
3179
|
+
toUrl() {
|
|
3180
|
+
return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
|
|
3181
|
+
}
|
|
3182
|
+
};
|
|
3183
|
+
function guessIndent(code) {
|
|
3184
|
+
const lines = code.split("\n");
|
|
3185
|
+
const tabbed = lines.filter((line) => /^\t+/.test(line));
|
|
3186
|
+
const spaced = lines.filter((line) => /^ {2,}/.test(line));
|
|
3187
|
+
if (tabbed.length === 0 && spaced.length === 0) {
|
|
3188
|
+
return null;
|
|
3189
|
+
}
|
|
3190
|
+
if (tabbed.length >= spaced.length) {
|
|
3191
|
+
return " ";
|
|
3192
|
+
}
|
|
3193
|
+
const min = spaced.reduce((previous, current) => {
|
|
3194
|
+
const numSpaces = /^ +/.exec(current)[0].length;
|
|
3195
|
+
return Math.min(numSpaces, previous);
|
|
3196
|
+
}, Infinity);
|
|
3197
|
+
return new Array(min + 1).join(" ");
|
|
3198
|
+
}
|
|
3199
|
+
function getRelativePath(from, to) {
|
|
3200
|
+
const fromParts = from.split(/[/\\]/);
|
|
3201
|
+
const toParts = to.split(/[/\\]/);
|
|
3202
|
+
fromParts.pop();
|
|
3203
|
+
while (fromParts[0] === toParts[0]) {
|
|
3204
|
+
fromParts.shift();
|
|
3205
|
+
toParts.shift();
|
|
3206
|
+
}
|
|
3207
|
+
if (fromParts.length) {
|
|
3208
|
+
let i = fromParts.length;
|
|
3209
|
+
while (i--)
|
|
3210
|
+
fromParts[i] = "..";
|
|
3211
|
+
}
|
|
3212
|
+
return fromParts.concat(toParts).join("/");
|
|
3213
|
+
}
|
|
3214
|
+
var toString = Object.prototype.toString;
|
|
3215
|
+
function isObject(thing) {
|
|
3216
|
+
return toString.call(thing) === "[object Object]";
|
|
3217
|
+
}
|
|
3218
|
+
function getLocator(source) {
|
|
3219
|
+
const originalLines = source.split("\n");
|
|
3220
|
+
const lineOffsets = [];
|
|
3221
|
+
for (let i = 0, pos = 0; i < originalLines.length; i++) {
|
|
3222
|
+
lineOffsets.push(pos);
|
|
3223
|
+
pos += originalLines[i].length + 1;
|
|
3224
|
+
}
|
|
3225
|
+
return function locate(index) {
|
|
3226
|
+
let i = 0;
|
|
3227
|
+
let j = lineOffsets.length;
|
|
3228
|
+
while (i < j) {
|
|
3229
|
+
const m = i + j >> 1;
|
|
3230
|
+
if (index < lineOffsets[m]) {
|
|
3231
|
+
j = m;
|
|
3232
|
+
} else {
|
|
3233
|
+
i = m + 1;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
const line = i - 1;
|
|
3237
|
+
const column = index - lineOffsets[line];
|
|
3238
|
+
return { line, column };
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
var wordRegex = /\w/;
|
|
3242
|
+
var Mappings = class {
|
|
3243
|
+
constructor(hires) {
|
|
3244
|
+
this.hires = hires;
|
|
3245
|
+
this.generatedCodeLine = 0;
|
|
3246
|
+
this.generatedCodeColumn = 0;
|
|
3247
|
+
this.raw = [];
|
|
3248
|
+
this.rawSegments = this.raw[this.generatedCodeLine] = [];
|
|
3249
|
+
this.pending = null;
|
|
3250
|
+
}
|
|
3251
|
+
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
3252
|
+
if (content.length) {
|
|
3253
|
+
const contentLengthMinusOne = content.length - 1;
|
|
3254
|
+
let contentLineEnd = content.indexOf("\n", 0);
|
|
3255
|
+
let previousContentLineEnd = -1;
|
|
3256
|
+
while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
|
|
3257
|
+
const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
3258
|
+
if (nameIndex >= 0) {
|
|
3259
|
+
segment2.push(nameIndex);
|
|
3260
|
+
}
|
|
3261
|
+
this.rawSegments.push(segment2);
|
|
3262
|
+
this.generatedCodeLine += 1;
|
|
3263
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3264
|
+
this.generatedCodeColumn = 0;
|
|
3265
|
+
previousContentLineEnd = contentLineEnd;
|
|
3266
|
+
contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
|
|
3267
|
+
}
|
|
3268
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
3269
|
+
if (nameIndex >= 0) {
|
|
3270
|
+
segment.push(nameIndex);
|
|
3271
|
+
}
|
|
3272
|
+
this.rawSegments.push(segment);
|
|
3273
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
3274
|
+
} else if (this.pending) {
|
|
3275
|
+
this.rawSegments.push(this.pending);
|
|
3276
|
+
this.advance(content);
|
|
3277
|
+
}
|
|
3278
|
+
this.pending = null;
|
|
3279
|
+
}
|
|
3280
|
+
addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
|
|
3281
|
+
let originalCharIndex = chunk.start;
|
|
3282
|
+
let first = true;
|
|
3283
|
+
let charInHiresBoundary = false;
|
|
3284
|
+
while (originalCharIndex < chunk.end) {
|
|
3285
|
+
if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
|
|
3286
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
3287
|
+
if (this.hires === "boundary") {
|
|
3288
|
+
if (wordRegex.test(original[originalCharIndex])) {
|
|
3289
|
+
if (!charInHiresBoundary) {
|
|
3290
|
+
this.rawSegments.push(segment);
|
|
3291
|
+
charInHiresBoundary = true;
|
|
3292
|
+
}
|
|
3293
|
+
} else {
|
|
3294
|
+
this.rawSegments.push(segment);
|
|
3295
|
+
charInHiresBoundary = false;
|
|
3296
|
+
}
|
|
3297
|
+
} else {
|
|
3298
|
+
this.rawSegments.push(segment);
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
if (original[originalCharIndex] === "\n") {
|
|
3302
|
+
loc.line += 1;
|
|
3303
|
+
loc.column = 0;
|
|
3304
|
+
this.generatedCodeLine += 1;
|
|
3305
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3306
|
+
this.generatedCodeColumn = 0;
|
|
3307
|
+
first = true;
|
|
3308
|
+
} else {
|
|
3309
|
+
loc.column += 1;
|
|
3310
|
+
this.generatedCodeColumn += 1;
|
|
3311
|
+
first = false;
|
|
3312
|
+
}
|
|
3313
|
+
originalCharIndex += 1;
|
|
3314
|
+
}
|
|
3315
|
+
this.pending = null;
|
|
3316
|
+
}
|
|
3317
|
+
advance(str) {
|
|
3318
|
+
if (!str)
|
|
3319
|
+
return;
|
|
3320
|
+
const lines = str.split("\n");
|
|
3321
|
+
if (lines.length > 1) {
|
|
3322
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
3323
|
+
this.generatedCodeLine++;
|
|
3324
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
3325
|
+
}
|
|
3326
|
+
this.generatedCodeColumn = 0;
|
|
3327
|
+
}
|
|
3328
|
+
this.generatedCodeColumn += lines[lines.length - 1].length;
|
|
3329
|
+
}
|
|
3330
|
+
};
|
|
3331
|
+
var n = "\n";
|
|
3332
|
+
var warned = {
|
|
3333
|
+
insertLeft: false,
|
|
3334
|
+
insertRight: false,
|
|
3335
|
+
storeName: false
|
|
3336
|
+
};
|
|
3337
|
+
var MagicString = class {
|
|
3338
|
+
constructor(string, options = {}) {
|
|
3339
|
+
const chunk = new Chunk(0, string.length, string);
|
|
3340
|
+
Object.defineProperties(this, {
|
|
3341
|
+
original: { writable: true, value: string },
|
|
3342
|
+
outro: { writable: true, value: "" },
|
|
3343
|
+
intro: { writable: true, value: "" },
|
|
3344
|
+
firstChunk: { writable: true, value: chunk },
|
|
3345
|
+
lastChunk: { writable: true, value: chunk },
|
|
3346
|
+
lastSearchedChunk: { writable: true, value: chunk },
|
|
3347
|
+
byStart: { writable: true, value: {} },
|
|
3348
|
+
byEnd: { writable: true, value: {} },
|
|
3349
|
+
filename: { writable: true, value: options.filename },
|
|
3350
|
+
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
3351
|
+
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
3352
|
+
storedNames: { writable: true, value: {} },
|
|
3353
|
+
indentStr: { writable: true, value: void 0 },
|
|
3354
|
+
ignoreList: { writable: true, value: options.ignoreList }
|
|
3355
|
+
});
|
|
3356
|
+
this.byStart[0] = chunk;
|
|
3357
|
+
this.byEnd[string.length] = chunk;
|
|
3358
|
+
}
|
|
3359
|
+
addSourcemapLocation(char) {
|
|
3360
|
+
this.sourcemapLocations.add(char);
|
|
3361
|
+
}
|
|
3362
|
+
append(content) {
|
|
3363
|
+
if (typeof content !== "string")
|
|
3364
|
+
throw new TypeError("outro content must be a string");
|
|
3365
|
+
this.outro += content;
|
|
3366
|
+
return this;
|
|
3367
|
+
}
|
|
3368
|
+
appendLeft(index, content) {
|
|
3369
|
+
if (typeof content !== "string")
|
|
3370
|
+
throw new TypeError("inserted content must be a string");
|
|
3371
|
+
this._split(index);
|
|
3372
|
+
const chunk = this.byEnd[index];
|
|
3373
|
+
if (chunk) {
|
|
3374
|
+
chunk.appendLeft(content);
|
|
3375
|
+
} else {
|
|
3376
|
+
this.intro += content;
|
|
3377
|
+
}
|
|
3378
|
+
return this;
|
|
3379
|
+
}
|
|
3380
|
+
appendRight(index, content) {
|
|
3381
|
+
if (typeof content !== "string")
|
|
3382
|
+
throw new TypeError("inserted content must be a string");
|
|
3383
|
+
this._split(index);
|
|
3384
|
+
const chunk = this.byStart[index];
|
|
3385
|
+
if (chunk) {
|
|
3386
|
+
chunk.appendRight(content);
|
|
3387
|
+
} else {
|
|
3388
|
+
this.outro += content;
|
|
3389
|
+
}
|
|
3390
|
+
return this;
|
|
3391
|
+
}
|
|
3392
|
+
clone() {
|
|
3393
|
+
const cloned = new MagicString(this.original, { filename: this.filename });
|
|
3394
|
+
let originalChunk = this.firstChunk;
|
|
3395
|
+
let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
|
|
3396
|
+
while (originalChunk) {
|
|
3397
|
+
cloned.byStart[clonedChunk.start] = clonedChunk;
|
|
3398
|
+
cloned.byEnd[clonedChunk.end] = clonedChunk;
|
|
3399
|
+
const nextOriginalChunk = originalChunk.next;
|
|
3400
|
+
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
3401
|
+
if (nextClonedChunk) {
|
|
3402
|
+
clonedChunk.next = nextClonedChunk;
|
|
3403
|
+
nextClonedChunk.previous = clonedChunk;
|
|
3404
|
+
clonedChunk = nextClonedChunk;
|
|
3405
|
+
}
|
|
3406
|
+
originalChunk = nextOriginalChunk;
|
|
3407
|
+
}
|
|
3408
|
+
cloned.lastChunk = clonedChunk;
|
|
3409
|
+
if (this.indentExclusionRanges) {
|
|
3410
|
+
cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
|
|
3411
|
+
}
|
|
3412
|
+
cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
|
|
3413
|
+
cloned.intro = this.intro;
|
|
3414
|
+
cloned.outro = this.outro;
|
|
3415
|
+
return cloned;
|
|
3416
|
+
}
|
|
3417
|
+
generateDecodedMap(options) {
|
|
3418
|
+
options = options || {};
|
|
3419
|
+
const sourceIndex = 0;
|
|
3420
|
+
const names = Object.keys(this.storedNames);
|
|
3421
|
+
const mappings = new Mappings(options.hires);
|
|
3422
|
+
const locate = getLocator(this.original);
|
|
3423
|
+
if (this.intro) {
|
|
3424
|
+
mappings.advance(this.intro);
|
|
3425
|
+
}
|
|
3426
|
+
this.firstChunk.eachNext((chunk) => {
|
|
3427
|
+
const loc = locate(chunk.start);
|
|
3428
|
+
if (chunk.intro.length)
|
|
3429
|
+
mappings.advance(chunk.intro);
|
|
3430
|
+
if (chunk.edited) {
|
|
3431
|
+
mappings.addEdit(
|
|
3432
|
+
sourceIndex,
|
|
3433
|
+
chunk.content,
|
|
3434
|
+
loc,
|
|
3435
|
+
chunk.storeName ? names.indexOf(chunk.original) : -1
|
|
3436
|
+
);
|
|
3437
|
+
} else {
|
|
3438
|
+
mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
|
|
3439
|
+
}
|
|
3440
|
+
if (chunk.outro.length)
|
|
3441
|
+
mappings.advance(chunk.outro);
|
|
3442
|
+
});
|
|
3443
|
+
return {
|
|
3444
|
+
file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
|
|
3445
|
+
sources: [
|
|
3446
|
+
options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
|
|
3447
|
+
],
|
|
3448
|
+
sourcesContent: options.includeContent ? [this.original] : void 0,
|
|
3449
|
+
names,
|
|
3450
|
+
mappings: mappings.raw,
|
|
3451
|
+
x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
|
|
3452
|
+
};
|
|
3453
|
+
}
|
|
3454
|
+
generateMap(options) {
|
|
3455
|
+
return new SourceMap(this.generateDecodedMap(options));
|
|
3456
|
+
}
|
|
3457
|
+
_ensureindentStr() {
|
|
3458
|
+
if (this.indentStr === void 0) {
|
|
3459
|
+
this.indentStr = guessIndent(this.original);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
_getRawIndentString() {
|
|
3463
|
+
this._ensureindentStr();
|
|
3464
|
+
return this.indentStr;
|
|
3465
|
+
}
|
|
3466
|
+
getIndentString() {
|
|
3467
|
+
this._ensureindentStr();
|
|
3468
|
+
return this.indentStr === null ? " " : this.indentStr;
|
|
3469
|
+
}
|
|
3470
|
+
indent(indentStr, options) {
|
|
3471
|
+
const pattern = /^[^\r\n]/gm;
|
|
3472
|
+
if (isObject(indentStr)) {
|
|
3473
|
+
options = indentStr;
|
|
3474
|
+
indentStr = void 0;
|
|
3475
|
+
}
|
|
3476
|
+
if (indentStr === void 0) {
|
|
3477
|
+
this._ensureindentStr();
|
|
3478
|
+
indentStr = this.indentStr || " ";
|
|
3479
|
+
}
|
|
3480
|
+
if (indentStr === "")
|
|
3481
|
+
return this;
|
|
3482
|
+
options = options || {};
|
|
3483
|
+
const isExcluded = {};
|
|
3484
|
+
if (options.exclude) {
|
|
3485
|
+
const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
|
|
3486
|
+
exclusions.forEach((exclusion) => {
|
|
3487
|
+
for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
|
|
3488
|
+
isExcluded[i] = true;
|
|
3489
|
+
}
|
|
3490
|
+
});
|
|
3491
|
+
}
|
|
3492
|
+
let shouldIndentNextCharacter = options.indentStart !== false;
|
|
3493
|
+
const replacer = (match) => {
|
|
3494
|
+
if (shouldIndentNextCharacter)
|
|
3495
|
+
return `${indentStr}${match}`;
|
|
3496
|
+
shouldIndentNextCharacter = true;
|
|
3497
|
+
return match;
|
|
3498
|
+
};
|
|
3499
|
+
this.intro = this.intro.replace(pattern, replacer);
|
|
3500
|
+
let charIndex = 0;
|
|
3501
|
+
let chunk = this.firstChunk;
|
|
3502
|
+
while (chunk) {
|
|
3503
|
+
const end = chunk.end;
|
|
3504
|
+
if (chunk.edited) {
|
|
3505
|
+
if (!isExcluded[charIndex]) {
|
|
3506
|
+
chunk.content = chunk.content.replace(pattern, replacer);
|
|
3507
|
+
if (chunk.content.length) {
|
|
3508
|
+
shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
} else {
|
|
3512
|
+
charIndex = chunk.start;
|
|
3513
|
+
while (charIndex < end) {
|
|
3514
|
+
if (!isExcluded[charIndex]) {
|
|
3515
|
+
const char = this.original[charIndex];
|
|
3516
|
+
if (char === "\n") {
|
|
3517
|
+
shouldIndentNextCharacter = true;
|
|
3518
|
+
} else if (char !== "\r" && shouldIndentNextCharacter) {
|
|
3519
|
+
shouldIndentNextCharacter = false;
|
|
3520
|
+
if (charIndex === chunk.start) {
|
|
3521
|
+
chunk.prependRight(indentStr);
|
|
3522
|
+
} else {
|
|
3523
|
+
this._splitChunk(chunk, charIndex);
|
|
3524
|
+
chunk = chunk.next;
|
|
3525
|
+
chunk.prependRight(indentStr);
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
charIndex += 1;
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
charIndex = chunk.end;
|
|
3533
|
+
chunk = chunk.next;
|
|
3534
|
+
}
|
|
3535
|
+
this.outro = this.outro.replace(pattern, replacer);
|
|
3536
|
+
return this;
|
|
3537
|
+
}
|
|
3538
|
+
insert() {
|
|
3539
|
+
throw new Error(
|
|
3540
|
+
"magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
|
|
3541
|
+
);
|
|
3542
|
+
}
|
|
3543
|
+
insertLeft(index, content) {
|
|
3544
|
+
if (!warned.insertLeft) {
|
|
3545
|
+
console.warn(
|
|
3546
|
+
"magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
|
|
3547
|
+
);
|
|
3548
|
+
warned.insertLeft = true;
|
|
3549
|
+
}
|
|
3550
|
+
return this.appendLeft(index, content);
|
|
3551
|
+
}
|
|
3552
|
+
insertRight(index, content) {
|
|
3553
|
+
if (!warned.insertRight) {
|
|
3554
|
+
console.warn(
|
|
3555
|
+
"magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
|
|
3556
|
+
);
|
|
3557
|
+
warned.insertRight = true;
|
|
3558
|
+
}
|
|
3559
|
+
return this.prependRight(index, content);
|
|
3560
|
+
}
|
|
3561
|
+
move(start, end, index) {
|
|
3562
|
+
if (index >= start && index <= end)
|
|
3563
|
+
throw new Error("Cannot move a selection inside itself");
|
|
3564
|
+
this._split(start);
|
|
3565
|
+
this._split(end);
|
|
3566
|
+
this._split(index);
|
|
3567
|
+
const first = this.byStart[start];
|
|
3568
|
+
const last = this.byEnd[end];
|
|
3569
|
+
const oldLeft = first.previous;
|
|
3570
|
+
const oldRight = last.next;
|
|
3571
|
+
const newRight = this.byStart[index];
|
|
3572
|
+
if (!newRight && last === this.lastChunk)
|
|
3573
|
+
return this;
|
|
3574
|
+
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
3575
|
+
if (oldLeft)
|
|
3576
|
+
oldLeft.next = oldRight;
|
|
3577
|
+
if (oldRight)
|
|
3578
|
+
oldRight.previous = oldLeft;
|
|
3579
|
+
if (newLeft)
|
|
3580
|
+
newLeft.next = first;
|
|
3581
|
+
if (newRight)
|
|
3582
|
+
newRight.previous = last;
|
|
3583
|
+
if (!first.previous)
|
|
3584
|
+
this.firstChunk = last.next;
|
|
3585
|
+
if (!last.next) {
|
|
3586
|
+
this.lastChunk = first.previous;
|
|
3587
|
+
this.lastChunk.next = null;
|
|
3588
|
+
}
|
|
3589
|
+
first.previous = newLeft;
|
|
3590
|
+
last.next = newRight || null;
|
|
3591
|
+
if (!newLeft)
|
|
3592
|
+
this.firstChunk = first;
|
|
3593
|
+
if (!newRight)
|
|
3594
|
+
this.lastChunk = last;
|
|
3595
|
+
return this;
|
|
3596
|
+
}
|
|
3597
|
+
overwrite(start, end, content, options) {
|
|
3598
|
+
options = options || {};
|
|
3599
|
+
return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
|
|
3600
|
+
}
|
|
3601
|
+
update(start, end, content, options) {
|
|
3602
|
+
if (typeof content !== "string")
|
|
3603
|
+
throw new TypeError("replacement content must be a string");
|
|
3604
|
+
while (start < 0)
|
|
3605
|
+
start += this.original.length;
|
|
3606
|
+
while (end < 0)
|
|
3607
|
+
end += this.original.length;
|
|
3608
|
+
if (end > this.original.length)
|
|
3609
|
+
throw new Error("end is out of bounds");
|
|
3610
|
+
if (start === end)
|
|
3611
|
+
throw new Error(
|
|
3612
|
+
"Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"
|
|
3613
|
+
);
|
|
3614
|
+
this._split(start);
|
|
3615
|
+
this._split(end);
|
|
3616
|
+
if (options === true) {
|
|
3617
|
+
if (!warned.storeName) {
|
|
3618
|
+
console.warn(
|
|
3619
|
+
"The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
|
|
3620
|
+
);
|
|
3621
|
+
warned.storeName = true;
|
|
3622
|
+
}
|
|
3623
|
+
options = { storeName: true };
|
|
3624
|
+
}
|
|
3625
|
+
const storeName = options !== void 0 ? options.storeName : false;
|
|
3626
|
+
const overwrite = options !== void 0 ? options.overwrite : false;
|
|
3627
|
+
if (storeName) {
|
|
3628
|
+
const original = this.original.slice(start, end);
|
|
3629
|
+
Object.defineProperty(this.storedNames, original, {
|
|
3630
|
+
writable: true,
|
|
3631
|
+
value: true,
|
|
3632
|
+
enumerable: true
|
|
3633
|
+
});
|
|
3634
|
+
}
|
|
3635
|
+
const first = this.byStart[start];
|
|
3636
|
+
const last = this.byEnd[end];
|
|
3637
|
+
if (first) {
|
|
3638
|
+
let chunk = first;
|
|
3639
|
+
while (chunk !== last) {
|
|
3640
|
+
if (chunk.next !== this.byStart[chunk.end]) {
|
|
3641
|
+
throw new Error("Cannot overwrite across a split point");
|
|
3642
|
+
}
|
|
3643
|
+
chunk = chunk.next;
|
|
3644
|
+
chunk.edit("", false);
|
|
3645
|
+
}
|
|
3646
|
+
first.edit(content, storeName, !overwrite);
|
|
3647
|
+
} else {
|
|
3648
|
+
const newChunk = new Chunk(start, end, "").edit(content, storeName);
|
|
3649
|
+
last.next = newChunk;
|
|
3650
|
+
newChunk.previous = last;
|
|
3651
|
+
}
|
|
3652
|
+
return this;
|
|
3653
|
+
}
|
|
3654
|
+
prepend(content) {
|
|
3655
|
+
if (typeof content !== "string")
|
|
3656
|
+
throw new TypeError("outro content must be a string");
|
|
3657
|
+
this.intro = content + this.intro;
|
|
3658
|
+
return this;
|
|
3659
|
+
}
|
|
3660
|
+
prependLeft(index, content) {
|
|
3661
|
+
if (typeof content !== "string")
|
|
3662
|
+
throw new TypeError("inserted content must be a string");
|
|
3663
|
+
this._split(index);
|
|
3664
|
+
const chunk = this.byEnd[index];
|
|
3665
|
+
if (chunk) {
|
|
3666
|
+
chunk.prependLeft(content);
|
|
3667
|
+
} else {
|
|
3668
|
+
this.intro = content + this.intro;
|
|
3669
|
+
}
|
|
3670
|
+
return this;
|
|
3671
|
+
}
|
|
3672
|
+
prependRight(index, content) {
|
|
3673
|
+
if (typeof content !== "string")
|
|
3674
|
+
throw new TypeError("inserted content must be a string");
|
|
3675
|
+
this._split(index);
|
|
3676
|
+
const chunk = this.byStart[index];
|
|
3677
|
+
if (chunk) {
|
|
3678
|
+
chunk.prependRight(content);
|
|
3679
|
+
} else {
|
|
3680
|
+
this.outro = content + this.outro;
|
|
3681
|
+
}
|
|
3682
|
+
return this;
|
|
3683
|
+
}
|
|
3684
|
+
remove(start, end) {
|
|
3685
|
+
while (start < 0)
|
|
3686
|
+
start += this.original.length;
|
|
3687
|
+
while (end < 0)
|
|
3688
|
+
end += this.original.length;
|
|
3689
|
+
if (start === end)
|
|
3690
|
+
return this;
|
|
3691
|
+
if (start < 0 || end > this.original.length)
|
|
3692
|
+
throw new Error("Character is out of bounds");
|
|
3693
|
+
if (start > end)
|
|
3694
|
+
throw new Error("end must be greater than start");
|
|
3695
|
+
this._split(start);
|
|
3696
|
+
this._split(end);
|
|
3697
|
+
let chunk = this.byStart[start];
|
|
3698
|
+
while (chunk) {
|
|
3699
|
+
chunk.intro = "";
|
|
3700
|
+
chunk.outro = "";
|
|
3701
|
+
chunk.edit("");
|
|
3702
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
3703
|
+
}
|
|
3704
|
+
return this;
|
|
3705
|
+
}
|
|
3706
|
+
reset(start, end) {
|
|
3707
|
+
while (start < 0)
|
|
3708
|
+
start += this.original.length;
|
|
3709
|
+
while (end < 0)
|
|
3710
|
+
end += this.original.length;
|
|
3711
|
+
if (start === end)
|
|
3712
|
+
return this;
|
|
3713
|
+
if (start < 0 || end > this.original.length)
|
|
3714
|
+
throw new Error("Character is out of bounds");
|
|
3715
|
+
if (start > end)
|
|
3716
|
+
throw new Error("end must be greater than start");
|
|
3717
|
+
this._split(start);
|
|
3718
|
+
this._split(end);
|
|
3719
|
+
let chunk = this.byStart[start];
|
|
3720
|
+
while (chunk) {
|
|
3721
|
+
chunk.reset();
|
|
3722
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
3723
|
+
}
|
|
3724
|
+
return this;
|
|
3725
|
+
}
|
|
3726
|
+
lastChar() {
|
|
3727
|
+
if (this.outro.length)
|
|
3728
|
+
return this.outro[this.outro.length - 1];
|
|
3729
|
+
let chunk = this.lastChunk;
|
|
3730
|
+
do {
|
|
3731
|
+
if (chunk.outro.length)
|
|
3732
|
+
return chunk.outro[chunk.outro.length - 1];
|
|
3733
|
+
if (chunk.content.length)
|
|
3734
|
+
return chunk.content[chunk.content.length - 1];
|
|
3735
|
+
if (chunk.intro.length)
|
|
3736
|
+
return chunk.intro[chunk.intro.length - 1];
|
|
3737
|
+
} while (chunk = chunk.previous);
|
|
3738
|
+
if (this.intro.length)
|
|
3739
|
+
return this.intro[this.intro.length - 1];
|
|
3740
|
+
return "";
|
|
3741
|
+
}
|
|
3742
|
+
lastLine() {
|
|
3743
|
+
let lineIndex = this.outro.lastIndexOf(n);
|
|
3744
|
+
if (lineIndex !== -1)
|
|
3745
|
+
return this.outro.substr(lineIndex + 1);
|
|
3746
|
+
let lineStr = this.outro;
|
|
3747
|
+
let chunk = this.lastChunk;
|
|
3748
|
+
do {
|
|
3749
|
+
if (chunk.outro.length > 0) {
|
|
3750
|
+
lineIndex = chunk.outro.lastIndexOf(n);
|
|
3751
|
+
if (lineIndex !== -1)
|
|
3752
|
+
return chunk.outro.substr(lineIndex + 1) + lineStr;
|
|
3753
|
+
lineStr = chunk.outro + lineStr;
|
|
3754
|
+
}
|
|
3755
|
+
if (chunk.content.length > 0) {
|
|
3756
|
+
lineIndex = chunk.content.lastIndexOf(n);
|
|
3757
|
+
if (lineIndex !== -1)
|
|
3758
|
+
return chunk.content.substr(lineIndex + 1) + lineStr;
|
|
3759
|
+
lineStr = chunk.content + lineStr;
|
|
3760
|
+
}
|
|
3761
|
+
if (chunk.intro.length > 0) {
|
|
3762
|
+
lineIndex = chunk.intro.lastIndexOf(n);
|
|
3763
|
+
if (lineIndex !== -1)
|
|
3764
|
+
return chunk.intro.substr(lineIndex + 1) + lineStr;
|
|
3765
|
+
lineStr = chunk.intro + lineStr;
|
|
3766
|
+
}
|
|
3767
|
+
} while (chunk = chunk.previous);
|
|
3768
|
+
lineIndex = this.intro.lastIndexOf(n);
|
|
3769
|
+
if (lineIndex !== -1)
|
|
3770
|
+
return this.intro.substr(lineIndex + 1) + lineStr;
|
|
3771
|
+
return this.intro + lineStr;
|
|
3772
|
+
}
|
|
3773
|
+
slice(start = 0, end = this.original.length) {
|
|
3774
|
+
while (start < 0)
|
|
3775
|
+
start += this.original.length;
|
|
3776
|
+
while (end < 0)
|
|
3777
|
+
end += this.original.length;
|
|
3778
|
+
let result = "";
|
|
3779
|
+
let chunk = this.firstChunk;
|
|
3780
|
+
while (chunk && (chunk.start > start || chunk.end <= start)) {
|
|
3781
|
+
if (chunk.start < end && chunk.end >= end) {
|
|
3782
|
+
return result;
|
|
3783
|
+
}
|
|
3784
|
+
chunk = chunk.next;
|
|
3785
|
+
}
|
|
3786
|
+
if (chunk && chunk.edited && chunk.start !== start)
|
|
3787
|
+
throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
|
|
3788
|
+
const startChunk = chunk;
|
|
3789
|
+
while (chunk) {
|
|
3790
|
+
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
|
|
3791
|
+
result += chunk.intro;
|
|
3792
|
+
}
|
|
3793
|
+
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
3794
|
+
if (containsEnd && chunk.edited && chunk.end !== end)
|
|
3795
|
+
throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
|
|
3796
|
+
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
3797
|
+
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
3798
|
+
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
3799
|
+
if (chunk.outro && (!containsEnd || chunk.end === end)) {
|
|
3800
|
+
result += chunk.outro;
|
|
3801
|
+
}
|
|
3802
|
+
if (containsEnd) {
|
|
3803
|
+
break;
|
|
3804
|
+
}
|
|
3805
|
+
chunk = chunk.next;
|
|
3806
|
+
}
|
|
3807
|
+
return result;
|
|
3808
|
+
}
|
|
3809
|
+
snip(start, end) {
|
|
3810
|
+
const clone = this.clone();
|
|
3811
|
+
clone.remove(0, start);
|
|
3812
|
+
clone.remove(end, clone.original.length);
|
|
3813
|
+
return clone;
|
|
3814
|
+
}
|
|
3815
|
+
_split(index) {
|
|
3816
|
+
if (this.byStart[index] || this.byEnd[index])
|
|
3817
|
+
return;
|
|
3818
|
+
let chunk = this.lastSearchedChunk;
|
|
3819
|
+
const searchForward = index > chunk.end;
|
|
3820
|
+
while (chunk) {
|
|
3821
|
+
if (chunk.contains(index))
|
|
3822
|
+
return this._splitChunk(chunk, index);
|
|
3823
|
+
chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
_splitChunk(chunk, index) {
|
|
3827
|
+
if (chunk.edited && chunk.content.length) {
|
|
3828
|
+
const loc = getLocator(this.original)(index);
|
|
3829
|
+
throw new Error(
|
|
3830
|
+
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} \u2013 "${chunk.original}")`
|
|
3831
|
+
);
|
|
3832
|
+
}
|
|
3833
|
+
const newChunk = chunk.split(index);
|
|
3834
|
+
this.byEnd[index] = chunk;
|
|
3835
|
+
this.byStart[index] = newChunk;
|
|
3836
|
+
this.byEnd[newChunk.end] = newChunk;
|
|
3837
|
+
if (chunk === this.lastChunk)
|
|
3838
|
+
this.lastChunk = newChunk;
|
|
3839
|
+
this.lastSearchedChunk = chunk;
|
|
3840
|
+
return true;
|
|
3841
|
+
}
|
|
3842
|
+
toString() {
|
|
3843
|
+
let str = this.intro;
|
|
3844
|
+
let chunk = this.firstChunk;
|
|
3845
|
+
while (chunk) {
|
|
3846
|
+
str += chunk.toString();
|
|
3847
|
+
chunk = chunk.next;
|
|
3848
|
+
}
|
|
3849
|
+
return str + this.outro;
|
|
3850
|
+
}
|
|
3851
|
+
isEmpty() {
|
|
3852
|
+
let chunk = this.firstChunk;
|
|
3853
|
+
do {
|
|
3854
|
+
if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim())
|
|
3855
|
+
return false;
|
|
3856
|
+
} while (chunk = chunk.next);
|
|
3857
|
+
return true;
|
|
3858
|
+
}
|
|
3859
|
+
length() {
|
|
3860
|
+
let chunk = this.firstChunk;
|
|
3861
|
+
let length = 0;
|
|
3862
|
+
do {
|
|
3863
|
+
length += chunk.intro.length + chunk.content.length + chunk.outro.length;
|
|
3864
|
+
} while (chunk = chunk.next);
|
|
3865
|
+
return length;
|
|
3866
|
+
}
|
|
3867
|
+
trimLines() {
|
|
3868
|
+
return this.trim("[\\r\\n]");
|
|
3869
|
+
}
|
|
3870
|
+
trim(charType) {
|
|
3871
|
+
return this.trimStart(charType).trimEnd(charType);
|
|
3872
|
+
}
|
|
3873
|
+
trimEndAborted(charType) {
|
|
3874
|
+
const rx = new RegExp((charType || "\\s") + "+$");
|
|
3875
|
+
this.outro = this.outro.replace(rx, "");
|
|
3876
|
+
if (this.outro.length)
|
|
3877
|
+
return true;
|
|
3878
|
+
let chunk = this.lastChunk;
|
|
3879
|
+
do {
|
|
3880
|
+
const end = chunk.end;
|
|
3881
|
+
const aborted = chunk.trimEnd(rx);
|
|
3882
|
+
if (chunk.end !== end) {
|
|
3883
|
+
if (this.lastChunk === chunk) {
|
|
3884
|
+
this.lastChunk = chunk.next;
|
|
3885
|
+
}
|
|
3886
|
+
this.byEnd[chunk.end] = chunk;
|
|
3887
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
3888
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
3889
|
+
}
|
|
3890
|
+
if (aborted)
|
|
3891
|
+
return true;
|
|
3892
|
+
chunk = chunk.previous;
|
|
3893
|
+
} while (chunk);
|
|
3894
|
+
return false;
|
|
3895
|
+
}
|
|
3896
|
+
trimEnd(charType) {
|
|
3897
|
+
this.trimEndAborted(charType);
|
|
3898
|
+
return this;
|
|
3899
|
+
}
|
|
3900
|
+
trimStartAborted(charType) {
|
|
3901
|
+
const rx = new RegExp("^" + (charType || "\\s") + "+");
|
|
3902
|
+
this.intro = this.intro.replace(rx, "");
|
|
3903
|
+
if (this.intro.length)
|
|
3904
|
+
return true;
|
|
3905
|
+
let chunk = this.firstChunk;
|
|
3906
|
+
do {
|
|
3907
|
+
const end = chunk.end;
|
|
3908
|
+
const aborted = chunk.trimStart(rx);
|
|
3909
|
+
if (chunk.end !== end) {
|
|
3910
|
+
if (chunk === this.lastChunk)
|
|
3911
|
+
this.lastChunk = chunk.next;
|
|
3912
|
+
this.byEnd[chunk.end] = chunk;
|
|
3913
|
+
this.byStart[chunk.next.start] = chunk.next;
|
|
3914
|
+
this.byEnd[chunk.next.end] = chunk.next;
|
|
3915
|
+
}
|
|
3916
|
+
if (aborted)
|
|
3917
|
+
return true;
|
|
3918
|
+
chunk = chunk.next;
|
|
3919
|
+
} while (chunk);
|
|
3920
|
+
return false;
|
|
3921
|
+
}
|
|
3922
|
+
trimStart(charType) {
|
|
3923
|
+
this.trimStartAborted(charType);
|
|
3924
|
+
return this;
|
|
3925
|
+
}
|
|
3926
|
+
hasChanged() {
|
|
3927
|
+
return this.original !== this.toString();
|
|
3928
|
+
}
|
|
3929
|
+
_replaceRegexp(searchValue, replacement) {
|
|
3930
|
+
function getReplacement(match, str) {
|
|
3931
|
+
if (typeof replacement === "string") {
|
|
3932
|
+
return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
|
|
3933
|
+
if (i === "$")
|
|
3934
|
+
return "$";
|
|
3935
|
+
if (i === "&")
|
|
3936
|
+
return match[0];
|
|
3937
|
+
const num = +i;
|
|
3938
|
+
if (num < match.length)
|
|
3939
|
+
return match[+i];
|
|
3940
|
+
return `$${i}`;
|
|
3941
|
+
});
|
|
3942
|
+
} else {
|
|
3943
|
+
return replacement(...match, match.index, str, match.groups);
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
function matchAll(re, str) {
|
|
3947
|
+
let match;
|
|
3948
|
+
const matches = [];
|
|
3949
|
+
while (match = re.exec(str)) {
|
|
3950
|
+
matches.push(match);
|
|
3951
|
+
}
|
|
3952
|
+
return matches;
|
|
3953
|
+
}
|
|
3954
|
+
if (searchValue.global) {
|
|
3955
|
+
const matches = matchAll(searchValue, this.original);
|
|
3956
|
+
matches.forEach((match) => {
|
|
3957
|
+
if (match.index != null)
|
|
3958
|
+
this.overwrite(
|
|
3959
|
+
match.index,
|
|
3960
|
+
match.index + match[0].length,
|
|
3961
|
+
getReplacement(match, this.original)
|
|
3962
|
+
);
|
|
3963
|
+
});
|
|
3964
|
+
} else {
|
|
3965
|
+
const match = this.original.match(searchValue);
|
|
3966
|
+
if (match && match.index != null)
|
|
3967
|
+
this.overwrite(
|
|
3968
|
+
match.index,
|
|
3969
|
+
match.index + match[0].length,
|
|
3970
|
+
getReplacement(match, this.original)
|
|
3971
|
+
);
|
|
3972
|
+
}
|
|
3973
|
+
return this;
|
|
3974
|
+
}
|
|
3975
|
+
_replaceString(string, replacement) {
|
|
3976
|
+
const { original } = this;
|
|
3977
|
+
const index = original.indexOf(string);
|
|
3978
|
+
if (index !== -1) {
|
|
3979
|
+
this.overwrite(index, index + string.length, replacement);
|
|
3980
|
+
}
|
|
3981
|
+
return this;
|
|
3982
|
+
}
|
|
3983
|
+
replace(searchValue, replacement) {
|
|
3984
|
+
if (typeof searchValue === "string") {
|
|
3985
|
+
return this._replaceString(searchValue, replacement);
|
|
3986
|
+
}
|
|
3987
|
+
return this._replaceRegexp(searchValue, replacement);
|
|
3988
|
+
}
|
|
3989
|
+
_replaceAllString(string, replacement) {
|
|
3990
|
+
const { original } = this;
|
|
3991
|
+
const stringLength = string.length;
|
|
3992
|
+
for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
|
|
3993
|
+
this.overwrite(index, index + stringLength, replacement);
|
|
3994
|
+
}
|
|
3995
|
+
return this;
|
|
3996
|
+
}
|
|
3997
|
+
replaceAll(searchValue, replacement) {
|
|
3998
|
+
if (typeof searchValue === "string") {
|
|
3999
|
+
return this._replaceAllString(searchValue, replacement);
|
|
4000
|
+
}
|
|
4001
|
+
if (!searchValue.global) {
|
|
4002
|
+
throw new TypeError(
|
|
4003
|
+
"MagicString.prototype.replaceAll called with a non-global RegExp argument"
|
|
4004
|
+
);
|
|
4005
|
+
}
|
|
4006
|
+
return this._replaceRegexp(searchValue, replacement);
|
|
4007
|
+
}
|
|
4008
|
+
};
|
|
4009
|
+
|
|
2999
4010
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
3000
4011
|
import ts31 from "typescript";
|
|
3001
4012
|
|
|
@@ -3075,7 +4086,7 @@ var ReferenceEmitEnvironment = class {
|
|
|
3075
4086
|
}
|
|
3076
4087
|
referenceExternalSymbol(moduleName, name) {
|
|
3077
4088
|
const external = new ExternalExpr({ moduleName, name });
|
|
3078
|
-
return translateExpression(external, this.importManager);
|
|
4089
|
+
return translateExpression(this.contextFile, external, this.importManager);
|
|
3079
4090
|
}
|
|
3080
4091
|
referenceExternalType(moduleName, name, typeParams) {
|
|
3081
4092
|
const external = new ExternalExpr({ moduleName, name });
|
|
@@ -3168,13 +4179,6 @@ function tsNumericExpression(value) {
|
|
|
3168
4179
|
}
|
|
3169
4180
|
return ts20.factory.createNumericLiteral(value);
|
|
3170
4181
|
}
|
|
3171
|
-
function getImportString(imp) {
|
|
3172
|
-
if (imp.qualifier === null) {
|
|
3173
|
-
return `import from '${imp.specifier}';`;
|
|
3174
|
-
} else {
|
|
3175
|
-
return `import * as ${imp.qualifier.text} from '${imp.specifier}';`;
|
|
3176
|
-
}
|
|
3177
|
-
}
|
|
3178
4182
|
|
|
3179
4183
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
3180
4184
|
import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers2, WrappedNodeExpr } from "@angular/compiler";
|
|
@@ -3263,8 +4267,8 @@ var TypeParameterEmitter = class {
|
|
|
3263
4267
|
};
|
|
3264
4268
|
|
|
3265
4269
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
3266
|
-
var
|
|
3267
|
-
R3Identifiers.InputSignalBrandWriteType
|
|
4270
|
+
var TCB_FILE_IMPORT_GRAPH_PREPARE_IDENTIFIERS = [
|
|
4271
|
+
R3Identifiers.InputSignalBrandWriteType
|
|
3268
4272
|
];
|
|
3269
4273
|
var TcbInliningRequirement;
|
|
3270
4274
|
(function(TcbInliningRequirement2) {
|
|
@@ -3341,8 +4345,12 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
3341
4345
|
}) || null;
|
|
3342
4346
|
}
|
|
3343
4347
|
function ensureTypeCheckFilePreparationImports(env) {
|
|
3344
|
-
for (const
|
|
3345
|
-
env.importManager.
|
|
4348
|
+
for (const identifier of TCB_FILE_IMPORT_GRAPH_PREPARE_IDENTIFIERS) {
|
|
4349
|
+
env.importManager.addImport({
|
|
4350
|
+
exportModuleSpecifier: identifier.moduleName,
|
|
4351
|
+
exportSymbolName: identifier.name,
|
|
4352
|
+
requestedFile: env.contextFile
|
|
4353
|
+
});
|
|
3346
4354
|
}
|
|
3347
4355
|
}
|
|
3348
4356
|
function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
@@ -3534,7 +4542,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
3534
4542
|
reference(ref) {
|
|
3535
4543
|
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
|
|
3536
4544
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
|
|
3537
|
-
return translateExpression(ngExpr.expression, this.importManager);
|
|
4545
|
+
return translateExpression(this.contextFile, ngExpr.expression, this.importManager);
|
|
3538
4546
|
}
|
|
3539
4547
|
emitTypeParameters(declaration) {
|
|
3540
4548
|
const emitter = new TypeParameterEmitter(declaration.typeParameters, this.reflector);
|
|
@@ -3682,7 +4690,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
3682
4690
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts25.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
3683
4691
|
}
|
|
3684
4692
|
missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
|
|
3685
|
-
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((
|
|
4693
|
+
const message = `Required input${inputAliases.length === 1 ? "" : "s"} ${inputAliases.map((n2) => `'${n2}'`).join(", ")} from ${isComponent ? "component" : "directive"} ${directiveName} must be specified.`;
|
|
3686
4694
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts25.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
3687
4695
|
}
|
|
3688
4696
|
illegalForLoopTrackAccess(templateId, block, access) {
|
|
@@ -5656,7 +6664,10 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
|
5656
6664
|
import ts30 from "typescript";
|
|
5657
6665
|
var TypeCheckFile = class extends Environment {
|
|
5658
6666
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
5659
|
-
super(config, new ImportManager(
|
|
6667
|
+
super(config, new ImportManager({
|
|
6668
|
+
forceGenerateNamespacesForNewImports: true,
|
|
6669
|
+
shouldUseSingleQuotes: () => true
|
|
6670
|
+
}), refEmitter, reflector, ts30.createSourceFile(compilerHost.getCanonicalFileName(fileName), "", ts30.ScriptTarget.Latest, true));
|
|
5660
6671
|
this.fileName = fileName;
|
|
5661
6672
|
this.nextTcbId = 1;
|
|
5662
6673
|
this.tcbStatements = [];
|
|
@@ -5668,8 +6679,16 @@ var TypeCheckFile = class extends Environment {
|
|
|
5668
6679
|
}
|
|
5669
6680
|
render(removeComments) {
|
|
5670
6681
|
ensureTypeCheckFilePreparationImports(this);
|
|
5671
|
-
|
|
6682
|
+
const importChanges = this.importManager.finalize();
|
|
6683
|
+
if (importChanges.updatedImports.size > 0) {
|
|
6684
|
+
throw new Error("AssertionError: Expected no imports to be updated for a new type check file.");
|
|
6685
|
+
}
|
|
5672
6686
|
const printer = ts30.createPrinter({ removeComments });
|
|
6687
|
+
let source = "";
|
|
6688
|
+
const newImports = importChanges.newImports.get(this.contextFile.fileName);
|
|
6689
|
+
if (newImports !== void 0) {
|
|
6690
|
+
source += newImports.map((i) => printer.printNode(ts30.EmitHint.Unspecified, i, this.contextFile)).join("\n");
|
|
6691
|
+
}
|
|
5673
6692
|
source += "\n";
|
|
5674
6693
|
for (const stmt of this.pipeInstStatements) {
|
|
5675
6694
|
source += printer.printNode(ts30.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
@@ -5792,18 +6811,44 @@ var TypeCheckContextImpl = class {
|
|
|
5792
6811
|
if (!this.opMap.has(sf)) {
|
|
5793
6812
|
return null;
|
|
5794
6813
|
}
|
|
5795
|
-
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
5796
|
-
const ops = this.opMap.get(sf).sort(orderOps);
|
|
5797
|
-
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
5798
6814
|
const printer = ts31.createPrinter({ omitTrailingSemicolon: true });
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
code += "\n\n" + text + textParts[idx + 1];
|
|
6815
|
+
const importManager = new ImportManager({
|
|
6816
|
+
forceGenerateNamespacesForNewImports: true,
|
|
6817
|
+
shouldUseSingleQuotes: () => true
|
|
5803
6818
|
});
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
6819
|
+
const updates = this.opMap.get(sf).map((op) => {
|
|
6820
|
+
return {
|
|
6821
|
+
pos: op.splitPoint,
|
|
6822
|
+
text: op.execute(importManager, sf, this.refEmitter, printer)
|
|
6823
|
+
};
|
|
6824
|
+
});
|
|
6825
|
+
const { newImports, updatedImports } = importManager.finalize();
|
|
6826
|
+
if (newImports.has(sf.fileName)) {
|
|
6827
|
+
newImports.get(sf.fileName).forEach((newImport) => {
|
|
6828
|
+
updates.push({
|
|
6829
|
+
pos: 0,
|
|
6830
|
+
text: printer.printNode(ts31.EmitHint.Unspecified, newImport, sf)
|
|
6831
|
+
});
|
|
6832
|
+
});
|
|
6833
|
+
}
|
|
6834
|
+
for (const [oldBindings, newBindings] of updatedImports.entries()) {
|
|
6835
|
+
if (oldBindings.getSourceFile() !== sf) {
|
|
6836
|
+
throw new Error("Unexpected updates to unrelated source files.");
|
|
6837
|
+
}
|
|
6838
|
+
updates.push({
|
|
6839
|
+
pos: oldBindings.getStart(),
|
|
6840
|
+
deletePos: oldBindings.getEnd(),
|
|
6841
|
+
text: printer.printNode(ts31.EmitHint.Unspecified, newBindings, sf)
|
|
6842
|
+
});
|
|
6843
|
+
}
|
|
6844
|
+
const result = new MagicString(sf.text, { filename: sf.fileName });
|
|
6845
|
+
for (const update of updates) {
|
|
6846
|
+
if (update.deletePos !== void 0) {
|
|
6847
|
+
result.remove(update.pos, update.deletePos);
|
|
6848
|
+
}
|
|
6849
|
+
result.appendLeft(update.pos, update.text);
|
|
6850
|
+
}
|
|
6851
|
+
return result.toString();
|
|
5807
6852
|
}
|
|
5808
6853
|
finalize() {
|
|
5809
6854
|
const updates = /* @__PURE__ */ new Map();
|
|
@@ -5914,20 +6959,6 @@ var TypeCtorOp = class {
|
|
|
5914
6959
|
return printer.printNode(ts31.EmitHint.Unspecified, tcb, sf);
|
|
5915
6960
|
}
|
|
5916
6961
|
};
|
|
5917
|
-
function orderOps(op1, op2) {
|
|
5918
|
-
return op1.splitPoint - op2.splitPoint;
|
|
5919
|
-
}
|
|
5920
|
-
function splitStringAtPoints(str, points) {
|
|
5921
|
-
const splits = [];
|
|
5922
|
-
let start = 0;
|
|
5923
|
-
for (let i = 0; i < points.length; i++) {
|
|
5924
|
-
const point = points[i];
|
|
5925
|
-
splits.push(str.substring(start, point));
|
|
5926
|
-
start = point;
|
|
5927
|
-
}
|
|
5928
|
-
splits.push(str.substring(start));
|
|
5929
|
-
return splits;
|
|
5930
|
-
}
|
|
5931
6962
|
|
|
5932
6963
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
5933
6964
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
@@ -6195,14 +7226,14 @@ var SymbolBuilder = class {
|
|
|
6195
7226
|
}
|
|
6196
7227
|
expectedAccess = bindingPropertyNames[0].classPropertyName;
|
|
6197
7228
|
}
|
|
6198
|
-
function filter(
|
|
6199
|
-
if (!isAccessExpression(
|
|
7229
|
+
function filter(n2) {
|
|
7230
|
+
if (!isAccessExpression(n2)) {
|
|
6200
7231
|
return false;
|
|
6201
7232
|
}
|
|
6202
|
-
if (ts32.isPropertyAccessExpression(
|
|
6203
|
-
return
|
|
7233
|
+
if (ts32.isPropertyAccessExpression(n2)) {
|
|
7234
|
+
return n2.name.getText() === expectedAccess;
|
|
6204
7235
|
} else {
|
|
6205
|
-
return ts32.isStringLiteral(
|
|
7236
|
+
return ts32.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
|
|
6206
7237
|
}
|
|
6207
7238
|
}
|
|
6208
7239
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
@@ -6520,7 +7551,7 @@ var SymbolBuilder = class {
|
|
|
6520
7551
|
}
|
|
6521
7552
|
}
|
|
6522
7553
|
};
|
|
6523
|
-
function anyNodeFilter(
|
|
7554
|
+
function anyNodeFilter(n2) {
|
|
6524
7555
|
return true;
|
|
6525
7556
|
}
|
|
6526
7557
|
function sourceSpanEqual(a, b) {
|
|
@@ -7854,6 +8885,25 @@ function unwrapAstWithSource(ast) {
|
|
|
7854
8885
|
return ast instanceof ASTWithSource5 ? ast.ast : ast;
|
|
7855
8886
|
}
|
|
7856
8887
|
|
|
8888
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/core_version.mjs
|
|
8889
|
+
function coreHasSymbol(program, symbol) {
|
|
8890
|
+
const checker = program.getTypeChecker();
|
|
8891
|
+
for (const sf of program.getSourceFiles().filter(isMaybeCore)) {
|
|
8892
|
+
const sym = checker.getSymbolAtLocation(sf);
|
|
8893
|
+
if (sym === void 0 || sym.exports === void 0) {
|
|
8894
|
+
continue;
|
|
8895
|
+
}
|
|
8896
|
+
if (!sym.exports.has("\u0275\u0275template")) {
|
|
8897
|
+
continue;
|
|
8898
|
+
}
|
|
8899
|
+
return sym.exports.has(symbol.name);
|
|
8900
|
+
}
|
|
8901
|
+
return null;
|
|
8902
|
+
}
|
|
8903
|
+
function isMaybeCore(sf) {
|
|
8904
|
+
return sf.isDeclarationFile && sf.fileName.includes("@angular/core") && sf.fileName.endsWith("index.d.ts");
|
|
8905
|
+
}
|
|
8906
|
+
|
|
7857
8907
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/feature_detection.mjs
|
|
7858
8908
|
import semver from "semver";
|
|
7859
8909
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
@@ -8211,10 +9261,10 @@ var NgCompiler = class {
|
|
|
8211
9261
|
return strictTemplates || !!this.options.fullTemplateTypeCheck;
|
|
8212
9262
|
}
|
|
8213
9263
|
getTypeCheckingConfig() {
|
|
8214
|
-
var _a, _b, _c, _d;
|
|
9264
|
+
var _a, _b, _c, _d, _e;
|
|
8215
9265
|
const strictTemplates = !!this.options.strictTemplates;
|
|
8216
9266
|
const useInlineTypeConstructors = this.programDriver.supportsInlineOperations;
|
|
8217
|
-
|
|
9267
|
+
let allowSignalsInTwoWayBindings = (_a = coreHasSymbol(this.inputProgram, R3Identifiers5.unwrapWritableSignal)) != null ? _a : this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 17.2.0-0");
|
|
8218
9268
|
let typeCheckingConfig;
|
|
8219
9269
|
if (this.fullTemplateTypeCheck) {
|
|
8220
9270
|
typeCheckingConfig = {
|
|
@@ -8239,7 +9289,7 @@ var NgCompiler = class {
|
|
|
8239
9289
|
enableTemplateTypeChecker: this.enableTemplateTypeChecker,
|
|
8240
9290
|
useInlineTypeConstructors,
|
|
8241
9291
|
suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates,
|
|
8242
|
-
controlFlowPreventingContentProjection: ((
|
|
9292
|
+
controlFlowPreventingContentProjection: ((_b = this.options.extendedDiagnostics) == null ? void 0 : _b.defaultCategory) || DiagnosticCategoryLabel.Warning,
|
|
8243
9293
|
allowSignalsInTwoWayBindings
|
|
8244
9294
|
};
|
|
8245
9295
|
} else {
|
|
@@ -8265,7 +9315,7 @@ var NgCompiler = class {
|
|
|
8265
9315
|
enableTemplateTypeChecker: this.enableTemplateTypeChecker,
|
|
8266
9316
|
useInlineTypeConstructors,
|
|
8267
9317
|
suggestionsForSuboptimalTypeInference: false,
|
|
8268
|
-
controlFlowPreventingContentProjection: ((
|
|
9318
|
+
controlFlowPreventingContentProjection: ((_c = this.options.extendedDiagnostics) == null ? void 0 : _c.defaultCategory) || DiagnosticCategoryLabel.Warning,
|
|
8269
9319
|
allowSignalsInTwoWayBindings
|
|
8270
9320
|
};
|
|
8271
9321
|
}
|
|
@@ -8301,7 +9351,7 @@ var NgCompiler = class {
|
|
|
8301
9351
|
if (this.options.strictLiteralTypes !== void 0) {
|
|
8302
9352
|
typeCheckingConfig.strictLiteralTypes = this.options.strictLiteralTypes;
|
|
8303
9353
|
}
|
|
8304
|
-
if (((
|
|
9354
|
+
if (((_e = (_d = this.options.extendedDiagnostics) == null ? void 0 : _d.checks) == null ? void 0 : _e.controlFlowPreventingContentProjection) !== void 0) {
|
|
8305
9355
|
typeCheckingConfig.controlFlowPreventingContentProjection = this.options.extendedDiagnostics.checks.controlFlowPreventingContentProjection;
|
|
8306
9356
|
}
|
|
8307
9357
|
return typeCheckingConfig;
|
|
@@ -9255,4 +10305,4 @@ export {
|
|
|
9255
10305
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9256
10306
|
* found in the LICENSE file at https://angular.io/license
|
|
9257
10307
|
*/
|
|
9258
|
-
//# sourceMappingURL=chunk-
|
|
10308
|
+
//# sourceMappingURL=chunk-ALDR4XSX.js.map
|