rolldown 1.0.0-beta.44 → 1.0.0-beta.45

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.
@@ -1,4 +1,4 @@
1
- import { F as ParserOptions, I as PreRenderedChunk, M as MinifyOptions$1, O as BindingWatcherEvent, _ as BindingRenderedChunk, b as BindingTransformHookExtraArgs, c as BindingHookResolveIdExtraArgs, f as BindingMagicString, i as BindingBundlerImpl, j as JsxOptions, r as BindingBuiltinPluginName, z as TransformOptions$1 } from "./binding-QBosa6N8.mjs";
1
+ import { F as ParserOptions, I as PreRenderedChunk, M as MinifyOptions$1, O as BindingWatcherEvent, _ as BindingRenderedChunk, b as BindingTransformHookExtraArgs, c as BindingHookResolveIdExtraArgs, f as BindingMagicString, i as BindingBundlerImpl, j as JsxOptions, r as BindingBuiltinPluginName, z as TransformOptions$1 } from "./binding-S7w0fEEX.mjs";
2
2
  import { TopLevelFilterExpression } from "@rolldown/pluginutils";
3
3
  import { Program } from "@oxc-project/types";
4
4
 
@@ -172,6 +172,7 @@ interface GeneratedCodeOptions {
172
172
  type ModuleFormat = "es" | "cjs" | "esm" | "module" | "commonjs" | "iife" | "umd";
173
173
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
174
174
  type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
175
+ type SanitizeFileNameFunction = (name: string) => string;
175
176
  interface PreRenderedAsset {
176
177
  type: "asset";
177
178
  name?: string;
@@ -181,7 +182,13 @@ interface PreRenderedAsset {
181
182
  source: string | Uint8Array;
182
183
  }
183
184
  type AssetFileNamesFunction = (chunkInfo: PreRenderedAsset) => string;
185
+ type PathsFunction$1 = (id: string) => string;
186
+ type ManualChunksFunction = (moduleId: string, meta: {
187
+ getModuleInfo: (moduleId: string) => ModuleInfo | null;
188
+ }) => string | NullValue;
184
189
  type GlobalsFunction = (name: string) => string;
190
+ type AdvancedChunksNameFunction = (moduleId: string, ctx: ChunkingContext) => string | NullValue;
191
+ type AdvancedChunksTestFunction = (id: string) => boolean | undefined | void;
185
192
  type MinifyOptions = Omit<MinifyOptions$1, "module" | "sourcemap">;
186
193
  interface ChunkingContext {
187
194
  getModuleInfo(moduleId: string): ModuleInfo | null;
@@ -248,7 +255,7 @@ interface OutputOptions {
248
255
  chunkFileNames?: string | ChunkFileNamesFunction;
249
256
  cssEntryFileNames?: string | ChunkFileNamesFunction;
250
257
  cssChunkFileNames?: string | ChunkFileNamesFunction;
251
- sanitizeFileName?: boolean | ((name: string) => string);
258
+ sanitizeFileName?: boolean | SanitizeFileNameFunction;
252
259
  /**
253
260
  * Control code minification.
254
261
  *
@@ -292,7 +299,7 @@ interface OutputOptions {
292
299
  * }
293
300
  * ```
294
301
  */
295
- paths?: Record<string, string> | ((id: string) => string);
302
+ paths?: Record<string, string> | PathsFunction$1;
296
303
  generatedCode?: Partial<GeneratedCodeOptions>;
297
304
  externalLiveBindings?: boolean;
298
305
  inlineDynamicImports?: boolean;
@@ -340,11 +347,9 @@ interface OutputOptions {
340
347
  *
341
348
  * @deprecated Please use `advancedChunks` instead.
342
349
  */
343
- manualChunks?: (moduleId: string, meta: {
344
- getModuleInfo: (moduleId: string) => ModuleInfo | null;
345
- }) => string | NullValue;
350
+ manualChunks?: ManualChunksFunction;
346
351
  /**
347
- * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/guide/in-depth/advanced-chunks).
352
+ * Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/in-depth/advanced-chunks).
348
353
  */
349
354
  advancedChunks?: {
350
355
  /**
@@ -446,7 +451,7 @@ interface OutputOptions {
446
451
  * Constraints like `minSize`, `maxSize`, etc. are applied separately for different names returned by the function.
447
452
  * :::
448
453
  */
449
- name: string | ((moduleId: string, ctx: ChunkingContext) => string | NullValue);
454
+ name: string | AdvancedChunksNameFunction;
450
455
  /**
451
456
  * - Type: `string | RegExp | ((id: string) => boolean | undefined | void);`
452
457
  *
@@ -463,7 +468,7 @@ interface OutputOptions {
463
468
  * - ❌ Not recommended: `/node_modules/react/`
464
469
  * :::
465
470
  */
466
- test?: StringOrRegExp | ((id: string) => boolean | undefined | void);
471
+ test?: StringOrRegExp | AdvancedChunksTestFunction;
467
472
  /**
468
473
  * - Type: `number`
469
474
  * - Default: `0`
@@ -876,7 +881,7 @@ interface PluginContext extends MinimalPluginContext {
876
881
  id: string;
877
882
  resolveDependencies?: boolean;
878
883
  } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
879
- parse(input: string, options?: ParserOptions | undefined | null): Program;
884
+ parse(input: string, options?: ParserOptions | null): Program;
880
885
  resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
881
886
  }
882
887
  //#endregion
@@ -1276,7 +1281,8 @@ interface TransformOptions extends Omit<TransformOptions$1, "sourceType" | "lang
1276
1281
  //#endregion
1277
1282
  //#region src/options/input-options.d.ts
1278
1283
  type InputOption = string | string[] | Record<string, string>;
1279
- type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);
1284
+ type ExternalOptionFunction = (id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>;
1285
+ type ExternalOption = StringOrRegExp | StringOrRegExp[] | ExternalOptionFunction;
1280
1286
  type ModuleTypes = Record<string, "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | "css" | "asset">;
1281
1287
  interface WatcherOptions {
1282
1288
  skipWrite?: boolean;
@@ -1340,9 +1346,15 @@ type OptimizationOptions = {
1340
1346
  mode?: "all" | "smart";
1341
1347
  pass?: number;
1342
1348
  };
1349
+ /**
1350
+ * Use PIFE pattern for module wrappers
1351
+ */
1352
+ pifeForModuleWrappers?: boolean;
1343
1353
  };
1344
1354
  type AttachDebugOptions = "none" | "simple" | "full";
1345
1355
  type ChunkModulesOrder = "exec-order" | "module-id";
1356
+ type OnLogFunction = (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1357
+ type OnwarnFunction = (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1346
1358
  interface InputOptions {
1347
1359
  input?: InputOption;
1348
1360
  plugins?: RolldownPluginOption;
@@ -1392,8 +1404,8 @@ interface InputOptions {
1392
1404
  shimMissingExports?: boolean;
1393
1405
  treeshake?: boolean | TreeshakingOptions;
1394
1406
  logLevel?: LogLevelOption;
1395
- onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1396
- onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1407
+ onLog?: OnLogFunction;
1408
+ onwarn?: OnwarnFunction;
1397
1409
  moduleTypes?: ModuleTypes;
1398
1410
  experimental?: {
1399
1411
  /**
@@ -1,4 +1,4 @@
1
- import { a as rolldown } from "./src-DY4_vVWu.mjs";
1
+ import { a as rolldown } from "./src-CPA2meNe.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { readdir } from "node:fs/promises";
@@ -14,13 +14,13 @@ async function bundleTsConfig(configFile, isEsm) {
14
14
  input: configFile,
15
15
  platform: "node",
16
16
  resolve: { mainFields: ["main"] },
17
- define: {
17
+ transform: { define: {
18
18
  __dirname: dirnameVarName,
19
19
  __filename: filenameVarName,
20
20
  "import.meta.url": importMetaUrlVarName,
21
21
  "import.meta.dirname": dirnameVarName,
22
22
  "import.meta.filename": filenameVarName
23
- },
23
+ } },
24
24
  treeshake: false,
25
25
  external: [/^[\w@][^:]/],
26
26
  plugins: [{
@@ -1,4 +1,4 @@
1
- import { b as parseSync, y as parseAsync } from "./binding-DkR1uPxc.mjs";
1
+ import { b as parseSync, y as parseAsync } from "./binding-D7oxcV7l.mjs";
2
2
  import { styleText } from "node:util";
3
3
 
4
4
  //#region src/utils/code-frame.ts