@dimina-kit/compiler 0.0.1-dev.20260706064107 → 0.0.1-dev.20260706125036
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/README.md +5 -3
- package/dist/compile-core.browser.js +34 -105
- package/dist/compile-core.node-chunks/{chunk-QJ34C5KK.js → chunk-5ND5V2SC.js} +2 -77
- package/dist/compile-core.node-chunks/{chunk-LUD2P6RM.js → chunk-CCZB2BJG.js} +1 -5
- package/dist/compile-core.node-chunks/{logic-compiler-2SQFOFEO.js → logic-compiler-RX63Y2FZ.js} +2 -2
- package/dist/compile-core.node-chunks/{style-compiler-ZEJ3XLTS.js → style-compiler-JUY5MZSO.js} +3 -3
- package/dist/compile-core.node-chunks/{view-compiler-WQNV7H5G.js → view-compiler-KA2OZG44.js} +23 -25
- package/dist/compile-core.node.js +5 -8
- package/dist/pool.node-chunks/{chunk-C7GEIDCP.js → chunk-FVCSERCO.js} +1 -5
- package/dist/pool.node-chunks/{chunk-PDHO4Y56.js → chunk-MHOA4NGC.js} +5 -8
- package/dist/pool.node-chunks/{chunk-7FGOYOXU.js → chunk-UYQ7D5I5.js} +2 -77
- package/dist/pool.node-chunks/{logic-compiler-BODAINZQ.js → logic-compiler-3VVLN3YN.js} +2 -2
- package/dist/pool.node-chunks/{style-compiler-TUNDVSR5.js → style-compiler-QOUWS72U.js} +3 -3
- package/dist/pool.node-chunks/{view-compiler-HOFFL63K.js → view-compiler-KAYOMOXO.js} +23 -25
- package/dist/pool.node.js +11 -4
- package/dist/stage-worker.browser.js +34 -105
- package/dist/stage-worker.node.js +2 -2
- package/package.json +1 -1
- package/scripts/test-pool-node.js +93 -3
- package/src/pool-node.js +33 -10
package/README.md
CHANGED
|
@@ -160,17 +160,19 @@ Node 宿主(Electron devtools、CLI watch 服务等)用这个导出替代直
|
|
|
160
160
|
|
|
161
161
|
dmcc 每次 `build()` 都新建 3 个 worker_threads、编完销毁,每次重编都要重新加载 sass/postcss/esbuild/oxc 并重启 esbuild 服务进程;本 pool 只在第一次付这笔钱。实测 watch 热重编(`dimina/fe/example` 全部 5 个 demo)比 dmcc 快 1.6–4×(base 826→207ms、weui 2716→763ms);冷启动略慢于 dmcc(3 个 worker 首次加载 bundle),"打开一次、保存无数次"的 devtools 场景下净赚。数据与方法见 [`docs/compile-fs-experiments.md`](./docs/compile-fs-experiments.md)。
|
|
162
162
|
|
|
163
|
-
**dmcc drop-in
|
|
163
|
+
**dmcc drop-in(默认导出)**——签名、成功返回值、日志面貌与 dmcc `build()` 一致,宿主原有的日志抓取(`✔ 输出编译产物` / `✖ <stage>` / `<workPath> 编译出错:`)不用改。**错误路径与 dmcc 刻意分歧:编译失败会 reject**(dmcc 吞错 resolve undefined,失败编译与"无 app 信息"从此不可区分,宿主会带着兜底 appId 启动一个只能 404 的会话)——失败时先照旧把 `✖ <stage>` + `编译出错:` 打到 stderr,再把错误抛给调用方:
|
|
164
164
|
|
|
165
165
|
```js
|
|
166
166
|
import build from '@dimina-kit/compiler/pool-node'
|
|
167
167
|
|
|
168
168
|
// 首次调用起常驻 worker,后续调用(watch 重编)复用
|
|
169
169
|
const appInfo = await build(outputDir, workPath, true, { sourcemap: true, fileTypes })
|
|
170
|
-
// 成功 → { appId, name, path }
|
|
170
|
+
// 成功 → { appId, name, path };编译失败 → reject(错误同时已打到 stderr,日志面貌同 dmcc)
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
配套导出:`warmDefaultPool()` 提前创建这个 singleton 池并拉起 stage worker(不 build、无输出,项目无关——热备胎宿主在没有项目打开时调用,让第一次真实 build 从热池起步);`disposeDefaultPool()`
|
|
173
|
+
配套导出:`warmDefaultPool()` 提前创建这个 singleton 池并拉起 stage worker(不 build、无输出,项目无关——热备胎宿主在没有项目打开时调用,让第一次真实 build 从热池起步);`disposeDefaultPool()` 显式回收;`oxcNativeBindingHint(message)` 把 oxc-parser 的 "Cannot find native binding" 报错映射成打包提示(其他消息返回 null)——stage 失败的 reject message 命中时会自动附带这条提示。
|
|
174
|
+
|
|
175
|
+
> **Electron 打包分发注意(oxc-parser 运行时绑定)**:Node 编译路径依赖 oxc-parser,其运行时需要 `@oxc-parser/binding-<platform>-<arch>`(平台原生 `.node`)或 `@oxc-parser/binding-wasm32-wasi`(wasm 兜底)**二者之一实际存在于分发包内**。它们都不是宿主的直接依赖,electron-builder 等工具收集依赖时容易丢——丢了之后每次编译都在 logic stage 报 `Cannot find native binding`。宿主打包时请把其中一个显式声明为自己的 dependency(或在打包配置里强制收集)。
|
|
174
176
|
|
|
175
177
|
**结构化用法(`createNodeCompilerPool`)**——要抛错误对象、显式回收 worker 时用:
|
|
176
178
|
|
|
@@ -989,81 +989,23 @@ var init_npm_resolver = __esm({
|
|
|
989
989
|
});
|
|
990
990
|
|
|
991
991
|
// ../../dimina/fe/packages/compiler/src/env.js
|
|
992
|
-
function
|
|
993
|
-
if (typeof raw !== "string") {
|
|
994
|
-
return null;
|
|
995
|
-
}
|
|
996
|
-
const v = raw.trim().toLowerCase().replace(/^\.+/, "");
|
|
997
|
-
if (!/^[a-z0-9_-]+$/.test(v)) {
|
|
998
|
-
return null;
|
|
999
|
-
}
|
|
1000
|
-
return `.${v}`;
|
|
1001
|
-
}
|
|
1002
|
-
function normalizeTag(raw) {
|
|
1003
|
-
if (typeof raw !== "string") {
|
|
1004
|
-
return null;
|
|
1005
|
-
}
|
|
1006
|
-
const v = raw.trim().toLowerCase().replace(/^\.+/, "");
|
|
1007
|
-
if (!/^[a-z][a-z0-9_-]*$/.test(v)) {
|
|
1008
|
-
return null;
|
|
1009
|
-
}
|
|
1010
|
-
return v;
|
|
1011
|
-
}
|
|
1012
|
-
function mergeUnique(builtins, custom, normalizer, reserved) {
|
|
1013
|
-
const out = [...builtins];
|
|
1014
|
-
const seen2 = new Set(builtins);
|
|
1015
|
-
if (Array.isArray(custom)) {
|
|
1016
|
-
for (const raw of custom) {
|
|
1017
|
-
const n2 = normalizer(raw);
|
|
1018
|
-
if (n2 && !seen2.has(n2) && !reserved?.has(n2)) {
|
|
1019
|
-
seen2.add(n2);
|
|
1020
|
-
out.push(n2);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
return out;
|
|
1025
|
-
}
|
|
1026
|
-
function normalizeFileTypes(fileTypes = {}) {
|
|
1027
|
-
const ft = fileTypes || {};
|
|
1028
|
-
return {
|
|
1029
|
-
templateExts: mergeUnique(DEFAULT_TEMPLATE_EXTS, ft.template, normalizeExt, RESERVED_EXTS),
|
|
1030
|
-
styleExts: mergeUnique(DEFAULT_STYLE_EXTS, ft.style, normalizeExt, RESERVED_EXTS),
|
|
1031
|
-
viewScriptExts: mergeUnique(DEFAULT_VIEW_SCRIPT_EXTS, ft.viewScript, normalizeExt, RESERVED_EXTS),
|
|
1032
|
-
viewScriptTags: mergeUnique(DEFAULT_VIEW_SCRIPT_TAGS, ft.viewScript, normalizeTag)
|
|
1033
|
-
};
|
|
1034
|
-
}
|
|
1035
|
-
function storeInfo(workPath, options = {}) {
|
|
992
|
+
function storeInfo(workPath) {
|
|
1036
993
|
storePathInfo(workPath);
|
|
1037
994
|
storeProjectConfig();
|
|
1038
995
|
storeAppConfig();
|
|
1039
996
|
storePageConfig();
|
|
1040
|
-
compilerOptions = normalizeFileTypes(options.fileTypes);
|
|
1041
997
|
return {
|
|
1042
998
|
pathInfo,
|
|
1043
|
-
configInfo
|
|
1044
|
-
compilerOptions
|
|
999
|
+
configInfo
|
|
1045
1000
|
};
|
|
1046
1001
|
}
|
|
1047
1002
|
function resetStoreInfo(opts) {
|
|
1048
1003
|
pathInfo = opts.pathInfo;
|
|
1049
1004
|
configInfo = opts.configInfo;
|
|
1050
|
-
compilerOptions = opts.compilerOptions || normalizeFileTypes();
|
|
1051
1005
|
if (pathInfo.workPath) {
|
|
1052
1006
|
npmResolver = new NpmResolver(pathInfo.workPath);
|
|
1053
1007
|
}
|
|
1054
1008
|
}
|
|
1055
|
-
function getTemplateExts() {
|
|
1056
|
-
return compilerOptions.templateExts;
|
|
1057
|
-
}
|
|
1058
|
-
function getStyleExts() {
|
|
1059
|
-
return compilerOptions.styleExts;
|
|
1060
|
-
}
|
|
1061
|
-
function getViewScriptExts() {
|
|
1062
|
-
return compilerOptions.viewScriptExts;
|
|
1063
|
-
}
|
|
1064
|
-
function getViewScriptTags() {
|
|
1065
|
-
return compilerOptions.viewScriptTags;
|
|
1066
|
-
}
|
|
1067
1009
|
function storePathInfo(workPath) {
|
|
1068
1010
|
pathInfo.workPath = workPath;
|
|
1069
1011
|
if (process_default.env.TARGET_PATH) {
|
|
@@ -1301,7 +1243,7 @@ function getPages() {
|
|
|
1301
1243
|
subPages
|
|
1302
1244
|
};
|
|
1303
1245
|
}
|
|
1304
|
-
var import_node_path4, pathInfo, configInfo, npmResolver
|
|
1246
|
+
var import_node_path4, pathInfo, configInfo, npmResolver;
|
|
1305
1247
|
var init_env = __esm({
|
|
1306
1248
|
"../../dimina/fe/packages/compiler/src/env.js"() {
|
|
1307
1249
|
init_fs();
|
|
@@ -1314,19 +1256,6 @@ var init_env = __esm({
|
|
|
1314
1256
|
pathInfo = {};
|
|
1315
1257
|
configInfo = {};
|
|
1316
1258
|
npmResolver = null;
|
|
1317
|
-
DEFAULT_TEMPLATE_EXTS = [".wxml", ".ddml"];
|
|
1318
|
-
DEFAULT_STYLE_EXTS = [".wxss", ".ddss", ".less", ".scss", ".sass"];
|
|
1319
|
-
DEFAULT_VIEW_SCRIPT_EXTS = [".wxs"];
|
|
1320
|
-
DEFAULT_VIEW_SCRIPT_TAGS = ["wxs", "dds"];
|
|
1321
|
-
RESERVED_EXTS = /* @__PURE__ */ new Set([
|
|
1322
|
-
...DEFAULT_TEMPLATE_EXTS,
|
|
1323
|
-
...DEFAULT_STYLE_EXTS,
|
|
1324
|
-
...DEFAULT_VIEW_SCRIPT_EXTS,
|
|
1325
|
-
".js",
|
|
1326
|
-
".ts",
|
|
1327
|
-
".json"
|
|
1328
|
-
]);
|
|
1329
|
-
compilerOptions = normalizeFileTypes();
|
|
1330
1259
|
}
|
|
1331
1260
|
});
|
|
1332
1261
|
|
|
@@ -4740,7 +4669,7 @@ function warnUnsupportedWxApi(apiName, filePath, line) {
|
|
|
4740
4669
|
}
|
|
4741
4670
|
function warnUnsupportedComponent(tagName, filePath, line) {
|
|
4742
4671
|
const { supportedBuiltinComponents: supportedBuiltinComponents2 } = loadReference();
|
|
4743
|
-
if (!tagName || supportedBuiltinComponents2.has(tagName)
|
|
4672
|
+
if (!tagName || supportedBuiltinComponents2.has(tagName)) {
|
|
4744
4673
|
return;
|
|
4745
4674
|
}
|
|
4746
4675
|
const location = formatLocation(filePath, line);
|
|
@@ -4801,7 +4730,6 @@ var cachedReference, warnedItems;
|
|
|
4801
4730
|
var init_compatibility = __esm({
|
|
4802
4731
|
"../../dimina/fe/packages/compiler/src/common/compatibility.js"() {
|
|
4803
4732
|
init_dist3();
|
|
4804
|
-
init_env();
|
|
4805
4733
|
init_compatibility_reference();
|
|
4806
4734
|
cachedReference = null;
|
|
4807
4735
|
warnedItems = /* @__PURE__ */ new Set();
|
|
@@ -31168,7 +31096,7 @@ function doCompileTemplate({
|
|
|
31168
31096
|
ssrCssVars,
|
|
31169
31097
|
isProd = false,
|
|
31170
31098
|
compiler,
|
|
31171
|
-
compilerOptions
|
|
31099
|
+
compilerOptions = {},
|
|
31172
31100
|
transformAssetUrls
|
|
31173
31101
|
}) {
|
|
31174
31102
|
const errors2 = [];
|
|
@@ -31202,7 +31130,7 @@ function doCompileTemplate({
|
|
|
31202
31130
|
if (inAST == null ? void 0 : inAST.transformed) {
|
|
31203
31131
|
const newAST = (ssr ? CompilerDOM : compiler).parse(inAST.source, __spreadProps$5(__spreadValues$6({
|
|
31204
31132
|
prefixIdentifiers: true
|
|
31205
|
-
},
|
|
31133
|
+
}, compilerOptions), {
|
|
31206
31134
|
parseMode: "sfc",
|
|
31207
31135
|
onError: (e) => errors2.push(e)
|
|
31208
31136
|
}));
|
|
@@ -31220,9 +31148,9 @@ function doCompileTemplate({
|
|
|
31220
31148
|
scopeId: scoped ? longId : void 0,
|
|
31221
31149
|
slotted,
|
|
31222
31150
|
sourceMap: true
|
|
31223
|
-
},
|
|
31151
|
+
}, compilerOptions), {
|
|
31224
31152
|
hmr: !isProd,
|
|
31225
|
-
nodeTransforms: nodeTransforms.concat(
|
|
31153
|
+
nodeTransforms: nodeTransforms.concat(compilerOptions.nodeTransforms || []),
|
|
31226
31154
|
filename,
|
|
31227
31155
|
onError: (e) => errors2.push(e),
|
|
31228
31156
|
onWarn: (w) => warnings.push(w)
|
|
@@ -62994,8 +62922,6 @@ __export(view_compiler_exports, {
|
|
|
62994
62922
|
compileML: () => compileML,
|
|
62995
62923
|
generateSlotDirective: () => generateSlotDirective,
|
|
62996
62924
|
generateVModelTemplate: () => generateVModelTemplate,
|
|
62997
|
-
initWxsFilePathMap: () => initWxsFilePathMap,
|
|
62998
|
-
loadWxsModule: () => loadWxsModule,
|
|
62999
62925
|
parseBraceExp: () => parseBraceExp,
|
|
63000
62926
|
parseClassRules: () => parseClassRules,
|
|
63001
62927
|
parseKeyExpression: () => parseKeyExpression,
|
|
@@ -63004,13 +62930,6 @@ __export(view_compiler_exports, {
|
|
|
63004
62930
|
processWxsContent: () => processWxsContent,
|
|
63005
62931
|
splitWithBraces: () => splitWithBraces
|
|
63006
62932
|
});
|
|
63007
|
-
function buildExtStripRegex(exts) {
|
|
63008
|
-
const alt = exts.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
63009
|
-
return new RegExp(`(${alt})$`);
|
|
63010
|
-
}
|
|
63011
|
-
function stripViewScriptExt(p) {
|
|
63012
|
-
return p.replace(buildExtStripRegex(getViewScriptExts()), "");
|
|
63013
|
-
}
|
|
63014
62933
|
function parseJs(code, filename = "view-compiler.js", sourceType = "module") {
|
|
63015
62934
|
return parseSync(filename, code, {
|
|
63016
62935
|
sourceType,
|
|
@@ -63176,8 +63095,8 @@ function scanWxsFiles(dir, workPath) {
|
|
|
63176
63095
|
const stat2 = fs_default.statSync(fullPath);
|
|
63177
63096
|
if (stat2.isDirectory()) {
|
|
63178
63097
|
scanWxsFiles(fullPath, workPath);
|
|
63179
|
-
} else if (stat2.isFile() &&
|
|
63180
|
-
const relativePath =
|
|
63098
|
+
} else if (stat2.isFile() && item.endsWith(".wxs")) {
|
|
63099
|
+
const relativePath = fullPath.replace(workPath, "").replace(/\.wxs$/, "");
|
|
63181
63100
|
const moduleName = relativePath.replace(/[\/\\@\-]/g, "_").replace(/^_/, "");
|
|
63182
63101
|
wxsFilePathMap.set(moduleName, fullPath);
|
|
63183
63102
|
}
|
|
@@ -63407,7 +63326,7 @@ function processWxsContent(wxsContent, wxsFilePath, scriptModule, workPath, file
|
|
|
63407
63326
|
if (filePath && filePath.includes("/miniprogram_npm/")) {
|
|
63408
63327
|
const currentWxsDir = import_node_path8.default.dirname(wxsFilePath);
|
|
63409
63328
|
resolvedWxsPath = import_node_path8.default.resolve(currentWxsDir, requirePath);
|
|
63410
|
-
const relativePath =
|
|
63329
|
+
const relativePath = resolvedWxsPath.replace(workPath, "").replace(/\.wxs$/, "");
|
|
63411
63330
|
const moduleName = relativePath.replace(/[\/\\@\-]/g, "_").replace(/^_/, "");
|
|
63412
63331
|
processWxsDependency(resolvedWxsPath, moduleName, scriptModule, workPath, filePath);
|
|
63413
63332
|
replacements.push({
|
|
@@ -63418,7 +63337,7 @@ function processWxsContent(wxsContent, wxsFilePath, scriptModule, workPath, file
|
|
|
63418
63337
|
} else {
|
|
63419
63338
|
const currentWxsDir = import_node_path8.default.dirname(wxsFilePath);
|
|
63420
63339
|
resolvedWxsPath = import_node_path8.default.resolve(currentWxsDir, requirePath);
|
|
63421
|
-
const relativePath =
|
|
63340
|
+
const relativePath = resolvedWxsPath.replace(workPath, "").replace(/\.wxs$/, "");
|
|
63422
63341
|
const depModuleName = relativePath.replace(/[\/\\@\-]/g, "_").replace(/^_/, "");
|
|
63423
63342
|
processWxsDependency(resolvedWxsPath, depModuleName, scriptModule, workPath, filePath);
|
|
63424
63343
|
replacements.push({
|
|
@@ -63634,7 +63553,7 @@ function toCompileTemplate(isComponent2, path10, components, componentPlaceholde
|
|
|
63634
63553
|
const src = $2(elem).attr("src");
|
|
63635
63554
|
if (src) {
|
|
63636
63555
|
const includeFullPath = getAbsolutePath(workPath, path10, src);
|
|
63637
|
-
let includePath = includeFullPath.replace(workPath, "").replace(
|
|
63556
|
+
let includePath = includeFullPath.replace(workPath, "").replace(/\.(wxml|ddml)$/, "");
|
|
63638
63557
|
const includeDiagnosticSource = includeFullPath.startsWith(workPath) ? includeFullPath.slice(workPath.length) : includePath;
|
|
63639
63558
|
if (!includePath.startsWith("/")) {
|
|
63640
63559
|
includePath = "/" + includePath;
|
|
@@ -63660,7 +63579,8 @@ function toCompileTemplate(isComponent2, path10, components, componentPlaceholde
|
|
|
63660
63579
|
);
|
|
63661
63580
|
processIncludedFileWxsDependencies(includeContent, includePath, scriptModule, components, processedPaths);
|
|
63662
63581
|
$includeContent("template").remove();
|
|
63663
|
-
$includeContent(
|
|
63582
|
+
$includeContent("wxs").remove();
|
|
63583
|
+
$includeContent("dds").remove();
|
|
63664
63584
|
const processedContent = processIncludeConditionalAttrs($2, elem, $includeContent.html());
|
|
63665
63585
|
$2(elem).replaceWith(processedContent);
|
|
63666
63586
|
} else {
|
|
@@ -63677,7 +63597,7 @@ function toCompileTemplate(isComponent2, path10, components, componentPlaceholde
|
|
|
63677
63597
|
const src = $2(elem).attr("src");
|
|
63678
63598
|
if (src) {
|
|
63679
63599
|
const importFullPath = getAbsolutePath(workPath, path10, src);
|
|
63680
|
-
let importPath = importFullPath.replace(workPath, "").replace(
|
|
63600
|
+
let importPath = importFullPath.replace(workPath, "").replace(/\.(wxml|ddml)$/, "");
|
|
63681
63601
|
const importDiagnosticSource = importFullPath.startsWith(workPath) ? importFullPath.slice(workPath.length) : importPath;
|
|
63682
63602
|
if (!importPath.startsWith("/")) {
|
|
63683
63603
|
importPath = "/" + importPath;
|
|
@@ -63724,7 +63644,8 @@ function transTagTemplate($2, templateModule, path10, components, componentPlace
|
|
|
63724
63644
|
const templateContent = $2(elem);
|
|
63725
63645
|
templateContent.find("import").remove();
|
|
63726
63646
|
templateContent.find("include").remove();
|
|
63727
|
-
templateContent.find(
|
|
63647
|
+
templateContent.find("wxs").remove();
|
|
63648
|
+
templateContent.find("dds").remove();
|
|
63728
63649
|
transAsses($2, templateContent.find("image"), path10);
|
|
63729
63650
|
const res = [];
|
|
63730
63651
|
transHtmlTag(templateContent.html(), res, components, componentPlaceholder);
|
|
@@ -64031,7 +63952,7 @@ function parseKeyExpression(exp, itemName = "item", indexName = "index") {
|
|
|
64031
63952
|
}
|
|
64032
63953
|
function getViewPath(workPath, src) {
|
|
64033
63954
|
const aSrc = src.startsWith("/") ? src : `/${src}`;
|
|
64034
|
-
for (const mlType of
|
|
63955
|
+
for (const mlType of fileType) {
|
|
64035
63956
|
const mlFullPath = `${workPath}${aSrc}${mlType}`;
|
|
64036
63957
|
if (fs_default.existsSync(mlFullPath)) {
|
|
64037
63958
|
return mlFullPath;
|
|
@@ -64137,7 +64058,10 @@ function parseTemplateDataExp(exp) {
|
|
|
64137
64058
|
return `{${parseBraceExp(exp)}}`;
|
|
64138
64059
|
}
|
|
64139
64060
|
function transTagWxs($2, scriptModule, filePath) {
|
|
64140
|
-
|
|
64061
|
+
let wxsNodes = $2("wxs");
|
|
64062
|
+
if (wxsNodes.length === 0) {
|
|
64063
|
+
wxsNodes = $2("dds");
|
|
64064
|
+
}
|
|
64141
64065
|
wxsNodes.each((_, elem) => {
|
|
64142
64066
|
const smName = $2(elem).attr("module");
|
|
64143
64067
|
if (smName) {
|
|
@@ -64156,7 +64080,7 @@ function transTagWxs($2, scriptModule, filePath) {
|
|
|
64156
64080
|
wxsFilePath = getAbsolutePath(workPath, filePath, src);
|
|
64157
64081
|
}
|
|
64158
64082
|
if (wxsFilePath) {
|
|
64159
|
-
const relativePath =
|
|
64083
|
+
const relativePath = wxsFilePath.replace(workPath, "").replace(/\.wxs$/, "");
|
|
64160
64084
|
uniqueModuleName = relativePath.replace(/[\/\\@\-]/g, "_").replace(/^_/, "");
|
|
64161
64085
|
cacheKey = wxsFilePath;
|
|
64162
64086
|
}
|
|
@@ -64229,8 +64153,12 @@ function collectAllWxsModules(scriptRes, collectedPaths = /* @__PURE__ */ new Se
|
|
|
64229
64153
|
return allWxsModules;
|
|
64230
64154
|
}
|
|
64231
64155
|
function loadWxsModule(modulePath, workPath, scriptModule) {
|
|
64156
|
+
if (!modulePath.startsWith("miniprogram_npm__") || !modulePath.includes("_wxs_")) {
|
|
64157
|
+
return null;
|
|
64158
|
+
}
|
|
64232
64159
|
const wxsFilePath = wxsFilePathMap.get(modulePath);
|
|
64233
64160
|
if (!wxsFilePath) {
|
|
64161
|
+
console.warn(`[view] \u65E0\u6CD5\u627E\u5230 wxs \u6A21\u5757\u6587\u4EF6: ${modulePath}`);
|
|
64234
64162
|
return null;
|
|
64235
64163
|
}
|
|
64236
64164
|
try {
|
|
@@ -64317,7 +64245,7 @@ function __resetViewState() {
|
|
|
64317
64245
|
wxsModuleRegistry.clear();
|
|
64318
64246
|
wxsFilePathMap.clear();
|
|
64319
64247
|
}
|
|
64320
|
-
var import_node_path8, compileResCache, wxsModuleRegistry, wxsFilePathMap, braceRegex, noBraceRegex, ternaryRegex;
|
|
64248
|
+
var import_node_path8, fileType, compileResCache, wxsModuleRegistry, wxsFilePathMap, braceRegex, noBraceRegex, ternaryRegex;
|
|
64321
64249
|
var init_view_compiler = __esm({
|
|
64322
64250
|
"../../dimina/fe/packages/compiler/src/core/view-compiler.js"() {
|
|
64323
64251
|
init_fs();
|
|
@@ -64334,6 +64262,7 @@ var init_view_compiler = __esm({
|
|
|
64334
64262
|
init_utils();
|
|
64335
64263
|
init_env();
|
|
64336
64264
|
init_expression_parser();
|
|
64265
|
+
fileType = [".wxml", ".ddml"];
|
|
64337
64266
|
compileResCache = /* @__PURE__ */ new Map();
|
|
64338
64267
|
wxsModuleRegistry = /* @__PURE__ */ new Set();
|
|
64339
64268
|
wxsFilePathMap = /* @__PURE__ */ new Map();
|
|
@@ -281985,7 +281914,7 @@ function normalizeCssUrlValue(value, absolutePath) {
|
|
|
281985
281914
|
function getAbsolutePath2(modulePath) {
|
|
281986
281915
|
const workPath = getWorkPath();
|
|
281987
281916
|
const src = modulePath.startsWith("/") ? modulePath : `/${modulePath}`;
|
|
281988
|
-
for (const ssType of
|
|
281917
|
+
for (const ssType of fileType2) {
|
|
281989
281918
|
const ssFullPath = `${workPath}${src}${ssType}`;
|
|
281990
281919
|
if (fs_default.existsSync(ssFullPath)) {
|
|
281991
281920
|
return ssFullPath;
|
|
@@ -282038,7 +281967,7 @@ function processHostSelector(selector2, moduleId) {
|
|
|
282038
281967
|
function __resetStyleState() {
|
|
282039
281968
|
compileRes.clear();
|
|
282040
281969
|
}
|
|
282041
|
-
var import_node_path9, import_autoprefixer, import_cssnano, import_postcss_selector_parser, compileRes;
|
|
281970
|
+
var import_node_path9, import_autoprefixer, import_cssnano, import_postcss_selector_parser, fileType2, compileRes;
|
|
282042
281971
|
var init_style_compiler = __esm({
|
|
282043
281972
|
"../../dimina/fe/packages/compiler/src/core/style-compiler.js"() {
|
|
282044
281973
|
init_fs();
|
|
@@ -282053,6 +281982,7 @@ var init_style_compiler = __esm({
|
|
|
282053
281982
|
init_sass_default();
|
|
282054
281983
|
init_utils();
|
|
282055
281984
|
init_env();
|
|
281985
|
+
fileType2 = [".wxss", ".ddss", ".less", ".scss", ".sass"];
|
|
282056
281986
|
compileRes = /* @__PURE__ */ new Map();
|
|
282057
281987
|
if (!isMainThread) {
|
|
282058
281988
|
parentPort.on("message", async ({ pages, storeInfo: storeInfo2 }) => {
|
|
@@ -282148,7 +282078,6 @@ var config_compiler_default = compileConfig;
|
|
|
282148
282078
|
// ../../dimina/fe/packages/compiler/src/common/npm-builder.js
|
|
282149
282079
|
init_fs();
|
|
282150
282080
|
var import_node_path6 = __toESM(require_path_browserify(), 1);
|
|
282151
|
-
init_env();
|
|
282152
282081
|
var NpmBuilder = class {
|
|
282153
282082
|
constructor(workPath, targetPath) {
|
|
282154
282083
|
this.workPath = workPath;
|
|
@@ -282256,7 +282185,7 @@ var NpmBuilder = class {
|
|
|
282256
282185
|
* @returns {boolean} 是否为小程序文件
|
|
282257
282186
|
*/
|
|
282258
282187
|
isMiniprogramFile(filename) {
|
|
282259
|
-
const miniprogramExts = [".js", ".json", ".ts",
|
|
282188
|
+
const miniprogramExts = [".js", ".json", ".wxml", ".wxss", ".wxs", ".ts", ".less", ".scss", ".styl"];
|
|
282260
282189
|
const ext = import_node_path6.default.extname(filename).toLowerCase();
|
|
282261
282190
|
return miniprogramExts.includes(ext) || filename === "package.json" || filename === "README.md" || filename.startsWith(".");
|
|
282262
282191
|
}
|
|
@@ -425,94 +425,23 @@ var NpmResolver = class {
|
|
|
425
425
|
var pathInfo = {};
|
|
426
426
|
var configInfo = {};
|
|
427
427
|
var npmResolver = null;
|
|
428
|
-
|
|
429
|
-
var DEFAULT_STYLE_EXTS = [".wxss", ".ddss", ".less", ".scss", ".sass"];
|
|
430
|
-
var DEFAULT_VIEW_SCRIPT_EXTS = [".wxs"];
|
|
431
|
-
var DEFAULT_VIEW_SCRIPT_TAGS = ["wxs", "dds"];
|
|
432
|
-
var RESERVED_EXTS = /* @__PURE__ */ new Set([
|
|
433
|
-
...DEFAULT_TEMPLATE_EXTS,
|
|
434
|
-
...DEFAULT_STYLE_EXTS,
|
|
435
|
-
...DEFAULT_VIEW_SCRIPT_EXTS,
|
|
436
|
-
".js",
|
|
437
|
-
".ts",
|
|
438
|
-
".json"
|
|
439
|
-
]);
|
|
440
|
-
var compilerOptions = normalizeFileTypes();
|
|
441
|
-
function normalizeExt(raw) {
|
|
442
|
-
if (typeof raw !== "string") {
|
|
443
|
-
return null;
|
|
444
|
-
}
|
|
445
|
-
const v = raw.trim().toLowerCase().replace(/^\.+/, "");
|
|
446
|
-
if (!/^[a-z0-9_-]+$/.test(v)) {
|
|
447
|
-
return null;
|
|
448
|
-
}
|
|
449
|
-
return `.${v}`;
|
|
450
|
-
}
|
|
451
|
-
function normalizeTag(raw) {
|
|
452
|
-
if (typeof raw !== "string") {
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
455
|
-
const v = raw.trim().toLowerCase().replace(/^\.+/, "");
|
|
456
|
-
if (!/^[a-z][a-z0-9_-]*$/.test(v)) {
|
|
457
|
-
return null;
|
|
458
|
-
}
|
|
459
|
-
return v;
|
|
460
|
-
}
|
|
461
|
-
function mergeUnique(builtins, custom, normalizer, reserved) {
|
|
462
|
-
const out = [...builtins];
|
|
463
|
-
const seen = new Set(builtins);
|
|
464
|
-
if (Array.isArray(custom)) {
|
|
465
|
-
for (const raw of custom) {
|
|
466
|
-
const n = normalizer(raw);
|
|
467
|
-
if (n && !seen.has(n) && !reserved?.has(n)) {
|
|
468
|
-
seen.add(n);
|
|
469
|
-
out.push(n);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
return out;
|
|
474
|
-
}
|
|
475
|
-
function normalizeFileTypes(fileTypes = {}) {
|
|
476
|
-
const ft = fileTypes || {};
|
|
477
|
-
return {
|
|
478
|
-
templateExts: mergeUnique(DEFAULT_TEMPLATE_EXTS, ft.template, normalizeExt, RESERVED_EXTS),
|
|
479
|
-
styleExts: mergeUnique(DEFAULT_STYLE_EXTS, ft.style, normalizeExt, RESERVED_EXTS),
|
|
480
|
-
viewScriptExts: mergeUnique(DEFAULT_VIEW_SCRIPT_EXTS, ft.viewScript, normalizeExt, RESERVED_EXTS),
|
|
481
|
-
viewScriptTags: mergeUnique(DEFAULT_VIEW_SCRIPT_TAGS, ft.viewScript, normalizeTag)
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
function storeInfo(workPath, options = {}) {
|
|
428
|
+
function storeInfo(workPath) {
|
|
485
429
|
storePathInfo(workPath);
|
|
486
430
|
storeProjectConfig();
|
|
487
431
|
storeAppConfig();
|
|
488
432
|
storePageConfig();
|
|
489
|
-
compilerOptions = normalizeFileTypes(options.fileTypes);
|
|
490
433
|
return {
|
|
491
434
|
pathInfo,
|
|
492
|
-
configInfo
|
|
493
|
-
compilerOptions
|
|
435
|
+
configInfo
|
|
494
436
|
};
|
|
495
437
|
}
|
|
496
438
|
function resetStoreInfo(opts) {
|
|
497
439
|
pathInfo = opts.pathInfo;
|
|
498
440
|
configInfo = opts.configInfo;
|
|
499
|
-
compilerOptions = opts.compilerOptions || normalizeFileTypes();
|
|
500
441
|
if (pathInfo.workPath) {
|
|
501
442
|
npmResolver = new NpmResolver(pathInfo.workPath);
|
|
502
443
|
}
|
|
503
444
|
}
|
|
504
|
-
function getTemplateExts() {
|
|
505
|
-
return compilerOptions.templateExts;
|
|
506
|
-
}
|
|
507
|
-
function getStyleExts() {
|
|
508
|
-
return compilerOptions.styleExts;
|
|
509
|
-
}
|
|
510
|
-
function getViewScriptExts() {
|
|
511
|
-
return compilerOptions.viewScriptExts;
|
|
512
|
-
}
|
|
513
|
-
function getViewScriptTags() {
|
|
514
|
-
return compilerOptions.viewScriptTags;
|
|
515
|
-
}
|
|
516
445
|
function storePathInfo(workPath) {
|
|
517
446
|
pathInfo.workPath = workPath;
|
|
518
447
|
if (process2.env.TARGET_PATH) {
|
|
@@ -763,10 +692,6 @@ export {
|
|
|
763
692
|
__resetAssets,
|
|
764
693
|
storeInfo,
|
|
765
694
|
resetStoreInfo,
|
|
766
|
-
getTemplateExts,
|
|
767
|
-
getStyleExts,
|
|
768
|
-
getViewScriptExts,
|
|
769
|
-
getViewScriptTags,
|
|
770
695
|
getContentByPath,
|
|
771
696
|
resolveAppAlias,
|
|
772
697
|
getTargetPath,
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getViewScriptTags
|
|
3
|
-
} from "./chunk-QJ34C5KK.js";
|
|
4
|
-
|
|
5
1
|
// ../../dimina/fe/packages/compiler/src/common/compatibility.js
|
|
6
2
|
import { Parser } from "htmlparser2";
|
|
7
3
|
|
|
@@ -146,7 +142,7 @@ function warnUnsupportedWxApi(apiName, filePath, line) {
|
|
|
146
142
|
}
|
|
147
143
|
function warnUnsupportedComponent(tagName, filePath, line) {
|
|
148
144
|
const { supportedBuiltinComponents: supportedBuiltinComponents2 } = loadReference();
|
|
149
|
-
if (!tagName || supportedBuiltinComponents2.has(tagName)
|
|
145
|
+
if (!tagName || supportedBuiltinComponents2.has(tagName)) {
|
|
150
146
|
return;
|
|
151
147
|
}
|
|
152
148
|
const location = formatLocation(filePath, line);
|
package/dist/compile-core.node-chunks/{logic-compiler-2SQFOFEO.js → logic-compiler-RX63Y2FZ.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getWxMemberName,
|
|
3
3
|
warnUnsupportedWxApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CCZB2BJG.js";
|
|
5
5
|
import {
|
|
6
6
|
isMainThread,
|
|
7
7
|
parentPort
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
hasCompileInfo,
|
|
20
20
|
resetStoreInfo,
|
|
21
21
|
resolveAppAlias
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-5ND5V2SC.js";
|
|
23
23
|
|
|
24
24
|
// ../../dimina/fe/packages/compiler/src/core/logic-compiler.js
|
|
25
25
|
import { resolve, sep } from "node:path";
|
package/dist/compile-core.node-chunks/{style-compiler-ZEJ3XLTS.js → style-compiler-JUY5MZSO.js}
RENAMED
|
@@ -8,13 +8,12 @@ import {
|
|
|
8
8
|
getAppId,
|
|
9
9
|
getComponent,
|
|
10
10
|
getContentByPath,
|
|
11
|
-
getStyleExts,
|
|
12
11
|
getTargetPath,
|
|
13
12
|
getWorkPath,
|
|
14
13
|
resetStoreInfo,
|
|
15
14
|
tagWhiteList,
|
|
16
15
|
transformRpx
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5ND5V2SC.js";
|
|
18
17
|
|
|
19
18
|
// ../../dimina/fe/packages/compiler/src/core/style-compiler.js
|
|
20
19
|
import path from "node:path";
|
|
@@ -25,6 +24,7 @@ import less from "less";
|
|
|
25
24
|
import postcss from "postcss";
|
|
26
25
|
import selectorParser from "postcss-selector-parser";
|
|
27
26
|
import * as sass from "sass";
|
|
27
|
+
var fileType = [".wxss", ".ddss", ".less", ".scss", ".sass"];
|
|
28
28
|
var compileRes = /* @__PURE__ */ new Map();
|
|
29
29
|
if (!isMainThread) {
|
|
30
30
|
parentPort.on("message", async ({ pages, storeInfo }) => {
|
|
@@ -212,7 +212,7 @@ function normalizeCssUrlValue(value, absolutePath) {
|
|
|
212
212
|
function getAbsolutePath(modulePath) {
|
|
213
213
|
const workPath = getWorkPath();
|
|
214
214
|
const src = modulePath.startsWith("/") ? modulePath : `/${modulePath}`;
|
|
215
|
-
for (const ssType of
|
|
215
|
+
for (const ssType of fileType) {
|
|
216
216
|
const ssFullPath = `${workPath}${src}${ssType}`;
|
|
217
217
|
if (fs_default.existsSync(ssFullPath)) {
|
|
218
218
|
return ssFullPath;
|