@weapp-vite/ast 6.16.8 → 6.16.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, parse, traverse } from "../babel.mjs";
|
|
2
2
|
import { t as parseJsLikeWithEngine } from "../engine-DHqNPCDA.mjs";
|
|
3
|
-
import { WEVU_GENERIC_SLOT_SCOPE_ATTR, WEVU_NATIVE_SLOT_SCOPE_DATA_KEY, WEVU_SLOT_SCOPE_KEY } from "@weapp-core/constants";
|
|
4
3
|
import { getMiniProgramDirectivePrefix, getSupportedMiniProgramPlatforms } from "@weapp-core/shared";
|
|
5
4
|
//#region src/operations/setDataPick.ts
|
|
6
5
|
const TEMPLATE_MUSTACHE_RE = /\{\{([\s\S]*?)\}\}/g;
|
|
@@ -9,7 +8,6 @@ const FOR_DIRECTIVE_SEPARATOR_PATTERN = "[:-]";
|
|
|
9
8
|
const FOR_TAG_RE = new RegExp(`<[^>]*\\b(?:${FOR_DIRECTIVE_PREFIX_PATTERN})${FOR_DIRECTIVE_SEPARATOR_PATTERN}for\\s*=\\s*(?:\"[^\"]*\"|'[^']*')[^>]*>`, "g");
|
|
10
9
|
const FOR_ITEM_RE = new RegExp(`\\b(?:${FOR_DIRECTIVE_PREFIX_PATTERN})${FOR_DIRECTIVE_SEPARATOR_PATTERN}for-item\\s*=\\s*(?:\"([^\"]+)\"|'([^']+)')`);
|
|
11
10
|
const FOR_INDEX_RE = new RegExp(`\\b(?:${FOR_DIRECTIVE_PREFIX_PATTERN})${FOR_DIRECTIVE_SEPARATOR_PATTERN}for-index\\s*=\\s*(?:\"([^\"]+)\"|'([^']+)')`);
|
|
12
|
-
const WEVU_SLOT_SCOPE_ATTR_RE = new RegExp(`\\b(?:${WEVU_SLOT_SCOPE_KEY}|${WEVU_GENERIC_SLOT_SCOPE_ATTR})\\s*=`);
|
|
13
11
|
const JS_GLOBAL_IDENTIFIERS = new Set([
|
|
14
12
|
"undefined",
|
|
15
13
|
"NaN",
|
|
@@ -284,12 +282,7 @@ function collectSetDataPickKeysFromTemplateCode(template, options) {
|
|
|
284
282
|
if (!template.includes("{{")) return [];
|
|
285
283
|
const engine = options?.astEngine ?? "babel";
|
|
286
284
|
try {
|
|
287
|
-
|
|
288
|
-
if (WEVU_SLOT_SCOPE_ATTR_RE.test(template) && !keys.includes(WEVU_NATIVE_SLOT_SCOPE_DATA_KEY)) {
|
|
289
|
-
keys.push(WEVU_NATIVE_SLOT_SCOPE_DATA_KEY);
|
|
290
|
-
keys.sort((a, b) => a.localeCompare(b));
|
|
291
|
-
}
|
|
292
|
-
return keys;
|
|
285
|
+
return engine === "oxc" ? collectSetDataPickKeysWithOxc(template) : collectSetDataPickKeysWithBabel(template);
|
|
293
286
|
} catch {
|
|
294
287
|
return [];
|
|
295
288
|
}
|