rolldown 0.10.5 → 0.11.0

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.
@@ -53,6 +53,8 @@ export class BindingPluginContext {
53
53
  resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
54
54
  emitFile(file: BindingEmittedAsset): string
55
55
  getFileName(referenceId: string): string
56
+ getModuleInfo(moduleId: string): BindingModuleInfo | null
57
+ getModuleIds(): Array<string> | null
56
58
  }
57
59
 
58
60
  export class BindingTransformPluginContext {
@@ -86,6 +88,10 @@ export interface AliasItem {
86
88
  replacements: Array<string>
87
89
  }
88
90
 
91
+ export interface ArrowFunctionsBindingOptions {
92
+ spec?: boolean
93
+ }
94
+
89
95
  export interface BindingAssetSource {
90
96
  inner: string | Uint8Array
91
97
  }
@@ -96,7 +102,8 @@ export interface BindingBuiltinPlugin {
96
102
  }
97
103
 
98
104
  export enum BindingBuiltinPluginName {
99
- WasmPlugin = 0
105
+ WasmPlugin = 0,
106
+ GlobImportPlugin = 1
100
107
  }
101
108
 
102
109
  export interface BindingEmittedAsset {
@@ -239,7 +246,31 @@ export interface BindingTreeshake {
239
246
  moduleSideEffects: string
240
247
  }
241
248
 
242
- export function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
249
+ export interface Es2015BindingOptions {
250
+ arrowFunction?: ArrowFunctionsBindingOptions
251
+ }
252
+
253
+ /** TypeScript Isolated Declarations for Standalone DTS Emit */
254
+ function isolatedDeclaration(filename: string, sourceText: string): IsolatedDeclarationsResult
255
+
256
+ export interface IsolatedDeclarationsResult {
257
+ sourceText: string
258
+ errors: Array<string>
259
+ }
260
+
261
+ export interface ReactBindingOptions {
262
+ runtime?: 'classic' | 'automatic'
263
+ development?: boolean
264
+ throwIfNamespace?: boolean
265
+ pure?: boolean
266
+ importSource?: string
267
+ pragma?: string
268
+ pragmaFrag?: string
269
+ useBuiltIns?: boolean
270
+ useSpread?: boolean
271
+ }
272
+
273
+ function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
243
274
 
244
275
  export interface RenderedChunk {
245
276
  name: string
@@ -254,3 +285,42 @@ export interface RenderedChunk {
254
285
  dynamicImports: Array<string>
255
286
  }
256
287
 
288
+ export interface Sourcemap {
289
+ file?: string
290
+ mappings?: string
291
+ sourceRoot?: string
292
+ sources?: Array<string | undefined | null>
293
+ sourcesContent?: Array<string | undefined | null>
294
+ names?: Array<string>
295
+ }
296
+
297
+ function transform(filename: string, sourceText: string, options?: TransformBindingOptions | undefined | null): TransformResult
298
+
299
+ export interface TransformBindingOptions {
300
+ typescript?: TypeScriptBindingOptions
301
+ react?: ReactBindingOptions
302
+ es2015?: Es2015BindingOptions
303
+ /**
304
+ * Enable Sourcemap
305
+ *
306
+ * * `true` to generate a sourcemap for the code and include it in the result object.
307
+ *
308
+ * Default: false
309
+ */
310
+ sourcemap?: boolean
311
+ }
312
+
313
+ export interface TransformResult {
314
+ sourceText: string
315
+ map?: Sourcemap
316
+ errors: Array<string>
317
+ }
318
+
319
+ export interface TypeScriptBindingOptions {
320
+ jsxPragma?: string
321
+ jsxPragmaFrag?: string
322
+ onlyRemoveTypeImports?: boolean
323
+ allowNamespaces?: boolean
324
+ allowDeclareFields?: boolean
325
+ }
326
+
@@ -1,2 +1 @@
1
- /// <reference types="colorette" />
2
1
  export declare const bold: import("colorette").Color, cyan: import("colorette").Color, dim: import("colorette").Color, gray: import("colorette").Color, green: import("colorette").Color, red: import("colorette").Color, underline: import("colorette").Color, yellow: import("colorette").Color;
@@ -7,20 +7,20 @@ import { defineParallelPlugin, DefineParallelPluginResult } from './plugin';
7
7
  import { defineConfig } from './utils/define-config';
8
8
  import { rolldown, experimental_scan } from './rolldown';
9
9
  import { ConfigExport } from './types/config-export';
10
- import { BuiltinWasmPlugin } from './plugin/bindingify-builtin-plugin';
10
+ import { BuiltinGlobImportPlugin, BuiltinWasmPlugin } from './plugin/bindingify-builtin-plugin';
11
11
  import { RolldownBuild } from './rolldown-build';
12
12
  import { InternalModuleFormat } from './options/bindingify-output-options';
13
13
  import { EmittedAsset, EmittedFile, PluginContext } from './plugin/plugin-context';
14
14
  import { TransformPluginContext } from './plugin/transfrom-plugin-context';
15
15
  import { NormalizedOutputOptions } from './options/normalized-output-options';
16
- import { RenderedChunk } from './binding';
16
+ import { RenderedChunk, transform } from './binding';
17
17
  import { PartialNull } from './types/utils';
18
18
  import { NormalizedInputOptions } from './options/normalized-input-options';
19
19
  import { ModuleInfo } from './types/module-info';
20
20
  import { MinimalPluginContext } from './log/logger';
21
21
  import { ExistingRawSourceMap, SourceMapInput } from './types/sourcemap';
22
22
  import { OutputBundle } from './types/output-bundle';
23
- export { defineConfig, defineParallelPlugin, rolldown, experimental_scan, BuiltinWasmPlugin, };
23
+ export { defineConfig, defineParallelPlugin, rolldown, experimental_scan, transform, BuiltinWasmPlugin, BuiltinGlobImportPlugin, };
24
24
  export type { RolldownOutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, RenderedChunk, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, };
25
25
  export type { RolldownOutput as RollupOutput, RolldownOptions as RollupOptions, RolldownBuild as RollupBuild, RolldownOutputChunk as OutputChunk, RolldownOutputAsset as OutputAsset, };
26
26
  export type { RollupError, RollupLog, LoggingFunction } from './rollup';
@@ -10,4 +10,4 @@ export interface MinimalPluginContext {
10
10
  warn: LoggingFunction;
11
11
  }
12
12
  export declare function getLogger(plugins: Plugin[], onLog: LogHandler, logLevel: LogLevelOption): LogHandler;
13
- export declare const getOnLog: (config: InputOptions, logLevel: LogLevelOption, printLog?: LogHandler) => NormalizedInputOptions['onLog'];
13
+ export declare const getOnLog: (config: InputOptions, logLevel: LogLevelOption, printLog?: LogHandler) => NormalizedInputOptions["onLog"];
@@ -15,25 +15,25 @@ declare const outputOptionsSchema: z.ZodObject<{
15
15
  assetFileNames: z.ZodOptional<z.ZodString>;
16
16
  }, "strict", z.ZodTypeAny, {
17
17
  exports?: "named" | undefined;
18
+ banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
19
+ footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
18
20
  dir?: string | undefined;
19
21
  format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
20
22
  sourcemap?: boolean | "inline" | "hidden" | undefined;
21
23
  sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
22
24
  sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
23
- banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
24
- footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
25
25
  entryFileNames?: string | undefined;
26
26
  chunkFileNames?: string | undefined;
27
27
  assetFileNames?: string | undefined;
28
28
  }, {
29
29
  exports?: "named" | undefined;
30
+ banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
31
+ footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
30
32
  dir?: string | undefined;
31
33
  format?: "es" | "cjs" | "esm" | "module" | "commonjs" | undefined;
32
34
  sourcemap?: boolean | "inline" | "hidden" | undefined;
33
35
  sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption | undefined;
34
36
  sourcemapPathTransform?: SourcemapPathTransformOption | undefined;
35
- banner?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
36
- footer?: string | ((args_0: RenderedChunk, ...args_1: unknown[]) => string | Promise<string>) | undefined;
37
37
  entryFileNames?: string | undefined;
38
38
  chunkFileNames?: string | undefined;
39
39
  assetFileNames?: string | undefined;
@@ -1,10 +1,13 @@
1
1
  import { BindingBuiltinPlugin, BindingBuiltinPluginName } from '../binding';
2
2
  export declare class BuiltinPlugin {
3
3
  name: BindingBuiltinPluginName;
4
- options?: unknown;
5
- constructor(name: BindingBuiltinPluginName, options?: unknown);
4
+ options?: unknown | undefined;
5
+ constructor(name: BindingBuiltinPluginName, options?: unknown | undefined);
6
6
  }
7
7
  export declare class BuiltinWasmPlugin extends BuiltinPlugin {
8
8
  constructor(options?: unknown);
9
9
  }
10
+ export declare class BuiltinGlobImportPlugin extends BuiltinPlugin {
11
+ constructor(options?: unknown);
12
+ }
10
13
  export declare function bindingifyBuiltInPlugin(plugin: BuiltinPlugin): BindingBuiltinPlugin;
@@ -3,6 +3,7 @@ import type { BindingPluginContext } from '../binding';
3
3
  import type { NormalizedInputOptions } from '../options/normalized-input-options';
4
4
  import type { Plugin } from './index';
5
5
  import { AssetSource } from '../utils/asset-source';
6
+ import { ModuleInfo } from '../types/module-info';
6
7
  export interface EmittedAsset {
7
8
  type: 'asset';
8
9
  name?: string;
@@ -18,9 +19,13 @@ export declare class PluginContext {
18
19
  resolve: BindingPluginContext['resolve'];
19
20
  emitFile: (file: EmittedAsset) => string;
20
21
  getFileName: (referenceId: string) => string;
22
+ getModuleInfo: (id: string) => ModuleInfo | null;
23
+ getModuleIds: () => IterableIterator<string>;
21
24
  /**
22
25
  * @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
23
26
  */
24
27
  parse: (input: string, options?: any) => any;
28
+ modules: Map<string, ModuleInfo>;
29
+ moduleIds: Array<string> | null;
25
30
  constructor(options: NormalizedInputOptions, context: BindingPluginContext, plugin: Plugin);
26
31
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Worker } from 'node:worker_threads';
3
2
  import type { ParallelPlugin, Plugin } from '../plugin';
4
3
  import { ParallelJsPluginRegistry } from '../binding';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "0.10.5",
3
+ "version": "0.11.0",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -72,20 +72,20 @@
72
72
  "dtsHeader": "type MaybePromise<T> = T | Promise<T>\ntype Nullable<T> = T | null | undefined\ntype VoidNullable<T = void> = T | null | undefined | void\n"
73
73
  },
74
74
  "dependencies": {
75
- "citty": "^0.1.6",
76
- "colorette": "^2.0.20",
77
- "consola": "^3.2.3",
78
- "locate-character": "^3.0.0",
79
- "mri": "^1.2.0",
80
75
  "zod": "^3.23.8"
81
76
  },
82
77
  "devDependencies": {
83
78
  "@napi-rs/cli": "^3.0.0-alpha.55",
84
79
  "@napi-rs/wasm-runtime": "^0.2.4",
80
+ "citty": "^0.1.6",
81
+ "colorette": "^2.0.20",
82
+ "consola": "^3.2.3",
85
83
  "emnapi": "^1.2.0",
86
84
  "execa": "^9.2.0",
87
85
  "fs-extra": "^11.2.0",
88
86
  "glob": "^10.4.1",
87
+ "locate-character": "^3.0.0",
88
+ "mri": "^1.2.0",
89
89
  "npm-run-all2": "^6.2.0",
90
90
  "rollup": "^4.18.0",
91
91
  "type-fest": "^4.20.0",
@@ -94,20 +94,20 @@
94
94
  "vitest": "^1.6.0",
95
95
  "why-is-node-running": "^2.2.2",
96
96
  "@rolldown/testing": "0.0.1",
97
- "rolldown": "0.10.5"
97
+ "rolldown": "0.11.0"
98
98
  },
99
99
  "optionalDependencies": {
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"
100
+ "@rolldown/binding-darwin-x64": "0.11.0",
101
+ "@rolldown/binding-darwin-arm64": "0.11.0",
102
+ "@rolldown/binding-linux-arm-gnueabihf": "0.11.0",
103
+ "@rolldown/binding-linux-arm64-musl": "0.11.0",
104
+ "@rolldown/binding-linux-arm64-gnu": "0.11.0",
105
+ "@rolldown/binding-linux-x64-gnu": "0.11.0",
106
+ "@rolldown/binding-linux-x64-musl": "0.11.0",
107
+ "@rolldown/binding-wasm32-wasi": "0.11.0",
108
+ "@rolldown/binding-win32-arm64-msvc": "0.11.0",
109
+ "@rolldown/binding-win32-ia32-msvc": "0.11.0",
110
+ "@rolldown/binding-win32-x64-msvc": "0.11.0"
111
111
  },
112
112
  "scripts": {
113
113
  "# Scrips for binding #": "_",