@dimina/compiler 1.0.14 → 1.0.15
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/bin/index.cjs +3 -3
- package/dist/bin/index.js +2 -2
- package/dist/{compatibility-B_5UilxZ.js → compatibility-C_zWVjYl.js} +1 -0
- package/dist/{compatibility-DCnJNS-s.cjs → compatibility-DlYbbw0F.cjs} +2 -1
- package/dist/core/logic-compiler.cjs +12 -4
- package/dist/core/logic-compiler.js +12 -4
- package/dist/core/style-compiler.cjs +7 -7
- package/dist/core/style-compiler.js +7 -7
- package/dist/core/view-compiler.cjs +2 -2
- package/dist/core/view-compiler.js +2 -2
- package/dist/{env-M-7lpbHL.cjs → env-Dmnqp9bD.cjs} +1 -1
- package/dist/{env-DgCLbrQb.js → env-p9Az8lv5.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/bin/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_env = require("../env-
|
|
2
|
+
const require_env = require("../env-Dmnqp9bD.cjs");
|
|
3
3
|
const require_index = require("../index.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_env.__toESM(node_path, 1);
|
|
@@ -10,7 +10,7 @@ chokidar = require_env.__toESM(chokidar, 1);
|
|
|
10
10
|
let commander = require("commander");
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@dimina/compiler",
|
|
13
|
-
version: "1.0.
|
|
13
|
+
version: "1.0.15",
|
|
14
14
|
description: "星河编译工具",
|
|
15
15
|
main: "./dist/index.cjs",
|
|
16
16
|
module: "./dist/index.js",
|
|
@@ -64,7 +64,7 @@ var package_default = {
|
|
|
64
64
|
"commander": "^14.0.3",
|
|
65
65
|
"cssnano": "^8.0.1",
|
|
66
66
|
"esbuild": "^0.28.0",
|
|
67
|
-
"htmlparser2": "^
|
|
67
|
+
"htmlparser2": "^12.0.0",
|
|
68
68
|
"less": "^4.6.4",
|
|
69
69
|
"listr2": "^9.0.5",
|
|
70
70
|
"magic-string": "^0.30.21",
|
package/dist/bin/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import chokidar from "chokidar";
|
|
|
6
6
|
import { program } from "commander";
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@dimina/compiler",
|
|
9
|
-
version: "1.0.
|
|
9
|
+
version: "1.0.15",
|
|
10
10
|
description: "星河编译工具",
|
|
11
11
|
main: "./dist/index.cjs",
|
|
12
12
|
module: "./dist/index.js",
|
|
@@ -60,7 +60,7 @@ var package_default = {
|
|
|
60
60
|
"commander": "^14.0.3",
|
|
61
61
|
"cssnano": "^8.0.1",
|
|
62
62
|
"esbuild": "^0.28.0",
|
|
63
|
-
"htmlparser2": "^
|
|
63
|
+
"htmlparser2": "^12.0.0",
|
|
64
64
|
"less": "^4.6.4",
|
|
65
65
|
"listr2": "^9.0.5",
|
|
66
66
|
"magic-string": "^0.30.21",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require("./env-
|
|
1
|
+
require("./env-Dmnqp9bD.cjs");
|
|
2
2
|
let htmlparser2 = require("htmlparser2");
|
|
3
3
|
//#region src/common/compatibility-reference.js
|
|
4
4
|
var supportedBuiltinComponents = [
|
|
@@ -33,6 +33,7 @@ var supportedBuiltinComponents = [
|
|
|
33
33
|
"template",
|
|
34
34
|
"text",
|
|
35
35
|
"textarea",
|
|
36
|
+
"video",
|
|
36
37
|
"view",
|
|
37
38
|
"web-view",
|
|
38
39
|
"wxs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_env = require("../env-
|
|
3
|
-
const require_compatibility = require("../compatibility-
|
|
2
|
+
const require_env = require("../env-Dmnqp9bD.cjs");
|
|
3
|
+
const require_compatibility = require("../compatibility-DlYbbw0F.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
let node_worker_threads = require("node:worker_threads");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
@@ -396,9 +396,14 @@ function resolveDependencyId(specifier, modulePath, allowAbsolute) {
|
|
|
396
396
|
};
|
|
397
397
|
if (specifier.startsWith("@") || isBareModuleSpecifier(specifier)) {
|
|
398
398
|
const npmModuleId = resolveNpmModuleId(specifier, modulePath);
|
|
399
|
+
if (npmModuleId) return {
|
|
400
|
+
id: npmModuleId,
|
|
401
|
+
shouldProcess: true
|
|
402
|
+
};
|
|
403
|
+
const siblingModuleId = resolveBareSiblingModuleId(specifier, modulePath);
|
|
399
404
|
return {
|
|
400
|
-
id:
|
|
401
|
-
shouldProcess: Boolean(
|
|
405
|
+
id: siblingModuleId || specifier,
|
|
406
|
+
shouldProcess: Boolean(siblingModuleId)
|
|
402
407
|
};
|
|
403
408
|
}
|
|
404
409
|
return {
|
|
@@ -413,6 +418,9 @@ function resolveRelativeModuleId(specifier, modulePath) {
|
|
|
413
418
|
const relativeId = (0, node_path.resolve)(modulePath, `../${specifier}`).split(`${require_env.getWorkPath()}${node_path.sep}`)[1];
|
|
414
419
|
return normalizeModuleId(relativeId);
|
|
415
420
|
}
|
|
421
|
+
function resolveBareSiblingModuleId(specifier, modulePath) {
|
|
422
|
+
return resolveModuleIdToExistingPath(resolveRelativeModuleId(`./${specifier}`, modulePath));
|
|
423
|
+
}
|
|
416
424
|
function normalizeModuleId(moduleId) {
|
|
417
425
|
let normalized = moduleId.replace(/\.(js|ts)$/, "").replace(/\\/g, "/");
|
|
418
426
|
if (!normalized.startsWith("/")) normalized = `/${normalized}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as getContentByPath, d as resetStoreInfo, f as resolveAppAlias, g as hasCompileInfo, i as getComponent, l as getTargetPath, m as collectAssets, n as getAppId, o as getNpmResolver, t as getAppConfigInfo, u as getWorkPath } from "../env-
|
|
2
|
-
import { n as getWxMemberName, r as warnUnsupportedWxApi } from "../compatibility-
|
|
1
|
+
import { a as getContentByPath, d as resetStoreInfo, f as resolveAppAlias, g as hasCompileInfo, i as getComponent, l as getTargetPath, m as collectAssets, n as getAppId, o as getNpmResolver, t as getAppConfigInfo, u as getWorkPath } from "../env-p9Az8lv5.js";
|
|
2
|
+
import { n as getWxMemberName, r as warnUnsupportedWxApi } from "../compatibility-C_zWVjYl.js";
|
|
3
3
|
import { resolve, sep } from "node:path";
|
|
4
4
|
import { isMainThread, parentPort } from "node:worker_threads";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -393,9 +393,14 @@ function resolveDependencyId(specifier, modulePath, allowAbsolute) {
|
|
|
393
393
|
};
|
|
394
394
|
if (specifier.startsWith("@") || isBareModuleSpecifier(specifier)) {
|
|
395
395
|
const npmModuleId = resolveNpmModuleId(specifier, modulePath);
|
|
396
|
+
if (npmModuleId) return {
|
|
397
|
+
id: npmModuleId,
|
|
398
|
+
shouldProcess: true
|
|
399
|
+
};
|
|
400
|
+
const siblingModuleId = resolveBareSiblingModuleId(specifier, modulePath);
|
|
396
401
|
return {
|
|
397
|
-
id:
|
|
398
|
-
shouldProcess: Boolean(
|
|
402
|
+
id: siblingModuleId || specifier,
|
|
403
|
+
shouldProcess: Boolean(siblingModuleId)
|
|
399
404
|
};
|
|
400
405
|
}
|
|
401
406
|
return {
|
|
@@ -410,6 +415,9 @@ function resolveRelativeModuleId(specifier, modulePath) {
|
|
|
410
415
|
const relativeId = resolve(modulePath, `../${specifier}`).split(`${getWorkPath()}${sep}`)[1];
|
|
411
416
|
return normalizeModuleId(relativeId);
|
|
412
417
|
}
|
|
418
|
+
function resolveBareSiblingModuleId(specifier, modulePath) {
|
|
419
|
+
return resolveModuleIdToExistingPath(resolveRelativeModuleId(`./${specifier}`, modulePath));
|
|
420
|
+
}
|
|
413
421
|
function normalizeModuleId(moduleId) {
|
|
414
422
|
let normalized = moduleId.replace(/\.(js|ts)$/, "").replace(/\\/g, "/");
|
|
415
423
|
if (!normalized.startsWith("/")) normalized = `/${normalized}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_env = require("../env-
|
|
2
|
+
const require_env = require("../env-Dmnqp9bD.cjs");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_env.__toESM(node_path, 1);
|
|
5
5
|
let node_worker_threads = require("node:worker_threads");
|
|
@@ -79,11 +79,11 @@ async function buildCompileCss(module, depthChain = [], compiledPaths = /* @__PU
|
|
|
79
79
|
const currentPath = module.path || module.absolutePath;
|
|
80
80
|
if (depthChain.includes(currentPath)) {
|
|
81
81
|
console.warn("[style]", `检测到循环依赖: ${[...depthChain, currentPath].join(" -> ")}`);
|
|
82
|
-
return;
|
|
82
|
+
return "";
|
|
83
83
|
}
|
|
84
84
|
if (depthChain.length > 20) {
|
|
85
85
|
console.warn("[style]", `检测到深度依赖: ${[...depthChain, currentPath].join(" -> ")}`);
|
|
86
|
-
return;
|
|
86
|
+
return "";
|
|
87
87
|
}
|
|
88
88
|
if (compiledPaths.has(currentPath)) return "";
|
|
89
89
|
compiledPaths.add(currentPath);
|
|
@@ -92,15 +92,15 @@ async function buildCompileCss(module, depthChain = [], compiledPaths = /* @__PU
|
|
|
92
92
|
if (module.usingComponents) for (const componentInfo of Object.values(module.usingComponents)) {
|
|
93
93
|
const componentModule = require_env.getComponent(componentInfo);
|
|
94
94
|
if (!componentModule) continue;
|
|
95
|
-
result += await buildCompileCss(componentModule, depthChain, compiledPaths);
|
|
95
|
+
result += await buildCompileCss(componentModule, depthChain, compiledPaths) || "";
|
|
96
96
|
}
|
|
97
97
|
return result;
|
|
98
98
|
}
|
|
99
99
|
async function enhanceCSS(module) {
|
|
100
100
|
const absolutePath = module.absolutePath ? module.absolutePath : getAbsolutePath(module.path);
|
|
101
|
-
if (!absolutePath) return;
|
|
101
|
+
if (!absolutePath) return "";
|
|
102
102
|
const inputCSS = require_env.getContentByPath(absolutePath);
|
|
103
|
-
if (!inputCSS) return;
|
|
103
|
+
if (!inputCSS) return "";
|
|
104
104
|
if (compileRes.has(absolutePath)) return compileRes.get(absolutePath);
|
|
105
105
|
let processedCSS = normalizeRootStyleImports(inputCSS);
|
|
106
106
|
const ext = node_path.default.extname(absolutePath).toLowerCase();
|
|
@@ -158,7 +158,7 @@ async function enhanceCSS(module) {
|
|
|
158
158
|
const cleanedCode = await removeBaseComponentScope(scopedCode, moduleId);
|
|
159
159
|
const res = await (0, postcss.default)([(0, autoprefixer.default)({ overrideBrowserslist: ["cover 99.5%"] }), (0, cssnano.default)()]).process(cleanedCode, { from: void 0 });
|
|
160
160
|
const result = (await Promise.all(promises)).filter(Boolean).join("") + res.css;
|
|
161
|
-
compileRes.set(
|
|
161
|
+
compileRes.set(absolutePath, result);
|
|
162
162
|
return result;
|
|
163
163
|
}
|
|
164
164
|
function normalizeCssUrlValue(value, absolutePath) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as tagWhiteList, a as getContentByPath, d as resetStoreInfo, i as getComponent, l as getTargetPath, m as collectAssets, n as getAppId, u as getWorkPath, v as transformRpx } from "../env-
|
|
1
|
+
import { _ as tagWhiteList, a as getContentByPath, d as resetStoreInfo, i as getComponent, l as getTargetPath, m as collectAssets, n as getAppId, u as getWorkPath, v as transformRpx } from "../env-p9Az8lv5.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { isMainThread, parentPort } from "node:worker_threads";
|
|
4
4
|
import fs from "node:fs";
|
|
@@ -70,11 +70,11 @@ async function buildCompileCss(module, depthChain = [], compiledPaths = /* @__PU
|
|
|
70
70
|
const currentPath = module.path || module.absolutePath;
|
|
71
71
|
if (depthChain.includes(currentPath)) {
|
|
72
72
|
console.warn("[style]", `检测到循环依赖: ${[...depthChain, currentPath].join(" -> ")}`);
|
|
73
|
-
return;
|
|
73
|
+
return "";
|
|
74
74
|
}
|
|
75
75
|
if (depthChain.length > 20) {
|
|
76
76
|
console.warn("[style]", `检测到深度依赖: ${[...depthChain, currentPath].join(" -> ")}`);
|
|
77
|
-
return;
|
|
77
|
+
return "";
|
|
78
78
|
}
|
|
79
79
|
if (compiledPaths.has(currentPath)) return "";
|
|
80
80
|
compiledPaths.add(currentPath);
|
|
@@ -83,15 +83,15 @@ async function buildCompileCss(module, depthChain = [], compiledPaths = /* @__PU
|
|
|
83
83
|
if (module.usingComponents) for (const componentInfo of Object.values(module.usingComponents)) {
|
|
84
84
|
const componentModule = getComponent(componentInfo);
|
|
85
85
|
if (!componentModule) continue;
|
|
86
|
-
result += await buildCompileCss(componentModule, depthChain, compiledPaths);
|
|
86
|
+
result += await buildCompileCss(componentModule, depthChain, compiledPaths) || "";
|
|
87
87
|
}
|
|
88
88
|
return result;
|
|
89
89
|
}
|
|
90
90
|
async function enhanceCSS(module) {
|
|
91
91
|
const absolutePath = module.absolutePath ? module.absolutePath : getAbsolutePath(module.path);
|
|
92
|
-
if (!absolutePath) return;
|
|
92
|
+
if (!absolutePath) return "";
|
|
93
93
|
const inputCSS = getContentByPath(absolutePath);
|
|
94
|
-
if (!inputCSS) return;
|
|
94
|
+
if (!inputCSS) return "";
|
|
95
95
|
if (compileRes.has(absolutePath)) return compileRes.get(absolutePath);
|
|
96
96
|
let processedCSS = normalizeRootStyleImports(inputCSS);
|
|
97
97
|
const ext = path.extname(absolutePath).toLowerCase();
|
|
@@ -149,7 +149,7 @@ async function enhanceCSS(module) {
|
|
|
149
149
|
const cleanedCode = await removeBaseComponentScope(scopedCode, moduleId);
|
|
150
150
|
const res = await postcss([autoprefixer({ overrideBrowserslist: ["cover 99.5%"] }), cssnano()]).process(cleanedCode, { from: void 0 });
|
|
151
151
|
const result = (await Promise.all(promises)).filter(Boolean).join("") + res.css;
|
|
152
|
-
compileRes.set(
|
|
152
|
+
compileRes.set(absolutePath, result);
|
|
153
153
|
return result;
|
|
154
154
|
}
|
|
155
155
|
function normalizeCssUrlValue(value, absolutePath) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_env = require("../env-
|
|
3
|
-
const require_compatibility = require("../compatibility-
|
|
2
|
+
const require_env = require("../env-Dmnqp9bD.cjs");
|
|
3
|
+
const require_compatibility = require("../compatibility-DlYbbw0F.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_env.__toESM(node_path, 1);
|
|
6
6
|
let node_worker_threads = require("node:worker_threads");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as tagWhiteList, a as getContentByPath, d as resetStoreInfo, h as getAbsolutePath, i as getComponent, l as getTargetPath, m as collectAssets, n as getAppId, u as getWorkPath, v as transformRpx } from "../env-
|
|
2
|
-
import { t as checkTemplateCompatibility } from "../compatibility-
|
|
1
|
+
import { _ as tagWhiteList, a as getContentByPath, d as resetStoreInfo, h as getAbsolutePath, i as getComponent, l as getTargetPath, m as collectAssets, n as getAppId, u as getWorkPath, v as transformRpx } from "../env-p9Az8lv5.js";
|
|
2
|
+
import { t as checkTemplateCompatibility } from "../compatibility-C_zWVjYl.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { isMainThread, parentPort } from "node:worker_threads";
|
|
5
5
|
import fs from "node:fs";
|
|
@@ -395,7 +395,7 @@ function storeProjectConfig() {
|
|
|
395
395
|
function storeAppConfig() {
|
|
396
396
|
const content = parseContentByPath(`${pathInfo.workPath}/app.json`);
|
|
397
397
|
const newObj = {};
|
|
398
|
-
for (const key in content) if (Object.
|
|
398
|
+
for (const key in content) if (Object.prototype.hasOwnProperty.call(content, key)) if (key === "subpackages") newObj.subPackages = content[key];
|
|
399
399
|
else newObj[key] = content[key];
|
|
400
400
|
configInfo.appInfo = newObj;
|
|
401
401
|
}
|
|
@@ -369,7 +369,7 @@ function storeProjectConfig() {
|
|
|
369
369
|
function storeAppConfig() {
|
|
370
370
|
const content = parseContentByPath(`${pathInfo.workPath}/app.json`);
|
|
371
371
|
const newObj = {};
|
|
372
|
-
for (const key in content) if (Object.
|
|
372
|
+
for (const key in content) if (Object.prototype.hasOwnProperty.call(content, key)) if (key === "subpackages") newObj.subPackages = content[key];
|
|
373
373
|
else newObj[key] = content[key];
|
|
374
374
|
configInfo.appInfo = newObj;
|
|
375
375
|
}
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as getPages, l as getTargetPath, m as collectAssets, n as getAppId, p as storeInfo, r as getAppName, s as getPageConfigInfo, t as getAppConfigInfo, u as getWorkPath, y as art_default } from "./env-
|
|
1
|
+
import { c as getPages, l as getTargetPath, m as collectAssets, n as getAppId, p as storeInfo, r as getAppName, s as getPageConfigInfo, t as getAppConfigInfo, u as getWorkPath, y as art_default } from "./env-p9Az8lv5.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { Worker } from "node:worker_threads";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimina/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "星河编译工具",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"commander": "^14.0.3",
|
|
59
59
|
"cssnano": "^8.0.1",
|
|
60
60
|
"esbuild": "^0.28.0",
|
|
61
|
-
"htmlparser2": "^
|
|
61
|
+
"htmlparser2": "^12.0.0",
|
|
62
62
|
"less": "^4.6.4",
|
|
63
63
|
"listr2": "^9.0.5",
|
|
64
64
|
"magic-string": "^0.30.21",
|