vite-plugin-rebundle 1.2.2 → 1.2.5
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 +11 -5
- package/package.json +5 -1
package/dist/rebundle.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { filesize } from 'filesize';
|
|
1
2
|
import * as $esbuild from 'esbuild';
|
|
2
3
|
import * as $fs from 'node:fs/promises';
|
|
3
4
|
import * as $path from 'node:path';
|
|
@@ -42,7 +43,7 @@ export class Rebundle extends $utils.Unit {
|
|
|
42
43
|
onConfigResolved = async (config) => {
|
|
43
44
|
// Save resolved config
|
|
44
45
|
this.config = config;
|
|
45
|
-
// Hide .js files from output logs
|
|
46
|
+
// Hide .js files from output logs (rollup only, not supported in rolldown)
|
|
46
47
|
const info = this.config.logger.info;
|
|
47
48
|
this.config.logger.info = (message, options) => {
|
|
48
49
|
const path = message.split(/\s+/)[0];
|
|
@@ -68,6 +69,9 @@ export class Rebundle extends $utils.Unit {
|
|
|
68
69
|
await Promise.all(entryJsChunks.map(async (chunk) => {
|
|
69
70
|
if (!this.config)
|
|
70
71
|
throw this.never;
|
|
72
|
+
// Delete chunk from bundle to hide log in vite-rolldown.
|
|
73
|
+
// Call for rollup as well for consistency.
|
|
74
|
+
delete bundle[chunk.fileName];
|
|
71
75
|
const chunkPath = this.outPath(chunk.fileName);
|
|
72
76
|
const chunkBuildOptions = options[chunk.name] ?? {};
|
|
73
77
|
const chunkFiles = await this.readChunkFiles(chunk);
|
|
@@ -90,10 +94,12 @@ export class Rebundle extends $utils.Unit {
|
|
|
90
94
|
if (result.errors.length > 0)
|
|
91
95
|
return;
|
|
92
96
|
// Log successful build
|
|
97
|
+
const { size } = await $fs.stat(chunkPath);
|
|
93
98
|
const _outDir_ = $chalk.dim(`${this.outDir}/`);
|
|
94
99
|
const _fileName_ = $chalk.cyan(chunk.fileName);
|
|
95
|
-
const _rebundle_ = $chalk.dim.cyan('rebundle');
|
|
96
|
-
|
|
100
|
+
const _rebundle_ = $chalk.dim.cyan('[rebundle]');
|
|
101
|
+
const _size_ = $chalk.bold.dim(`${filesize(size)}`);
|
|
102
|
+
console.log(`${_outDir_}${_fileName_} ${_rebundle_} ${_size_}`);
|
|
97
103
|
// Mark chunk as changed
|
|
98
104
|
changedChunkNames.push(chunk.name);
|
|
99
105
|
// Save chunk content
|
|
@@ -122,11 +128,11 @@ export class Rebundle extends $utils.Unit {
|
|
|
122
128
|
// Remove all non-entry chunks
|
|
123
129
|
for (const chunk of nonEntryChunks) {
|
|
124
130
|
// Remove chunk
|
|
125
|
-
await $fs.unlink(this.outPath(chunk.fileName));
|
|
131
|
+
await $utils.safe($fs.unlink(this.outPath(chunk.fileName)));
|
|
126
132
|
delete bundle[chunk.fileName];
|
|
127
133
|
// Remove sourcemap
|
|
128
134
|
if (chunk.sourcemapFileName) {
|
|
129
|
-
await $fs.unlink(this.outPath(chunk.sourcemapFileName));
|
|
135
|
+
await $utils.safe($fs.unlink(this.outPath(chunk.sourcemapFileName)));
|
|
130
136
|
delete bundle[chunk.sourcemapFileName];
|
|
131
137
|
}
|
|
132
138
|
// Remove containing directory if empty (recursively)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-rebundle",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "imkost",
|
|
@@ -24,10 +24,14 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"@eposlabs/utils": "^1.0.0",
|
|
27
28
|
"@types/ws": "^8.18.1",
|
|
28
29
|
"chalk": "^5.6.0",
|
|
29
30
|
"esbuild": "^0.25.9",
|
|
31
|
+
"filesize": "^11.0.2",
|
|
30
32
|
"portfinder": "^1.0.37",
|
|
33
|
+
"rollup": "^4.50.0",
|
|
34
|
+
"vite": "^7.1.4",
|
|
31
35
|
"ws": "^8.18.3"
|
|
32
36
|
}
|
|
33
37
|
}
|