weapp-vite 1.1.3 → 1.1.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-VXEA2S4N.mjs → chunk-NPLMSNBG.mjs} +22 -31
- package/dist/cli.cjs +22 -31
- package/dist/cli.mjs +2 -2
- package/dist/index.cjs +21 -30
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -24,7 +24,7 @@ import fg from "fast-glob";
|
|
|
24
24
|
import fs3 from "fs-extra";
|
|
25
25
|
import MagicString from "magic-string";
|
|
26
26
|
import path4 from "pathe";
|
|
27
|
-
import { isCSSRequest
|
|
27
|
+
import { isCSSRequest } from "vite";
|
|
28
28
|
|
|
29
29
|
// src/debugger.ts
|
|
30
30
|
import createDebug from "debug";
|
|
@@ -323,7 +323,6 @@ function getRealPath(res) {
|
|
|
323
323
|
return res.filename;
|
|
324
324
|
}
|
|
325
325
|
function vitePluginWeapp(ctx) {
|
|
326
|
-
const stylesIds = /* @__PURE__ */ new Set();
|
|
327
326
|
let configResolved;
|
|
328
327
|
let entriesSet = /* @__PURE__ */ new Set();
|
|
329
328
|
function relative(p) {
|
|
@@ -440,7 +439,7 @@ function vitePluginWeapp(ctx) {
|
|
|
440
439
|
return source.replace(/\.wxss$/, ".css?wxss");
|
|
441
440
|
}
|
|
442
441
|
},
|
|
443
|
-
load(id) {
|
|
442
|
+
async load(id) {
|
|
444
443
|
if (entriesSet.has(id)) {
|
|
445
444
|
const base = removeExtension2(id);
|
|
446
445
|
const ms = new MagicString(fs3.readFileSync(id, "utf8"));
|
|
@@ -457,41 +456,33 @@ function vitePluginWeapp(ctx) {
|
|
|
457
456
|
code: ms.toString()
|
|
458
457
|
};
|
|
459
458
|
} else if (isCSSRequest(id)) {
|
|
460
|
-
|
|
461
|
-
return {
|
|
462
|
-
code: ""
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
async buildEnd() {
|
|
467
|
-
const styles = {};
|
|
468
|
-
for (const stylesId of stylesIds) {
|
|
469
|
-
const parsed = parseRequest(stylesId);
|
|
459
|
+
const parsed = parseRequest(id);
|
|
470
460
|
const realPath = getRealPath(parsed);
|
|
471
461
|
if (await fs3.exists(realPath)) {
|
|
472
462
|
const css = await fs3.readFile(realPath, "utf8");
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
styles[fileName] += res.code;
|
|
477
|
-
} else {
|
|
478
|
-
styles[fileName] = res.code;
|
|
479
|
-
}
|
|
480
|
-
} else {
|
|
481
|
-
stylesIds.delete(stylesId);
|
|
463
|
+
return {
|
|
464
|
+
code: css
|
|
465
|
+
};
|
|
482
466
|
}
|
|
483
467
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
468
|
+
},
|
|
469
|
+
generateBundle(_options, bundle) {
|
|
470
|
+
const bundleKeys = Object.keys(bundle);
|
|
471
|
+
for (const bundleKey of bundleKeys) {
|
|
472
|
+
const asset = bundle[bundleKey];
|
|
473
|
+
if (bundleKey.endsWith(".css") && asset.type === "asset" && asset.originalFileName?.endsWith(".js")) {
|
|
474
|
+
const newFileName = normalizeCssPath(asset.originalFileName);
|
|
475
|
+
this.emitFile({
|
|
476
|
+
type: "asset",
|
|
477
|
+
fileName: newFileName,
|
|
478
|
+
source: asset.source
|
|
479
|
+
});
|
|
480
|
+
delete bundle[bundleKey];
|
|
481
|
+
}
|
|
490
482
|
}
|
|
491
483
|
}
|
|
492
|
-
//
|
|
493
|
-
//
|
|
494
|
-
// console.log(files)
|
|
484
|
+
// writeBundle(options, bundle) {
|
|
485
|
+
// console.log(options, bundle)
|
|
495
486
|
// },
|
|
496
487
|
},
|
|
497
488
|
{
|
package/dist/cli.cjs
CHANGED
|
@@ -29,7 +29,7 @@ var import_cac = require("cac");
|
|
|
29
29
|
var import_weapp_ide_cli = require("weapp-ide-cli");
|
|
30
30
|
|
|
31
31
|
// package.json
|
|
32
|
-
var version = "1.1.
|
|
32
|
+
var version = "1.1.4";
|
|
33
33
|
|
|
34
34
|
// src/constants.ts
|
|
35
35
|
var VERSION = version;
|
|
@@ -359,7 +359,6 @@ function getRealPath(res) {
|
|
|
359
359
|
return res.filename;
|
|
360
360
|
}
|
|
361
361
|
function vitePluginWeapp(ctx) {
|
|
362
|
-
const stylesIds = /* @__PURE__ */ new Set();
|
|
363
362
|
let configResolved;
|
|
364
363
|
let entriesSet = /* @__PURE__ */ new Set();
|
|
365
364
|
function relative(p) {
|
|
@@ -476,7 +475,7 @@ function vitePluginWeapp(ctx) {
|
|
|
476
475
|
return source.replace(/\.wxss$/, ".css?wxss");
|
|
477
476
|
}
|
|
478
477
|
},
|
|
479
|
-
load(id) {
|
|
478
|
+
async load(id) {
|
|
480
479
|
if (entriesSet.has(id)) {
|
|
481
480
|
const base = (0, import_shared3.removeExtension)(id);
|
|
482
481
|
const ms = new import_magic_string.default(import_fs_extra3.default.readFileSync(id, "utf8"));
|
|
@@ -493,41 +492,33 @@ function vitePluginWeapp(ctx) {
|
|
|
493
492
|
code: ms.toString()
|
|
494
493
|
};
|
|
495
494
|
} else if ((0, import_vite.isCSSRequest)(id)) {
|
|
496
|
-
|
|
497
|
-
return {
|
|
498
|
-
code: ""
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
async buildEnd() {
|
|
503
|
-
const styles = {};
|
|
504
|
-
for (const stylesId of stylesIds) {
|
|
505
|
-
const parsed = parseRequest(stylesId);
|
|
495
|
+
const parsed = parseRequest(id);
|
|
506
496
|
const realPath = getRealPath(parsed);
|
|
507
497
|
if (await import_fs_extra3.default.exists(realPath)) {
|
|
508
498
|
const css = await import_fs_extra3.default.readFile(realPath, "utf8");
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
styles[fileName] += res.code;
|
|
513
|
-
} else {
|
|
514
|
-
styles[fileName] = res.code;
|
|
515
|
-
}
|
|
516
|
-
} else {
|
|
517
|
-
stylesIds.delete(stylesId);
|
|
499
|
+
return {
|
|
500
|
+
code: css
|
|
501
|
+
};
|
|
518
502
|
}
|
|
519
503
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
504
|
+
},
|
|
505
|
+
generateBundle(_options, bundle) {
|
|
506
|
+
const bundleKeys = Object.keys(bundle);
|
|
507
|
+
for (const bundleKey of bundleKeys) {
|
|
508
|
+
const asset = bundle[bundleKey];
|
|
509
|
+
if (bundleKey.endsWith(".css") && asset.type === "asset" && asset.originalFileName?.endsWith(".js")) {
|
|
510
|
+
const newFileName = normalizeCssPath(asset.originalFileName);
|
|
511
|
+
this.emitFile({
|
|
512
|
+
type: "asset",
|
|
513
|
+
fileName: newFileName,
|
|
514
|
+
source: asset.source
|
|
515
|
+
});
|
|
516
|
+
delete bundle[bundleKey];
|
|
517
|
+
}
|
|
526
518
|
}
|
|
527
519
|
}
|
|
528
|
-
//
|
|
529
|
-
//
|
|
530
|
-
// console.log(files)
|
|
520
|
+
// writeBundle(options, bundle) {
|
|
521
|
+
// console.log(options, bundle)
|
|
531
522
|
// },
|
|
532
523
|
},
|
|
533
524
|
{
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NPLMSNBG.mjs";
|
|
4
4
|
import "./chunk-444MQSSG.mjs";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
@@ -10,7 +10,7 @@ import { cac } from "cac";
|
|
|
10
10
|
import { parse } from "weapp-ide-cli";
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
|
-
var version = "1.1.
|
|
13
|
+
var version = "1.1.4";
|
|
14
14
|
|
|
15
15
|
// src/constants.ts
|
|
16
16
|
var VERSION = version;
|
package/dist/index.cjs
CHANGED
|
@@ -359,7 +359,6 @@ function getRealPath(res) {
|
|
|
359
359
|
return res.filename;
|
|
360
360
|
}
|
|
361
361
|
function vitePluginWeapp(ctx) {
|
|
362
|
-
const stylesIds = /* @__PURE__ */ new Set();
|
|
363
362
|
let configResolved;
|
|
364
363
|
let entriesSet = /* @__PURE__ */ new Set();
|
|
365
364
|
function relative(p) {
|
|
@@ -476,7 +475,7 @@ function vitePluginWeapp(ctx) {
|
|
|
476
475
|
return source.replace(/\.wxss$/, ".css?wxss");
|
|
477
476
|
}
|
|
478
477
|
},
|
|
479
|
-
load(id) {
|
|
478
|
+
async load(id) {
|
|
480
479
|
if (entriesSet.has(id)) {
|
|
481
480
|
const base = (0, import_shared3.removeExtension)(id);
|
|
482
481
|
const ms = new import_magic_string.default(import_fs_extra3.default.readFileSync(id, "utf8"));
|
|
@@ -493,41 +492,33 @@ function vitePluginWeapp(ctx) {
|
|
|
493
492
|
code: ms.toString()
|
|
494
493
|
};
|
|
495
494
|
} else if ((0, import_vite.isCSSRequest)(id)) {
|
|
496
|
-
|
|
497
|
-
return {
|
|
498
|
-
code: ""
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
},
|
|
502
|
-
async buildEnd() {
|
|
503
|
-
const styles = {};
|
|
504
|
-
for (const stylesId of stylesIds) {
|
|
505
|
-
const parsed = parseRequest(stylesId);
|
|
495
|
+
const parsed = parseRequest(id);
|
|
506
496
|
const realPath = getRealPath(parsed);
|
|
507
497
|
if (await import_fs_extra3.default.exists(realPath)) {
|
|
508
498
|
const css = await import_fs_extra3.default.readFile(realPath, "utf8");
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
styles[fileName] += res.code;
|
|
513
|
-
} else {
|
|
514
|
-
styles[fileName] = res.code;
|
|
515
|
-
}
|
|
516
|
-
} else {
|
|
517
|
-
stylesIds.delete(stylesId);
|
|
499
|
+
return {
|
|
500
|
+
code: css
|
|
501
|
+
};
|
|
518
502
|
}
|
|
519
503
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
504
|
+
},
|
|
505
|
+
generateBundle(_options, bundle) {
|
|
506
|
+
const bundleKeys = Object.keys(bundle);
|
|
507
|
+
for (const bundleKey of bundleKeys) {
|
|
508
|
+
const asset = bundle[bundleKey];
|
|
509
|
+
if (bundleKey.endsWith(".css") && asset.type === "asset" && asset.originalFileName?.endsWith(".js")) {
|
|
510
|
+
const newFileName = normalizeCssPath(asset.originalFileName);
|
|
511
|
+
this.emitFile({
|
|
512
|
+
type: "asset",
|
|
513
|
+
fileName: newFileName,
|
|
514
|
+
source: asset.source
|
|
515
|
+
});
|
|
516
|
+
delete bundle[bundleKey];
|
|
517
|
+
}
|
|
526
518
|
}
|
|
527
519
|
}
|
|
528
|
-
//
|
|
529
|
-
//
|
|
530
|
-
// console.log(files)
|
|
520
|
+
// writeBundle(options, bundle) {
|
|
521
|
+
// console.log(options, bundle)
|
|
531
522
|
// },
|
|
532
523
|
},
|
|
533
524
|
{
|
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.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"pkg-types": "^1.2.0",
|
|
65
65
|
"vite-tsconfig-paths": "^5.0.1",
|
|
66
66
|
"@weapp-core/init": "^1.0.4",
|
|
67
|
+
"weapp-ide-cli": "^2.0.5",
|
|
67
68
|
"@weapp-core/logger": "^1.0.1",
|
|
68
|
-
"@weapp-core/shared": "^1.0.1"
|
|
69
|
-
"weapp-ide-cli": "^2.0.5"
|
|
69
|
+
"@weapp-core/shared": "^1.0.1"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public",
|