rolldown 0.13.2 → 0.14.0-snapshot-18ee4d3-20241107003320

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.
Files changed (63) hide show
  1. package/LICENSE +1 -1
  2. package/dist/cjs/cli.cjs +390 -96
  3. package/dist/cjs/experimental-index.cjs +2 -3
  4. package/dist/cjs/index.cjs +2 -13
  5. package/dist/cjs/parallel-plugin-worker.cjs +2 -2
  6. package/dist/esm/cli.mjs +389 -95
  7. package/dist/esm/experimental-index.mjs +1 -2
  8. package/dist/esm/index.mjs +2 -14
  9. package/dist/esm/parallel-plugin-worker.mjs +1 -1
  10. package/dist/shared/{consola.36c0034f-eps_ogJv.cjs → consola.36c0034f-HcmWcfPe.cjs} +2 -2
  11. package/dist/shared/{consola.36c0034f-m5cABVv4.mjs → consola.36c0034f-Xyw7SC_7.mjs} +1 -1
  12. package/dist/shared/{prompt-Ah5G71p-.cjs → prompt-9Ij3R3TG.cjs} +2 -2
  13. package/dist/shared/{prompt-9VjtYvi_.mjs → prompt-hoPhcrA-.mjs} +1 -1
  14. package/dist/shared/rolldown-binding.wasi.cjs +82 -73
  15. package/dist/shared/src_index-5gly_SB-.cjs +2772 -0
  16. package/dist/shared/src_index-p85M6ERL.mjs +2773 -0
  17. package/dist/shared/watcher-worker.js +1 -0
  18. package/dist/types/binding.d.ts +155 -67
  19. package/dist/types/cli/arguments/alias.d.ts +1 -0
  20. package/dist/types/cli/arguments/index.d.ts +1 -1
  21. package/dist/types/cli/arguments/normalize.d.ts +3 -6
  22. package/dist/types/cli/arguments/schema.d.ts +136 -51
  23. package/dist/types/constants/plugin.d.ts +1 -1
  24. package/dist/types/constants/types.d.ts +1 -0
  25. package/dist/types/experimental-index.d.ts +1 -0
  26. package/dist/types/index.d.ts +7 -6
  27. package/dist/types/log/logger.d.ts +10 -3
  28. package/dist/types/log/logging.d.ts +6 -3
  29. package/dist/types/options/input-options.d.ts +227 -58
  30. package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -2
  31. package/dist/types/options/normalized-input-options.d.ts +1 -1
  32. package/dist/types/options/normalized-output-options.d.ts +3 -12
  33. package/dist/types/options/output-options.d.ts +34 -173
  34. package/dist/types/options/watch-option.d.ts +5 -0
  35. package/dist/types/plugin/bindingify-hook-filter.d.ts +2 -0
  36. package/dist/types/plugin/bindingify-output-hooks.d.ts +1 -0
  37. package/dist/types/plugin/bindingify-watch-hooks.d.ts +7 -0
  38. package/dist/types/plugin/hook-filter.d.ts +48 -0
  39. package/dist/types/plugin/index.d.ts +9 -15
  40. package/dist/types/plugin/plugin-context-data.d.ts +3 -5
  41. package/dist/types/plugin/plugin-context.d.ts +2 -6
  42. package/dist/types/plugin/plugin-driver.d.ts +1 -0
  43. package/dist/types/rolldown-build.d.ts +3 -3
  44. package/dist/types/rolldown.d.ts +4 -1
  45. package/dist/types/types/input-options.d.ts +92 -0
  46. package/dist/types/types/output-options.d.ts +53 -0
  47. package/dist/types/types/rolldown-options.d.ts +2 -2
  48. package/dist/types/types/utils.d.ts +2 -0
  49. package/dist/types/utils/create-bundler.d.ts +5 -4
  50. package/dist/types/utils/normalize-input-options.d.ts +1 -1
  51. package/dist/types/utils/normalize-output-options.d.ts +1 -1
  52. package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
  53. package/dist/types/utils/normalize-tree-shake.d.ts +1 -1
  54. package/dist/types/utils/transform-to-rollup-output.d.ts +8 -3
  55. package/dist/types/watcher.d.ts +31 -0
  56. package/package.json +19 -17
  57. package/dist/shared/package-8qJYyGdm.cjs +0 -11
  58. package/dist/shared/package-unZcnfG9.mjs +0 -9
  59. package/dist/shared/plugin-context-data-F1I9ytXp.cjs +0 -1435
  60. package/dist/shared/plugin-context-data-iKSAvmTX.mjs +0 -1442
  61. package/dist/shared/rolldown-ESzFTeqV.cjs +0 -1087
  62. package/dist/shared/rolldown-Hf7txSlh.mjs +0 -1071
  63. /package/dist/shared/{chunk-gQ4GMlVi.cjs → chunk-JoMxl5V2.cjs} +0 -0
