@dimina/compiler 1.0.12 → 1.0.13

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.
@@ -0,0 +1,689 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let node_path = require("node:path");
25
+ node_path = __toESM(node_path);
26
+ let node_process = require("node:process");
27
+ node_process = __toESM(node_process);
28
+ let node_fs = require("node:fs");
29
+ node_fs = __toESM(node_fs);
30
+ let node_os = require("node:os");
31
+ node_os = __toESM(node_os);
32
+ //#region src/common/art.js
33
+ var artCode = `
34
+ ██████╗ ██╗███╗ ███╗██╗███╗ ██╗ █████╗
35
+ ██╔══██╗██║████╗ ████║██║████╗ ██║██╔══██╗
36
+ ██║ ██║██║██╔████╔██║██║██╔██╗ ██║███████║
37
+ ██║ ██║██║██║╚██╔╝██║██║██║╚██╗██║██╔══██║
38
+ ██████╔╝██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║
39
+ ╚═════╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝
40
+ `;
41
+ function art_default() {
42
+ console.log(artCode);
43
+ }
44
+ //#endregion
45
+ //#region src/common/utils.js
46
+ function hasCompileInfo(modulePath, list, preList) {
47
+ const mergeList = Array.isArray(preList) ? [...preList, ...list] : list;
48
+ for (const element of mergeList) if (element.path === modulePath) return true;
49
+ return false;
50
+ }
51
+ function getAbsolutePath(workPath, pagePath, src) {
52
+ if (src.startsWith("/")) return node_path.default.join(workPath, src);
53
+ if (pagePath.includes("/miniprogram_npm/")) {
54
+ const componentFullPath = workPath + pagePath.split("/").slice(0, -1).join("/");
55
+ return node_path.default.resolve(componentFullPath, src);
56
+ }
57
+ const relativePath = pagePath.split("/").filter((part) => part !== "").slice(0, -1).join("/");
58
+ return node_path.default.resolve(workPath, relativePath, src);
59
+ }
60
+ var assetsMap = {};
61
+ /**
62
+ * 将静态资源存储到 static 文件夹
63
+ */
64
+ function collectAssets(workPath, pagePath, src, targetPath, appId) {
65
+ if (src.startsWith("http") || src.startsWith("//")) return src;
66
+ if (!/\.(?:png|jpe?g|gif|svg)(?:\?.*)?$/.test(src)) return src;
67
+ const relativePath = pagePath.split("/").slice(0, -1).join("/");
68
+ const absolutePath = src.startsWith("/") ? workPath + src : node_path.default.resolve(workPath, relativePath, src);
69
+ if (assetsMap[absolutePath]) return assetsMap[absolutePath];
70
+ try {
71
+ const ext = `.${src.split(".").pop()}`;
72
+ const dirPath = absolutePath.split(node_path.default.sep).slice(0, -1).join("/");
73
+ const prefix = uuid();
74
+ const targetStatic = `${targetPath}/main/static`;
75
+ if (!node_fs.default.existsSync(targetStatic)) node_fs.default.mkdirSync(targetStatic, { recursive: true });
76
+ getFilesWithExtension(dirPath, ext).forEach((file) => {
77
+ node_fs.default.copyFileSync(node_path.default.resolve(dirPath, file), `${targetStatic}/${prefix}_${file}`);
78
+ });
79
+ const filename = src.split("/").pop();
80
+ assetsMap[absolutePath] = `${node_process.default.env.ASSETS_PATH_PREFIX ? "" : "/"}${appId}/main/static/${prefix}_${filename}`;
81
+ } catch (error) {
82
+ console.log(error);
83
+ }
84
+ return assetsMap[absolutePath] || src;
85
+ }
86
+ function getFilesWithExtension(directory, extension) {
87
+ return node_fs.default.readdirSync(directory).filter((file) => node_path.default.extname(file) === extension);
88
+ }
89
+ function isObjectEmpty(objectName) {
90
+ if (!objectName) return true;
91
+ return Object.keys(objectName).length === 0 && objectName.constructor === Object;
92
+ }
93
+ function isString(o) {
94
+ return Object.prototype.toString.call(o) === "[object String]";
95
+ }
96
+ function transformRpx(styleText) {
97
+ if (!isString(styleText)) return styleText;
98
+ return styleText.replace(/([+-]?\d+(?:\.\d+)?)rpx/g, (_, pixel) => {
99
+ return `${Number(pixel)}rem`;
100
+ });
101
+ }
102
+ function uuid() {
103
+ return Math.random().toString(36).slice(2, 7);
104
+ }
105
+ var tagWhiteList = [
106
+ "page",
107
+ "wrapper",
108
+ "block",
109
+ "button",
110
+ "camera",
111
+ "checkbox-group",
112
+ "checkbox",
113
+ "cover-image",
114
+ "cover-view",
115
+ "form",
116
+ "icon",
117
+ "image",
118
+ "input",
119
+ "keyboard-accessory",
120
+ "label",
121
+ "map",
122
+ "movable-area",
123
+ "movable-view",
124
+ "navigation-bar",
125
+ "navigator",
126
+ "open-data",
127
+ "page-meta",
128
+ "picker-view-column",
129
+ "picker-view",
130
+ "picker",
131
+ "progress",
132
+ "radio-group",
133
+ "radio",
134
+ "rich-text",
135
+ "root-portal",
136
+ "scroll-view",
137
+ "slider",
138
+ "swiper-item",
139
+ "swiper",
140
+ "switch",
141
+ "template",
142
+ "text",
143
+ "textarea",
144
+ "video",
145
+ "view",
146
+ "web-view"
147
+ ];
148
+ //#endregion
149
+ //#region src/common/npm-resolver.js
150
+ /**
151
+ * npm 组件解析器
152
+ * 根据微信小程序 npm 支持规范实现组件寻址
153
+ * https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html
154
+ */
155
+ var NpmResolver = class {
156
+ constructor(workPath) {
157
+ this.workPath = workPath;
158
+ this.miniprogramNpmCache = /* @__PURE__ */ new Map();
159
+ this.packageCache = /* @__PURE__ */ new Map();
160
+ }
161
+ /**
162
+ * 解析组件路径,支持 npm 包组件
163
+ * @param {string} componentPath 组件路径
164
+ * @param {string} pageFilePath 页面文件路径
165
+ * @returns {string} 解析后的组件路径
166
+ */
167
+ resolveComponentPath(componentPath, pageFilePath) {
168
+ if (componentPath.startsWith("./") || componentPath.startsWith("../") || componentPath.startsWith("/")) return this.resolveRelativePath(componentPath, pageFilePath);
169
+ const npmPath = this.resolveNpmComponent(componentPath, pageFilePath);
170
+ if (npmPath) return npmPath;
171
+ return this.resolveRelativePath(componentPath, pageFilePath);
172
+ }
173
+ /**
174
+ * 解析相对路径组件
175
+ * @param {string} componentPath 组件路径
176
+ * @param {string} pageFilePath 页面文件路径
177
+ * @returns {string} 解析后的路径
178
+ */
179
+ resolveRelativePath(componentPath, pageFilePath) {
180
+ const lastIndex = pageFilePath.lastIndexOf("/");
181
+ const newPath = pageFilePath.slice(0, lastIndex);
182
+ return node_path.default.resolve(newPath, componentPath).replace(this.workPath, "");
183
+ }
184
+ /**
185
+ * 解析 npm 组件
186
+ * @param {string} componentName 组件名称
187
+ * @param {string} pageFilePath 页面文件路径
188
+ * @returns {string|null} 解析后的组件路径,如果找不到返回 null
189
+ */
190
+ resolveNpmComponent(componentName, pageFilePath) {
191
+ const searchPaths = this.generateSearchPaths(pageFilePath);
192
+ for (const searchPath of searchPaths) {
193
+ const componentPath = this.findComponentInMiniprogramNpm(componentName, searchPath);
194
+ if (componentPath) return componentPath;
195
+ }
196
+ return null;
197
+ }
198
+ /**
199
+ * 解析脚本模块路径,支持微信小程序 npm 逐级寻址和 package.json 入口
200
+ * @param {string} specifier 模块导入路径
201
+ * @param {string} modulePath 当前模块绝对文件路径
202
+ * @param {(moduleId: string) => string | null} resolveExistingModuleId 解析真实存在模块的回调
203
+ * @returns {string|null} 解析后的模块 id
204
+ */
205
+ resolveScriptModule(specifier, modulePath, resolveExistingModuleId) {
206
+ if (!specifier || !resolveExistingModuleId) return null;
207
+ for (const searchPath of this.generateSearchPaths(modulePath)) {
208
+ const resolvedModuleId = resolveExistingModuleId(this.normalizeModuleId(`/${searchPath}/${specifier}`));
209
+ if (resolvedModuleId) return resolvedModuleId;
210
+ }
211
+ return null;
212
+ }
213
+ /**
214
+ * 生成 miniprogram_npm 搜索路径
215
+ * 按照微信小程序的寻址顺序生成搜索路径
216
+ * @param {string} pageFilePath 页面文件路径
217
+ * @returns {string[]} 搜索路径数组
218
+ */
219
+ generateSearchPaths(pageFilePath) {
220
+ const pathParts = pageFilePath.replace(this.workPath, "").replace(/^\//, "").split("/").slice(0, -1);
221
+ const searchPaths = [];
222
+ for (let i = pathParts.length; i >= 0; i--) {
223
+ const currentPath = pathParts.slice(0, i).join("/");
224
+ const miniprogramNpmPath = currentPath ? `${currentPath}/miniprogram_npm` : "miniprogram_npm";
225
+ searchPaths.push(miniprogramNpmPath);
226
+ }
227
+ return searchPaths;
228
+ }
229
+ /**
230
+ * 在指定的 miniprogram_npm 目录中查找组件
231
+ * @param {string} componentName 组件名称
232
+ * @param {string} miniprogramNpmPath miniprogram_npm 路径
233
+ * @returns {string|null} 组件路径,如果找不到返回 null
234
+ */
235
+ findComponentInMiniprogramNpm(componentName, miniprogramNpmPath) {
236
+ const fullMiniprogramNpmPath = node_path.default.join(this.workPath, miniprogramNpmPath);
237
+ if (!node_fs.default.existsSync(fullMiniprogramNpmPath)) return null;
238
+ const cacheKey = `${miniprogramNpmPath}/${componentName}`;
239
+ if (this.miniprogramNpmCache.has(cacheKey)) return this.miniprogramNpmCache.get(cacheKey);
240
+ const candidatePaths = [componentName, `${componentName}/index`];
241
+ for (const candidatePath of candidatePaths) {
242
+ const componentDir = node_path.default.join(fullMiniprogramNpmPath, candidatePath);
243
+ if (this.isValidComponent(componentDir)) {
244
+ const resolvedPath = `/${miniprogramNpmPath}/${candidatePath}`.replace(/\/+/g, "/");
245
+ this.miniprogramNpmCache.set(cacheKey, resolvedPath);
246
+ return resolvedPath;
247
+ }
248
+ }
249
+ this.miniprogramNpmCache.set(cacheKey, null);
250
+ return null;
251
+ }
252
+ normalizeModuleId(moduleId) {
253
+ let normalized = moduleId.replace(/\.(js|ts)$/, "").replace(/\\/g, "/");
254
+ if (!normalized.startsWith("/")) normalized = `/${normalized}`;
255
+ return normalized;
256
+ }
257
+ /**
258
+ * 检查是否为有效的组件
259
+ * @param {string} componentPath 组件路径
260
+ * @returns {boolean} 是否为有效组件
261
+ */
262
+ isValidComponent(componentPath) {
263
+ const requiredFiles = [".json", ".js"];
264
+ if (!requiredFiles.some((ext) => {
265
+ return node_fs.default.existsSync(`${componentPath}${ext}`);
266
+ })) {
267
+ if (!requiredFiles.some((ext) => {
268
+ return node_fs.default.existsSync(node_path.default.join(componentPath, `index${ext}`));
269
+ })) return false;
270
+ const indexJsonFile = node_path.default.join(componentPath, "index.json");
271
+ if (node_fs.default.existsSync(indexJsonFile)) try {
272
+ return JSON.parse(node_fs.default.readFileSync(indexJsonFile, "utf-8")).component === true;
273
+ } catch (e) {
274
+ return false;
275
+ }
276
+ return true;
277
+ }
278
+ const jsonFile = `${componentPath}.json`;
279
+ if (node_fs.default.existsSync(jsonFile)) try {
280
+ return JSON.parse(node_fs.default.readFileSync(jsonFile, "utf-8")).component === true;
281
+ } catch (e) {
282
+ return false;
283
+ }
284
+ return true;
285
+ }
286
+ /**
287
+ * 获取 npm 包信息
288
+ * @param {string} packageName 包名
289
+ * @param {string} searchPath 搜索路径
290
+ * @returns {object|null} 包信息,如果找不到返回 null
291
+ */
292
+ getPackageInfo(packageName, searchPath) {
293
+ const cacheKey = `${searchPath}/${packageName}`;
294
+ if (this.packageCache.has(cacheKey)) return this.packageCache.get(cacheKey);
295
+ const packageJsonPath = node_path.default.join(this.workPath, searchPath, packageName, "package.json");
296
+ if (!node_fs.default.existsSync(packageJsonPath)) {
297
+ this.packageCache.set(cacheKey, null);
298
+ return null;
299
+ }
300
+ try {
301
+ const packageInfo = JSON.parse(node_fs.default.readFileSync(packageJsonPath, "utf-8"));
302
+ this.packageCache.set(cacheKey, packageInfo);
303
+ return packageInfo;
304
+ } catch (e) {
305
+ this.packageCache.set(cacheKey, null);
306
+ return null;
307
+ }
308
+ }
309
+ /**
310
+ * 清除缓存
311
+ */
312
+ clearCache() {
313
+ this.miniprogramNpmCache.clear();
314
+ this.packageCache.clear();
315
+ }
316
+ };
317
+ //#endregion
318
+ //#region src/env.js
319
+ var pathInfo = {};
320
+ var configInfo = {};
321
+ var npmResolver = null;
322
+ /**
323
+ * 持久化编译过程的上下文
324
+ */
325
+ function storeInfo(workPath) {
326
+ storePathInfo(workPath);
327
+ storeProjectConfig();
328
+ storeAppConfig();
329
+ storePageConfig();
330
+ return {
331
+ pathInfo,
332
+ configInfo
333
+ };
334
+ }
335
+ function resetStoreInfo(opts) {
336
+ pathInfo = opts.pathInfo;
337
+ configInfo = opts.configInfo;
338
+ if (pathInfo.workPath) npmResolver = new NpmResolver(pathInfo.workPath);
339
+ }
340
+ function storePathInfo(workPath) {
341
+ pathInfo.workPath = workPath;
342
+ if (node_process.default.env.TARGET_PATH) pathInfo.targetPath = node_process.default.env.TARGET_PATH;
343
+ else {
344
+ const tempDir = node_process.default.env.GITHUB_WORKSPACE || node_os.default.tmpdir();
345
+ const targetDir = node_path.default.join(tempDir, `dimina-fe-dist-${Date.now()}`);
346
+ if (!node_fs.default.existsSync(targetDir)) node_fs.default.mkdirSync(targetDir, { recursive: true });
347
+ pathInfo.targetPath = targetDir;
348
+ }
349
+ npmResolver = new NpmResolver(workPath);
350
+ }
351
+ function storeProjectConfig() {
352
+ const privateConfigPath = `${pathInfo.workPath}/project.private.config.json`;
353
+ const defaultConfigPath = `${pathInfo.workPath}/project.config.json`;
354
+ let privateConfig = {};
355
+ let defaultConfig = {};
356
+ if (node_fs.default.existsSync(defaultConfigPath)) try {
357
+ defaultConfig = parseContentByPath(defaultConfigPath);
358
+ } catch (e) {
359
+ console.warn("Failed to parse project.config.json:", e.message);
360
+ }
361
+ if (node_fs.default.existsSync(privateConfigPath)) try {
362
+ privateConfig = parseContentByPath(privateConfigPath);
363
+ } catch (e) {
364
+ console.warn("Failed to parse project.private.config.json:", e.message);
365
+ }
366
+ configInfo.projectInfo = {
367
+ ...defaultConfig,
368
+ ...privateConfig
369
+ };
370
+ }
371
+ function storeAppConfig() {
372
+ const content = parseContentByPath(`${pathInfo.workPath}/app.json`);
373
+ const newObj = {};
374
+ for (const key in content) if (Object.hasOwn(content, key)) if (key === "subpackages") newObj.subPackages = content[key];
375
+ else newObj[key] = content[key];
376
+ configInfo.appInfo = newObj;
377
+ }
378
+ function getContentByPath(path) {
379
+ return node_fs.default.readFileSync(path, { encoding: "utf-8" });
380
+ }
381
+ function parseContentByPath(path) {
382
+ return JSON.parse(getContentByPath(path));
383
+ }
384
+ /**
385
+ * 收集页面 json 信息
386
+ */
387
+ function storePageConfig() {
388
+ const { pages, subPackages } = configInfo.appInfo;
389
+ configInfo.pageInfo = {};
390
+ configInfo.componentInfo = {};
391
+ if (configInfo.appInfo.usingComponents) {
392
+ const appFilePath = `${pathInfo.workPath}/app.json`;
393
+ storeComponentConfig(configInfo.appInfo, appFilePath);
394
+ }
395
+ collectionPageJson(pages);
396
+ if (subPackages) subPackages.forEach((subPkg) => {
397
+ collectionPageJson(subPkg.pages, subPkg.root);
398
+ });
399
+ }
400
+ /**
401
+ * 匹配页面和对应的配置信息
402
+ * @param {*} pages
403
+ */
404
+ function collectionPageJson(pages, root) {
405
+ pages.forEach((pagePath) => {
406
+ let np = pagePath;
407
+ if (root) {
408
+ if (!root.endsWith("/")) root += "/";
409
+ np = root + np;
410
+ }
411
+ const pageFilePath = `${pathInfo.workPath}/${np}.json`;
412
+ if (node_fs.default.existsSync(pageFilePath)) {
413
+ const pageJsonContent = parseContentByPath(pageFilePath);
414
+ if (root) pageJsonContent.root = transSubDir(root);
415
+ configInfo.pageInfo[np] = pageJsonContent;
416
+ storeComponentConfig(pageJsonContent, pageFilePath);
417
+ }
418
+ });
419
+ }
420
+ /**
421
+ * 按页面收集组件 json 信息
422
+ * @param {*} pageJsonContent
423
+ * @param {*} pageFilePath
424
+ */
425
+ function storeComponentConfig(pageJsonContent, pageFilePath) {
426
+ if (isObjectEmpty(pageJsonContent.usingComponents)) return;
427
+ for (const [componentName, componentPath] of Object.entries(pageJsonContent.usingComponents)) {
428
+ const moduleId = getModuleId(componentPath, pageFilePath);
429
+ pageJsonContent.usingComponents[componentName] = moduleId;
430
+ if (configInfo.componentInfo[moduleId]) continue;
431
+ let componentFilePath = node_path.default.resolve(getWorkPath(), `./${moduleId}.json`);
432
+ let cContent = null;
433
+ if (node_fs.default.existsSync(componentFilePath)) cContent = parseContentByPath(componentFilePath);
434
+ else {
435
+ const indexJsonPath = node_path.default.resolve(getWorkPath(), `./${moduleId}/index.json`);
436
+ if (node_fs.default.existsSync(indexJsonPath)) {
437
+ componentFilePath = indexJsonPath;
438
+ cContent = parseContentByPath(componentFilePath);
439
+ } else if (moduleId.includes("/miniprogram_npm/")) {
440
+ console.log(`[env] 为 npm 组件创建默认配置: ${moduleId}`);
441
+ cContent = {
442
+ component: true,
443
+ usingComponents: {}
444
+ };
445
+ } else {
446
+ console.warn(`[env] 组件配置文件不存在: ${componentFilePath}`);
447
+ continue;
448
+ }
449
+ }
450
+ const cUsing = cContent.usingComponents || {};
451
+ const isComponent = cContent.component || false;
452
+ const cComponents = Object.keys(cUsing).reduce((acc, key) => {
453
+ acc[key] = getModuleId(cUsing[key], componentFilePath);
454
+ return acc;
455
+ }, {});
456
+ configInfo.componentInfo[moduleId] = {
457
+ id: uuid(),
458
+ path: moduleId,
459
+ component: isComponent,
460
+ usingComponents: cComponents
461
+ };
462
+ if (cContent.usingComponents && Object.keys(cContent.usingComponents).length > 0) storeComponentConfig(configInfo.componentInfo[moduleId], componentFilePath);
463
+ }
464
+ }
465
+ /**
466
+ * 转化为相对小程序根目录的绝对路径,作为模块唯一性 id
467
+ * 支持 npm 组件解析
468
+ * @param {string} src
469
+ */
470
+ function getModuleId(src, pageFilePath) {
471
+ const resolvedAlias = resolveAppAlias(src);
472
+ if (resolvedAlias) return resolvedAlias;
473
+ if (!npmResolver) {
474
+ const lastIndex = pageFilePath.lastIndexOf("/");
475
+ const newPath = pageFilePath.slice(0, lastIndex);
476
+ const workPath = getWorkPath();
477
+ return node_path.default.resolve(newPath, src).replace(workPath, "");
478
+ }
479
+ return npmResolver.resolveComponentPath(src, pageFilePath);
480
+ }
481
+ function resolveAppAlias(src) {
482
+ const resolveAlias = configInfo.appInfo?.resolveAlias;
483
+ if (!resolveAlias || typeof src !== "string") return null;
484
+ for (const [alias, target] of Object.entries(resolveAlias)) if (alias.endsWith("/*") && target.endsWith("/*")) {
485
+ const aliasPrefix = alias.slice(0, -1);
486
+ const targetPrefix = target.slice(0, -1);
487
+ if (src.startsWith(aliasPrefix)) return src.replace(aliasPrefix, targetPrefix);
488
+ } else if (src === alias) return target;
489
+ return null;
490
+ }
491
+ function getTargetPath() {
492
+ return pathInfo.targetPath;
493
+ }
494
+ function getComponent(src) {
495
+ return configInfo.componentInfo[src];
496
+ }
497
+ function getPageConfigInfo() {
498
+ return configInfo.pageInfo;
499
+ }
500
+ function getAppConfigInfo() {
501
+ return configInfo.appInfo;
502
+ }
503
+ function getWorkPath() {
504
+ return pathInfo.workPath;
505
+ }
506
+ function getNpmResolver() {
507
+ return npmResolver;
508
+ }
509
+ function getAppId() {
510
+ return configInfo.projectInfo.appid;
511
+ }
512
+ function getAppName() {
513
+ if (configInfo.projectInfo.projectname) return decodeURIComponent(configInfo.projectInfo.projectname);
514
+ return getAppId();
515
+ }
516
+ function transSubDir(name) {
517
+ return `sub_${name.replace(/\/$/, "")}`;
518
+ }
519
+ /**
520
+ * 获取页面及其配置信息,并生成id(输出的 json 文件没有 id)
521
+ */
522
+ function getPages() {
523
+ const { pages, subPackages = [], usingComponents: globalComponents = {} } = getAppConfigInfo();
524
+ const pageInfo = getPageConfigInfo();
525
+ const mainPages = pages.map((path) => {
526
+ const pageComponents = pageInfo[path]?.usingComponents || {};
527
+ const mergedComponents = {
528
+ ...globalComponents,
529
+ ...pageComponents
530
+ };
531
+ return {
532
+ id: uuid(),
533
+ path,
534
+ usingComponents: mergedComponents
535
+ };
536
+ });
537
+ const subPages = {};
538
+ subPackages.forEach((subPkg) => {
539
+ const rootPath = subPkg.root.endsWith("/") ? subPkg.root : `${subPkg.root}/`;
540
+ const independent = subPkg.independent ? subPkg.independent : false;
541
+ subPages[transSubDir(rootPath)] = {
542
+ independent,
543
+ info: subPkg.pages.map((path) => {
544
+ const fullPath = rootPath + path;
545
+ const pageComponents = pageInfo[fullPath]?.usingComponents || {};
546
+ const mergedComponents = {
547
+ ...globalComponents,
548
+ ...pageComponents
549
+ };
550
+ return {
551
+ id: uuid(),
552
+ path: fullPath,
553
+ usingComponents: mergedComponents
554
+ };
555
+ })
556
+ };
557
+ });
558
+ return {
559
+ mainPages,
560
+ subPages
561
+ };
562
+ }
563
+ //#endregion
564
+ Object.defineProperty(exports, "__commonJSMin", {
565
+ enumerable: true,
566
+ get: function() {
567
+ return __commonJSMin;
568
+ }
569
+ });
570
+ Object.defineProperty(exports, "__toESM", {
571
+ enumerable: true,
572
+ get: function() {
573
+ return __toESM;
574
+ }
575
+ });
576
+ Object.defineProperty(exports, "art_default", {
577
+ enumerable: true,
578
+ get: function() {
579
+ return art_default;
580
+ }
581
+ });
582
+ Object.defineProperty(exports, "collectAssets", {
583
+ enumerable: true,
584
+ get: function() {
585
+ return collectAssets;
586
+ }
587
+ });
588
+ Object.defineProperty(exports, "getAbsolutePath", {
589
+ enumerable: true,
590
+ get: function() {
591
+ return getAbsolutePath;
592
+ }
593
+ });
594
+ Object.defineProperty(exports, "getAppConfigInfo", {
595
+ enumerable: true,
596
+ get: function() {
597
+ return getAppConfigInfo;
598
+ }
599
+ });
600
+ Object.defineProperty(exports, "getAppId", {
601
+ enumerable: true,
602
+ get: function() {
603
+ return getAppId;
604
+ }
605
+ });
606
+ Object.defineProperty(exports, "getAppName", {
607
+ enumerable: true,
608
+ get: function() {
609
+ return getAppName;
610
+ }
611
+ });
612
+ Object.defineProperty(exports, "getComponent", {
613
+ enumerable: true,
614
+ get: function() {
615
+ return getComponent;
616
+ }
617
+ });
618
+ Object.defineProperty(exports, "getContentByPath", {
619
+ enumerable: true,
620
+ get: function() {
621
+ return getContentByPath;
622
+ }
623
+ });
624
+ Object.defineProperty(exports, "getNpmResolver", {
625
+ enumerable: true,
626
+ get: function() {
627
+ return getNpmResolver;
628
+ }
629
+ });
630
+ Object.defineProperty(exports, "getPageConfigInfo", {
631
+ enumerable: true,
632
+ get: function() {
633
+ return getPageConfigInfo;
634
+ }
635
+ });
636
+ Object.defineProperty(exports, "getPages", {
637
+ enumerable: true,
638
+ get: function() {
639
+ return getPages;
640
+ }
641
+ });
642
+ Object.defineProperty(exports, "getTargetPath", {
643
+ enumerable: true,
644
+ get: function() {
645
+ return getTargetPath;
646
+ }
647
+ });
648
+ Object.defineProperty(exports, "getWorkPath", {
649
+ enumerable: true,
650
+ get: function() {
651
+ return getWorkPath;
652
+ }
653
+ });
654
+ Object.defineProperty(exports, "hasCompileInfo", {
655
+ enumerable: true,
656
+ get: function() {
657
+ return hasCompileInfo;
658
+ }
659
+ });
660
+ Object.defineProperty(exports, "resetStoreInfo", {
661
+ enumerable: true,
662
+ get: function() {
663
+ return resetStoreInfo;
664
+ }
665
+ });
666
+ Object.defineProperty(exports, "resolveAppAlias", {
667
+ enumerable: true,
668
+ get: function() {
669
+ return resolveAppAlias;
670
+ }
671
+ });
672
+ Object.defineProperty(exports, "storeInfo", {
673
+ enumerable: true,
674
+ get: function() {
675
+ return storeInfo;
676
+ }
677
+ });
678
+ Object.defineProperty(exports, "tagWhiteList", {
679
+ enumerable: true,
680
+ get: function() {
681
+ return tagWhiteList;
682
+ }
683
+ });
684
+ Object.defineProperty(exports, "transformRpx", {
685
+ enumerable: true,
686
+ get: function() {
687
+ return transformRpx;
688
+ }
689
+ });