rolldown 0.10.4 → 0.10.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.
Files changed (44) hide show
  1. package/dist/cjs/cli.cjs +8 -8
  2. package/dist/cjs/index.cjs +3 -2
  3. package/dist/cjs/parallel-plugin-worker.cjs +1 -1
  4. package/dist/esm/cli.mjs +8 -8
  5. package/dist/esm/index.mjs +3 -3
  6. package/dist/esm/parallel-plugin-worker.mjs +1 -1
  7. package/dist/shared/{utils_index-ywWHgCJG.mjs → bindingify_plugin-gPrr_HPR.mjs} +474 -827
  8. package/dist/shared/{utils_index-D-jBnBMP.cjs → bindingify_plugin-sRZqfDBJ.cjs} +484 -827
  9. package/dist/shared/rolldown-1SJPa4fg.cjs +547 -0
  10. package/dist/shared/rolldown-bgokD9pg.mjs +544 -0
  11. package/dist/shared/rolldown-binding.wasi.cjs +46 -25
  12. package/dist/types/binding.d.ts +256 -0
  13. package/dist/types/index.d.ts +21 -7
  14. package/dist/types/options/bindingify-input-options.d.ts +1 -1
  15. package/dist/types/options/bindingify-output-options.d.ts +1 -0
  16. package/dist/types/options/input-options.d.ts +31 -6
  17. package/dist/types/options/normalized-input-options.d.ts +4 -2
  18. package/dist/types/options/normalized-output-options.d.ts +2 -1
  19. package/dist/types/options/output-options.d.ts +10 -5
  20. package/dist/types/plugin/bindingify-builtin-plugin.d.ts +10 -0
  21. package/dist/types/plugin/bindingify-output-hooks.d.ts +1 -1
  22. package/dist/types/plugin/bindingify-plugin.d.ts +1 -1
  23. package/dist/types/plugin/index.d.ts +49 -29
  24. package/dist/types/plugin/plugin-context.d.ts +14 -0
  25. package/dist/types/plugin/plugin-driver.d.ts +5 -1
  26. package/dist/types/plugin/transfrom-plugin-context.d.ts +9 -5
  27. package/dist/types/rollup.d.ts +1113 -0
  28. package/dist/types/treeshake/index.d.ts +14 -0
  29. package/dist/types/treeshake/module-side-effects.d.ts +15 -0
  30. package/dist/types/types/rolldown-output.d.ts +3 -1
  31. package/dist/types/types/sourcemap.d.ts +7 -4
  32. package/dist/types/types/utils.d.ts +3 -0
  33. package/dist/types/utils/asset-source.d.ts +4 -0
  34. package/dist/types/utils/index.d.ts +1 -5
  35. package/dist/types/utils/initialize-parallel-plugins.d.ts +2 -1
  36. package/dist/types/utils/misc.d.ts +5 -0
  37. package/dist/types/utils/normalize-hook.d.ts +2 -2
  38. package/dist/types/utils/normalize-output-options.d.ts +2 -2
  39. package/dist/types/utils/normalize-plugin-option.d.ts +2 -2
  40. package/dist/types/utils/normalize-tree-shake.d.ts +3 -0
  41. package/dist/types/utils/transform-side-effects.d.ts +1 -1
  42. package/package.json +20 -21
  43. package/dist/shared/rolldown-ftFKbC6A.mjs +0 -51
  44. package/dist/shared/rolldown-l_Cw2GW3.cjs +0 -52
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const TreeshakingOptionsSchema: z.ZodObject<z.objectUtil.extendShape<{
3
+ moduleSideEffects: z.ZodUnion<[z.ZodBoolean, z.ZodString]>;
4
+ }, {
5
+ moduleSideEffects: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>;
6
+ }>, "strict", z.ZodTypeAny, {
7
+ moduleSideEffects?: string | boolean | undefined;
8
+ }, {
9
+ moduleSideEffects?: string | boolean | undefined;
10
+ }>;
11
+ export interface TreeshakingOptions {
12
+ moduleSideEffects?: string | RegExp;
13
+ }
14
+ export * from './module-side-effects';
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export declare const HasModuleSideEffectsSchema: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodBoolean], z.ZodUnknown>, z.ZodBoolean>;
3
+ export type HasModuleSideEffects = z.infer<typeof HasModuleSideEffectsSchema>;
4
+ export type ModuleSideEffectsOption = z.infer<typeof ModuleSideEffectsOptionSchema>;
5
+ export declare const ModuleSideEffectsOptionSchema: z.ZodUnion<[z.ZodBoolean, z.ZodString]>;
6
+ export declare const NormalizedTreeshakingOptionsSchema: z.ZodObject<{
7
+ moduleSideEffects: z.ZodUnion<[z.ZodBoolean, z.ZodString]>;
8
+ }, "strict", z.ZodTypeAny, {
9
+ moduleSideEffects: string | boolean;
10
+ }, {
11
+ moduleSideEffects: string | boolean;
12
+ }>;
13
+ export type NormalizedTreeshakingOptions = {
14
+ moduleSideEffects: string;
15
+ };
@@ -1,8 +1,9 @@
1
+ import { AssetSource } from '../utils/asset-source';
1
2
  import type { RenderedModule } from './rendered-module';