@@ -9,3 +9,5 @@ export type PartialNull<T> = {
9
9
  [P in keyof T]: T[P] | null;
10
10
  };
11
11
  export type MakeAsync<Function_> = Function_ extends (this: infer This, ...parameters: infer Arguments) => infer Return ? (this: This, ...parameters: Arguments) => Return | Promise<Return> : never;
12
+ export type MaybeArray<T> = T | T[];
13
+ export type StringOrRegExp = string | RegExp;
@@ -1,7 +1,8 @@
1
1
  import { Bundler } from '../binding';
2
- import type { InputOptions } from '../options/input-options';
3
- import type { OutputOptions } from '../options/output-options';
4
- export declare function createBundler(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<{
2
+ import type { InputOptions } from '../types/input-options';
3
+ import type { OutputOptions } from '../types/output-options';
4
+ export declare function createBundler(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<BundlerWithStopWorker>;
5
+ export interface BundlerWithStopWorker {
5
6
  bundler: Bundler;
6
7
  stopWorkers?: () => Promise<void>;
7
- }>;
8
+ }
@@ -1,3 +1,3 @@
1
- import type { InputOptions } from '../options/input-options';
1
+ import type { InputOptions } from '../types/input-options';
2
2
  import type { NormalizedInputOptions } from '../options/normalized-input-options';
3
3
  export declare function normalizeInputOptions(config: InputOptions): Promise<NormalizedInputOptions>;
@@ -1,3 +1,3 @@
1
- import type { OutputOptions } from '../options/output-options';
1
+ import type { OutputOptions } from '../types/output-options';
2
2
  import type { NormalizedOutputOptions } from '../options/normalized-output-options';
3
3
  export declare function normalizeOutputOptions(opts: OutputOptions): NormalizedOutputOptions;
@@ -1,5 +1,5 @@
1
1
  import type { OutputOptions, OutputPlugin } from '../rollup-types';
2
- import type { InputOptions } from '../options/input-options';
2
+ import type { InputOptions } from '../types/input-options';
3
3
  import type { RolldownPlugin } from '../plugin';
4
4
  export declare const normalizePluginOption: {
5
5
  (plugins: InputOptions['plugins']): Promise<RolldownPlugin[]>;
@@ -1,3 +1,3 @@
1
- import type { InputOptions } from '../options/input-options';
1
+ import type { InputOptions } from '../types/input-options';
2
2
  import { NormalizedTreeshakingOptions } from '../treeshake';
3
3
  export declare function normalizeTreeshakeOptions(config: InputOptions['treeshake']): NormalizedTreeshakingOptions | undefined;
@@ -1,5 +1,10 @@
1
1
  import type { RolldownOutput } from '../types/rolldown-output';
2
2
  import type { OutputBundle } from '../types/output-bundle';
3
- import type { BindingOutputs, FinalBindingOutputs } from '../binding';
4
- export declare function transformToRollupOutput(output: BindingOutputs | FinalBindingOutputs): RolldownOutput;
5
- export declare function transformToOutputBundle(output: BindingOutputs): OutputBundle;
3
+ import type { BindingOutputs, JsChangedOutputs } from '../binding';
4
+ export declare function transformToRollupOutput(output: BindingOutputs, changed?: ChangedOutputs): RolldownOutput;
5
+ export declare function transformToOutputBundle(output: BindingOutputs, changed: ChangedOutputs): OutputBundle;
6
+ export interface ChangedOutputs {
7
+ updated: Set<string>;
8
+ deleted: Set<string>;
9
+ }
10
+ export declare function collectChangedBundle(changed: ChangedOutputs, bundle: OutputBundle): JsChangedOutputs;
@@ -0,0 +1,31 @@
1
+ import { BindingWatcher } from './binding';
2
+ import { MaybePromise } from './types/utils';
3
+ export declare class Watcher {
4
+ closed: boolean;
5
+ controller: AbortController;
6
+ inner: BindingWatcher;
7
+ stopWorkers?: () => Promise<void>;
8
+ constructor(inner: BindingWatcher, stopWorkers?: () => Promise<void>);
9
+ close(): Promise<void>;
10
+ on(event: 'change', listener: (id: string, change: {
11
+ event: ChangeEvent;
12
+ }) => MaybePromise<void>): this;
13
+ on(event: 'event', listener: (data: RollupWatcherEvent) => MaybePromise<void>): this;
14
+ on(event: 'restart' | 'close', listener: () => MaybePromise<void>): this;
15
+ watch(): void;
16
+ }
17
+ export type WatcherEvent = 'close' | 'event' | 'restart' | 'change';
18
+ export type ChangeEvent = 'create' | 'update' | 'delete';
19
+ export type RollupWatcherEvent = {
20
+ code: 'START';
21
+ } | {
22
+ code: 'BUNDLE_START';
23
+ } | {
24
+ code: 'BUNDLE_END';
25
+ duration: number;
26
+ output: readonly string[];
27
+ } | {
28
+ code: 'END';
29
+ } | {
30
+ code: 'ERROR'; /** error: RollupError; result: RollupBuild | null **/
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "0.13.2",
3
+ "version": "0.14.0-snapshot-18ee4d3-20241107003320",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -44,6 +44,7 @@
44
44
  "require": "./dist/cjs/parallel-plugin.cjs",
45
45
  "import": "./dist/esm/parallel-plugin.mjs"
46
46
  },
47
+ "./watcher-worker": "./dist/shared/watcher-worker.js",
47
48
  "./package.json": "./package.json"
48
49
  },
49
50
  "imports": {
@@ -76,7 +77,7 @@
76
77
  "fs": true
77
78
  }
78
79
  },
79
- "dtsHeader": "type MaybePromise<T> = T | Promise<T>\ntype Nullable<T> = T | null | undefined\ntype VoidNullable<T = void> = T | null | undefined | void\n"
80
+ "dtsHeader": "type MaybePromise<T> = T | Promise<T>\ntype Nullable<T> = T | null | undefined\ntype VoidNullable<T = void> = T | null | undefined | void\nexport type BindingStringOrRegex = string | RegExp\n\n"
80
81
  },
