@angular/compiler-cli 17.3.1 → 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-VH6EDOMC.js → chunk-ALDR4XSX.js} +1095 -66
- package/bundles/chunk-ALDR4XSX.js.map +6 -0
- package/bundles/{chunk-OXIOYWLB.js → chunk-AWB4ZG2D.js} +24 -24
- package/bundles/chunk-AWB4ZG2D.js.map +6 -0
- package/bundles/{chunk-F2QV65AH.js → chunk-B454JZVO.js} +2 -2
- package/bundles/{chunk-E5DF5SRS.js → chunk-C4L7A7U3.js} +24 -40
- 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-3ESFLGKJ.js → chunk-OHOBDHII.js} +248 -288
- 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/index.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +1 -2
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -2
- 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/annotations/component/src/handler.d.ts +2 -4
- package/src/ngtsc/annotations/component/src/metadata.d.ts +36 -7
- package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -2
- package/src/ngtsc/annotations/directive/src/shared.d.ts +1 -1
- package/src/ngtsc/core/api/src/public_options.d.ts +0 -4
- 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-3ESFLGKJ.js.map +0 -6
- package/bundles/chunk-6X7GQ6BQ.js.map +0 -6
- package/bundles/chunk-E5DF5SRS.js.map +0 -6
- package/bundles/chunk-OXIOYWLB.js.map +0 -6
- package/bundles/chunk-VH6EDOMC.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-F2QV65AH.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,
|
|
@@ -1003,8 +1003,8 @@ function extractEnumMembers(declaration, checker) {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
function getEnumMemberValue(memberNode) {
|
|
1005
1005
|
var _a;
|
|
1006
|
-
const literal = memberNode.getChildren().find((
|
|
1007
|
-
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);
|
|
1008
1008
|
});
|
|
1009
1009
|
return (_a = literal == null ? void 0 : literal.getText()) != null ? _a : "";
|
|
1010
1010
|
}
|
|
@@ -2955,7 +2955,7 @@ var CompletionEngine = class {
|
|
|
2955
2955
|
}
|
|
2956
2956
|
} else {
|
|
2957
2957
|
tsExpr = findFirstMatchingNode(this.tcb, {
|
|
2958
|
-
filter: (
|
|
2958
|
+
filter: (n2) => ts18.isStringLiteral(n2) || ts18.isNumericLiteral(n2),
|
|
2959
2959
|
withSpan: expr.sourceSpan
|
|
2960
2960
|
});
|
|
2961
2961
|
}
|
|
@@ -2997,6 +2997,1016 @@ var CompletionEngine = class {
|
|
|
2997
2997
|
}
|
|
2998
2998
|
};
|
|
2999
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
|
+
|
|
3000
4010
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
3001
4011
|
import ts31 from "typescript";
|
|
3002
4012
|
|
|
@@ -3076,7 +4086,7 @@ var ReferenceEmitEnvironment = class {
|
|
|
3076
4086
|
}
|
|
3077
4087
|
referenceExternalSymbol(moduleName, name) {
|
|
3078
4088
|
const external = new ExternalExpr({ moduleName, name });
|
|
3079
|
-
return translateExpression(external, this.importManager);
|
|
4089
|
+
return translateExpression(this.contextFile, external, this.importManager);
|
|
3080
4090
|
}
|
|
3081
4091
|
referenceExternalType(moduleName, name, typeParams) {
|
|
3082
4092
|
const external = new ExternalExpr({ moduleName, name });
|
|
@@ -3169,13 +4179,6 @@ function tsNumericExpression(value) {
|
|
|
3169
4179
|
}
|
|
3170
4180
|
return ts20.factory.createNumericLiteral(value);
|
|
3171
4181
|
}
|
|
3172
|
-
function getImportString(imp) {
|
|
3173
|
-
if (imp.qualifier === null) {
|
|
3174
|
-
return `import from '${imp.specifier}';`;
|
|
3175
|
-
} else {
|
|
3176
|
-
return `import * as ${imp.qualifier.text} from '${imp.specifier}';`;
|
|
3177
|
-
}
|
|
3178
|
-
}
|
|
3179
4182
|
|
|
3180
4183
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
3181
4184
|
import { ExpressionType as ExpressionType2, R3Identifiers as R3Identifiers2, WrappedNodeExpr } from "@angular/compiler";
|
|
@@ -3264,8 +4267,8 @@ var TypeParameterEmitter = class {
|
|
|
3264
4267
|
};
|
|
3265
4268
|
|
|
3266
4269
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
3267
|
-
var
|
|
3268
|
-
R3Identifiers.InputSignalBrandWriteType
|
|
4270
|
+
var TCB_FILE_IMPORT_GRAPH_PREPARE_IDENTIFIERS = [
|
|
4271
|
+
R3Identifiers.InputSignalBrandWriteType
|
|
3269
4272
|
];
|
|
3270
4273
|
var TcbInliningRequirement;
|
|
3271
4274
|
(function(TcbInliningRequirement2) {
|
|
@@ -3342,8 +4345,12 @@ function getTemplateId2(node, sourceFile, isDiagnosticRequest) {
|
|
|
3342
4345
|
}) || null;
|
|
3343
4346
|
}
|
|
3344
4347
|
function ensureTypeCheckFilePreparationImports(env) {
|
|
3345
|
-
for (const
|
|
3346
|
-
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
|
+
});
|
|
3347
4354
|
}
|
|
3348
4355
|
}
|
|
3349
4356
|
function checkIfGenericTypeBoundsCanBeEmitted(node, reflector, env) {
|
|
@@ -3535,7 +4542,7 @@ var Environment = class extends ReferenceEmitEnvironment {
|
|
|
3535
4542
|
reference(ref) {
|
|
3536
4543
|
const ngExpr = this.refEmitter.emit(ref, this.contextFile, ImportFlags.NoAliasing);
|
|
3537
4544
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
|
|
3538
|
-
return translateExpression(ngExpr.expression, this.importManager);
|
|
4545
|
+
return translateExpression(this.contextFile, ngExpr.expression, this.importManager);
|
|
3539
4546
|
}
|
|
3540
4547
|
emitTypeParameters(declaration) {
|
|
3541
4548
|
const emitter = new TypeParameterEmitter(declaration.typeParameters, this.reflector);
|
|
@@ -3683,7 +4690,7 @@ Consider enabling the 'strictTemplates' option in your tsconfig.json for better
|
|
|
3683
4690
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, input.keySpan, ts25.DiagnosticCategory.Error, ngErrorCode(ErrorCode.SPLIT_TWO_WAY_BINDING), errorMsg, relatedMessages));
|
|
3684
4691
|
}
|
|
3685
4692
|
missingRequiredInputs(templateId, element, directiveName, isComponent, inputAliases) {
|
|
3686
|
-
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.`;
|
|
3687
4694
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), element.startSourceSpan, ts25.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REQUIRED_INPUTS), message));
|
|
3688
4695
|
}
|
|
3689
4696
|
illegalForLoopTrackAccess(templateId, block, access) {
|
|
@@ -3755,7 +4762,7 @@ var TypeCheckShimGenerator = class {
|
|
|
3755
4762
|
};
|
|
3756
4763
|
|
|
3757
4764
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
3758
|
-
import { BindingPipe, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock as TmplAstForLoopBlock2, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TransplantedType } from "@angular/compiler";
|
|
4765
|
+
import { BindingPipe, BindingType, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver3, ParsedEventType, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock as TmplAstForLoopBlock2, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable, TransplantedType } from "@angular/compiler";
|
|
3759
4766
|
import ts29 from "typescript";
|
|
3760
4767
|
|
|
3761
4768
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
@@ -4604,7 +5611,7 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
|
|
|
4604
5611
|
this.tcb.domSchemaChecker.checkElement(this.tcb.id, this.element, this.tcb.schemas, this.tcb.hostIsStandalone);
|
|
4605
5612
|
}
|
|
4606
5613
|
for (const binding of this.element.inputs) {
|
|
4607
|
-
const isPropertyBinding = binding.type ===
|
|
5614
|
+
const isPropertyBinding = binding.type === BindingType.Property || binding.type === BindingType.TwoWay;
|
|
4608
5615
|
if (isPropertyBinding && this.claimedInputs.has(binding.name)) {
|
|
4609
5616
|
continue;
|
|
4610
5617
|
}
|
|
@@ -4712,7 +5719,7 @@ var TcbUnclaimedInputsOp = class extends TcbOp {
|
|
|
4712
5719
|
var _a;
|
|
4713
5720
|
let elId = null;
|
|
4714
5721
|
for (const binding of this.element.inputs) {
|
|
4715
|
-
const isPropertyBinding = binding.type ===
|
|
5722
|
+
const isPropertyBinding = binding.type === BindingType.Property || binding.type === BindingType.TwoWay;
|
|
4716
5723
|
if (isPropertyBinding && this.claimedInputs.has(binding.name)) {
|
|
4717
5724
|
continue;
|
|
4718
5725
|
}
|
|
@@ -4752,7 +5759,7 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
4752
5759
|
let dirId = null;
|
|
4753
5760
|
const outputs = this.dir.outputs;
|
|
4754
5761
|
for (const output of this.node.outputs) {
|
|
4755
|
-
if (output.type ===
|
|
5762
|
+
if (output.type === ParsedEventType.Animation || !outputs.hasBindingPropertyName(output.name)) {
|
|
4756
5763
|
continue;
|
|
4757
5764
|
}
|
|
4758
5765
|
if (this.tcb.env.config.checkTypeOfOutputEvents && output.name.endsWith("Change")) {
|
|
@@ -4803,7 +5810,7 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
4803
5810
|
continue;
|
|
4804
5811
|
}
|
|
4805
5812
|
}
|
|
4806
|
-
if (output.type ===
|
|
5813
|
+
if (output.type === ParsedEventType.Animation) {
|
|
4807
5814
|
const eventType = this.tcb.env.config.checkTypeOfAnimationEvents ? this.tcb.env.referenceExternalType("@angular/animations", "AnimationEvent") : 1;
|
|
4808
5815
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, eventType);
|
|
4809
5816
|
this.scope.addStatement(ts29.factory.createExpressionStatement(handler));
|
|
@@ -5520,7 +6527,7 @@ function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
|
5520
6527
|
function getBoundAttributes(directive, node) {
|
|
5521
6528
|
const boundInputs = [];
|
|
5522
6529
|
const processAttribute = (attr) => {
|
|
5523
|
-
if (attr instanceof TmplAstBoundAttribute && attr.type !==
|
|
6530
|
+
if (attr instanceof TmplAstBoundAttribute && attr.type !== BindingType.Property && attr.type !== BindingType.TwoWay) {
|
|
5524
6531
|
return;
|
|
5525
6532
|
}
|
|
5526
6533
|
const inputs = directive.inputs.getByBindingPropertyName(attr.name);
|
|
@@ -5534,7 +6541,7 @@ function getBoundAttributes(directive, node) {
|
|
|
5534
6541
|
required: input.required,
|
|
5535
6542
|
transformType: ((_a = input.transform) == null ? void 0 : _a.type) || null,
|
|
5536
6543
|
isSignal: input.isSignal,
|
|
5537
|
-
isTwoWayBinding: attr instanceof TmplAstBoundAttribute && attr.type ===
|
|
6544
|
+
isTwoWayBinding: attr instanceof TmplAstBoundAttribute && attr.type === BindingType.TwoWay
|
|
5538
6545
|
};
|
|
5539
6546
|
})
|
|
5540
6547
|
});
|
|
@@ -5657,7 +6664,10 @@ var TcbForLoopTrackTranslator = class extends TcbExpressionTranslator {
|
|
|
5657
6664
|
import ts30 from "typescript";
|
|
5658
6665
|
var TypeCheckFile = class extends Environment {
|
|
5659
6666
|
constructor(fileName, config, refEmitter, reflector, compilerHost) {
|
|
5660
|
-
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));
|
|
5661
6671
|
this.fileName = fileName;
|
|
5662
6672
|
this.nextTcbId = 1;
|
|
5663
6673
|
this.tcbStatements = [];
|
|
@@ -5669,8 +6679,16 @@ var TypeCheckFile = class extends Environment {
|
|
|
5669
6679
|
}
|
|
5670
6680
|
render(removeComments) {
|
|
5671
6681
|
ensureTypeCheckFilePreparationImports(this);
|
|
5672
|
-
|
|
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
|
+
}
|
|
5673
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
|
+
}
|
|
5674
6692
|
source += "\n";
|
|
5675
6693
|
for (const stmt of this.pipeInstStatements) {
|
|
5676
6694
|
source += printer.printNode(ts30.EmitHint.Unspecified, stmt, this.contextFile) + "\n";
|
|
@@ -5793,18 +6811,44 @@ var TypeCheckContextImpl = class {
|
|
|
5793
6811
|
if (!this.opMap.has(sf)) {
|
|
5794
6812
|
return null;
|
|
5795
6813
|
}
|
|
5796
|
-
const importManager = new ImportManager(new NoopImportRewriter(), "_i");
|
|
5797
|
-
const ops = this.opMap.get(sf).sort(orderOps);
|
|
5798
|
-
const textParts = splitStringAtPoints(sf.text, ops.map((op) => op.splitPoint));
|
|
5799
6814
|
const printer = ts31.createPrinter({ omitTrailingSemicolon: true });
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
6815
|
+
const importManager = new ImportManager({
|
|
6816
|
+
forceGenerateNamespacesForNewImports: true,
|
|
6817
|
+
shouldUseSingleQuotes: () => true
|
|
6818
|
+
});
|
|
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
|
+
};
|
|
5804
6824
|
});
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
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();
|
|
5808
6852
|
}
|
|
5809
6853
|
finalize() {
|
|
5810
6854
|
const updates = /* @__PURE__ */ new Map();
|
|
@@ -5915,20 +6959,6 @@ var TypeCtorOp = class {
|
|
|
5915
6959
|
return printer.printNode(ts31.EmitHint.Unspecified, tcb, sf);
|
|
5916
6960
|
}
|
|
5917
6961
|
};
|
|
5918
|
-
function orderOps(op1, op2) {
|
|
5919
|
-
return op1.splitPoint - op2.splitPoint;
|
|
5920
|
-
}
|
|
5921
|
-
function splitStringAtPoints(str, points) {
|
|
5922
|
-
const splits = [];
|
|
5923
|
-
let start = 0;
|
|
5924
|
-
for (let i = 0; i < points.length; i++) {
|
|
5925
|
-
const point = points[i];
|
|
5926
|
-
splits.push(str.substring(start, point));
|
|
5927
|
-
start = point;
|
|
5928
|
-
}
|
|
5929
|
-
splits.push(str.substring(start));
|
|
5930
|
-
return splits;
|
|
5931
|
-
}
|
|
5932
6962
|
|
|
5933
6963
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/source.mjs
|
|
5934
6964
|
import { ParseLocation, ParseSourceSpan } from "@angular/compiler";
|
|
@@ -6196,14 +7226,14 @@ var SymbolBuilder = class {
|
|
|
6196
7226
|
}
|
|
6197
7227
|
expectedAccess = bindingPropertyNames[0].classPropertyName;
|
|
6198
7228
|
}
|
|
6199
|
-
function filter(
|
|
6200
|
-
if (!isAccessExpression(
|
|
7229
|
+
function filter(n2) {
|
|
7230
|
+
if (!isAccessExpression(n2)) {
|
|
6201
7231
|
return false;
|
|
6202
7232
|
}
|
|
6203
|
-
if (ts32.isPropertyAccessExpression(
|
|
6204
|
-
return
|
|
7233
|
+
if (ts32.isPropertyAccessExpression(n2)) {
|
|
7234
|
+
return n2.name.getText() === expectedAccess;
|
|
6205
7235
|
} else {
|
|
6206
|
-
return ts32.isStringLiteral(
|
|
7236
|
+
return ts32.isStringLiteral(n2.argumentExpression) && n2.argumentExpression.text === expectedAccess;
|
|
6207
7237
|
}
|
|
6208
7238
|
}
|
|
6209
7239
|
const outputFieldAccesses = findAllMatchingNodes(this.typeCheckBlock, { withSpan: eventBinding.keySpan, filter });
|
|
@@ -6521,7 +7551,7 @@ var SymbolBuilder = class {
|
|
|
6521
7551
|
}
|
|
6522
7552
|
}
|
|
6523
7553
|
};
|
|
6524
|
-
function anyNodeFilter(
|
|
7554
|
+
function anyNodeFilter(n2) {
|
|
6525
7555
|
return true;
|
|
6526
7556
|
}
|
|
6527
7557
|
function sourceSpanEqual(a, b) {
|
|
@@ -7774,7 +8804,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
7774
8804
|
]);
|
|
7775
8805
|
|
|
7776
8806
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.mjs
|
|
7777
|
-
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver4, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
8807
|
+
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver4, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
7778
8808
|
import ts37 from "typescript";
|
|
7779
8809
|
var TemplateSemanticsCheckerImpl = class {
|
|
7780
8810
|
constructor(templateTypeChecker) {
|
|
@@ -7828,7 +8858,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
|
|
|
7828
8858
|
}
|
|
7829
8859
|
}
|
|
7830
8860
|
checkForIllegalWriteInTwoWayBinding(ast, context) {
|
|
7831
|
-
if (!(context instanceof TmplAstBoundEvent3) || context.type !==
|
|
8861
|
+
if (!(context instanceof TmplAstBoundEvent3) || context.type !== ParsedEventType2.TwoWay || !(ast.receiver instanceof ImplicitReceiver4) || ast !== unwrapAstWithSource(context.handler)) {
|
|
7832
8862
|
return;
|
|
7833
8863
|
}
|
|
7834
8864
|
const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
|
|
@@ -7884,7 +8914,6 @@ function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
|
7884
8914
|
}
|
|
7885
8915
|
|
|
7886
8916
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
7887
|
-
var SHOULD_USE_TEMPLATE_PIPELINE = true;
|
|
7888
8917
|
var CompilationTicketKind;
|
|
7889
8918
|
(function(CompilationTicketKind2) {
|
|
7890
8919
|
CompilationTicketKind2[CompilationTicketKind2["Fresh"] = 0] = "Fresh";
|
|
@@ -8384,7 +9413,7 @@ var NgCompiler = class {
|
|
|
8384
9413
|
return diagnostics;
|
|
8385
9414
|
}
|
|
8386
9415
|
makeCompilation() {
|
|
8387
|
-
var _a, _b, _c, _d
|
|
9416
|
+
var _a, _b, _c, _d;
|
|
8388
9417
|
const isCore = isAngularCorePackage(this.inputProgram);
|
|
8389
9418
|
let compilationMode = CompilationMode.FULL;
|
|
8390
9419
|
if (!isCore) {
|
|
@@ -8475,11 +9504,11 @@ var NgCompiler = class {
|
|
|
8475
9504
|
throw new Error('JIT mode support ("supportJitMode" option) cannot be disabled when forbidOrphanComponents is set to true');
|
|
8476
9505
|
}
|
|
8477
9506
|
const handlers = [
|
|
8478
|
-
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax,
|
|
8479
|
-
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, compilationMode,
|
|
9507
|
+
new ComponentDecoratorHandler(reflector, evaluator, metaRegistry, metaReader, scopeReader, depScopeReader, ngModuleScopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, this.resourceManager, this.adapter.rootDirs, this.options.preserveWhitespaces || false, this.options.i18nUseExternalIds !== false, this.options.enableI18nLegacyMessageIdFormat !== false, this.usePoisonedData, this.options.i18nNormalizeLineEndingsInICUs === true, this.moduleResolver, this.cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, this.incrementalCompilation.depGraph, injectableRegistry, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, hostDirectivesResolver, importTracker, supportTestBed, compilationMode, deferredSymbolsTracker, !!this.options.forbidOrphanComponents, this.enableBlockSyntax, localCompilationExtraImportsTracker),
|
|
9508
|
+
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
|
|
8480
9509
|
new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
|
|
8481
9510
|
new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
|
|
8482
|
-
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (
|
|
9511
|
+
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_d = this.options.onlyPublishPublicTypingsForNgModules) != null ? _d : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode, localCompilationExtraImportsTracker)
|
|
8483
9512
|
];
|
|
8484
9513
|
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
|
|
8485
9514
|
const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
|
|
@@ -9276,4 +10305,4 @@ export {
|
|
|
9276
10305
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9277
10306
|
* found in the LICENSE file at https://angular.io/license
|
|
9278
10307
|
*/
|
|
9279
|
-
//# sourceMappingURL=chunk-
|
|
10308
|
+
//# sourceMappingURL=chunk-ALDR4XSX.js.map
|