2
3
  export interface RolldownOutputAsset {
3
4
  type: 'asset';
4
5
  fileName: string;
5
- source: string | Uint8Array;
6
+ source: AssetSource;
6
7
  }
7
8
  export interface SourceMap {
8
9
  file: string;
@@ -15,6 +16,7 @@ export interface SourceMap {
15
16
  export interface RolldownOutputChunk {
16
17
  type: 'chunk';
17
18
  code: string;
19
+ name: string;
18
20
  isEntry: boolean;
19
21
  exports: string[];
20
22
  fileName: string;
@@ -1,10 +1,13 @@
1
- export interface SourceMapInputObject {
2
- file?: string;
1
+ import { BindingSourcemap } from '../binding';
2
+ export interface ExistingRawSourceMap {
3
+ file?: string | null;
3
4
  mappings: string;
4
5
  names?: string[];
5
6
  sources?: (string | null)[];
6
7
  sourcesContent?: (string | null)[];
7
8
  sourceRoot?: string;
8
- version: number;
9
+ version?: number;
10
+ x_google_ignoreList?: number[];
9
11
  }
10
- export type SourceMapInput = SourceMapInputObject | string | null;
12
+ export type SourceMapInput = ExistingRawSourceMap | string | null;
13
+ export declare function bindingifySourcemap(map?: SourceMapInput): undefined | BindingSourcemap;
@@ -5,3 +5,6 @@ export interface AnyFn {
5
5
  export interface AnyObj {
6
6
  }
7
7
  export type NullValue<T = void> = T | undefined | null | void;
8
+ export type PartialNull<T> = {
9
+ [P in keyof T]: T[P] | null;
10
+ };
@@ -0,0 +1,4 @@
1
+ import { BindingAssetSource } from '../binding';
2
+ export type AssetSource = string | Uint8Array;
3
+ export declare function transformAssetSource(bindingAssetSource: BindingAssetSource): AssetSource;
4
+ export declare function bindingAssetSource(source: AssetSource): BindingAssetSource;
@@ -6,8 +6,4 @@ export * from './create-bundler';
6
6
  export * from './transform-sourcemap';
7
7
  export * from './transform-module-info';
8
8
  export * from './code-frame';
9
- export declare function arraify<T>(value: T | T[]): T[];
10
- export declare function unimplemented(info?: string): never;
11
- export declare function unreachable(info?: string): never;
12
- export declare function unsupported(info: string): never;
13
- export declare function noop(..._args: any[]): void;
9
+ export * from './misc';
@@ -2,6 +2,7 @@
2
2
  import { Worker } from 'node:worker_threads';
3
3
  import type { ParallelPlugin, Plugin } from '../plugin';
4
4
  import { ParallelJsPluginRegistry } from '../binding';
5
+ import { BuiltinPlugin } from '../plugin/bindingify-builtin-plugin';
5
6
  export type WorkerData = {
6
7
  registryId: number;
7
8
  pluginInfos: ParallelPluginInfo[];
@@ -12,7 +13,7 @@ type ParallelPluginInfo = {
12
13
  fileUrl: string;
13
14
  options: unknown;
14
15
  };
15
- export declare function initializeParallelPlugins(plugins: (Plugin | ParallelPlugin)[]): Promise<{
16
+ export declare function initializeParallelPlugins(plugins: (Plugin | ParallelPlugin | BuiltinPlugin)[]): Promise<{
16
17
  registry: ParallelJsPluginRegistry;
17
18
  stopWorkers: () => Promise<void>;
18
19
  } | undefined>;
@@ -0,0 +1,5 @@
1
+ export declare function arraify<T>(value: T | T[]): T[];
2
+ export declare function unimplemented(info?: string): never;
3
+ export declare function unreachable(info?: string): never;
4
+ export declare function unsupported(info: string): () => never;
5
+ export declare function noop(..._args: any[]): void;
@@ -1,5 +1,5 @@
1
- import type { Hook } from '../plugin';
1
+ import type { ObjectHook } from '../plugin';
2
2
  import type { AnyFn, AnyObj } from '../types/utils';
3
3
  type NotFn<T> = T extends AnyFn ? never : T;
4
- export declare function normalizeHook<H extends Hook<AnyFn, AnyObj>>(hook: H): H extends Hook<infer Handler, infer Options> ? [Handler, NotFn<Options>] : never;
4
+ export declare function normalizeHook<H extends ObjectHook<AnyFn, AnyObj>>(hook: H): H extends ObjectHook<infer Handler, infer Options> ? [Handler, NotFn<Options>] : never;
5
5
  export {};
@@ -1,3 +1,3 @@
1
- import type { OutputOptions } from '@src/options/output-options';
2
- import type { NormalizedOutputOptions } from '@src/options/normalized-output-options';
1
+ import type { OutputOptions } from '../options/output-options';
2
+ import type { NormalizedOutputOptions } from '../options/normalized-output-options';
3
3
  export declare function normalizeOutputOptions(opts: OutputOptions): NormalizedOutputOptions;
@@ -1,8 +1,8 @@
1
1
  import type { OutputOptions, OutputPlugin } from '../rollup-types';
2
2
  import type { InputOptions } from '../options/input-options';
3
- import type { ParallelPlugin, Plugin } from '../plugin';
3
+ import type { RolldownPlugin } from '../plugin';
4
4
  export declare const normalizePluginOption: {
5
- (plugins: InputOptions['plugins']): Promise<(ParallelPlugin | Plugin)[]>;
5
+ (plugins: InputOptions['plugins']): Promise<RolldownPlugin[]>;
6
6
  (plugins: OutputOptions['plugins']): Promise<OutputPlugin[]>;
7
7
  (plugins: unknown): Promise<any[]>;
8
8
  };
@@ -0,0 +1,3 @@
1
+ import type { InputOptions } from '../options/input-options';
2
+ import { NormalizedTreeshakingOptions } from '../../src/treeshake';
3
+ export declare function normalizeTreeshakeOptions(config: InputOptions['treeshake']): NormalizedTreeshakingOptions | undefined;
@@ -1,3 +1,3 @@
1
- import { BindingHookSideEffects } from '@src/binding';
1
+ import { BindingHookSideEffects } from '../binding';
2
2
  import { ModuleSideEffects } from '../plugin';
3
3
  export declare function bindingifySideEffects(sideEffects?: ModuleSideEffects): BindingHookSideEffects | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -77,38 +77,37 @@
77
77
  "consola": "^3.2.3",
78
78
  "locate-character": "^3.0.0",
79
79
  "mri": "^1.2.0",
80
- "zod": "^3.23.6"
80
+ "zod": "^3.23.8"
81
81
  },
82
82
  "devDependencies": {
83
- "@napi-rs/cli": "^3.0.0-alpha",
84
- "@napi-rs/wasm-runtime": "^0.2.3",
83
+ "@napi-rs/cli": "^3.0.0-alpha.55",
84
+ "@napi-rs/wasm-runtime": "^0.2.4",
85
85
  "emnapi": "^1.2.0",
86
- "esbuild": "^0.21.3",
87
- "execa": "^9.1.0",
86
+ "execa": "^9.2.0",
88
87
  "fs-extra": "^11.2.0",
89
88
  "glob": "^10.4.1",
90
89
  "npm-run-all2": "^6.2.0",
91
90
  "rollup": "^4.18.0",
92
- "type-fest": "^4.18.2",
91
+ "type-fest": "^4.20.0",
93
92
  "unbuild": "^2.0.0",
94
- "vite": "^5.2.11",
95
- "vitest": "^1.3.1",
93
+ "vite": "^5.2.13",
94
+ "vitest": "^1.6.0",
96
95
  "why-is-node-running": "^2.2.2",
97
96
  "@rolldown/testing": "0.0.1",
98
- "rolldown": "0.10.4"
97
+ "rolldown": "0.10.5"
99
98
  },
100
99
  "optionalDependencies": {
101
- "@rolldown/binding-darwin-x64": "0.10.4",
102
- "@rolldown/binding-darwin-arm64": "0.10.4",
103
- "@rolldown/binding-linux-arm-gnueabihf": "0.10.4",
104
- "@rolldown/binding-linux-arm64-gnu": "0.10.4",
105
- "@rolldown/binding-linux-arm64-musl": "0.10.4",
106
- "@rolldown/binding-linux-x64-gnu": "0.10.4",
107
- "@rolldown/binding-linux-x64-musl": "0.10.4",
108
- "@rolldown/binding-win32-ia32-msvc": "0.10.4",
109
- "@rolldown/binding-wasm32-wasi": "0.10.4",
110
- "@rolldown/binding-win32-x64-msvc": "0.10.4",
111
- "@rolldown/binding-win32-arm64-msvc": "0.10.4"
100
+ "@rolldown/binding-darwin-arm64": "0.10.5",
101
+ "@rolldown/binding-darwin-x64": "0.10.5",
102
+ "@rolldown/binding-linux-arm-gnueabihf": "0.10.5",
103
+ "@rolldown/binding-linux-arm64-musl": "0.10.5",
104
+ "@rolldown/binding-linux-arm64-gnu": "0.10.5",
105
+ "@rolldown/binding-linux-x64-gnu": "0.10.5",
106
+ "@rolldown/binding-wasm32-wasi": "0.10.5",
107
+ "@rolldown/binding-linux-x64-musl": "0.10.5",
108
+ "@rolldown/binding-win32-arm64-msvc": "0.10.5",
109
+ "@rolldown/binding-win32-x64-msvc": "0.10.5",
110
+ "@rolldown/binding-win32-ia32-msvc": "0.10.5"
112
111
  },
113
112
  "scripts": {
114
113
  "# Scrips for binding #": "_",
@@ -1,51 +0,0 @@
1
- import __node_module__ from 'node:module';
2
- const require = __node_module__.createRequire(import.meta.url)
3
- import { createBundler, transformToRollupOutput } from "./utils_index-ywWHgCJG.mjs";
4
-
5
- //#region src/rolldown-build.ts
6
- class RolldownBuild {
7
- #inputOptions;
8
-
9
- #bundler;
10
-
11
- #stopWorkers;
12
-
13
- constructor(inputOptions){
14
- this.#inputOptions = inputOptions;
15
- }
16
- async #getBundler(outputOptions){
17
- if (typeof this.#bundler === 'undefined') {
18
- const {bundler, stopWorkers} = await createBundler(this.#inputOptions, outputOptions);
19
- this.#bundler = bundler;
20
- this.#stopWorkers = stopWorkers;
21
- }
22
- return this.#bundler;
23
- }
24
- async generate(outputOptions={}){
25
- const bundler = await this.#getBundler(outputOptions);
26
- const output = await bundler.generate();
27
- return transformToRollupOutput(output);
28
- }
29
- async write(outputOptions={}){
30
- const bundler = await this.#getBundler(outputOptions);
31
- const output = await bundler.write();
32
- return transformToRollupOutput(output);
33
- }
34
- async destroy(){
35
- await this.#stopWorkers?.();
36
- }
37
- }
38
-
39
- //#endregion
40
- //#region src/rolldown.ts
41
- const rolldown = async input => {
42
- return new RolldownBuild(input);
43
- };
44
- const experimental_scan = async input => {
45
- const {bundler, stopWorkers} = await createBundler(input, {});
46
- await bundler.scan();
47
- await stopWorkers?.();
48
- };
49
-
50
- //#endregion
51
- export { experimental_scan, rolldown };
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- const { createBundler, transformToRollupOutput } = require("./utils_index-D-jBnBMP.cjs");
4
-
5
- //#region src/rolldown-build.ts
6
- class RolldownBuild {
7
- #inputOptions;
8
-
9
- #bundler;
10
-
11
- #stopWorkers;
12
-
13
- constructor(inputOptions){
14
- this.#inputOptions = inputOptions;
15
- }
16
- async #getBundler(outputOptions){
17
- if (typeof this.#bundler === 'undefined') {
18
- const {bundler, stopWorkers} = await createBundler(this.#inputOptions, outputOptions);
19
- this.#bundler = bundler;
20
- this.#stopWorkers = stopWorkers;
21
- }
22
- return this.#bundler;
23
- }
24
- async generate(outputOptions={}){
25
- const bundler = await this.#getBundler(outputOptions);
26
- const output = await bundler.generate();
27
- return transformToRollupOutput(output);
28
- }
29
- async write(outputOptions={}){
30
- const bundler = await this.#getBundler(outputOptions);
31
- const output = await bundler.write();
32
- return transformToRollupOutput(output);
33
- }
34
- async destroy(){
35
- await this.#stopWorkers?.();
36
- }
37
- }
38
-
39
- //#endregion
40
- //#region src/rolldown.ts
41
- const rolldown = async input => {
42
- return new RolldownBuild(input);
43
- };
44
- const experimental_scan = async input => {
45
- const {bundler, stopWorkers} = await createBundler(input, {});
46
- await bundler.scan();
47
- await stopWorkers?.();
48
- };
49
-
50
- //#endregion
51
- exports.experimental_scan = experimental_scan;
52
- exports.rolldown = rolldown;