@dimina/compiler 1.0.7 → 1.0.8
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/README.md +48 -0
- package/dist/core/logic-compiler.cjs +90 -13
- package/dist/core/logic-compiler.js +90 -13
- package/dist/core/style-compiler.cjs +59 -6
- package/dist/core/style-compiler.js +43 -7
- package/dist/core/view-compiler.cjs +538 -69
- package/dist/core/view-compiler.js +538 -69
- package/dist/env-Cmen1qwy.cjs +543 -0
- package/dist/env-Csj3AHY4.js +544 -0
- package/dist/index.cjs +195 -1
- package/dist/index.js +195 -1
- package/package.json +15 -11
- package/dist/env-CGYKCSjT.cjs +0 -322
- package/dist/env-fkuCnng-.js +0 -323
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ const node_worker_threads = require("node:worker_threads");
|
|
|
5
5
|
const listr2 = require("listr2");
|
|
6
6
|
const process = require("node:process");
|
|
7
7
|
const fs = require("node:fs");
|
|
8
|
-
const env = require("./env-
|
|
8
|
+
const env = require("./env-Cmen1qwy.cjs");
|
|
9
9
|
const os = require("node:os");
|
|
10
10
|
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
11
11
|
const artCode = `
|
|
@@ -114,6 +114,193 @@ class WorkerPool {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
const workerPool = new WorkerPool();
|
|
117
|
+
class NpmBuilder {
|
|
118
|
+
constructor(workPath, targetPath) {
|
|
119
|
+
this.workPath = workPath;
|
|
120
|
+
this.targetPath = targetPath;
|
|
121
|
+
this.builtPackages = /* @__PURE__ */ new Set();
|
|
122
|
+
this.packageDependencies = /* @__PURE__ */ new Map();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 构建 npm 包
|
|
126
|
+
* 扫描 miniprogram_npm 目录并构建相关包
|
|
127
|
+
*/
|
|
128
|
+
async buildNpmPackages() {
|
|
129
|
+
const miniprogramNpmPaths = this.findMiniprogramNpmDirs();
|
|
130
|
+
for (const npmPath of miniprogramNpmPaths) {
|
|
131
|
+
await this.buildNpmDir(npmPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 查找所有 miniprogram_npm 目录
|
|
136
|
+
* @returns {string[]} miniprogram_npm 目录路径数组
|
|
137
|
+
*/
|
|
138
|
+
findMiniprogramNpmDirs() {
|
|
139
|
+
const npmDirs = [];
|
|
140
|
+
const scanDir = (dir, relativePath = "") => {
|
|
141
|
+
if (!fs.existsSync(dir)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
145
|
+
for (const item of items) {
|
|
146
|
+
if (item.isDirectory()) {
|
|
147
|
+
const itemPath = path.join(dir, item.name);
|
|
148
|
+
const itemRelativePath = relativePath ? `${relativePath}/${item.name}` : item.name;
|
|
149
|
+
if (item.name === "miniprogram_npm") {
|
|
150
|
+
npmDirs.push(itemRelativePath);
|
|
151
|
+
} else {
|
|
152
|
+
scanDir(itemPath, itemRelativePath);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
scanDir(this.workPath);
|
|
158
|
+
return npmDirs;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 构建指定的 miniprogram_npm 目录
|
|
162
|
+
* @param {string} npmDirPath miniprogram_npm 目录路径
|
|
163
|
+
*/
|
|
164
|
+
async buildNpmDir(npmDirPath) {
|
|
165
|
+
const fullNpmPath = path.join(this.workPath, npmDirPath);
|
|
166
|
+
if (!fs.existsSync(fullNpmPath)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const packages = fs.readdirSync(fullNpmPath, { withFileTypes: true }).filter((item) => item.isDirectory()).map((item) => item.name);
|
|
170
|
+
for (const packageName of packages) {
|
|
171
|
+
await this.buildPackage(packageName, npmDirPath);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 构建单个 npm 包
|
|
176
|
+
* @param {string} packageName 包名
|
|
177
|
+
* @param {string} npmDirPath miniprogram_npm 目录路径
|
|
178
|
+
*/
|
|
179
|
+
async buildPackage(packageName, npmDirPath) {
|
|
180
|
+
const packageKey = `${npmDirPath}/${packageName}`;
|
|
181
|
+
if (this.builtPackages.has(packageKey)) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const packagePath = path.join(this.workPath, npmDirPath, packageName);
|
|
185
|
+
const targetPackagePath = path.join(this.targetPath, npmDirPath, packageName);
|
|
186
|
+
if (!fs.existsSync(path.dirname(targetPackagePath))) {
|
|
187
|
+
fs.mkdirSync(path.dirname(targetPackagePath), { recursive: true });
|
|
188
|
+
}
|
|
189
|
+
await this.copyPackageFiles(packagePath, targetPackagePath);
|
|
190
|
+
await this.processDependencies(packageName, packagePath, npmDirPath);
|
|
191
|
+
this.builtPackages.add(packageKey);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* 复制包文件
|
|
195
|
+
* @param {string} sourcePath 源路径
|
|
196
|
+
* @param {string} targetPath 目标路径
|
|
197
|
+
*/
|
|
198
|
+
async copyPackageFiles(sourcePath, targetPath) {
|
|
199
|
+
if (!fs.existsSync(sourcePath)) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (!fs.existsSync(targetPath)) {
|
|
203
|
+
fs.mkdirSync(targetPath, { recursive: true });
|
|
204
|
+
}
|
|
205
|
+
const items = fs.readdirSync(sourcePath, { withFileTypes: true });
|
|
206
|
+
for (const item of items) {
|
|
207
|
+
const sourceItemPath = path.join(sourcePath, item.name);
|
|
208
|
+
const targetItemPath = path.join(targetPath, item.name);
|
|
209
|
+
if (item.isDirectory()) {
|
|
210
|
+
await this.copyPackageFiles(sourceItemPath, targetItemPath);
|
|
211
|
+
} else {
|
|
212
|
+
if (this.isMiniprogramFile(item.name)) {
|
|
213
|
+
fs.copyFileSync(sourceItemPath, targetItemPath);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* 检查是否为小程序相关文件
|
|
220
|
+
* @param {string} filename 文件名
|
|
221
|
+
* @returns {boolean} 是否为小程序文件
|
|
222
|
+
*/
|
|
223
|
+
isMiniprogramFile(filename) {
|
|
224
|
+
const miniprogramExts = [".js", ".json", ".wxml", ".wxss", ".wxs", ".ts", ".less", ".scss", ".styl"];
|
|
225
|
+
const ext = path.extname(filename).toLowerCase();
|
|
226
|
+
return miniprogramExts.includes(ext) || filename === "package.json" || filename === "README.md" || filename.startsWith(".");
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 处理包依赖
|
|
230
|
+
* @param {string} packageName 包名
|
|
231
|
+
* @param {string} packagePath 包路径
|
|
232
|
+
* @param {string} npmDirPath npm 目录路径
|
|
233
|
+
*/
|
|
234
|
+
async processDependencies(packageName, packagePath, npmDirPath) {
|
|
235
|
+
const packageJsonPath = path.join(packagePath, "package.json");
|
|
236
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
241
|
+
const dependencies = {
|
|
242
|
+
...packageJson.dependencies,
|
|
243
|
+
...packageJson.peerDependencies
|
|
244
|
+
};
|
|
245
|
+
if (dependencies && Object.keys(dependencies).length > 0) {
|
|
246
|
+
this.packageDependencies.set(packageName, dependencies);
|
|
247
|
+
for (const depName of Object.keys(dependencies)) {
|
|
248
|
+
await this.buildPackage(depName, npmDirPath);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} catch (e) {
|
|
252
|
+
console.warn(`[npm-builder] 解析 package.json 失败: ${packageJsonPath}`, e.message);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 验证 npm 包的完整性
|
|
257
|
+
* @param {string} packageName 包名
|
|
258
|
+
* @param {string} packagePath 包路径
|
|
259
|
+
* @returns {boolean} 是否有效
|
|
260
|
+
*/
|
|
261
|
+
validatePackage(packageName, packagePath) {
|
|
262
|
+
const requiredFiles = ["package.json"];
|
|
263
|
+
for (const file of requiredFiles) {
|
|
264
|
+
if (!fs.existsSync(path.join(packagePath, file))) {
|
|
265
|
+
console.warn(`[npm-builder] 包 ${packageName} 缺少必要文件: ${file}`);
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
const packageJsonPath = path.join(packagePath, "package.json");
|
|
271
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
272
|
+
if (!packageJson.name || !packageJson.version) {
|
|
273
|
+
console.warn(`[npm-builder] 包 ${packageName} 的 package.json 格式不正确`);
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
} catch (e) {
|
|
277
|
+
console.warn(`[npm-builder] 包 ${packageName} 的 package.json 解析失败:`, e.message);
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* 获取已构建的包列表
|
|
284
|
+
* @returns {string[]} 已构建的包列表
|
|
285
|
+
*/
|
|
286
|
+
getBuiltPackages() {
|
|
287
|
+
return Array.from(this.builtPackages);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* 获取包依赖关系
|
|
291
|
+
* @returns {Map} 包依赖关系映射
|
|
292
|
+
*/
|
|
293
|
+
getPackageDependencies() {
|
|
294
|
+
return this.packageDependencies;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* 清理构建缓存
|
|
298
|
+
*/
|
|
299
|
+
clearCache() {
|
|
300
|
+
this.builtPackages.clear();
|
|
301
|
+
this.packageDependencies.clear();
|
|
302
|
+
}
|
|
303
|
+
}
|
|
117
304
|
function compileConfig() {
|
|
118
305
|
const compileResInfo = {
|
|
119
306
|
app: env.getAppConfigInfo(),
|
|
@@ -156,6 +343,13 @@ async function build(targetPath, workPath, useAppIdDir = true) {
|
|
|
156
343
|
task: () => {
|
|
157
344
|
compileConfig();
|
|
158
345
|
}
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
title: "构建 npm 包",
|
|
349
|
+
task: async () => {
|
|
350
|
+
const npmBuilder = new NpmBuilder(env.getWorkPath(), env.getTargetPath());
|
|
351
|
+
await npmBuilder.buildNpmPackages();
|
|
352
|
+
}
|
|
159
353
|
}
|
|
160
354
|
],
|
|
161
355
|
{ concurrent: false }
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Worker } from "node:worker_threads";
|
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import fs from "node:fs";
|
|
7
|
-
import { g as getTargetPath, f as getAppId, k as getAppName, l as getPageConfigInfo, j as getAppConfigInfo, s as storeInfo, m as getPages } from "./env-
|
|
7
|
+
import { g as getTargetPath, f as getAppId, k as getAppName, l as getPageConfigInfo, j as getAppConfigInfo, s as storeInfo, d as getWorkPath, m as getPages } from "./env-Csj3AHY4.js";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
const artCode = `
|
|
10
10
|
██████╗ ██╗███╗ ███╗██╗███╗ ██╗ █████╗
|
|
@@ -112,6 +112,193 @@ class WorkerPool {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
const workerPool = new WorkerPool();
|
|
115
|
+
class NpmBuilder {
|
|
116
|
+
constructor(workPath, targetPath) {
|
|
117
|
+
this.workPath = workPath;
|
|
118
|
+
this.targetPath = targetPath;
|
|
119
|
+
this.builtPackages = /* @__PURE__ */ new Set();
|
|
120
|
+
this.packageDependencies = /* @__PURE__ */ new Map();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 构建 npm 包
|
|
124
|
+
* 扫描 miniprogram_npm 目录并构建相关包
|
|
125
|
+
*/
|
|
126
|
+
async buildNpmPackages() {
|
|
127
|
+
const miniprogramNpmPaths = this.findMiniprogramNpmDirs();
|
|
128
|
+
for (const npmPath of miniprogramNpmPaths) {
|
|
129
|
+
await this.buildNpmDir(npmPath);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 查找所有 miniprogram_npm 目录
|
|
134
|
+
* @returns {string[]} miniprogram_npm 目录路径数组
|
|
135
|
+
*/
|
|
136
|
+
findMiniprogramNpmDirs() {
|
|
137
|
+
const npmDirs = [];
|
|
138
|
+
const scanDir = (dir, relativePath = "") => {
|
|
139
|
+
if (!fs.existsSync(dir)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
143
|
+
for (const item of items) {
|
|
144
|
+
if (item.isDirectory()) {
|
|
145
|
+
const itemPath = path.join(dir, item.name);
|
|
146
|
+
const itemRelativePath = relativePath ? `${relativePath}/${item.name}` : item.name;
|
|
147
|
+
if (item.name === "miniprogram_npm") {
|
|
148
|
+
npmDirs.push(itemRelativePath);
|
|
149
|
+
} else {
|
|
150
|
+
scanDir(itemPath, itemRelativePath);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
scanDir(this.workPath);
|
|
156
|
+
return npmDirs;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 构建指定的 miniprogram_npm 目录
|
|
160
|
+
* @param {string} npmDirPath miniprogram_npm 目录路径
|
|
161
|
+
*/
|
|
162
|
+
async buildNpmDir(npmDirPath) {
|
|
163
|
+
const fullNpmPath = path.join(this.workPath, npmDirPath);
|
|
164
|
+
if (!fs.existsSync(fullNpmPath)) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const packages = fs.readdirSync(fullNpmPath, { withFileTypes: true }).filter((item) => item.isDirectory()).map((item) => item.name);
|
|
168
|
+
for (const packageName of packages) {
|
|
169
|
+
await this.buildPackage(packageName, npmDirPath);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 构建单个 npm 包
|
|
174
|
+
* @param {string} packageName 包名
|
|
175
|
+
* @param {string} npmDirPath miniprogram_npm 目录路径
|
|
176
|
+
*/
|
|
177
|
+
async buildPackage(packageName, npmDirPath) {
|
|
178
|
+
const packageKey = `${npmDirPath}/${packageName}`;
|
|
179
|
+
if (this.builtPackages.has(packageKey)) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const packagePath = path.join(this.workPath, npmDirPath, packageName);
|
|
183
|
+
const targetPackagePath = path.join(this.targetPath, npmDirPath, packageName);
|
|
184
|
+
if (!fs.existsSync(path.dirname(targetPackagePath))) {
|
|
185
|
+
fs.mkdirSync(path.dirname(targetPackagePath), { recursive: true });
|
|
186
|
+
}
|
|
187
|
+
await this.copyPackageFiles(packagePath, targetPackagePath);
|
|
188
|
+
await this.processDependencies(packageName, packagePath, npmDirPath);
|
|
189
|
+
this.builtPackages.add(packageKey);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 复制包文件
|
|
193
|
+
* @param {string} sourcePath 源路径
|
|
194
|
+
* @param {string} targetPath 目标路径
|
|
195
|
+
*/
|
|
196
|
+
async copyPackageFiles(sourcePath, targetPath) {
|
|
197
|
+
if (!fs.existsSync(sourcePath)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (!fs.existsSync(targetPath)) {
|
|
201
|
+
fs.mkdirSync(targetPath, { recursive: true });
|
|
202
|
+
}
|
|
203
|
+
const items = fs.readdirSync(sourcePath, { withFileTypes: true });
|
|
204
|
+
for (const item of items) {
|
|
205
|
+
const sourceItemPath = path.join(sourcePath, item.name);
|
|
206
|
+
const targetItemPath = path.join(targetPath, item.name);
|
|
207
|
+
if (item.isDirectory()) {
|
|
208
|
+
await this.copyPackageFiles(sourceItemPath, targetItemPath);
|
|
209
|
+
} else {
|
|
210
|
+
if (this.isMiniprogramFile(item.name)) {
|
|
211
|
+
fs.copyFileSync(sourceItemPath, targetItemPath);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 检查是否为小程序相关文件
|
|
218
|
+
* @param {string} filename 文件名
|
|
219
|
+
* @returns {boolean} 是否为小程序文件
|
|
220
|
+
*/
|
|
221
|
+
isMiniprogramFile(filename) {
|
|
222
|
+
const miniprogramExts = [".js", ".json", ".wxml", ".wxss", ".wxs", ".ts", ".less", ".scss", ".styl"];
|
|
223
|
+
const ext = path.extname(filename).toLowerCase();
|
|
224
|
+
return miniprogramExts.includes(ext) || filename === "package.json" || filename === "README.md" || filename.startsWith(".");
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* 处理包依赖
|
|
228
|
+
* @param {string} packageName 包名
|
|
229
|
+
* @param {string} packagePath 包路径
|
|
230
|
+
* @param {string} npmDirPath npm 目录路径
|
|
231
|
+
*/
|
|
232
|
+
async processDependencies(packageName, packagePath, npmDirPath) {
|
|
233
|
+
const packageJsonPath = path.join(packagePath, "package.json");
|
|
234
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
239
|
+
const dependencies = {
|
|
240
|
+
...packageJson.dependencies,
|
|
241
|
+
...packageJson.peerDependencies
|
|
242
|
+
};
|
|
243
|
+
if (dependencies && Object.keys(dependencies).length > 0) {
|
|
244
|
+
this.packageDependencies.set(packageName, dependencies);
|
|
245
|
+
for (const depName of Object.keys(dependencies)) {
|
|
246
|
+
await this.buildPackage(depName, npmDirPath);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} catch (e) {
|
|
250
|
+
console.warn(`[npm-builder] 解析 package.json 失败: ${packageJsonPath}`, e.message);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 验证 npm 包的完整性
|
|
255
|
+
* @param {string} packageName 包名
|
|
256
|
+
* @param {string} packagePath 包路径
|
|
257
|
+
* @returns {boolean} 是否有效
|
|
258
|
+
*/
|
|
259
|
+
validatePackage(packageName, packagePath) {
|
|
260
|
+
const requiredFiles = ["package.json"];
|
|
261
|
+
for (const file of requiredFiles) {
|
|
262
|
+
if (!fs.existsSync(path.join(packagePath, file))) {
|
|
263
|
+
console.warn(`[npm-builder] 包 ${packageName} 缺少必要文件: ${file}`);
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
try {
|
|
268
|
+
const packageJsonPath = path.join(packagePath, "package.json");
|
|
269
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
270
|
+
if (!packageJson.name || !packageJson.version) {
|
|
271
|
+
console.warn(`[npm-builder] 包 ${packageName} 的 package.json 格式不正确`);
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
} catch (e) {
|
|
275
|
+
console.warn(`[npm-builder] 包 ${packageName} 的 package.json 解析失败:`, e.message);
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 获取已构建的包列表
|
|
282
|
+
* @returns {string[]} 已构建的包列表
|
|
283
|
+
*/
|
|
284
|
+
getBuiltPackages() {
|
|
285
|
+
return Array.from(this.builtPackages);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 获取包依赖关系
|
|
289
|
+
* @returns {Map} 包依赖关系映射
|
|
290
|
+
*/
|
|
291
|
+
getPackageDependencies() {
|
|
292
|
+
return this.packageDependencies;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 清理构建缓存
|
|
296
|
+
*/
|
|
297
|
+
clearCache() {
|
|
298
|
+
this.builtPackages.clear();
|
|
299
|
+
this.packageDependencies.clear();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
115
302
|
function compileConfig() {
|
|
116
303
|
const compileResInfo = {
|
|
117
304
|
app: getAppConfigInfo(),
|
|
@@ -154,6 +341,13 @@ async function build(targetPath, workPath, useAppIdDir = true) {
|
|
|
154
341
|
task: () => {
|
|
155
342
|
compileConfig();
|
|
156
343
|
}
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
title: "构建 npm 包",
|
|
347
|
+
task: async () => {
|
|
348
|
+
const npmBuilder = new NpmBuilder(getWorkPath(), getTargetPath());
|
|
349
|
+
await npmBuilder.buildNpmPackages();
|
|
350
|
+
}
|
|
157
351
|
}
|
|
158
352
|
],
|
|
159
353
|
{ concurrent: false }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimina/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "星河编译工具",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -45,20 +45,24 @@
|
|
|
45
45
|
"星河"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@babel/core": "^7.
|
|
49
|
-
"@babel/
|
|
50
|
-
"@babel/
|
|
51
|
-
"@
|
|
48
|
+
"@babel/core": "^7.28.3",
|
|
49
|
+
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
50
|
+
"@babel/traverse": "^7.28.3",
|
|
51
|
+
"@babel/types": "^7.28.2",
|
|
52
|
+
"@vue/compiler-sfc": "^3.5.19",
|
|
52
53
|
"autoprefixer": "^10.4.21",
|
|
53
|
-
"cheerio": "^1.1.
|
|
54
|
+
"cheerio": "^1.1.2",
|
|
54
55
|
"chokidar": "^4.0.3",
|
|
55
56
|
"commander": "^14.0.0",
|
|
56
|
-
"cssnano": "^7.0
|
|
57
|
-
"esbuild": "^0.25.
|
|
57
|
+
"cssnano": "^7.1.0",
|
|
58
|
+
"esbuild": "^0.25.9",
|
|
58
59
|
"htmlparser2": "^10.0.0",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"postcss
|
|
60
|
+
"less": "^4.4.1",
|
|
61
|
+
"listr2": "^9.0.2",
|
|
62
|
+
"postcss": "^8.5.6",
|
|
63
|
+
"postcss-selector-parser": "^7.1.0",
|
|
64
|
+
"sass": "^1.90.0",
|
|
65
|
+
"typescript": "^5.9.2"
|
|
62
66
|
},
|
|
63
67
|
"publishConfig": {
|
|
64
68
|
"registry": "https://registry.npmjs.org/"
|