@dimina/compiler 1.0.12 → 1.0.14-beta.0
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 +100 -29
- package/dist/bin/index.js +92 -23
- package/dist/core/logic-compiler.cjs +351 -361
- package/dist/core/logic-compiler.js +340 -355
- package/dist/core/style-compiler.cjs +220 -228
- package/dist/core/style-compiler.js +200 -206
- package/dist/core/view-compiler.cjs +1224 -8312
- package/dist/core/view-compiler.js +1201 -8289
- package/dist/env-DgCLbrQb.js +560 -0
- package/dist/env-M-7lpbHL.cjs +705 -0
- package/dist/index.cjs +420 -461
- package/dist/index.js +410 -455
- package/package.json +10 -10
- package/dist/env-Cmen1qwy.cjs +0 -543
- package/dist/env-QQjdhY-G.js +0 -544
package/dist/bin/index.cjs
CHANGED
|
@@ -1,33 +1,104 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
const require_env = require("../env-M-7lpbHL.cjs");
|
|
3
|
+
const require_index = require("../index.cjs");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_env.__toESM(node_path, 1);
|
|
6
|
+
let node_process = require("node:process");
|
|
7
|
+
node_process = require_env.__toESM(node_process, 1);
|
|
8
|
+
let chokidar = require("chokidar");
|
|
9
|
+
chokidar = require_env.__toESM(chokidar, 1);
|
|
10
|
+
let commander = require("commander");
|
|
11
|
+
var package_default = {
|
|
12
|
+
name: "@dimina/compiler",
|
|
13
|
+
version: "1.0.14-beta.0",
|
|
14
|
+
description: "星河编译工具",
|
|
15
|
+
main: "./dist/index.cjs",
|
|
16
|
+
module: "./dist/index.js",
|
|
17
|
+
type: "module",
|
|
18
|
+
files: ["dist"],
|
|
19
|
+
exports: {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./view-compiler": {
|
|
25
|
+
"import": "./dist/core/view-compiler.js",
|
|
26
|
+
"require": "./dist/core/view-compiler.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./logic-compiler": {
|
|
29
|
+
"import": "./dist/core/logic-compiler.mjs",
|
|
30
|
+
"require": "./dist/core/logic-compiler.js"
|
|
31
|
+
},
|
|
32
|
+
"./style-compiler": {
|
|
33
|
+
"import": "./dist/core/style-compiler.js",
|
|
34
|
+
"require": "./dist/core/style-compiler.cjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
bin: { "dmcc": "dist/bin/index.js" },
|
|
38
|
+
scripts: {
|
|
39
|
+
"build": "vite build",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:dev": "vitest",
|
|
42
|
+
"coverage": "vitest run --coverage",
|
|
43
|
+
"release:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
|
|
44
|
+
"release": "npm version patch && npm publish"
|
|
45
|
+
},
|
|
46
|
+
author: "doslin",
|
|
47
|
+
license: "Apache-2.0",
|
|
48
|
+
keywords: [
|
|
49
|
+
"dimina",
|
|
50
|
+
"compiler",
|
|
51
|
+
"miniapp",
|
|
52
|
+
"小程序",
|
|
53
|
+
"星河"
|
|
54
|
+
],
|
|
55
|
+
dependencies: {
|
|
56
|
+
"@babel/core": "^7.29.0",
|
|
57
|
+
"@babel/generator": "^7.29.1",
|
|
58
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
|
|
59
|
+
"@babel/traverse": "^7.29.0",
|
|
60
|
+
"@babel/types": "^7.29.0",
|
|
61
|
+
"@vue/compiler-sfc": "^3.5.32",
|
|
62
|
+
"autoprefixer": "^10.4.27",
|
|
63
|
+
"cheerio": "^1.2.0",
|
|
64
|
+
"chokidar": "^4.0.3",
|
|
65
|
+
"commander": "^14.0.3",
|
|
66
|
+
"cssnano": "^7.1.4",
|
|
67
|
+
"esbuild": "^0.27.7",
|
|
68
|
+
"htmlparser2": "^10.1.0",
|
|
69
|
+
"less": "^4.6.4",
|
|
70
|
+
"listr2": "^9.0.5",
|
|
71
|
+
"magic-string": "^0.30.21",
|
|
72
|
+
"oxc-parser": "^0.123.0",
|
|
73
|
+
"oxc-transform": "^0.124.0",
|
|
74
|
+
"oxc-walker": "^0.7.0",
|
|
75
|
+
"postcss": "^8.5.9",
|
|
76
|
+
"postcss-selector-parser": "^7.1.1",
|
|
77
|
+
"sass": "^1.99.0",
|
|
78
|
+
"typescript": "^6.0.2"
|
|
79
|
+
},
|
|
80
|
+
publishConfig: {
|
|
81
|
+
"registry": "https://registry.npmjs.org/",
|
|
82
|
+
"access": "public"
|
|
83
|
+
}
|
|
11
84
|
};
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/bin/index.js
|
|
12
87
|
commander.program.command("build").option("-c, --work-path <path>", "编译工作目录").option("-s, --target-path <path>", "编译产物存放路径").option("-w, --watch", "启用监听文件改动").option("--no-app-id-dir", "产物根目录不包含appId").action(async (options) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
console.log(`${path2} 改动,重新编译`);
|
|
27
|
-
await index(targetPath, workPath, useAppIdDir);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
88
|
+
const workPath = options.workPath ? node_path.default.resolve(options.workPath) : node_process.default.cwd();
|
|
89
|
+
const targetPath = options.targetPath ? node_path.default.resolve(options.targetPath) : node_process.default.cwd();
|
|
90
|
+
const useAppIdDir = options.appIdDir !== false;
|
|
91
|
+
await require_index(targetPath, workPath, useAppIdDir);
|
|
92
|
+
if (options.watch) chokidar.default.watch(workPath, {
|
|
93
|
+
persistent: true,
|
|
94
|
+
ignoreInitial: true
|
|
95
|
+
}).on("all", async (event, path) => {
|
|
96
|
+
if (event === "change") {
|
|
97
|
+
console.log(`${path} 改动,重新编译`);
|
|
98
|
+
await require_index(targetPath, workPath, useAppIdDir);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
31
101
|
});
|
|
32
|
-
commander.program.name("dmcc").version(
|
|
33
|
-
commander.program.parse(
|
|
102
|
+
commander.program.name("dmcc").version(package_default.version);
|
|
103
|
+
commander.program.parse(node_process.default.argv);
|
|
104
|
+
//#endregion
|
package/dist/bin/index.js
CHANGED
|
@@ -1,32 +1,101 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import build from "../index.js";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import process from "node:process";
|
|
4
5
|
import chokidar from "chokidar";
|
|
5
6
|
import { program } from "commander";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var package_default = {
|
|
8
|
+
name: "@dimina/compiler",
|
|
9
|
+
version: "1.0.14-beta.0",
|
|
10
|
+
description: "星河编译工具",
|
|
11
|
+
main: "./dist/index.cjs",
|
|
12
|
+
module: "./dist/index.js",
|
|
13
|
+
type: "module",
|
|
14
|
+
files: ["dist"],
|
|
15
|
+
exports: {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./view-compiler": {
|
|
21
|
+
"import": "./dist/core/view-compiler.js",
|
|
22
|
+
"require": "./dist/core/view-compiler.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./logic-compiler": {
|
|
25
|
+
"import": "./dist/core/logic-compiler.mjs",
|
|
26
|
+
"require": "./dist/core/logic-compiler.js"
|
|
27
|
+
},
|
|
28
|
+
"./style-compiler": {
|
|
29
|
+
"import": "./dist/core/style-compiler.js",
|
|
30
|
+
"require": "./dist/core/style-compiler.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
bin: { "dmcc": "dist/bin/index.js" },
|
|
34
|
+
scripts: {
|
|
35
|
+
"build": "vite build",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:dev": "vitest",
|
|
38
|
+
"coverage": "vitest run --coverage",
|
|
39
|
+
"release:beta": "npm version prerelease --preid=beta && npm publish --tag beta",
|
|
40
|
+
"release": "npm version patch && npm publish"
|
|
41
|
+
},
|
|
42
|
+
author: "doslin",
|
|
43
|
+
license: "Apache-2.0",
|
|
44
|
+
keywords: [
|
|
45
|
+
"dimina",
|
|
46
|
+
"compiler",
|
|
47
|
+
"miniapp",
|
|
48
|
+
"小程序",
|
|
49
|
+
"星河"
|
|
50
|
+
],
|
|
51
|
+
dependencies: {
|
|
52
|
+
"@babel/core": "^7.29.0",
|
|
53
|
+
"@babel/generator": "^7.29.1",
|
|
54
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
|
|
55
|
+
"@babel/traverse": "^7.29.0",
|
|
56
|
+
"@babel/types": "^7.29.0",
|
|
57
|
+
"@vue/compiler-sfc": "^3.5.32",
|
|
58
|
+
"autoprefixer": "^10.4.27",
|
|
59
|
+
"cheerio": "^1.2.0",
|
|
60
|
+
"chokidar": "^4.0.3",
|
|
61
|
+
"commander": "^14.0.3",
|
|
62
|
+
"cssnano": "^7.1.4",
|
|
63
|
+
"esbuild": "^0.27.7",
|
|
64
|
+
"htmlparser2": "^10.1.0",
|
|
65
|
+
"less": "^4.6.4",
|
|
66
|
+
"listr2": "^9.0.5",
|
|
67
|
+
"magic-string": "^0.30.21",
|
|
68
|
+
"oxc-parser": "^0.123.0",
|
|
69
|
+
"oxc-transform": "^0.124.0",
|
|
70
|
+
"oxc-walker": "^0.7.0",
|
|
71
|
+
"postcss": "^8.5.9",
|
|
72
|
+
"postcss-selector-parser": "^7.1.1",
|
|
73
|
+
"sass": "^1.99.0",
|
|
74
|
+
"typescript": "^6.0.2"
|
|
75
|
+
},
|
|
76
|
+
publishConfig: {
|
|
77
|
+
"registry": "https://registry.npmjs.org/",
|
|
78
|
+
"access": "public"
|
|
79
|
+
}
|
|
10
80
|
};
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/bin/index.js
|
|
11
83
|
program.command("build").option("-c, --work-path <path>", "编译工作目录").option("-s, --target-path <path>", "编译产物存放路径").option("-w, --watch", "启用监听文件改动").option("--no-app-id-dir", "产物根目录不包含appId").action(async (options) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
console.log(`${path2} 改动,重新编译`);
|
|
26
|
-
await build(targetPath, workPath, useAppIdDir);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
84
|
+
const workPath = options.workPath ? path.resolve(options.workPath) : process.cwd();
|
|
85
|
+
const targetPath = options.targetPath ? path.resolve(options.targetPath) : process.cwd();
|
|
86
|
+
const useAppIdDir = options.appIdDir !== false;
|
|
87
|
+
await build(targetPath, workPath, useAppIdDir);
|
|
88
|
+
if (options.watch) chokidar.watch(workPath, {
|
|
89
|
+
persistent: true,
|
|
90
|
+
ignoreInitial: true
|
|
91
|
+
}).on("all", async (event, path) => {
|
|
92
|
+
if (event === "change") {
|
|
93
|
+
console.log(`${path} 改动,重新编译`);
|
|
94
|
+
await build(targetPath, workPath, useAppIdDir);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
30
97
|
});
|
|
31
|
-
program.name("dmcc").version(
|
|
98
|
+
program.name("dmcc").version(package_default.version);
|
|
32
99
|
program.parse(process.argv);
|
|
100
|
+
//#endregion
|
|
101
|
+
export {};
|