@dimina-kit/compiler 0.0.2-dev.20260718095333 → 0.0.2-dev.20260728063215
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/compile-core.browser.js +5130 -4282
- package/dist/compile-core.node-chunks/chunk-23PCGQQU.js +141 -0
- package/dist/compile-core.node-chunks/{chunk-QVEZ34FP.js → chunk-M62ZDT7T.js} +281 -21
- package/dist/compile-core.node-chunks/{chunk-6734LXNU.js → chunk-QYHGF3MS.js} +75 -4
- package/dist/compile-core.node-chunks/{logic-compiler-VJWEQMXZ.js → logic-compiler-AEZPY2MO.js} +26 -102
- package/dist/compile-core.node-chunks/style-compiler-4PHMBQIC.js +470 -0
- package/dist/compile-core.node-chunks/{view-compiler-3OUFRVZF.js → view-compiler-2SMUHAPD.js} +232 -109
- package/dist/compile-core.node.js +11 -6
- package/dist/pool.node-chunks/{chunk-7F3E2G42.js → chunk-CKQISGZS.js} +281 -21
- package/dist/pool.node-chunks/{chunk-DQNLDQGT.js → chunk-LGB3AH5C.js} +75 -4
- package/dist/pool.node-chunks/chunk-VHWKAXDL.js +141 -0
- package/dist/pool.node-chunks/{chunk-LKL7FBHG.js → chunk-WX4462A5.js} +11 -6
- package/dist/pool.node-chunks/{logic-compiler-HMMTJJWY.js → logic-compiler-P4T4OMTG.js} +26 -102
- package/dist/pool.node-chunks/style-compiler-W7EA2Y7R.js +470 -0
- package/dist/pool.node-chunks/{view-compiler-2VZMJ65O.js → view-compiler-2D7HPYIN.js} +232 -109
- package/dist/pool.node.js +2 -2
- package/dist/stage-worker.browser.js +5337 -4489
- package/dist/stage-worker.node.js +2 -2
- package/package.json +8 -7
- package/scripts/check-wasm-alignment.js +173 -0
- package/dist/compile-core.node-chunks/chunk-2VRS523Z.js +0 -8
- package/dist/compile-core.node-chunks/style-compiler-YWVITCJW.js +0 -288
- package/dist/pool.node-chunks/chunk-KLXXOLDF.js +0 -8
- package/dist/pool.node-chunks/style-compiler-VGVCLQ7X.js +0 -288
|
@@ -16,15 +16,18 @@ import {
|
|
|
16
16
|
resetStoreInfo,
|
|
17
17
|
setFs,
|
|
18
18
|
storeInfo
|
|
19
|
-
} from "./compile-core.node-chunks/chunk-
|
|
19
|
+
} from "./compile-core.node-chunks/chunk-M62ZDT7T.js";
|
|
20
20
|
|
|
21
21
|
// ../../dimina/fe/packages/compiler/src/common/publish.js
|
|
22
|
-
function createDist() {
|
|
22
|
+
function createDist(seedPath) {
|
|
23
23
|
const distPath = getTargetPath();
|
|
24
24
|
if (fs_default.existsSync(distPath)) {
|
|
25
25
|
fs_default.rmSync(distPath, { recursive: true, force: true });
|
|
26
26
|
}
|
|
27
27
|
fs_default.mkdirSync(distPath, { recursive: true });
|
|
28
|
+
if (seedPath && fs_default.existsSync(seedPath)) {
|
|
29
|
+
fs_default.cpSync(seedPath, distPath, { recursive: true });
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
// ../../dimina/fe/packages/compiler/src/core/config-compiler.js
|
|
@@ -65,9 +68,10 @@ var config_compiler_default = compileConfig;
|
|
|
65
68
|
// ../../dimina/fe/packages/compiler/src/common/npm-builder.js
|
|
66
69
|
import path from "node:path";
|
|
67
70
|
var NpmBuilder = class {
|
|
68
|
-
constructor(workPath, targetPath) {
|
|
71
|
+
constructor(workPath, targetPath, dependencyGraph = null) {
|
|
69
72
|
this.workPath = workPath;
|
|
70
73
|
this.targetPath = targetPath;
|
|
74
|
+
this.dependencyGraph = dependencyGraph;
|
|
71
75
|
this.builtPackages = /* @__PURE__ */ new Set();
|
|
72
76
|
this.packageDependencies = /* @__PURE__ */ new Map();
|
|
73
77
|
}
|
|
@@ -160,6 +164,7 @@ var NpmBuilder = class {
|
|
|
160
164
|
await this.copyPackageFiles(sourceItemPath, targetItemPath);
|
|
161
165
|
} else {
|
|
162
166
|
if (this.isMiniprogramFile(item.name)) {
|
|
167
|
+
this.dependencyGraph?.addFile("app", sourceItemPath, "config");
|
|
163
168
|
fs_default.copyFileSync(sourceItemPath, targetItemPath);
|
|
164
169
|
}
|
|
165
170
|
}
|
|
@@ -254,9 +259,9 @@ var NpmBuilder = class {
|
|
|
254
259
|
|
|
255
260
|
// src/compile-core.js
|
|
256
261
|
var STAGE_IMPORTERS = {
|
|
257
|
-
logic: () => import("./compile-core.node-chunks/logic-compiler-
|
|
258
|
-
view: () => import("./compile-core.node-chunks/view-compiler-
|
|
259
|
-
style: () => import("./compile-core.node-chunks/style-compiler-
|
|
262
|
+
logic: () => import("./compile-core.node-chunks/logic-compiler-AEZPY2MO.js"),
|
|
263
|
+
view: () => import("./compile-core.node-chunks/view-compiler-2SMUHAPD.js"),
|
|
264
|
+
style: () => import("./compile-core.node-chunks/style-compiler-4PHMBQIC.js")
|
|
260
265
|
};
|
|
261
266
|
var stageLoads = /* @__PURE__ */ new Map();
|
|
262
267
|
var stageModules = /* @__PURE__ */ new Map();
|
|
@@ -226,7 +226,7 @@ function __resetAssets() {
|
|
|
226
226
|
// ../../dimina/fe/packages/compiler/src/env.js
|
|
227
227
|
import fs3 from "node:fs";
|
|
228
228
|
import os from "node:os";
|
|
229
|
-
import
|
|
229
|
+
import path5 from "node:path";
|
|
230
230
|
import process2 from "node:process";
|
|
231
231
|
import { parseSync } from "oxc-parser";
|
|
232
232
|
import { walk } from "oxc-walker";
|
|
@@ -431,11 +431,164 @@ var NpmResolver = class {
|
|
|
431
431
|
}
|
|
432
432
|
};
|
|
433
433
|
|
|
434
|
+
// ../../dimina/fe/packages/compiler/src/common/dependency-graph.js
|
|
435
|
+
import path4 from "node:path";
|
|
436
|
+
function normalizeFilePath(filePath) {
|
|
437
|
+
return path4.resolve(filePath);
|
|
438
|
+
}
|
|
439
|
+
function normalizeKinds(kinds) {
|
|
440
|
+
if (!kinds) return null;
|
|
441
|
+
return new Set(Array.isArray(kinds) ? kinds : [kinds]);
|
|
442
|
+
}
|
|
443
|
+
var DependencyGraph = class _DependencyGraph {
|
|
444
|
+
constructor(snapshot) {
|
|
445
|
+
this.nodes = /* @__PURE__ */ new Map();
|
|
446
|
+
this.dependencies = /* @__PURE__ */ new Map();
|
|
447
|
+
this.dependents = /* @__PURE__ */ new Map();
|
|
448
|
+
this.fileOwners = /* @__PURE__ */ new Map();
|
|
449
|
+
this.fileKinds = /* @__PURE__ */ new Map();
|
|
450
|
+
if (snapshot) {
|
|
451
|
+
this.merge(snapshot);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
addNode(id, metadata = {}) {
|
|
455
|
+
if (!id) return null;
|
|
456
|
+
const current = this.nodes.get(id) || {
|
|
457
|
+
id,
|
|
458
|
+
type: "module",
|
|
459
|
+
entry: false,
|
|
460
|
+
packageRoot: null,
|
|
461
|
+
files: /* @__PURE__ */ new Set()
|
|
462
|
+
};
|
|
463
|
+
if (metadata.type) current.type = metadata.type;
|
|
464
|
+
if (metadata.entry === true) current.entry = true;
|
|
465
|
+
if (metadata.packageRoot !== void 0) current.packageRoot = metadata.packageRoot;
|
|
466
|
+
this.nodes.set(id, current);
|
|
467
|
+
for (const filePath of metadata.files || []) {
|
|
468
|
+
this.addFile(id, filePath);
|
|
469
|
+
}
|
|
470
|
+
return current;
|
|
471
|
+
}
|
|
472
|
+
addFile(id, filePath, kind = "module") {
|
|
473
|
+
if (!id || !filePath) return;
|
|
474
|
+
const node = this.addNode(id);
|
|
475
|
+
const normalizedPath = normalizeFilePath(filePath);
|
|
476
|
+
node.files.add(normalizedPath);
|
|
477
|
+
const owners = this.fileOwners.get(normalizedPath) || /* @__PURE__ */ new Set();
|
|
478
|
+
owners.add(id);
|
|
479
|
+
this.fileOwners.set(normalizedPath, owners);
|
|
480
|
+
const ownerKinds = this.fileKinds.get(normalizedPath) || /* @__PURE__ */ new Map();
|
|
481
|
+
const kinds = ownerKinds.get(id) || /* @__PURE__ */ new Set();
|
|
482
|
+
kinds.add(kind);
|
|
483
|
+
ownerKinds.set(id, kinds);
|
|
484
|
+
this.fileKinds.set(normalizedPath, ownerKinds);
|
|
485
|
+
}
|
|
486
|
+
addDependency(from, to, kind = "module") {
|
|
487
|
+
if (!from || !to) return;
|
|
488
|
+
this.addNode(from);
|
|
489
|
+
this.addNode(to);
|
|
490
|
+
const outgoing = this.dependencies.get(from) || /* @__PURE__ */ new Map();
|
|
491
|
+
const kinds = outgoing.get(to) || /* @__PURE__ */ new Set();
|
|
492
|
+
kinds.add(kind);
|
|
493
|
+
outgoing.set(to, kinds);
|
|
494
|
+
this.dependencies.set(from, outgoing);
|
|
495
|
+
const incoming = this.dependents.get(to) || /* @__PURE__ */ new Map();
|
|
496
|
+
const reverseKinds = incoming.get(from) || /* @__PURE__ */ new Set();
|
|
497
|
+
reverseKinds.add(kind);
|
|
498
|
+
incoming.set(from, reverseKinds);
|
|
499
|
+
this.dependents.set(to, incoming);
|
|
500
|
+
}
|
|
501
|
+
getDirectDependencies(id, kinds) {
|
|
502
|
+
return this.#filterEdges(this.dependencies.get(id), kinds);
|
|
503
|
+
}
|
|
504
|
+
getDirectDependents(id, kinds) {
|
|
505
|
+
return this.#filterEdges(this.dependents.get(id), kinds);
|
|
506
|
+
}
|
|
507
|
+
getAffectedEntries(filePath) {
|
|
508
|
+
const owners = this.fileOwners.get(normalizeFilePath(filePath)) || /* @__PURE__ */ new Set();
|
|
509
|
+
const pending = [...owners];
|
|
510
|
+
const visited = /* @__PURE__ */ new Set();
|
|
511
|
+
const entries = /* @__PURE__ */ new Set();
|
|
512
|
+
while (pending.length > 0) {
|
|
513
|
+
const id = pending.pop();
|
|
514
|
+
if (visited.has(id)) continue;
|
|
515
|
+
visited.add(id);
|
|
516
|
+
const node = this.nodes.get(id);
|
|
517
|
+
if (node?.entry) entries.add(id);
|
|
518
|
+
for (const dependent of this.getDirectDependents(id)) {
|
|
519
|
+
pending.push(dependent);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return [...entries].sort();
|
|
523
|
+
}
|
|
524
|
+
hasFile(filePath) {
|
|
525
|
+
return this.fileOwners.has(normalizeFilePath(filePath));
|
|
526
|
+
}
|
|
527
|
+
getFileKinds(filePath) {
|
|
528
|
+
const ownerKinds = this.fileKinds.get(normalizeFilePath(filePath));
|
|
529
|
+
if (!ownerKinds) return [];
|
|
530
|
+
return [...new Set(
|
|
531
|
+
[...ownerKinds.values()].flatMap((kinds) => [...kinds])
|
|
532
|
+
)].sort();
|
|
533
|
+
}
|
|
534
|
+
merge(snapshotOrGraph) {
|
|
535
|
+
const snapshot = snapshotOrGraph instanceof _DependencyGraph ? snapshotOrGraph.toJSON() : snapshotOrGraph;
|
|
536
|
+
const fileEdges = snapshot?.fileEdges || [];
|
|
537
|
+
for (const node of snapshot?.nodes || []) {
|
|
538
|
+
this.addNode(node.id, { ...node, files: [] });
|
|
539
|
+
if (fileEdges.length === 0) {
|
|
540
|
+
for (const filePath of node.files || []) {
|
|
541
|
+
this.addFile(node.id, filePath);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
for (const fileEdge of fileEdges) {
|
|
546
|
+
for (const kind of fileEdge.kinds || ["module"]) {
|
|
547
|
+
this.addFile(fileEdge.owner, fileEdge.file, kind);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
for (const edge of snapshot?.edges || []) {
|
|
551
|
+
for (const kind of edge.kinds || ["module"]) {
|
|
552
|
+
this.addDependency(edge.from, edge.to, kind);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return this;
|
|
556
|
+
}
|
|
557
|
+
toJSON() {
|
|
558
|
+
return {
|
|
559
|
+
nodes: [...this.nodes.values()].map((node) => ({
|
|
560
|
+
id: node.id,
|
|
561
|
+
type: node.type,
|
|
562
|
+
entry: node.entry,
|
|
563
|
+
packageRoot: node.packageRoot,
|
|
564
|
+
files: [...node.files].sort()
|
|
565
|
+
})).sort((a, b) => a.id.localeCompare(b.id)),
|
|
566
|
+
edges: [...this.dependencies.entries()].flatMap(([from, targets]) => [...targets.entries()].map(([to, kinds]) => ({
|
|
567
|
+
from,
|
|
568
|
+
to,
|
|
569
|
+
kinds: [...kinds].sort()
|
|
570
|
+
}))).sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to)),
|
|
571
|
+
fileEdges: [...this.fileKinds.entries()].flatMap(([file, owners]) => [...owners.entries()].map(([owner, kinds]) => ({
|
|
572
|
+
file,
|
|
573
|
+
owner,
|
|
574
|
+
kinds: [...kinds].sort()
|
|
575
|
+
}))).sort((a, b) => a.file.localeCompare(b.file) || a.owner.localeCompare(b.owner))
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
#filterEdges(edges, kinds) {
|
|
579
|
+
if (!edges) return [];
|
|
580
|
+
const acceptedKinds = normalizeKinds(kinds);
|
|
581
|
+
return [...edges.entries()].filter(([, edgeKinds]) => !acceptedKinds || [...edgeKinds].some((kind) => acceptedKinds.has(kind))).map(([id]) => id);
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
|
|
434
585
|
// ../../dimina/fe/packages/compiler/src/env.js
|
|
435
586
|
var pathInfo = {};
|
|
436
587
|
var configInfo = {};
|
|
437
588
|
var npmResolver = null;
|
|
589
|
+
var dependencyGraph = new DependencyGraph();
|
|
438
590
|
var DEFAULT_TEMPLATE_EXTS = [".wxml", ".ddml"];
|
|
591
|
+
var DEFAULT_TEMPLATE_DIRECTIVE_PREFIXES = ["wx", "dd", "a"];
|
|
439
592
|
var DEFAULT_STYLE_EXTS = [".wxss", ".ddss", ".less", ".scss", ".sass"];
|
|
440
593
|
var DEFAULT_VIEW_SCRIPT_EXTS = [".wxs"];
|
|
441
594
|
var DEFAULT_VIEW_SCRIPT_TAGS = ["wxs", "dds"];
|
|
@@ -490,29 +643,38 @@ function mergeUnique(builtins, custom, normalizer, reserved) {
|
|
|
490
643
|
}
|
|
491
644
|
function normalizeFileTypes(fileTypes = {}) {
|
|
492
645
|
const ft = fileTypes || {};
|
|
646
|
+
const templateExts = mergeUnique(DEFAULT_TEMPLATE_EXTS, ft.template, normalizeExt, RESERVED_EXTS);
|
|
493
647
|
return {
|
|
494
|
-
templateExts
|
|
648
|
+
templateExts,
|
|
649
|
+
templateDirectivePrefixes: [.../* @__PURE__ */ new Set([...DEFAULT_TEMPLATE_DIRECTIVE_PREFIXES, ...templateExts.map((extension) => {
|
|
650
|
+
const name = extension.slice(1);
|
|
651
|
+
return name.endsWith("ml") ? name.slice(0, -2) : name;
|
|
652
|
+
}).filter(Boolean)])],
|
|
495
653
|
styleExts: mergeUnique(DEFAULT_STYLE_EXTS, ft.style, normalizeExt, RESERVED_EXTS),
|
|
496
654
|
viewScriptExts: mergeUnique(DEFAULT_VIEW_SCRIPT_EXTS, ft.viewScript, normalizeExt, RESERVED_EXTS),
|
|
497
655
|
viewScriptTags: mergeUnique(DEFAULT_VIEW_SCRIPT_TAGS, ft.viewScript, normalizeTag)
|
|
498
656
|
};
|
|
499
657
|
}
|
|
500
658
|
function storeInfo(workPath, options = {}) {
|
|
659
|
+
compilerOptions = normalizeFileTypes(options.fileTypes);
|
|
501
660
|
storePathInfo(workPath);
|
|
502
661
|
storeProjectConfig();
|
|
503
662
|
storeAppConfig();
|
|
504
663
|
storePageConfig();
|
|
505
|
-
|
|
664
|
+
dependencyGraph = createInitialDependencyGraph();
|
|
665
|
+
dependencyGraph.merge(options.dependencyGraph);
|
|
506
666
|
return {
|
|
507
667
|
pathInfo,
|
|
508
668
|
configInfo,
|
|
509
|
-
compilerOptions
|
|
669
|
+
compilerOptions,
|
|
670
|
+
dependencyGraph: dependencyGraph.toJSON()
|
|
510
671
|
};
|
|
511
672
|
}
|
|
512
673
|
function resetStoreInfo(opts) {
|
|
513
674
|
pathInfo = opts.pathInfo;
|
|
514
675
|
configInfo = opts.configInfo;
|
|
515
676
|
compilerOptions = opts.compilerOptions || normalizeFileTypes();
|
|
677
|
+
dependencyGraph = new DependencyGraph(opts.dependencyGraph);
|
|
516
678
|
if (pathInfo.workPath) {
|
|
517
679
|
npmResolver = new NpmResolver(pathInfo.workPath);
|
|
518
680
|
}
|
|
@@ -520,6 +682,9 @@ function resetStoreInfo(opts) {
|
|
|
520
682
|
function getTemplateExts() {
|
|
521
683
|
return compilerOptions.templateExts;
|
|
522
684
|
}
|
|
685
|
+
function getTemplateDirectivePrefixes() {
|
|
686
|
+
return compilerOptions.templateDirectivePrefixes || normalizeFileTypes({ template: compilerOptions.templateExts }).templateDirectivePrefixes;
|
|
687
|
+
}
|
|
523
688
|
function getStyleExts() {
|
|
524
689
|
return compilerOptions.styleExts;
|
|
525
690
|
}
|
|
@@ -529,13 +694,16 @@ function getViewScriptExts() {
|
|
|
529
694
|
function getViewScriptTags() {
|
|
530
695
|
return compilerOptions.viewScriptTags;
|
|
531
696
|
}
|
|
697
|
+
function getDependencyGraph() {
|
|
698
|
+
return dependencyGraph;
|
|
699
|
+
}
|
|
532
700
|
function storePathInfo(workPath) {
|
|
533
701
|
pathInfo.workPath = workPath;
|
|
534
702
|
if (process2.env.TARGET_PATH) {
|
|
535
703
|
pathInfo.targetPath = process2.env.TARGET_PATH;
|
|
536
704
|
} else {
|
|
537
705
|
const tempDir = process2.env.GITHUB_WORKSPACE || os.tmpdir();
|
|
538
|
-
const targetDir =
|
|
706
|
+
const targetDir = path5.join(tempDir, `dimina-fe-dist-${Date.now()}`);
|
|
539
707
|
if (!fs3.existsSync(targetDir)) {
|
|
540
708
|
fs3.mkdirSync(targetDir, { recursive: true });
|
|
541
709
|
}
|
|
@@ -579,11 +747,11 @@ function storeAppConfig() {
|
|
|
579
747
|
}
|
|
580
748
|
configInfo.appInfo = newObj;
|
|
581
749
|
}
|
|
582
|
-
function getContentByPath(
|
|
583
|
-
return fs3.readFileSync(
|
|
750
|
+
function getContentByPath(path6) {
|
|
751
|
+
return fs3.readFileSync(path6, { encoding: "utf-8" });
|
|
584
752
|
}
|
|
585
|
-
function parseContentByPath(
|
|
586
|
-
return JSON.parse(getContentByPath(
|
|
753
|
+
function parseContentByPath(path6) {
|
|
754
|
+
return JSON.parse(getContentByPath(path6));
|
|
587
755
|
}
|
|
588
756
|
function storePageConfig() {
|
|
589
757
|
const { pages, subPackages } = configInfo.appInfo;
|
|
@@ -606,7 +774,7 @@ function storeCustomTabBarConfig() {
|
|
|
606
774
|
if (tabBar?.custom !== true || !Array.isArray(tabBar.list)) {
|
|
607
775
|
return;
|
|
608
776
|
}
|
|
609
|
-
const componentJsonPath =
|
|
777
|
+
const componentJsonPath = path5.join(pathInfo.workPath, "custom-tab-bar/index.json");
|
|
610
778
|
if (!fs3.existsSync(componentJsonPath)) {
|
|
611
779
|
console.warn("[env] tabBar.custom \u5DF2\u542F\u7528\uFF0C\u4F46\u627E\u4E0D\u5230 custom-tab-bar/index.json");
|
|
612
780
|
return;
|
|
@@ -617,7 +785,7 @@ function storeCustomTabBarConfig() {
|
|
|
617
785
|
[dependencyName]: CUSTOM_TAB_BAR_COMPONENT_PATH
|
|
618
786
|
}
|
|
619
787
|
};
|
|
620
|
-
storeComponentConfig(internalConfig,
|
|
788
|
+
storeComponentConfig(internalConfig, path5.join(pathInfo.workPath, "app.json"));
|
|
621
789
|
const componentConfig = configInfo.componentInfo[CUSTOM_TAB_BAR_COMPONENT_PATH];
|
|
622
790
|
if (componentConfig) {
|
|
623
791
|
componentConfig.customTabBar = true;
|
|
@@ -674,12 +842,12 @@ function storeComponentConfig(pageJsonContent, pageFilePath) {
|
|
|
674
842
|
if (configInfo.componentInfo[moduleId]) {
|
|
675
843
|
continue;
|
|
676
844
|
}
|
|
677
|
-
let componentFilePath =
|
|
845
|
+
let componentFilePath = path5.resolve(getWorkPath(), `./${moduleId}.json`);
|
|
678
846
|
let cContent = null;
|
|
679
847
|
if (fs3.existsSync(componentFilePath)) {
|
|
680
848
|
cContent = parseContentByPath(componentFilePath);
|
|
681
849
|
} else {
|
|
682
|
-
const indexJsonPath =
|
|
850
|
+
const indexJsonPath = path5.resolve(getWorkPath(), `./${moduleId}/index.json`);
|
|
683
851
|
if (fs3.existsSync(indexJsonPath)) {
|
|
684
852
|
componentFilePath = indexJsonPath;
|
|
685
853
|
cContent = parseContentByPath(componentFilePath);
|
|
@@ -708,7 +876,8 @@ function storeComponentConfig(pageJsonContent, pageFilePath) {
|
|
|
708
876
|
path: moduleId,
|
|
709
877
|
component: isComponent,
|
|
710
878
|
styleIsolation,
|
|
711
|
-
usingComponents: cComponents
|
|
879
|
+
usingComponents: cComponents,
|
|
880
|
+
componentPlaceholder: { ...cContent.componentPlaceholder || {} }
|
|
712
881
|
};
|
|
713
882
|
if (cContent.usingComponents && Object.keys(cContent.usingComponents).length > 0) {
|
|
714
883
|
storeComponentConfig(configInfo.componentInfo[moduleId], componentFilePath);
|
|
@@ -839,16 +1008,17 @@ function transSubDir(name) {
|
|
|
839
1008
|
function getPages() {
|
|
840
1009
|
const { pages, subPackages = [], usingComponents: globalComponents = {} } = getAppConfigInfo();
|
|
841
1010
|
const pageInfo = getPageConfigInfo();
|
|
842
|
-
const mainPages = pages.map((
|
|
843
|
-
const pageComponents = pageInfo[
|
|
1011
|
+
const mainPages = pages.map((path6) => {
|
|
1012
|
+
const pageComponents = pageInfo[path6]?.usingComponents || {};
|
|
844
1013
|
const mergedComponents = { ...globalComponents, ...pageComponents };
|
|
845
1014
|
return {
|
|
846
|
-
id: uuid(
|
|
847
|
-
path:
|
|
1015
|
+
id: uuid(path6),
|
|
1016
|
+
path: path6,
|
|
848
1017
|
appStyleScopeId: getAppStyleScopeId(),
|
|
849
1018
|
sharedStyleScopeIds: collectSharedStyleScopeIds(mergedComponents),
|
|
850
1019
|
usingComponents: mergedComponents,
|
|
851
|
-
|
|
1020
|
+
componentPlaceholder: { ...pageInfo[path6]?.componentPlaceholder || {} },
|
|
1021
|
+
customTabBar: pageInfo[path6]?.customTabBar
|
|
852
1022
|
};
|
|
853
1023
|
});
|
|
854
1024
|
const subPages = {};
|
|
@@ -857,8 +1027,8 @@ function getPages() {
|
|
|
857
1027
|
const independent = subPkg.independent ? subPkg.independent : false;
|
|
858
1028
|
subPages[transSubDir(rootPath)] = {
|
|
859
1029
|
independent,
|
|
860
|
-
info: subPkg.pages.map((
|
|
861
|
-
const fullPath = rootPath +
|
|
1030
|
+
info: subPkg.pages.map((path6) => {
|
|
1031
|
+
const fullPath = rootPath + path6;
|
|
862
1032
|
const pageComponents = pageInfo[fullPath]?.usingComponents || {};
|
|
863
1033
|
const mergedComponents = { ...globalComponents, ...pageComponents };
|
|
864
1034
|
return {
|
|
@@ -867,6 +1037,7 @@ function getPages() {
|
|
|
867
1037
|
appStyleScopeId: getAppStyleScopeId(),
|
|
868
1038
|
sharedStyleScopeIds: collectSharedStyleScopeIds(mergedComponents),
|
|
869
1039
|
usingComponents: mergedComponents,
|
|
1040
|
+
componentPlaceholder: { ...pageInfo[fullPath]?.componentPlaceholder || {} },
|
|
870
1041
|
customTabBar: pageInfo[fullPath]?.customTabBar
|
|
871
1042
|
};
|
|
872
1043
|
})
|
|
@@ -877,6 +1048,92 @@ function getPages() {
|
|
|
877
1048
|
subPages
|
|
878
1049
|
};
|
|
879
1050
|
}
|
|
1051
|
+
function addExistingModuleFiles(graph, moduleId) {
|
|
1052
|
+
const relativeId = moduleId.replace(/^\/+/, "");
|
|
1053
|
+
const basePath = path5.resolve(getWorkPath(), relativeId);
|
|
1054
|
+
const baseCandidates = [basePath, path5.join(basePath, "index")];
|
|
1055
|
+
const extensions = [
|
|
1056
|
+
".json",
|
|
1057
|
+
".js",
|
|
1058
|
+
".ts",
|
|
1059
|
+
...getTemplateExts(),
|
|
1060
|
+
...getStyleExts(),
|
|
1061
|
+
...getViewScriptExts()
|
|
1062
|
+
];
|
|
1063
|
+
for (const candidateBase of baseCandidates) {
|
|
1064
|
+
for (const extension of extensions) {
|
|
1065
|
+
const filePath = `${candidateBase}${extension}`;
|
|
1066
|
+
if (fs3.existsSync(filePath)) {
|
|
1067
|
+
graph.addFile(moduleId, filePath, getFileDependencyKind(filePath));
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
function getFileDependencyKind(filePath) {
|
|
1073
|
+
const extension = path5.extname(filePath).toLowerCase();
|
|
1074
|
+
if (extension === ".json") return "config";
|
|
1075
|
+
if (extension === ".js" || extension === ".ts") return "logic";
|
|
1076
|
+
if (getTemplateExts().includes(extension) || getViewScriptExts().includes(extension)) return "view";
|
|
1077
|
+
if (getStyleExts().includes(extension)) return "style";
|
|
1078
|
+
return "module";
|
|
1079
|
+
}
|
|
1080
|
+
function createInitialDependencyGraph() {
|
|
1081
|
+
const graph = new DependencyGraph();
|
|
1082
|
+
graph.addNode("app", { type: "app" });
|
|
1083
|
+
for (const fileName of [
|
|
1084
|
+
"app.json",
|
|
1085
|
+
"app.js",
|
|
1086
|
+
"app.ts",
|
|
1087
|
+
"project.config.json",
|
|
1088
|
+
"project.private.config.json"
|
|
1089
|
+
]) {
|
|
1090
|
+
const filePath = path5.resolve(getWorkPath(), fileName);
|
|
1091
|
+
if (fs3.existsSync(filePath)) {
|
|
1092
|
+
graph.addFile("app", filePath, getFileDependencyKind(filePath));
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
addExistingModuleFiles(graph, "app");
|
|
1096
|
+
for (const item of getAppConfigInfo().tabBar?.list || []) {
|
|
1097
|
+
for (const field of ["iconPath", "selectedIconPath"]) {
|
|
1098
|
+
if (!item[field]) continue;
|
|
1099
|
+
const assetPath = resolveAssetSourcePath(getWorkPath(), "", item[field]);
|
|
1100
|
+
if (fs3.existsSync(assetPath)) {
|
|
1101
|
+
graph.addFile("app", assetPath, "config");
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
for (const component of Object.values(configInfo.componentInfo || {})) {
|
|
1106
|
+
graph.addNode(component.path, { type: "component" });
|
|
1107
|
+
addExistingModuleFiles(graph, component.path);
|
|
1108
|
+
}
|
|
1109
|
+
for (const component of Object.values(configInfo.componentInfo || {})) {
|
|
1110
|
+
for (const dependencyPath of Object.values(component.usingComponents || {})) {
|
|
1111
|
+
graph.addDependency(component.path, dependencyPath, "component");
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
const pages = getPages();
|
|
1115
|
+
const addEntry = (page, packageRoot) => {
|
|
1116
|
+
graph.addNode(page.path, {
|
|
1117
|
+
type: "page",
|
|
1118
|
+
entry: true,
|
|
1119
|
+
packageRoot
|
|
1120
|
+
});
|
|
1121
|
+
addExistingModuleFiles(graph, page.path);
|
|
1122
|
+
graph.addDependency(page.path, "app", "app");
|
|
1123
|
+
for (const dependencyPath of Object.values(page.usingComponents || {})) {
|
|
1124
|
+
graph.addDependency(page.path, dependencyPath, "component");
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
for (const page of pages.mainPages) {
|
|
1128
|
+
addEntry(page, null);
|
|
1129
|
+
}
|
|
1130
|
+
for (const [packageRoot, subPackage] of Object.entries(pages.subPages)) {
|
|
1131
|
+
for (const page of subPackage.info) {
|
|
1132
|
+
addEntry(page, packageRoot);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
return graph;
|
|
1136
|
+
}
|
|
880
1137
|
function collectSharedStyleScopeIds(usingComponents) {
|
|
881
1138
|
const result = [];
|
|
882
1139
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -911,6 +1168,7 @@ export {
|
|
|
911
1168
|
toMiniProgramModuleId,
|
|
912
1169
|
hasCompileInfo,
|
|
913
1170
|
getAbsolutePath,
|
|
1171
|
+
resolveAssetSourcePath,
|
|
914
1172
|
collectAssets,
|
|
915
1173
|
transformRpx,
|
|
916
1174
|
tagWhiteList,
|
|
@@ -919,9 +1177,11 @@ export {
|
|
|
919
1177
|
storeInfo,
|
|
920
1178
|
resetStoreInfo,
|
|
921
1179
|
getTemplateExts,
|
|
1180
|
+
getTemplateDirectivePrefixes,
|
|
922
1181
|
getStyleExts,
|
|
923
1182
|
getViewScriptExts,
|
|
924
1183
|
getViewScriptTags,
|
|
1184
|
+
getDependencyGraph,
|
|
925
1185
|
getContentByPath,
|
|
926
1186
|
resolveAppAlias,
|
|
927
1187
|
getTargetPath,
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isMainThread
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VHWKAXDL.js";
|
|
4
4
|
import {
|
|
5
5
|
__commonJS,
|
|
6
6
|
__toESM,
|
|
7
|
+
getTemplateDirectivePrefixes,
|
|
7
8
|
getViewScriptTags,
|
|
8
9
|
miniProgramBuiltinTags,
|
|
9
10
|
tagWhiteList
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CKQISGZS.js";
|
|
11
12
|
|
|
12
13
|
// ../../dimina/fe/node_modules/.pnpm/@vue+shared@3.5.40/node_modules/@vue/shared/dist/shared.cjs.prod.js
|
|
13
14
|
var require_shared_cjs_prod = __commonJS({
|
|
@@ -1395,6 +1396,8 @@ var supportedWxApis = [
|
|
|
1395
1396
|
"hideKeyboard",
|
|
1396
1397
|
"getNetworkType",
|
|
1397
1398
|
"makePhoneCall",
|
|
1399
|
+
"onUserCaptureScreen",
|
|
1400
|
+
"offUserCaptureScreen",
|
|
1398
1401
|
"extBridge",
|
|
1399
1402
|
"extOnBridge",
|
|
1400
1403
|
"extOffBridge"
|
|
@@ -1404,6 +1407,61 @@ var supportedWxApis = [
|
|
|
1404
1407
|
var cachedReference = null;
|
|
1405
1408
|
var warnedItems = /* @__PURE__ */ new Set();
|
|
1406
1409
|
var pendingWarnings = [];
|
|
1410
|
+
var TEMPLATE_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
|
|
1411
|
+
"if",
|
|
1412
|
+
"elif",
|
|
1413
|
+
"else",
|
|
1414
|
+
"for",
|
|
1415
|
+
"for-items",
|
|
1416
|
+
"for-item",
|
|
1417
|
+
"for-index",
|
|
1418
|
+
"key"
|
|
1419
|
+
]);
|
|
1420
|
+
var KNOWN_NON_TEMPLATE_PREFIXES = /* @__PURE__ */ new Set([
|
|
1421
|
+
"model",
|
|
1422
|
+
"change",
|
|
1423
|
+
"worklet",
|
|
1424
|
+
"data",
|
|
1425
|
+
"class",
|
|
1426
|
+
"style",
|
|
1427
|
+
"bind",
|
|
1428
|
+
"mut-bind",
|
|
1429
|
+
"catch",
|
|
1430
|
+
"capture-bind",
|
|
1431
|
+
"capture-mut-bind",
|
|
1432
|
+
"capture-catch",
|
|
1433
|
+
"mark",
|
|
1434
|
+
"generic",
|
|
1435
|
+
"extra-attr",
|
|
1436
|
+
"slot",
|
|
1437
|
+
"let"
|
|
1438
|
+
]);
|
|
1439
|
+
function splitAttributePrefix(attributeName) {
|
|
1440
|
+
const segments = attributeName.split(":");
|
|
1441
|
+
if (segments.length !== 2 || !segments[0] || !segments[1]) {
|
|
1442
|
+
return null;
|
|
1443
|
+
}
|
|
1444
|
+
return { prefix: segments[0], name: segments[1] };
|
|
1445
|
+
}
|
|
1446
|
+
function getTemplateDirectiveName(attributeName) {
|
|
1447
|
+
const attribute = splitAttributePrefix(attributeName);
|
|
1448
|
+
if (!attribute || !getTemplateDirectivePrefixes().includes(attribute.prefix)) {
|
|
1449
|
+
return null;
|
|
1450
|
+
}
|
|
1451
|
+
return TEMPLATE_DIRECTIVE_NAMES.has(attribute.name) ? attribute.name : null;
|
|
1452
|
+
}
|
|
1453
|
+
function getInvalidAttributePrefix(attributeName) {
|
|
1454
|
+
const attribute = splitAttributePrefix(attributeName);
|
|
1455
|
+
if (!attribute) return null;
|
|
1456
|
+
const templatePrefixes = getTemplateDirectivePrefixes();
|
|
1457
|
+
if (templatePrefixes.includes(attribute.prefix)) {
|
|
1458
|
+
return TEMPLATE_DIRECTIVE_NAMES.has(attribute.name) ? null : attribute.prefix;
|
|
1459
|
+
}
|
|
1460
|
+
if (KNOWN_NON_TEMPLATE_PREFIXES.has(attribute.prefix)) {
|
|
1461
|
+
return null;
|
|
1462
|
+
}
|
|
1463
|
+
return attribute.prefix;
|
|
1464
|
+
}
|
|
1407
1465
|
function loadReference() {
|
|
1408
1466
|
if (cachedReference) {
|
|
1409
1467
|
return cachedReference;
|
|
@@ -1452,11 +1510,23 @@ function checkTemplateCompatibility(content, filePath, components = {}) {
|
|
|
1452
1510
|
let parser;
|
|
1453
1511
|
parser = new Parser(
|
|
1454
1512
|
{
|
|
1455
|
-
onopentag(tagName) {
|
|
1513
|
+
onopentag(tagName, attrs) {
|
|
1514
|
+
const line = getLineByIndex(content, parser.startIndex);
|
|
1515
|
+
for (const attributeName of Object.keys(attrs)) {
|
|
1516
|
+
const invalidPrefix = getInvalidAttributePrefix(attributeName);
|
|
1517
|
+
if (invalidPrefix) {
|
|
1518
|
+
const location = formatLocation(filePath, line);
|
|
1519
|
+
warnOnce(
|
|
1520
|
+
"template-prefix",
|
|
1521
|
+
attributeName,
|
|
1522
|
+
location,
|
|
1523
|
+
`[compat] Invalid template attribute prefix: ${invalidPrefix}: (${attributeName})${location}`
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1456
1527
|
if (components?.[tagName]) {
|
|
1457
1528
|
return;
|
|
1458
1529
|
}
|
|
1459
|
-
const line = getLineByIndex(content, parser.startIndex);
|
|
1460
1530
|
warnUnsupportedComponent(tagName, filePath, line);
|
|
1461
1531
|
},
|
|
1462
1532
|
onerror(error) {
|
|
@@ -1513,6 +1583,7 @@ function takeCompatibilityWarnings() {
|
|
|
1513
1583
|
}
|
|
1514
1584
|
|
|
1515
1585
|
export {
|
|
1586
|
+
getTemplateDirectiveName,
|
|
1516
1587
|
getWxMemberName,
|
|
1517
1588
|
warnUnsupportedWxApi,
|
|
1518
1589
|
checkTemplateCompatibility,
|