81
82
  "dependencies": {
82
83
  "zod": "^3.23.8"
@@ -93,9 +94,10 @@
93
94
  "fs-extra": "^11.2.0",
94
95
  "glob": "^11.0.0",
95
96
  "locate-character": "^3.0.0",
96
- "npm-run-all2": "^6.2.0",
97
+ "npm-run-all2": "^7.0.0",
97
98
  "remeda": "^2.10.0",
98
99
  "rollup": "^4.18.0",
100
+ "signal-exit": "4.1.0",
99
101
  "type-fest": "^4.20.0",
100
102
  "unbuild": "^2.0.0",
101
103
  "vite": "^5.2.13",
@@ -103,21 +105,21 @@
103
105
  "why-is-node-running": "^3.0.0",
104
106
  "zod-to-json-schema": "^3.23.2",
105
107
  "@rolldown/testing": "0.0.1",
106
- "rolldown": "0.13.2"
108
+ "rolldown": "0.14.0-snapshot-18ee4d3-20241107003320"
107
109
  },
108
110
  "optionalDependencies": {
109
- "@rolldown/binding-darwin-arm64": "0.13.2",
110
- "@rolldown/binding-darwin-x64": "0.13.2",
111
- "@rolldown/binding-freebsd-x64": "0.13.2",
112
- "@rolldown/binding-linux-arm64-gnu": "0.13.2",
113
- "@rolldown/binding-linux-arm-gnueabihf": "0.13.2",
114
- "@rolldown/binding-linux-arm64-musl": "0.13.2",
115
- "@rolldown/binding-linux-x64-gnu": "0.13.2",
116
- "@rolldown/binding-linux-x64-musl": "0.13.2",
117
- "@rolldown/binding-wasm32-wasi": "0.13.2",
118
- "@rolldown/binding-win32-arm64-msvc": "0.13.2",
119
- "@rolldown/binding-win32-ia32-msvc": "0.13.2",
120
- "@rolldown/binding-win32-x64-msvc": "0.13.2"
111
+ "@rolldown/binding-darwin-x64": "0.14.0-snapshot-18ee4d3-20241107003320",
112
+ "@rolldown/binding-darwin-arm64": "0.14.0-snapshot-18ee4d3-20241107003320",
113
+ "@rolldown/binding-linux-arm-gnueabihf": "0.14.0-snapshot-18ee4d3-20241107003320",
114
+ "@rolldown/binding-freebsd-x64": "0.14.0-snapshot-18ee4d3-20241107003320",
115
+ "@rolldown/binding-linux-arm64-gnu": "0.14.0-snapshot-18ee4d3-20241107003320",
116
+ "@rolldown/binding-linux-arm64-musl": "0.14.0-snapshot-18ee4d3-20241107003320",
117
+ "@rolldown/binding-linux-x64-gnu": "0.14.0-snapshot-18ee4d3-20241107003320",
118
+ "@rolldown/binding-linux-x64-musl": "0.14.0-snapshot-18ee4d3-20241107003320",
119
+ "@rolldown/binding-win32-arm64-msvc": "0.14.0-snapshot-18ee4d3-20241107003320",
120
+ "@rolldown/binding-wasm32-wasi": "0.14.0-snapshot-18ee4d3-20241107003320",
121
+ "@rolldown/binding-win32-ia32-msvc": "0.14.0-snapshot-18ee4d3-20241107003320",
122
+ "@rolldown/binding-win32-x64-msvc": "0.14.0-snapshot-18ee4d3-20241107003320"
121
123
  },
122
124
  "scripts": {
123
125
  "# Scrips for binding #": "_",
@@ -136,7 +138,7 @@
136
138
  "build-wasi:debug": "run-s build-binding:wasi build-node",
137
139
  "build-wasi:release": "run-s build-binding:wasi:release build-node",
138
140
  "# Scrips for checking #": "_",
139
- "test": "cross-env ROLLDOWN_TEST=1 vitest run --reporter verbose --hideSkippedTests",
141
+ "test": "cross-env RUST_BACKTRACE=1 ROLLDOWN_TEST=1 vitest run --reporter verbose --hideSkippedTests",
140
142
  "test:update": "vitest run -u",
141
143
  "type-check": "tsc"
142
144
  }
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
-
4
- //#region package.json
5
- const version = "0.13.2";
6
- const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
7
-
8
- //#endregion
9
- exports.description = description;
10
- exports.version = version;
11
-
@@ -1,9 +0,0 @@
1
- import __node_module__ from 'node:module';
2
- const require = __node_module__.createRequire(import.meta.url)
3
-
4
- //#region package.json
5
- const version = "0.13.2";
6
- const description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
7
-
8
- //#endregion
9
- export { description, version };