@dongmingzhixiu/vuexir-compiler 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/transform/vue2ir.js +3 -10
- package/package.json +1 -1
package/dist/transform/vue2ir.js
CHANGED
|
@@ -1022,16 +1022,9 @@ export function vueToIr(source, opts = {}) {
|
|
|
1022
1022
|
if (stateInfo.states.some((st) => st.name === name))
|
|
1023
1023
|
continue;
|
|
1024
1024
|
const jsExpr = rawExpr.replace(/\b([A-Za-z_$][\w$]*)\.value\b/g, (all, id) => stateNames.includes(id) ? `stateStore.${id}` : all);
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
const stripped = jsExpr.replace(/'[^']*'|"[^"]*"|`[^`]*`/g, '""');
|
|
1029
|
-
const unknown2 = [...stripped.matchAll(/(?<![.\w$])([A-Za-z_$][\w$]*)/g)]
|
|
1030
|
-
.map((m2) => m2[1])
|
|
1031
|
-
.filter((id) => !SAFE.has(id) && !stateNames.includes(id));
|
|
1032
|
-
if (unknown.length === 0 || unknown2.length === 0) {
|
|
1033
|
-
stateInfo.states.push({ name, init: '', computed: jsExpr });
|
|
1034
|
-
}
|
|
1025
|
+
// R97:不再要求「标识符全部已知」——外部函数由 utils bundle(esbuild)提供,
|
|
1026
|
+
// 运行时找不到时由 try/catch 兜住(保持 init 空串),不静默也不阻断编译
|
|
1027
|
+
stateInfo.states.push({ name, init: '', computed: jsExpr });
|
|
1035
1028
|
}
|
|
1036
1029
|
}
|
|
1037
1030
|
// R89 常量折叠:模块级纯常量(含可静态求值的模板字面量)注入为状态
|