vite-plugin-rebundle 1.2.8 → 1.2.10

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,2 @@
1
- import { type OptionsInput } from './rebundle.js';
2
- export default function rebundle(options?: OptionsInput): import("vite").Plugin<any>;
1
+ import { type Options } from './rebundle.js';
2
+ export default function rebundle(options?: Options): import("vite").Plugin<any>;
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Rebundle } from './rebundle.js';
2
2
  export default function rebundle(options = {}) {
3
- return new Rebundle(options).vite;
3
+ const rb = new Rebundle(options);
4
+ return rb.vite;
4
5
  }
@@ -7,7 +7,6 @@ export declare const _sourcemap_: unique symbol;
7
7
  export type Options = {
8
8
  [chunkName: string]: BuildOptions;
9
9
  };
10
- export type OptionsInput = Options | (() => Options | Promise<Options>);
11
10
  export declare class Rebundle extends $utils.Unit {
12
11
  private options;
13
12
  private config;
@@ -16,7 +15,7 @@ export declare class Rebundle extends $utils.Unit {
16
15
  private hasError;
17
16
  private port;
18
17
  private ws;
19
- constructor(options: OptionsInput);
18
+ constructor(options: Options);
20
19
  get vite(): Plugin;
21
20
  private onConfig;
22
21
  private onConfigResolved;
@@ -31,6 +30,5 @@ export declare class Rebundle extends $utils.Unit {
31
30
  private write;
32
31
  private remove;
33
32
  private ensureWs;
34
- private getOptions;
35
33
  private removeDirectoryIfEmpty;
36
34
  }
package/dist/rebundle.js CHANGED
@@ -91,9 +91,8 @@ export class Rebundle extends $utils.Unit {
91
91
  // Delete chunk from bundle to hide log for vite-rolldown.
92
92
  // Call for rollup as well for consistency.
93
93
  delete bundle[chunk.fileName];
94
- const options = await this.getOptions();
95
94
  const chunkPath = this.resolve(chunk.fileName);
96
- const chunkBuildOptions = options[chunk.name] ?? {};
95
+ const chunkBuildOptions = this.options[chunk.name] ?? {};
97
96
  const chunkFiles = await this.readChunkFiles(chunk);
98
97
  const chunkFilePaths = Object.keys(chunkFiles);
99
98
  const chunkChanged = chunkFilePaths.some(path => chunkFiles[path] !== this.chunkFiles[path]);
@@ -195,11 +194,6 @@ export class Rebundle extends $utils.Unit {
195
194
  this.ws = new $ws.WebSocketServer({ port: this.port });
196
195
  return this.ws;
197
196
  }
198
- async getOptions() {
199
- if (typeof this.options !== 'function')
200
- return this.options;
201
- return await this.options();
202
- }
203
197
  async removeDirectoryIfEmpty(dir) {
204
198
  const files = await $fs.readdir(dir);
205
199
  if (files.length > 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-rebundle",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "imkost",