vite-plugin-rebundle 1.2.10 → 1.2.12

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/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  import { type Options } from './rebundle.js';
2
+ import type { BuildOptions } from 'esbuild';
3
+ export type { BuildOptions };
2
4
  export default function rebundle(options?: Options): import("vite").Plugin<any>;
5
+ export { rebundle };
package/dist/index.js CHANGED
@@ -3,3 +3,4 @@ export default function rebundle(options = {}) {
3
3
  const rb = new Rebundle(options);
4
4
  return rb.vite;
5
5
  }
6
+ export { rebundle };
package/dist/rebundle.js CHANGED
@@ -1,11 +1,11 @@
1
- import { filesize } from 'filesize';
1
+ import * as $utils from '@eposlabs/utils';
2
+ import $chalk from 'chalk';
2
3
  import * as $esbuild from 'esbuild';
4
+ import { filesize } from 'filesize';
3
5
  import * as $fs from 'node:fs/promises';
4
6
  import * as $path from 'node:path';
5
- import * as $utils from '@eposlabs/utils';
6
- import * as $ws from 'ws';
7
- import $chalk from 'chalk';
8
7
  import $portfinder from 'portfinder';
8
+ import * as $ws from 'ws';
9
9
  export const _code_ = Symbol('rebundle:code');
10
10
  export const _sourcemap_ = Symbol('rebundle:sourcemap');
11
11
  export class Rebundle extends $utils.Unit {
@@ -112,14 +112,21 @@ export class Rebundle extends $utils.Unit {
112
112
  return false;
113
113
  }
114
114
  // Build with esbuild
115
- const result = await $esbuild.build({
116
- sourcemap: Boolean(this.config.build.sourcemap),
117
- ...chunkBuildOptions,
118
- outfile: chunkPath,
119
- entryPoints: [chunkPath],
120
- bundle: true,
121
- allowOverwrite: true,
122
- });
115
+ let result;
116
+ try {
117
+ result = await $esbuild.build({
118
+ sourcemap: Boolean(this.config.build.sourcemap),
119
+ ...chunkBuildOptions,
120
+ format: 'esm',
121
+ outfile: chunkPath,
122
+ entryPoints: [chunkPath],
123
+ bundle: true,
124
+ allowOverwrite: true,
125
+ });
126
+ }
127
+ catch (err) {
128
+ return;
129
+ }
123
130
  // Errors? -> Ignore, esbuild will show errors in console
124
131
  if (result.errors.length > 0)
125
132
  return;
@@ -160,7 +167,7 @@ export class Rebundle extends $utils.Unit {
160
167
  await Promise.all(usedPaths.map(async (path) => {
161
168
  const content = await this.read(path);
162
169
  if (!content)
163
- throw this.never;
170
+ return;
164
171
  files[path] = content;
165
172
  }));
166
173
  return files;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-rebundle",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",
@@ -22,14 +22,14 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@eposlabs/utils": "^1.0.0",
25
+ "@eposlabs/utils": "^1.0.13",
26
26
  "@types/ws": "^8.18.1",
27
- "chalk": "^5.6.0",
27
+ "chalk": "^5.6.2",
28
28
  "esbuild": "^0.25.9",
29
29
  "filesize": "^11.0.2",
30
- "portfinder": "^1.0.37",
31
- "rollup": "^4.50.0",
32
- "vite": "^7.1.4",
30
+ "portfinder": "^1.0.38",
31
+ "rollup": "^4.50.1",
32
+ "vite": "^7.1.5",
33
33
  "ws": "^8.18.3"
34
34
  }
35
35
  }