vite-plugin-rebundle 1.21.0 → 1.23.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/rebundle.js +7 -2
- package/package.json +11 -17
- package/src/rebundle.ts +7 -2
package/dist/rebundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/rebundle.ts
|
|
2
|
-
import { is } from "@eposlabs/utils";
|
|
3
2
|
import chalk from "chalk";
|
|
3
|
+
import { is } from "dropcap/utils";
|
|
4
4
|
import { filesize } from "filesize";
|
|
5
5
|
import { rm, stat } from "fs/promises";
|
|
6
6
|
import { extname, join } from "path";
|
|
@@ -50,6 +50,7 @@ var RebundleVite = class {
|
|
|
50
50
|
const info = this.config.logger.info;
|
|
51
51
|
this.config.logger.info = (message, options) => {
|
|
52
52
|
const path = message.split(/\s+/)[0];
|
|
53
|
+
if (is.absent(path)) return;
|
|
53
54
|
if (extname(path) === ".js") return;
|
|
54
55
|
info(message, options);
|
|
55
56
|
};
|
|
@@ -69,7 +70,11 @@ var RebundleVite = class {
|
|
|
69
70
|
onWriteBundle = async (_output, bundle) => {
|
|
70
71
|
const modifiedEntryChunks = this.getEntryChunks(bundle).filter((chunk) => {
|
|
71
72
|
const usedPaths = [chunk.fileName, ...chunk.imports];
|
|
72
|
-
return usedPaths.some((path) =>
|
|
73
|
+
return usedPaths.some((path) => {
|
|
74
|
+
if (!bundle[path]) return false;
|
|
75
|
+
if (!("code" in bundle[path])) return false;
|
|
76
|
+
return bundle[path].code !== this.originals[path];
|
|
77
|
+
});
|
|
73
78
|
});
|
|
74
79
|
await Promise.all(
|
|
75
80
|
modifiedEntryChunks.map(async (chunk) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-rebundle",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "imkost",
|
|
@@ -10,34 +10,28 @@
|
|
|
10
10
|
"vite-plugin"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"dev": "tsup --config
|
|
14
|
-
"build": "tsup --config
|
|
13
|
+
"dev": "tsup --config ../../tsup.config.ts --watch",
|
|
14
|
+
"build": "tsup --config ../../tsup.config.ts",
|
|
15
15
|
"lint": "tsc --noEmit",
|
|
16
16
|
"release": "sh -c 'npm version ${1:-minor} && npm run build && npm publish' --"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
19
|
-
".":
|
|
20
|
-
|
|
21
|
-
"import": "./dist/rebundle.js",
|
|
22
|
-
"types": "./dist/rebundle.d.ts"
|
|
23
|
-
},
|
|
24
|
-
"./ts": {
|
|
25
|
-
"import": "./src/rebundle.ts"
|
|
26
|
-
}
|
|
19
|
+
".": "./dist/rebundle.js",
|
|
20
|
+
"./ts": "./src/rebundle.ts"
|
|
27
21
|
},
|
|
28
22
|
"files": [
|
|
29
|
-
"
|
|
30
|
-
"
|
|
23
|
+
"dist",
|
|
24
|
+
"src"
|
|
31
25
|
],
|
|
32
26
|
"dependencies": {
|
|
33
|
-
"@eposlabs/utils": "^1.10.0",
|
|
34
27
|
"@types/ws": "^8.18.1",
|
|
35
28
|
"chalk": "^5.6.2",
|
|
29
|
+
"dropcap": "^1.0.0",
|
|
36
30
|
"filesize": "^11.0.13",
|
|
37
31
|
"portfinder": "^1.0.38",
|
|
38
|
-
"rolldown": "^1.0.0-beta.
|
|
39
|
-
"rollup": "^4.
|
|
40
|
-
"vite": "^7.
|
|
32
|
+
"rolldown": "^1.0.0-beta.57",
|
|
33
|
+
"rollup": "^4.54.0",
|
|
34
|
+
"vite": "^7.3.0",
|
|
41
35
|
"ws": "^8.18.3"
|
|
42
36
|
}
|
|
43
37
|
}
|
package/src/rebundle.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { is } from '@eposlabs/utils'
|
|
2
1
|
import chalk from 'chalk'
|
|
2
|
+
import { is } from 'dropcap/utils'
|
|
3
3
|
import { filesize } from 'filesize'
|
|
4
4
|
import { rm, stat } from 'node:fs/promises'
|
|
5
5
|
import { extname, join } from 'node:path'
|
|
@@ -71,6 +71,7 @@ export class RebundleVite {
|
|
|
71
71
|
const info = this.config.logger.info
|
|
72
72
|
this.config.logger.info = (message, options) => {
|
|
73
73
|
const path = message.split(/\s+/)[0]
|
|
74
|
+
if (is.absent(path)) return
|
|
74
75
|
if (extname(path) === '.js') return
|
|
75
76
|
info(message, options)
|
|
76
77
|
}
|
|
@@ -97,7 +98,11 @@ export class RebundleVite {
|
|
|
97
98
|
// Get modified entry chunks
|
|
98
99
|
const modifiedEntryChunks = this.getEntryChunks(bundle).filter(chunk => {
|
|
99
100
|
const usedPaths = [chunk.fileName, ...chunk.imports]
|
|
100
|
-
return usedPaths.some(path =>
|
|
101
|
+
return usedPaths.some(path => {
|
|
102
|
+
if (!bundle[path]) return false
|
|
103
|
+
if (!('code' in bundle[path])) return false
|
|
104
|
+
return bundle[path].code !== this.originals[path]
|
|
105
|
+
})
|
|
101
106
|
})
|
|
102
107
|
|
|
103
108
|
// Rebundle modified entry chunks
|