@dimina-kit/compiler 0.0.2-dev.20260728065133 → 0.0.2-dev.20260728095034
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 +14759 -16081
- package/dist/compile-core.node-chunks/chunk-2VRS523Z.js +8 -0
- package/dist/compile-core.node-chunks/chunk-LUD2P6RM.js +211 -0
- package/dist/compile-core.node-chunks/{chunk-M62ZDT7T.js → chunk-QJ34C5KK.js} +66 -542
- package/dist/compile-core.node-chunks/{logic-compiler-AEZPY2MO.js → logic-compiler-2SQFOFEO.js} +113 -37
- package/dist/compile-core.node-chunks/style-compiler-ZEJ3XLTS.js +277 -0
- package/dist/compile-core.node-chunks/{view-compiler-2SMUHAPD.js → view-compiler-WQNV7H5G.js} +161 -425
- package/dist/compile-core.node.js +6 -11
- package/dist/pool.node-chunks/{chunk-CKQISGZS.js → chunk-7FGOYOXU.js} +66 -542
- package/dist/pool.node-chunks/chunk-C7GEIDCP.js +211 -0
- package/dist/pool.node-chunks/chunk-KLXXOLDF.js +8 -0
- package/dist/pool.node-chunks/{chunk-WX4462A5.js → chunk-PDHO4Y56.js} +6 -11
- package/dist/pool.node-chunks/{logic-compiler-P4T4OMTG.js → logic-compiler-BODAINZQ.js} +113 -37
- package/dist/pool.node-chunks/style-compiler-TUNDVSR5.js +277 -0
- package/dist/pool.node-chunks/{view-compiler-2D7HPYIN.js → view-compiler-HOFFL63K.js} +161 -425
- package/dist/pool.node.js +2 -2
- package/dist/stage-worker.browser.js +1940 -3262
- package/dist/stage-worker.node.js +2 -2
- package/package.json +3 -3
- package/dist/compile-core.node-chunks/chunk-23PCGQQU.js +0 -141
- package/dist/compile-core.node-chunks/chunk-QYHGF3MS.js +0 -1601
- package/dist/compile-core.node-chunks/style-compiler-4PHMBQIC.js +0 -470
- package/dist/pool.node-chunks/chunk-LGB3AH5C.js +0 -1601
- package/dist/pool.node-chunks/chunk-VHWKAXDL.js +0 -141
- package/dist/pool.node-chunks/style-compiler-W7EA2Y7R.js +0 -470
|
@@ -1,67 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
try {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
} catch (e) {
|
|
11
|
-
throw mod = 0, e;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
-
mod
|
|
29
|
-
));
|
|
30
|
-
|
|
31
|
-
// ../../dimina/fe/packages/compiler/src/common/path-utils.js
|
|
32
|
-
import path from "node:path";
|
|
33
|
-
var WINDOWS_FS_PATH_RE = /^(?:[a-zA-Z]:[\\/]|\\\\)/;
|
|
34
|
-
function isWindowsFsPath(targetPath) {
|
|
35
|
-
return typeof targetPath === "string" && (WINDOWS_FS_PATH_RE.test(targetPath) || targetPath.includes("\\"));
|
|
36
|
-
}
|
|
37
|
-
function getFsPathApi(targetPath) {
|
|
38
|
-
return isWindowsFsPath(targetPath) ? path.win32 : path.posix;
|
|
39
|
-
}
|
|
40
|
-
function normalizeToPosixPath(targetPath) {
|
|
41
|
-
return targetPath.replace(/\\/g, "/");
|
|
42
|
-
}
|
|
43
|
-
function resolveMiniProgramPath(workPath, importerPath, sourcePath) {
|
|
44
|
-
const pathApi = getFsPathApi(importerPath || workPath);
|
|
45
|
-
return sourcePath.startsWith("/") ? pathApi.join(workPath, sourcePath) : pathApi.resolve(pathApi.dirname(importerPath), sourcePath);
|
|
46
|
-
}
|
|
47
|
-
function toMiniProgramModuleId(resolvedPath, workPath) {
|
|
48
|
-
const normalizedResolvedPath = normalizeToPosixPath(resolvedPath);
|
|
49
|
-
const normalizedWorkPath = normalizeToPosixPath(workPath);
|
|
50
|
-
let moduleId = normalizedResolvedPath.startsWith(normalizedWorkPath) ? normalizedResolvedPath.slice(normalizedWorkPath.length) : normalizedResolvedPath;
|
|
51
|
-
moduleId = moduleId.replace(/\/+/g, "/");
|
|
52
|
-
if (!moduleId.startsWith("/")) {
|
|
53
|
-
moduleId = `/${moduleId}`;
|
|
54
|
-
}
|
|
55
|
-
return moduleId;
|
|
56
|
-
}
|
|
57
|
-
function getRelativePosixPath(targetPath, rootPath) {
|
|
58
|
-
return normalizeToPosixPath(targetPath).replace(normalizeToPosixPath(rootPath), "").replace(/^\//, "");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
1
|
// ../../dimina/fe/packages/compiler/src/common/utils.js
|
|
62
|
-
import crypto from "node:crypto";
|
|
63
2
|
import fs from "node:fs";
|
|
64
|
-
import
|
|
3
|
+
import path from "node:path";
|
|
65
4
|
import process from "node:process";
|
|
66
5
|
function hasCompileInfo(modulePath, list, preList) {
|
|
67
6
|
const mergeList = Array.isArray(preList) ? [...preList, ...list] : list;
|
|
@@ -74,34 +13,17 @@ function hasCompileInfo(modulePath, list, preList) {
|
|
|
74
13
|
}
|
|
75
14
|
function getAbsolutePath(workPath, pagePath, src) {
|
|
76
15
|
if (src.startsWith("/")) {
|
|
77
|
-
return
|
|
16
|
+
return path.join(workPath, src);
|
|
78
17
|
}
|
|
79
18
|
if (pagePath.includes("/miniprogram_npm/")) {
|
|
80
19
|
const componentDir = pagePath.split("/").slice(0, -1).join("/");
|
|
81
20
|
const componentFullPath = workPath + componentDir;
|
|
82
|
-
return
|
|
21
|
+
return path.resolve(componentFullPath, src);
|
|
83
22
|
}
|
|
84
23
|
const relativePath = pagePath.split("/").filter((part) => part !== "").slice(0, -1).join("/");
|
|
85
|
-
return
|
|
24
|
+
return path.resolve(workPath, relativePath, src);
|
|
86
25
|
}
|
|
87
26
|
var assetsMap = {};
|
|
88
|
-
function isPathInside(rootPath, targetPath) {
|
|
89
|
-
const relativePath = path2.relative(rootPath, targetPath);
|
|
90
|
-
return relativePath === "" || !relativePath.startsWith(`..${path2.sep}`) && relativePath !== ".." && !path2.isAbsolute(relativePath);
|
|
91
|
-
}
|
|
92
|
-
function resolveAssetSourcePath(workPath, pagePath, src) {
|
|
93
|
-
const projectRoot = path2.resolve(workPath);
|
|
94
|
-
if (src.startsWith("/")) {
|
|
95
|
-
return path2.resolve(projectRoot, `.${src}`);
|
|
96
|
-
}
|
|
97
|
-
const normalizedPagePath = path2.resolve(pagePath);
|
|
98
|
-
const pageDirectory = path2.isAbsolute(pagePath) && isPathInside(projectRoot, normalizedPagePath) ? path2.dirname(normalizedPagePath) : path2.resolve(projectRoot, path2.dirname(pagePath.replace(/^[/\\]+/, "")));
|
|
99
|
-
const resolvedPath = path2.resolve(pageDirectory, src);
|
|
100
|
-
if (isPathInside(projectRoot, resolvedPath)) {
|
|
101
|
-
return resolvedPath;
|
|
102
|
-
}
|
|
103
|
-
return path2.resolve(projectRoot, src.replace(/^(?:\.\.[/\\])+/, ""));
|
|
104
|
-
}
|
|
105
27
|
function collectAssets(workPath, pagePath, src, targetPath, appId) {
|
|
106
28
|
if (src.startsWith("http") || src.startsWith("//")) {
|
|
107
29
|
return src;
|
|
@@ -109,20 +31,21 @@ function collectAssets(workPath, pagePath, src, targetPath, appId) {
|
|
|
109
31
|
if (!/\.(?:png|jpe?g|gif|svg)(?:\?.*)?$/.test(src)) {
|
|
110
32
|
return src;
|
|
111
33
|
}
|
|
112
|
-
const
|
|
34
|
+
const relativePath = pagePath.split("/").slice(0, -1).join("/");
|
|
35
|
+
const absolutePath = src.startsWith("/") ? workPath + src : path.resolve(workPath, relativePath, src);
|
|
113
36
|
if (assetsMap[absolutePath]) {
|
|
114
37
|
return assetsMap[absolutePath];
|
|
115
38
|
}
|
|
116
39
|
try {
|
|
117
40
|
const ext = `.${src.split(".").pop()}`;
|
|
118
|
-
const dirPath = absolutePath.split(
|
|
119
|
-
const prefix = uuid(
|
|
41
|
+
const dirPath = absolutePath.split(path.sep).slice(0, -1).join("/");
|
|
42
|
+
const prefix = uuid();
|
|
120
43
|
const targetStatic = `${targetPath}/main/static`;
|
|
121
44
|
if (!fs.existsSync(targetStatic)) {
|
|
122
45
|
fs.mkdirSync(targetStatic, { recursive: true });
|
|
123
46
|
}
|
|
124
47
|
getFilesWithExtension(dirPath, ext).forEach((file) => {
|
|
125
|
-
fs.copyFileSync(
|
|
48
|
+
fs.copyFileSync(path.resolve(dirPath, file), `${targetStatic}/${prefix}_${file}`);
|
|
126
49
|
});
|
|
127
50
|
const filename = src.split("/").pop();
|
|
128
51
|
const pathPrefix = process.env.ASSETS_PATH_PREFIX ? "" : "/";
|
|
@@ -134,7 +57,7 @@ function collectAssets(workPath, pagePath, src, targetPath, appId) {
|
|
|
134
57
|
}
|
|
135
58
|
function getFilesWithExtension(directory, extension) {
|
|
136
59
|
const files = fs.readdirSync(directory);
|
|
137
|
-
const filteredFiles = files.filter((file) =>
|
|
60
|
+
const filteredFiles = files.filter((file) => path.extname(file) === extension);
|
|
138
61
|
return filteredFiles;
|
|
139
62
|
}
|
|
140
63
|
function isObjectEmpty(objectName) {
|
|
@@ -151,16 +74,15 @@ function transformRpx(styleText) {
|
|
|
151
74
|
return styleText;
|
|
152
75
|
}
|
|
153
76
|
return styleText.replace(/([+-]?\d+(?:\.\d+)?)rpx/g, (_, pixel) => {
|
|
154
|
-
|
|
155
|
-
return `${Object.is(viewportWidth, -0) ? 0 : viewportWidth}vw`;
|
|
77
|
+
return `${Number(pixel)}rem`;
|
|
156
78
|
});
|
|
157
79
|
}
|
|
158
|
-
function uuid(
|
|
159
|
-
return
|
|
80
|
+
function uuid() {
|
|
81
|
+
return Math.random().toString(36).slice(2, 7);
|
|
160
82
|
}
|
|
161
83
|
var tagWhiteList = [
|
|
162
84
|
"page",
|
|
163
|
-
"
|
|
85
|
+
"wrapper",
|
|
164
86
|
"block",
|
|
165
87
|
"button",
|
|
166
88
|
"camera",
|
|
@@ -201,24 +123,6 @@ var tagWhiteList = [
|
|
|
201
123
|
"view",
|
|
202
124
|
"web-view"
|
|
203
125
|
];
|
|
204
|
-
var miniProgramBuiltinTags = /* @__PURE__ */ new Set([
|
|
205
|
-
...tagWhiteList,
|
|
206
|
-
"canvas",
|
|
207
|
-
"match-media",
|
|
208
|
-
"page-container",
|
|
209
|
-
"share-element",
|
|
210
|
-
"editor",
|
|
211
|
-
"audio",
|
|
212
|
-
"channel-live",
|
|
213
|
-
"channel-video",
|
|
214
|
-
"live-player",
|
|
215
|
-
"live-pusher",
|
|
216
|
-
"voip-room",
|
|
217
|
-
"ad",
|
|
218
|
-
"ad-custom",
|
|
219
|
-
"official-account",
|
|
220
|
-
"xr-frame"
|
|
221
|
-
]);
|
|
222
126
|
function __resetAssets() {
|
|
223
127
|
for (const k of Object.keys(assetsMap)) delete assetsMap[k];
|
|
224
128
|
}
|
|
@@ -226,10 +130,38 @@ function __resetAssets() {
|
|
|
226
130
|
// ../../dimina/fe/packages/compiler/src/env.js
|
|
227
131
|
import fs3 from "node:fs";
|
|
228
132
|
import os from "node:os";
|
|
229
|
-
import
|
|
133
|
+
import path4 from "node:path";
|
|
230
134
|
import process2 from "node:process";
|
|
231
|
-
|
|
232
|
-
|
|
135
|
+
|
|
136
|
+
// ../../dimina/fe/packages/compiler/src/common/path-utils.js
|
|
137
|
+
import path2 from "node:path";
|
|
138
|
+
var WINDOWS_FS_PATH_RE = /^(?:[a-zA-Z]:[\\/]|\\\\)/;
|
|
139
|
+
function isWindowsFsPath(targetPath) {
|
|
140
|
+
return typeof targetPath === "string" && (WINDOWS_FS_PATH_RE.test(targetPath) || targetPath.includes("\\"));
|
|
141
|
+
}
|
|
142
|
+
function getFsPathApi(targetPath) {
|
|
143
|
+
return isWindowsFsPath(targetPath) ? path2.win32 : path2.posix;
|
|
144
|
+
}
|
|
145
|
+
function normalizeToPosixPath(targetPath) {
|
|
146
|
+
return targetPath.replace(/\\/g, "/");
|
|
147
|
+
}
|
|
148
|
+
function resolveMiniProgramPath(workPath, importerPath, sourcePath) {
|
|
149
|
+
const pathApi = getFsPathApi(importerPath || workPath);
|
|
150
|
+
return sourcePath.startsWith("/") ? pathApi.join(workPath, sourcePath) : pathApi.resolve(pathApi.dirname(importerPath), sourcePath);
|
|
151
|
+
}
|
|
152
|
+
function toMiniProgramModuleId(resolvedPath, workPath) {
|
|
153
|
+
const normalizedResolvedPath = normalizeToPosixPath(resolvedPath);
|
|
154
|
+
const normalizedWorkPath = normalizeToPosixPath(workPath);
|
|
155
|
+
let moduleId = normalizedResolvedPath.startsWith(normalizedWorkPath) ? normalizedResolvedPath.slice(normalizedWorkPath.length) : normalizedResolvedPath;
|
|
156
|
+
moduleId = moduleId.replace(/\/+/g, "/");
|
|
157
|
+
if (!moduleId.startsWith("/")) {
|
|
158
|
+
moduleId = `/${moduleId}`;
|
|
159
|
+
}
|
|
160
|
+
return moduleId;
|
|
161
|
+
}
|
|
162
|
+
function getRelativePosixPath(targetPath, rootPath) {
|
|
163
|
+
return normalizeToPosixPath(targetPath).replace(normalizeToPosixPath(rootPath), "").replace(/^\//, "");
|
|
164
|
+
}
|
|
233
165
|
|
|
234
166
|
// ../../dimina/fe/packages/compiler/src/common/npm-resolver.js
|
|
235
167
|
import fs2 from "node:fs";
|
|
@@ -431,173 +363,14 @@ var NpmResolver = class {
|
|
|
431
363
|
}
|
|
432
364
|
};
|
|
433
365
|
|
|
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
|
-
|
|
585
366
|
// ../../dimina/fe/packages/compiler/src/env.js
|
|
586
367
|
var pathInfo = {};
|
|
587
368
|
var configInfo = {};
|
|
588
369
|
var npmResolver = null;
|
|
589
|
-
var dependencyGraph = new DependencyGraph();
|
|
590
370
|
var DEFAULT_TEMPLATE_EXTS = [".wxml", ".ddml"];
|
|
591
|
-
var DEFAULT_TEMPLATE_DIRECTIVE_PREFIXES = ["wx", "dd", "a"];
|
|
592
371
|
var DEFAULT_STYLE_EXTS = [".wxss", ".ddss", ".less", ".scss", ".sass"];
|
|
593
372
|
var DEFAULT_VIEW_SCRIPT_EXTS = [".wxs"];
|
|
594
373
|
var DEFAULT_VIEW_SCRIPT_TAGS = ["wxs", "dds"];
|
|
595
|
-
var CUSTOM_TAB_BAR_COMPONENT_PATH = "/custom-tab-bar/index";
|
|
596
|
-
var STYLE_ISOLATION_VALUES = /* @__PURE__ */ new Set([
|
|
597
|
-
"isolated",
|
|
598
|
-
"apply-shared",
|
|
599
|
-
"shared"
|
|
600
|
-
]);
|
|
601
374
|
var RESERVED_EXTS = /* @__PURE__ */ new Set([
|
|
602
375
|
...DEFAULT_TEMPLATE_EXTS,
|
|
603
376
|
...DEFAULT_STYLE_EXTS,
|
|
@@ -643,38 +416,29 @@ function mergeUnique(builtins, custom, normalizer, reserved) {
|
|
|
643
416
|
}
|
|
644
417
|
function normalizeFileTypes(fileTypes = {}) {
|
|
645
418
|
const ft = fileTypes || {};
|
|
646
|
-
const templateExts = mergeUnique(DEFAULT_TEMPLATE_EXTS, ft.template, normalizeExt, RESERVED_EXTS);
|
|
647
419
|
return {
|
|
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)])],
|
|
420
|
+
templateExts: mergeUnique(DEFAULT_TEMPLATE_EXTS, ft.template, normalizeExt, RESERVED_EXTS),
|
|
653
421
|
styleExts: mergeUnique(DEFAULT_STYLE_EXTS, ft.style, normalizeExt, RESERVED_EXTS),
|
|
654
422
|
viewScriptExts: mergeUnique(DEFAULT_VIEW_SCRIPT_EXTS, ft.viewScript, normalizeExt, RESERVED_EXTS),
|
|
655
423
|
viewScriptTags: mergeUnique(DEFAULT_VIEW_SCRIPT_TAGS, ft.viewScript, normalizeTag)
|
|
656
424
|
};
|
|
657
425
|
}
|
|
658
426
|
function storeInfo(workPath, options = {}) {
|
|
659
|
-
compilerOptions = normalizeFileTypes(options.fileTypes);
|
|
660
427
|
storePathInfo(workPath);
|
|
661
428
|
storeProjectConfig();
|
|
662
429
|
storeAppConfig();
|
|
663
430
|
storePageConfig();
|
|
664
|
-
|
|
665
|
-
dependencyGraph.merge(options.dependencyGraph);
|
|
431
|
+
compilerOptions = normalizeFileTypes(options.fileTypes);
|
|
666
432
|
return {
|
|
667
433
|
pathInfo,
|
|
668
434
|
configInfo,
|
|
669
|
-
compilerOptions
|
|
670
|
-
dependencyGraph: dependencyGraph.toJSON()
|
|
435
|
+
compilerOptions
|
|
671
436
|
};
|
|
672
437
|
}
|
|
673
438
|
function resetStoreInfo(opts) {
|
|
674
439
|
pathInfo = opts.pathInfo;
|
|
675
440
|
configInfo = opts.configInfo;
|
|
676
441
|
compilerOptions = opts.compilerOptions || normalizeFileTypes();
|
|
677
|
-
dependencyGraph = new DependencyGraph(opts.dependencyGraph);
|
|
678
442
|
if (pathInfo.workPath) {
|
|
679
443
|
npmResolver = new NpmResolver(pathInfo.workPath);
|
|
680
444
|
}
|
|
@@ -682,9 +446,6 @@ function resetStoreInfo(opts) {
|
|
|
682
446
|
function getTemplateExts() {
|
|
683
447
|
return compilerOptions.templateExts;
|
|
684
448
|
}
|
|
685
|
-
function getTemplateDirectivePrefixes() {
|
|
686
|
-
return compilerOptions.templateDirectivePrefixes || normalizeFileTypes({ template: compilerOptions.templateExts }).templateDirectivePrefixes;
|
|
687
|
-
}
|
|
688
449
|
function getStyleExts() {
|
|
689
450
|
return compilerOptions.styleExts;
|
|
690
451
|
}
|
|
@@ -694,16 +455,13 @@ function getViewScriptExts() {
|
|
|
694
455
|
function getViewScriptTags() {
|
|
695
456
|
return compilerOptions.viewScriptTags;
|
|
696
457
|
}
|
|
697
|
-
function getDependencyGraph() {
|
|
698
|
-
return dependencyGraph;
|
|
699
|
-
}
|
|
700
458
|
function storePathInfo(workPath) {
|
|
701
459
|
pathInfo.workPath = workPath;
|
|
702
460
|
if (process2.env.TARGET_PATH) {
|
|
703
461
|
pathInfo.targetPath = process2.env.TARGET_PATH;
|
|
704
462
|
} else {
|
|
705
463
|
const tempDir = process2.env.GITHUB_WORKSPACE || os.tmpdir();
|
|
706
|
-
const targetDir =
|
|
464
|
+
const targetDir = path4.join(tempDir, `dimina-fe-dist-${Date.now()}`);
|
|
707
465
|
if (!fs3.existsSync(targetDir)) {
|
|
708
466
|
fs3.mkdirSync(targetDir, { recursive: true });
|
|
709
467
|
}
|
|
@@ -747,11 +505,11 @@ function storeAppConfig() {
|
|
|
747
505
|
}
|
|
748
506
|
configInfo.appInfo = newObj;
|
|
749
507
|
}
|
|
750
|
-
function getContentByPath(
|
|
751
|
-
return fs3.readFileSync(
|
|
508
|
+
function getContentByPath(path5) {
|
|
509
|
+
return fs3.readFileSync(path5, { encoding: "utf-8" });
|
|
752
510
|
}
|
|
753
|
-
function parseContentByPath(
|
|
754
|
-
return JSON.parse(getContentByPath(
|
|
511
|
+
function parseContentByPath(path5) {
|
|
512
|
+
return JSON.parse(getContentByPath(path5));
|
|
755
513
|
}
|
|
756
514
|
function storePageConfig() {
|
|
757
515
|
const { pages, subPackages } = configInfo.appInfo;
|
|
@@ -767,50 +525,6 @@ function storePageConfig() {
|
|
|
767
525
|
collectionPageJson(subPkg.pages, subPkg.root);
|
|
768
526
|
});
|
|
769
527
|
}
|
|
770
|
-
storeCustomTabBarConfig();
|
|
771
|
-
}
|
|
772
|
-
function storeCustomTabBarConfig() {
|
|
773
|
-
const tabBar = configInfo.appInfo?.tabBar;
|
|
774
|
-
if (tabBar?.custom !== true || !Array.isArray(tabBar.list)) {
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
const componentJsonPath = path5.join(pathInfo.workPath, "custom-tab-bar/index.json");
|
|
778
|
-
if (!fs3.existsSync(componentJsonPath)) {
|
|
779
|
-
console.warn("[env] tabBar.custom \u5DF2\u542F\u7528\uFF0C\u4F46\u627E\u4E0D\u5230 custom-tab-bar/index.json");
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
const dependencyName = `dimina-${uuid(CUSTOM_TAB_BAR_COMPONENT_PATH)}`;
|
|
783
|
-
const internalConfig = {
|
|
784
|
-
usingComponents: {
|
|
785
|
-
[dependencyName]: CUSTOM_TAB_BAR_COMPONENT_PATH
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
storeComponentConfig(internalConfig, path5.join(pathInfo.workPath, "app.json"));
|
|
789
|
-
const componentConfig = configInfo.componentInfo[CUSTOM_TAB_BAR_COMPONENT_PATH];
|
|
790
|
-
if (componentConfig) {
|
|
791
|
-
componentConfig.customTabBar = true;
|
|
792
|
-
}
|
|
793
|
-
for (const item of tabBar.list) {
|
|
794
|
-
const pagePath = typeof item?.pagePath === "string" ? item.pagePath.replace(/^\/+/, "") : "";
|
|
795
|
-
if (!pagePath || !configInfo.appInfo.pages?.includes(pagePath)) {
|
|
796
|
-
continue;
|
|
797
|
-
}
|
|
798
|
-
const pageConfig = configInfo.pageInfo[pagePath] ||= {};
|
|
799
|
-
pageConfig.usingComponents ||= {};
|
|
800
|
-
const declaredComponents = {
|
|
801
|
-
...configInfo.appInfo.usingComponents || {},
|
|
802
|
-
...pageConfig.usingComponents
|
|
803
|
-
};
|
|
804
|
-
const declaredEntry = Object.entries(declaredComponents).find(([, componentPath]) => componentPath === CUSTOM_TAB_BAR_COMPONENT_PATH);
|
|
805
|
-
let componentName = declaredEntry?.[0] || dependencyName;
|
|
806
|
-
let suffix = 0;
|
|
807
|
-
while (declaredComponents[componentName] && declaredComponents[componentName] !== CUSTOM_TAB_BAR_COMPONENT_PATH) {
|
|
808
|
-
suffix++;
|
|
809
|
-
componentName = `${dependencyName}-${suffix}`;
|
|
810
|
-
}
|
|
811
|
-
pageConfig.usingComponents[componentName] = CUSTOM_TAB_BAR_COMPONENT_PATH;
|
|
812
|
-
pageConfig.customTabBar = { componentName };
|
|
813
|
-
}
|
|
814
528
|
}
|
|
815
529
|
function collectionPageJson(pages, root) {
|
|
816
530
|
pages.forEach((pagePath) => {
|
|
@@ -842,12 +556,12 @@ function storeComponentConfig(pageJsonContent, pageFilePath) {
|
|
|
842
556
|
if (configInfo.componentInfo[moduleId]) {
|
|
843
557
|
continue;
|
|
844
558
|
}
|
|
845
|
-
let componentFilePath =
|
|
559
|
+
let componentFilePath = path4.resolve(getWorkPath(), `./${moduleId}.json`);
|
|
846
560
|
let cContent = null;
|
|
847
561
|
if (fs3.existsSync(componentFilePath)) {
|
|
848
562
|
cContent = parseContentByPath(componentFilePath);
|
|
849
563
|
} else {
|
|
850
|
-
const indexJsonPath =
|
|
564
|
+
const indexJsonPath = path4.resolve(getWorkPath(), `./${moduleId}/index.json`);
|
|
851
565
|
if (fs3.existsSync(indexJsonPath)) {
|
|
852
566
|
componentFilePath = indexJsonPath;
|
|
853
567
|
cContent = parseContentByPath(componentFilePath);
|
|
@@ -866,83 +580,21 @@ function storeComponentConfig(pageJsonContent, pageFilePath) {
|
|
|
866
580
|
}
|
|
867
581
|
const cUsing = cContent.usingComponents || {};
|
|
868
582
|
const isComponent = cContent.component || false;
|
|
869
|
-
const styleIsolation = resolveComponentStyleIsolation(cContent, componentFilePath);
|
|
870
583
|
const cComponents = Object.keys(cUsing).reduce((acc, key) => {
|
|
871
584
|
acc[key] = getModuleId(cUsing[key], componentFilePath);
|
|
872
585
|
return acc;
|
|
873
586
|
}, {});
|
|
874
587
|
configInfo.componentInfo[moduleId] = {
|
|
875
|
-
id: uuid(
|
|
588
|
+
id: uuid(),
|
|
876
589
|
path: moduleId,
|
|
877
590
|
component: isComponent,
|
|
878
|
-
|
|
879
|
-
usingComponents: cComponents,
|
|
880
|
-
componentPlaceholder: { ...cContent.componentPlaceholder || {} }
|
|
591
|
+
usingComponents: cComponents
|
|
881
592
|
};
|
|
882
593
|
if (cContent.usingComponents && Object.keys(cContent.usingComponents).length > 0) {
|
|
883
594
|
storeComponentConfig(configInfo.componentInfo[moduleId], componentFilePath);
|
|
884
595
|
}
|
|
885
596
|
}
|
|
886
597
|
}
|
|
887
|
-
function getStaticProperty(objectExpression, propertyName) {
|
|
888
|
-
if (objectExpression?.type !== "ObjectExpression") {
|
|
889
|
-
return void 0;
|
|
890
|
-
}
|
|
891
|
-
return objectExpression.properties?.find((property) => {
|
|
892
|
-
if (property.type !== "Property" || property.computed) {
|
|
893
|
-
return false;
|
|
894
|
-
}
|
|
895
|
-
return property.key?.name === propertyName || property.key?.value === propertyName;
|
|
896
|
-
})?.value;
|
|
897
|
-
}
|
|
898
|
-
function normalizeStyleIsolation(value) {
|
|
899
|
-
return STYLE_ISOLATION_VALUES.has(value) ? value : void 0;
|
|
900
|
-
}
|
|
901
|
-
function resolveComponentStyleIsolation(componentConfig, componentJsonPath) {
|
|
902
|
-
const jsonValue = normalizeStyleIsolation(componentConfig?.styleIsolation);
|
|
903
|
-
if (jsonValue) {
|
|
904
|
-
return jsonValue;
|
|
905
|
-
}
|
|
906
|
-
const basePath = componentJsonPath.replace(/\.json$/i, "");
|
|
907
|
-
const scriptPath = [".js", ".ts"].map((ext) => `${basePath}${ext}`).find((candidate) => fs3.existsSync(candidate));
|
|
908
|
-
if (!scriptPath) {
|
|
909
|
-
return "isolated";
|
|
910
|
-
}
|
|
911
|
-
try {
|
|
912
|
-
const source = getContentByPath(scriptPath);
|
|
913
|
-
const { program } = parseSync(scriptPath, source, {
|
|
914
|
-
sourceType: "unambiguous"
|
|
915
|
-
});
|
|
916
|
-
let extractedValue;
|
|
917
|
-
walk(program, {
|
|
918
|
-
enter(expression) {
|
|
919
|
-
if (extractedValue) {
|
|
920
|
-
return;
|
|
921
|
-
}
|
|
922
|
-
if (expression?.type !== "CallExpression" || expression.callee?.type !== "Identifier" || expression.callee.name !== "Component") {
|
|
923
|
-
return;
|
|
924
|
-
}
|
|
925
|
-
const definition = expression.arguments?.[0];
|
|
926
|
-
const options = getStaticProperty(definition, "options");
|
|
927
|
-
const styleIsolation = getStaticProperty(options, "styleIsolation")?.value;
|
|
928
|
-
const normalized = normalizeStyleIsolation(styleIsolation);
|
|
929
|
-
if (normalized) {
|
|
930
|
-
extractedValue = normalized;
|
|
931
|
-
return;
|
|
932
|
-
}
|
|
933
|
-
if (getStaticProperty(options, "addGlobalClass")?.value === true) {
|
|
934
|
-
extractedValue = "apply-shared";
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
});
|
|
938
|
-
if (extractedValue) {
|
|
939
|
-
return extractedValue;
|
|
940
|
-
}
|
|
941
|
-
} catch (error) {
|
|
942
|
-
console.warn(`[env] \u65E0\u6CD5\u89E3\u6790\u7EC4\u4EF6\u6837\u5F0F\u9694\u79BB\u914D\u7F6E ${scriptPath}: ${error.message}`);
|
|
943
|
-
}
|
|
944
|
-
return "isolated";
|
|
945
|
-
}
|
|
946
598
|
function getModuleId(src, pageFilePath) {
|
|
947
599
|
const resolvedAlias = resolveAppAlias(src);
|
|
948
600
|
if (resolvedAlias) {
|
|
@@ -1008,17 +660,13 @@ function transSubDir(name) {
|
|
|
1008
660
|
function getPages() {
|
|
1009
661
|
const { pages, subPackages = [], usingComponents: globalComponents = {} } = getAppConfigInfo();
|
|
1010
662
|
const pageInfo = getPageConfigInfo();
|
|
1011
|
-
const mainPages = pages.map((
|
|
1012
|
-
const pageComponents = pageInfo[
|
|
663
|
+
const mainPages = pages.map((path5) => {
|
|
664
|
+
const pageComponents = pageInfo[path5]?.usingComponents || {};
|
|
1013
665
|
const mergedComponents = { ...globalComponents, ...pageComponents };
|
|
1014
666
|
return {
|
|
1015
|
-
id: uuid(
|
|
1016
|
-
path:
|
|
1017
|
-
|
|
1018
|
-
sharedStyleScopeIds: collectSharedStyleScopeIds(mergedComponents),
|
|
1019
|
-
usingComponents: mergedComponents,
|
|
1020
|
-
componentPlaceholder: { ...pageInfo[path6]?.componentPlaceholder || {} },
|
|
1021
|
-
customTabBar: pageInfo[path6]?.customTabBar
|
|
667
|
+
id: uuid(),
|
|
668
|
+
path: path5,
|
|
669
|
+
usingComponents: mergedComponents
|
|
1022
670
|
};
|
|
1023
671
|
});
|
|
1024
672
|
const subPages = {};
|
|
@@ -1027,18 +675,14 @@ function getPages() {
|
|
|
1027
675
|
const independent = subPkg.independent ? subPkg.independent : false;
|
|
1028
676
|
subPages[transSubDir(rootPath)] = {
|
|
1029
677
|
independent,
|
|
1030
|
-
info: subPkg.pages.map((
|
|
1031
|
-
const fullPath = rootPath +
|
|
678
|
+
info: subPkg.pages.map((path5) => {
|
|
679
|
+
const fullPath = rootPath + path5;
|
|
1032
680
|
const pageComponents = pageInfo[fullPath]?.usingComponents || {};
|
|
1033
681
|
const mergedComponents = { ...globalComponents, ...pageComponents };
|
|
1034
682
|
return {
|
|
1035
|
-
id: uuid(
|
|
683
|
+
id: uuid(),
|
|
1036
684
|
path: fullPath,
|
|
1037
|
-
|
|
1038
|
-
sharedStyleScopeIds: collectSharedStyleScopeIds(mergedComponents),
|
|
1039
|
-
usingComponents: mergedComponents,
|
|
1040
|
-
componentPlaceholder: { ...pageInfo[fullPath]?.componentPlaceholder || {} },
|
|
1041
|
-
customTabBar: pageInfo[fullPath]?.customTabBar
|
|
685
|
+
usingComponents: mergedComponents
|
|
1042
686
|
};
|
|
1043
687
|
})
|
|
1044
688
|
};
|
|
@@ -1048,140 +692,20 @@ function getPages() {
|
|
|
1048
692
|
subPages
|
|
1049
693
|
};
|
|
1050
694
|
}
|
|
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
|
-
}
|
|
1137
|
-
function collectSharedStyleScopeIds(usingComponents) {
|
|
1138
|
-
const result = [];
|
|
1139
|
-
const visited = /* @__PURE__ */ new Set();
|
|
1140
|
-
const visit = (componentPath) => {
|
|
1141
|
-
if (visited.has(componentPath)) {
|
|
1142
|
-
return;
|
|
1143
|
-
}
|
|
1144
|
-
visited.add(componentPath);
|
|
1145
|
-
const component = configInfo.componentInfo[componentPath];
|
|
1146
|
-
if (!component) {
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
if (component.styleIsolation === "shared") {
|
|
1150
|
-
result.push(component.id);
|
|
1151
|
-
}
|
|
1152
|
-
for (const childPath of Object.values(component.usingComponents || {})) {
|
|
1153
|
-
visit(childPath);
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
|
-
for (const componentPath of Object.values(usingComponents || {})) {
|
|
1157
|
-
visit(componentPath);
|
|
1158
|
-
}
|
|
1159
|
-
return result;
|
|
1160
|
-
}
|
|
1161
|
-
function getAppStyleScopeId() {
|
|
1162
|
-
return uuid("app");
|
|
1163
|
-
}
|
|
1164
695
|
|
|
1165
696
|
export {
|
|
1166
|
-
__commonJS,
|
|
1167
|
-
__toESM,
|
|
1168
|
-
toMiniProgramModuleId,
|
|
1169
697
|
hasCompileInfo,
|
|
1170
698
|
getAbsolutePath,
|
|
1171
|
-
resolveAssetSourcePath,
|
|
1172
699
|
collectAssets,
|
|
1173
700
|
transformRpx,
|
|
1174
701
|
tagWhiteList,
|
|
1175
|
-
miniProgramBuiltinTags,
|
|
1176
702
|
__resetAssets,
|
|
1177
703
|
storeInfo,
|
|
1178
704
|
resetStoreInfo,
|
|
1179
705
|
getTemplateExts,
|
|
1180
|
-
getTemplateDirectivePrefixes,
|
|
1181
706
|
getStyleExts,
|
|
1182
707
|
getViewScriptExts,
|
|
1183
708
|
getViewScriptTags,
|
|
1184
|
-
getDependencyGraph,
|
|
1185
709
|
getContentByPath,
|
|
1186
710
|
resolveAppAlias,
|
|
1187
711
|
getTargetPath,
|