@weapp-vite/miniprogram-automator 1.4.0 → 1.5.0
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/dist/index.d.mts +0 -50
- package/dist/index.mjs +48 -89
- package/dist/{launch-ElaGbFxh.mjs → launch-DuW7r68J.mjs} +1063 -932
- package/dist/operation.d.mts +1 -7
- package/dist/operation.mjs +3 -6
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import vm from "node:vm";
|
|
3
3
|
import fs from "node:fs";
|
|
4
|
-
|
|
4
|
+
// \0rolldown/runtime.js
|
|
5
5
|
var __create = Object.create;
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -32,8 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
value: mod,
|
|
33
33
|
enumerable: true
|
|
34
34
|
}) : target, mod));
|
|
35
|
-
|
|
36
|
-
//#region ../../mpcore/packages/simulator/src/runtime/appInstance.ts
|
|
35
|
+
// ../../mpcore/packages/simulator/src/runtime/appInstance.ts
|
|
37
36
|
function bindFunction$2(target, key, value) {
|
|
38
37
|
if (typeof value !== "function") {
|
|
39
38
|
target[key] = value;
|
|
@@ -57,8 +56,7 @@ function createAppInstance(definition) {
|
|
|
57
56
|
}
|
|
58
57
|
return instance;
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
//#region ../../mpcore/packages/simulator/src/host/attachmentBindingUpdates.ts
|
|
59
|
+
// ../../mpcore/packages/simulator/src/host/attachmentBindingUpdates.ts
|
|
62
60
|
const bindingUpdates = /* @__PURE__ */ new WeakMap();
|
|
63
61
|
const instanceScopes = /* @__PURE__ */ new WeakMap();
|
|
64
62
|
/** 实例经渲染上下文归属页面,不扩展公开 renderer context 的参数契约。 */
|
|
@@ -92,8 +90,7 @@ function synchronizeAttachmentBindings(instance) {
|
|
|
92
90
|
state.update();
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/shared.ts
|
|
93
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/shared.ts
|
|
97
94
|
const ARRAY_INDEX_PATH_RE$1 = /\[(\d+)\]/g;
|
|
98
95
|
const ARRAY_INDEX_SEGMENT_RE$1 = /^\d+$/;
|
|
99
96
|
function cloneObject$1(value) {
|
|
@@ -155,8 +152,7 @@ function assignByPath$1(target, path, value) {
|
|
|
155
152
|
function mergeRecord(...records) {
|
|
156
153
|
return Object.assign({}, ...records.filter(Boolean));
|
|
157
154
|
}
|
|
158
|
-
|
|
159
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/observers.ts
|
|
155
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/observers.ts
|
|
160
156
|
function runPropertyObservers(definition, instance, changedKeys, previousProperties) {
|
|
161
157
|
const propOptions = definition.properties;
|
|
162
158
|
if (!propOptions || typeof propOptions !== "object" || Array.isArray(propOptions)) return;
|
|
@@ -212,8 +208,7 @@ function runComponentObservers(definition, instance, changedKeys, previousProper
|
|
|
212
208
|
}
|
|
213
209
|
runPropertyObservers(definition, instance, changedKeys, previousProperties);
|
|
214
210
|
}
|
|
215
|
-
|
|
216
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/lifetimes.ts
|
|
211
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/lifetimes.ts
|
|
217
212
|
function mergeComponentLifetimes(behaviors, definition) {
|
|
218
213
|
const lifetimes = mergeRecord(...behaviors.map((item) => item.lifetimes), definition.lifetimes);
|
|
219
214
|
for (const name of [
|
|
@@ -231,8 +226,7 @@ function mergeComponentLifetimes(behaviors, definition) {
|
|
|
231
226
|
}
|
|
232
227
|
return lifetimes;
|
|
233
228
|
}
|
|
234
|
-
|
|
235
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/properties.ts
|
|
229
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/properties.ts
|
|
236
230
|
function resolveInitialData$1(definition) {
|
|
237
231
|
const rawData = definition.data;
|
|
238
232
|
if (typeof rawData === "function") {
|
|
@@ -254,6 +248,9 @@ function flattenBehaviors(definition) {
|
|
|
254
248
|
}
|
|
255
249
|
return flattened;
|
|
256
250
|
}
|
|
251
|
+
function resolveComponentPropertyDefinitions(definition, behaviors = flattenBehaviors(definition)) {
|
|
252
|
+
return behaviors.length === 0 ? definition.properties ?? {} : mergeRecord(...behaviors.map((item) => item.properties), definition.properties);
|
|
253
|
+
}
|
|
257
254
|
function normalizeComponentDefinition(definition) {
|
|
258
255
|
const behaviors = flattenBehaviors(definition);
|
|
259
256
|
if (behaviors.length === 0) return definition;
|
|
@@ -263,7 +260,7 @@ function normalizeComponentDefinition(definition) {
|
|
|
263
260
|
methods: mergeRecord(...behaviors.map((item) => item.methods), definition.methods),
|
|
264
261
|
observers: mergeRecord(...behaviors.map((item) => item.observers), definition.observers),
|
|
265
262
|
pageLifetimes: mergeRecord(...behaviors.map((item) => item.pageLifetimes), definition.pageLifetimes),
|
|
266
|
-
properties:
|
|
263
|
+
properties: resolveComponentPropertyDefinitions(definition, behaviors),
|
|
267
264
|
relations: mergeRecord(...behaviors.map((item) => item.relations), definition.relations),
|
|
268
265
|
lifetimes: mergeComponentLifetimes(behaviors, definition)
|
|
269
266
|
};
|
|
@@ -383,8 +380,7 @@ function resolveInitialProperties(definition, properties) {
|
|
|
383
380
|
}
|
|
384
381
|
return resolved;
|
|
385
382
|
}
|
|
386
|
-
|
|
387
|
-
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
383
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
388
384
|
let _lazyMatch = () => {
|
|
389
385
|
var __lib__ = (() => {
|
|
390
386
|
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
@@ -812,8 +808,7 @@ const _path = {
|
|
|
812
808
|
sep: "/",
|
|
813
809
|
toNamespacedPath
|
|
814
810
|
};
|
|
815
|
-
|
|
816
|
-
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
811
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
817
812
|
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
818
813
|
const _platforms = {
|
|
819
814
|
posix: void 0,
|
|
@@ -829,8 +824,7 @@ const mix = (del = delimiter) => {
|
|
|
829
824
|
};
|
|
830
825
|
const posix = /* @__PURE__ */ mix(":");
|
|
831
826
|
const win32 = /* @__PURE__ */ mix(";");
|
|
832
|
-
|
|
833
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/relations.ts
|
|
827
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/relations.ts
|
|
834
828
|
const states = /* @__PURE__ */ new WeakMap();
|
|
835
829
|
const opposite = {
|
|
836
830
|
ancestor: "descendant",
|
|
@@ -915,8 +909,7 @@ function detachComponentRelations(instances) {
|
|
|
915
909
|
}
|
|
916
910
|
publishRelations(nextStates);
|
|
917
911
|
}
|
|
918
|
-
|
|
919
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/index.ts
|
|
912
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/index.ts
|
|
920
913
|
function createComponentInstance(options) {
|
|
921
914
|
const definition = normalizeComponentDefinition(options.definition);
|
|
922
915
|
const data = {
|
|
@@ -968,8 +961,7 @@ function runComponentLifecycle(instance, lifecycleName) {
|
|
|
968
961
|
const topLevel = definition?.[lifecycleName];
|
|
969
962
|
if (typeof topLevel === "function") topLevel.call(instance);
|
|
970
963
|
}
|
|
971
|
-
|
|
972
|
-
//#region ../../mpcore/packages/simulator/src/host/componentPageAttachment.ts
|
|
964
|
+
// ../../mpcore/packages/simulator/src/host/componentPageAttachment.ts
|
|
973
965
|
const definitionAttachments = /* @__PURE__ */ new WeakMap();
|
|
974
966
|
const instanceAttachments = /* @__PURE__ */ new WeakMap();
|
|
975
967
|
const attachingInstances = /* @__PURE__ */ new WeakSet();
|
|
@@ -1006,8 +998,7 @@ function attachComponentPage(instance, updateBindings) {
|
|
|
1006
998
|
}
|
|
1007
999
|
return true;
|
|
1008
1000
|
}
|
|
1009
|
-
|
|
1010
|
-
//#region ../../mpcore/packages/simulator/src/project/pageConfig.ts
|
|
1001
|
+
// ../../mpcore/packages/simulator/src/project/pageConfig.ts
|
|
1011
1002
|
const DEFAULT_NAVIGATION_BAR_BACKGROUND_COLOR = "#ffffff";
|
|
1012
1003
|
const DEFAULT_NAVIGATION_BAR_FRONT_COLOR = "#000000";
|
|
1013
1004
|
const DEFAULT_NAVIGATION_BAR_FRONT_COLOR_WHITE = "#ffffff";
|
|
@@ -1069,8 +1060,7 @@ function resolveBackgroundSnapshot(appConfig, pageConfig) {
|
|
|
1069
1060
|
textStyle: resolveBackgroundTextStyle(appConfig, pageConfig)
|
|
1070
1061
|
};
|
|
1071
1062
|
}
|
|
1072
|
-
|
|
1073
|
-
//#region ../../mpcore/packages/simulator/src/runtime/pageInstance.ts
|
|
1063
|
+
// ../../mpcore/packages/simulator/src/runtime/pageInstance.ts
|
|
1074
1064
|
const ARRAY_INDEX_PATH_RE = /\[(\d+)\]/g;
|
|
1075
1065
|
const ARRAY_INDEX_SEGMENT_RE = /^\d+$/;
|
|
1076
1066
|
const LEADING_ROUTE_SLASH_RE = /^\/+/;
|
|
@@ -1162,8 +1152,7 @@ function createPageInstance(route, definition, options = {}, pageState = {}) {
|
|
|
1162
1152
|
bindComponentPageAttachment(instance, definition);
|
|
1163
1153
|
return instance;
|
|
1164
1154
|
}
|
|
1165
|
-
|
|
1166
|
-
//#region ../../mpcore/packages/simulator/src/view/eventBindingParser.ts
|
|
1155
|
+
// ../../mpcore/packages/simulator/src/view/eventBindingParser.ts
|
|
1167
1156
|
const LEGACY_EVENT_NAME_RE = /^\w+$/;
|
|
1168
1157
|
const EVENT_BINDING_PREFIXES = [
|
|
1169
1158
|
{
|
|
@@ -1270,8 +1259,7 @@ function resolveEventBindingPhases(attributes, eventName, includeCapture = true)
|
|
|
1270
1259
|
}
|
|
1271
1260
|
return bindings;
|
|
1272
1261
|
}
|
|
1273
|
-
|
|
1274
|
-
//#region ../../mpcore/packages/simulator/src/view/nodeDataset.ts
|
|
1262
|
+
// ../../mpcore/packages/simulator/src/view/nodeDataset.ts
|
|
1275
1263
|
const DATASET_NAME_RE = /-([a-z])/g;
|
|
1276
1264
|
function isDatasetAttribute(attributeName) {
|
|
1277
1265
|
return attributeName.startsWith("data-") && !attributeName.startsWith("data-sim-");
|
|
@@ -1285,8 +1273,7 @@ function collectNodeDataset(node) {
|
|
|
1285
1273
|
for (const [key, value] of Object.entries(node.attribs ?? {})) if (isDatasetAttribute(key)) dataset[toDatasetKey(key)] = value;
|
|
1286
1274
|
return dataset;
|
|
1287
1275
|
}
|
|
1288
|
-
|
|
1289
|
-
//#region ../../mpcore/packages/simulator/src/view/componentEvent.ts
|
|
1276
|
+
// ../../mpcore/packages/simulator/src/view/componentEvent.ts
|
|
1290
1277
|
const eventNodes = /* @__PURE__ */ new WeakMap();
|
|
1291
1278
|
/** 原生默认行为读取声明所有者与原始属性,避免组件根折叠覆盖宿主边界。 */
|
|
1292
1279
|
function getNativeNodeOwner(node) {
|
|
@@ -1443,8 +1430,7 @@ function buildComponentTrigger(componentScopeId, context) {
|
|
|
1443
1430
|
});
|
|
1444
1431
|
};
|
|
1445
1432
|
}
|
|
1446
|
-
|
|
1447
|
-
//#region ../../mpcore/packages/simulator/src/view/conditionalChildren.ts
|
|
1433
|
+
// ../../mpcore/packages/simulator/src/view/conditionalChildren.ts
|
|
1448
1434
|
function selectConditionalChildren(children, evaluate) {
|
|
1449
1435
|
const selected = [];
|
|
1450
1436
|
let inChain = false;
|
|
@@ -1481,8 +1467,7 @@ function selectConditionalChildren(children, evaluate) {
|
|
|
1481
1467
|
}
|
|
1482
1468
|
return selected;
|
|
1483
1469
|
}
|
|
1484
|
-
|
|
1485
|
-
//#region ../../mpcore/packages/simulator/src/view/customTabBar.ts
|
|
1470
|
+
// ../../mpcore/packages/simulator/src/view/customTabBar.ts
|
|
1486
1471
|
function customTabBarScopeId(route) {
|
|
1487
1472
|
return `page:${route.replace(/^\/+/, "")}/custom-tab-bar`;
|
|
1488
1473
|
}
|
|
@@ -1498,8 +1483,7 @@ function customTabBarHostScope() {
|
|
|
1498
1483
|
getScopeId: () => "tabbar-root"
|
|
1499
1484
|
};
|
|
1500
1485
|
}
|
|
1501
|
-
|
|
1502
|
-
//#region ../../mpcore/packages/simulator/src/view/inspectionTree.ts
|
|
1486
|
+
// ../../mpcore/packages/simulator/src/view/inspectionTree.ts
|
|
1503
1487
|
const inspectionChildren = /* @__PURE__ */ new WeakMap();
|
|
1504
1488
|
const inspectionParents = /* @__PURE__ */ new WeakMap();
|
|
1505
1489
|
const emptyChildren = [];
|
|
@@ -1549,8 +1533,7 @@ function registerInspectionTrees(root, pass, scopes) {
|
|
|
1549
1533
|
inspectionParents.set(node, host);
|
|
1550
1534
|
}
|
|
1551
1535
|
}
|
|
1552
|
-
|
|
1553
|
-
//#region ../../mpcore/packages/simulator/src/view/loopEntries.ts
|
|
1536
|
+
// ../../mpcore/packages/simulator/src/view/loopEntries.ts
|
|
1554
1537
|
const LOOP_SCOPE_ESCAPE_RE = /[^\w-]/g;
|
|
1555
1538
|
function escapeScopeCodeUnit(character) {
|
|
1556
1539
|
return `~${character.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
@@ -1570,15 +1553,13 @@ function resolveLoopInstanceSuffix(item, index, key, occurrences) {
|
|
|
1570
1553
|
occurrences.set(normalized, occurrence + 1);
|
|
1571
1554
|
return `:key-${normalized}${occurrence ? `:duplicate-${occurrence}` : ""}`;
|
|
1572
1555
|
}
|
|
1573
|
-
|
|
1574
|
-
//#region ../../mpcore/packages/simulator/src/view/renderedTree.ts
|
|
1556
|
+
// ../../mpcore/packages/simulator/src/view/renderedTree.ts
|
|
1575
1557
|
/** 在循环展开和组件替换完成后,让父节点关系指向本次渲染树。 */
|
|
1576
1558
|
function linkRenderedParents(root, parent = null) {
|
|
1577
1559
|
root.parent = parent;
|
|
1578
1560
|
for (const child of root.children ?? []) linkRenderedParents(child, root);
|
|
1579
1561
|
}
|
|
1580
|
-
|
|
1581
|
-
//#region ../../mpcore/packages/simulator/src/view/renderPass.ts
|
|
1562
|
+
// ../../mpcore/packages/simulator/src/view/renderPass.ts
|
|
1582
1563
|
const initializedPages = /* @__PURE__ */ new WeakMap();
|
|
1583
1564
|
function createRenderPass(propertyUpdate = false, parent) {
|
|
1584
1565
|
return {
|
|
@@ -1615,8 +1596,7 @@ function registerSlotDeclarations(pass, slots, parent, scopeId) {
|
|
|
1615
1596
|
scopeId
|
|
1616
1597
|
});
|
|
1617
1598
|
}
|
|
1618
|
-
|
|
1619
|
-
//#region ../../node_modules/.pnpm/@babel+parser@8.0.7/node_modules/@babel/parser/lib/index.js
|
|
1599
|
+
// ../../node_modules/.pnpm/@babel+parser@8.0.8/node_modules/@babel/parser/lib/index.js
|
|
1620
1600
|
var Position = class {
|
|
1621
1601
|
constructor(line, col, index) {
|
|
1622
1602
|
this.line = void 0;
|
|
@@ -2505,6 +2485,7 @@ const tt = {
|
|
|
2505
2485
|
}),
|
|
2506
2486
|
_for: createKeyword("for", { isLoop }),
|
|
2507
2487
|
_while: createKeyword("while", { isLoop }),
|
|
2488
|
+
_arguments: createKeywordLike("arguments", { startsExpr }),
|
|
2508
2489
|
_as: createKeywordLike("as", { startsExpr }),
|
|
2509
2490
|
_assert: createKeywordLike("assert", { startsExpr }),
|
|
2510
2491
|
_async: createKeywordLike("async", { startsExpr }),
|
|
@@ -2558,16 +2539,16 @@ const tt = {
|
|
|
2558
2539
|
jsxTagEnd: createToken("jsxTagEnd")
|
|
2559
2540
|
};
|
|
2560
2541
|
function tokenIsIdentifier(token) {
|
|
2561
|
-
return token >= 89 && token <=
|
|
2542
|
+
return token >= 89 && token <= 130;
|
|
2562
2543
|
}
|
|
2563
2544
|
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
2564
2545
|
return token <= 88;
|
|
2565
2546
|
}
|
|
2566
2547
|
function tokenIsKeywordOrIdentifier(token) {
|
|
2567
|
-
return token >= 54 && token <=
|
|
2548
|
+
return token >= 54 && token <= 130;
|
|
2568
2549
|
}
|
|
2569
2550
|
function tokenIsLiteralPropertyName(token) {
|
|
2570
|
-
return token >= 54 && token <=
|
|
2551
|
+
return token >= 54 && token <= 133;
|
|
2571
2552
|
}
|
|
2572
2553
|
function tokenComesBeforeExpression(token) {
|
|
2573
2554
|
return tokenBeforeExprs[token];
|
|
@@ -2579,7 +2560,7 @@ function tokenIsAssignment(token) {
|
|
|
2579
2560
|
return token >= 25 && token <= 29;
|
|
2580
2561
|
}
|
|
2581
2562
|
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
2582
|
-
return token >=
|
|
2563
|
+
return token >= 126 && token <= 128;
|
|
2583
2564
|
}
|
|
2584
2565
|
function tokenIsLoop(token) {
|
|
2585
2566
|
return token >= 86 && token <= 88;
|
|
@@ -2597,10 +2578,10 @@ function tokenIsPrefix(token) {
|
|
|
2597
2578
|
return tokenPrefixes[token];
|
|
2598
2579
|
}
|
|
2599
2580
|
function tokenIsTSTypeOperator(token) {
|
|
2600
|
-
return token >=
|
|
2581
|
+
return token >= 118 && token <= 120;
|
|
2601
2582
|
}
|
|
2602
2583
|
function tokenIsTSDeclarationStart(token) {
|
|
2603
|
-
return token >=
|
|
2584
|
+
return token >= 121 && token <= 127;
|
|
2604
2585
|
}
|
|
2605
2586
|
function tokenLabelName(token) {
|
|
2606
2587
|
return tokenLabels[token];
|
|
@@ -3137,7 +3118,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3137
3118
|
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
|
|
3138
3119
|
}
|
|
3139
3120
|
finishToken(type, val) {
|
|
3140
|
-
if (type !==
|
|
3121
|
+
if (type !== 131 && type !== 9 && type !== 24) {
|
|
3141
3122
|
if (this.flowPragma === void 0) this.flowPragma = null;
|
|
3142
3123
|
}
|
|
3143
3124
|
super.finishToken(type, val);
|
|
@@ -3164,7 +3145,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3164
3145
|
const node = this.startNode();
|
|
3165
3146
|
const moduloLoc = this.state.startLoc;
|
|
3166
3147
|
this.next();
|
|
3167
|
-
this.expectContextual(
|
|
3148
|
+
this.expectContextual(107);
|
|
3168
3149
|
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
3169
3150
|
if (this.eat(6)) {
|
|
3170
3151
|
node.value = super.parseExpression();
|
|
@@ -3218,15 +3199,15 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3218
3199
|
if (this.match(76)) return this.flowParseDeclareClass(node);
|
|
3219
3200
|
else if (this.match(64)) return this.flowParseDeclareFunction(node);
|
|
3220
3201
|
else if (this.match(70)) return this.flowParseDeclareVariable(node);
|
|
3221
|
-
else if (this.eatContextual(
|
|
3202
|
+
else if (this.eatContextual(124)) {
|
|
3222
3203
|
if (this.match(12)) return this.flowParseDeclareModuleExports(node);
|
|
3223
3204
|
else {
|
|
3224
3205
|
if (insideModule) this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
3225
3206
|
return this.flowParseDeclareModule(node);
|
|
3226
3207
|
}
|
|
3227
|
-
} else if (this.isContextual(
|
|
3228
|
-
else if (this.isContextual(
|
|
3229
|
-
else if (this.isContextual(
|
|
3208
|
+
} else if (this.isContextual(127)) return this.flowParseDeclareTypeAlias(node);
|
|
3209
|
+
else if (this.isContextual(128)) return this.flowParseDeclareOpaqueType(node);
|
|
3210
|
+
else if (this.isContextual(126)) return this.flowParseDeclareInterface(node);
|
|
3230
3211
|
else if (this.match(78)) return this.flowParseDeclareExportDeclaration(node, insideModule);
|
|
3231
3212
|
throw this.unexpected();
|
|
3232
3213
|
}
|
|
@@ -3239,7 +3220,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3239
3220
|
}
|
|
3240
3221
|
flowParseDeclareModule(node) {
|
|
3241
3222
|
this.scope.enter(0);
|
|
3242
|
-
if (this.match(
|
|
3223
|
+
if (this.match(131)) node.id = super.parseExprAtom();
|
|
3243
3224
|
else node.id = this.parseIdentifier();
|
|
3244
3225
|
const bodyNode = this.startNode();
|
|
3245
3226
|
const body = bodyNode.body = [];
|
|
@@ -3248,10 +3229,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3248
3229
|
const bodyNode = this.startNode();
|
|
3249
3230
|
if (this.match(79)) {
|
|
3250
3231
|
this.next();
|
|
3251
|
-
if (!this.isContextual(
|
|
3232
|
+
if (!this.isContextual(127) && !this.match(83)) this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
3252
3233
|
body.push(super.parseImport(bodyNode));
|
|
3253
3234
|
} else {
|
|
3254
|
-
this.expectContextual(
|
|
3235
|
+
this.expectContextual(122, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
3255
3236
|
body.push(this.flowParseDeclare(bodyNode, true));
|
|
3256
3237
|
}
|
|
3257
3238
|
}
|
|
@@ -3285,18 +3266,18 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3285
3266
|
node.default = true;
|
|
3286
3267
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
3287
3268
|
} else {
|
|
3288
|
-
if (this.match(71) || this.isLet() || (this.isContextual(
|
|
3269
|
+
if (this.match(71) || this.isLet() || (this.isContextual(127) || this.isContextual(126)) && !insideModule) {
|
|
3289
3270
|
const label = this.state.value;
|
|
3290
3271
|
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
3291
3272
|
unsupportedExportKind: label,
|
|
3292
3273
|
suggestion: exportSuggestions[label]
|
|
3293
3274
|
});
|
|
3294
3275
|
}
|
|
3295
|
-
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(
|
|
3276
|
+
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(128)) {
|
|
3296
3277
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
3297
3278
|
node.default = false;
|
|
3298
3279
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
3299
|
-
} else if (this.match(51) || this.match(2) || this.isContextual(
|
|
3280
|
+
} else if (this.match(51) || this.match(2) || this.isContextual(126) || this.isContextual(127) || this.isContextual(128)) {
|
|
3300
3281
|
const result = this.parseExport(node, null);
|
|
3301
3282
|
if (result.type === "ExportNamedDeclaration") {
|
|
3302
3283
|
result.default = false;
|
|
@@ -3309,7 +3290,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3309
3290
|
}
|
|
3310
3291
|
flowParseDeclareModuleExports(node) {
|
|
3311
3292
|
this.next();
|
|
3312
|
-
this.expectContextual(
|
|
3293
|
+
this.expectContextual(108);
|
|
3313
3294
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
3314
3295
|
this.semicolon();
|
|
3315
3296
|
return this.finishNode(node, "DeclareModuleExports");
|
|
@@ -3341,10 +3322,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3341
3322
|
if (isClass) {
|
|
3342
3323
|
const implemented = [];
|
|
3343
3324
|
const mixins = [];
|
|
3344
|
-
if (this.eatContextual(
|
|
3325
|
+
if (this.eatContextual(114)) do
|
|
3345
3326
|
mixins.push(this.flowParseInterfaceExtends());
|
|
3346
3327
|
while (this.eat(8));
|
|
3347
|
-
if (this.eatContextual(
|
|
3328
|
+
if (this.eatContextual(110)) do
|
|
3348
3329
|
implemented.push(this.flowParseClassImplements());
|
|
3349
3330
|
while (this.eat(8));
|
|
3350
3331
|
node.implements = implemented;
|
|
@@ -3395,7 +3376,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3395
3376
|
return this.finishNode(node, "TypeAlias");
|
|
3396
3377
|
}
|
|
3397
3378
|
flowParseOpaqueType(node, declare) {
|
|
3398
|
-
this.expectContextual(
|
|
3379
|
+
this.expectContextual(127);
|
|
3399
3380
|
node.id = this.flowParseRestrictedIdentifier(true, true);
|
|
3400
3381
|
this.scope.declareName(node.id.name, 8201, node.id.start);
|
|
3401
3382
|
if (this.match(43)) node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
@@ -3433,7 +3414,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3433
3414
|
const node = this.startNode();
|
|
3434
3415
|
node.params = [];
|
|
3435
3416
|
this.state.inType = true;
|
|
3436
|
-
if (this.match(43) || this.match(
|
|
3417
|
+
if (this.match(43) || this.match(139)) this.next();
|
|
3437
3418
|
else this.unexpected();
|
|
3438
3419
|
let defaultRequired = false;
|
|
3439
3420
|
do {
|
|
@@ -3498,7 +3479,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3498
3479
|
}
|
|
3499
3480
|
flowParseInterfaceType() {
|
|
3500
3481
|
const node = this.startNode();
|
|
3501
|
-
this.expectContextual(
|
|
3482
|
+
this.expectContextual(126);
|
|
3502
3483
|
node.extends = [];
|
|
3503
3484
|
if (this.eat(77)) do
|
|
3504
3485
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
@@ -3513,7 +3494,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3513
3494
|
return this.finishNode(node, "InterfaceTypeAnnotation");
|
|
3514
3495
|
}
|
|
3515
3496
|
flowParseObjectPropertyKey() {
|
|
3516
|
-
return this.match(
|
|
3497
|
+
return this.match(132) || this.match(131) ? super.parseExprAtom() : this.parseIdentifier(true);
|
|
3517
3498
|
}
|
|
3518
3499
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
3519
3500
|
node.static = isStatic;
|
|
@@ -3598,7 +3579,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3598
3579
|
let protoStartLoc = null;
|
|
3599
3580
|
let inexactStartLoc = null;
|
|
3600
3581
|
const node = this.startNode();
|
|
3601
|
-
if (allowProto && this.isContextual(
|
|
3582
|
+
if (allowProto && this.isContextual(115)) {
|
|
3602
3583
|
const lookahead = this.lookahead();
|
|
3603
3584
|
if (lookahead.type !== 10 && lookahead.type !== 13) {
|
|
3604
3585
|
this.next();
|
|
@@ -3606,7 +3587,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3606
3587
|
allowStatic = false;
|
|
3607
3588
|
}
|
|
3608
3589
|
}
|
|
3609
|
-
if (allowStatic && this.isContextual(
|
|
3590
|
+
if (allowStatic && this.isContextual(103)) {
|
|
3610
3591
|
const lookahead = this.lookahead();
|
|
3611
3592
|
if (lookahead.type !== 10 && lookahead.type !== 13) {
|
|
3612
3593
|
this.next();
|
|
@@ -3626,7 +3607,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3626
3607
|
nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
|
|
3627
3608
|
} else {
|
|
3628
3609
|
let kind = "init";
|
|
3629
|
-
if (this.isContextual(
|
|
3610
|
+
if (this.isContextual(96) || this.isContextual(101)) {
|
|
3630
3611
|
if (tokenIsLiteralPropertyName(this.lookahead().type)) {
|
|
3631
3612
|
kind = this.state.value;
|
|
3632
3613
|
this.next();
|
|
@@ -3862,7 +3843,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3862
3843
|
node.typeParameters = null;
|
|
3863
3844
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
3864
3845
|
}
|
|
3865
|
-
case
|
|
3846
|
+
case 131: return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
3866
3847
|
case 81:
|
|
3867
3848
|
case 82:
|
|
3868
3849
|
node.value = this.match(81);
|
|
@@ -3871,13 +3852,13 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3871
3852
|
case 49:
|
|
3872
3853
|
if (this.state.value === "-") {
|
|
3873
3854
|
this.next();
|
|
3874
|
-
if (this.match(
|
|
3875
|
-
if (this.match(
|
|
3855
|
+
if (this.match(132)) return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
3856
|
+
if (this.match(133)) return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
3876
3857
|
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
3877
3858
|
}
|
|
3878
3859
|
throw this.unexpected();
|
|
3879
|
-
case
|
|
3880
|
-
case
|
|
3860
|
+
case 132: return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
3861
|
+
case 133: return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
|
|
3881
3862
|
case 84:
|
|
3882
3863
|
this.next();
|
|
3883
3864
|
return this.finishNode(node, "VoidTypeAnnotation");
|
|
@@ -3896,7 +3877,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3896
3877
|
this.next();
|
|
3897
3878
|
return super.createIdentifier(node, label);
|
|
3898
3879
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
3899
|
-
if (this.isContextual(
|
|
3880
|
+
if (this.isContextual(126)) return this.flowParseInterfaceType();
|
|
3900
3881
|
return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier());
|
|
3901
3882
|
}
|
|
3902
3883
|
}
|
|
@@ -3971,7 +3952,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3971
3952
|
return type;
|
|
3972
3953
|
}
|
|
3973
3954
|
flowParseTypeOrImplicitInstantiation() {
|
|
3974
|
-
if (this.state.type ===
|
|
3955
|
+
if (this.state.type === 129 && this.state.value === "_") {
|
|
3975
3956
|
const startLoc = this.state.startLoc;
|
|
3976
3957
|
const node = this.parseIdentifier();
|
|
3977
3958
|
return this.flowParseGenericType(startLoc, node);
|
|
@@ -4021,13 +4002,13 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4021
4002
|
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
4022
4003
|
}
|
|
4023
4004
|
parseStatementLike(flags) {
|
|
4024
|
-
if (this.state.strict && this.isContextual(
|
|
4005
|
+
if (this.state.strict && this.isContextual(126)) {
|
|
4025
4006
|
if (tokenIsKeywordOrIdentifier(this.lookahead().type)) {
|
|
4026
4007
|
const node = this.startNode();
|
|
4027
4008
|
this.next();
|
|
4028
4009
|
return this.flowParseInterface(node);
|
|
4029
4010
|
}
|
|
4030
|
-
} else if (this.isContextual(
|
|
4011
|
+
} else if (this.isContextual(123)) {
|
|
4031
4012
|
const node = this.startNode();
|
|
4032
4013
|
this.next();
|
|
4033
4014
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -4036,7 +4017,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4036
4017
|
if (this.flowPragma === void 0 && !this.isValidDirective(stmt)) this.flowPragma = null;
|
|
4037
4018
|
return stmt;
|
|
4038
4019
|
}
|
|
4039
|
-
parseExpressionStatement(node, expr) {
|
|
4020
|
+
parseExpressionStatement(node, expr, flags) {
|
|
4040
4021
|
if (expr.type === "Identifier") {
|
|
4041
4022
|
if (expr.name === "declare") {
|
|
4042
4023
|
if (this.match(76) || tokenIsIdentifier(this.state.type) || this.match(64) || this.match(70) || this.match(78)) return this.flowParseDeclare(node);
|
|
@@ -4046,20 +4027,20 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4046
4027
|
else if (expr.name === "opaque") return this.flowParseOpaqueType(node, false);
|
|
4047
4028
|
}
|
|
4048
4029
|
}
|
|
4049
|
-
return super.parseExpressionStatement(node, expr);
|
|
4030
|
+
return super.parseExpressionStatement(node, expr, flags);
|
|
4050
4031
|
}
|
|
4051
4032
|
shouldParseExportDeclaration() {
|
|
4052
4033
|
const { type } = this.state;
|
|
4053
|
-
if (type ===
|
|
4034
|
+
if (type === 123 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) return !this.state.containsEsc;
|
|
4054
4035
|
return super.shouldParseExportDeclaration();
|
|
4055
4036
|
}
|
|
4056
4037
|
isExportDefaultSpecifier() {
|
|
4057
4038
|
const { type } = this.state;
|
|
4058
|
-
if (type ===
|
|
4039
|
+
if (type === 123 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) return this.state.containsEsc;
|
|
4059
4040
|
return super.isExportDefaultSpecifier();
|
|
4060
4041
|
}
|
|
4061
4042
|
parseExportDefaultExpression() {
|
|
4062
|
-
if (this.isContextual(
|
|
4043
|
+
if (this.isContextual(123)) {
|
|
4063
4044
|
const node = this.startNode();
|
|
4064
4045
|
this.next();
|
|
4065
4046
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -4172,7 +4153,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4172
4153
|
super.assertModuleNodeAllowed(node);
|
|
4173
4154
|
}
|
|
4174
4155
|
parseExportDeclaration(node) {
|
|
4175
|
-
if (this.isContextual(
|
|
4156
|
+
if (this.isContextual(127)) {
|
|
4176
4157
|
node.exportKind = "type";
|
|
4177
4158
|
const declarationNode = this.startNode();
|
|
4178
4159
|
this.next();
|
|
@@ -4181,17 +4162,17 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4181
4162
|
super.parseExportFrom(node);
|
|
4182
4163
|
return null;
|
|
4183
4164
|
} else return this.flowParseTypeAlias(declarationNode);
|
|
4184
|
-
} else if (this.isContextual(
|
|
4165
|
+
} else if (this.isContextual(128)) {
|
|
4185
4166
|
node.exportKind = "type";
|
|
4186
4167
|
const declarationNode = this.startNode();
|
|
4187
4168
|
this.next();
|
|
4188
4169
|
return this.flowParseOpaqueType(declarationNode, false);
|
|
4189
|
-
} else if (this.isContextual(
|
|
4170
|
+
} else if (this.isContextual(126)) {
|
|
4190
4171
|
node.exportKind = "type";
|
|
4191
4172
|
const declarationNode = this.startNode();
|
|
4192
4173
|
this.next();
|
|
4193
4174
|
return this.flowParseInterface(declarationNode);
|
|
4194
|
-
} else if (this.isContextual(
|
|
4175
|
+
} else if (this.isContextual(123)) {
|
|
4195
4176
|
node.exportKind = "value";
|
|
4196
4177
|
const declarationNode = this.startNode();
|
|
4197
4178
|
this.next();
|
|
@@ -4200,7 +4181,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4200
4181
|
}
|
|
4201
4182
|
eatExportStar(node) {
|
|
4202
4183
|
if (super.eatExportStar(node)) return true;
|
|
4203
|
-
if (this.isContextual(
|
|
4184
|
+
if (this.isContextual(127) && this.lookahead().type === 51) {
|
|
4204
4185
|
node.exportKind = "type";
|
|
4205
4186
|
this.next();
|
|
4206
4187
|
this.next();
|
|
@@ -4215,7 +4196,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4215
4196
|
return hasNamespace;
|
|
4216
4197
|
}
|
|
4217
4198
|
parseClassId(node, isStatement, optionalId) {
|
|
4218
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
4199
|
+
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
4219
4200
|
node.id = null;
|
|
4220
4201
|
return;
|
|
4221
4202
|
}
|
|
@@ -4224,7 +4205,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4224
4205
|
}
|
|
4225
4206
|
parseClassMember(classBody, member, state) {
|
|
4226
4207
|
const { startLoc } = this.state;
|
|
4227
|
-
if (this.isContextual(
|
|
4208
|
+
if (this.isContextual(122)) {
|
|
4228
4209
|
if (super.parseClassMemberFromModifier(classBody, member)) return;
|
|
4229
4210
|
member.declare = true;
|
|
4230
4211
|
}
|
|
@@ -4241,7 +4222,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4241
4222
|
const word = super.readWord1();
|
|
4242
4223
|
const fullWord = "@@" + word;
|
|
4243
4224
|
if (!this.isIterator(word) || !this.state.inType) this.raise(Errors.InvalidIdentifier, this.state.curPosition(), { identifierName: fullWord });
|
|
4244
|
-
this.finishToken(
|
|
4225
|
+
this.finishToken(129, fullWord);
|
|
4245
4226
|
}
|
|
4246
4227
|
getTokenFromCode(code) {
|
|
4247
4228
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
@@ -4329,7 +4310,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4329
4310
|
parseClassSuper(node) {
|
|
4330
4311
|
super.parseClassSuper(node);
|
|
4331
4312
|
if (node.superClass && (this.match(43) || this.match(47))) node.superTypeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
4332
|
-
if (this.eatContextual(
|
|
4313
|
+
if (this.eatContextual(110)) {
|
|
4333
4314
|
const implemented = node.implements = [];
|
|
4334
4315
|
do
|
|
4335
4316
|
implemented.push(this.flowParseClassImplements());
|
|
@@ -4383,7 +4364,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4383
4364
|
}
|
|
4384
4365
|
isPotentialImportPhase(isExport) {
|
|
4385
4366
|
if (super.isPotentialImportPhase(isExport)) return true;
|
|
4386
|
-
if (this.isContextual(
|
|
4367
|
+
if (this.isContextual(127)) {
|
|
4387
4368
|
if (!isExport) return true;
|
|
4388
4369
|
const ch = this.lookaheadCharCode();
|
|
4389
4370
|
return ch === 123 || ch === 42;
|
|
@@ -4408,7 +4389,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4408
4389
|
else if (firstIdent.name === "typeof") specifierTypeKind = "typeof";
|
|
4409
4390
|
}
|
|
4410
4391
|
let isBinding = false;
|
|
4411
|
-
if (this.isContextual(
|
|
4392
|
+
if (this.isContextual(90) && !this.isLookaheadContextual("as")) {
|
|
4412
4393
|
const as_ident = this.parseIdentifier(true);
|
|
4413
4394
|
if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
4414
4395
|
specifier.imported = as_ident;
|
|
@@ -4428,7 +4409,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4428
4409
|
specifier.imported = firstIdent;
|
|
4429
4410
|
specifier.importKind = null;
|
|
4430
4411
|
}
|
|
4431
|
-
if (this.eatContextual(
|
|
4412
|
+
if (this.eatContextual(90)) specifier.local = this.parseIdentifier();
|
|
4432
4413
|
else {
|
|
4433
4414
|
isBinding = true;
|
|
4434
4415
|
specifier.local = this.cloneIdentifier(specifier.imported);
|
|
@@ -4473,7 +4454,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4473
4454
|
parseMaybeAssign(refExpressionErrors, isParenItem) {
|
|
4474
4455
|
let state = null;
|
|
4475
4456
|
let jsx;
|
|
4476
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
4457
|
+
if (this.hasPlugin("jsx") && (this.match(139) || this.match(43))) {
|
|
4477
4458
|
state = this.state.clone();
|
|
4478
4459
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, isParenItem), state);
|
|
4479
4460
|
if (!jsx.error) return jsx.node;
|
|
@@ -4688,7 +4669,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4688
4669
|
const startLoc = this.state.startLoc;
|
|
4689
4670
|
const endOfInit = () => this.match(8) || this.match(4);
|
|
4690
4671
|
switch (this.state.type) {
|
|
4691
|
-
case
|
|
4672
|
+
case 132: {
|
|
4692
4673
|
const literal = this.parseNumericLiteral(this.state.value);
|
|
4693
4674
|
if (endOfInit()) return {
|
|
4694
4675
|
type: "number",
|
|
@@ -4697,7 +4678,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4697
4678
|
};
|
|
4698
4679
|
break;
|
|
4699
4680
|
}
|
|
4700
|
-
case
|
|
4681
|
+
case 131: {
|
|
4701
4682
|
const literal = this.parseStringLiteral(this.state.value);
|
|
4702
4683
|
if (endOfInit()) return {
|
|
4703
4684
|
type: "string",
|
|
@@ -4816,7 +4797,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
4816
4797
|
}
|
|
4817
4798
|
}
|
|
4818
4799
|
flowEnumParseExplicitType({ enumName }) {
|
|
4819
|
-
if (!this.eatContextual(
|
|
4800
|
+
if (!this.eatContextual(99)) return null;
|
|
4820
4801
|
if (!tokenIsIdentifier(this.state.type)) throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, { enumName });
|
|
4821
4802
|
const { value } = this.state;
|
|
4822
4803
|
this.next();
|
|
@@ -5209,6 +5190,7 @@ function hasNewLine(input, start, end) {
|
|
|
5209
5190
|
return false;
|
|
5210
5191
|
}
|
|
5211
5192
|
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
5193
|
+
const skipWhiteSpaceAnnexB = /(?:[^\S\n\r\u2028\u2029]|\/\*.*?\*\/)*(?:(?!-->)(?:\s|\/\/.*|\/\*[^]*?\*\/|<!--.*|-->.*)*)?/g;
|
|
5212
5194
|
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
|
|
5213
5195
|
function isWhitespace$2(code) {
|
|
5214
5196
|
switch (code) {
|
|
@@ -5268,12 +5250,12 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5268
5250
|
if (this.state.pos === this.state.start) {
|
|
5269
5251
|
if (ch === 60 && this.state.canStartJSXElement) {
|
|
5270
5252
|
++this.state.pos;
|
|
5271
|
-
this.finishToken(
|
|
5253
|
+
this.finishToken(139);
|
|
5272
5254
|
} else super.getTokenFromCode(ch);
|
|
5273
5255
|
return;
|
|
5274
5256
|
}
|
|
5275
5257
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
5276
|
-
this.finishToken(
|
|
5258
|
+
this.finishToken(138, out);
|
|
5277
5259
|
return;
|
|
5278
5260
|
case 38:
|
|
5279
5261
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -5323,7 +5305,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5323
5305
|
} else ++this.state.pos;
|
|
5324
5306
|
}
|
|
5325
5307
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
5326
|
-
this.finishToken(
|
|
5308
|
+
this.finishToken(131, out);
|
|
5327
5309
|
}
|
|
5328
5310
|
jsxReadEntity() {
|
|
5329
5311
|
const startPos = ++this.state.pos;
|
|
@@ -5359,11 +5341,11 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5359
5341
|
do
|
|
5360
5342
|
ch = this.input.charCodeAt(++this.state.pos);
|
|
5361
5343
|
while (isIdentifierChar(ch) || ch === 45);
|
|
5362
|
-
this.finishToken(
|
|
5344
|
+
this.finishToken(137, this.input.slice(start, this.state.pos));
|
|
5363
5345
|
}
|
|
5364
5346
|
jsxParseIdentifier() {
|
|
5365
5347
|
const node = this.startNode();
|
|
5366
|
-
if (this.match(
|
|
5348
|
+
if (this.match(137)) node.name = this.state.value;
|
|
5367
5349
|
else if (tokenIsKeyword(this.state.type)) node.name = tokenLabelName(this.state.type);
|
|
5368
5350
|
else this.unexpected();
|
|
5369
5351
|
this.next();
|
|
@@ -5400,8 +5382,8 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5400
5382
|
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
5401
5383
|
if (node.expression.type === "JSXEmptyExpression") this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
5402
5384
|
return node;
|
|
5403
|
-
case
|
|
5404
|
-
case
|
|
5385
|
+
case 139:
|
|
5386
|
+
case 131: return this.parseExprAtom();
|
|
5405
5387
|
default: throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
5406
5388
|
}
|
|
5407
5389
|
}
|
|
@@ -5447,7 +5429,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5447
5429
|
return this.finishNode(node, "JSXAttribute");
|
|
5448
5430
|
}
|
|
5449
5431
|
jsxParseOpeningElementAt(startLoc) {
|
|
5450
|
-
if (this.eat(
|
|
5432
|
+
if (this.eat(140)) {
|
|
5451
5433
|
const node = this.startNodeAt(startLoc);
|
|
5452
5434
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
5453
5435
|
}
|
|
@@ -5457,20 +5439,20 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5457
5439
|
}
|
|
5458
5440
|
jsxParseOpeningElementAfterName(node) {
|
|
5459
5441
|
const attributes = [];
|
|
5460
|
-
while (!this.match(52) && !this.match(
|
|
5442
|
+
while (!this.match(52) && !this.match(140)) attributes.push(this.jsxParseAttribute());
|
|
5461
5443
|
node.attributes = attributes;
|
|
5462
5444
|
node.selfClosing = this.eat(52);
|
|
5463
|
-
this.expect(
|
|
5445
|
+
this.expect(140);
|
|
5464
5446
|
return this.finishNode(node, "JSXOpeningElement");
|
|
5465
5447
|
}
|
|
5466
5448
|
jsxParseClosingElementAt(startLoc) {
|
|
5467
|
-
if (this.eat(
|
|
5449
|
+
if (this.eat(140)) {
|
|
5468
5450
|
const node = this.startNodeAt(startLoc);
|
|
5469
5451
|
return this.finishNode(node, "JSXClosingFragment");
|
|
5470
5452
|
}
|
|
5471
5453
|
const node = this.startNodeAt(startLoc);
|
|
5472
5454
|
node.name = this.jsxParseElementName();
|
|
5473
|
-
this.expect(
|
|
5455
|
+
this.expect(140);
|
|
5474
5456
|
return this.finishNode(node, "JSXClosingElement");
|
|
5475
5457
|
}
|
|
5476
5458
|
jsxParseElementAt(startLoc) {
|
|
@@ -5480,7 +5462,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5480
5462
|
let closingElement = null;
|
|
5481
5463
|
if (!openingElement.selfClosing) {
|
|
5482
5464
|
contents: for (;;) switch (this.state.type) {
|
|
5483
|
-
case
|
|
5465
|
+
case 139:
|
|
5484
5466
|
startLoc = this.state.startLoc;
|
|
5485
5467
|
this.next();
|
|
5486
5468
|
if (this.eat(52)) {
|
|
@@ -5490,7 +5472,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5490
5472
|
}
|
|
5491
5473
|
children.push(this.jsxParseElementAt(startLoc));
|
|
5492
5474
|
break;
|
|
5493
|
-
case
|
|
5475
|
+
case 138:
|
|
5494
5476
|
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
5495
5477
|
break;
|
|
5496
5478
|
case 2: {
|
|
@@ -5530,9 +5512,9 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5530
5512
|
context[context.length - 1] = newContext;
|
|
5531
5513
|
}
|
|
5532
5514
|
parseExprAtom(refExpressionErrors) {
|
|
5533
|
-
if (this.match(
|
|
5515
|
+
if (this.match(139)) return this.jsxParseElement();
|
|
5534
5516
|
else if (this.match(43) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
5535
|
-
this.replaceToken(
|
|
5517
|
+
this.replaceToken(139);
|
|
5536
5518
|
return this.jsxParseElement();
|
|
5537
5519
|
} else return super.parseExprAtom(refExpressionErrors);
|
|
5538
5520
|
}
|
|
@@ -5552,7 +5534,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5552
5534
|
}
|
|
5553
5535
|
if (code === 62) {
|
|
5554
5536
|
++this.state.pos;
|
|
5555
|
-
this.finishToken(
|
|
5537
|
+
this.finishToken(140);
|
|
5556
5538
|
return;
|
|
5557
5539
|
}
|
|
5558
5540
|
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
@@ -5562,18 +5544,18 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
5562
5544
|
}
|
|
5563
5545
|
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
|
5564
5546
|
++this.state.pos;
|
|
5565
|
-
this.finishToken(
|
|
5547
|
+
this.finishToken(139);
|
|
5566
5548
|
return;
|
|
5567
5549
|
}
|
|
5568
5550
|
super.getTokenFromCode(code);
|
|
5569
5551
|
}
|
|
5570
5552
|
updateContext(prevType) {
|
|
5571
5553
|
const { context, type } = this.state;
|
|
5572
|
-
if (type === 52 && prevType ===
|
|
5554
|
+
if (type === 52 && prevType === 139) {
|
|
5573
5555
|
context.splice(-2, 2, types.j_cTag);
|
|
5574
5556
|
this.state.canStartJSXElement = false;
|
|
5575
|
-
} else if (type ===
|
|
5576
|
-
else if (type ===
|
|
5557
|
+
} else if (type === 139) context.push(types.j_oTag);
|
|
5558
|
+
else if (type === 140) {
|
|
5577
5559
|
const out = context[context.length - 1];
|
|
5578
5560
|
if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
|
|
5579
5561
|
context.pop();
|
|
@@ -5838,6 +5820,7 @@ var State$1 = class State$1 {
|
|
|
5838
5820
|
errors = [];
|
|
5839
5821
|
noArrowAt = [];
|
|
5840
5822
|
noArrowParamsConversionAt = [];
|
|
5823
|
+
regExpAllowedAt = -1;
|
|
5841
5824
|
get canStartArrow() {
|
|
5842
5825
|
return (this.flags & 2) > 0;
|
|
5843
5826
|
}
|
|
@@ -5912,7 +5895,7 @@ var State$1 = class State$1 {
|
|
|
5912
5895
|
commentsLen = 0;
|
|
5913
5896
|
commentStack = [];
|
|
5914
5897
|
pos = 0;
|
|
5915
|
-
type =
|
|
5898
|
+
type = 136;
|
|
5916
5899
|
value = null;
|
|
5917
5900
|
start = 0;
|
|
5918
5901
|
end = 0;
|
|
@@ -5957,6 +5940,7 @@ var State$1 = class State$1 {
|
|
|
5957
5940
|
state.errors = this.errors.slice();
|
|
5958
5941
|
state.noArrowAt = this.noArrowAt.slice();
|
|
5959
5942
|
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
5943
|
+
state.regExpAllowedAt = this.regExpAllowedAt;
|
|
5960
5944
|
state.labels = this.labels.slice();
|
|
5961
5945
|
state.commentsLen = this.commentsLen;
|
|
5962
5946
|
state.commentStack = this.commentStack.slice();
|
|
@@ -5986,7 +5970,9 @@ const forbiddenNumericSeparatorSiblings = {
|
|
|
5986
5970
|
95,
|
|
5987
5971
|
98,
|
|
5988
5972
|
101,
|
|
5989
|
-
111
|
|
5973
|
+
111,
|
|
5974
|
+
43,
|
|
5975
|
+
45
|
|
5990
5976
|
]),
|
|
5991
5977
|
hex: /* @__PURE__ */ new Set([
|
|
5992
5978
|
46,
|
|
@@ -6144,7 +6130,7 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
6144
6130
|
pos
|
|
6145
6131
|
};
|
|
6146
6132
|
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
6147
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)
|
|
6133
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
6148
6134
|
if (bailOnError) return {
|
|
6149
6135
|
n: null,
|
|
6150
6136
|
pos
|
|
@@ -6301,8 +6287,9 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6301
6287
|
return this.nextTokenStartSince(this.state.pos);
|
|
6302
6288
|
}
|
|
6303
6289
|
nextTokenStartSince(pos) {
|
|
6304
|
-
|
|
6305
|
-
|
|
6290
|
+
const skipWhiteSpaceRe = this.inModule || !(this.optionFlags & 16384) ? skipWhiteSpace : skipWhiteSpaceAnnexB;
|
|
6291
|
+
skipWhiteSpaceRe.lastIndex = pos;
|
|
6292
|
+
return skipWhiteSpaceRe.test(this.input) ? skipWhiteSpaceRe.lastIndex : pos;
|
|
6306
6293
|
}
|
|
6307
6294
|
lookaheadCharCode() {
|
|
6308
6295
|
return this.lookaheadCharCodeSince(this.state.pos);
|
|
@@ -6343,7 +6330,7 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6343
6330
|
this.state.start = this.state.pos;
|
|
6344
6331
|
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
|
|
6345
6332
|
if (this.state.pos >= this.length) {
|
|
6346
|
-
this.finishToken(
|
|
6333
|
+
this.finishToken(136);
|
|
6347
6334
|
return;
|
|
6348
6335
|
}
|
|
6349
6336
|
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
@@ -6484,10 +6471,10 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6484
6471
|
if (next >= 48 && next <= 57) throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
6485
6472
|
if (isIdentifierStart(next)) {
|
|
6486
6473
|
++this.state.pos;
|
|
6487
|
-
this.finishToken(
|
|
6474
|
+
this.finishToken(135, this.readWord1(next));
|
|
6488
6475
|
} else if (next === 92) {
|
|
6489
6476
|
++this.state.pos;
|
|
6490
|
-
this.finishToken(
|
|
6477
|
+
this.finishToken(135, this.readWord1());
|
|
6491
6478
|
} else this.finishOp(23, 1);
|
|
6492
6479
|
}
|
|
6493
6480
|
readToken_dot() {
|
|
@@ -6811,7 +6798,7 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6811
6798
|
mods += char;
|
|
6812
6799
|
}
|
|
6813
6800
|
this.state.pos = pos;
|
|
6814
|
-
this.finishToken(
|
|
6801
|
+
this.finishToken(134, {
|
|
6815
6802
|
pattern: content,
|
|
6816
6803
|
flags: mods
|
|
6817
6804
|
});
|
|
@@ -6835,10 +6822,10 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6835
6822
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
6836
6823
|
if (isBigInt) {
|
|
6837
6824
|
const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
|
|
6838
|
-
this.finishToken(
|
|
6825
|
+
this.finishToken(133, str);
|
|
6839
6826
|
return;
|
|
6840
6827
|
}
|
|
6841
|
-
this.finishToken(
|
|
6828
|
+
this.finishToken(132, val);
|
|
6842
6829
|
}
|
|
6843
6830
|
readNumber(startsWithDot) {
|
|
6844
6831
|
const start = this.state.pos;
|
|
@@ -6879,11 +6866,11 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6879
6866
|
}
|
|
6880
6867
|
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
6881
6868
|
if (isBigInt) {
|
|
6882
|
-
this.finishToken(
|
|
6869
|
+
this.finishToken(133, str);
|
|
6883
6870
|
return;
|
|
6884
6871
|
}
|
|
6885
6872
|
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
6886
|
-
this.finishToken(
|
|
6873
|
+
this.finishToken(132, val);
|
|
6887
6874
|
}
|
|
6888
6875
|
readCodePoint(throwOnInvalid) {
|
|
6889
6876
|
const { code, pos } = readCodePoint(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
|
|
@@ -6895,7 +6882,7 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6895
6882
|
this.state.pos = pos + 1;
|
|
6896
6883
|
this.state.lineStart = lineStart;
|
|
6897
6884
|
this.state.curLine = curLine;
|
|
6898
|
-
this.finishToken(
|
|
6885
|
+
this.finishToken(131, str);
|
|
6899
6886
|
}
|
|
6900
6887
|
readTemplateContinuation() {
|
|
6901
6888
|
if (!this.match(4)) this.unexpected(null, 4);
|
|
@@ -6954,7 +6941,7 @@ var Tokenizer$1 = class extends CommentsParser {
|
|
|
6954
6941
|
const word = this.readWord1(firstCode);
|
|
6955
6942
|
const type = keywords$1.get(word);
|
|
6956
6943
|
if (type !== void 0) this.finishToken(type, tokenLabelName(type));
|
|
6957
|
-
else this.finishToken(
|
|
6944
|
+
else this.finishToken(129, word);
|
|
6958
6945
|
}
|
|
6959
6946
|
checkKeywordEscapes() {
|
|
6960
6947
|
const { type } = this.state;
|
|
@@ -7235,7 +7222,7 @@ var UtilParser = class extends Tokenizer$1 {
|
|
|
7235
7222
|
}
|
|
7236
7223
|
}
|
|
7237
7224
|
canInsertSemicolon() {
|
|
7238
|
-
return this.match(
|
|
7225
|
+
return this.match(136) || this.match(4) || this.hasPrecedingLineBreak();
|
|
7239
7226
|
}
|
|
7240
7227
|
hasPrecedingLineBreak() {
|
|
7241
7228
|
return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
|
|
@@ -7658,7 +7645,7 @@ var LValParser = class extends NodeUtils {
|
|
|
7658
7645
|
const { type, startLoc } = this.state;
|
|
7659
7646
|
if (type === 17) return this.parseBindingRestProperty(this.startNode());
|
|
7660
7647
|
const prop = this.startNode();
|
|
7661
|
-
if (type ===
|
|
7648
|
+
if (type === 135) {
|
|
7662
7649
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
7663
7650
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
7664
7651
|
prop.key = this.parsePrivateName();
|
|
@@ -7727,7 +7714,7 @@ var LValParser = class extends NodeUtils {
|
|
|
7727
7714
|
return;
|
|
7728
7715
|
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") this.raise(Errors.VoidPatternCatchClauseParam, expression);
|
|
7729
7716
|
const unwrappedExpression = unwrapParenthesizedExpression(expression);
|
|
7730
|
-
disallowCallExpression ||= unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
7717
|
+
disallowCallExpression ||= binding !== 64 || unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
7731
7718
|
const validity = this.isValidLVal(type, disallowCallExpression, !(hasParenthesizedAncestor || expression.extra?.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
7732
7719
|
if (validity === true) return;
|
|
7733
7720
|
if (validity === false) {
|
|
@@ -7747,12 +7734,15 @@ var LValParser = class extends NodeUtils {
|
|
|
7747
7734
|
} else if (val) this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, disallowCallExpression);
|
|
7748
7735
|
}
|
|
7749
7736
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
7737
|
+
this.checkStrictBindReservedWord(at, bindingType, strictModeChanged);
|
|
7738
|
+
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
7739
|
+
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
7740
|
+
}
|
|
7741
|
+
checkStrictBindReservedWord(at, bindingType, strictModeChanged = false) {
|
|
7750
7742
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
7751
7743
|
if (bindingType === 64) this.raise(Errors.StrictEvalArguments, at, { referenceName: at.name });
|
|
7752
7744
|
else this.raise(Errors.StrictEvalArgumentsBinding, at, { bindingName: at.name });
|
|
7753
7745
|
}
|
|
7754
|
-
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
7755
|
-
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
7756
7746
|
}
|
|
7757
7747
|
declareNameFromIdentifier(identifier, binding) {
|
|
7758
7748
|
this.scope.declareName(identifier.name, binding, identifier.start);
|
|
@@ -7795,9 +7785,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
7795
7785
|
getExpression() {
|
|
7796
7786
|
this.enterInitialScopes();
|
|
7797
7787
|
this.nextToken();
|
|
7798
|
-
if (this.match(
|
|
7788
|
+
if (this.match(136)) throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
|
|
7799
7789
|
const expr = this.parseExpression();
|
|
7800
|
-
if (!this.match(
|
|
7790
|
+
if (!this.match(136)) throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, { unexpected: this.input.codePointAt(this.state.start) });
|
|
7801
7791
|
this.finalizeRemainingComments();
|
|
7802
7792
|
expr.comments = this.comments;
|
|
7803
7793
|
expr.errors = this.state.errors;
|
|
@@ -7831,7 +7821,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7831
7821
|
}
|
|
7832
7822
|
parseMaybeAssign(refExpressionErrors, isParenItem) {
|
|
7833
7823
|
const startLoc = this.state.startLoc;
|
|
7834
|
-
const isYield = this.isContextual(
|
|
7824
|
+
const isYield = this.isContextual(105);
|
|
7835
7825
|
if (isYield) {
|
|
7836
7826
|
if (this.prodParam.hasYield) {
|
|
7837
7827
|
this.next();
|
|
@@ -7849,7 +7839,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7849
7839
|
this.state.canStartArrow = true;
|
|
7850
7840
|
let left = this.parseMaybeConditional(refExpressionErrors);
|
|
7851
7841
|
if (isParenItem) left = this.parseParenItem(left, startLoc);
|
|
7852
|
-
if (tokenIsAssignment(this.state.type)) {
|
|
7842
|
+
if (tokenIsAssignment(this.state.type) && !(this.match(27) && this.state.lastTokEndLoc.index === this.state.regExpAllowedAt)) {
|
|
7853
7843
|
const node = this.startNodeAt(startLoc);
|
|
7854
7844
|
const operator = this.state.value;
|
|
7855
7845
|
node.operator = operator;
|
|
@@ -7897,7 +7887,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7897
7887
|
return expr;
|
|
7898
7888
|
}
|
|
7899
7889
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
7900
|
-
return this.match(
|
|
7890
|
+
return this.match(135) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
7901
7891
|
}
|
|
7902
7892
|
parseExprOps(refExpressionErrors) {
|
|
7903
7893
|
const startLoc = this.state.startLoc;
|
|
@@ -7906,14 +7896,21 @@ var ExpressionParser = class extends LValParser {
|
|
|
7906
7896
|
this.state.canStartArrow = false;
|
|
7907
7897
|
return this.parseExprOp(expr, startLoc, -1);
|
|
7908
7898
|
}
|
|
7899
|
+
isEscapedKeywordOperatorAfterLineBreak() {
|
|
7900
|
+
return tokenIsKeyword(this.state.type) && this.state.containsEsc && this.hasPrecedingLineBreak();
|
|
7901
|
+
}
|
|
7902
|
+
isBinaryOperator(op) {
|
|
7903
|
+
return tokenIsOperator(op) && (this.prodParam.hasIn || op !== 54) && !this.isEscapedKeywordOperatorAfterLineBreak();
|
|
7904
|
+
}
|
|
7909
7905
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
7906
|
+
const op = this.state.type;
|
|
7907
|
+
const isOperator = this.isBinaryOperator(op);
|
|
7910
7908
|
if (this.isPrivateName(left)) {
|
|
7911
7909
|
const value = this.getPrivateNameSV(left);
|
|
7912
|
-
if (minPrec >= tokenOperatorPrecedence(54) ||
|
|
7910
|
+
if (minPrec >= tokenOperatorPrecedence(54) || op !== 54 || !isOperator) this.raise(Errors.PrivateInExpectedIn, leftStartLoc, { identifierName: value });
|
|
7913
7911
|
this.classScope.usePrivateName(value, leftStartLoc);
|
|
7914
7912
|
}
|
|
7915
|
-
|
|
7916
|
-
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(54))) {
|
|
7913
|
+
if (isOperator) {
|
|
7917
7914
|
let prec = tokenOperatorPrecedence(op);
|
|
7918
7915
|
if (prec > minPrec) {
|
|
7919
7916
|
if (op === 35) {
|
|
@@ -7963,7 +7960,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7963
7960
|
}
|
|
7964
7961
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
7965
7962
|
const startLoc = this.state.startLoc;
|
|
7966
|
-
const isAwait = this.isContextual(
|
|
7963
|
+
const isAwait = this.isContextual(93);
|
|
7967
7964
|
if (isAwait && this.recordAwaitIfAllowed()) {
|
|
7968
7965
|
this.next();
|
|
7969
7966
|
const expr = this.parseAwait(startLoc);
|
|
@@ -7982,7 +7979,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7982
7979
|
node.argument = this.parseMaybeUnary(null, true);
|
|
7983
7980
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
7984
7981
|
if (this.state.strict && isDelete) {
|
|
7985
|
-
const arg = node.argument;
|
|
7982
|
+
const arg = unwrapParenthesizedExpression(node.argument);
|
|
7986
7983
|
if (arg.type === "Identifier") this.raise(Errors.StrictDelete, node);
|
|
7987
7984
|
else if (this.hasPropertyAsPrivateName(arg)) this.raise(Errors.DeletePrivateField, node);
|
|
7988
7985
|
}
|
|
@@ -8023,6 +8020,20 @@ var ExpressionParser = class extends LValParser {
|
|
|
8023
8020
|
parseExprSubscripts(refExpressionErrors) {
|
|
8024
8021
|
const startLoc = this.state.startLoc;
|
|
8025
8022
|
this.setLoc(startLoc);
|
|
8023
|
+
if (refExpressionErrors != null && (this.match(2) || this.match(0))) {
|
|
8024
|
+
const atomExpressionErrors = new ExpressionErrors();
|
|
8025
|
+
const expr = this.parseExprAtom(atomExpressionErrors);
|
|
8026
|
+
const result = this.parseSubscripts(expr, startLoc);
|
|
8027
|
+
if (result !== expr) this.checkExpressionErrors(atomExpressionErrors, true);
|
|
8028
|
+
else {
|
|
8029
|
+
refExpressionErrors.shorthandAssignLoc ??= atomExpressionErrors.shorthandAssignLoc;
|
|
8030
|
+
refExpressionErrors.doubleProtoLoc ??= atomExpressionErrors.doubleProtoLoc;
|
|
8031
|
+
refExpressionErrors.privateKeyLoc ??= atomExpressionErrors.privateKeyLoc;
|
|
8032
|
+
refExpressionErrors.optionalParametersLoc ??= atomExpressionErrors.optionalParametersLoc;
|
|
8033
|
+
refExpressionErrors.voidPatternLoc ??= atomExpressionErrors.voidPatternLoc;
|
|
8034
|
+
}
|
|
8035
|
+
return result;
|
|
8036
|
+
}
|
|
8026
8037
|
const expr = this.parseExprAtom(refExpressionErrors);
|
|
8027
8038
|
if (this.shouldExitDescending(expr)) return expr;
|
|
8028
8039
|
return this.parseSubscripts(expr, startLoc);
|
|
@@ -8070,7 +8081,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8070
8081
|
if (computed) {
|
|
8071
8082
|
node.property = this.parseExpression();
|
|
8072
8083
|
this.expect(1);
|
|
8073
|
-
} else if (this.match(
|
|
8084
|
+
} else if (this.match(135)) {
|
|
8074
8085
|
if (base.type === "Super") this.raise(Errors.SuperPrivateField, startLoc);
|
|
8075
8086
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
8076
8087
|
node.property = this.parsePrivateName();
|
|
@@ -8169,6 +8180,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8169
8180
|
parseNoCallExpr(onUnparenthesizedImportExpression) {
|
|
8170
8181
|
const startLoc = this.state.startLoc;
|
|
8171
8182
|
const isImport = this.match(79);
|
|
8183
|
+
this.state.canStartArrow = false;
|
|
8172
8184
|
const base = this.parseExprAtom();
|
|
8173
8185
|
if (isImport && base.type === "ImportExpression") onUnparenthesizedImportExpression(base);
|
|
8174
8186
|
return this.parseSubscripts(base, startLoc, true);
|
|
@@ -8199,9 +8211,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
8199
8211
|
case 27:
|
|
8200
8212
|
this.readRegexp();
|
|
8201
8213
|
return this.parseRegExpLiteral(this.state.value);
|
|
8202
|
-
case
|
|
8203
|
-
case
|
|
8204
|
-
case
|
|
8214
|
+
case 132: return this.parseNumericLiteral(this.state.value);
|
|
8215
|
+
case 133: return this.parseBigIntLiteral(this.state.value);
|
|
8216
|
+
case 131: return this.parseStringLiteral(this.state.value);
|
|
8205
8217
|
case 80: return this.parseNullLiteral();
|
|
8206
8218
|
case 81: return this.parseBooleanLiteral(true);
|
|
8207
8219
|
case 82: return this.parseBooleanLiteral(false);
|
|
@@ -8224,7 +8236,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8224
8236
|
if (callee.type === "MemberExpression") return this.finishNode(node, "BindExpression");
|
|
8225
8237
|
else throw this.raise(Errors.UnsupportedBind, callee);
|
|
8226
8238
|
}
|
|
8227
|
-
case
|
|
8239
|
+
case 135:
|
|
8228
8240
|
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, { identifierName: this.state.value });
|
|
8229
8241
|
return this.parsePrivateName();
|
|
8230
8242
|
case 29: return this.parseTopicReferenceThenEqualsSign(50, "%");
|
|
@@ -8248,7 +8260,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8248
8260
|
throw this.unexpected();
|
|
8249
8261
|
}
|
|
8250
8262
|
default: if (tokenIsIdentifier(type)) {
|
|
8251
|
-
if (this.isContextual(
|
|
8263
|
+
if (this.isContextual(124) && this.lookaheadInLineCharCode() === 123) return this.parseModuleExpression();
|
|
8252
8264
|
const { canStartArrow, containsEsc } = this.state;
|
|
8253
8265
|
const id = this.parseIdentifier();
|
|
8254
8266
|
if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) {
|
|
@@ -8350,7 +8362,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8350
8362
|
if (this.prodParam.hasYield && this.match(12)) {
|
|
8351
8363
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
8352
8364
|
this.next();
|
|
8353
|
-
if (this.match(
|
|
8365
|
+
if (this.match(100)) this.expectPlugin("functionSent");
|
|
8354
8366
|
else if (!this.hasPlugin("functionSent")) this.unexpected();
|
|
8355
8367
|
return this.parseMetaProperty(node, meta, "sent");
|
|
8356
8368
|
}
|
|
@@ -8368,15 +8380,15 @@ var ExpressionParser = class extends LValParser {
|
|
|
8368
8380
|
}
|
|
8369
8381
|
parseImportMetaPropertyOrPhaseCall(node) {
|
|
8370
8382
|
this.next();
|
|
8371
|
-
if (this.isContextual(
|
|
8372
|
-
const isSource = this.isContextual(
|
|
8383
|
+
if (this.isContextual(102) || this.isContextual(94)) {
|
|
8384
|
+
const isSource = this.isContextual(102);
|
|
8373
8385
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
8374
8386
|
this.next();
|
|
8375
8387
|
node.phase = isSource ? "source" : "defer";
|
|
8376
8388
|
return this.parseImportCall(node);
|
|
8377
8389
|
} else {
|
|
8378
8390
|
const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
|
|
8379
|
-
if (this.isContextual(
|
|
8391
|
+
if (this.isContextual(98)) {
|
|
8380
8392
|
if (!this.inModule) this.raise(Errors.ImportMetaOutsideModule, id);
|
|
8381
8393
|
this.sawUnambiguousESM = true;
|
|
8382
8394
|
}
|
|
@@ -8706,16 +8718,16 @@ var ExpressionParser = class extends LValParser {
|
|
|
8706
8718
|
let key;
|
|
8707
8719
|
if (tokenIsKeywordOrIdentifier(type)) key = this.parseIdentifier(true);
|
|
8708
8720
|
else switch (type) {
|
|
8709
|
-
case
|
|
8721
|
+
case 132:
|
|
8710
8722
|
key = this.parseNumericLiteral(value);
|
|
8711
8723
|
break;
|
|
8712
|
-
case
|
|
8724
|
+
case 131:
|
|
8713
8725
|
key = this.parseStringLiteral(value);
|
|
8714
8726
|
break;
|
|
8715
|
-
case
|
|
8727
|
+
case 133:
|
|
8716
8728
|
key = this.parseBigIntLiteral(value);
|
|
8717
8729
|
break;
|
|
8718
|
-
case
|
|
8730
|
+
case 135: {
|
|
8719
8731
|
const privateKeyLoc = this.state.startLoc;
|
|
8720
8732
|
if (refExpressionErrors != null) {
|
|
8721
8733
|
if (refExpressionErrors.privateKeyLoc === null) refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
@@ -8726,7 +8738,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8726
8738
|
default: throw this.unexpected();
|
|
8727
8739
|
}
|
|
8728
8740
|
prop.key = key;
|
|
8729
|
-
if (type !==
|
|
8741
|
+
if (type !== 135) prop.computed = false;
|
|
8730
8742
|
}
|
|
8731
8743
|
}
|
|
8732
8744
|
initFunction(node, isAsync) {
|
|
@@ -8754,11 +8766,13 @@ var ExpressionParser = class extends LValParser {
|
|
|
8754
8766
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
8755
8767
|
this.scope.enter(518);
|
|
8756
8768
|
let flags = functionFlags(isAsync, false);
|
|
8757
|
-
|
|
8769
|
+
const hasBlockBody = this.match(2);
|
|
8770
|
+
if (!hasBlockBody) flags |= this.prodParam.currentFlags() & 24;
|
|
8758
8771
|
this.prodParam.enter(flags);
|
|
8759
8772
|
this.initFunction(node, isAsync);
|
|
8760
8773
|
if (params) this.setArrowFunctionParameters(node, params, trailingCommaLoc);
|
|
8761
8774
|
this.parseFunctionBody(node, true);
|
|
8775
|
+
if (hasBlockBody) this.state.regExpAllowedAt = this.state.lastTokEndLoc.index;
|
|
8762
8776
|
this.prodParam.exit();
|
|
8763
8777
|
this.scope.exit();
|
|
8764
8778
|
return this.finishNode(node, "ArrowFunctionExpression");
|
|
@@ -8787,7 +8801,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8787
8801
|
if (hasStrictModeDirective && nonSimple) this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? this.optionFlags & 256 ? node.key.loc.end : node.key : node);
|
|
8788
8802
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
8789
8803
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
8790
|
-
if (
|
|
8804
|
+
if (node.id) this.checkStrictBindReservedWord(node.id, 65, strictModeChanged);
|
|
8791
8805
|
});
|
|
8792
8806
|
this.prodParam.exit();
|
|
8793
8807
|
this.state.labels = oldLabels;
|
|
@@ -8862,7 +8876,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8862
8876
|
else this.unexpected();
|
|
8863
8877
|
const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type);
|
|
8864
8878
|
if (liberal) {
|
|
8865
|
-
if (tokenIsKeyword) this.replaceToken(
|
|
8879
|
+
if (tokenIsKeyword) this.replaceToken(129);
|
|
8866
8880
|
} else this.checkReservedWord(name, this.sourceToOffsetPos(start), tokenIsKeyword, false);
|
|
8867
8881
|
this.next();
|
|
8868
8882
|
return name;
|
|
@@ -8914,13 +8928,16 @@ var ExpressionParser = class extends LValParser {
|
|
|
8914
8928
|
if (this.isAmbiguousPrefixOrIdentifier()) this.ambiguousScriptDifferentAst = true;
|
|
8915
8929
|
else this.sawUnambiguousESM = true;
|
|
8916
8930
|
}
|
|
8917
|
-
if (!soloAwait)
|
|
8931
|
+
if (!soloAwait) {
|
|
8932
|
+
this.state.canStartArrow = false;
|
|
8933
|
+
node.argument = this.parseMaybeUnary(null, true);
|
|
8934
|
+
}
|
|
8918
8935
|
return this.finishNode(node, "AwaitExpression");
|
|
8919
8936
|
}
|
|
8920
8937
|
isAmbiguousPrefixOrIdentifier() {
|
|
8921
8938
|
if (this.hasPrecedingLineBreak()) return true;
|
|
8922
8939
|
const { type } = this.state;
|
|
8923
|
-
return type === 49 || type === 6 || type === 0 || tokenIsTemplate(type) || type ===
|
|
8940
|
+
return type === 49 || type === 6 || type === 0 || tokenIsTemplate(type) || type === 99 && !this.state.containsEsc || type === 134 || type === 52 || this.hasPlugin("v8intrinsic") && type === 50;
|
|
8924
8941
|
}
|
|
8925
8942
|
parseYield(startLoc) {
|
|
8926
8943
|
this.setLoc(startLoc);
|
|
@@ -8932,7 +8949,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8932
8949
|
delegating = this.eat(51);
|
|
8933
8950
|
switch (this.state.type) {
|
|
8934
8951
|
case 9:
|
|
8935
|
-
case
|
|
8952
|
+
case 136:
|
|
8936
8953
|
case 4:
|
|
8937
8954
|
case 7:
|
|
8938
8955
|
case 1:
|
|
@@ -8942,6 +8959,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
8942
8959
|
default: argument = this.parseMaybeAssign();
|
|
8943
8960
|
}
|
|
8944
8961
|
}
|
|
8962
|
+
if (!argument) this.state.regExpAllowedAt = this.state.lastTokEndLoc.index;
|
|
8945
8963
|
node.delegate = delegating;
|
|
8946
8964
|
node.argument = argument;
|
|
8947
8965
|
return this.finishNode(node, "YieldExpression");
|
|
@@ -9006,11 +9024,11 @@ var ExpressionParser = class extends LValParser {
|
|
|
9006
9024
|
const startLoc = this.state.startLoc;
|
|
9007
9025
|
this.prodParam.enter(this.prodParam.currentFlags() & -17);
|
|
9008
9026
|
let ret;
|
|
9009
|
-
if (this.isContextual(
|
|
9027
|
+
if (this.isContextual(93) && this.recordAwaitIfAllowed()) {
|
|
9010
9028
|
this.next();
|
|
9011
9029
|
ret = this.parseAwait(startLoc, true);
|
|
9012
9030
|
const nextOp = this.state.type;
|
|
9013
|
-
if (
|
|
9031
|
+
if (nextOp !== 35 && this.isBinaryOperator(nextOp)) this.raise(Errors.PipelineUnparenthesized, startLoc);
|
|
9014
9032
|
} else {
|
|
9015
9033
|
this.state.canStartArrow = true;
|
|
9016
9034
|
ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, prec);
|
|
@@ -9064,7 +9082,7 @@ function createExportedTokens(tokens) {
|
|
|
9064
9082
|
}
|
|
9065
9083
|
var StatementParser = class extends ExpressionParser {
|
|
9066
9084
|
parseTopLevel(file, program) {
|
|
9067
|
-
file.program = this.parseProgram(program,
|
|
9085
|
+
file.program = this.parseProgram(program, 136, this.options.sourceType === "module" ? "module" : "script");
|
|
9068
9086
|
file.comments = this.comments;
|
|
9069
9087
|
if (this.optionFlags & 512) file.tokens = createExportedTokens(this.tokens);
|
|
9070
9088
|
return this.finishNode(file, "File");
|
|
@@ -9078,7 +9096,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9078
9096
|
this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
|
|
9079
9097
|
}
|
|
9080
9098
|
let finishedProgram;
|
|
9081
|
-
if (end ===
|
|
9099
|
+
if (end === 136) finishedProgram = this.finishNode(program, "Program");
|
|
9082
9100
|
else finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
|
|
9083
9101
|
return finishedProgram;
|
|
9084
9102
|
}
|
|
@@ -9103,15 +9121,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9103
9121
|
return this.finishNode(node, "InterpreterDirective");
|
|
9104
9122
|
}
|
|
9105
9123
|
isLet() {
|
|
9106
|
-
if (!this.isContextual(
|
|
9124
|
+
if (!this.isContextual(97)) return false;
|
|
9107
9125
|
return this.hasFollowingBindingAtom();
|
|
9108
9126
|
}
|
|
9109
9127
|
isUsing() {
|
|
9110
|
-
if (!this.isContextual(
|
|
9128
|
+
if (!this.isContextual(104)) return false;
|
|
9111
9129
|
return this.nextTokenIsIdentifierOnSameLine();
|
|
9112
9130
|
}
|
|
9113
9131
|
isForUsing() {
|
|
9114
|
-
if (!this.isContextual(
|
|
9132
|
+
if (!this.isContextual(104)) return false;
|
|
9115
9133
|
const next = this.nextTokenInLineStart();
|
|
9116
9134
|
const nextCh = this.codePointAtPos(next);
|
|
9117
9135
|
if (this.isUnparsedContextual(next, "of")) {
|
|
@@ -9127,7 +9145,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9127
9145
|
return this.chStartsBindingIdentifier(nextCh, next);
|
|
9128
9146
|
}
|
|
9129
9147
|
isAwaitUsing() {
|
|
9130
|
-
if (!this.isContextual(
|
|
9148
|
+
if (!this.isContextual(93)) return false;
|
|
9131
9149
|
let next = this.nextTokenInLineStart();
|
|
9132
9150
|
if (this.isUnparsedContextual(next, "using")) {
|
|
9133
9151
|
next = this.nextTokenInLineStartSince(next + 5);
|
|
@@ -9200,7 +9218,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9200
9218
|
case 64:
|
|
9201
9219
|
if (this.lookaheadCharCode() === 46) break;
|
|
9202
9220
|
if (!allowFunctionDeclaration) this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
|
|
9203
|
-
return this.parseFunctionStatement(node, false,
|
|
9221
|
+
return this.parseFunctionStatement(node, false, flags);
|
|
9204
9222
|
case 76:
|
|
9205
9223
|
if (!allowDeclaration) this.unexpected();
|
|
9206
9224
|
return this.parseClass(this.maybeTakeDecorators(decorators, node), true);
|
|
@@ -9209,7 +9227,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9209
9227
|
case 67: return this.parseSwitchStatement(node);
|
|
9210
9228
|
case 68: return this.parseThrowStatement(node);
|
|
9211
9229
|
case 69: return this.parseTryStatement(node);
|
|
9212
|
-
case
|
|
9230
|
+
case 93:
|
|
9213
9231
|
if (this.isAwaitUsing()) {
|
|
9214
9232
|
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, node);
|
|
9215
9233
|
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
@@ -9218,12 +9236,12 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9218
9236
|
return this.parseVarStatement(node, "await using");
|
|
9219
9237
|
}
|
|
9220
9238
|
break;
|
|
9221
|
-
case
|
|
9239
|
+
case 104:
|
|
9222
9240
|
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) break;
|
|
9223
9241
|
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
9224
9242
|
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
9225
9243
|
return this.parseVarStatement(node, "using");
|
|
9226
|
-
case
|
|
9244
|
+
case 97: {
|
|
9227
9245
|
if (this.state.containsEsc) break;
|
|
9228
9246
|
const next = this.nextTokenStart();
|
|
9229
9247
|
const nextCh = this.codePointAtPos(next);
|
|
@@ -9257,13 +9275,18 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9257
9275
|
default: if (this.isAsyncFunction()) {
|
|
9258
9276
|
if (!allowDeclaration) this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
9259
9277
|
this.next();
|
|
9260
|
-
return this.parseFunctionStatement(node, true,
|
|
9278
|
+
return this.parseFunctionStatement(node, true, flags);
|
|
9261
9279
|
}
|
|
9262
9280
|
}
|
|
9263
9281
|
const maybeName = this.state.value;
|
|
9282
|
+
if (startType === 89 && this.lookahead().type === 10) {
|
|
9283
|
+
const label = this.parseIdentifier(true);
|
|
9284
|
+
this.next();
|
|
9285
|
+
return this.parseLabeledStatement(node, maybeName, label, flags);
|
|
9286
|
+
}
|
|
9264
9287
|
const expr = this.parseExpression();
|
|
9265
9288
|
if (tokenIsIdentifier(startType) && expr.type === "Identifier" && this.eat(10)) return this.parseLabeledStatement(node, maybeName, expr, flags);
|
|
9266
|
-
else return this.parseExpressionStatement(node, expr);
|
|
9289
|
+
else return this.parseExpressionStatement(node, expr, flags);
|
|
9267
9290
|
}
|
|
9268
9291
|
assertModuleNodeAllowed(node) {
|
|
9269
9292
|
if (!(this.optionFlags & 8) && !this.inModule) this.raise(Errors.ImportOutsideModule, node);
|
|
@@ -9313,7 +9336,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9313
9336
|
while (this.eat(12)) {
|
|
9314
9337
|
const node = this.startNodeAt(startLoc);
|
|
9315
9338
|
node.object = expr;
|
|
9316
|
-
if (this.match(
|
|
9339
|
+
if (this.match(135)) {
|
|
9317
9340
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
9318
9341
|
node.property = this.parsePrivateName();
|
|
9319
9342
|
} else node.property = this.parseIdentifier(true);
|
|
@@ -9342,7 +9365,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9342
9365
|
this.next();
|
|
9343
9366
|
if (this.isLineTerminator()) node.label = null;
|
|
9344
9367
|
else {
|
|
9345
|
-
node.label = this.parseIdentifier();
|
|
9368
|
+
node.label = this.parseIdentifier(this.match(89));
|
|
9346
9369
|
this.semicolon();
|
|
9347
9370
|
}
|
|
9348
9371
|
this.verifyBreakContinue(node, isBreak);
|
|
@@ -9387,7 +9410,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9387
9410
|
this.next();
|
|
9388
9411
|
this.state.labels.push(loopLabel);
|
|
9389
9412
|
let awaitAt = null;
|
|
9390
|
-
if (this.isContextual(
|
|
9413
|
+
if (this.isContextual(93) && this.recordAwaitIfAllowed()) {
|
|
9391
9414
|
awaitAt = this.state.startLoc;
|
|
9392
9415
|
this.next();
|
|
9393
9416
|
}
|
|
@@ -9397,7 +9420,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9397
9420
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
9398
9421
|
return this.parseFor(node, null);
|
|
9399
9422
|
}
|
|
9400
|
-
const startsWithLet = this.isContextual(
|
|
9423
|
+
const startsWithLet = this.isContextual(97);
|
|
9401
9424
|
{
|
|
9402
9425
|
const startsWithAwaitUsing = this.isAwaitUsing();
|
|
9403
9426
|
const starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing();
|
|
@@ -9415,15 +9438,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9415
9438
|
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
9416
9439
|
const isForIn = this.match(54);
|
|
9417
9440
|
if (isForIn && starsWithUsingDeclaration) this.raise(Errors.ForInUsing, init);
|
|
9418
|
-
if ((isForIn || this.isContextual(
|
|
9441
|
+
if ((isForIn || this.isContextual(99)) && init.declarations.length === 1) return this.parseForX(node, init, awaitAt);
|
|
9419
9442
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
9420
9443
|
return this.parseFor(node, init);
|
|
9421
9444
|
}
|
|
9422
9445
|
}
|
|
9423
|
-
const startsWithAsync = this.isContextual(
|
|
9446
|
+
const startsWithAsync = this.isContextual(92);
|
|
9424
9447
|
const refExpressionErrors = new ExpressionErrors();
|
|
9425
9448
|
const init = this.parseExpression(true, refExpressionErrors);
|
|
9426
|
-
const isForOf = this.isContextual(
|
|
9449
|
+
const isForOf = this.isContextual(99);
|
|
9427
9450
|
if (isForOf) {
|
|
9428
9451
|
if (startsWithLet) this.raise(Errors.ForOfLet, init);
|
|
9429
9452
|
if (awaitAt === null && startsWithAsync && init.type === "Identifier") this.raise(Errors.ForOfAsync, init);
|
|
@@ -9438,9 +9461,14 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9438
9461
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
9439
9462
|
return this.parseFor(node, init);
|
|
9440
9463
|
}
|
|
9441
|
-
parseFunctionStatement(node, isAsync,
|
|
9464
|
+
parseFunctionStatement(node, isAsync, statementFlags) {
|
|
9442
9465
|
this.next();
|
|
9443
|
-
|
|
9466
|
+
let flags = 1 | (isAsync ? 8 : 0);
|
|
9467
|
+
if (!(statementFlags & 2) && statementFlags & 4) {
|
|
9468
|
+
flags |= 16;
|
|
9469
|
+
if (!(statementFlags & 8)) flags |= 2;
|
|
9470
|
+
}
|
|
9471
|
+
return this.parseFunction(node, flags);
|
|
9444
9472
|
}
|
|
9445
9473
|
parseIfStatement(node) {
|
|
9446
9474
|
this.next();
|
|
@@ -9569,7 +9597,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9569
9597
|
node.label = expr;
|
|
9570
9598
|
return this.finishNode(node, "LabeledStatement");
|
|
9571
9599
|
}
|
|
9572
|
-
parseExpressionStatement(node, expr) {
|
|
9600
|
+
parseExpressionStatement(node, expr, _flags) {
|
|
9573
9601
|
node.expression = expr;
|
|
9574
9602
|
this.semicolon();
|
|
9575
9603
|
return this.finishNode(node, "ExpressionStatement");
|
|
@@ -9651,9 +9679,9 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9651
9679
|
const decl = this.startNode();
|
|
9652
9680
|
this.parseVarId(decl, kind);
|
|
9653
9681
|
decl.init = !this.eat(25) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
9654
|
-
if (decl.init === null && !allowMissingInitializer) {
|
|
9655
|
-
if (decl.id.type !== "Identifier"
|
|
9656
|
-
else if (
|
|
9682
|
+
if (decl.init === null && !allowMissingInitializer && !(isFor && declarations.length === 0 && (this.match(54) || this.isContextual(99)))) {
|
|
9683
|
+
if (decl.id.type !== "Identifier") this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind: "destructuring" });
|
|
9684
|
+
else if (kind === "const" || kind === "using" || kind === "await using") this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind });
|
|
9657
9685
|
}
|
|
9658
9686
|
declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
9659
9687
|
if (!this.eat(8)) break;
|
|
@@ -9672,13 +9700,12 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9672
9700
|
return this.parseFunction(node, 8);
|
|
9673
9701
|
}
|
|
9674
9702
|
parseFunction(node, flags = 0) {
|
|
9675
|
-
const hangingDeclaration = flags & 2;
|
|
9676
9703
|
const isDeclaration = !!(flags & 1);
|
|
9677
9704
|
const requireId = isDeclaration && !(flags & 4);
|
|
9678
9705
|
const isAsync = !!(flags & 8);
|
|
9679
9706
|
this.initFunction(node, isAsync);
|
|
9680
9707
|
if (this.match(51)) {
|
|
9681
|
-
if (
|
|
9708
|
+
if (flags & 16) this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
9682
9709
|
this.next();
|
|
9683
9710
|
node.generator = true;
|
|
9684
9711
|
}
|
|
@@ -9694,7 +9721,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9694
9721
|
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
9695
9722
|
this.prodParam.exit();
|
|
9696
9723
|
this.scope.exit();
|
|
9697
|
-
if (isDeclaration && !
|
|
9724
|
+
if (isDeclaration && !(flags & 2)) this.registerFunctionStatementId(node);
|
|
9698
9725
|
return node;
|
|
9699
9726
|
}
|
|
9700
9727
|
parseFunctionId(requireId) {
|
|
@@ -9786,7 +9813,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9786
9813
|
return false;
|
|
9787
9814
|
}
|
|
9788
9815
|
parseClassMember(classBody, member, state) {
|
|
9789
|
-
const isStatic = this.isContextual(
|
|
9816
|
+
const isStatic = this.isContextual(103);
|
|
9790
9817
|
if (isStatic) {
|
|
9791
9818
|
if (this.parseClassMemberFromModifier(classBody, member)) return;
|
|
9792
9819
|
if (this.eat(2)) {
|
|
@@ -9808,7 +9835,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9808
9835
|
this.parsePropertyNamePrefixOperator(member);
|
|
9809
9836
|
if (this.eat(51)) {
|
|
9810
9837
|
method.kind = "method";
|
|
9811
|
-
const isPrivateName = this.match(
|
|
9838
|
+
const isPrivateName = this.match(135);
|
|
9812
9839
|
this.parseClassElementName(method);
|
|
9813
9840
|
this.parsePostMemberNameModifiers(method);
|
|
9814
9841
|
if (isPrivateName) {
|
|
@@ -9850,7 +9877,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9850
9877
|
const isGenerator = this.eat(51);
|
|
9851
9878
|
if (publicMember.optional) this.unexpected(maybeQuestionTokenStartLoc);
|
|
9852
9879
|
method.kind = "method";
|
|
9853
|
-
const isPrivate = this.match(
|
|
9880
|
+
const isPrivate = this.match(135);
|
|
9854
9881
|
this.parseClassElementName(method);
|
|
9855
9882
|
this.parsePostMemberNameModifiers(publicMember);
|
|
9856
9883
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
@@ -9861,7 +9888,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9861
9888
|
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(51) && this.isLineTerminator())) {
|
|
9862
9889
|
this.resetPreviousNodeTrailingComments(key);
|
|
9863
9890
|
method.kind = maybeContextualKw;
|
|
9864
|
-
const isPrivate = this.match(
|
|
9891
|
+
const isPrivate = this.match(135);
|
|
9865
9892
|
this.parseClassElementName(publicMethod);
|
|
9866
9893
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
9867
9894
|
else {
|
|
@@ -9872,7 +9899,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9872
9899
|
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
9873
9900
|
this.expectPlugin("decoratorAutoAccessors");
|
|
9874
9901
|
this.resetPreviousNodeTrailingComments(key);
|
|
9875
|
-
const isPrivate = this.match(
|
|
9902
|
+
const isPrivate = this.match(135);
|
|
9876
9903
|
this.parseClassElementName(publicProp);
|
|
9877
9904
|
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
9878
9905
|
} else if (this.isLineTerminator()) {
|
|
@@ -9882,8 +9909,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9882
9909
|
}
|
|
9883
9910
|
parseClassElementName(member) {
|
|
9884
9911
|
const { type, value } = this.state;
|
|
9885
|
-
if ((type ===
|
|
9886
|
-
if (type ===
|
|
9912
|
+
if ((type === 129 || type === 131) && member.static && value === "prototype") this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
9913
|
+
if (type === 135) {
|
|
9887
9914
|
if (value === "constructor") this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
9888
9915
|
const key = this.parsePrivateName();
|
|
9889
9916
|
member.key = key;
|
|
@@ -9960,6 +9987,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9960
9987
|
parseClassId(node, isStatement, optionalId, bindingType = 8331) {
|
|
9961
9988
|
if (tokenIsIdentifier(this.state.type)) {
|
|
9962
9989
|
node.id = this.parseIdentifier();
|
|
9990
|
+
this.checkStrictBindReservedWord(node.id, bindingType);
|
|
9963
9991
|
if (isStatement) this.declareNameFromIdentifier(node.id, bindingType);
|
|
9964
9992
|
} else if (optionalId || !isStatement) node.id = null;
|
|
9965
9993
|
else throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
@@ -9976,7 +10004,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9976
10004
|
const parseAfterDefault = !hasDefault || this.eat(8);
|
|
9977
10005
|
const hasStar = parseAfterDefault && this.eatExportStar(node);
|
|
9978
10006
|
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
|
|
9979
|
-
const parseAfterNamespace = parseAfterDefault &&
|
|
10007
|
+
const parseAfterNamespace = parseAfterDefault && !hasNamespace;
|
|
9980
10008
|
const isFromRequired = hasDefault || hasStar;
|
|
9981
10009
|
if (hasStar && !hasNamespace) {
|
|
9982
10010
|
if (hasDefault) this.unexpected();
|
|
@@ -9985,9 +10013,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
9985
10013
|
this.sawUnambiguousESM = true;
|
|
9986
10014
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
9987
10015
|
}
|
|
9988
|
-
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
|
10016
|
+
const hasSpecifiers = parseAfterNamespace && this.maybeParseExportNamedSpecifiers(node);
|
|
9989
10017
|
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) this.unexpected(null, 2);
|
|
9990
|
-
if (hasNamespace && parseAfterNamespace) this.unexpected(null, 94);
|
|
9991
10018
|
let hasDeclaration;
|
|
9992
10019
|
if (isFromRequired || hasSpecifiers) {
|
|
9993
10020
|
hasDeclaration = false;
|
|
@@ -10032,7 +10059,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10032
10059
|
return false;
|
|
10033
10060
|
}
|
|
10034
10061
|
maybeParseExportNamespaceSpecifier(node) {
|
|
10035
|
-
if (this.isContextual(
|
|
10062
|
+
if (this.isContextual(90)) {
|
|
10036
10063
|
node.specifiers ??= [];
|
|
10037
10064
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
10038
10065
|
this.next();
|
|
@@ -10066,7 +10093,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10066
10093
|
return false;
|
|
10067
10094
|
}
|
|
10068
10095
|
isAsyncFunction() {
|
|
10069
|
-
if (!this.isContextual(
|
|
10096
|
+
if (!this.isContextual(92)) return false;
|
|
10070
10097
|
const next = this.nextTokenInLineStart();
|
|
10071
10098
|
return this.isUnparsedContextual(next, "function");
|
|
10072
10099
|
}
|
|
@@ -10094,8 +10121,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10094
10121
|
isExportDefaultSpecifier() {
|
|
10095
10122
|
const { type } = this.state;
|
|
10096
10123
|
if (tokenIsIdentifier(type)) {
|
|
10097
|
-
if (type ===
|
|
10098
|
-
if ((type ===
|
|
10124
|
+
if (type === 92 && !this.state.containsEsc || type === 97) return false;
|
|
10125
|
+
if ((type === 127 || type === 126) && !this.state.containsEsc) {
|
|
10099
10126
|
const next = this.nextTokenStart();
|
|
10100
10127
|
const nextChar = this.input.charCodeAt(next);
|
|
10101
10128
|
if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.input.startsWith("from", next)) {
|
|
@@ -10108,16 +10135,16 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10108
10135
|
const hasFrom = this.isUnparsedContextual(next, "from");
|
|
10109
10136
|
if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.state.type) && hasFrom) return true;
|
|
10110
10137
|
if (this.match(61) && hasFrom) {
|
|
10111
|
-
const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
|
|
10138
|
+
const nextAfterFrom = this.input.charCodeAt(this.hasPlugin("exportDefaultFrom") ? this.nextTokenStartSince(next + 4) : this.nextTokenInLineStartSince(next + 4));
|
|
10112
10139
|
return nextAfterFrom === 34 || nextAfterFrom === 39;
|
|
10113
10140
|
}
|
|
10114
10141
|
return false;
|
|
10115
10142
|
}
|
|
10116
10143
|
parseExportFrom(node, expect) {
|
|
10117
|
-
if (this.eatContextual(
|
|
10144
|
+
if (this.eatContextual(95)) {
|
|
10118
10145
|
node.source = this.parseImportSource();
|
|
10119
10146
|
this.maybeParseImportAttributes(node);
|
|
10120
|
-
} else if (expect) this.unexpected();
|
|
10147
|
+
} else if (expect) this.unexpected(null, 95);
|
|
10121
10148
|
this.semicolon();
|
|
10122
10149
|
}
|
|
10123
10150
|
shouldParseExportDeclaration() {
|
|
@@ -10188,8 +10215,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10188
10215
|
this.expect(8);
|
|
10189
10216
|
if (this.eat(4)) break;
|
|
10190
10217
|
}
|
|
10191
|
-
const isMaybeTypeOnly = this.isContextual(
|
|
10192
|
-
const isString = this.match(
|
|
10218
|
+
const isMaybeTypeOnly = this.isContextual(127);
|
|
10219
|
+
const isString = this.match(131);
|
|
10193
10220
|
const node = this.startNode();
|
|
10194
10221
|
node.local = this.parseModuleExportName();
|
|
10195
10222
|
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
@@ -10197,13 +10224,13 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10197
10224
|
return nodes;
|
|
10198
10225
|
}
|
|
10199
10226
|
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
10200
|
-
if (this.eatContextual(
|
|
10227
|
+
if (this.eatContextual(90)) node.exported = this.parseModuleExportName();
|
|
10201
10228
|
else if (isString) node.exported = this.cloneStringLiteral(node.local);
|
|
10202
10229
|
else if (!node.exported) node.exported = this.cloneIdentifier(node.local);
|
|
10203
10230
|
return this.finishNode(node, "ExportSpecifier");
|
|
10204
10231
|
}
|
|
10205
10232
|
parseModuleExportName() {
|
|
10206
|
-
if (this.match(
|
|
10233
|
+
if (this.match(131)) {
|
|
10207
10234
|
const result = this.parseStringLiteral(this.state.value);
|
|
10208
10235
|
const surrogate = loneSurrogate.exec(result.value);
|
|
10209
10236
|
if (surrogate) this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, { surrogateCharCode: surrogate[0].charCodeAt(0) });
|
|
@@ -10222,7 +10249,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10222
10249
|
}
|
|
10223
10250
|
isPotentialImportPhase(isExport) {
|
|
10224
10251
|
if (isExport) return false;
|
|
10225
|
-
return this.isContextual(
|
|
10252
|
+
return this.isContextual(102) || this.isContextual(94);
|
|
10226
10253
|
}
|
|
10227
10254
|
applyImportPhase(node, isExport, phase, loc) {
|
|
10228
10255
|
if (isExport) return;
|
|
@@ -10232,7 +10259,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10232
10259
|
} else if (phase === "defer") {
|
|
10233
10260
|
this.expectPlugin("deferredImportEvaluation", loc);
|
|
10234
10261
|
node.phase = "defer";
|
|
10235
|
-
} else if (this.hasPlugin("sourcePhaseImports")) node.phase = null;
|
|
10262
|
+
} else if (this.hasPlugin("sourcePhaseImports") || this.hasPlugin("deferredImportEvaluation")) node.phase = null;
|
|
10236
10263
|
}
|
|
10237
10264
|
parseMaybeImportPhase(node, isExport) {
|
|
10238
10265
|
if (!this.isPotentialImportPhase(isExport)) {
|
|
@@ -10242,7 +10269,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10242
10269
|
const phaseIdentifier = this.startNode();
|
|
10243
10270
|
const phaseIdentifierName = this.parseIdentifierName(true);
|
|
10244
10271
|
const { type } = this.state;
|
|
10245
|
-
if (tokenIsKeywordOrIdentifier(type) ? type !==
|
|
10272
|
+
if (tokenIsKeywordOrIdentifier(type) ? type !== 95 || this.lookaheadCharCode() === 102 : type !== 8) {
|
|
10246
10273
|
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.start);
|
|
10247
10274
|
return null;
|
|
10248
10275
|
} else {
|
|
@@ -10252,10 +10279,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10252
10279
|
}
|
|
10253
10280
|
isPrecedingIdImportPhase(phase) {
|
|
10254
10281
|
const { type } = this.state;
|
|
10255
|
-
return tokenIsIdentifier(type) ? type !==
|
|
10282
|
+
return tokenIsIdentifier(type) ? type !== 95 || this.lookaheadCharCode() === 102 : type !== 8;
|
|
10256
10283
|
}
|
|
10257
10284
|
parseImport(node) {
|
|
10258
|
-
if (this.match(
|
|
10285
|
+
if (this.match(131)) return this.parseImportSourceAndAttributes(node);
|
|
10259
10286
|
return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
|
|
10260
10287
|
}
|
|
10261
10288
|
parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier) {
|
|
@@ -10263,7 +10290,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10263
10290
|
const parseNext = !this.maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier) || this.eat(8);
|
|
10264
10291
|
const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
|
|
10265
10292
|
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
|
|
10266
|
-
this.expectContextual(
|
|
10293
|
+
this.expectContextual(95);
|
|
10267
10294
|
return this.parseImportSourceAndAttributes(node);
|
|
10268
10295
|
}
|
|
10269
10296
|
parseImportSourceAndAttributes(node) {
|
|
@@ -10276,7 +10303,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10276
10303
|
return this.finishNode(node, "ImportDeclaration");
|
|
10277
10304
|
}
|
|
10278
10305
|
parseImportSource() {
|
|
10279
|
-
if (!this.match(
|
|
10306
|
+
if (!this.match(131)) this.unexpected();
|
|
10280
10307
|
return this.parseExprAtom();
|
|
10281
10308
|
}
|
|
10282
10309
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -10297,10 +10324,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10297
10324
|
const keyName = this.state.value;
|
|
10298
10325
|
if (attrNames.has(keyName)) this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, { key: keyName });
|
|
10299
10326
|
attrNames.add(keyName);
|
|
10300
|
-
if (this.match(
|
|
10327
|
+
if (this.match(131)) node.key = this.parseStringLiteral(keyName);
|
|
10301
10328
|
else node.key = this.parseIdentifier(true);
|
|
10302
10329
|
this.expect(10);
|
|
10303
|
-
if (!this.match(
|
|
10330
|
+
if (!this.match(131)) throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
10304
10331
|
node.value = this.parseStringLiteral(this.state.value);
|
|
10305
10332
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
10306
10333
|
} while (this.eat(8));
|
|
@@ -10332,7 +10359,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10332
10359
|
if (this.match(51)) {
|
|
10333
10360
|
const specifier = this.startNode();
|
|
10334
10361
|
this.next();
|
|
10335
|
-
this.expectContextual(
|
|
10362
|
+
this.expectContextual(90);
|
|
10336
10363
|
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
|
|
10337
10364
|
return true;
|
|
10338
10365
|
}
|
|
@@ -10349,15 +10376,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
10349
10376
|
if (this.eat(4)) break;
|
|
10350
10377
|
}
|
|
10351
10378
|
const specifier = this.startNode();
|
|
10352
|
-
const importedIsString = this.match(
|
|
10353
|
-
const isMaybeTypeOnly = this.isContextual(
|
|
10379
|
+
const importedIsString = this.match(131);
|
|
10380
|
+
const isMaybeTypeOnly = this.isContextual(127);
|
|
10354
10381
|
specifier.imported = this.parseModuleExportName();
|
|
10355
10382
|
const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, void 0);
|
|
10356
10383
|
node.specifiers.push(importSpecifier);
|
|
10357
10384
|
}
|
|
10358
10385
|
}
|
|
10359
10386
|
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
10360
|
-
if (this.eatContextual(
|
|
10387
|
+
if (this.eatContextual(90)) specifier.local = this.parseIdentifier();
|
|
10361
10388
|
else {
|
|
10362
10389
|
const { imported } = specifier;
|
|
10363
10390
|
if (importedIsString) throw this.raise(Errors.ImportBindingIsString, specifier, { importName: imported.value });
|
|
@@ -10525,7 +10552,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10525
10552
|
return tokenIsIdentifier(this.state.type);
|
|
10526
10553
|
}
|
|
10527
10554
|
tsTokenCanFollowModifier() {
|
|
10528
|
-
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(
|
|
10555
|
+
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(135) || this.isLiteralPropertyName();
|
|
10529
10556
|
}
|
|
10530
10557
|
tsNextTokenOnSameLineAndCanFollowModifier() {
|
|
10531
10558
|
this.next();
|
|
@@ -10533,7 +10560,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10533
10560
|
return this.tsTokenCanFollowModifier();
|
|
10534
10561
|
}
|
|
10535
10562
|
tsNextTokenCanFollowModifier() {
|
|
10536
|
-
if (this.match(
|
|
10563
|
+
if (this.match(103)) {
|
|
10537
10564
|
this.next();
|
|
10538
10565
|
return this.tsTokenCanFollowModifier();
|
|
10539
10566
|
}
|
|
@@ -10543,9 +10570,15 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10543
10570
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 54 && this.state.type !== 71) return;
|
|
10544
10571
|
const modifier = this.state.value;
|
|
10545
10572
|
if (modifiers.has(modifier)) {
|
|
10546
|
-
if (hasSeenStaticModifier && this.match(
|
|
10573
|
+
if (hasSeenStaticModifier && this.match(103)) return;
|
|
10547
10574
|
if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) return;
|
|
10548
|
-
|
|
10575
|
+
const escapedKeywordLoc = this.state.containsEsc && !tokenIsIdentifier(this.state.type) ? this.state.startLoc : null;
|
|
10576
|
+
if (escapedKeywordLoc) this.state.containsEsc = false;
|
|
10577
|
+
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
|
|
10578
|
+
if (escapedKeywordLoc) this.raise(Errors.InvalidEscapedReservedWord, escapedKeywordLoc, { reservedWord: modifier });
|
|
10579
|
+
return modifier;
|
|
10580
|
+
}
|
|
10581
|
+
if (escapedKeywordLoc) this.state.containsEsc = true;
|
|
10549
10582
|
}
|
|
10550
10583
|
}
|
|
10551
10584
|
tsParseModifiers(modifiers, errorTemplate = TSErrors.InvalidModifierOnTypeMember, modified, stopOnStartOfClassStaticBlock = false) {
|
|
@@ -10637,7 +10670,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10637
10670
|
const node = this.startNode();
|
|
10638
10671
|
this.expect(79);
|
|
10639
10672
|
this.expect(6);
|
|
10640
|
-
if (!this.match(
|
|
10673
|
+
if (!this.match(131)) {
|
|
10641
10674
|
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
10642
10675
|
node.source = this.tsParseNonConditionalType();
|
|
10643
10676
|
} else node.source = this.parseStringLiteral(this.state.value);
|
|
@@ -10671,7 +10704,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10671
10704
|
this.expect(2);
|
|
10672
10705
|
while (!this.match(4)) {
|
|
10673
10706
|
const type = this.state.type;
|
|
10674
|
-
if (tokenIsIdentifier(type) || type ===
|
|
10707
|
+
if (tokenIsIdentifier(type) || type === 131) properties.push(super.parsePropertyDefinition(null));
|
|
10675
10708
|
else this.unexpected();
|
|
10676
10709
|
this.eat(8);
|
|
10677
10710
|
}
|
|
@@ -10761,7 +10794,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10761
10794
|
}
|
|
10762
10795
|
tsParseTypeParameters(parseModifiers) {
|
|
10763
10796
|
const node = this.startNode();
|
|
10764
|
-
if (this.match(43) || this.match(
|
|
10797
|
+
if (this.match(43) || this.match(139)) this.next();
|
|
10765
10798
|
else this.unexpected();
|
|
10766
10799
|
const refTrailingCommaPos = { value: -1 };
|
|
10767
10800
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
@@ -10885,8 +10918,8 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10885
10918
|
}
|
|
10886
10919
|
tsIsStartOfMappedType() {
|
|
10887
10920
|
this.next();
|
|
10888
|
-
if (this.eat(49)) return this.isContextual(
|
|
10889
|
-
if (this.isContextual(
|
|
10921
|
+
if (this.eat(49)) return this.isContextual(119);
|
|
10922
|
+
if (this.isContextual(119)) this.next();
|
|
10890
10923
|
if (!this.match(0)) return false;
|
|
10891
10924
|
this.next();
|
|
10892
10925
|
if (!this.tsIsIdentifier()) return false;
|
|
@@ -10899,12 +10932,12 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10899
10932
|
if (this.match(49)) {
|
|
10900
10933
|
node.readonly = this.state.value;
|
|
10901
10934
|
this.next();
|
|
10902
|
-
this.expectContextual(
|
|
10903
|
-
} else if (this.eatContextual(
|
|
10935
|
+
this.expectContextual(119);
|
|
10936
|
+
} else if (this.eatContextual(119)) node.readonly = true;
|
|
10904
10937
|
this.expect(0);
|
|
10905
10938
|
node.key = this.tsParseTypeParameterName();
|
|
10906
10939
|
node.constraint = this.tsExpectThenParseType(54);
|
|
10907
|
-
node.nameType = this.eatContextual(
|
|
10940
|
+
node.nameType = this.eatContextual(90) ? this.tsParseType() : null;
|
|
10908
10941
|
this.expect(1);
|
|
10909
10942
|
if (this.match(49)) {
|
|
10910
10943
|
node.optional = this.state.value;
|
|
@@ -11013,9 +11046,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11013
11046
|
tsParseLiteralTypeNode() {
|
|
11014
11047
|
const node = this.startNode();
|
|
11015
11048
|
switch (this.state.type) {
|
|
11016
|
-
case 131:
|
|
11017
11049
|
case 132:
|
|
11018
|
-
case
|
|
11050
|
+
case 133:
|
|
11051
|
+
case 131:
|
|
11019
11052
|
case 81:
|
|
11020
11053
|
case 82:
|
|
11021
11054
|
node.literal = super.parseExprAtom();
|
|
@@ -11054,21 +11087,21 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11054
11087
|
}
|
|
11055
11088
|
tsParseThisTypeOrThisTypePredicate() {
|
|
11056
11089
|
const thisKeyword = this.tsParseThisTypeNode();
|
|
11057
|
-
if (this.isContextual(
|
|
11090
|
+
if (this.isContextual(113) && !this.hasPrecedingLineBreak()) return this.tsParseThisTypePredicate(thisKeyword);
|
|
11058
11091
|
else return thisKeyword;
|
|
11059
11092
|
}
|
|
11060
11093
|
tsParseNonArrayType() {
|
|
11061
11094
|
switch (this.state.type) {
|
|
11062
|
-
case 130:
|
|
11063
11095
|
case 131:
|
|
11064
11096
|
case 132:
|
|
11097
|
+
case 133:
|
|
11065
11098
|
case 81:
|
|
11066
11099
|
case 82: return this.tsParseLiteralTypeNode();
|
|
11067
11100
|
case 49:
|
|
11068
11101
|
if (this.state.value === "-") {
|
|
11069
11102
|
const node = this.startNode();
|
|
11070
11103
|
const nextToken = this.lookahead();
|
|
11071
|
-
if (nextToken.type !==
|
|
11104
|
+
if (nextToken.type !== 132 && nextToken.type !== 133) this.unexpected();
|
|
11072
11105
|
node.literal = this.parseMaybeUnary();
|
|
11073
11106
|
return this.finishNode(node, "TSLiteralType");
|
|
11074
11107
|
}
|
|
@@ -11141,7 +11174,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11141
11174
|
}
|
|
11142
11175
|
tsParseInferType() {
|
|
11143
11176
|
const node = this.startNode();
|
|
11144
|
-
this.expectContextual(
|
|
11177
|
+
this.expectContextual(112);
|
|
11145
11178
|
const typeParameter = this.startNode();
|
|
11146
11179
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
11147
11180
|
typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
|
|
@@ -11155,7 +11188,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11155
11188
|
}
|
|
11156
11189
|
}
|
|
11157
11190
|
tsParseTypeOperatorOrHigher() {
|
|
11158
|
-
return tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(
|
|
11191
|
+
return tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
|
|
11159
11192
|
}
|
|
11160
11193
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
11161
11194
|
const node = this.startNode();
|
|
@@ -11266,13 +11299,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11266
11299
|
}
|
|
11267
11300
|
tsParseTypePredicatePrefix() {
|
|
11268
11301
|
const id = this.parseIdentifier();
|
|
11269
|
-
if (this.isContextual(
|
|
11302
|
+
if (this.isContextual(113) && !this.hasPrecedingLineBreak()) {
|
|
11270
11303
|
this.next();
|
|
11271
11304
|
return id;
|
|
11272
11305
|
}
|
|
11273
11306
|
}
|
|
11274
11307
|
tsParseTypePredicateAsserts() {
|
|
11275
|
-
if (this.state.type !==
|
|
11308
|
+
if (this.state.type !== 106) return false;
|
|
11276
11309
|
const containsEsc = this.state.containsEsc;
|
|
11277
11310
|
this.next();
|
|
11278
11311
|
if (!tokenIsIdentifier(this.state.type) && !this.match(74)) return false;
|
|
@@ -11300,7 +11333,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11300
11333
|
return this.finishNode(node, "TSConditionalType");
|
|
11301
11334
|
}
|
|
11302
11335
|
isAbstractConstructorSignature() {
|
|
11303
|
-
return this.isContextual(
|
|
11336
|
+
return this.isContextual(121) && this.isLookaheadContextual("new");
|
|
11304
11337
|
}
|
|
11305
11338
|
tsParseNonConditionalType() {
|
|
11306
11339
|
if (this.tsIsStartOfFunctionType()) return this.tsParseFunctionOrConstructorType("TSFunctionType");
|
|
@@ -11316,6 +11349,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11316
11349
|
return this.match(71) ? this.tsParseTypeReference() : this.tsParseType();
|
|
11317
11350
|
});
|
|
11318
11351
|
this.expect(44);
|
|
11352
|
+
this.state.canStartArrow = false;
|
|
11319
11353
|
node.expression = this.parseMaybeUnary();
|
|
11320
11354
|
return this.finishNode(node, "TSTypeAssertion");
|
|
11321
11355
|
}
|
|
@@ -11339,7 +11373,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11339
11373
|
}
|
|
11340
11374
|
tsParseInterfaceDeclaration(node, properties = {}) {
|
|
11341
11375
|
if (this.hasFollowingLineBreak()) return null;
|
|
11342
|
-
this.expectContextual(
|
|
11376
|
+
this.expectContextual(126);
|
|
11343
11377
|
if (properties.declare) node.declare = true;
|
|
11344
11378
|
if (tokenIsIdentifier(this.state.type)) {
|
|
11345
11379
|
node.id = this.parseIdentifier();
|
|
@@ -11361,7 +11395,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11361
11395
|
node.typeAnnotation = this.tsInType(() => {
|
|
11362
11396
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
|
|
11363
11397
|
this.expect(25);
|
|
11364
|
-
if (this.isContextual(
|
|
11398
|
+
if (this.isContextual(111) && this.lookaheadCharCode() !== 46) {
|
|
11365
11399
|
const node = this.startNode();
|
|
11366
11400
|
this.next();
|
|
11367
11401
|
return this.finishNode(node, "TSIntrinsicKeyword");
|
|
@@ -11426,14 +11460,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11426
11460
|
}
|
|
11427
11461
|
tsParseEnumMember() {
|
|
11428
11462
|
const node = this.startNode();
|
|
11429
|
-
node.id = this.match(
|
|
11463
|
+
node.id = this.match(131) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
|
|
11430
11464
|
if (this.eat(25)) node.initializer = super.parseMaybeAssignAllowIn();
|
|
11431
11465
|
return this.finishNode(node, "TSEnumMember");
|
|
11432
11466
|
}
|
|
11433
11467
|
tsParseEnumDeclaration(node, properties = {}) {
|
|
11434
11468
|
if (properties.const) node.const = true;
|
|
11435
11469
|
if (properties.declare) node.declare = true;
|
|
11436
|
-
this.expectContextual(
|
|
11470
|
+
this.expectContextual(123);
|
|
11437
11471
|
node.id = this.parseIdentifier();
|
|
11438
11472
|
this.checkIdentifier(node.id, node.const ? 8971 : 8459);
|
|
11439
11473
|
node.body = this.tsParseEnumBody();
|
|
@@ -11465,14 +11499,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11465
11499
|
return this.finishNode(node, "TSModuleDeclaration");
|
|
11466
11500
|
}
|
|
11467
11501
|
tsParseAmbientExternalModuleDeclaration(node) {
|
|
11468
|
-
const isGlobal = this.isContextual(
|
|
11502
|
+
const isGlobal = this.isContextual(109);
|
|
11469
11503
|
if (isGlobal) {
|
|
11470
11504
|
node.kind = "global";
|
|
11471
11505
|
node.id = this.parseIdentifier();
|
|
11472
11506
|
} else {
|
|
11473
11507
|
node.kind = "module";
|
|
11474
11508
|
const { type, value } = this.state;
|
|
11475
|
-
if (type ===
|
|
11509
|
+
if (type === 131) node.id = super.parseStringLiteral(value);
|
|
11476
11510
|
else if (tokenIsIdentifier(type)) {
|
|
11477
11511
|
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
11478
11512
|
node.id = this.tsParseEntityName(0);
|
|
@@ -11502,16 +11536,16 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11502
11536
|
return this.finishNode(node, "TSImportEqualsDeclaration");
|
|
11503
11537
|
}
|
|
11504
11538
|
tsIsExternalModuleReference() {
|
|
11505
|
-
return this.isContextual(
|
|
11539
|
+
return this.isContextual(116) && this.lookaheadCharCode() === 40;
|
|
11506
11540
|
}
|
|
11507
11541
|
tsParseModuleReference() {
|
|
11508
11542
|
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
|
|
11509
11543
|
}
|
|
11510
11544
|
tsParseExternalModuleReference() {
|
|
11511
11545
|
const node = this.startNode();
|
|
11512
|
-
this.expectContextual(
|
|
11546
|
+
this.expectContextual(116);
|
|
11513
11547
|
this.expect(6);
|
|
11514
|
-
if (!this.match(
|
|
11548
|
+
if (!this.match(131)) this.unexpected();
|
|
11515
11549
|
node.expression = super.parseExprAtom();
|
|
11516
11550
|
this.expect(7);
|
|
11517
11551
|
this.sawUnambiguousESM = true;
|
|
@@ -11542,13 +11576,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11542
11576
|
switch (startType) {
|
|
11543
11577
|
case 64:
|
|
11544
11578
|
node.declare = true;
|
|
11545
|
-
return super.parseFunctionStatement(node, false,
|
|
11579
|
+
return super.parseFunctionStatement(node, false, 2);
|
|
11546
11580
|
case 76:
|
|
11547
11581
|
node.declare = true;
|
|
11548
11582
|
return this.parseClass(node, true, false);
|
|
11549
|
-
case
|
|
11550
|
-
case
|
|
11551
|
-
case
|
|
11583
|
+
case 123: return this.tsParseEnumDeclaration(node, { declare: true });
|
|
11584
|
+
case 109: return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
11585
|
+
case 97: if (this.state.containsEsc) return;
|
|
11552
11586
|
case 71:
|
|
11553
11587
|
case 70:
|
|
11554
11588
|
if (!this.match(71) || !this.isLookaheadContextual("enum")) {
|
|
@@ -11560,14 +11594,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11560
11594
|
const: true,
|
|
11561
11595
|
declare: true
|
|
11562
11596
|
});
|
|
11563
|
-
case
|
|
11597
|
+
case 104:
|
|
11564
11598
|
if (this.isUsing()) {
|
|
11565
11599
|
this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
|
|
11566
11600
|
node.declare = true;
|
|
11567
11601
|
return this.parseVarStatement(node, "using", true);
|
|
11568
11602
|
}
|
|
11569
11603
|
break;
|
|
11570
|
-
case
|
|
11604
|
+
case 93:
|
|
11571
11605
|
if (this.isAwaitUsing()) {
|
|
11572
11606
|
this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
|
|
11573
11607
|
node.declare = true;
|
|
@@ -11575,7 +11609,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11575
11609
|
return this.parseVarStatement(node, "await using", true);
|
|
11576
11610
|
}
|
|
11577
11611
|
break;
|
|
11578
|
-
case
|
|
11612
|
+
case 126: {
|
|
11579
11613
|
const result = this.tsParseInterfaceDeclaration(node, { declare: true });
|
|
11580
11614
|
if (result) return result;
|
|
11581
11615
|
}
|
|
@@ -11588,19 +11622,19 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11588
11622
|
}
|
|
11589
11623
|
tsParseDeclaration(node, type, next, decorators) {
|
|
11590
11624
|
switch (type) {
|
|
11591
|
-
case
|
|
11625
|
+
case 121:
|
|
11592
11626
|
if (this.tsCheckLineTerminator(next) && (this.match(76) || tokenIsIdentifier(this.state.type))) return this.tsParseAbstractDeclaration(node, decorators);
|
|
11593
11627
|
break;
|
|
11594
|
-
case
|
|
11628
|
+
case 124:
|
|
11595
11629
|
if (this.tsCheckLineTerminator(next)) return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
11596
11630
|
break;
|
|
11597
|
-
case
|
|
11631
|
+
case 125:
|
|
11598
11632
|
if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
|
|
11599
11633
|
node.kind = "namespace";
|
|
11600
11634
|
return this.tsParseNamespaceDeclaration(node);
|
|
11601
11635
|
}
|
|
11602
11636
|
break;
|
|
11603
|
-
case
|
|
11637
|
+
case 127: if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) return this.tsParseTypeAliasDeclaration(node);
|
|
11604
11638
|
}
|
|
11605
11639
|
}
|
|
11606
11640
|
tsCheckLineTerminator(next) {
|
|
@@ -11765,7 +11799,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11765
11799
|
return this.finishCallExpression(node, state.optionalChainMember);
|
|
11766
11800
|
}
|
|
11767
11801
|
const tokenType = this.state.type;
|
|
11768
|
-
if (tokenType === 44 || tokenType === 48 || tokenType !== 6 && tokenType !==
|
|
11802
|
+
if (tokenType === 44 || tokenType === 48 || tokenType !== 6 && tokenType !== 90 && tokenType !== 117 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) return;
|
|
11769
11803
|
const node = this.startNodeAt(startLoc);
|
|
11770
11804
|
node.expression = base;
|
|
11771
11805
|
node.typeArguments = typeArguments;
|
|
@@ -11792,7 +11826,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11792
11826
|
}
|
|
11793
11827
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
11794
11828
|
let isSatisfies;
|
|
11795
|
-
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(
|
|
11829
|
+
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(90) || (isSatisfies = this.isContextual(117)))) {
|
|
11796
11830
|
const node = this.startNodeAt(leftStartLoc);
|
|
11797
11831
|
node.expression = left;
|
|
11798
11832
|
node.typeAnnotation = this.tsInType(() => {
|
|
@@ -11815,7 +11849,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11815
11849
|
checkDuplicateExports() {}
|
|
11816
11850
|
isPotentialImportPhase(isExport) {
|
|
11817
11851
|
if (super.isPotentialImportPhase(isExport)) return true;
|
|
11818
|
-
if (this.isContextual(
|
|
11852
|
+
if (this.isContextual(127)) {
|
|
11819
11853
|
const ch = this.lookaheadCharCode();
|
|
11820
11854
|
return isExport ? ch === 123 || ch === 42 : ch !== 61;
|
|
11821
11855
|
}
|
|
@@ -11827,7 +11861,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11827
11861
|
else node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
|
|
11828
11862
|
}
|
|
11829
11863
|
parseImport(node) {
|
|
11830
|
-
if (this.match(
|
|
11864
|
+
if (this.match(131)) {
|
|
11831
11865
|
node.importKind = "value";
|
|
11832
11866
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
11833
11867
|
return super.parseImport(node);
|
|
@@ -11838,7 +11872,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11838
11872
|
const result = this.tsParseImportEqualsDeclaration(node);
|
|
11839
11873
|
if (this.scope.inTSNamespace && result.moduleReference.type === "TSExternalModuleReference") this.raise(TSErrors.ImportInTSNamespace, node);
|
|
11840
11874
|
return result;
|
|
11841
|
-
} else if (this.isContextual(
|
|
11875
|
+
} else if (this.isContextual(127)) {
|
|
11842
11876
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
|
|
11843
11877
|
if (this.lookaheadCharCode() === 61) {
|
|
11844
11878
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
@@ -11854,7 +11888,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11854
11888
|
const nodeImportEquals = this.startNode();
|
|
11855
11889
|
this.next();
|
|
11856
11890
|
let maybeDefaultIdentifier = null;
|
|
11857
|
-
if (this.isContextual(
|
|
11891
|
+
if (this.isContextual(127) && this.isPotentialImportPhase(false)) maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
11858
11892
|
else nodeImportEquals.importKind = "value";
|
|
11859
11893
|
const declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier);
|
|
11860
11894
|
node.attributes = [];
|
|
@@ -11870,9 +11904,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11870
11904
|
this.sawUnambiguousESM = true;
|
|
11871
11905
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ExportAssignmentInTSNamespace, assign);
|
|
11872
11906
|
return this.finishNode(assign, "TSExportAssignment");
|
|
11873
|
-
} else if (this.eatContextual(
|
|
11907
|
+
} else if (this.eatContextual(90)) {
|
|
11874
11908
|
const decl = node;
|
|
11875
|
-
this.expectContextual(
|
|
11909
|
+
this.expectContextual(125);
|
|
11876
11910
|
decl.id = this.parseIdentifier();
|
|
11877
11911
|
this.checkIdentifier(decl.id, 8201);
|
|
11878
11912
|
this.semicolon();
|
|
@@ -11885,7 +11919,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11885
11919
|
}
|
|
11886
11920
|
}
|
|
11887
11921
|
isAbstractClass() {
|
|
11888
|
-
return this.isContextual(
|
|
11922
|
+
return this.isContextual(121) && this.isLookaheadContextual("class");
|
|
11889
11923
|
}
|
|
11890
11924
|
parseExportDefaultExpression() {
|
|
11891
11925
|
if (this.isAbstractClass()) {
|
|
@@ -11894,7 +11928,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11894
11928
|
cls.abstract = true;
|
|
11895
11929
|
return this.parseClass(cls, true, true);
|
|
11896
11930
|
}
|
|
11897
|
-
if (this.match(
|
|
11931
|
+
if (this.match(126)) {
|
|
11898
11932
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
11899
11933
|
if (result) return result;
|
|
11900
11934
|
}
|
|
@@ -11930,31 +11964,31 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11930
11964
|
return this.tsParseEnumDeclaration(node, { const: true });
|
|
11931
11965
|
}
|
|
11932
11966
|
break;
|
|
11933
|
-
case 120:
|
|
11934
11967
|
case 121:
|
|
11968
|
+
case 122:
|
|
11935
11969
|
if (this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()) {
|
|
11936
11970
|
const token = this.state.type;
|
|
11937
11971
|
const node = this.startNode();
|
|
11938
11972
|
this.next();
|
|
11939
|
-
const declaration = token ===
|
|
11973
|
+
const declaration = token === 122 ? this.tsTryParseDeclare(node) : this.tsParseAbstractDeclaration(node, decorators);
|
|
11940
11974
|
if (declaration) {
|
|
11941
|
-
if (token ===
|
|
11975
|
+
if (token === 122) declaration.declare = true;
|
|
11942
11976
|
return declaration;
|
|
11943
11977
|
} else {
|
|
11944
|
-
node.expression = this.createIdentifier(this.startNodeAtNode(node), token ===
|
|
11978
|
+
node.expression = this.createIdentifier(this.startNodeAtNode(node), token === 122 ? "declare" : "abstract");
|
|
11945
11979
|
this.semicolon(false);
|
|
11946
11980
|
return this.finishNode(node, "ExpressionStatement");
|
|
11947
11981
|
}
|
|
11948
11982
|
}
|
|
11949
11983
|
break;
|
|
11950
|
-
case
|
|
11951
|
-
case
|
|
11984
|
+
case 123: return this.tsParseEnumDeclaration(this.startNode());
|
|
11985
|
+
case 109:
|
|
11952
11986
|
if (this.lookaheadCharCode() === 123) {
|
|
11953
11987
|
const node = this.startNode();
|
|
11954
11988
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
11955
11989
|
}
|
|
11956
11990
|
break;
|
|
11957
|
-
case
|
|
11991
|
+
case 126: {
|
|
11958
11992
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
11959
11993
|
if (result) {
|
|
11960
11994
|
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, result, "interface");
|
|
@@ -11962,26 +11996,26 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
11962
11996
|
}
|
|
11963
11997
|
break;
|
|
11964
11998
|
}
|
|
11965
|
-
case
|
|
11999
|
+
case 124:
|
|
11966
12000
|
if (this.nextTokenIsStringLiteralOnSameLine()) {
|
|
11967
12001
|
const node = this.startNode();
|
|
11968
12002
|
this.next();
|
|
11969
|
-
return this.tsParseDeclaration(node,
|
|
12003
|
+
return this.tsParseDeclaration(node, 124, false, decorators);
|
|
11970
12004
|
} else if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
11971
12005
|
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
11972
12006
|
const node = this.startNode();
|
|
11973
12007
|
this.next();
|
|
11974
|
-
return this.tsParseDeclaration(node,
|
|
12008
|
+
return this.tsParseDeclaration(node, 125, false, decorators);
|
|
11975
12009
|
}
|
|
11976
12010
|
break;
|
|
11977
|
-
case
|
|
12011
|
+
case 125:
|
|
11978
12012
|
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
11979
12013
|
const node = this.startNode();
|
|
11980
12014
|
this.next();
|
|
11981
|
-
return this.tsParseDeclaration(node,
|
|
12015
|
+
return this.tsParseDeclaration(node, 125, false, decorators);
|
|
11982
12016
|
}
|
|
11983
12017
|
break;
|
|
11984
|
-
case
|
|
12018
|
+
case 127: if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
11985
12019
|
const node = this.startNode();
|
|
11986
12020
|
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, node, "type");
|
|
11987
12021
|
this.next();
|
|
@@ -12000,7 +12034,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12000
12034
|
});
|
|
12001
12035
|
}
|
|
12002
12036
|
tsIsStartOfStaticBlocks() {
|
|
12003
|
-
return this.isContextual(
|
|
12037
|
+
return this.isContextual(103) && this.lookaheadCharCode() === 123;
|
|
12004
12038
|
}
|
|
12005
12039
|
parseClassMember(classBody, member, state) {
|
|
12006
12040
|
this.tsParseModifiers(ClassMemberModifiers, TSErrors.InvalidModifierOnTypeParameterPositions, member, true);
|
|
@@ -12088,10 +12122,10 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12088
12122
|
return node;
|
|
12089
12123
|
}
|
|
12090
12124
|
parseExportDeclaration(node) {
|
|
12091
|
-
if (!this.state.isAmbientContext && this.isContextual(
|
|
12125
|
+
if (!this.state.isAmbientContext && this.isContextual(122)) return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
|
|
12092
12126
|
const startLoc = this.state.startLoc;
|
|
12093
|
-
const isDeclare = this.eatContextual(
|
|
12094
|
-
if (isDeclare && (this.isContextual(
|
|
12127
|
+
const isDeclare = this.eatContextual(122);
|
|
12128
|
+
if (isDeclare && (this.isContextual(122) || !this.shouldParseExportDeclaration())) throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
12095
12129
|
const declaration = tokenIsIdentifier(this.state.type) && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
12096
12130
|
if (!declaration) return null;
|
|
12097
12131
|
if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) node.exportKind = "type";
|
|
@@ -12102,7 +12136,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12102
12136
|
return declaration;
|
|
12103
12137
|
}
|
|
12104
12138
|
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
12105
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
12139
|
+
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
12106
12140
|
node.id = null;
|
|
12107
12141
|
return;
|
|
12108
12142
|
}
|
|
@@ -12173,7 +12207,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12173
12207
|
node.superTypeArguments = superTypeArguments;
|
|
12174
12208
|
} else if (this.match(43) || this.match(47)) node.superTypeArguments = this.tsParseTypeArgumentsInExpression();
|
|
12175
12209
|
}
|
|
12176
|
-
if (this.eatContextual(
|
|
12210
|
+
if (this.eatContextual(110)) node.implements = this.tsParseHeritageClause("implements");
|
|
12177
12211
|
}
|
|
12178
12212
|
parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
12179
12213
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
@@ -12202,7 +12236,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12202
12236
|
let state;
|
|
12203
12237
|
let jsx;
|
|
12204
12238
|
let typeCast;
|
|
12205
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
12239
|
+
if (this.hasPlugin("jsx") && (this.match(139) || this.match(43))) {
|
|
12206
12240
|
state = this.state.clone();
|
|
12207
12241
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, isParenItem), state);
|
|
12208
12242
|
if (!jsx.error) return jsx.node;
|
|
@@ -12478,7 +12512,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12478
12512
|
if (this.match(76)) {
|
|
12479
12513
|
node.abstract = true;
|
|
12480
12514
|
return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
|
|
12481
|
-
} else if (this.isContextual(
|
|
12515
|
+
} else if (this.isContextual(126)) {
|
|
12482
12516
|
if (!this.hasFollowingLineBreak()) {
|
|
12483
12517
|
node.abstract = true;
|
|
12484
12518
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
@@ -12530,9 +12564,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12530
12564
|
parseTypeOnlyImportSpecifier(node, isInTypeOnly) {
|
|
12531
12565
|
let leftOfAs = node.imported;
|
|
12532
12566
|
let hasTypeSpecifier = false;
|
|
12533
|
-
if (this.isContextual(
|
|
12567
|
+
if (this.isContextual(90)) {
|
|
12534
12568
|
const firstAs = this.parseIdentifier();
|
|
12535
|
-
if (this.isContextual(
|
|
12569
|
+
if (this.isContextual(90)) {
|
|
12536
12570
|
const secondAs = this.parseIdentifier();
|
|
12537
12571
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
12538
12572
|
hasTypeSpecifier = true;
|
|
@@ -12547,19 +12581,19 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12547
12581
|
} else if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
12548
12582
|
hasTypeSpecifier = true;
|
|
12549
12583
|
leftOfAs = this.parseIdentifier(true);
|
|
12550
|
-
if (!this.isContextual(
|
|
12584
|
+
if (!this.isContextual(90)) this.checkReservedWord(leftOfAs.name, leftOfAs.start, true, true);
|
|
12551
12585
|
}
|
|
12552
12586
|
if (hasTypeSpecifier && isInTypeOnly) this.raise(TSErrors.TypeModifierIsUsedInTypeImports, node.imported);
|
|
12553
12587
|
node.imported = leftOfAs;
|
|
12554
12588
|
node.importKind = hasTypeSpecifier ? "type" : "value";
|
|
12555
|
-
this.checkIdentifier(node.local ??= this.eatContextual(
|
|
12589
|
+
this.checkIdentifier(node.local ??= this.eatContextual(90) ? this.parseIdentifier() : this.cloneIdentifier(node.imported), hasTypeSpecifier ? 4098 : 4096);
|
|
12556
12590
|
}
|
|
12557
12591
|
parseTypeOnlyExportSpecifier(node, isInTypeOnly) {
|
|
12558
12592
|
const local = node.local;
|
|
12559
12593
|
let hasTypeSpecifier = false;
|
|
12560
|
-
if (this.isContextual(
|
|
12594
|
+
if (this.isContextual(90)) {
|
|
12561
12595
|
const firstAs = this.parseIdentifier();
|
|
12562
|
-
if (this.isContextual(
|
|
12596
|
+
if (this.isContextual(90)) {
|
|
12563
12597
|
const secondAs = this.parseIdentifier();
|
|
12564
12598
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
12565
12599
|
hasTypeSpecifier = true;
|
|
@@ -12577,7 +12611,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
12577
12611
|
}
|
|
12578
12612
|
if (hasTypeSpecifier && isInTypeOnly) this.raise(TSErrors.TypeModifierIsUsedInTypeExports, local);
|
|
12579
12613
|
node.exportKind = hasTypeSpecifier ? "type" : "value";
|
|
12580
|
-
node.exported ??= this.eatContextual(
|
|
12614
|
+
node.exported ??= this.eatContextual(90) ? this.parseModuleExportName() : this.cloneIdentifier(node.local);
|
|
12581
12615
|
}
|
|
12582
12616
|
fillOptionalPropertiesForTSESLint(node) {
|
|
12583
12617
|
switch (node.type) {
|
|
@@ -12755,13 +12789,13 @@ const PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
|
12755
12789
|
});
|
|
12756
12790
|
const placeholders = (superClass) => class PlaceholdersParserMixin extends superClass {
|
|
12757
12791
|
parsePlaceholder(expectedNode) {
|
|
12758
|
-
if (this.match(
|
|
12792
|
+
if (this.match(130)) {
|
|
12759
12793
|
const node = this.startNode();
|
|
12760
12794
|
this.next();
|
|
12761
12795
|
this.assertNoSpace();
|
|
12762
12796
|
node.name = super.parseIdentifier(true);
|
|
12763
12797
|
this.assertNoSpace();
|
|
12764
|
-
this.expect(
|
|
12798
|
+
this.expect(130);
|
|
12765
12799
|
return this.finishPlaceholder(node, expectedNode);
|
|
12766
12800
|
}
|
|
12767
12801
|
}
|
|
@@ -12772,7 +12806,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12772
12806
|
return placeholder;
|
|
12773
12807
|
}
|
|
12774
12808
|
getTokenFromCode(code) {
|
|
12775
|
-
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) this.finishOp(
|
|
12809
|
+
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) this.finishOp(130, 2);
|
|
12776
12810
|
else super.getTokenFromCode(code);
|
|
12777
12811
|
}
|
|
12778
12812
|
parseExprAtom(refExpressionErrors) {
|
|
@@ -12813,13 +12847,13 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12813
12847
|
if (node.label?.type === "Placeholder") return;
|
|
12814
12848
|
super.verifyBreakContinue(node, isBreak);
|
|
12815
12849
|
}
|
|
12816
|
-
parseExpressionStatement(node, expr) {
|
|
12817
|
-
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) return super.parseExpressionStatement(node, expr);
|
|
12850
|
+
parseExpressionStatement(node, expr, flags) {
|
|
12851
|
+
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) return super.parseExpressionStatement(node, expr, flags);
|
|
12818
12852
|
if (this.match(10)) {
|
|
12819
12853
|
const stmt = node;
|
|
12820
12854
|
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
|
12821
12855
|
this.next();
|
|
12822
|
-
stmt.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration();
|
|
12856
|
+
stmt.body = flags & 8 ? super.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : super.parseStatement();
|
|
12823
12857
|
return this.finishNode(stmt, "LabeledStatement");
|
|
12824
12858
|
}
|
|
12825
12859
|
this.semicolon();
|
|
@@ -12839,7 +12873,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12839
12873
|
const oldStrict = this.state.strict;
|
|
12840
12874
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
12841
12875
|
if (placeholder) {
|
|
12842
|
-
if (this.match(77) || this.match(
|
|
12876
|
+
if (this.match(77) || this.match(130) || this.match(2)) node.id = placeholder;
|
|
12843
12877
|
else if (optionalId || !isStatement) {
|
|
12844
12878
|
node.id = null;
|
|
12845
12879
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
@@ -12854,7 +12888,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12854
12888
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
12855
12889
|
if (!placeholder) return super.parseExport(node, decorators);
|
|
12856
12890
|
const node2 = node;
|
|
12857
|
-
if (!this.isContextual(
|
|
12891
|
+
if (!this.isContextual(95) && !this.match(8)) {
|
|
12858
12892
|
node2.specifiers = [];
|
|
12859
12893
|
node2.source = null;
|
|
12860
12894
|
node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
@@ -12870,7 +12904,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12870
12904
|
if (this.match(61)) {
|
|
12871
12905
|
const next = this.nextTokenStart();
|
|
12872
12906
|
if (this.isUnparsedContextual(next, "from")) {
|
|
12873
|
-
if (this.input.startsWith(tokenLabelName(
|
|
12907
|
+
if (this.input.startsWith(tokenLabelName(130), this.hasPlugin("exportDefaultFrom") ? this.nextTokenStartSince(next + 4) : this.nextTokenInLineStartSince(next + 4))) return true;
|
|
12874
12908
|
}
|
|
12875
12909
|
}
|
|
12876
12910
|
return super.isExportDefaultSpecifier();
|
|
@@ -12884,7 +12918,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12884
12918
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
12885
12919
|
if (!placeholder) return super.parseImport(node);
|
|
12886
12920
|
node.specifiers = [];
|
|
12887
|
-
if (!this.isContextual(
|
|
12921
|
+
if (!this.isContextual(95) && !this.match(8)) {
|
|
12888
12922
|
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
|
12889
12923
|
this.semicolon();
|
|
12890
12924
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -12895,7 +12929,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
12895
12929
|
if (this.eat(8)) {
|
|
12896
12930
|
if (!this.maybeParseStarImportSpecifier(node)) this.parseNamedImportSpecifiers(node);
|
|
12897
12931
|
}
|
|
12898
|
-
this.expectContextual(
|
|
12932
|
+
this.expectContextual(95);
|
|
12899
12933
|
node.source = this.parseImportSource();
|
|
12900
12934
|
this.semicolon();
|
|
12901
12935
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -13084,8 +13118,7 @@ function getParserClass(pluginsMap) {
|
|
|
13084
13118
|
}
|
|
13085
13119
|
return cls;
|
|
13086
13120
|
}
|
|
13087
|
-
|
|
13088
|
-
//#region ../../mpcore/packages/simulator/src/view/templateInterpolation.ts
|
|
13121
|
+
// ../../mpcore/packages/simulator/src/view/templateInterpolation.ts
|
|
13089
13122
|
/** 按表达式词法寻找插值边界,字符串和对象内部的大括号不结束绑定。 */
|
|
13090
13123
|
function templateInterpolations(source) {
|
|
13091
13124
|
const ranges = [];
|
|
@@ -13126,8 +13159,7 @@ function isTemplateExpression(value) {
|
|
|
13126
13159
|
const ranges = templateInterpolations(trimmed);
|
|
13127
13160
|
return ranges.length === 1 && ranges[0].start === 0 && ranges[0].end === trimmed.length;
|
|
13128
13161
|
}
|
|
13129
|
-
|
|
13130
|
-
//#region ../../mpcore/packages/simulator/src/view/wxs.ts
|
|
13162
|
+
// ../../mpcore/packages/simulator/src/view/wxs.ts
|
|
13131
13163
|
const wxsFunctions = /* @__PURE__ */ new WeakSet();
|
|
13132
13164
|
function registerWxsExports(value, visited = /* @__PURE__ */ new Set()) {
|
|
13133
13165
|
if (value == null || visited.has(value) || typeof value !== "object" && typeof value !== "function") return;
|
|
@@ -13171,8 +13203,7 @@ function createWxsModuleLoader(options) {
|
|
|
13171
13203
|
clear: () => cache.clear()
|
|
13172
13204
|
};
|
|
13173
13205
|
}
|
|
13174
|
-
|
|
13175
|
-
//#region ../../mpcore/packages/simulator/src/view/templateExpression.ts
|
|
13206
|
+
// ../../mpcore/packages/simulator/src/view/templateExpression.ts
|
|
13176
13207
|
const expressionCache = /* @__PURE__ */ new Map();
|
|
13177
13208
|
const BLOCKED_MEMBER_KEYS = /* @__PURE__ */ new Set([
|
|
13178
13209
|
"__proto__",
|
|
@@ -13314,8 +13345,7 @@ function resolveTemplateExpression(source, expression) {
|
|
|
13314
13345
|
if (!normalized) return;
|
|
13315
13346
|
return evaluateExpressionNode(parseTemplateExpression(normalized), source);
|
|
13316
13347
|
}
|
|
13317
|
-
|
|
13318
|
-
//#region ../../mpcore/packages/simulator/src/view/templateRuntime.ts
|
|
13348
|
+
// ../../mpcore/packages/simulator/src/view/templateRuntime.ts
|
|
13319
13349
|
function isTagNode$1(node) {
|
|
13320
13350
|
return node.type === "tag" && typeof node.name === "string";
|
|
13321
13351
|
}
|
|
@@ -13355,8 +13385,7 @@ function resolveTemplateData(node, source) {
|
|
|
13355
13385
|
const resolved = resolveTemplateExpression(source, expression) ?? resolveTemplateExpression(source, `{${expression}}`);
|
|
13356
13386
|
return resolved && typeof resolved === "object" ? resolved : {};
|
|
13357
13387
|
}
|
|
13358
|
-
|
|
13359
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/attachment.ts
|
|
13388
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/attachment.ts
|
|
13360
13389
|
const attachmentStates = /* @__PURE__ */ new WeakMap();
|
|
13361
13390
|
function isComponentAttached(instance) {
|
|
13362
13391
|
return attachmentStates.get(instance) === "attached";
|
|
@@ -13399,8 +13428,7 @@ function flushComponentAttachments(componentCache, scopeIds, attach) {
|
|
|
13399
13428
|
}
|
|
13400
13429
|
return pending.size > 0 ? "attached" : false;
|
|
13401
13430
|
}
|
|
13402
|
-
|
|
13403
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/construction.ts
|
|
13431
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/construction.ts
|
|
13404
13432
|
const constructionStates = /* @__PURE__ */ new WeakMap();
|
|
13405
13433
|
const constructingInstances = /* @__PURE__ */ new WeakSet();
|
|
13406
13434
|
function isComponentConstructing(instance) {
|
|
@@ -13439,8 +13467,7 @@ function finishComponentConstruction(componentCache, instance) {
|
|
|
13439
13467
|
const state = constructionStates.get(componentCache);
|
|
13440
13468
|
if (--state.depth === 0) constructionStates.delete(componentCache);
|
|
13441
13469
|
}
|
|
13442
|
-
|
|
13443
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/discardedReady.ts
|
|
13470
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/discardedReady.ts
|
|
13444
13471
|
const discardedReady = /* @__PURE__ */ new WeakMap();
|
|
13445
13472
|
/** 初始模板分支被 props 替换时,微信仍发送 ready,但不发送 attached 或 detached。 */
|
|
13446
13473
|
function scheduleDiscardedComponentReady(cache, scopeId, instance) {
|
|
@@ -13459,8 +13486,7 @@ function flushDiscardedComponentReady(cache, pageScopeId, ready) {
|
|
|
13459
13486
|
for (const [, instance] of current) ready(instance);
|
|
13460
13487
|
if (!pending.size) discardedReady.delete(cache);
|
|
13461
13488
|
}
|
|
13462
|
-
|
|
13463
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/propertyBindings.ts
|
|
13489
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/propertyBindings.ts
|
|
13464
13490
|
const consumedPageChanges = /* @__PURE__ */ new WeakMap();
|
|
13465
13491
|
function syncComponentProperties(instance, definition, nextProperties, bindingExpressions, changedPageKeys, beforeObservers) {
|
|
13466
13492
|
const freshPageChanges = changedPageKeys.length > 0 && consumedPageChanges.get(instance) !== changedPageKeys;
|
|
@@ -13488,8 +13514,7 @@ function syncComponentProperties(instance, definition, nextProperties, bindingEx
|
|
|
13488
13514
|
beforeObservers?.(instance, "properties");
|
|
13489
13515
|
runComponentObservers(definition, instance, changedRootKeys, previousProperties);
|
|
13490
13516
|
}
|
|
13491
|
-
|
|
13492
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/reconcileRemoved.ts
|
|
13517
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/reconcileRemoved.ts
|
|
13493
13518
|
/** 用户卸载钩子失败也要完成关系与缓存收尾,避免下一次渲染重复卸载同一实例。 */
|
|
13494
13519
|
function reconcileRemovedComponents(cache, scopes, activeScopeIds, pageScopeId) {
|
|
13495
13520
|
const removed = [...cache].filter(([scopeId]) => scopeId.startsWith(`${pageScopeId}/`) && !activeScopeIds.has(scopeId));
|
|
@@ -13514,8 +13539,7 @@ function reconcileRemovedComponents(cache, scopes, activeScopeIds, pageScopeId)
|
|
|
13514
13539
|
if (failure) throw failure.error;
|
|
13515
13540
|
return relationsChanged;
|
|
13516
13541
|
}
|
|
13517
|
-
|
|
13518
|
-
//#region ../../mpcore/packages/simulator/src/runtime/pageLifecycle.ts
|
|
13542
|
+
// ../../mpcore/packages/simulator/src/runtime/pageLifecycle.ts
|
|
13519
13543
|
const loadingPages = /* @__PURE__ */ new WeakSet();
|
|
13520
13544
|
function isPageBeforeReady(page) {
|
|
13521
13545
|
return loadingPages.has(page);
|
|
@@ -13541,8 +13565,7 @@ function runInitialPageLifecycles(page, query, scheduler, isAlive, renderCompone
|
|
|
13541
13565
|
}
|
|
13542
13566
|
}, 0);
|
|
13543
13567
|
}
|
|
13544
|
-
|
|
13545
|
-
//#region ../../mpcore/packages/simulator/src/runtime/wxs.ts
|
|
13568
|
+
// ../../mpcore/packages/simulator/src/runtime/wxs.ts
|
|
13546
13569
|
const loaders = /* @__PURE__ */ new WeakMap();
|
|
13547
13570
|
function closeRuntimeWxsLoader(owner) {
|
|
13548
13571
|
loaders.get(owner)?.clear();
|
|
@@ -13567,44 +13590,7 @@ function getRuntimeWxsLoader(owner, artifactSource) {
|
|
|
13567
13590
|
}
|
|
13568
13591
|
return loader.load;
|
|
13569
13592
|
}
|
|
13570
|
-
|
|
13571
|
-
//#region ../../mpcore/packages/simulator/src/project/plugins.ts
|
|
13572
|
-
const HEADLESS_PLUGIN_VIRTUAL_ROOT = "__plugins__";
|
|
13573
|
-
const PLUGIN_URL_RE = /^plugin:\/\/([^/]+)\/(.+)$/;
|
|
13574
|
-
function createPluginVirtualRoot(alias) {
|
|
13575
|
-
return `${HEADLESS_PLUGIN_VIRTUAL_ROOT}/${alias}`;
|
|
13576
|
-
}
|
|
13577
|
-
function resolvePluginRequest(plugins, request, kind) {
|
|
13578
|
-
const match = PLUGIN_URL_RE.exec(request);
|
|
13579
|
-
if (!match) return;
|
|
13580
|
-
const [, alias, publicName] = match;
|
|
13581
|
-
const plugin = plugins.find((item) => item.alias === alias);
|
|
13582
|
-
const registry = kind === "page" ? plugin?.config.pages : plugin?.config.publicComponents;
|
|
13583
|
-
const resourcePath = registry && typeof registry === "object" && !Array.isArray(registry) ? registry[publicName] : void 0;
|
|
13584
|
-
if (!plugin || typeof resourcePath !== "string" || !resourcePath) return;
|
|
13585
|
-
return {
|
|
13586
|
-
plugin,
|
|
13587
|
-
publicName,
|
|
13588
|
-
resourcePath: `${plugin.virtualRoot}/${resourcePath}`
|
|
13589
|
-
};
|
|
13590
|
-
}
|
|
13591
|
-
function createPluginArtifactSource(fallback, miniprogramRootPath, plugins) {
|
|
13592
|
-
function resolvePhysicalPath(filePath) {
|
|
13593
|
-
const normalizedPath = path.resolve(filePath);
|
|
13594
|
-
for (const plugin of plugins) {
|
|
13595
|
-
const virtualRootPath = path.resolve(miniprogramRootPath, plugin.virtualRoot);
|
|
13596
|
-
const relativePath = path.relative(virtualRootPath, normalizedPath);
|
|
13597
|
-
if (!relativePath.startsWith("..") && !path.isAbsolute(relativePath)) return path.resolve(plugin.rootPath, relativePath);
|
|
13598
|
-
}
|
|
13599
|
-
return normalizedPath;
|
|
13600
|
-
}
|
|
13601
|
-
return {
|
|
13602
|
-
has: (filePath) => fallback.has(resolvePhysicalPath(filePath)),
|
|
13603
|
-
readText: (filePath) => fallback.readText(resolvePhysicalPath(filePath))
|
|
13604
|
-
};
|
|
13605
|
-
}
|
|
13606
|
-
//#endregion
|
|
13607
|
-
//#region ../../@weapp-core/constants/dist/index.js
|
|
13593
|
+
// ../../@weapp-core/constants/dist/index.js
|
|
13608
13594
|
/** 无头测试后端不支持所请求的自动化协议。 */
|
|
13609
13595
|
const HEADLESS_PROTOCOL_UNSUPPORTED = "HEADLESS_PROTOCOL_UNSUPPORTED";
|
|
13610
13596
|
const WEVU_NATIVE_INSTANCE_KEY = "__wevuNativeInstance";
|
|
@@ -13612,8 +13598,7 @@ const WEVU_NATIVE_INSTANCE_KEY = "__wevuNativeInstance";
|
|
|
13612
13598
|
const WEVU_ROUTE_EVENT_CONTRACT_KEY = "__wevuRouteEventContract";
|
|
13613
13599
|
/** 宿主负责 pageScrollTo 的实际滚动事件,框架不再合成第二份通知。 */
|
|
13614
13600
|
const WEVU_PAGE_SCROLL_EVENT_CONTRACT_KEY = "__wevuPageScrollEventContract";
|
|
13615
|
-
|
|
13616
|
-
//#region ../../mpcore/packages/simulator/src/view/selectorQueryScope.ts
|
|
13601
|
+
// ../../mpcore/packages/simulator/src/view/selectorQueryScope.ts
|
|
13617
13602
|
const MPCORE_COMPONENT_SCOPE_ID = "__mpcoreComponentScopeId";
|
|
13618
13603
|
function isScopeCandidate(value) {
|
|
13619
13604
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
@@ -13671,207 +13656,7 @@ function resolveSelectorQueryScopeSnapshot(scope, snapshots) {
|
|
|
13671
13656
|
}
|
|
13672
13657
|
return null;
|
|
13673
13658
|
}
|
|
13674
|
-
|
|
13675
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentInstance/selection.ts
|
|
13676
|
-
function hasExportBehavior(definition, visited = /* @__PURE__ */ new Set()) {
|
|
13677
|
-
if (visited.has(definition)) return false;
|
|
13678
|
-
visited.add(definition);
|
|
13679
|
-
return (Array.isArray(definition.behaviors) ? definition.behaviors : []).some((behavior) => behavior === "wx://component-export" || behavior !== null && typeof behavior === "object" && hasExportBehavior(behavior, visited));
|
|
13680
|
-
}
|
|
13681
|
-
/** 原生选择器尊重组件导出行为;测试桥接继续保留完整组件实例。 */
|
|
13682
|
-
function resolveNativeComponentSelection(instance) {
|
|
13683
|
-
if (!instance) return null;
|
|
13684
|
-
const definition = instance.__definition__;
|
|
13685
|
-
if (!definition || !hasExportBehavior(definition) || typeof instance.export !== "function") return instance;
|
|
13686
|
-
return instance.export();
|
|
13687
|
-
}
|
|
13688
|
-
//#endregion
|
|
13689
|
-
//#region ../../mpcore/packages/simulator/src/runtime/moduleResolution.ts
|
|
13690
|
-
function resolveMiniProgramModule(importer, request, miniprogramRootPath, hasFile) {
|
|
13691
|
-
function resolveFile(basePath) {
|
|
13692
|
-
return [
|
|
13693
|
-
basePath,
|
|
13694
|
-
`${basePath}.js`,
|
|
13695
|
-
`${basePath}.json`,
|
|
13696
|
-
join(basePath, "index.js")
|
|
13697
|
-
].find(hasFile);
|
|
13698
|
-
}
|
|
13699
|
-
if (request.startsWith(".")) return resolveFile(join(dirname(importer), request));
|
|
13700
|
-
if (request.includes("\\") || request.includes(":") || request.split("/").some((part) => !part || part === "." || part === "..")) return;
|
|
13701
|
-
const root = normalize(miniprogramRootPath);
|
|
13702
|
-
let directory = dirname(importer);
|
|
13703
|
-
while (true) {
|
|
13704
|
-
const relativeDirectory = relative(root, directory);
|
|
13705
|
-
if (relativeDirectory === ".." || relativeDirectory.startsWith("../")) return;
|
|
13706
|
-
const resolved = resolveFile(join(directory, "miniprogram_npm", request));
|
|
13707
|
-
if (resolved) return resolved;
|
|
13708
|
-
if (normalize(directory) === root) return;
|
|
13709
|
-
const parent = dirname(directory);
|
|
13710
|
-
if (parent === directory) return;
|
|
13711
|
-
directory = parent;
|
|
13712
|
-
}
|
|
13713
|
-
}
|
|
13714
|
-
//#endregion
|
|
13715
|
-
//#region ../../mpcore/packages/simulator/src/runtime/componentResolution.ts
|
|
13716
|
-
function resolveMiniProgramComponent(ownerFilePath, request, miniprogramRootPath, hasFile) {
|
|
13717
|
-
const localPath = request.startsWith("/") ? request.replace(/^\/+/, "") : join(dirname(ownerFilePath), request);
|
|
13718
|
-
if (request.startsWith("/") || request.startsWith(".") || hasFile(join(miniprogramRootPath, `${localPath}.js`))) return localPath;
|
|
13719
|
-
const npmPath = resolveMiniProgramModule(join(miniprogramRootPath, ownerFilePath), request, miniprogramRootPath, (candidate) => candidate.endsWith(".js") && hasFile(candidate));
|
|
13720
|
-
return npmPath ? relative(miniprogramRootPath, npmPath).slice(0, -3) : localPath;
|
|
13721
|
-
}
|
|
13722
|
-
//#endregion
|
|
13723
|
-
//#region ../../mpcore/packages/simulator/src/view/nodeEvents.ts
|
|
13724
|
-
/** 正确字段优先;复制触点,避免处理器修改调用者持有的数据。 */
|
|
13725
|
-
function readTouchEventPayload(event) {
|
|
13726
|
-
const changedTouches = event.changedTouches ?? event.changeTouches;
|
|
13727
|
-
return {
|
|
13728
|
-
...event.touches === void 0 ? {} : { touches: event.touches.map((touch) => ({ ...touch })) },
|
|
13729
|
-
...changedTouches === void 0 ? {} : { changedTouches: changedTouches.map((touch) => ({ ...touch })) }
|
|
13730
|
-
};
|
|
13731
|
-
}
|
|
13732
|
-
//#endregion
|
|
13733
|
-
//#region ../../mpcore/packages/simulator/src/view/eventBinding.ts
|
|
13734
|
-
function resolveMiniProgramEventBinding(attributes, eventName) {
|
|
13735
|
-
return resolveEventBindingPhases(attributes, eventName, false)?.bubble ?? null;
|
|
13736
|
-
}
|
|
13737
|
-
/** 冒泡时保留原始 target,currentTarget 则属于当前执行绑定的节点。 */
|
|
13738
|
-
function createMiniProgramEventPayload(node, eventName, event, origin = node) {
|
|
13739
|
-
const dataset = collectNodeDataset(node);
|
|
13740
|
-
const nodeId = node.attribs?.id ?? "";
|
|
13741
|
-
const isOrigin = node === origin;
|
|
13742
|
-
return {
|
|
13743
|
-
...readTouchEventPayload(event),
|
|
13744
|
-
bubbles: false,
|
|
13745
|
-
capturePhase: false,
|
|
13746
|
-
composed: false,
|
|
13747
|
-
currentTarget: {
|
|
13748
|
-
dataset: isOrigin ? event.currentTarget?.dataset ?? event.dataset ?? dataset : dataset,
|
|
13749
|
-
id: isOrigin ? event.currentTarget?.id ?? event.id ?? nodeId : nodeId
|
|
13750
|
-
},
|
|
13751
|
-
detail: event.detail,
|
|
13752
|
-
mark: event.mark,
|
|
13753
|
-
target: {
|
|
13754
|
-
dataset: event.target?.dataset ?? event.dataset ?? (isOrigin ? dataset : collectNodeDataset(origin)),
|
|
13755
|
-
id: event.target?.id ?? event.id ?? origin.attribs?.id ?? ""
|
|
13756
|
-
},
|
|
13757
|
-
timeStamp: Date.now(),
|
|
13758
|
-
type: eventName
|
|
13759
|
-
};
|
|
13760
|
-
}
|
|
13761
|
-
//#endregion
|
|
13762
|
-
//#region ../../mpcore/packages/simulator/src/view/nativeForm.ts
|
|
13763
|
-
const pickerValues = /* @__PURE__ */ new WeakMap();
|
|
13764
|
-
/** 保存 picker 的原始数组属性,不能从渲染后的逗号字符串反推选项值。 */
|
|
13765
|
-
function setNativePickerValue(node, value) {
|
|
13766
|
-
if (node.name === "picker") pickerValues.set(node, value);
|
|
13767
|
-
}
|
|
13768
|
-
function includesBehavior(definition, name, visited = /* @__PURE__ */ new Set()) {
|
|
13769
|
-
if (visited.has(definition)) return false;
|
|
13770
|
-
visited.add(definition);
|
|
13771
|
-
return Array.isArray(definition.behaviors) && definition.behaviors.some((behavior) => behavior === name || behavior !== null && typeof behavior === "object" && includesBehavior(behavior, name, visited));
|
|
13772
|
-
}
|
|
13773
|
-
function nativeOwner(node) {
|
|
13774
|
-
return getNativeNodeOwner(node) ?? {
|
|
13775
|
-
scopeId: node.attribs?.["data-sim-scope"] ?? null,
|
|
13776
|
-
target: node
|
|
13777
|
-
};
|
|
13778
|
-
}
|
|
13779
|
-
function participatingScopes(formScope, pageScope, resolveComponent) {
|
|
13780
|
-
const scopes = /* @__PURE__ */ new Set([null, pageScope]);
|
|
13781
|
-
let current = formScope;
|
|
13782
|
-
while (current && !scopes.has(current)) {
|
|
13783
|
-
scopes.add(current);
|
|
13784
|
-
current = resolveComponent?.(current)?.ownerScopeId ?? null;
|
|
13785
|
-
}
|
|
13786
|
-
return scopes;
|
|
13787
|
-
}
|
|
13788
|
-
function participates(scopeId, formScopes, behavior, resolveComponent) {
|
|
13789
|
-
const visited = /* @__PURE__ */ new Set();
|
|
13790
|
-
while (!formScopes.has(scopeId)) {
|
|
13791
|
-
if (!scopeId || visited.has(scopeId)) return false;
|
|
13792
|
-
visited.add(scopeId);
|
|
13793
|
-
const component = resolveComponent?.(scopeId);
|
|
13794
|
-
if (!component || !includesBehavior(component.definition, behavior)) return false;
|
|
13795
|
-
scopeId = component.ownerScopeId;
|
|
13796
|
-
}
|
|
13797
|
-
return true;
|
|
13798
|
-
}
|
|
13799
|
-
function checked(attributes, name) {
|
|
13800
|
-
const value = attributes?.[name];
|
|
13801
|
-
return value !== void 0 && value !== "false" && value !== "0";
|
|
13802
|
-
}
|
|
13803
|
-
function choiceValues(group, pageScope, resolveComponent) {
|
|
13804
|
-
const values = [];
|
|
13805
|
-
const scopes = participatingScopes(nativeOwner(group).scopeId, pageScope, resolveComponent);
|
|
13806
|
-
const choice = group.name === "radio-group" ? "radio" : "checkbox";
|
|
13807
|
-
const visit = (node) => {
|
|
13808
|
-
if (node.name === "form" || node.name === "radio-group" || node.name === "checkbox-group") return;
|
|
13809
|
-
if (node.name === choice) {
|
|
13810
|
-
const owner = nativeOwner(node);
|
|
13811
|
-
if (checked(owner.target.attribs, "checked") && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) values.push(owner.target.attribs?.value ?? "");
|
|
13812
|
-
}
|
|
13813
|
-
for (const child of node.children ?? []) visit(child);
|
|
13814
|
-
};
|
|
13815
|
-
for (const child of group.children ?? []) visit(child);
|
|
13816
|
-
return values;
|
|
13817
|
-
}
|
|
13818
|
-
function collectFormValues(form, scopes, pageScope, resolveComponent) {
|
|
13819
|
-
const values = Object.create(null);
|
|
13820
|
-
const visit = (node) => {
|
|
13821
|
-
if (node.name === "form") return;
|
|
13822
|
-
const owner = nativeOwner(node);
|
|
13823
|
-
const attributes = owner.target.attribs;
|
|
13824
|
-
const name = attributes?.name;
|
|
13825
|
-
if (attributes && name && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) switch (node.name) {
|
|
13826
|
-
case "input":
|
|
13827
|
-
case "textarea":
|
|
13828
|
-
values[name] = attributes.value ?? "";
|
|
13829
|
-
break;
|
|
13830
|
-
case "switch":
|
|
13831
|
-
values[name] = checked(attributes, "checked");
|
|
13832
|
-
break;
|
|
13833
|
-
case "slider":
|
|
13834
|
-
values[name] = Number(attributes.value ?? 0);
|
|
13835
|
-
break;
|
|
13836
|
-
case "picker": {
|
|
13837
|
-
const mode = attributes.mode ?? "selector";
|
|
13838
|
-
if (mode === "multiSelector" || mode === "region") {
|
|
13839
|
-
const value = pickerValues.get(node);
|
|
13840
|
-
values[name] = Array.isArray(value) ? value.slice() : [];
|
|
13841
|
-
} else values[name] = mode === "selector" ? Number(attributes.value ?? 0) : attributes.value ?? "";
|
|
13842
|
-
break;
|
|
13843
|
-
}
|
|
13844
|
-
case "radio-group":
|
|
13845
|
-
values[name] = choiceValues(node, pageScope, resolveComponent)[0] ?? "";
|
|
13846
|
-
break;
|
|
13847
|
-
case "checkbox-group": values[name] = choiceValues(node, pageScope, resolveComponent);
|
|
13848
|
-
}
|
|
13849
|
-
for (const child of node.children ?? []) visit(child);
|
|
13850
|
-
};
|
|
13851
|
-
for (const child of form.children ?? []) visit(child);
|
|
13852
|
-
return values;
|
|
13853
|
-
}
|
|
13854
|
-
/** 先固定提交目标、字段值和方法所有者,再允许 tap 回调改变组件树。 */
|
|
13855
|
-
function prepareNativeFormSubmit(button, pageScope, event, resolveMethod, resolveComponent) {
|
|
13856
|
-
const owner = nativeOwner(button);
|
|
13857
|
-
if (owner.target.attribs?.["form-type"] !== "submit" || checked(owner.target.attribs, "disabled")) return;
|
|
13858
|
-
let form = button.parent;
|
|
13859
|
-
while (form && form.name !== "form") form = form.parent;
|
|
13860
|
-
if (!form) return;
|
|
13861
|
-
const formOwner = nativeOwner(form);
|
|
13862
|
-
const scopes = participatingScopes(formOwner.scopeId, pageScope, resolveComponent);
|
|
13863
|
-
if (!participates(owner.scopeId, scopes, "wx://form-field-button", resolveComponent)) return;
|
|
13864
|
-
const binding = resolveMiniProgramEventBinding(formOwner.target.attribs, "submit");
|
|
13865
|
-
return {
|
|
13866
|
-
call: binding?.method ? resolveMethod(formOwner.scopeId, binding.method) : void 0,
|
|
13867
|
-
event: createMiniProgramEventPayload(formOwner.target, "submit", {
|
|
13868
|
-
detail: { value: collectFormValues(form, scopes, pageScope, resolveComponent) },
|
|
13869
|
-
mark: event.mark
|
|
13870
|
-
})
|
|
13871
|
-
};
|
|
13872
|
-
}
|
|
13873
|
-
//#endregion
|
|
13874
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode-codepoint.js
|
|
13659
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode-codepoint.js
|
|
13875
13660
|
/**
|
|
13876
13661
|
* C1 Unicode control character reference replacements (code points 128–159).
|
|
13877
13662
|
* Index i gives the replacement for code point 128+i; 0 means "no replacement".
|
|
@@ -13939,8 +13724,7 @@ function replaceCodePoint(codePoint) {
|
|
|
13939
13724
|
function replaceCodePointXML(codePoint) {
|
|
13940
13725
|
return isInvalidCodePoint(codePoint) ? 65533 : codePoint;
|
|
13941
13726
|
}
|
|
13942
|
-
|
|
13943
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/decode-shared.js
|
|
13727
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/decode-shared.js
|
|
13944
13728
|
const BASE91_INVERSE = /* #__PURE__ */ (() => {
|
|
13945
13729
|
const table = /* @__PURE__ */ new Uint8Array(127);
|
|
13946
13730
|
let code = 0;
|
|
@@ -14082,12 +13866,10 @@ function decodeTrieDict(input, resultLength, atomCount, dict1AtomCount, ngramCou
|
|
|
14082
13866
|
}
|
|
14083
13867
|
return out;
|
|
14084
13868
|
}
|
|
14085
|
-
|
|
14086
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-html.js
|
|
13869
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-html.js
|
|
14087
13870
|
/** Packed HTML decode trie data. */
|
|
14088
13871
|
const htmlDecodeTree = /* #__PURE__ */ decodeTrieDict("!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&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#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P", 13494, 2713, 49, 25, 61);
|
|
14089
|
-
|
|
14090
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-xml.js
|
|
13872
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/generated/decode-data-xml.js
|
|
14091
13873
|
/** Packed XML decode trie data. */
|
|
14092
13874
|
const xmlDecodeTree = /* #__PURE__ */ new Uint16Array([
|
|
14093
13875
|
512,
|
|
@@ -14115,8 +13897,7 @@ const xmlDecodeTree = /* #__PURE__ */ new Uint16Array([
|
|
|
14115
13897
|
115,
|
|
14116
13898
|
24615
|
|
14117
13899
|
]);
|
|
14118
|
-
|
|
14119
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/bin-trie-flags.js
|
|
13900
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/internal/bin-trie-flags.js
|
|
14120
13901
|
/**
|
|
14121
13902
|
* Bit flags & masks for the binary trie encoding used for entity decoding.
|
|
14122
13903
|
*
|
|
@@ -14165,8 +13946,7 @@ var BinTrieFlags;
|
|
|
14165
13946
|
/** Bits 12..0: the inline value of a VALUE_LENGTH = 1 header word. */
|
|
14166
13947
|
BinTrieFlags[BinTrieFlags["VALUE_MASK"] = 8191] = "VALUE_MASK";
|
|
14167
13948
|
})(BinTrieFlags || (BinTrieFlags = {}));
|
|
14168
|
-
|
|
14169
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode.js
|
|
13949
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode.js
|
|
14170
13950
|
var CharCodes$1;
|
|
14171
13951
|
(function(CharCodes) {
|
|
14172
13952
|
CharCodes[CharCodes["AMP"] = 38] = "AMP";
|
|
@@ -14592,8 +14372,7 @@ function determineBranch(decodeTree, current, nodeIndex, char) {
|
|
|
14592
14372
|
}
|
|
14593
14373
|
return -1;
|
|
14594
14374
|
}
|
|
14595
|
-
|
|
14596
|
-
//#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Tokenizer.js
|
|
14375
|
+
// ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Tokenizer.js
|
|
14597
14376
|
var CharCodes;
|
|
14598
14377
|
(function(CharCodes) {
|
|
14599
14378
|
CharCodes[CharCodes["Tab"] = 9] = "Tab";
|
|
@@ -15499,8 +15278,7 @@ var Tokenizer = class {
|
|
|
15499
15278
|
}
|
|
15500
15279
|
}
|
|
15501
15280
|
};
|
|
15502
|
-
|
|
15503
|
-
//#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Parser.js
|
|
15281
|
+
// ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Parser.js
|
|
15504
15282
|
const { fromCodePoint } = String;
|
|
15505
15283
|
const formTags = /* @__PURE__ */ new Set([
|
|
15506
15284
|
"input",
|
|
@@ -16064,8 +15842,7 @@ var Parser = class {
|
|
|
16064
15842
|
if (this.ended) this.tokenizer.end();
|
|
16065
15843
|
}
|
|
16066
15844
|
};
|
|
16067
|
-
|
|
16068
|
-
//#region ../../node_modules/.pnpm/domelementtype@3.0.0/node_modules/domelementtype/dist/index.js
|
|
15845
|
+
// ../../node_modules/.pnpm/domelementtype@3.0.0/node_modules/domelementtype/dist/index.js
|
|
16069
15846
|
/** Types of elements found in htmlparser2's DOM */
|
|
16070
15847
|
var ElementType;
|
|
16071
15848
|
(function(ElementType) {
|
|
@@ -16113,8 +15890,7 @@ const Tag = ElementType.Tag;
|
|
|
16113
15890
|
/** Type for <![CDATA[ ... ]]> */
|
|
16114
15891
|
const CDATA$1 = ElementType.CDATA;
|
|
16115
15892
|
ElementType.Doctype;
|
|
16116
|
-
|
|
16117
|
-
//#region ../../node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/node.js
|
|
15893
|
+
// ../../node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/node.js
|
|
16118
15894
|
/**
|
|
16119
15895
|
* This object will be used as the prototype for Nodes when creating a
|
|
16120
15896
|
* DOM-Level-1-compliant structure.
|
|
@@ -16438,8 +16214,7 @@ function cloneChildren(childs) {
|
|
|
16438
16214
|
}
|
|
16439
16215
|
return children;
|
|
16440
16216
|
}
|
|
16441
|
-
|
|
16442
|
-
//#region ../../node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/index.js
|
|
16217
|
+
// ../../node_modules/.pnpm/domhandler@6.0.1/node_modules/domhandler/dist/index.js
|
|
16443
16218
|
const defaultOptions$1 = {
|
|
16444
16219
|
withStartIndices: false,
|
|
16445
16220
|
withEndIndices: false,
|
|
@@ -16571,8 +16346,7 @@ var DomHandler = class {
|
|
|
16571
16346
|
this.lastNode = null;
|
|
16572
16347
|
}
|
|
16573
16348
|
};
|
|
16574
|
-
|
|
16575
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/querying.js
|
|
16349
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/querying.js
|
|
16576
16350
|
/**
|
|
16577
16351
|
* Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one.
|
|
16578
16352
|
*
|
|
@@ -16680,8 +16454,7 @@ function findAll$1(test, nodes) {
|
|
|
16680
16454
|
}
|
|
16681
16455
|
}
|
|
16682
16456
|
}
|
|
16683
|
-
|
|
16684
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/legacy.js
|
|
16457
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/legacy.js
|
|
16685
16458
|
/**
|
|
16686
16459
|
* A map of functions to check nodes against.
|
|
16687
16460
|
*/
|
|
@@ -16818,8 +16591,7 @@ function getElementsByClassName(className, nodes, recurse = true, limit = Number
|
|
|
16818
16591
|
function getElementsByTagType(type, nodes, recurse = true, limit = Number.POSITIVE_INFINITY) {
|
|
16819
16592
|
return filter(Checks["tag_type"](type), nodes, recurse, limit);
|
|
16820
16593
|
}
|
|
16821
|
-
|
|
16822
|
-
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/escape.js
|
|
16594
|
+
// ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/escape.js
|
|
16823
16595
|
/**
|
|
16824
16596
|
* Get the named reference for an XML special character or U+00A0.
|
|
16825
16597
|
* @param char Code unit matched by one of the escape regexes.
|
|
@@ -16929,8 +16701,7 @@ const textEscapeRegex = /[&<>\u{A0}]/gu;
|
|
|
16929
16701
|
function escapeText$3(data) {
|
|
16930
16702
|
return escapeWithRegex(textEscapeRegex, data);
|
|
16931
16703
|
}
|
|
16932
|
-
|
|
16933
|
-
//#region ../../node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/foreign-names.js
|
|
16704
|
+
// ../../node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/foreign-names.js
|
|
16934
16705
|
/**
|
|
16935
16706
|
* Mixed-case SVG and MathML element names recognized in foreign content.
|
|
16936
16707
|
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
|
@@ -16941,8 +16712,7 @@ const elementNames = new Map("altGlyph altGlyphDef altGlyphItem animateColor ani
|
|
|
16941
16712
|
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
|
16942
16713
|
*/
|
|
16943
16714
|
const attributeNames = new Map("definitionURL attributeName attributeType baseFrequency baseProfile calcMode clipPathUnits diffuseConstant edgeMode filterUnits glyphRef gradientTransform gradientUnits kernelMatrix kernelUnitLength keyPoints keySplines keyTimes lengthAdjust limitingConeAngle markerHeight markerUnits markerWidth maskContentUnits maskUnits numOctaves pathLength patternContentUnits patternTransform patternUnits pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits refX refY repeatCount repeatDur requiredExtensions requiredFeatures specularConstant specularExponent spreadMethod startOffset stdDeviation stitchTiles surfaceScale systemLanguage tableValues targetX targetY textLength viewBox viewTarget xChannelSelector yChannelSelector zoomAndPan".split(" ").map((name) => [name.toLowerCase(), name]));
|
|
16944
|
-
|
|
16945
|
-
//#region ../../node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/index.js
|
|
16715
|
+
// ../../node_modules/.pnpm/dom-serializer@3.1.1/node_modules/dom-serializer/dist/index.js
|
|
16946
16716
|
/** Elements whose text content is never entity-encoded. */
|
|
16947
16717
|
const unencodedElements = new Set("style script xmp iframe noembed noframes plaintext noscript".split(" "));
|
|
16948
16718
|
/** HTML void elements — they cannot have children. */
|
|
@@ -17041,8 +16811,7 @@ function formatAttributes(attributes, options, xmlMode) {
|
|
|
17041
16811
|
}
|
|
17042
16812
|
return result;
|
|
17043
16813
|
}
|
|
17044
|
-
|
|
17045
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/stringify.js
|
|
16814
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/stringify.js
|
|
17046
16815
|
/**
|
|
17047
16816
|
* @category Stringify
|
|
17048
16817
|
* @deprecated Use the `dom-serializer` module directly.
|
|
@@ -17106,8 +16875,7 @@ function innerText(node) {
|
|
|
17106
16875
|
if (isText(node)) return node.data;
|
|
17107
16876
|
return "";
|
|
17108
16877
|
}
|
|
17109
|
-
|
|
17110
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/feeds.js
|
|
16878
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/feeds.js
|
|
17111
16879
|
/**
|
|
17112
16880
|
* Get the feed object from the root of a DOM tree.
|
|
17113
16881
|
*
|
|
@@ -17261,8 +17029,7 @@ function addConditionally(object, property, tagName, where, recurse = false) {
|
|
|
17261
17029
|
function isValidFeed(value) {
|
|
17262
17030
|
return value === "rss" || value === "feed" || value === "rdf:RDF";
|
|
17263
17031
|
}
|
|
17264
|
-
|
|
17265
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/helpers.js
|
|
17032
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/helpers.js
|
|
17266
17033
|
/**
|
|
17267
17034
|
* Given an array of nodes, remove any member that is contained by another
|
|
17268
17035
|
* member.
|
|
@@ -17372,8 +17139,7 @@ function uniqueSort(nodes) {
|
|
|
17372
17139
|
});
|
|
17373
17140
|
return nodes;
|
|
17374
17141
|
}
|
|
17375
|
-
|
|
17376
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/manipulation.js
|
|
17142
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/manipulation.js
|
|
17377
17143
|
/**
|
|
17378
17144
|
* Remove an element from the dom
|
|
17379
17145
|
*
|
|
@@ -17491,8 +17257,7 @@ function prepend(element, previous) {
|
|
|
17491
17257
|
previous.next = element;
|
|
17492
17258
|
element.prev = previous;
|
|
17493
17259
|
}
|
|
17494
|
-
|
|
17495
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/traversal.js
|
|
17260
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/traversal.js
|
|
17496
17261
|
/**
|
|
17497
17262
|
* Get a node's children.
|
|
17498
17263
|
*
|
|
@@ -17592,8 +17357,7 @@ function prevElementSibling(element) {
|
|
|
17592
17357
|
while (prev !== null && !isTag(prev)) ({prev} = prev);
|
|
17593
17358
|
return prev;
|
|
17594
17359
|
}
|
|
17595
|
-
|
|
17596
|
-
//#region ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/index.js
|
|
17360
|
+
// ../../node_modules/.pnpm/domutils@4.0.2/node_modules/domutils/dist/index.js
|
|
17597
17361
|
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
17598
17362
|
DocumentPosition: () => DocumentPosition,
|
|
17599
17363
|
append: () => append,
|
|
@@ -17631,8 +17395,7 @@ var dist_exports = /* @__PURE__ */ __exportAll({
|
|
|
17631
17395
|
textContent: () => textContent,
|
|
17632
17396
|
uniqueSort: () => uniqueSort
|
|
17633
17397
|
});
|
|
17634
|
-
|
|
17635
|
-
//#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/index.js
|
|
17398
|
+
// ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/index.js
|
|
17636
17399
|
/**
|
|
17637
17400
|
* Parses the data, returns the resulting document.
|
|
17638
17401
|
* @param data The data that should be parsed.
|
|
@@ -17643,8 +17406,319 @@ function parseDocument(data, options) {
|
|
|
17643
17406
|
new Parser(handler, options).end(data);
|
|
17644
17407
|
return handler.root;
|
|
17645
17408
|
}
|
|
17646
|
-
|
|
17647
|
-
|
|
17409
|
+
// ../../mpcore/packages/simulator/src/view/templateAttributes.ts
|
|
17410
|
+
const valuelessAttributes = /* @__PURE__ */ new WeakMap();
|
|
17411
|
+
var TemplateAttributeHandler = class extends DomHandler {
|
|
17412
|
+
attributeForms = /* @__PURE__ */ new Map();
|
|
17413
|
+
onopentagname() {
|
|
17414
|
+
this.attributeForms.clear();
|
|
17415
|
+
}
|
|
17416
|
+
onattribute(name, _value, quote) {
|
|
17417
|
+
if (!this.attributeForms.has(name)) this.attributeForms.set(name, quote === void 0);
|
|
17418
|
+
}
|
|
17419
|
+
onopentag(name, attributes) {
|
|
17420
|
+
super.onopentag(name, attributes);
|
|
17421
|
+
const names = new Set([...this.attributeForms].filter(([key, valueless]) => valueless && Object.hasOwn(attributes, key)).map(([key]) => key));
|
|
17422
|
+
if (names.size > 0) valuelessAttributes.set(this.tagStack[this.tagStack.length - 1], names);
|
|
17423
|
+
}
|
|
17424
|
+
};
|
|
17425
|
+
/** 保留 parser 的无值属性信息,不把裸属性与显式空字符串混为一谈。 */
|
|
17426
|
+
function parseTemplateAttributeDocument(source) {
|
|
17427
|
+
const handler = new TemplateAttributeHandler(void 0, { xmlMode: true });
|
|
17428
|
+
new Parser(handler, {
|
|
17429
|
+
xmlMode: true,
|
|
17430
|
+
decodeEntities: false,
|
|
17431
|
+
lowerCaseAttributeNames: false,
|
|
17432
|
+
lowerCaseTags: false,
|
|
17433
|
+
recognizeSelfClosing: true
|
|
17434
|
+
}).end(source);
|
|
17435
|
+
return handler.root;
|
|
17436
|
+
}
|
|
17437
|
+
function isValuelessTemplateAttribute(node, name) {
|
|
17438
|
+
return valuelessAttributes.get(node)?.has(name) ?? false;
|
|
17439
|
+
}
|
|
17440
|
+
function copyTemplateAttributeMetadata(source, target) {
|
|
17441
|
+
const attributes = valuelessAttributes.get(source);
|
|
17442
|
+
if (attributes) valuelessAttributes.set(target, attributes);
|
|
17443
|
+
else valuelessAttributes.delete(target);
|
|
17444
|
+
}
|
|
17445
|
+
function decodeAttribute(raw, quote) {
|
|
17446
|
+
const source = raw.replaceAll(`\\${quote}`, quote);
|
|
17447
|
+
let value = "";
|
|
17448
|
+
let offset = 0;
|
|
17449
|
+
for (const range of templateInterpolations(source)) {
|
|
17450
|
+
value += source.slice(offset, range.start).replace(/\\([\s\S])/g, "$1");
|
|
17451
|
+
value += source.slice(range.start, range.end);
|
|
17452
|
+
offset = range.end;
|
|
17453
|
+
}
|
|
17454
|
+
return value + source.slice(offset).replace(/\\([\s\S])/g, "$1");
|
|
17455
|
+
}
|
|
17456
|
+
/** 先保存 WXML 属性词法值,再交给 HTML parser 构建标签树,避免反斜杠引号提前截断属性。 */
|
|
17457
|
+
function maskTemplateAttributes(source) {
|
|
17458
|
+
const attributes = /* @__PURE__ */ new Map();
|
|
17459
|
+
if (!source.includes("\\")) return {
|
|
17460
|
+
source,
|
|
17461
|
+
attributes
|
|
17462
|
+
};
|
|
17463
|
+
let prefix = "__mpcore_quoted_attribute_";
|
|
17464
|
+
while (source.includes(prefix)) prefix += "_";
|
|
17465
|
+
let output = "";
|
|
17466
|
+
let offset = 0;
|
|
17467
|
+
for (let i = 0; i < source.length; i++) {
|
|
17468
|
+
if (source.startsWith("<!--", i)) {
|
|
17469
|
+
const end = source.indexOf("-->", i + 4);
|
|
17470
|
+
i = end < 0 ? source.length : end + 2;
|
|
17471
|
+
continue;
|
|
17472
|
+
}
|
|
17473
|
+
if (source[i] !== "<" || !/[a-z_]/i.test(source[i + 1] ?? "")) continue;
|
|
17474
|
+
for (i++; i < source.length && source[i] !== ">"; i++) {
|
|
17475
|
+
if (source[i] !== "\"" && source[i] !== "'") continue;
|
|
17476
|
+
const quote = source[i];
|
|
17477
|
+
const start = i + 1;
|
|
17478
|
+
for (i++; i < source.length && source[i] !== quote; i++) if (source[i] === "\\") i++;
|
|
17479
|
+
if (i >= source.length) break;
|
|
17480
|
+
const raw = source.slice(start, i);
|
|
17481
|
+
if (!raw.includes("\\")) continue;
|
|
17482
|
+
const token = `${prefix}${attributes.size}`;
|
|
17483
|
+
attributes.set(token, decodeAttribute(raw, quote));
|
|
17484
|
+
output += source.slice(offset, start) + token;
|
|
17485
|
+
offset = i;
|
|
17486
|
+
}
|
|
17487
|
+
}
|
|
17488
|
+
return {
|
|
17489
|
+
source: output + source.slice(offset),
|
|
17490
|
+
attributes
|
|
17491
|
+
};
|
|
17492
|
+
}
|
|
17493
|
+
// ../../mpcore/packages/simulator/src/runtime/componentInstance/selection.ts
|
|
17494
|
+
function hasExportBehavior(definition, visited = /* @__PURE__ */ new Set()) {
|
|
17495
|
+
if (visited.has(definition)) return false;
|
|
17496
|
+
visited.add(definition);
|
|
17497
|
+
return (Array.isArray(definition.behaviors) ? definition.behaviors : []).some((behavior) => behavior === "wx://component-export" || behavior !== null && typeof behavior === "object" && hasExportBehavior(behavior, visited));
|
|
17498
|
+
}
|
|
17499
|
+
/** 原生选择器尊重组件导出行为;测试桥接继续保留完整组件实例。 */
|
|
17500
|
+
function resolveNativeComponentSelection(instance) {
|
|
17501
|
+
if (!instance) return null;
|
|
17502
|
+
const definition = instance.__definition__;
|
|
17503
|
+
if (!definition || !hasExportBehavior(definition) || typeof instance.export !== "function") return instance;
|
|
17504
|
+
return instance.export();
|
|
17505
|
+
}
|
|
17506
|
+
// ../../mpcore/packages/simulator/src/project/plugins.ts
|
|
17507
|
+
const HEADLESS_PLUGIN_VIRTUAL_ROOT = "__plugins__";
|
|
17508
|
+
const PLUGIN_URL_RE = /^plugin:\/\/([^/]+)\/(.+)$/;
|
|
17509
|
+
function createPluginVirtualRoot(alias) {
|
|
17510
|
+
return `${HEADLESS_PLUGIN_VIRTUAL_ROOT}/${alias}`;
|
|
17511
|
+
}
|
|
17512
|
+
function resolvePluginRequest(plugins, request, kind) {
|
|
17513
|
+
const match = PLUGIN_URL_RE.exec(request);
|
|
17514
|
+
if (!match) return;
|
|
17515
|
+
const [, alias, publicName] = match;
|
|
17516
|
+
const plugin = plugins.find((item) => item.alias === alias);
|
|
17517
|
+
const registry = kind === "page" ? plugin?.config.pages : plugin?.config.publicComponents;
|
|
17518
|
+
const resourcePath = registry && typeof registry === "object" && !Array.isArray(registry) ? registry[publicName] : void 0;
|
|
17519
|
+
if (!plugin || typeof resourcePath !== "string" || !resourcePath) return;
|
|
17520
|
+
return {
|
|
17521
|
+
plugin,
|
|
17522
|
+
publicName,
|
|
17523
|
+
resourcePath: `${plugin.virtualRoot}/${resourcePath}`
|
|
17524
|
+
};
|
|
17525
|
+
}
|
|
17526
|
+
function createPluginArtifactSource(fallback, miniprogramRootPath, plugins) {
|
|
17527
|
+
function resolvePhysicalPath(filePath) {
|
|
17528
|
+
const normalizedPath = path.resolve(filePath);
|
|
17529
|
+
for (const plugin of plugins) {
|
|
17530
|
+
const virtualRootPath = path.resolve(miniprogramRootPath, plugin.virtualRoot);
|
|
17531
|
+
const relativePath = path.relative(virtualRootPath, normalizedPath);
|
|
17532
|
+
if (!relativePath.startsWith("..") && !path.isAbsolute(relativePath)) return path.resolve(plugin.rootPath, relativePath);
|
|
17533
|
+
}
|
|
17534
|
+
return normalizedPath;
|
|
17535
|
+
}
|
|
17536
|
+
return {
|
|
17537
|
+
has: (filePath) => fallback.has(resolvePhysicalPath(filePath)),
|
|
17538
|
+
readText: (filePath) => fallback.readText(resolvePhysicalPath(filePath))
|
|
17539
|
+
};
|
|
17540
|
+
}
|
|
17541
|
+
// ../../mpcore/packages/simulator/src/runtime/moduleResolution.ts
|
|
17542
|
+
function resolveMiniProgramModule(importer, request, miniprogramRootPath, hasFile) {
|
|
17543
|
+
function resolveFile(basePath) {
|
|
17544
|
+
return [
|
|
17545
|
+
basePath,
|
|
17546
|
+
`${basePath}.js`,
|
|
17547
|
+
`${basePath}.json`,
|
|
17548
|
+
join(basePath, "index.js")
|
|
17549
|
+
].find(hasFile);
|
|
17550
|
+
}
|
|
17551
|
+
if (request.startsWith(".")) return resolveFile(join(dirname(importer), request));
|
|
17552
|
+
if (request.includes("\\") || request.includes(":") || request.split("/").some((part) => !part || part === "." || part === "..")) return;
|
|
17553
|
+
const root = normalize(miniprogramRootPath);
|
|
17554
|
+
let directory = dirname(importer);
|
|
17555
|
+
while (true) {
|
|
17556
|
+
const relativeDirectory = relative(root, directory);
|
|
17557
|
+
if (relativeDirectory === ".." || relativeDirectory.startsWith("../")) return;
|
|
17558
|
+
const resolved = resolveFile(join(directory, "miniprogram_npm", request));
|
|
17559
|
+
if (resolved) return resolved;
|
|
17560
|
+
if (normalize(directory) === root) return;
|
|
17561
|
+
const parent = dirname(directory);
|
|
17562
|
+
if (parent === directory) return;
|
|
17563
|
+
directory = parent;
|
|
17564
|
+
}
|
|
17565
|
+
}
|
|
17566
|
+
// ../../mpcore/packages/simulator/src/runtime/componentResolution.ts
|
|
17567
|
+
function resolveMiniProgramComponent(ownerFilePath, request, miniprogramRootPath, hasFile) {
|
|
17568
|
+
const localPath = request.startsWith("/") ? request.replace(/^\/+/, "") : join(dirname(ownerFilePath), request);
|
|
17569
|
+
if (request.startsWith("/") || request.startsWith(".") || hasFile(join(miniprogramRootPath, `${localPath}.js`))) return localPath;
|
|
17570
|
+
const npmPath = resolveMiniProgramModule(join(miniprogramRootPath, ownerFilePath), request, miniprogramRootPath, (candidate) => candidate.endsWith(".js") && hasFile(candidate));
|
|
17571
|
+
return npmPath ? relative(miniprogramRootPath, npmPath).slice(0, -3) : localPath;
|
|
17572
|
+
}
|
|
17573
|
+
// ../../mpcore/packages/simulator/src/view/nodeEvents.ts
|
|
17574
|
+
/** 正确字段优先;复制触点,避免处理器修改调用者持有的数据。 */
|
|
17575
|
+
function readTouchEventPayload(event) {
|
|
17576
|
+
const changedTouches = event.changedTouches ?? event.changeTouches;
|
|
17577
|
+
return {
|
|
17578
|
+
...event.touches === void 0 ? {} : { touches: event.touches.map((touch) => ({ ...touch })) },
|
|
17579
|
+
...changedTouches === void 0 ? {} : { changedTouches: changedTouches.map((touch) => ({ ...touch })) }
|
|
17580
|
+
};
|
|
17581
|
+
}
|
|
17582
|
+
// ../../mpcore/packages/simulator/src/view/eventBinding.ts
|
|
17583
|
+
function resolveMiniProgramEventBinding(attributes, eventName) {
|
|
17584
|
+
return resolveEventBindingPhases(attributes, eventName, false)?.bubble ?? null;
|
|
17585
|
+
}
|
|
17586
|
+
/** 冒泡时保留原始 target,currentTarget 则属于当前执行绑定的节点。 */
|
|
17587
|
+
function createMiniProgramEventPayload(node, eventName, event, origin = node) {
|
|
17588
|
+
const dataset = collectNodeDataset(node);
|
|
17589
|
+
const nodeId = node.attribs?.id ?? "";
|
|
17590
|
+
const isOrigin = node === origin;
|
|
17591
|
+
return {
|
|
17592
|
+
...readTouchEventPayload(event),
|
|
17593
|
+
bubbles: false,
|
|
17594
|
+
capturePhase: false,
|
|
17595
|
+
composed: false,
|
|
17596
|
+
currentTarget: {
|
|
17597
|
+
dataset: isOrigin ? event.currentTarget?.dataset ?? event.dataset ?? dataset : dataset,
|
|
17598
|
+
id: isOrigin ? event.currentTarget?.id ?? event.id ?? nodeId : nodeId
|
|
17599
|
+
},
|
|
17600
|
+
detail: event.detail,
|
|
17601
|
+
mark: event.mark,
|
|
17602
|
+
target: {
|
|
17603
|
+
dataset: event.target?.dataset ?? event.dataset ?? (isOrigin ? dataset : collectNodeDataset(origin)),
|
|
17604
|
+
id: event.target?.id ?? event.id ?? origin.attribs?.id ?? ""
|
|
17605
|
+
},
|
|
17606
|
+
timeStamp: Date.now(),
|
|
17607
|
+
type: eventName
|
|
17608
|
+
};
|
|
17609
|
+
}
|
|
17610
|
+
// ../../mpcore/packages/simulator/src/view/nativeForm.ts
|
|
17611
|
+
const pickerValues = /* @__PURE__ */ new WeakMap();
|
|
17612
|
+
/** 保存 picker 的原始数组属性,不能从渲染后的逗号字符串反推选项值。 */
|
|
17613
|
+
function setNativePickerValue(node, value) {
|
|
17614
|
+
if (node.name === "picker") pickerValues.set(node, value);
|
|
17615
|
+
}
|
|
17616
|
+
function includesBehavior(definition, name, visited = /* @__PURE__ */ new Set()) {
|
|
17617
|
+
if (visited.has(definition)) return false;
|
|
17618
|
+
visited.add(definition);
|
|
17619
|
+
return Array.isArray(definition.behaviors) && definition.behaviors.some((behavior) => behavior === name || behavior !== null && typeof behavior === "object" && includesBehavior(behavior, name, visited));
|
|
17620
|
+
}
|
|
17621
|
+
function nativeOwner(node) {
|
|
17622
|
+
return getNativeNodeOwner(node) ?? {
|
|
17623
|
+
scopeId: node.attribs?.["data-sim-scope"] ?? null,
|
|
17624
|
+
target: node
|
|
17625
|
+
};
|
|
17626
|
+
}
|
|
17627
|
+
function participatingScopes(formScope, pageScope, resolveComponent) {
|
|
17628
|
+
const scopes = /* @__PURE__ */ new Set([null, pageScope]);
|
|
17629
|
+
let current = formScope;
|
|
17630
|
+
while (current && !scopes.has(current)) {
|
|
17631
|
+
scopes.add(current);
|
|
17632
|
+
current = resolveComponent?.(current)?.ownerScopeId ?? null;
|
|
17633
|
+
}
|
|
17634
|
+
return scopes;
|
|
17635
|
+
}
|
|
17636
|
+
function participates(scopeId, formScopes, behavior, resolveComponent) {
|
|
17637
|
+
const visited = /* @__PURE__ */ new Set();
|
|
17638
|
+
while (!formScopes.has(scopeId)) {
|
|
17639
|
+
if (!scopeId || visited.has(scopeId)) return false;
|
|
17640
|
+
visited.add(scopeId);
|
|
17641
|
+
const component = resolveComponent?.(scopeId);
|
|
17642
|
+
if (!component || !includesBehavior(component.definition, behavior)) return false;
|
|
17643
|
+
scopeId = component.ownerScopeId;
|
|
17644
|
+
}
|
|
17645
|
+
return true;
|
|
17646
|
+
}
|
|
17647
|
+
function checked(attributes, name) {
|
|
17648
|
+
const value = attributes?.[name];
|
|
17649
|
+
return value !== void 0 && value !== "false" && value !== "0";
|
|
17650
|
+
}
|
|
17651
|
+
function choiceValues(group, pageScope, resolveComponent) {
|
|
17652
|
+
const values = [];
|
|
17653
|
+
const scopes = participatingScopes(nativeOwner(group).scopeId, pageScope, resolveComponent);
|
|
17654
|
+
const choice = group.name === "radio-group" ? "radio" : "checkbox";
|
|
17655
|
+
const visit = (node) => {
|
|
17656
|
+
if (node.name === "form" || node.name === "radio-group" || node.name === "checkbox-group") return;
|
|
17657
|
+
if (node.name === choice) {
|
|
17658
|
+
const owner = nativeOwner(node);
|
|
17659
|
+
if (checked(owner.target.attribs, "checked") && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) values.push(owner.target.attribs?.value ?? "");
|
|
17660
|
+
}
|
|
17661
|
+
for (const child of node.children ?? []) visit(child);
|
|
17662
|
+
};
|
|
17663
|
+
for (const child of group.children ?? []) visit(child);
|
|
17664
|
+
return values;
|
|
17665
|
+
}
|
|
17666
|
+
function collectFormValues(form, scopes, pageScope, resolveComponent) {
|
|
17667
|
+
const values = Object.create(null);
|
|
17668
|
+
const visit = (node) => {
|
|
17669
|
+
if (node.name === "form") return;
|
|
17670
|
+
const owner = nativeOwner(node);
|
|
17671
|
+
const attributes = owner.target.attribs;
|
|
17672
|
+
const name = attributes?.name;
|
|
17673
|
+
if (attributes && name && participates(owner.scopeId, scopes, "wx://form-field-group", resolveComponent)) switch (node.name) {
|
|
17674
|
+
case "input":
|
|
17675
|
+
case "textarea":
|
|
17676
|
+
values[name] = attributes.value ?? "";
|
|
17677
|
+
break;
|
|
17678
|
+
case "switch":
|
|
17679
|
+
values[name] = checked(attributes, "checked");
|
|
17680
|
+
break;
|
|
17681
|
+
case "slider":
|
|
17682
|
+
values[name] = Number(attributes.value ?? 0);
|
|
17683
|
+
break;
|
|
17684
|
+
case "picker": {
|
|
17685
|
+
const mode = attributes.mode ?? "selector";
|
|
17686
|
+
if (mode === "multiSelector" || mode === "region") {
|
|
17687
|
+
const value = pickerValues.get(node);
|
|
17688
|
+
values[name] = Array.isArray(value) ? value.slice() : [];
|
|
17689
|
+
} else values[name] = mode === "selector" ? Number(attributes.value ?? 0) : attributes.value ?? "";
|
|
17690
|
+
break;
|
|
17691
|
+
}
|
|
17692
|
+
case "radio-group":
|
|
17693
|
+
values[name] = choiceValues(node, pageScope, resolveComponent)[0] ?? "";
|
|
17694
|
+
break;
|
|
17695
|
+
case "checkbox-group": values[name] = choiceValues(node, pageScope, resolveComponent);
|
|
17696
|
+
}
|
|
17697
|
+
for (const child of node.children ?? []) visit(child);
|
|
17698
|
+
};
|
|
17699
|
+
for (const child of form.children ?? []) visit(child);
|
|
17700
|
+
return values;
|
|
17701
|
+
}
|
|
17702
|
+
/** 先固定提交目标、字段值和方法所有者,再允许 tap 回调改变组件树。 */
|
|
17703
|
+
function prepareNativeFormSubmit(button, pageScope, event, resolveMethod, resolveComponent) {
|
|
17704
|
+
const owner = nativeOwner(button);
|
|
17705
|
+
if (owner.target.attribs?.["form-type"] !== "submit" || checked(owner.target.attribs, "disabled")) return;
|
|
17706
|
+
let form = button.parent;
|
|
17707
|
+
while (form && form.name !== "form") form = form.parent;
|
|
17708
|
+
if (!form) return;
|
|
17709
|
+
const formOwner = nativeOwner(form);
|
|
17710
|
+
const scopes = participatingScopes(formOwner.scopeId, pageScope, resolveComponent);
|
|
17711
|
+
if (!participates(owner.scopeId, scopes, "wx://form-field-button", resolveComponent)) return;
|
|
17712
|
+
const binding = resolveMiniProgramEventBinding(formOwner.target.attribs, "submit");
|
|
17713
|
+
return {
|
|
17714
|
+
call: binding?.method ? resolveMethod(formOwner.scopeId, binding.method) : void 0,
|
|
17715
|
+
event: createMiniProgramEventPayload(formOwner.target, "submit", {
|
|
17716
|
+
detail: { value: collectFormValues(form, scopes, pageScope, resolveComponent) },
|
|
17717
|
+
mark: event.mark
|
|
17718
|
+
})
|
|
17719
|
+
};
|
|
17720
|
+
}
|
|
17721
|
+
// ../../@weapp-core/shared/dist/rich-text.js
|
|
17648
17722
|
const ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
17649
17723
|
"a",
|
|
17650
17724
|
"abbr",
|
|
@@ -17868,8 +17942,7 @@ function normalizeRichTextNodes(value) {
|
|
|
17868
17942
|
}).children.flatMap(convertParsedNode);
|
|
17869
17943
|
return (Array.isArray(value) ? value : [value]).flatMap(convertSourceNode);
|
|
17870
17944
|
}
|
|
17871
|
-
|
|
17872
|
-
//#region ../../mpcore/packages/simulator/src/view/richText.ts
|
|
17945
|
+
// ../../mpcore/packages/simulator/src/view/richText.ts
|
|
17873
17946
|
function materializeNode(node) {
|
|
17874
17947
|
if (node.type === "text") return {
|
|
17875
17948
|
type: "text",
|
|
@@ -17887,8 +17960,7 @@ function materializeNode(node) {
|
|
|
17887
17960
|
function renderRichTextNodes(value) {
|
|
17888
17961
|
return normalizeRichTextNodes(value).map(materializeNode);
|
|
17889
17962
|
}
|
|
17890
|
-
|
|
17891
|
-
//#region ../../mpcore/packages/simulator/src/view/templateIncludes.ts
|
|
17963
|
+
// ../../mpcore/packages/simulator/src/view/templateIncludes.ts
|
|
17892
17964
|
/** 展开 include 的可渲染内容,并保留嵌套引用的来源文件。 */
|
|
17893
17965
|
function expandTemplateIncludes(root, filePath, loadTemplate) {
|
|
17894
17966
|
const owners = /* @__PURE__ */ new WeakMap();
|
|
@@ -17917,8 +17989,7 @@ function expandTemplateIncludes(root, filePath, loadTemplate) {
|
|
|
17917
17989
|
expand(root, filePath, [filePath]);
|
|
17918
17990
|
return owners;
|
|
17919
17991
|
}
|
|
17920
|
-
|
|
17921
|
-
//#region ../../mpcore/packages/simulator/src/view/templateImports.ts
|
|
17992
|
+
// ../../mpcore/packages/simulator/src/view/templateImports.ts
|
|
17922
17993
|
function createImportedTemplateState(root, filePath, loadImport, loadWxs) {
|
|
17923
17994
|
const documents = /* @__PURE__ */ new Map();
|
|
17924
17995
|
const definitionScopes = /* @__PURE__ */ new Map();
|
|
@@ -17969,8 +18040,7 @@ function createImportedTemplateState(root, filePath, loadImport, loadWxs) {
|
|
|
17969
18040
|
};
|
|
17970
18041
|
return collect(root, filePath).state;
|
|
17971
18042
|
}
|
|
17972
|
-
|
|
17973
|
-
//#region ../../mpcore/packages/simulator/src/view/templateText.ts
|
|
18043
|
+
// ../../mpcore/packages/simulator/src/view/templateText.ts
|
|
17974
18044
|
function interpolateTemplateText(input, data, emptyNull = false) {
|
|
17975
18045
|
let output = "";
|
|
17976
18046
|
let offset = 0;
|
|
@@ -17981,58 +18051,7 @@ function interpolateTemplateText(input, data, emptyNull = false) {
|
|
|
17981
18051
|
}
|
|
17982
18052
|
return output + input.slice(offset);
|
|
17983
18053
|
}
|
|
17984
|
-
|
|
17985
|
-
//#region ../../mpcore/packages/simulator/src/view/templateAttributes.ts
|
|
17986
|
-
function decodeAttribute(raw, quote) {
|
|
17987
|
-
const source = raw.replaceAll(`\\${quote}`, quote);
|
|
17988
|
-
let value = "";
|
|
17989
|
-
let offset = 0;
|
|
17990
|
-
for (const range of templateInterpolations(source)) {
|
|
17991
|
-
value += source.slice(offset, range.start).replace(/\\([\s\S])/g, "$1");
|
|
17992
|
-
value += source.slice(range.start, range.end);
|
|
17993
|
-
offset = range.end;
|
|
17994
|
-
}
|
|
17995
|
-
return value + source.slice(offset).replace(/\\([\s\S])/g, "$1");
|
|
17996
|
-
}
|
|
17997
|
-
/** 先保存 WXML 属性词法值,再交给 HTML parser 构建标签树,避免反斜杠引号提前截断属性。 */
|
|
17998
|
-
function maskTemplateAttributes(source) {
|
|
17999
|
-
const attributes = /* @__PURE__ */ new Map();
|
|
18000
|
-
if (!source.includes("\\")) return {
|
|
18001
|
-
source,
|
|
18002
|
-
attributes
|
|
18003
|
-
};
|
|
18004
|
-
let prefix = "__mpcore_quoted_attribute_";
|
|
18005
|
-
while (source.includes(prefix)) prefix += "_";
|
|
18006
|
-
let output = "";
|
|
18007
|
-
let offset = 0;
|
|
18008
|
-
for (let i = 0; i < source.length; i++) {
|
|
18009
|
-
if (source.startsWith("<!--", i)) {
|
|
18010
|
-
const end = source.indexOf("-->", i + 4);
|
|
18011
|
-
i = end < 0 ? source.length : end + 2;
|
|
18012
|
-
continue;
|
|
18013
|
-
}
|
|
18014
|
-
if (source[i] !== "<" || !/[a-z_]/i.test(source[i + 1] ?? "")) continue;
|
|
18015
|
-
for (i++; i < source.length && source[i] !== ">"; i++) {
|
|
18016
|
-
if (source[i] !== "\"" && source[i] !== "'") continue;
|
|
18017
|
-
const quote = source[i];
|
|
18018
|
-
const start = i + 1;
|
|
18019
|
-
for (i++; i < source.length && source[i] !== quote; i++) if (source[i] === "\\") i++;
|
|
18020
|
-
if (i >= source.length) break;
|
|
18021
|
-
const raw = source.slice(start, i);
|
|
18022
|
-
if (!raw.includes("\\")) continue;
|
|
18023
|
-
const token = `${prefix}${attributes.size}`;
|
|
18024
|
-
attributes.set(token, decodeAttribute(raw, quote));
|
|
18025
|
-
output += source.slice(offset, start) + token;
|
|
18026
|
-
offset = i;
|
|
18027
|
-
}
|
|
18028
|
-
}
|
|
18029
|
-
return {
|
|
18030
|
-
source: output + source.slice(offset),
|
|
18031
|
-
attributes
|
|
18032
|
-
};
|
|
18033
|
-
}
|
|
18034
|
-
//#endregion
|
|
18035
|
-
//#region ../../mpcore/packages/simulator/src/view/wxsDocument.ts
|
|
18054
|
+
// ../../mpcore/packages/simulator/src/view/wxsDocument.ts
|
|
18036
18055
|
const INLINE_WXS_RE = /<wxs\b([^>]*)(?<!\/)>([\s\S]*?)<\/wxs\s*>/g;
|
|
18037
18056
|
function parseWxsTemplateDocument(templateSource) {
|
|
18038
18057
|
const scripts = [];
|
|
@@ -18040,13 +18059,7 @@ function parseWxsTemplateDocument(templateSource) {
|
|
|
18040
18059
|
return `<wxs data-sim-wxs="${scripts.push(script) - 1}"${attributes}>wxs-source</wxs>`;
|
|
18041
18060
|
});
|
|
18042
18061
|
const masked = maskTemplateAttributes(source);
|
|
18043
|
-
const document =
|
|
18044
|
-
xmlMode: true,
|
|
18045
|
-
decodeEntities: false,
|
|
18046
|
-
lowerCaseAttributeNames: false,
|
|
18047
|
-
lowerCaseTags: false,
|
|
18048
|
-
recognizeSelfClosing: true
|
|
18049
|
-
});
|
|
18062
|
+
const document = parseTemplateAttributeDocument(`<page>${masked.source}</page>`);
|
|
18050
18063
|
if (!scripts.length && !masked.attributes.size && !/[\r\n]/.test(source)) return document;
|
|
18051
18064
|
const hasAttributes = masked.attributes.size > 0;
|
|
18052
18065
|
const restore = (node) => {
|
|
@@ -18064,8 +18077,7 @@ function parseWxsTemplateDocument(templateSource) {
|
|
|
18064
18077
|
restore(document);
|
|
18065
18078
|
return document;
|
|
18066
18079
|
}
|
|
18067
|
-
|
|
18068
|
-
//#region ../../mpcore/packages/simulator/src/runtime/render/shared.ts
|
|
18080
|
+
// ../../mpcore/packages/simulator/src/runtime/render/shared.ts
|
|
18069
18081
|
const LEADING_SLASH_RE$4 = /^\/+/;
|
|
18070
18082
|
const EVENT_BINDING_ATTRS = [
|
|
18071
18083
|
"bindtap",
|
|
@@ -18103,12 +18115,14 @@ function escapeAttribute$1(value) {
|
|
|
18103
18115
|
return escapeText$2(value).replaceAll("\"", """);
|
|
18104
18116
|
}
|
|
18105
18117
|
function cloneNode(node) {
|
|
18106
|
-
|
|
18118
|
+
const clone = {
|
|
18107
18119
|
...node,
|
|
18108
18120
|
attribs: node.attribs ? { ...node.attribs } : void 0,
|
|
18109
18121
|
dataset: node.dataset ? { ...node.dataset } : void 0,
|
|
18110
18122
|
children: node.children?.map((child) => cloneNode(child))
|
|
18111
18123
|
};
|
|
18124
|
+
copyTemplateAttributeMetadata(node, clone);
|
|
18125
|
+
return clone;
|
|
18112
18126
|
}
|
|
18113
18127
|
function resolveRawValueByPath$1(source, expression) {
|
|
18114
18128
|
return resolveTemplateExpression(source, expression);
|
|
@@ -18204,33 +18218,37 @@ function createLoopScope(scope, itemName, indexName, item, index) {
|
|
|
18204
18218
|
}
|
|
18205
18219
|
};
|
|
18206
18220
|
}
|
|
18207
|
-
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
if (
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
|
|
18221
|
-
};
|
|
18221
|
+
// ../../mpcore/packages/simulator/src/runtime/render/registry.ts
|
|
18222
|
+
const snapshots = /* @__PURE__ */ new WeakMap();
|
|
18223
|
+
/** 同一次同步渲染的挂载重试共享配置与路径解析,下一轮重新读取产物。 */
|
|
18224
|
+
function withComponentRegistrySnapshot(context, render) {
|
|
18225
|
+
if (snapshots.has(context)) return render();
|
|
18226
|
+
snapshots.set(context, {
|
|
18227
|
+
configs: /* @__PURE__ */ new Map(),
|
|
18228
|
+
usingComponents: /* @__PURE__ */ new Map()
|
|
18229
|
+
});
|
|
18230
|
+
try {
|
|
18231
|
+
return render();
|
|
18232
|
+
} finally {
|
|
18233
|
+
snapshots.delete(context);
|
|
18234
|
+
}
|
|
18222
18235
|
}
|
|
18223
|
-
function readComponentConfig(
|
|
18236
|
+
function readComponentConfig(context, jsonPath) {
|
|
18237
|
+
const configs = snapshots.get(context)?.configs;
|
|
18238
|
+
if (configs?.has(jsonPath)) return configs.get(jsonPath);
|
|
18239
|
+
let config;
|
|
18224
18240
|
try {
|
|
18225
|
-
const source = artifactSource.readText(jsonPath);
|
|
18226
|
-
|
|
18241
|
+
const source = context.artifactSource.readText(jsonPath);
|
|
18242
|
+
config = source ? JSON.parse(source) : {};
|
|
18227
18243
|
} catch {
|
|
18228
|
-
|
|
18244
|
+
config = {};
|
|
18229
18245
|
}
|
|
18246
|
+
configs?.set(jsonPath, config);
|
|
18247
|
+
return config;
|
|
18230
18248
|
}
|
|
18231
|
-
function
|
|
18249
|
+
function resolveOwnerComponent(context, ownerJsonPath, ownerFilePath, alias) {
|
|
18232
18250
|
try {
|
|
18233
|
-
const usingComponents = readComponentConfig(context
|
|
18251
|
+
const usingComponents = readComponentConfig(context, ownerJsonPath).usingComponents;
|
|
18234
18252
|
if (!usingComponents || typeof usingComponents !== "object" || Array.isArray(usingComponents)) return;
|
|
18235
18253
|
const rawPath = usingComponents[alias];
|
|
18236
18254
|
if (typeof rawPath !== "string") return;
|
|
@@ -18239,9 +18257,38 @@ function resolveUsingComponent(context, ownerJsonPath, ownerFilePath, alias) {
|
|
|
18239
18257
|
return;
|
|
18240
18258
|
}
|
|
18241
18259
|
}
|
|
18260
|
+
function resolveUsingComponent(context, ownerJsonPath, ownerFilePath, alias) {
|
|
18261
|
+
const snapshot = snapshots.get(context);
|
|
18262
|
+
const ownerFiles = snapshot?.usingComponents.get(ownerJsonPath);
|
|
18263
|
+
const cached = ownerFiles?.get(ownerFilePath);
|
|
18264
|
+
if (cached?.has(alias)) return cached.get(alias);
|
|
18265
|
+
const resolved = resolveOwnerComponent(context, ownerJsonPath, ownerFilePath, alias);
|
|
18266
|
+
if (snapshot) {
|
|
18267
|
+
const entries = ownerFiles ?? /* @__PURE__ */ new Map();
|
|
18268
|
+
const aliases = cached ?? /* @__PURE__ */ new Map();
|
|
18269
|
+
aliases.set(alias, resolved);
|
|
18270
|
+
entries.set(ownerFilePath, aliases);
|
|
18271
|
+
snapshot.usingComponents.set(ownerJsonPath, entries);
|
|
18272
|
+
}
|
|
18273
|
+
return resolved;
|
|
18274
|
+
}
|
|
18275
|
+
// ../../mpcore/packages/simulator/src/runtime/render/component.ts
|
|
18276
|
+
function resolveComponentRegistryEntry(context, ownerJsonPath, ownerFilePath, alias, genericComponentBasePath) {
|
|
18277
|
+
const componentBasePath = genericComponentBasePath ?? resolveUsingComponent(context, ownerJsonPath, ownerFilePath, alias);
|
|
18278
|
+
if (!componentBasePath) return null;
|
|
18279
|
+
const filePath = `${componentBasePath}.js`;
|
|
18280
|
+
const templatePath = `${componentBasePath}.wxml`;
|
|
18281
|
+
const absoluteFilePath = path.resolve(context.project.miniprogramRootPath, filePath);
|
|
18282
|
+
const absoluteTemplatePath = path.resolve(context.project.miniprogramRootPath, templatePath);
|
|
18283
|
+
return {
|
|
18284
|
+
definition: context.moduleLoader.executeComponentModule(absoluteFilePath, componentBasePath),
|
|
18285
|
+
filePath,
|
|
18286
|
+
templatePath,
|
|
18287
|
+
absoluteTemplatePath
|
|
18288
|
+
};
|
|
18289
|
+
}
|
|
18242
18290
|
function resolveComponentGenerics(context, hostNode, ownerJsonPath, ownerFilePath, componentFilePath, ownerGenerics) {
|
|
18243
|
-
const
|
|
18244
|
-
const componentGenerics = readComponentConfig(context.artifactSource, componentJsonPath).componentGenerics;
|
|
18291
|
+
const componentGenerics = readComponentConfig(context, path.resolve(context.project.miniprogramRootPath, `${componentFilePath.replace(JS_FILE_RE, "")}.json`)).componentGenerics;
|
|
18245
18292
|
if (!componentGenerics || typeof componentGenerics !== "object" || Array.isArray(componentGenerics)) return;
|
|
18246
18293
|
const resolved = /* @__PURE__ */ new Map();
|
|
18247
18294
|
for (const [genericName, definition] of Object.entries(componentGenerics)) {
|
|
@@ -18283,13 +18330,13 @@ function createComponentScope(clonedNode, scope, componentScopeId, componentInst
|
|
|
18283
18330
|
function resolveComponentProperties(clonedNode, scope, definition) {
|
|
18284
18331
|
const nextProperties = {};
|
|
18285
18332
|
const bindingExpressions = {};
|
|
18286
|
-
const declaredProperties = definition
|
|
18333
|
+
const declaredProperties = resolveComponentPropertyDefinitions(definition);
|
|
18287
18334
|
for (const [key, value] of Object.entries(clonedNode.attribs ?? {})) {
|
|
18288
18335
|
if (key.startsWith("bind") || key.startsWith("generic:")) continue;
|
|
18289
18336
|
const camelizedKey = key.replace(/-([a-z])/g, (_match, char) => char.toUpperCase());
|
|
18290
18337
|
const propertyKey = key in declaredProperties || !(camelizedKey in declaredProperties) ? key : camelizedKey;
|
|
18291
18338
|
if (isMustacheOnly$1(String(value))) bindingExpressions[propertyKey] = String(value).trim().slice(2, -2).trim();
|
|
18292
|
-
nextProperties[propertyKey] = resolveComponentAttributeValue(String(value), scope);
|
|
18339
|
+
nextProperties[propertyKey] = Object.hasOwn(declaredProperties, propertyKey) && isValuelessTemplateAttribute(clonedNode, key) ? true : resolveComponentAttributeValue(String(value), scope);
|
|
18293
18340
|
}
|
|
18294
18341
|
return {
|
|
18295
18342
|
nextProperties,
|
|
@@ -18334,8 +18381,7 @@ function renderRuntimeComponentTemplate(context, componentEntry, renderNodeTree,
|
|
|
18334
18381
|
const templateRenderState = prepareTemplateRenderState(context.artifactSource, componentRoot, componentEntry.absoluteTemplatePath, context.project.miniprogramRootPath, getRuntimeWxsLoader(context.moduleLoader, context.artifactSource));
|
|
18335
18382
|
return renderNodeTree(componentRoot, componentScope, context, path.resolve(context.project.miniprogramRootPath, `${componentEntry.filePath.replace(JS_FILE_RE, "")}.json`), componentEntry.filePath, componentScopeId, renderPass, templateRenderState, componentScope.hostNode);
|
|
18336
18383
|
}
|
|
18337
|
-
|
|
18338
|
-
//#region ../../mpcore/packages/simulator/src/runtime/render/index.ts
|
|
18384
|
+
// ../../mpcore/packages/simulator/src/runtime/render/index.ts
|
|
18339
18385
|
function expandNodeByFor(node, scope) {
|
|
18340
18386
|
const forExpression = node.attribs?.["wx:for"];
|
|
18341
18387
|
if (!forExpression) return [{
|
|
@@ -18610,14 +18656,15 @@ function reconcileRuntimePageTree(context, page, bindingsOnly = false) {
|
|
|
18610
18656
|
}
|
|
18611
18657
|
}
|
|
18612
18658
|
function renderRuntimePageTree(context, page) {
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18659
|
+
return withComponentRegistrySnapshot(context, () => {
|
|
18660
|
+
const { root, roots } = reconcileRuntimePageTree(context, page);
|
|
18661
|
+
return {
|
|
18662
|
+
root,
|
|
18663
|
+
wxml: roots.map(serializeDomNode$1).join("")
|
|
18664
|
+
};
|
|
18665
|
+
});
|
|
18618
18666
|
}
|
|
18619
|
-
|
|
18620
|
-
//#region ../../mpcore/packages/simulator/src/host/behavior.ts
|
|
18667
|
+
// ../../mpcore/packages/simulator/src/host/behavior.ts
|
|
18621
18668
|
function validateConstructedBehaviors(definition, visited = /* @__PURE__ */ new WeakSet()) {
|
|
18622
18669
|
if (visited.has(definition)) return;
|
|
18623
18670
|
visited.add(definition);
|
|
@@ -18628,8 +18675,7 @@ function validateConstructedBehaviors(definition, visited = /* @__PURE__ */ new
|
|
|
18628
18675
|
validateConstructedBehaviors(behavior, visited);
|
|
18629
18676
|
}
|
|
18630
18677
|
}
|
|
18631
|
-
|
|
18632
|
-
//#region ../../mpcore/packages/simulator/src/host/globals.ts
|
|
18678
|
+
// ../../mpcore/packages/simulator/src/host/globals.ts
|
|
18633
18679
|
function createDuplicateRegistrationError(kind, id) {
|
|
18634
18680
|
return /* @__PURE__ */ new Error(`Duplicate ${kind} registration in headless runtime: ${id}`);
|
|
18635
18681
|
}
|
|
@@ -18723,8 +18769,37 @@ function registerExportedComponentDefinition(registries, id, moduleExports, regi
|
|
|
18723
18769
|
registries.components.set(id, exportedDefinition);
|
|
18724
18770
|
return exportedDefinition;
|
|
18725
18771
|
}
|
|
18726
|
-
|
|
18727
|
-
|
|
18772
|
+
// ../../mpcore/packages/simulator/src/host/wx/base64.ts
|
|
18773
|
+
const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
18774
|
+
function arrayBufferToBase64(buffer) {
|
|
18775
|
+
const bytes = new Uint8Array(buffer);
|
|
18776
|
+
const encoded = [];
|
|
18777
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
18778
|
+
const first = bytes[index];
|
|
18779
|
+
const second = bytes[index + 1];
|
|
18780
|
+
const third = bytes[index + 2];
|
|
18781
|
+
encoded.push(BASE64_ALPHABET[first >> 2], BASE64_ALPHABET[(first & 3) << 4 | (second ?? 0) >> 4], second === void 0 ? "=" : BASE64_ALPHABET[(second & 15) << 2 | (third ?? 0) >> 6], third === void 0 ? "=" : BASE64_ALPHABET[third & 63]);
|
|
18782
|
+
}
|
|
18783
|
+
return encoded.join("");
|
|
18784
|
+
}
|
|
18785
|
+
function base64ToArrayBuffer(base64) {
|
|
18786
|
+
const bytes = [];
|
|
18787
|
+
let accumulator = 0;
|
|
18788
|
+
let bitCount = 0;
|
|
18789
|
+
for (const character of base64) {
|
|
18790
|
+
if (character === "=") break;
|
|
18791
|
+
const value = BASE64_ALPHABET.indexOf(character);
|
|
18792
|
+
if (value < 0) continue;
|
|
18793
|
+
accumulator = accumulator << 6 | value;
|
|
18794
|
+
bitCount += 6;
|
|
18795
|
+
if (bitCount >= 8) {
|
|
18796
|
+
bitCount -= 8;
|
|
18797
|
+
bytes.push(accumulator >> bitCount & 255);
|
|
18798
|
+
}
|
|
18799
|
+
}
|
|
18800
|
+
return new Uint8Array(bytes).buffer;
|
|
18801
|
+
}
|
|
18802
|
+
// ../../mpcore/packages/simulator/src/host/wx/eventBus.ts
|
|
18728
18803
|
function createHeadlessUniEventBus() {
|
|
18729
18804
|
const listeners = /* @__PURE__ */ new Map();
|
|
18730
18805
|
const $off = (eventName, handler) => {
|
|
@@ -18773,8 +18848,7 @@ function createHeadlessUniEventBus() {
|
|
|
18773
18848
|
}
|
|
18774
18849
|
};
|
|
18775
18850
|
}
|
|
18776
|
-
|
|
18777
|
-
//#region ../../mpcore/packages/simulator/src/host/wx/logManager.ts
|
|
18851
|
+
// ../../mpcore/packages/simulator/src/host/wx/logManager.ts
|
|
18778
18852
|
function createHeadlessLogManager(runtimeConsole) {
|
|
18779
18853
|
return {
|
|
18780
18854
|
debug(...args) {
|
|
@@ -18791,8 +18865,7 @@ function createHeadlessLogManager(runtimeConsole) {
|
|
|
18791
18865
|
}
|
|
18792
18866
|
};
|
|
18793
18867
|
}
|
|
18794
|
-
|
|
18795
|
-
//#region ../../mpcore/packages/simulator/src/host/wx/startupNavigation.ts
|
|
18868
|
+
// ../../mpcore/packages/simulator/src/host/wx/startupNavigation.ts
|
|
18796
18869
|
const queues = /* @__PURE__ */ new WeakMap();
|
|
18797
18870
|
/** 冷启动先完成 App 与首屏装载,再顺序提交启动钩子请求的导航。 */
|
|
18798
18871
|
var StartupNavigationQueue = class {
|
|
@@ -18821,17 +18894,24 @@ var StartupNavigationQueue = class {
|
|
|
18821
18894
|
});
|
|
18822
18895
|
return;
|
|
18823
18896
|
}
|
|
18824
|
-
const
|
|
18825
|
-
|
|
18897
|
+
const scheduler = this.scheduler;
|
|
18898
|
+
const isolate = (callback) => callback ? function(...args) {
|
|
18899
|
+
try {
|
|
18900
|
+
callback.apply(this, args);
|
|
18901
|
+
} catch (error) {
|
|
18902
|
+
scheduler.setTimeout(() => {
|
|
18903
|
+
throw error;
|
|
18904
|
+
}, 0);
|
|
18905
|
+
}
|
|
18826
18906
|
} : void 0;
|
|
18827
|
-
const
|
|
18907
|
+
const submitted = option && {
|
|
18828
18908
|
...option,
|
|
18829
|
-
success:
|
|
18830
|
-
fail:
|
|
18831
|
-
complete:
|
|
18909
|
+
success: isolate(option.success),
|
|
18910
|
+
fail: isolate(option.fail),
|
|
18911
|
+
complete: isolate(option.complete)
|
|
18832
18912
|
};
|
|
18833
18913
|
this.pending.push(() => {
|
|
18834
|
-
operation(
|
|
18914
|
+
operation(submitted);
|
|
18835
18915
|
});
|
|
18836
18916
|
}
|
|
18837
18917
|
flush() {
|
|
@@ -18848,8 +18928,7 @@ function runNavigationApi(driver, option, operation) {
|
|
|
18848
18928
|
const queue = queues.get(driver);
|
|
18849
18929
|
return queue ? queue.run(option, operation) : operation(option);
|
|
18850
18930
|
}
|
|
18851
|
-
|
|
18852
|
-
//#region ../../mpcore/packages/simulator/src/host/wx/index.ts
|
|
18931
|
+
// ../../mpcore/packages/simulator/src/host/wx/index.ts
|
|
18853
18932
|
function invokeWxApi(operation, option) {
|
|
18854
18933
|
try {
|
|
18855
18934
|
const result = operation();
|
|
@@ -18878,6 +18957,8 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
18878
18957
|
return Number.isFinite(value) && width > 0 ? value * width / 750 : 0;
|
|
18879
18958
|
};
|
|
18880
18959
|
const capabilityTree = {
|
|
18960
|
+
arrayBufferToBase64: true,
|
|
18961
|
+
base64ToArrayBuffer: true,
|
|
18881
18962
|
canIUse: true,
|
|
18882
18963
|
...workers ? {
|
|
18883
18964
|
createWorker: true,
|
|
@@ -18978,6 +19059,11 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
18978
19059
|
platform: true,
|
|
18979
19060
|
version: true
|
|
18980
19061
|
} },
|
|
19062
|
+
getAccountInfoSync: { return: { miniProgram: {
|
|
19063
|
+
appId: true,
|
|
19064
|
+
envVersion: true,
|
|
19065
|
+
version: true
|
|
19066
|
+
} } },
|
|
18981
19067
|
getDeviceInfo: { return: {
|
|
18982
19068
|
abi: true,
|
|
18983
19069
|
benchmarkLevel: true,
|
|
@@ -19077,6 +19163,10 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19077
19163
|
windowWidth: true
|
|
19078
19164
|
} },
|
|
19079
19165
|
loadFontFace: { return: { errMsg: true } },
|
|
19166
|
+
login: { return: {
|
|
19167
|
+
code: true,
|
|
19168
|
+
errMsg: true
|
|
19169
|
+
} },
|
|
19080
19170
|
hideLoading: true,
|
|
19081
19171
|
hideToast: true,
|
|
19082
19172
|
downloadFile: true,
|
|
@@ -19140,6 +19230,8 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19140
19230
|
...eventBus,
|
|
19141
19231
|
[WEVU_ROUTE_EVENT_CONTRACT_KEY]: 1,
|
|
19142
19232
|
[WEVU_PAGE_SCROLL_EVENT_CONTRACT_KEY]: 1,
|
|
19233
|
+
arrayBufferToBase64,
|
|
19234
|
+
base64ToArrayBuffer,
|
|
19143
19235
|
createWorker: (script) => {
|
|
19144
19236
|
if (!workers) throw new Error("Worker host is unavailable");
|
|
19145
19237
|
return workers.createWorker(script);
|
|
@@ -19177,7 +19269,7 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19177
19269
|
single,
|
|
19178
19270
|
target
|
|
19179
19271
|
});
|
|
19180
|
-
|
|
19272
|
+
callbacks.push(callback);
|
|
19181
19273
|
return query;
|
|
19182
19274
|
},
|
|
19183
19275
|
fields: (fields, callback) => {
|
|
@@ -19187,7 +19279,7 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19187
19279
|
single,
|
|
19188
19280
|
target
|
|
19189
19281
|
});
|
|
19190
|
-
|
|
19282
|
+
callbacks.push(callback);
|
|
19191
19283
|
return query;
|
|
19192
19284
|
},
|
|
19193
19285
|
node: (callback) => {
|
|
@@ -19197,7 +19289,7 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19197
19289
|
single,
|
|
19198
19290
|
target
|
|
19199
19291
|
});
|
|
19200
|
-
|
|
19292
|
+
callbacks.push(callback);
|
|
19201
19293
|
return query;
|
|
19202
19294
|
},
|
|
19203
19295
|
scrollOffset: (callback) => {
|
|
@@ -19207,15 +19299,19 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19207
19299
|
single,
|
|
19208
19300
|
target
|
|
19209
19301
|
});
|
|
19210
|
-
|
|
19302
|
+
callbacks.push(callback);
|
|
19211
19303
|
return query;
|
|
19212
19304
|
}
|
|
19213
19305
|
});
|
|
19214
19306
|
query = {
|
|
19215
19307
|
exec: (callback) => {
|
|
19216
|
-
const
|
|
19217
|
-
|
|
19218
|
-
|
|
19308
|
+
const queuedRequests = [...requests];
|
|
19309
|
+
const queuedCallbacks = [...callbacks];
|
|
19310
|
+
const result = driver.executeSelectorQuery(queuedRequests, scope);
|
|
19311
|
+
driver.nextTick(() => {
|
|
19312
|
+
for (const [index, item] of result.entries()) queuedCallbacks[index]?.(item);
|
|
19313
|
+
callback?.(result);
|
|
19314
|
+
});
|
|
19219
19315
|
return result;
|
|
19220
19316
|
},
|
|
19221
19317
|
in: (component) => {
|
|
@@ -19245,6 +19341,7 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19245
19341
|
getSavedFileList: (option) => invokeWxApi(() => driver.getSavedFileList(option), option),
|
|
19246
19342
|
getAppBaseInfo: (option) => invokeWxApi(() => driver.getAppBaseInfoSync(), option),
|
|
19247
19343
|
getAppBaseInfoSync: () => driver.getAppBaseInfoSync(),
|
|
19344
|
+
getAccountInfoSync: () => driver.getAccountInfoSync(),
|
|
19248
19345
|
getDeviceInfo: () => driver.getDeviceInfo(),
|
|
19249
19346
|
getLaunchOptionsSync: () => driver.getLaunchOptionsSync(),
|
|
19250
19347
|
getClipboardData: (option) => invokeWxApi(() => driver.getClipboardData(), option),
|
|
@@ -19265,6 +19362,7 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19265
19362
|
if (!option || typeof option.family !== "string" || !option.family.trim() || typeof option.source !== "string" || !option.source.trim()) throw new TypeError("loadFontFace:fail invalid options");
|
|
19266
19363
|
return { errMsg: "loadFontFace:ok" };
|
|
19267
19364
|
}, option),
|
|
19365
|
+
login: (option) => driver.login(option),
|
|
19268
19366
|
hideLoading: (option) => invokeWxApi(() => driver.hideLoading(), option),
|
|
19269
19367
|
hideToast: () => driver.hideToast(),
|
|
19270
19368
|
downloadFile: (option) => driver.downloadFile(option),
|
|
@@ -19341,8 +19439,7 @@ function createHeadlessWx(driver, runtimeConsole = console, workers) {
|
|
|
19341
19439
|
upx2px: rpx2px
|
|
19342
19440
|
};
|
|
19343
19441
|
}
|
|
19344
|
-
|
|
19345
|
-
//#region ../../mpcore/packages/simulator/src/host/appLaunchOptions.ts
|
|
19442
|
+
// ../../mpcore/packages/simulator/src/host/appLaunchOptions.ts
|
|
19346
19443
|
/** 普通启动没有来源小程序,保留宿主返回的空 referrerInfo。 */
|
|
19347
19444
|
function createAppLaunchOptions(pathname, query) {
|
|
19348
19445
|
return {
|
|
@@ -19362,8 +19459,7 @@ function cloneAppLaunchOptions(options) {
|
|
|
19362
19459
|
referrerInfo
|
|
19363
19460
|
};
|
|
19364
19461
|
}
|
|
19365
|
-
|
|
19366
|
-
//#region ../../mpcore/packages/simulator/src/host/wx/navigation.ts
|
|
19462
|
+
// ../../mpcore/packages/simulator/src/host/wx/navigation.ts
|
|
19367
19463
|
function invokePreparedNavigationApi(prepare, option) {
|
|
19368
19464
|
try {
|
|
19369
19465
|
const finalize = prepare()();
|
|
@@ -19378,8 +19474,7 @@ function invokePreparedNavigationApi(prepare, option) {
|
|
|
19378
19474
|
option?.complete?.();
|
|
19379
19475
|
}
|
|
19380
19476
|
}
|
|
19381
|
-
|
|
19382
|
-
//#region ../../mpcore/packages/simulator/src/kernel/artifactSource.ts
|
|
19477
|
+
// ../../mpcore/packages/simulator/src/kernel/artifactSource.ts
|
|
19383
19478
|
function createFileSystemArtifactSource() {
|
|
19384
19479
|
return {
|
|
19385
19480
|
has(filePath) {
|
|
@@ -19398,8 +19493,7 @@ function createFileSystemArtifactSource() {
|
|
|
19398
19493
|
}
|
|
19399
19494
|
};
|
|
19400
19495
|
}
|
|
19401
|
-
|
|
19402
|
-
//#region ../../mpcore/packages/simulator/src/kernel/diagnostics.ts
|
|
19496
|
+
// ../../mpcore/packages/simulator/src/kernel/diagnostics.ts
|
|
19403
19497
|
var RuntimeDiagnostics = class {
|
|
19404
19498
|
entries = [];
|
|
19405
19499
|
clear() {
|
|
@@ -19440,8 +19534,7 @@ var RuntimeDiagnostics = class {
|
|
|
19440
19534
|
return runtimeConsole;
|
|
19441
19535
|
}
|
|
19442
19536
|
};
|
|
19443
|
-
|
|
19444
|
-
//#region ../../mpcore/packages/simulator/src/kernel/scheduler.ts
|
|
19537
|
+
// ../../mpcore/packages/simulator/src/kernel/scheduler.ts
|
|
19445
19538
|
var RuntimeScheduler = class {
|
|
19446
19539
|
intervals = /* @__PURE__ */ new Set();
|
|
19447
19540
|
timeouts = /* @__PURE__ */ new Set();
|
|
@@ -19512,8 +19605,7 @@ var RuntimeScheduler = class {
|
|
|
19512
19605
|
return this.canceledHandle;
|
|
19513
19606
|
}
|
|
19514
19607
|
};
|
|
19515
|
-
|
|
19516
|
-
//#region ../../mpcore/packages/simulator/src/kernel/runtimeKernel.ts
|
|
19608
|
+
// ../../mpcore/packages/simulator/src/kernel/runtimeKernel.ts
|
|
19517
19609
|
var RuntimeKernel = class {
|
|
19518
19610
|
diagnostics = new RuntimeDiagnostics();
|
|
19519
19611
|
scheduler = new RuntimeScheduler((error) => {
|
|
@@ -19532,8 +19624,7 @@ var RuntimeKernel = class {
|
|
|
19532
19624
|
return this.closed;
|
|
19533
19625
|
}
|
|
19534
19626
|
};
|
|
19535
|
-
|
|
19536
|
-
//#region ../../mpcore/packages/simulator/src/kernel/renderQueue.ts
|
|
19627
|
+
// ../../mpcore/packages/simulator/src/kernel/renderQueue.ts
|
|
19537
19628
|
/** 两类宿主共享提交、错误诊断与等待回调边界,失败批次不自动重试。 */
|
|
19538
19629
|
var RuntimeRenderQueue = class {
|
|
19539
19630
|
options;
|
|
@@ -19588,8 +19679,7 @@ var RuntimeRenderQueue = class {
|
|
|
19588
19679
|
return this.closed || this.options.isClosed();
|
|
19589
19680
|
}
|
|
19590
19681
|
};
|
|
19591
|
-
|
|
19592
|
-
//#region ../../mpcore/packages/simulator/src/project/resolveRoutes.ts
|
|
19682
|
+
// ../../mpcore/packages/simulator/src/project/resolveRoutes.ts
|
|
19593
19683
|
const LEADING_SLASH_RE$3 = /^\/+/;
|
|
19594
19684
|
const TRAILING_SLASH_RE$1 = /\/+$/;
|
|
19595
19685
|
const DUPLICATE_SLASH_RE = /\/{2,}/g;
|
|
@@ -19646,8 +19736,7 @@ function resolveRoutesFromAppConfig(config, plugins = []) {
|
|
|
19646
19736
|
}
|
|
19647
19737
|
return records;
|
|
19648
19738
|
}
|
|
19649
|
-
|
|
19650
|
-
//#region ../../mpcore/packages/simulator/src/project/createProjectDescriptor.ts
|
|
19739
|
+
// ../../mpcore/packages/simulator/src/project/createProjectDescriptor.ts
|
|
19651
19740
|
function createProjectDescriptor(options) {
|
|
19652
19741
|
return {
|
|
19653
19742
|
artifactSource: options.artifactSource ?? createFileSystemArtifactSource(),
|
|
@@ -19661,8 +19750,7 @@ function createProjectDescriptor(options) {
|
|
|
19661
19750
|
routes: resolveRoutesFromAppConfig(options.appConfig, options.plugins ?? [])
|
|
19662
19751
|
};
|
|
19663
19752
|
}
|
|
19664
|
-
|
|
19665
|
-
//#region ../../mpcore/packages/simulator/src/project/hostConfig.ts
|
|
19753
|
+
// ../../mpcore/packages/simulator/src/project/hostConfig.ts
|
|
19666
19754
|
/**
|
|
19667
19755
|
* @description 根据构建后的 app.json 创建模拟器提供给小程序脚本读取的宿主配置。
|
|
19668
19756
|
* 微信开发者工具的 tabBar 页面路径通常带有 `.html` 后缀,保留该形态以覆盖路由归一化边界。
|
|
@@ -19695,8 +19783,7 @@ function createMiniProgramHostConfig(appConfig, override) {
|
|
|
19695
19783
|
} } : {}
|
|
19696
19784
|
};
|
|
19697
19785
|
}
|
|
19698
|
-
|
|
19699
|
-
//#region ../../mpcore/packages/simulator/src/project/loadProject.ts
|
|
19786
|
+
// ../../mpcore/packages/simulator/src/project/loadProject.ts
|
|
19700
19787
|
function readJsonObject$1(filePath) {
|
|
19701
19788
|
try {
|
|
19702
19789
|
const content = fs.readFileSync(filePath, "utf8");
|
|
@@ -19788,8 +19875,23 @@ function loadProject(projectPath) {
|
|
|
19788
19875
|
projectConfigFiles
|
|
19789
19876
|
});
|
|
19790
19877
|
}
|
|
19791
|
-
|
|
19792
|
-
|
|
19878
|
+
// ../../mpcore/packages/simulator/src/project/accountInfo.ts
|
|
19879
|
+
function createDefaultAccountInfo(project) {
|
|
19880
|
+
let appId = "";
|
|
19881
|
+
for (const config of [...project.projectConfigFiles].reverse()) {
|
|
19882
|
+
const value = config.value.appid;
|
|
19883
|
+
if (typeof value === "string" && value.trim()) {
|
|
19884
|
+
appId = value.trim();
|
|
19885
|
+
break;
|
|
19886
|
+
}
|
|
19887
|
+
}
|
|
19888
|
+
return { miniProgram: {
|
|
19889
|
+
appId,
|
|
19890
|
+
envVersion: "develop",
|
|
19891
|
+
version: ""
|
|
19892
|
+
} };
|
|
19893
|
+
}
|
|
19894
|
+
// ../../mpcore/packages/simulator/src/view/nodeSerialization.ts
|
|
19793
19895
|
function escapeText$1(text) {
|
|
19794
19896
|
return text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
19795
19897
|
}
|
|
@@ -19804,16 +19906,14 @@ function collectNodeText$1(node) {
|
|
|
19804
19906
|
if (node.type === "text") return node.data ?? "";
|
|
19805
19907
|
return (node.children ?? []).map(collectNodeText$1).join("");
|
|
19806
19908
|
}
|
|
19807
|
-
|
|
19808
|
-
//#region ../../node_modules/.pnpm/boolbase@2.0.0/node_modules/boolbase/dist/index.js
|
|
19909
|
+
// ../../node_modules/.pnpm/boolbase@2.0.0/node_modules/boolbase/dist/index.js
|
|
19809
19910
|
function trueFunc() {
|
|
19810
19911
|
return true;
|
|
19811
19912
|
}
|
|
19812
19913
|
function falseFunc() {
|
|
19813
19914
|
return false;
|
|
19814
19915
|
}
|
|
19815
|
-
|
|
19816
|
-
//#region ../../node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/types.js
|
|
19916
|
+
// ../../node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/types.js
|
|
19817
19917
|
/** Discriminants for selector token kinds. */
|
|
19818
19918
|
var SelectorType;
|
|
19819
19919
|
(function(SelectorType) {
|
|
@@ -19841,8 +19941,7 @@ var AttributeAction;
|
|
|
19841
19941
|
AttributeAction["Not"] = "not";
|
|
19842
19942
|
AttributeAction["Start"] = "start";
|
|
19843
19943
|
})(AttributeAction || (AttributeAction = {}));
|
|
19844
|
-
|
|
19845
|
-
//#region ../../node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/parse.js
|
|
19944
|
+
// ../../node_modules/.pnpm/css-what@8.0.0/node_modules/css-what/dist/parse.js
|
|
19846
19945
|
const reName = /^[^#\\]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\u00B0-\uFFFF-])+/;
|
|
19847
19946
|
const reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
|
|
19848
19947
|
var CharCode;
|
|
@@ -20210,8 +20309,7 @@ function parseSelector(subselects, selector, selectorIndex) {
|
|
|
20210
20309
|
finalizeSubselector();
|
|
20211
20310
|
return selectorIndex;
|
|
20212
20311
|
}
|
|
20213
|
-
|
|
20214
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/attributes.js
|
|
20312
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/attributes.js
|
|
20215
20313
|
/**
|
|
20216
20314
|
* All reserved characters in a regex, used for escaping.
|
|
20217
20315
|
*
|
|
@@ -20380,8 +20478,7 @@ const attributeRules = {
|
|
|
20380
20478
|
return (element) => adapter.getAttributeValue(element, name) !== value && next(element);
|
|
20381
20479
|
}
|
|
20382
20480
|
};
|
|
20383
|
-
|
|
20384
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/querying.js
|
|
20481
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/querying.js
|
|
20385
20482
|
/**
|
|
20386
20483
|
* Find all elements matching the query. If not in XML mode, the query will ignore
|
|
20387
20484
|
* the contents of `<template>` elements.
|
|
@@ -20470,8 +20567,7 @@ function getElementParent(node, adapter) {
|
|
|
20470
20567
|
const parent = adapter.getParent(node);
|
|
20471
20568
|
return parent != null && adapter.isTag(parent) ? parent : null;
|
|
20472
20569
|
}
|
|
20473
|
-
|
|
20474
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/aliases.js
|
|
20570
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/aliases.js
|
|
20475
20571
|
/**
|
|
20476
20572
|
* Only text controls can be made read-only, since for other controls (such
|
|
20477
20573
|
* as checkboxes and buttons) there is no useful distinction between being
|
|
@@ -20517,8 +20613,7 @@ const aliases = {
|
|
|
20517
20613
|
input: ":is(input, textarea, select, button)",
|
|
20518
20614
|
text: "input:is(:not([type!='']), [type=text])"
|
|
20519
20615
|
};
|
|
20520
|
-
|
|
20521
|
-
//#region ../../node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/compile.js
|
|
20616
|
+
// ../../node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/compile.js
|
|
20522
20617
|
/**
|
|
20523
20618
|
* Returns a function that checks if an elements index matches the given rule
|
|
20524
20619
|
* highly optimized to return the fastest solution.
|
|
@@ -20549,8 +20644,7 @@ function compile(parsed) {
|
|
|
20549
20644
|
const bModulo = (b % absA + absA) % absA;
|
|
20550
20645
|
return a > 1 ? (index) => index >= b && index % absA === bModulo : (index) => index <= b && index % absA === bModulo;
|
|
20551
20646
|
}
|
|
20552
|
-
|
|
20553
|
-
//#region ../../node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/parse.js
|
|
20647
|
+
// ../../node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/parse.js
|
|
20554
20648
|
const whitespace = /* @__PURE__ */ new Set([
|
|
20555
20649
|
9,
|
|
20556
20650
|
10,
|
|
@@ -20611,8 +20705,7 @@ function parse(formula) {
|
|
|
20611
20705
|
while (index < formula.length && whitespace.has(formula.charCodeAt(index))) index++;
|
|
20612
20706
|
}
|
|
20613
20707
|
}
|
|
20614
|
-
|
|
20615
|
-
//#region ../../node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/index.js
|
|
20708
|
+
// ../../node_modules/.pnpm/nth-check@3.0.1/node_modules/nth-check/dist/index.js
|
|
20616
20709
|
/**
|
|
20617
20710
|
* Parses and compiles a formula to a highly optimized function.
|
|
20618
20711
|
* Combination of {@link parse} and {@link compile}.
|
|
@@ -20638,8 +20731,7 @@ function parse(formula) {
|
|
|
20638
20731
|
function nthCheck(formula) {
|
|
20639
20732
|
return compile(parse(formula));
|
|
20640
20733
|
}
|
|
20641
|
-
|
|
20642
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/cache.js
|
|
20734
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/cache.js
|
|
20643
20735
|
/**
|
|
20644
20736
|
* Some selectors such as `:contains` and (non-relative) `:has` will only be
|
|
20645
20737
|
* able to match elements if their parents match the selector (as they contain
|
|
@@ -20674,8 +20766,7 @@ function cacheParentResults(next, { adapter, cacheResults }, matches) {
|
|
|
20674
20766
|
return resultCache.get(node) ? addResultToCache(element) : false;
|
|
20675
20767
|
};
|
|
20676
20768
|
}
|
|
20677
|
-
|
|
20678
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/options.js
|
|
20769
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/options.js
|
|
20679
20770
|
/**
|
|
20680
20771
|
* Create a copy of options, omitting `context` and `rootFunc`.
|
|
20681
20772
|
*
|
|
@@ -20686,8 +20777,7 @@ function copyOptions(options) {
|
|
|
20686
20777
|
const { context: _, rootFunc: __, ...copied } = options;
|
|
20687
20778
|
return copied;
|
|
20688
20779
|
}
|
|
20689
|
-
|
|
20690
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/filters.js
|
|
20780
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/filters.js
|
|
20691
20781
|
/**
|
|
20692
20782
|
* RFC 4647 extended filtering with pre-split subtags.
|
|
20693
20783
|
* @param tag - Lowercased subtags of the element's language value.
|
|
@@ -20800,8 +20890,7 @@ function dynamicStatePseudo(name) {
|
|
|
20800
20890
|
};
|
|
20801
20891
|
};
|
|
20802
20892
|
}
|
|
20803
|
-
|
|
20804
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/pseudos.js
|
|
20893
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/pseudos.js
|
|
20805
20894
|
/**
|
|
20806
20895
|
* CSS limits the characters considered as whitespace to space, tab & line
|
|
20807
20896
|
* feed. We add carriage returns as htmlparser2 doesn't normalize them to
|
|
@@ -20867,8 +20956,7 @@ function verifyPseudoArguments(pseudoClassCondition, name, subselect, argumentIn
|
|
|
20867
20956
|
if (pseudoClassCondition.length > argumentIndex) throw new Error(`Pseudo-class :${name} requires an argument`);
|
|
20868
20957
|
} else if (pseudoClassCondition.length === argumentIndex) throw new Error(`Pseudo-class :${name} doesn't have any arguments`);
|
|
20869
20958
|
}
|
|
20870
|
-
|
|
20871
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/selectors.js
|
|
20959
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/helpers/selectors.js
|
|
20872
20960
|
/**
|
|
20873
20961
|
* Check whether a selector token performs traversal.
|
|
20874
20962
|
* @param token Selector token(s) to compile.
|
|
@@ -20929,8 +21017,7 @@ function getQuality(token) {
|
|
|
20929
21017
|
function includesScopePseudo(t) {
|
|
20930
21018
|
return t.type === SelectorType.Pseudo && (t.name === "scope" || Array.isArray(t.data) && t.data.some((data) => data.some(includesScopePseudo)));
|
|
20931
21019
|
}
|
|
20932
|
-
|
|
20933
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/subselects.js
|
|
21020
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/subselects.js
|
|
20934
21021
|
/** Used as a placeholder for :has. Will be replaced with the actual element. */
|
|
20935
21022
|
const PLACEHOLDER_ELEMENT = {};
|
|
20936
21023
|
/**
|
|
@@ -20982,8 +21069,7 @@ const subselects = {
|
|
|
20982
21069
|
return skipCache ? (element) => next(element) && hasOne(element) : cacheParentResults(next, options, hasOne);
|
|
20983
21070
|
}
|
|
20984
21071
|
};
|
|
20985
|
-
|
|
20986
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/index.js
|
|
21072
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/pseudo-selectors/index.js
|
|
20987
21073
|
/**
|
|
20988
21074
|
* Compile a pseudo selector into an executable query function.
|
|
20989
21075
|
* @param next Matcher to run after this matcher succeeds.
|
|
@@ -21017,8 +21103,7 @@ function compilePseudoSelector(next, selector, options, context, compileToken) {
|
|
|
21017
21103
|
}
|
|
21018
21104
|
throw new Error(`Unknown pseudo-class :${name}`);
|
|
21019
21105
|
}
|
|
21020
|
-
|
|
21021
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/general.js
|
|
21106
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/general.js
|
|
21022
21107
|
/**
|
|
21023
21108
|
* Compile a single selector token.
|
|
21024
21109
|
* @param next Matcher to run after this matcher succeeds.
|
|
@@ -21113,8 +21198,7 @@ function compileGeneralSelector(next, selector, options, context, compileToken,
|
|
|
21113
21198
|
return next;
|
|
21114
21199
|
}
|
|
21115
21200
|
}
|
|
21116
|
-
|
|
21117
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/compile.js
|
|
21201
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/compile.js
|
|
21118
21202
|
const DESCENDANT_TOKEN = { type: SelectorType.Descendant };
|
|
21119
21203
|
const FLEXIBLE_DESCENDANT_TOKEN = { type: "_flexibleDescendant" };
|
|
21120
21204
|
const SCOPE_TOKEN = {
|
|
@@ -21167,8 +21251,7 @@ function compileToken(token, options, compilationContext) {
|
|
|
21167
21251
|
function or(a, b) {
|
|
21168
21252
|
return (element) => a(element) || b(element);
|
|
21169
21253
|
}
|
|
21170
|
-
|
|
21171
|
-
//#region ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/index.js
|
|
21254
|
+
// ../../node_modules/.pnpm/css-select@7.0.0/node_modules/css-select/dist/index.js
|
|
21172
21255
|
const defaultEquals = (a, b) => a === b;
|
|
21173
21256
|
const defaultOptions = {
|
|
21174
21257
|
adapter: {
|
|
@@ -21229,8 +21312,7 @@ function appendNextSiblings(element, adapter) {
|
|
|
21229
21312
|
* @returns All matching elements.
|
|
21230
21313
|
*/
|
|
21231
21314
|
const selectAll = getSelectorFunction((query, elements, options) => query === falseFunc || !elements || elements.length === 0 ? [] : findAll(query, elements, options));
|
|
21232
|
-
|
|
21233
|
-
//#region ../../mpcore/packages/simulator/src/view/selectors.ts
|
|
21315
|
+
// ../../mpcore/packages/simulator/src/view/selectors.ts
|
|
21234
21316
|
function createAdapter(getChildren, getParent) {
|
|
21235
21317
|
const adapter = {
|
|
21236
21318
|
isTag: (node) => node.type === "tag",
|
|
@@ -21293,8 +21375,7 @@ function querySelectorAll(root, selector) {
|
|
|
21293
21375
|
function queryInspectionSelectorAll(root, selector) {
|
|
21294
21376
|
return queryWithAdapter(root, selector, inspectionAdapter);
|
|
21295
21377
|
}
|
|
21296
|
-
|
|
21297
|
-
//#region ../../node_modules/.pnpm/whynot@5.0.0/node_modules/whynot/dist/whynot.umd.cjs
|
|
21378
|
+
// ../../node_modules/.pnpm/whynot@5.0.0/node_modules/whynot/dist/whynot.umd.cjs
|
|
21298
21379
|
var require_whynot_umd = /* @__PURE__ */ __commonJSMin(((exports, module, this$4) => {
|
|
21299
21380
|
(function(t, s) {
|
|
21300
21381
|
"object" == typeof exports && "undefined" != typeof module ? s(exports) : "function" == typeof define && define.amd ? define(["exports"], s) : s((t = "undefined" != typeof globalThis ? globalThis : t || self).whynot = {});
|
|
@@ -21644,8 +21725,7 @@ var require_whynot_umd = /* @__PURE__ */ __commonJSMin(((exports, module, this$4
|
|
|
21644
21725
|
t.Assembler = r, t.VM = p, t.compileVM = b, t.default = v, Object.defineProperty(t, "V", { value: !0 });
|
|
21645
21726
|
}));
|
|
21646
21727
|
}));
|
|
21647
|
-
|
|
21648
|
-
//#region ../../node_modules/.pnpm/xspattern@3.1.0/node_modules/xspattern/dist/xspattern.umd.cjs
|
|
21728
|
+
// ../../node_modules/.pnpm/xspattern@3.1.0/node_modules/xspattern/dist/xspattern.umd.cjs
|
|
21649
21729
|
var require_xspattern_umd = /* @__PURE__ */ __commonJSMin(((exports, module, this$3) => {
|
|
21650
21730
|
(function(A, B) {
|
|
21651
21731
|
"object" == typeof exports && "undefined" != typeof module ? B(exports, require_whynot_umd()) : "function" == typeof define && define.amd ? define(["exports", "whynot"], B) : B((A = "undefined" != typeof globalThis ? globalThis : A || self).xspattern = {}, A.whynot);
|
|
@@ -22944,8 +23024,7 @@ var require_xspattern_umd = /* @__PURE__ */ __commonJSMin(((exports, module, thi
|
|
|
22944
23024
|
}, Object.defineProperty(A, "__esModule", { value: !0 });
|
|
22945
23025
|
}));
|
|
22946
23026
|
}));
|
|
22947
|
-
|
|
22948
|
-
//#region ../../node_modules/.pnpm/prsc@4.0.0/node_modules/prsc/dist/prsc.umd.cjs
|
|
23027
|
+
// ../../node_modules/.pnpm/prsc@4.0.0/node_modules/prsc/dist/prsc.umd.cjs
|
|
22949
23028
|
var require_prsc_umd = /* @__PURE__ */ __commonJSMin(((exports, module, this$2) => {
|
|
22950
23029
|
(function(n, t) {
|
|
22951
23030
|
"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((n = "undefined" != typeof globalThis ? globalThis : n || self).prsc = {});
|
|
@@ -23190,8 +23269,7 @@ var require_prsc_umd = /* @__PURE__ */ __commonJSMin(((exports, module, this$2)
|
|
|
23190
23269
|
}, Object.defineProperty(n, "__esModule", { value: !0 });
|
|
23191
23270
|
}));
|
|
23192
23271
|
}));
|
|
23193
|
-
|
|
23194
|
-
//#region ../../mpcore/packages/simulator/src/view/xpath.ts
|
|
23272
|
+
// ../../mpcore/packages/simulator/src/view/xpath.ts
|
|
23195
23273
|
var import_fontoxpath = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module, this$1) => {
|
|
23196
23274
|
(function(root, factory) {
|
|
23197
23275
|
if (typeof define === "function" && define.amd) define(["xspattern", "prsc"], factory);
|
|
@@ -39100,8 +39178,7 @@ function queryXPathElements(root, expression) {
|
|
|
39100
39178
|
function queryInspectionXPathElements(root, expression) {
|
|
39101
39179
|
return queryElements(root, expression, getInspectionChildren);
|
|
39102
39180
|
}
|
|
39103
|
-
|
|
39104
|
-
//#region ../../mpcore/packages/simulator/src/view/nodeHandle.ts
|
|
39181
|
+
// ../../mpcore/packages/simulator/src/view/nodeHandle.ts
|
|
39105
39182
|
function createValueEventDetail(value, detail) {
|
|
39106
39183
|
return {
|
|
39107
39184
|
value,
|
|
@@ -39262,8 +39339,7 @@ var HeadlessTestingNodeHandle = class HeadlessTestingNodeHandle {
|
|
|
39262
39339
|
return serializeNode(this.node);
|
|
39263
39340
|
}
|
|
39264
39341
|
};
|
|
39265
|
-
|
|
39266
|
-
//#region ../../mpcore/packages/simulator/src/view/render.ts
|
|
39342
|
+
// ../../mpcore/packages/simulator/src/view/render.ts
|
|
39267
39343
|
const LEADING_SLASH_RE$2 = /^\/+/;
|
|
39268
39344
|
const TEMPLATE_INTERPOLATION_RE = /\{\{([^{}]+)\}\}/g;
|
|
39269
39345
|
function resolveRawValueByPath(source, expression) {
|
|
@@ -39346,8 +39422,7 @@ function renderPageTree(project, page) {
|
|
|
39346
39422
|
wxml: serializeDomNode((document.children ?? [])[0] ?? document)
|
|
39347
39423
|
};
|
|
39348
39424
|
}
|
|
39349
|
-
|
|
39350
|
-
//#region ../../mpcore/packages/simulator/src/view/nodeGeometry.ts
|
|
39425
|
+
// ../../mpcore/packages/simulator/src/view/nodeGeometry.ts
|
|
39351
39426
|
const NUMERIC_LIKE_VALUE_RE$1 = /-?\d+(?:\.\d+)?/;
|
|
39352
39427
|
const PIXEL_LENGTH_RE = /^\d+(?:\.\d+)?px$|^0$/;
|
|
39353
39428
|
function parseStyleDeclarations$1(styleValue) {
|
|
@@ -39419,8 +39494,7 @@ function resolveNativeScrollBounds(node) {
|
|
|
39419
39494
|
maxLeft: extent("width")
|
|
39420
39495
|
};
|
|
39421
39496
|
}
|
|
39422
|
-
|
|
39423
|
-
//#region ../../mpcore/packages/simulator/src/view/nativeNode.ts
|
|
39497
|
+
// ../../mpcore/packages/simulator/src/view/nativeNode.ts
|
|
39424
39498
|
const pageScrollViews = /* @__PURE__ */ new WeakMap();
|
|
39425
39499
|
function coordinate(value) {
|
|
39426
39500
|
const number = Number(value);
|
|
@@ -39584,8 +39658,7 @@ function dispatchNativeNodeEvent(page, node, eventName, event, wx, resolveMethod
|
|
|
39584
39658
|
}
|
|
39585
39659
|
return true;
|
|
39586
39660
|
}
|
|
39587
|
-
|
|
39588
|
-
//#region ../../mpcore/packages/simulator/src/view/selectorQuery.ts
|
|
39661
|
+
// ../../mpcore/packages/simulator/src/view/selectorQuery.ts
|
|
39589
39662
|
const LEADING_MARK_PREFIX_RE = /^mark[:\-]?/;
|
|
39590
39663
|
const MARK_NAME_RE = /[:\-]([a-z])/g;
|
|
39591
39664
|
function toMarkKey(attributeName) {
|
|
@@ -39605,10 +39678,11 @@ function createScopedRoot(node) {
|
|
|
39605
39678
|
type: "root"
|
|
39606
39679
|
};
|
|
39607
39680
|
}
|
|
39608
|
-
function findNodeByScopeId(root, scopeId) {
|
|
39681
|
+
function findNodeByScopeId(root, scopeId, includeUnprojected = false) {
|
|
39609
39682
|
if (root.attribs?.["data-sim-scope"] === scopeId) return root;
|
|
39610
|
-
|
|
39611
|
-
|
|
39683
|
+
const children = includeUnprojected ? getInspectionChildren(root) : root.children ?? [];
|
|
39684
|
+
for (const child of children) {
|
|
39685
|
+
const match = findNodeByScopeId(child, scopeId, includeUnprojected);
|
|
39612
39686
|
if (match) return match;
|
|
39613
39687
|
}
|
|
39614
39688
|
return null;
|
|
@@ -39644,7 +39718,14 @@ function resolveFieldsResult(node, fields, options) {
|
|
|
39644
39718
|
if (fields.dataset) result.dataset = collectNodeDataset(node);
|
|
39645
39719
|
if (fields.mark) result.mark = collectMark(node);
|
|
39646
39720
|
if (fields.rect || fields.size) {
|
|
39647
|
-
const rect =
|
|
39721
|
+
const rect = options.unprojected ? {
|
|
39722
|
+
bottom: 0,
|
|
39723
|
+
height: 0,
|
|
39724
|
+
left: 0,
|
|
39725
|
+
right: 0,
|
|
39726
|
+
top: 0,
|
|
39727
|
+
width: 0
|
|
39728
|
+
} : resolveRect$1(node, options.root.name === "page" ? options.windowInfo : void 0);
|
|
39648
39729
|
if (fields.rect) Object.assign(result, rect);
|
|
39649
39730
|
if (fields.size) {
|
|
39650
39731
|
result.width = rect.width;
|
|
@@ -39695,15 +39776,27 @@ function resolveRequestResult(request, options) {
|
|
|
39695
39776
|
return match ? resolveFieldsResult(match, request.fields, options) : null;
|
|
39696
39777
|
}
|
|
39697
39778
|
function executeSelectorQueryRequests(requests, options) {
|
|
39698
|
-
|
|
39779
|
+
let resolved = options;
|
|
39780
|
+
if (options.scopeId) {
|
|
39781
|
+
const projected = findNodeByScopeId(options.root, options.scopeId);
|
|
39782
|
+
const declared = projected ?? findNodeByScopeId(options.root, options.scopeId, true);
|
|
39783
|
+
resolved = {
|
|
39784
|
+
...options,
|
|
39785
|
+
root: declared ? createScopedRoot(declared) : {
|
|
39786
|
+
type: "root",
|
|
39787
|
+
children: []
|
|
39788
|
+
},
|
|
39789
|
+
unprojected: !projected
|
|
39790
|
+
};
|
|
39791
|
+
}
|
|
39792
|
+
return requests.map((request) => resolveRequestResult(request, resolved));
|
|
39699
39793
|
}
|
|
39700
39794
|
function resolveSelectorQueryScopeRoot(root, scopeId) {
|
|
39701
39795
|
if (!scopeId) return root;
|
|
39702
39796
|
const scopedNode = findNodeByScopeId(root, scopeId);
|
|
39703
39797
|
return scopedNode ? createScopedRoot(scopedNode) : root;
|
|
39704
39798
|
}
|
|
39705
|
-
|
|
39706
|
-
//#region ../../mpcore/packages/simulator/src/view/animation.ts
|
|
39799
|
+
// ../../mpcore/packages/simulator/src/view/animation.ts
|
|
39707
39800
|
const DEFAULT_STEP_OPTION = {
|
|
39708
39801
|
delay: 0,
|
|
39709
39802
|
duration: 400,
|
|
@@ -39816,8 +39909,7 @@ function createHeadlessAnimation(defaultOption) {
|
|
|
39816
39909
|
};
|
|
39817
39910
|
return animation;
|
|
39818
39911
|
}
|
|
39819
|
-
|
|
39820
|
-
//#region ../../mpcore/packages/simulator/src/view/canvasContext.ts
|
|
39912
|
+
// ../../mpcore/packages/simulator/src/view/canvasContext.ts
|
|
39821
39913
|
function findCanvasNode(root, canvasId) {
|
|
39822
39914
|
if (root.type === "tag" && root.name === "canvas" && root.attribs?.["canvas-id"] === canvasId) return root;
|
|
39823
39915
|
for (const child of root.children ?? []) {
|
|
@@ -40142,8 +40234,7 @@ function createHeadlessCanvasContext(driver, canvasId, scope) {
|
|
|
40142
40234
|
}
|
|
40143
40235
|
};
|
|
40144
40236
|
}
|
|
40145
|
-
|
|
40146
|
-
//#region ../../mpcore/packages/simulator/src/view/intersectionObserver.ts
|
|
40237
|
+
// ../../mpcore/packages/simulator/src/view/intersectionObserver.ts
|
|
40147
40238
|
const NUMERIC_LIKE_VALUE_RE = /-?\d+(?:\.\d+)?/;
|
|
40148
40239
|
function normalizeMargins(margins) {
|
|
40149
40240
|
return {
|
|
@@ -40268,6 +40359,7 @@ function createHeadlessIntersectionObserver(driver, scope, _options) {
|
|
|
40268
40359
|
const intersectionArea = intersectionRect.width * intersectionRect.height;
|
|
40269
40360
|
callback({
|
|
40270
40361
|
boundingClientRect,
|
|
40362
|
+
dataset: collectNodeDataset(targetNode),
|
|
40271
40363
|
id: targetNode.attribs?.id ?? "",
|
|
40272
40364
|
intersectionRatio: targetArea > 0 ? intersectionArea / targetArea : 0,
|
|
40273
40365
|
intersectionRect,
|
|
@@ -40291,8 +40383,7 @@ function createHeadlessIntersectionObserver(driver, scope, _options) {
|
|
|
40291
40383
|
}
|
|
40292
40384
|
};
|
|
40293
40385
|
}
|
|
40294
|
-
|
|
40295
|
-
//#region ../../mpcore/packages/simulator/src/view/mediaQueryObserver.ts
|
|
40386
|
+
// ../../mpcore/packages/simulator/src/view/mediaQueryObserver.ts
|
|
40296
40387
|
function resolveOrientation(windowInfo) {
|
|
40297
40388
|
return windowInfo.windowWidth >= windowInfo.windowHeight ? "landscape" : "portrait";
|
|
40298
40389
|
}
|
|
@@ -40344,8 +40435,7 @@ function createHeadlessMediaQueryObserver(driver, onDisconnect) {
|
|
|
40344
40435
|
observer
|
|
40345
40436
|
};
|
|
40346
40437
|
}
|
|
40347
|
-
|
|
40348
|
-
//#region ../../mpcore/packages/simulator/src/view/templateRegistration.ts
|
|
40438
|
+
// ../../mpcore/packages/simulator/src/view/templateRegistration.ts
|
|
40349
40439
|
/** 编译模板及递归依赖共用全局注册图,图外原生模板继续实时读取。 */
|
|
40350
40440
|
function createTemplateRegistration(source, projectRoot, compiledTemplatePaths = []) {
|
|
40351
40441
|
const root = normalize(projectRoot);
|
|
@@ -40402,8 +40492,7 @@ function createTemplateRegistration(source, projectRoot, compiledTemplatePaths =
|
|
|
40402
40492
|
reload
|
|
40403
40493
|
};
|
|
40404
40494
|
}
|
|
40405
|
-
|
|
40406
|
-
//#region ../../mpcore/packages/simulator/src/view/videoContext.ts
|
|
40495
|
+
// ../../mpcore/packages/simulator/src/view/videoContext.ts
|
|
40407
40496
|
function createEventPayload(node, eventName, detail) {
|
|
40408
40497
|
const dataset = collectNodeDataset(node);
|
|
40409
40498
|
const nodeId = node.attribs?.id ?? "";
|
|
@@ -40476,8 +40565,7 @@ function createHeadlessVideoContext(driver, videoId, scope) {
|
|
|
40476
40565
|
}
|
|
40477
40566
|
};
|
|
40478
40567
|
}
|
|
40479
|
-
|
|
40480
|
-
//#region ../../mpcore/packages/simulator/src/runtime/appLifecycle.ts
|
|
40568
|
+
// ../../mpcore/packages/simulator/src/runtime/appLifecycle.ts
|
|
40481
40569
|
var HeadlessAppLifecycle = class {
|
|
40482
40570
|
hideCallbacks = [];
|
|
40483
40571
|
showCallbacks = [];
|
|
@@ -40530,8 +40618,7 @@ var HeadlessAppLifecycle = class {
|
|
|
40530
40618
|
if (!isInitialShow) app.onShow?.(options);
|
|
40531
40619
|
}
|
|
40532
40620
|
};
|
|
40533
|
-
|
|
40534
|
-
//#region ../../mpcore/packages/simulator/src/runtime/workerHost.ts
|
|
40621
|
+
// ../../mpcore/packages/simulator/src/runtime/workerHost.ts
|
|
40535
40622
|
/** 两种 simulator 共用消息与生命周期;每个 worker 独立模块缓存、全局对象及计时器。 */
|
|
40536
40623
|
function createWorkerHost(options) {
|
|
40537
40624
|
const active = /* @__PURE__ */ new Set();
|
|
@@ -40660,8 +40747,7 @@ function createWorkerHost(options) {
|
|
|
40660
40747
|
}
|
|
40661
40748
|
};
|
|
40662
40749
|
}
|
|
40663
|
-
|
|
40664
|
-
//#region ../../mpcore/packages/simulator/src/runtime/moduleSyntax/ast.ts
|
|
40750
|
+
// ../../mpcore/packages/simulator/src/runtime/moduleSyntax/ast.ts
|
|
40665
40751
|
function isSyntaxNode(value) {
|
|
40666
40752
|
return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
|
|
40667
40753
|
}
|
|
@@ -40699,8 +40785,7 @@ function applySourceEdits(source, edits) {
|
|
|
40699
40785
|
for (const edit of edits.toSorted((left, right) => right.start - left.start || right.end - left.end)) source = source.slice(0, edit.start) + edit.content + source.slice(edit.end);
|
|
40700
40786
|
return source;
|
|
40701
40787
|
}
|
|
40702
|
-
|
|
40703
|
-
//#region ../../mpcore/packages/simulator/src/runtime/moduleSyntax/bindings.ts
|
|
40788
|
+
// ../../mpcore/packages/simulator/src/runtime/moduleSyntax/bindings.ts
|
|
40704
40789
|
const functionTypes = /* @__PURE__ */ new Set([
|
|
40705
40790
|
"FunctionDeclaration",
|
|
40706
40791
|
"FunctionExpression",
|
|
@@ -40816,8 +40901,7 @@ function rewriteImportReferences(root, imports, bindingName) {
|
|
|
40816
40901
|
rewrite(root);
|
|
40817
40902
|
return edits;
|
|
40818
40903
|
}
|
|
40819
|
-
|
|
40820
|
-
//#region ../../mpcore/packages/simulator/src/runtime/moduleSyntax/index.ts
|
|
40904
|
+
// ../../mpcore/packages/simulator/src/runtime/moduleSyntax/index.ts
|
|
40821
40905
|
function position(node, edge) {
|
|
40822
40906
|
const value = node[edge];
|
|
40823
40907
|
if (typeof value !== "number") throw new SyntaxError("Missing source range in mini-program module syntax.");
|
|
@@ -40976,8 +41060,7 @@ function transformMiniProgramModule(source) {
|
|
|
40976
41060
|
}
|
|
40977
41061
|
return `(function(${moduleName}, ${requireName}, ${objectName}) {\n"use strict";\n${declarations.join("\n")}\n${applySourceEdits(source, edits)}\n${objectName}.preventExtensions(${moduleName}.exports);\n}).call(undefined, module, require, Object);`;
|
|
40978
41062
|
}
|
|
40979
|
-
|
|
40980
|
-
//#region ../../mpcore/packages/simulator/src/runtime/pageDefinitionReload.ts
|
|
41063
|
+
// ../../mpcore/packages/simulator/src/runtime/pageDefinitionReload.ts
|
|
40981
41064
|
/** 定义更新只解析已有路由,不触发普通导航的启动或 page-not-found 生命周期。 */
|
|
40982
41065
|
function resolvePageDefinitionReloadRoute(project, route) {
|
|
40983
41066
|
if (typeof route !== "string" || !route.trim() || /[?#]/.test(route)) throw new TypeError("Page definition reload requires a route path without query or hash.");
|
|
@@ -41014,8 +41097,7 @@ function reloadPageModuleDefinition(options) {
|
|
|
41014
41097
|
throw error;
|
|
41015
41098
|
}
|
|
41016
41099
|
}
|
|
41017
|
-
|
|
41018
|
-
//#region ../../mpcore/packages/simulator/src/runtime/runtimeGlobals.ts
|
|
41100
|
+
// ../../mpcore/packages/simulator/src/runtime/runtimeGlobals.ts
|
|
41019
41101
|
const MINI_PROGRAM_UNAVAILABLE_GLOBAL_NAMES = [
|
|
41020
41102
|
"window",
|
|
41021
41103
|
"document",
|
|
@@ -41056,8 +41138,7 @@ function createMiniProgramRuntimeGlobals(availableGlobals, overrides) {
|
|
|
41056
41138
|
for (const name of MINI_PROGRAM_UNAVAILABLE_GLOBAL_NAMES) globals[name] = void 0;
|
|
41057
41139
|
return Object.assign(globals, availableGlobals, overrides);
|
|
41058
41140
|
}
|
|
41059
|
-
|
|
41060
|
-
//#region ../../mpcore/packages/simulator/src/runtime/moduleLoader.ts
|
|
41141
|
+
// ../../mpcore/packages/simulator/src/runtime/moduleLoader.ts
|
|
41061
41142
|
function createRequireNotFoundError(request, importer) {
|
|
41062
41143
|
return /* @__PURE__ */ new Error(`Cannot resolve require("${request}") from ${normalize(importer)} in headless runtime.`);
|
|
41063
41144
|
}
|
|
@@ -41211,8 +41292,7 @@ function createModuleLoader(registries, getCurrentPages, getApp, wxDriver, optio
|
|
|
41211
41292
|
};
|
|
41212
41293
|
return loader;
|
|
41213
41294
|
}
|
|
41214
|
-
|
|
41215
|
-
//#region ../../mpcore/packages/simulator/src/runtime/packageAsset.ts
|
|
41295
|
+
// ../../mpcore/packages/simulator/src/runtime/packageAsset.ts
|
|
41216
41296
|
const assetExtension = /\.(?:png|jpe?g|gif|svg|cer|mp3|aac|m4a|mp4|wav|ogg|silk|wasm|br|cur|ico|skel|crt|cert|gltf|glb|bin|ktx|hdr|exr|xnet|pem)$/i;
|
|
41217
41297
|
/** 包内静态资源只读且每次访问宿主当前产物,不缓存为用户文件,也不允许越过包根目录。 */
|
|
41218
41298
|
function createPackageAssetReader(read) {
|
|
@@ -41223,8 +41303,7 @@ function createPackageAssetReader(read) {
|
|
|
41223
41303
|
return read(relative);
|
|
41224
41304
|
};
|
|
41225
41305
|
}
|
|
41226
|
-
|
|
41227
|
-
//#region ../../mpcore/packages/simulator/src/runtime/routeEvents.ts
|
|
41306
|
+
// ../../mpcore/packages/simulator/src/runtime/routeEvents.ts
|
|
41228
41307
|
/** 两种模拟器共用路由身份与监听状态,完成事件由页面就绪和宿主提交驱动。 */
|
|
41229
41308
|
var HeadlessRouteEvents = class {
|
|
41230
41309
|
requestRender;
|
|
@@ -41355,8 +41434,7 @@ var HeadlessRouteEvents = class {
|
|
|
41355
41434
|
this.bus.$off();
|
|
41356
41435
|
}
|
|
41357
41436
|
};
|
|
41358
|
-
|
|
41359
|
-
//#region ../../mpcore/packages/simulator/src/runtime/systemInfo.ts
|
|
41437
|
+
// ../../mpcore/packages/simulator/src/runtime/systemInfo.ts
|
|
41360
41438
|
function createDefaultLocationResult() {
|
|
41361
41439
|
return {
|
|
41362
41440
|
accuracy: 10,
|
|
@@ -41476,8 +41554,63 @@ function deriveMenuButtonBoundingClientRect(systemInfo) {
|
|
|
41476
41554
|
width
|
|
41477
41555
|
};
|
|
41478
41556
|
}
|
|
41479
|
-
|
|
41480
|
-
|
|
41557
|
+
// ../../mpcore/packages/simulator/src/runtime/accountState.ts
|
|
41558
|
+
function cloneAccountInfo(info) {
|
|
41559
|
+
return { miniProgram: { ...info.miniProgram } };
|
|
41560
|
+
}
|
|
41561
|
+
function createHeadlessAccountState(scheduler, options) {
|
|
41562
|
+
let accountInfo = cloneAccountInfo(options.accountInfo ?? { miniProgram: {
|
|
41563
|
+
appId: "",
|
|
41564
|
+
envVersion: "develop",
|
|
41565
|
+
version: ""
|
|
41566
|
+
} });
|
|
41567
|
+
let closed = false;
|
|
41568
|
+
let loginSequence = 0;
|
|
41569
|
+
const mocks = [];
|
|
41570
|
+
const timers = /* @__PURE__ */ new Set();
|
|
41571
|
+
return {
|
|
41572
|
+
close() {
|
|
41573
|
+
closed = true;
|
|
41574
|
+
for (const timer of timers) scheduler.clearTimeout(timer);
|
|
41575
|
+
timers.clear();
|
|
41576
|
+
mocks.length = 0;
|
|
41577
|
+
},
|
|
41578
|
+
getAccountInfoSync() {
|
|
41579
|
+
return cloneAccountInfo(accountInfo);
|
|
41580
|
+
},
|
|
41581
|
+
setAccountInfo(info) {
|
|
41582
|
+
accountInfo = cloneAccountInfo(info);
|
|
41583
|
+
},
|
|
41584
|
+
mockLogin(definition = {}) {
|
|
41585
|
+
mocks.push({ ...definition });
|
|
41586
|
+
},
|
|
41587
|
+
login(option = {}) {
|
|
41588
|
+
if (closed) return;
|
|
41589
|
+
const mock = mocks.shift();
|
|
41590
|
+
const { complete, fail, success, timeout } = option;
|
|
41591
|
+
const requestedDelay = mock?.delay;
|
|
41592
|
+
const delay = typeof requestedDelay === "number" && Number.isFinite(requestedDelay) ? Math.max(0, requestedDelay) : 0;
|
|
41593
|
+
const timedOut = typeof timeout === "number" && Number.isFinite(timeout) && timeout > 0 && timeout < delay;
|
|
41594
|
+
const error = timedOut ? "login:fail timeout" : !mock && options.strictMocks ? "login:fail no mock matched in headless runtime" : mock?.error ? `login:fail ${mock.error}` : void 0;
|
|
41595
|
+
const result = error ? { errMsg: error } : {
|
|
41596
|
+
code: mock?.code ?? `mpcore-login-${++loginSequence}`,
|
|
41597
|
+
errMsg: "login:ok"
|
|
41598
|
+
};
|
|
41599
|
+
const timer = scheduler.setTimeout(() => {
|
|
41600
|
+
timers.delete(timer);
|
|
41601
|
+
if (closed) return;
|
|
41602
|
+
try {
|
|
41603
|
+
if ("code" in result) success?.(result);
|
|
41604
|
+
else fail?.(result);
|
|
41605
|
+
} finally {
|
|
41606
|
+
if (!closed) complete?.(result);
|
|
41607
|
+
}
|
|
41608
|
+
}, timedOut ? timeout : delay);
|
|
41609
|
+
timers.add(timer);
|
|
41610
|
+
}
|
|
41611
|
+
};
|
|
41612
|
+
}
|
|
41613
|
+
// ../../mpcore/packages/simulator/src/runtime/request/task.ts
|
|
41481
41614
|
/** mock 与显式网络桥接共用终止状态;终止后不再分发 headers/chunk。 */
|
|
41482
41615
|
function createRequestTask(option, onAbort = () => {}) {
|
|
41483
41616
|
const headers = /* @__PURE__ */ new Set();
|
|
@@ -41540,8 +41673,7 @@ function createRequestTask(option, onAbort = () => {}) {
|
|
|
41540
41673
|
}
|
|
41541
41674
|
};
|
|
41542
41675
|
}
|
|
41543
|
-
|
|
41544
|
-
//#region ../../mpcore/packages/simulator/src/runtime/request/mock.ts
|
|
41676
|
+
// ../../mpcore/packages/simulator/src/runtime/request/mock.ts
|
|
41545
41677
|
/** 仅模拟已声明的分块;不进行网络访问,也不把完整 response 拆成假分块。 */
|
|
41546
41678
|
function createChunkedMockRequest(option, mock, response, scheduler, onSuccess) {
|
|
41547
41679
|
let timer;
|
|
@@ -41574,14 +41706,13 @@ function createChunkedMockRequest(option, mock, response, scheduler, onSuccess)
|
|
|
41574
41706
|
request.headers({
|
|
41575
41707
|
cookies: response.cookies,
|
|
41576
41708
|
header: response.header,
|
|
41577
|
-
statusCode: response.statusCode
|
|
41709
|
+
...mock.headersStatusCode === null ? {} : { statusCode: mock.headersStatusCode ?? response.statusCode }
|
|
41578
41710
|
});
|
|
41579
41711
|
next();
|
|
41580
41712
|
}, Math.max(0, mock.delay ?? 0));
|
|
41581
41713
|
return request.task;
|
|
41582
41714
|
}
|
|
41583
|
-
|
|
41584
|
-
//#region ../../mpcore/packages/simulator/src/runtime/wxState.ts
|
|
41715
|
+
// ../../mpcore/packages/simulator/src/runtime/wxState.ts
|
|
41585
41716
|
const STORAGE_LIMIT_SIZE = 10240;
|
|
41586
41717
|
const DEFAULT_MODAL_CANCEL_COLOR = "#000000";
|
|
41587
41718
|
const DEFAULT_MODAL_CANCEL_TEXT = "取消";
|
|
@@ -42068,6 +42199,7 @@ const nativeScheduler = {
|
|
|
42068
42199
|
setTimeout
|
|
42069
42200
|
};
|
|
42070
42201
|
function createHeadlessWxState(scheduler = nativeScheduler, options = {}) {
|
|
42202
|
+
const accountState = createHeadlessAccountState(scheduler, options);
|
|
42071
42203
|
const actionSheetLogs = [];
|
|
42072
42204
|
const actionSheetMocks = [];
|
|
42073
42205
|
const downloadFileLogs = [];
|
|
@@ -42475,7 +42607,12 @@ function createHeadlessWxState(scheduler = nativeScheduler, options = {}) {
|
|
|
42475
42607
|
}
|
|
42476
42608
|
};
|
|
42477
42609
|
return {
|
|
42610
|
+
getAccountInfoSync: accountState.getAccountInfoSync,
|
|
42611
|
+
login: accountState.login,
|
|
42612
|
+
mockLogin: accountState.mockLogin,
|
|
42613
|
+
setAccountInfo: accountState.setAccountInfo,
|
|
42478
42614
|
close() {
|
|
42615
|
+
accountState.close();
|
|
42479
42616
|
networkStatusChangeCallbacks.clear();
|
|
42480
42617
|
},
|
|
42481
42618
|
clearStorageSync() {
|
|
@@ -43126,8 +43263,7 @@ function createHeadlessWxState(scheduler = nativeScheduler, options = {}) {
|
|
|
43126
43263
|
}
|
|
43127
43264
|
};
|
|
43128
43265
|
}
|
|
43129
|
-
|
|
43130
|
-
//#region ../../mpcore/packages/simulator/src/runtime/session.ts
|
|
43266
|
+
// ../../mpcore/packages/simulator/src/runtime/session.ts
|
|
43131
43267
|
const LEADING_SLASH_RE$1 = /^\/+/;
|
|
43132
43268
|
const PAGE_STACK_LIMIT = 10;
|
|
43133
43269
|
const WHITESPACE_RE = /\s+/;
|
|
@@ -43234,6 +43370,7 @@ var HeadlessSession = class {
|
|
|
43234
43370
|
this.project = options.project ?? loadProject(options.projectPath);
|
|
43235
43371
|
this.templateRegistration = createTemplateRegistration(this.project.artifactSource, this.project.miniprogramRootPath, options.compiledTemplatePaths);
|
|
43236
43372
|
this.wxState = createHeadlessWxState(this.kernel.scheduler, {
|
|
43373
|
+
accountInfo: createDefaultAccountInfo(this.project),
|
|
43237
43374
|
strictMocks: options.strictHostMocks,
|
|
43238
43375
|
readPackageFile: createPackageAssetReader((relative) => this.project.artifactSource.readText(path.join(this.project.miniprogramRootPath, relative)))
|
|
43239
43376
|
});
|
|
@@ -43279,12 +43416,14 @@ var HeadlessSession = class {
|
|
|
43279
43416
|
getSavedFileList: () => this.wxState.getSavedFileList(),
|
|
43280
43417
|
getEnterOptionsSync: () => this.getEnterOptions(),
|
|
43281
43418
|
getAppBaseInfoSync: () => deriveAppBaseInfo(this.systemInfo),
|
|
43419
|
+
getAccountInfoSync: () => this.wxState.getAccountInfoSync(),
|
|
43282
43420
|
getDeviceInfo: () => deriveDeviceInfo(this.systemInfo),
|
|
43283
43421
|
getLaunchOptionsSync: () => this.getLaunchOptions(),
|
|
43284
43422
|
getClipboardData: () => this.wxState.getClipboardData(),
|
|
43285
43423
|
getLocation: () => createDefaultLocationResult(),
|
|
43286
43424
|
getMenuButtonBoundingClientRect: () => deriveMenuButtonBoundingClientRect(this.systemInfo),
|
|
43287
43425
|
getNetworkType: () => this.wxState.getNetworkType(),
|
|
43426
|
+
login: (option) => this.wxState.login(option),
|
|
43288
43427
|
navigateBack: (option) => this.navigateBack(option?.delta),
|
|
43289
43428
|
navigateTo: (option) => this.routeEvents.navigateTo(() => this.navigateTo(option.url), option),
|
|
43290
43429
|
pageScrollTo: (option) => this.pageScrollTo(option),
|
|
@@ -43704,6 +43843,12 @@ var HeadlessSession = class {
|
|
|
43704
43843
|
mockModal(definition = {}) {
|
|
43705
43844
|
this.wxState.mockModal(definition);
|
|
43706
43845
|
}
|
|
43846
|
+
mockLogin(definition = {}) {
|
|
43847
|
+
this.wxState.mockLogin(definition);
|
|
43848
|
+
}
|
|
43849
|
+
setAccountInfo(info) {
|
|
43850
|
+
this.wxState.setAccountInfo(info);
|
|
43851
|
+
}
|
|
43707
43852
|
mockActionSheet(definition = {}) {
|
|
43708
43853
|
this.wxState.mockActionSheet(definition);
|
|
43709
43854
|
}
|
|
@@ -44050,10 +44195,10 @@ var HeadlessSession = class {
|
|
|
44050
44195
|
const canvasId = node.attribs?.["canvas-id"];
|
|
44051
44196
|
return typeof canvasId === "string" && canvasId ? this.createCanvasContext(canvasId, staleScope.nativeScope) : { type: "unsupported-context" };
|
|
44052
44197
|
},
|
|
44053
|
-
root:
|
|
44198
|
+
root: staleScope.snapshot.root,
|
|
44199
|
+
scopeId: staleScope.snapshot.scopeId,
|
|
44054
44200
|
windowInfo: this.getWindowInfo()
|
|
44055
44201
|
});
|
|
44056
|
-
const rendered = this.renderCurrentPage();
|
|
44057
44202
|
const scopeId = nativeScope && nativeScope !== current ? this.getComponentScopeId(nativeScope) : null;
|
|
44058
44203
|
return executeSelectorQueryRequests(requests, {
|
|
44059
44204
|
page: current,
|
|
@@ -44062,7 +44207,8 @@ var HeadlessSession = class {
|
|
|
44062
44207
|
const canvasId = node.attribs?.["canvas-id"];
|
|
44063
44208
|
return typeof canvasId === "string" && canvasId ? this.createCanvasContext(canvasId, nativeScope ?? void 0) : { type: "unsupported-context" };
|
|
44064
44209
|
},
|
|
44065
|
-
root:
|
|
44210
|
+
root: this.renderCurrentPage().root,
|
|
44211
|
+
scopeId,
|
|
44066
44212
|
windowInfo: this.getWindowInfo()
|
|
44067
44213
|
});
|
|
44068
44214
|
}
|
|
@@ -44330,8 +44476,7 @@ var HeadlessSession = class {
|
|
|
44330
44476
|
function createHeadlessSession(options) {
|
|
44331
44477
|
return new HeadlessSession(options);
|
|
44332
44478
|
}
|
|
44333
|
-
|
|
44334
|
-
//#region ../../mpcore/packages/simulator/src/testing/logicalSnapshot.ts
|
|
44479
|
+
// ../../mpcore/packages/simulator/src/testing/logicalSnapshot.ts
|
|
44335
44480
|
function collectNodeText(node) {
|
|
44336
44481
|
if (node.type === "text") return node.data ?? "";
|
|
44337
44482
|
return (node.children ?? []).map(collectNodeText).join("");
|
|
@@ -44352,16 +44497,14 @@ function createLogicalNode(node) {
|
|
|
44352
44497
|
type: "element"
|
|
44353
44498
|
};
|
|
44354
44499
|
}
|
|
44355
|
-
|
|
44356
|
-
//#region ../../mpcore/packages/simulator/src/testing/pageMethodTarget.ts
|
|
44500
|
+
// ../../mpcore/packages/simulator/src/testing/pageMethodTarget.ts
|
|
44357
44501
|
/** 对齐 Page 协议的栈顶约束;AppService 模式仅访问 handle 对应且仍存活的页面。 */
|
|
44358
44502
|
function resolveTestingPageMethodTarget(page, pages, options) {
|
|
44359
44503
|
if (!pages) return page;
|
|
44360
44504
|
if (!options.routeOnly && options.fallback === false && pages.at(-1) !== page) throw new Error("page is not on top of page stack");
|
|
44361
44505
|
return pages.includes(page) ? page : void 0;
|
|
44362
44506
|
}
|
|
44363
|
-
|
|
44364
|
-
//#region ../../mpcore/packages/simulator/src/testing/pageNodeAccess.ts
|
|
44507
|
+
// ../../mpcore/packages/simulator/src/testing/pageNodeAccess.ts
|
|
44365
44508
|
function createPageRootNodeHandle(options) {
|
|
44366
44509
|
const { page, project, session } = options;
|
|
44367
44510
|
const tree = session?.getCurrentPages().includes(page) ? session.renderCurrentPage() : renderPageTree(project, page);
|
|
@@ -44388,15 +44531,13 @@ function createPageRootNodeHandle(options) {
|
|
|
44388
44531
|
}
|
|
44389
44532
|
});
|
|
44390
44533
|
}
|
|
44391
|
-
|
|
44392
|
-
//#region ../../mpcore/packages/simulator/src/testing/pagePath.ts
|
|
44534
|
+
// ../../mpcore/packages/simulator/src/testing/pagePath.ts
|
|
44393
44535
|
const PRIVATE_PLUGIN_ROUTE_RE = /^plugin-private:\/\/([^/]+)\/(.+)$/;
|
|
44394
44536
|
/** 将内部插件路由映射为 DevTools 页面协议路径,保留 AppService 实例路由。 */
|
|
44395
44537
|
function resolveTestingPagePath(route) {
|
|
44396
44538
|
return route.replace(PRIVATE_PLUGIN_ROUTE_RE, "__plugin__/$1/$2");
|
|
44397
44539
|
}
|
|
44398
|
-
|
|
44399
|
-
//#region ../../mpcore/packages/simulator/src/testing/pageWait.ts
|
|
44540
|
+
// ../../mpcore/packages/simulator/src/testing/pageWait.ts
|
|
44400
44541
|
const DEFAULT_WAIT_TIMEOUT$1 = 1e3;
|
|
44401
44542
|
const DEFAULT_WAIT_INTERVAL$1 = 10;
|
|
44402
44543
|
function normalizeInput(value, label) {
|
|
@@ -44452,8 +44593,7 @@ async function waitForPageData(access, path, matcher, hasMatcher, options = {})
|
|
|
44452
44593
|
return value === void 0 ? null : value;
|
|
44453
44594
|
}, `Timed out waiting for data "${normalizedPath}" in headless testing runtime.`, options);
|
|
44454
44595
|
}
|
|
44455
|
-
|
|
44456
|
-
//#region ../../mpcore/packages/simulator/src/testing/rendered.ts
|
|
44596
|
+
// ../../mpcore/packages/simulator/src/testing/rendered.ts
|
|
44457
44597
|
const DEFAULT_RENDERED_WAIT_TIMEOUT = 15e3;
|
|
44458
44598
|
const DEFAULT_RENDERED_WAIT_INTERVAL = 10;
|
|
44459
44599
|
function normalizeSelector(selector) {
|
|
@@ -44522,8 +44662,7 @@ async function waitForRenderedPage(access, options = {}) {
|
|
|
44522
44662
|
return null;
|
|
44523
44663
|
}, options.text ? `Timed out waiting page rendered: text=${options.text}` : options.predicate ? "Timed out waiting page rendered: predicate=true" : "Timed out waiting page rendered: non-empty wxml", options);
|
|
44524
44664
|
}
|
|
44525
|
-
|
|
44526
|
-
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/shared.ts
|
|
44665
|
+
// ../../mpcore/packages/simulator/src/testing/sessionHandle/shared.ts
|
|
44527
44666
|
const LEADING_SLASH_RE = /^\/+/;
|
|
44528
44667
|
const DEFAULT_WAIT_TIMEOUT = 1e3;
|
|
44529
44668
|
const DEFAULT_WAIT_INTERVAL = 10;
|
|
@@ -44569,8 +44708,7 @@ async function runWithTimeout(operation, timeout, message) {
|
|
|
44569
44708
|
if (timer) clearTimeout(timer);
|
|
44570
44709
|
}
|
|
44571
44710
|
}
|
|
44572
|
-
|
|
44573
|
-
//#region ../../mpcore/packages/simulator/src/testing/pageHandle.ts
|
|
44711
|
+
// ../../mpcore/packages/simulator/src/testing/pageHandle.ts
|
|
44574
44712
|
var HeadlessTestingPageHandle = class {
|
|
44575
44713
|
project;
|
|
44576
44714
|
page;
|
|
@@ -44757,8 +44895,7 @@ var HeadlessTestingPageHandle = class {
|
|
|
44757
44895
|
};
|
|
44758
44896
|
}
|
|
44759
44897
|
};
|
|
44760
|
-
|
|
44761
|
-
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/protocol.ts
|
|
44898
|
+
// ../../mpcore/packages/simulator/src/testing/sessionHandle/protocol.ts
|
|
44762
44899
|
/** 无头协议只公布已有运行时语义;不把宿主缺失能力伪装为调试器结果。 */
|
|
44763
44900
|
var HeadlessTestingProtocolUnsupportedError = class extends Error {
|
|
44764
44901
|
method;
|
|
@@ -44812,8 +44949,7 @@ async function sendHeadlessTestingProtocol(target, method, params, options) {
|
|
|
44812
44949
|
target.off("close", onClose);
|
|
44813
44950
|
}
|
|
44814
44951
|
}
|
|
44815
|
-
|
|
44816
|
-
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/cdp.ts
|
|
44952
|
+
// ../../mpcore/packages/simulator/src/testing/sessionHandle/cdp.ts
|
|
44817
44953
|
/** 保留官方调用形状;当前后端的 enable 会明确报告不支持。 */
|
|
44818
44954
|
function createHeadlessTestingCDP(target, assertActive) {
|
|
44819
44955
|
let enabling;
|
|
@@ -44844,8 +44980,7 @@ function createHeadlessTestingCDP(target, assertActive) {
|
|
|
44844
44980
|
}
|
|
44845
44981
|
};
|
|
44846
44982
|
}
|
|
44847
|
-
|
|
44848
|
-
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/navigation.ts
|
|
44983
|
+
// ../../mpcore/packages/simulator/src/testing/sessionHandle/navigation.ts
|
|
44849
44984
|
/** 所有测试句柄通过同一个 wx 导航边界等待成功、失败或关闭通知。 */
|
|
44850
44985
|
var HeadlessTestingNavigation = class {
|
|
44851
44986
|
session;
|
|
@@ -44884,8 +45019,7 @@ var HeadlessTestingNavigation = class {
|
|
|
44884
45019
|
});
|
|
44885
45020
|
}
|
|
44886
45021
|
};
|
|
44887
|
-
|
|
44888
|
-
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/scope.ts
|
|
45022
|
+
// ../../mpcore/packages/simulator/src/testing/sessionHandle/scope.ts
|
|
44889
45023
|
var HeadlessTestingScopeHandle = class HeadlessTestingScopeHandle {
|
|
44890
45024
|
scopeId;
|
|
44891
45025
|
project;
|
|
@@ -44941,8 +45075,7 @@ var HeadlessTestingScopeHandle = class HeadlessTestingScopeHandle {
|
|
|
44941
45075
|
}, `Timed out waiting for ${normalizedCount} component(s) matching "${normalizedSelector}" in headless testing runtime.`, options);
|
|
44942
45076
|
}
|
|
44943
45077
|
};
|
|
44944
|
-
|
|
44945
|
-
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/index.ts
|
|
45078
|
+
// ../../mpcore/packages/simulator/src/testing/sessionHandle/index.ts
|
|
44946
45079
|
var HeadlessTestingSessionHandle = class {
|
|
44947
45080
|
project;
|
|
44948
45081
|
session;
|
|
@@ -45120,8 +45253,7 @@ var HeadlessTestingSessionHandle = class {
|
|
|
45120
45253
|
return await this.session.evaluateRuntime(source, args);
|
|
45121
45254
|
}
|
|
45122
45255
|
};
|
|
45123
|
-
|
|
45124
|
-
//#region ../../mpcore/packages/simulator/src/testing/launch.ts
|
|
45256
|
+
// ../../mpcore/packages/simulator/src/testing/launch.ts
|
|
45125
45257
|
function resolveInitialRoute(session) {
|
|
45126
45258
|
const entryPagePath = typeof session.project.appConfig.entryPagePath === "string" ? session.project.appConfig.entryPagePath.trim().replace(/^\/+/, "") : "";
|
|
45127
45259
|
if (entryPagePath && session.project.routes.some((route) => route.route === entryPagePath)) return entryPagePath;
|
|
@@ -45145,5 +45277,4 @@ async function launch(options) {
|
|
|
45145
45277
|
throw error;
|
|
45146
45278
|
}
|
|
45147
45279
|
}
|
|
45148
|
-
//#endregion
|
|
45149
45280
|
export { launch };
|