weapp-vite 1.3.2 → 1.3.4
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/{chunk-455ARQ2V.mjs → chunk-S7BZPKXE.mjs} +14 -18
- package/dist/cli.cjs +14 -18
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +13 -17
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import logger from "@weapp-core/logger";
|
|
|
3
3
|
var logger_default = logger;
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
|
-
var version = "1.3.
|
|
6
|
+
var version = "1.3.4";
|
|
7
7
|
|
|
8
8
|
// src/constants.ts
|
|
9
9
|
var VERSION = version;
|
|
@@ -164,6 +164,12 @@ function vitePluginWeapp(ctx) {
|
|
|
164
164
|
function relative(p) {
|
|
165
165
|
return path4.relative(configResolved.root, p);
|
|
166
166
|
}
|
|
167
|
+
function transformAbsoluteToRelative(p) {
|
|
168
|
+
if (path4.isAbsolute(p)) {
|
|
169
|
+
return relative(p);
|
|
170
|
+
}
|
|
171
|
+
return p;
|
|
172
|
+
}
|
|
167
173
|
function getInputOption(entries) {
|
|
168
174
|
return entries.reduce((acc, cur) => {
|
|
169
175
|
acc[relative(cur)] = cur;
|
|
@@ -191,18 +197,9 @@ function vitePluginWeapp(ctx) {
|
|
|
191
197
|
async buildStart() {
|
|
192
198
|
const { build: build2 } = configResolved;
|
|
193
199
|
const ignore = [
|
|
194
|
-
...defaultExcluded
|
|
200
|
+
...defaultExcluded,
|
|
201
|
+
`${build2.outDir}/**`
|
|
195
202
|
];
|
|
196
|
-
ignore.push(
|
|
197
|
-
...[
|
|
198
|
-
`${build2.outDir}/**`,
|
|
199
|
-
"project.config.json",
|
|
200
|
-
"project.private.config.json",
|
|
201
|
-
"package.json",
|
|
202
|
-
"tsconfig.json",
|
|
203
|
-
"tsconfig.node.json"
|
|
204
|
-
]
|
|
205
|
-
);
|
|
206
203
|
const relFiles = await new Fdir().withRelativePaths().globWithOptions(
|
|
207
204
|
[path4.join(ctx.srcRoot ?? "", "**/*.{wxml,wxs,png,jpg,jpeg,gif,svg,webp}")],
|
|
208
205
|
{
|
|
@@ -266,9 +263,9 @@ function vitePluginWeapp(ctx) {
|
|
|
266
263
|
}
|
|
267
264
|
},
|
|
268
265
|
// for debug
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
watchChange(id, change) {
|
|
267
|
+
logger_default.success(`[${change.event}] ${transformAbsoluteToRelative(id)}`);
|
|
268
|
+
},
|
|
272
269
|
generateBundle(_options, bundle) {
|
|
273
270
|
const bundleKeys = Object.keys(bundle);
|
|
274
271
|
for (const bundleKey of bundleKeys) {
|
|
@@ -327,7 +324,6 @@ var CompilerContext = class {
|
|
|
327
324
|
projectConfig: {},
|
|
328
325
|
type: "app",
|
|
329
326
|
inlineConfig: {},
|
|
330
|
-
mode: "",
|
|
331
327
|
packageJson: {}
|
|
332
328
|
});
|
|
333
329
|
this.cwd = cwd;
|
|
@@ -390,7 +386,7 @@ var CompilerContext = class {
|
|
|
390
386
|
const getWatcher = (paths, opts, inlineConfig2) => {
|
|
391
387
|
const watcher = watch(paths, opts);
|
|
392
388
|
let isReady = false;
|
|
393
|
-
watcher.on("all", async (eventName) => {
|
|
389
|
+
watcher.on("all", async (eventName, _p) => {
|
|
394
390
|
if (isReady && (eventName === "add" || eventName === "change" || eventName === "unlink")) {
|
|
395
391
|
await this.internalDev(inlineConfig2);
|
|
396
392
|
}
|
|
@@ -556,7 +552,7 @@ var CompilerContext = class {
|
|
|
556
552
|
for (const dep of dependencies) {
|
|
557
553
|
const id = `${dep}/package.json`;
|
|
558
554
|
const targetJson = require2(id);
|
|
559
|
-
if ("miniprogram"
|
|
555
|
+
if (Reflect.has(targetJson, "miniprogram") && targetJson.miniprogram) {
|
|
560
556
|
const targetJsonPath = require2.resolve(id);
|
|
561
557
|
await fs6.copy(
|
|
562
558
|
path5.resolve(
|
package/dist/cli.cjs
CHANGED
|
@@ -32,7 +32,7 @@ var import_cac = require("cac");
|
|
|
32
32
|
var import_weapp_ide_cli = require("weapp-ide-cli");
|
|
33
33
|
|
|
34
34
|
// package.json
|
|
35
|
-
var version = "1.3.
|
|
35
|
+
var version = "1.3.4";
|
|
36
36
|
|
|
37
37
|
// src/constants.ts
|
|
38
38
|
var VERSION = version;
|
|
@@ -197,6 +197,12 @@ function vitePluginWeapp(ctx) {
|
|
|
197
197
|
function relative(p) {
|
|
198
198
|
return import_pathe4.default.relative(configResolved.root, p);
|
|
199
199
|
}
|
|
200
|
+
function transformAbsoluteToRelative(p) {
|
|
201
|
+
if (import_pathe4.default.isAbsolute(p)) {
|
|
202
|
+
return relative(p);
|
|
203
|
+
}
|
|
204
|
+
return p;
|
|
205
|
+
}
|
|
200
206
|
function getInputOption(entries) {
|
|
201
207
|
return entries.reduce((acc, cur) => {
|
|
202
208
|
acc[relative(cur)] = cur;
|
|
@@ -224,18 +230,9 @@ function vitePluginWeapp(ctx) {
|
|
|
224
230
|
async buildStart() {
|
|
225
231
|
const { build: build2 } = configResolved;
|
|
226
232
|
const ignore = [
|
|
227
|
-
...defaultExcluded
|
|
233
|
+
...defaultExcluded,
|
|
234
|
+
`${build2.outDir}/**`
|
|
228
235
|
];
|
|
229
|
-
ignore.push(
|
|
230
|
-
...[
|
|
231
|
-
`${build2.outDir}/**`,
|
|
232
|
-
"project.config.json",
|
|
233
|
-
"project.private.config.json",
|
|
234
|
-
"package.json",
|
|
235
|
-
"tsconfig.json",
|
|
236
|
-
"tsconfig.node.json"
|
|
237
|
-
]
|
|
238
|
-
);
|
|
239
236
|
const relFiles = await new import_fdir.fdir().withRelativePaths().globWithOptions(
|
|
240
237
|
[import_pathe4.default.join(ctx.srcRoot ?? "", "**/*.{wxml,wxs,png,jpg,jpeg,gif,svg,webp}")],
|
|
241
238
|
{
|
|
@@ -299,9 +296,9 @@ function vitePluginWeapp(ctx) {
|
|
|
299
296
|
}
|
|
300
297
|
},
|
|
301
298
|
// for debug
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
299
|
+
watchChange(id, change) {
|
|
300
|
+
logger_default.success(`[${change.event}] ${transformAbsoluteToRelative(id)}`);
|
|
301
|
+
},
|
|
305
302
|
generateBundle(_options, bundle) {
|
|
306
303
|
const bundleKeys = Object.keys(bundle);
|
|
307
304
|
for (const bundleKey of bundleKeys) {
|
|
@@ -360,7 +357,6 @@ var CompilerContext = class {
|
|
|
360
357
|
projectConfig: {},
|
|
361
358
|
type: "app",
|
|
362
359
|
inlineConfig: {},
|
|
363
|
-
mode: "",
|
|
364
360
|
packageJson: {}
|
|
365
361
|
});
|
|
366
362
|
this.cwd = cwd;
|
|
@@ -423,7 +419,7 @@ var CompilerContext = class {
|
|
|
423
419
|
const getWatcher = (paths, opts, inlineConfig2) => {
|
|
424
420
|
const watcher = (0, import_chokidar.watch)(paths, opts);
|
|
425
421
|
let isReady = false;
|
|
426
|
-
watcher.on("all", async (eventName) => {
|
|
422
|
+
watcher.on("all", async (eventName, _p) => {
|
|
427
423
|
if (isReady && (eventName === "add" || eventName === "change" || eventName === "unlink")) {
|
|
428
424
|
await this.internalDev(inlineConfig2);
|
|
429
425
|
}
|
|
@@ -589,7 +585,7 @@ var CompilerContext = class {
|
|
|
589
585
|
for (const dep of dependencies) {
|
|
590
586
|
const id = `${dep}/package.json`;
|
|
591
587
|
const targetJson = require2(id);
|
|
592
|
-
if ("miniprogram"
|
|
588
|
+
if (Reflect.has(targetJson, "miniprogram") && targetJson.miniprogram) {
|
|
593
589
|
const targetJsonPath = require2.resolve(id);
|
|
594
590
|
await import_fs_extra6.default.copy(
|
|
595
591
|
import_pathe5.default.resolve(
|
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -201,6 +201,12 @@ function vitePluginWeapp(ctx) {
|
|
|
201
201
|
function relative(p) {
|
|
202
202
|
return import_pathe4.default.relative(configResolved.root, p);
|
|
203
203
|
}
|
|
204
|
+
function transformAbsoluteToRelative(p) {
|
|
205
|
+
if (import_pathe4.default.isAbsolute(p)) {
|
|
206
|
+
return relative(p);
|
|
207
|
+
}
|
|
208
|
+
return p;
|
|
209
|
+
}
|
|
204
210
|
function getInputOption(entries) {
|
|
205
211
|
return entries.reduce((acc, cur) => {
|
|
206
212
|
acc[relative(cur)] = cur;
|
|
@@ -228,18 +234,9 @@ function vitePluginWeapp(ctx) {
|
|
|
228
234
|
async buildStart() {
|
|
229
235
|
const { build: build2 } = configResolved;
|
|
230
236
|
const ignore = [
|
|
231
|
-
...defaultExcluded
|
|
237
|
+
...defaultExcluded,
|
|
238
|
+
`${build2.outDir}/**`
|
|
232
239
|
];
|
|
233
|
-
ignore.push(
|
|
234
|
-
...[
|
|
235
|
-
`${build2.outDir}/**`,
|
|
236
|
-
"project.config.json",
|
|
237
|
-
"project.private.config.json",
|
|
238
|
-
"package.json",
|
|
239
|
-
"tsconfig.json",
|
|
240
|
-
"tsconfig.node.json"
|
|
241
|
-
]
|
|
242
|
-
);
|
|
243
240
|
const relFiles = await new import_fdir.fdir().withRelativePaths().globWithOptions(
|
|
244
241
|
[import_pathe4.default.join(ctx.srcRoot ?? "", "**/*.{wxml,wxs,png,jpg,jpeg,gif,svg,webp}")],
|
|
245
242
|
{
|
|
@@ -303,9 +300,9 @@ function vitePluginWeapp(ctx) {
|
|
|
303
300
|
}
|
|
304
301
|
},
|
|
305
302
|
// for debug
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
303
|
+
watchChange(id, change) {
|
|
304
|
+
logger_default.success(`[${change.event}] ${transformAbsoluteToRelative(id)}`);
|
|
305
|
+
},
|
|
309
306
|
generateBundle(_options, bundle) {
|
|
310
307
|
const bundleKeys = Object.keys(bundle);
|
|
311
308
|
for (const bundleKey of bundleKeys) {
|
|
@@ -364,7 +361,6 @@ var CompilerContext = class {
|
|
|
364
361
|
projectConfig: {},
|
|
365
362
|
type: "app",
|
|
366
363
|
inlineConfig: {},
|
|
367
|
-
mode: "",
|
|
368
364
|
packageJson: {}
|
|
369
365
|
});
|
|
370
366
|
this.cwd = cwd;
|
|
@@ -427,7 +423,7 @@ var CompilerContext = class {
|
|
|
427
423
|
const getWatcher = (paths, opts, inlineConfig2) => {
|
|
428
424
|
const watcher = (0, import_chokidar.watch)(paths, opts);
|
|
429
425
|
let isReady = false;
|
|
430
|
-
watcher.on("all", async (eventName) => {
|
|
426
|
+
watcher.on("all", async (eventName, _p) => {
|
|
431
427
|
if (isReady && (eventName === "add" || eventName === "change" || eventName === "unlink")) {
|
|
432
428
|
await this.internalDev(inlineConfig2);
|
|
433
429
|
}
|
|
@@ -593,7 +589,7 @@ var CompilerContext = class {
|
|
|
593
589
|
for (const dep of dependencies) {
|
|
594
590
|
const id = `${dep}/package.json`;
|
|
595
591
|
const targetJson = require2(id);
|
|
596
|
-
if ("miniprogram"
|
|
592
|
+
if (Reflect.has(targetJson, "miniprogram") && targetJson.miniprogram) {
|
|
597
593
|
const targetJsonPath = require2.resolve(id);
|
|
598
594
|
await import_fs_extra6.default.copy(
|
|
599
595
|
import_pathe5.default.resolve(
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.4",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"tsup": "^8.3.0",
|
|
63
63
|
"vite-tsconfig-paths": "^5.0.1",
|
|
64
64
|
"@weapp-core/init": "^1.0.5",
|
|
65
|
-
"
|
|
65
|
+
"weapp-ide-cli": "^2.0.6",
|
|
66
66
|
"@weapp-core/shared": "^1.0.1",
|
|
67
|
-
"weapp-
|
|
67
|
+
"@weapp-core/logger": "^1.0.1"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public",
|