rolldown 0.14.0-snapshot-1cfa47c-20241129015040 → 0.14.0-snapshot-12d7e71-20241201004055

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/cjs/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-BK2Ye-xa.cjs');
3
- const require_src = require('../shared/src-C30C_EcA.cjs');
3
+ const require_src = require('../shared/src-DrLPqkUf.cjs');
4
4
  const require_consola_36c0034f = require('../shared/consola_36c0034f--b2gQiI0.cjs');
5
5
  const zod = require_chunk.__toESM(require("zod"));
6
6
  const node_path = require_chunk.__toESM(require("node:path"));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-BK2Ye-xa.cjs');
3
- const require_src = require('../shared/src-C30C_EcA.cjs');
3
+ const require_src = require('../shared/src-DrLPqkUf.cjs');
4
4
  const node_url = require_chunk.__toESM(require("node:url"));
5
5
 
6
6
  //#region src/plugin/parallel-plugin.ts
@@ -18,10 +18,9 @@ function defineParallelPlugin(pluginPath) {
18
18
  function normalizeEcmaTransformPluginConfig(config) {
19
19
  if (!config) return undefined;
20
20
  let normalizedConfig = {
21
- jsxInject: config?.jsxInject,
21
+ ...config,
22
22
  exclude: require_src.normalizedStringOrRegex(config.exclude),
23
- include: require_src.normalizedStringOrRegex(config.include),
24
- targets: config.targets
23
+ include: require_src.normalizedStringOrRegex(config.include)
25
24
  };
26
25
  return normalizedConfig;
27
26
  }
@@ -1,4 +1,4 @@
1
- const require_src = require('../shared/src-C30C_EcA.cjs');
1
+ const require_src = require('../shared/src-DrLPqkUf.cjs');
2
2
 
3
3
  exports.VERSION = require_src.VERSION
4
4
  exports.defineConfig = require_src.defineConfig
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-BK2Ye-xa.cjs');
3
- const require_src = require('../shared/src-C30C_EcA.cjs');
3
+ const require_src = require('../shared/src-DrLPqkUf.cjs');
4
4
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
5
5
 
6
6
  //#region src/parallel-plugin-worker.ts
package/dist/esm/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src-BSzWMLLr.mjs";
1
+ import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, __export, arraify, description, rolldown, version, watch } from "../shared/src-Bx1l8mKg.mjs";
2
2
  import { createConsola } from "../shared/consola_36c0034f-DWsVjwtA.mjs";
3
3
  import { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind as ZodFirstPartyTypeKind$2, z, z as z$1, z as z$2, z as z$3 } from "zod";
4
4
  import nodePath, { default as path } from "node:path";
@@ -1,4 +1,4 @@
1
- import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-BSzWMLLr.mjs";
1
+ import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, dynamicImportVarsPlugin, experimental_scan, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-Bx1l8mKg.mjs";
2
2
  import { pathToFileURL } from "node:url";
3
3
 
4
4
  //#region src/plugin/parallel-plugin.ts
@@ -16,10 +16,9 @@ function defineParallelPlugin(pluginPath) {
16
16
  function normalizeEcmaTransformPluginConfig(config) {
17
17
  if (!config) return undefined;
18
18
  let normalizedConfig = {
19
- jsxInject: config?.jsxInject,
19
+ ...config,
20
20
  exclude: normalizedStringOrRegex(config.exclude),
21
- include: normalizedStringOrRegex(config.include),
22
- targets: config.targets
21
+ include: normalizedStringOrRegex(config.include)
23
22
  };
24
23
  return normalizedConfig;
25
24
  }
@@ -1,3 +1,3 @@
1
- import { VERSION, defineConfig, rolldown, watch } from "../shared/src-BSzWMLLr.mjs";
1
+ import { VERSION, defineConfig, rolldown, watch } from "../shared/src-Bx1l8mKg.mjs";
2
2
 
3
3
  export { VERSION, defineConfig, rolldown, watch };
@@ -1,4 +1,4 @@
1
- import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-BSzWMLLr.mjs";
1
+ import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-Bx1l8mKg.mjs";
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
3
 
4
4
  //#region src/parallel-plugin-worker.ts
@@ -776,7 +776,7 @@ function normalizeHook(hook) {
776
776
  options: {},
777
777
  meta: {}
778
778
  };
779
- else if (typeof hook === "object" && hook !== null) {
779
+ if (typeof hook === "object" && hook !== null) {
780
780
  const { handler, order,...options } = hook;
781
781
  return {
782
782
  handler,
@@ -1256,6 +1256,7 @@ var PluginContext = class extends MinimalPluginContext {
1256
1256
  //#region src/plugin/transform-plugin-context.ts
1257
1257
  var TransformPluginContext = class extends PluginContext {
1258
1258
  error;
1259
+ getCombinedSourcemap;
1259
1260
  constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
1260
1261
  super(context, plugin, data, onLog, LogLevelOption, moduleId);
1261
1262
  const getLogHandler$1 = (handler) => (log, pos) => {
@@ -1275,6 +1276,7 @@ var TransformPluginContext = class extends PluginContext {
1275
1276
  e.hook = "transform";
1276
1277
  return error(logPluginError(normalizeLog(e), plugin.name || "unknown"));
1277
1278
  };
1279
+ this.getCombinedSourcemap = () => JSON.parse(inner.getCombinedSourcemap());
1278
1280
  }
1279
1281
  };
1280
1282
 
@@ -1571,6 +1573,30 @@ var NormalizedOutputOptionsImpl = class {
1571
1573
  get esModule() {
1572
1574
  return this.inner.esModule;
1573
1575
  }
1576
+ get extend() {
1577
+ return this.inner.extend;
1578
+ }
1579
+ get globals() {
1580
+ return mapFunctionOption(this.inner.globals, "globals");
1581
+ }
1582
+ get hashCharacters() {
1583
+ return this.inner.hashCharacters;
1584
+ }
1585
+ get sourcemapDebugIds() {
1586
+ return this.inner.sourcemapDebugIds;
1587
+ }
1588
+ get sourcemapIgnoreList() {
1589
+ return mapFunctionOption(void 0, "sourcemapIgnoreList");
1590
+ }
1591
+ get sourcemapPathTransform() {
1592
+ return mapFunctionOption(void 0, "sourcemapPathTransform");
1593
+ }
1594
+ get minify() {
1595
+ return this.inner.minify;
1596
+ }
1597
+ get comments() {
1598
+ return this.inner.comments;
1599
+ }
1574
1600
  };
1575
1601
 
1576
1602
  //#endregion
@@ -2132,6 +2158,7 @@ function bindingifyFormat(format) {
2132
2158
  case "commonjs": return "cjs";
2133
2159
  case "iife": return "iife";
2134
2160
  case "umd": return "umd";
2161
+ case "experimental-app": return "app";
2135
2162
  default: unimplemented(`output.format: ${format}`);
2136
2163
  }
2137
2164
  }
@@ -2358,7 +2385,12 @@ function createComposedPlugin(plugins) {
2358
2385
  }
2359
2386
  for (const [handler, plugin] of batchedHandlers) {
2360
2387
  const { handler: handlerFn } = normalizeHook(handler);
2361
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
2388
+ const result = await handlerFn.call({
2389
+ ...applyFixedPluginResolveFn(this, plugin),
2390
+ getCombinedSourcemap() {
2391
+ throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
2392
+ }
2393
+ }, code, id, moduleType);
2362
2394
  if (!isNullish(result)) {
2363
2395
  if (typeof result === "string") updateOutput(result);
2364
2396
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
@@ -2555,7 +2587,7 @@ async function createBundler(inputOptions, outputOptions) {
2555
2587
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
2556
2588
  outputOptions = pluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2557
2589
  const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
2558
- const onLog = inputOptions.onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2590
+ const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2559
2591
  let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(await normalizePluginOption(outputOptions.plugins), ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2560
2592
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2561
2593
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
@@ -744,7 +744,7 @@ function normalizeHook(hook) {
744
744
  options: {},
745
745
  meta: {}
746
746
  };
747
- else if (typeof hook === "object" && hook !== null) {
747
+ if (typeof hook === "object" && hook !== null) {
748
748
  const { handler, order,...options } = hook;
749
749
  return {
750
750
  handler,
@@ -1224,6 +1224,7 @@ var PluginContext = class extends MinimalPluginContext {
1224
1224
  //#region src/plugin/transform-plugin-context.ts
1225
1225
  var TransformPluginContext = class extends PluginContext {
1226
1226
  error;
1227
+ getCombinedSourcemap;
1227
1228
  constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
1228
1229
  super(context, plugin, data, onLog, LogLevelOption, moduleId);
1229
1230
  const getLogHandler$1 = (handler) => (log, pos) => {
@@ -1243,6 +1244,7 @@ var TransformPluginContext = class extends PluginContext {
1243
1244
  e.hook = "transform";
1244
1245
  return error(logPluginError(normalizeLog(e), plugin.name || "unknown"));
1245
1246
  };
1247
+ this.getCombinedSourcemap = () => JSON.parse(inner.getCombinedSourcemap());
1246
1248
  }
1247
1249
  };
1248
1250
 
@@ -1539,6 +1541,30 @@ var NormalizedOutputOptionsImpl = class {
1539
1541
  get esModule() {
1540
1542
  return this.inner.esModule;
1541
1543
  }
1544
+ get extend() {
1545
+ return this.inner.extend;
1546
+ }
1547
+ get globals() {
1548
+ return mapFunctionOption(this.inner.globals, "globals");
1549
+ }
1550
+ get hashCharacters() {
1551
+ return this.inner.hashCharacters;
1552
+ }
1553
+ get sourcemapDebugIds() {
1554
+ return this.inner.sourcemapDebugIds;
1555
+ }
1556
+ get sourcemapIgnoreList() {
1557
+ return mapFunctionOption(void 0, "sourcemapIgnoreList");
1558
+ }
1559
+ get sourcemapPathTransform() {
1560
+ return mapFunctionOption(void 0, "sourcemapPathTransform");
1561
+ }
1562
+ get minify() {
1563
+ return this.inner.minify;
1564
+ }
1565
+ get comments() {
1566
+ return this.inner.comments;
1567
+ }
1542
1568
  };
1543
1569
 
1544
1570
  //#endregion
@@ -2100,6 +2126,7 @@ function bindingifyFormat(format) {
2100
2126
  case "commonjs": return "cjs";
2101
2127
  case "iife": return "iife";
2102
2128
  case "umd": return "umd";
2129
+ case "experimental-app": return "app";
2103
2130
  default: unimplemented(`output.format: ${format}`);
2104
2131
  }
2105
2132
  }
@@ -2326,7 +2353,12 @@ function createComposedPlugin(plugins) {
2326
2353
  }
2327
2354
  for (const [handler, plugin] of batchedHandlers) {
2328
2355
  const { handler: handlerFn } = normalizeHook(handler);
2329
- const result = await handlerFn.call(applyFixedPluginResolveFn(this, plugin), code, id, moduleType);
2356
+ const result = await handlerFn.call({
2357
+ ...applyFixedPluginResolveFn(this, plugin),
2358
+ getCombinedSourcemap() {
2359
+ throw new Error(`The getCombinedSourcemap is not implement in transform hook at composedJsPlugins`);
2360
+ }
2361
+ }, code, id, moduleType);
2330
2362
  if (!isNullish(result)) {
2331
2363
  if (typeof result === "string") updateOutput(result);
2332
2364
  else if (result.code) updateOutput(result.code, result.moduleSideEffects);
@@ -2523,7 +2555,7 @@ async function createBundler(inputOptions, outputOptions) {
2523
2555
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
2524
2556
  outputOptions = pluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions);
2525
2557
  const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
2526
- const onLog = inputOptions.onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2558
+ const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel);
2527
2559
  let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(await normalizePluginOption(outputOptions.plugins), ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
2528
2560
  if (inputOptions.experimental?.enableComposingJsPlugins ?? false) plugins = composeJsPlugins(plugins);
2529
2561
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
@@ -58,6 +58,12 @@ export declare class BindingNormalizedOptions {
58
58
  get intro(): string | undefined | null | undefined
59
59
  get outro(): string | undefined | null | undefined
60
60
  get externalLiveBindings(): boolean
61
+ get extend(): boolean
62
+ get globals(): Record<string, string> | undefined
63
+ get hashCharacters(): 'base64' | 'base36' | 'hex'
64
+ get sourcemapDebugIds(): boolean
65
+ get minify(): boolean
66
+ get comments(): 'none' | 'preserve-legal'
61
67
  }
62
68
 
63
69
  export declare class BindingOutputAsset {
@@ -105,6 +111,7 @@ export declare class BindingRenderedModule {
105
111
  }
106
112
 
107
113
  export declare class BindingTransformPluginContext {
114
+ getCombinedSourcemap(): string
108
115
  inner(): BindingPluginContext
109
116
  }
110
117
 
@@ -389,7 +396,7 @@ export interface BindingOutputOptions {
389
396
  extend?: boolean
390
397
  externalLiveBindings?: boolean
391
398
  footer?: (chunk: RenderedChunk) => MaybePromise<VoidNullable<string>>
392
- format?: 'es' | 'cjs' | 'iife' | 'umd'
399
+ format?: 'es' | 'cjs' | 'iife' | 'umd' | 'app'
393
400
  globals?: Record<string, string> | ((name: string) => string)
394
401
  hashCharacters?: 'base64' | 'base36' | 'hex'
395
402
  inlineDynamicImports?: boolean
@@ -517,6 +524,7 @@ export interface BindingTransformPluginConfig {
517
524
  include?: Array<BindingStringOrRegex>
518
525
  exclude?: Array<BindingStringOrRegex>
519
526
  jsxInject?: string
527
+ reactRefresh?: boolean
520
528
  targets?: string
521
529
  }
522
530
 
@@ -1,5 +1,6 @@
1
1
  import type { BindingNormalizedOptions } from '../binding';
2
- import { ChunkFileNamesFunction, OutputOptions } from './output-options';
2
+ import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../rollup';
3
+ import type { ChunkFileNamesFunction, GlobalsFunction, OutputOptions } from './output-options';
3
4
  export type InternalModuleFormat = 'es' | 'cjs' | 'iife' | 'umd' | 'app';
4
5
  export interface NormalizedOutputOptions {
5
6
  name: string | undefined;
@@ -20,6 +21,14 @@ export interface NormalizedOutputOptions {
20
21
  intro: OutputOptions['intro'];
21
22
  outro: OutputOptions['outro'];
22
23
  esModule: boolean | 'if-default-prop';
24
+ extend: boolean;
25
+ globals: Record<string, string> | GlobalsFunction;
26
+ hashCharacters: 'base64' | 'base36' | 'hex';
27
+ sourcemapDebugIds: boolean;
28
+ sourcemapIgnoreList: SourcemapIgnoreListOption | undefined;
29
+ sourcemapPathTransform: SourcemapPathTransformOption | undefined;
30
+ minify: boolean;
31
+ comments: 'none' | 'preserve-legal';
23
32
  }
24
33
  export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOptions {
25
34
  inner: BindingNormalizedOptions;
@@ -43,4 +52,12 @@ export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOpti
43
52
  get intro(): string | (() => never) | undefined;
44
53
  get outro(): string | (() => never) | undefined;
45
54
  get esModule(): boolean | "if-default-prop";
55
+ get extend(): boolean;
56
+ get globals(): Record<string, string> | (() => never);
57
+ get hashCharacters(): "base64" | "base36" | "hex";
58
+ get sourcemapDebugIds(): boolean;
59
+ get sourcemapIgnoreList(): (() => never) | undefined;
60
+ get sourcemapPathTransform(): (() => never) | undefined;
61
+ get minify(): boolean;
62
+ get comments(): "none" | "preserve-legal";
46
63
  }
@@ -2,7 +2,7 @@ import type { StringOrRegExp } from '../types/utils';
2
2
  import type { RenderedChunk, PreRenderedChunk } from '../binding';
3
3
  import { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../rollup';
4
4
  import { RolldownOutputPluginOption } from '../plugin';
5
- export type ModuleFormat = 'es' | 'cjs' | 'esm' | 'module' | 'commonjs' | 'iife' | 'umd';
5
+ export type ModuleFormat = 'es' | 'cjs' | 'esm' | 'module' | 'commonjs' | 'iife' | 'umd' | 'experimental-app';
6
6
  export type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
7
7
  export type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
8
8
  export type GlobalsFunction = (name: string) => string;
@@ -1,11 +1,10 @@
1
- import type { BindingPluginOptions } from '../binding';
2
- import type { hookFilterExtension } from './index';
1
+ import type { BindingGeneralHookFilter, BindingPluginOptions, BindingTransformHookFilter } from '../binding';
3
2
  import { PluginHookWithBindingExt } from './bindingify-plugin-hook-meta';
4
3
  import type { BindingifyPluginArgs } from './bindingify-plugin';
5
4
  export declare function bindingifyBuildStart(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['buildStart']>;
6
5
  export declare function bindingifyBuildEnd(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['buildEnd']>;
7
- export declare function bindingifyResolveId(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['resolveId'], hookFilterExtension<'transform'>>;
6
+ export declare function bindingifyResolveId(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['resolveId'], BindingGeneralHookFilter | undefined>;
8
7
  export declare function bindingifyResolveDynamicImport(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['resolveDynamicImport']>;
9
- export declare function bindingifyTransform(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['transform']>;
10
- export declare function bindingifyLoad(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['load']>;
8
+ export declare function bindingifyTransform(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['transform'], BindingTransformHookFilter | undefined>;
9
+ export declare function bindingifyLoad(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['load'], BindingGeneralHookFilter | undefined>;
11
10
  export declare function bindingifyModuleParsed(args: BindingifyPluginArgs): PluginHookWithBindingExt<BindingPluginOptions['moduleParsed']>;
@@ -1,7 +1,7 @@
1
- import { BindingGeneralHookFilter, BindingTransformHookFilter } from '../binding.d';
2
- import { hookFilterExtension } from '.';
3
1
  import type { StringFilter } from './hook-filter';
2
+ import type { HookFilterExtension } from '.';
3
+ import type { BindingGeneralHookFilter, BindingTransformHookFilter } from '../binding.d';
4
4
  export declare function bindingifyStringFilter(matcher: StringFilter): BindingGeneralHookFilter;
5
- export declare function bindingifyResolveIdFilter(filterOption?: hookFilterExtension<'resolveId'>['filter']): BindingGeneralHookFilter | undefined;
6
- export declare function bindingifyLoadFilter(filterOption?: hookFilterExtension<'load'>['filter']): BindingGeneralHookFilter | undefined;
7
- export declare function bindingifyTransformFilter(filterOption?: hookFilterExtension<'transform'>['filter']): BindingTransformHookFilter | undefined;
5
+ export declare function bindingifyResolveIdFilter(filterOption?: HookFilterExtension<'resolveId'>['filter']): BindingGeneralHookFilter | undefined;
6
+ export declare function bindingifyLoadFilter(filterOption?: HookFilterExtension<'load'>['filter']): BindingGeneralHookFilter | undefined;
7
+ export declare function bindingifyTransformFilter(filterOption?: HookFilterExtension<'transform'>['filter']): BindingTransformHookFilter | undefined;
@@ -4,19 +4,19 @@ import type { NullValue, MaybePromise, PartialNull, MakeAsync } from '../types/u
4
4
  import type { SourceMapInput } from '../types/sourcemap';
5
5
  import type { ModuleInfo } from '../types/module-info';
6
6
  import type { OutputBundle } from '../types/output-bundle';
7
- import { PluginContext } from './plugin-context';
7
+ import type { PluginContext } from './plugin-context';
8
8
  import type { TransformPluginContext } from './transform-plugin-context';
9
9
  import type { NormalizedOutputOptions } from '../options/normalized-output-options';
10
10
  import type { LogLevel } from '../log/logging';
11
11
  import type { RollupLog } from '../rollup';
12
12
  import type { MinimalPluginContext } from './minimal-plugin-context';
13
- import { InputOptions, OutputOptions } from '..';
14
- import { BuiltinPlugin } from '../builtin-plugin/constructors';
15
- import { ParallelPlugin } from './parallel-plugin';
13
+ import type { InputOptions, OutputOptions } from '..';
14
+ import type { BuiltinPlugin } from '../builtin-plugin/constructors';
15
+ import type { ParallelPlugin } from './parallel-plugin';
16
16
  import type { DefinedHookNames } from '../constants/plugin';
17
- import { DEFINED_HOOK_NAMES } from '../constants/plugin';
18
- import { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
19
- import { HookFilter } from './hook-filter';
17
+ import type { DEFINED_HOOK_NAMES } from '../constants/plugin';
18
+ import type { SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF } from '../constants/plugin-context';
19
+ import type { HookFilter } from './hook-filter';
20
20
  export type ModuleSideEffects = boolean | 'no-treeshake' | null;
21
21
  export type ModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
22
22
  export type ImportKind = BindingHookResolveIdExtraArgs['kind'];
@@ -85,12 +85,12 @@ export interface FunctionPluginHooks {
85
85
  }
86
86
  export type ChangeEvent = 'create' | 'update' | 'delete';
87
87
  export type PluginOrder = 'pre' | 'post' | null;
88
- export type ObjectHookMeta<O = {}> = {
88
+ export type ObjectHookMeta = {
89
89
  order?: PluginOrder;
90
- } & O;
90
+ };
91
91
  export type ObjectHook<T, O = {}> = T | ({
92
92
  handler: T;
93
- } & ObjectHookMeta<O>);
93
+ } & ObjectHookMeta & O);
94
94
  export type SyncPluginHooks = DefinedHookNames['augmentChunkHash' | 'onLog' | 'outputOptions'];
95
95
  export type AsyncPluginHooks = Exclude<keyof FunctionPluginHooks, SyncPluginHooks>;
96
96
  export type FirstPluginHooks = DefinedHookNames['load' | 'resolveDynamicImport' | 'resolveId'];
@@ -98,13 +98,13 @@ export type SequentialPluginHooks = DefinedHookNames['augmentChunkHash' | 'gener
98
98
  export type AddonHooks = DefinedHookNames['banner' | 'footer' | 'intro' | 'outro'];
99
99
  export type OutputPluginHooks = DefinedHookNames['augmentChunkHash' | 'generateBundle' | 'outputOptions' | 'renderChunk' | 'renderError' | 'renderStart' | 'writeBundle'];
100
100
  export type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, FirstPluginHooks | SequentialPluginHooks>;
101
- export type hookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'transform' ? {
101
+ export type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'transform' ? {
102
102
  filter?: HookFilter;
103
103
  } : K extends 'load' | 'resolveId' ? {
104
104
  filter?: Pick<HookFilter, 'id'>;
105
105
  } : {};
106
106
  export type PluginHooks = {
107
- [K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], hookFilterExtension<K>>;
107
+ [K in keyof FunctionPluginHooks]: ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K>>;
108
108
  };
109
109
  export type AddonHookFunction = (this: PluginContext, chunk: RenderedChunk) => string | Promise<string>;
110
110
  export type AddonHook = string | AddonHookFunction;
@@ -3,10 +3,12 @@ import type { LogHandler, LogLevelOption, RollupError } from '../rollup';
3
3
  import { PluginContext } from './plugin-context';
4
4
  import { PluginContextData } from './plugin-context-data';
5
5
  import type { Plugin } from './index';
6
+ import { SourceMap } from '../types/rolldown-output';
6
7
  export declare class TransformPluginContext extends PluginContext {
7
8
  error: (error: RollupError | string, pos?: number | {
8
9
  column: number;
9
10
  line: number;
10
11
  }) => never;
12
+ getCombinedSourcemap: () => SourceMap;
11
13
  constructor(context: BindingPluginContext, plugin: Plugin, data: PluginContextData, inner: BindingTransformPluginContext, moduleId: string, moduleSource: string, onLog: LogHandler, LogLevelOption: LogLevelOption);
12
14
  }
@@ -1,6 +1,6 @@
1
1
  import { AnyFn } from '../types/utils';
2
2
  import type { ObjectHook, ObjectHookMeta } from '../plugin';
3
- export declare function normalizeHook<Hook extends ObjectHook<AnyFn | string>>(hook: Hook): Hook extends ObjectHook<infer RawHook, infer CustomOptions> ? {
3
+ export declare function normalizeHook<Hook extends ObjectHook<AnyFn | string>>(hook: Hook): Hook extends ObjectHook<infer RawHook, infer CustomOptions> ? Hook extends RawHook ? never : {
4
4
  handler: RawHook;
5
5
  options: CustomOptions;
6
6
  meta: ObjectHookMeta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "0.14.0-snapshot-1cfa47c-20241129015040",
3
+ "version": "0.14.0-snapshot-12d7e71-20241201004055",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -113,21 +113,21 @@
113
113
  "why-is-node-running": "^3.0.0",
114
114
  "zod-to-json-schema": "^3.23.2",
115
115
  "@rolldown/testing": "0.0.1",
116
- "rolldown": "0.14.0-snapshot-1cfa47c-20241129015040"
116
+ "rolldown": "0.14.0-snapshot-12d7e71-20241201004055"
117
117
  },
118
118
  "optionalDependencies": {
119
- "@rolldown/binding-darwin-arm64": "0.14.0-snapshot-1cfa47c-20241129015040",
120
- "@rolldown/binding-darwin-x64": "0.14.0-snapshot-1cfa47c-20241129015040",
121
- "@rolldown/binding-linux-arm-gnueabihf": "0.14.0-snapshot-1cfa47c-20241129015040",
122
- "@rolldown/binding-freebsd-x64": "0.14.0-snapshot-1cfa47c-20241129015040",
123
- "@rolldown/binding-linux-arm64-gnu": "0.14.0-snapshot-1cfa47c-20241129015040",
124
- "@rolldown/binding-linux-arm64-musl": "0.14.0-snapshot-1cfa47c-20241129015040",
125
- "@rolldown/binding-linux-x64-gnu": "0.14.0-snapshot-1cfa47c-20241129015040",
126
- "@rolldown/binding-linux-x64-musl": "0.14.0-snapshot-1cfa47c-20241129015040",
127
- "@rolldown/binding-wasm32-wasi": "0.14.0-snapshot-1cfa47c-20241129015040",
128
- "@rolldown/binding-win32-ia32-msvc": "0.14.0-snapshot-1cfa47c-20241129015040",
129
- "@rolldown/binding-win32-arm64-msvc": "0.14.0-snapshot-1cfa47c-20241129015040",
130
- "@rolldown/binding-win32-x64-msvc": "0.14.0-snapshot-1cfa47c-20241129015040"
119
+ "@rolldown/binding-darwin-x64": "0.14.0-snapshot-12d7e71-20241201004055",
120
+ "@rolldown/binding-darwin-arm64": "0.14.0-snapshot-12d7e71-20241201004055",
121
+ "@rolldown/binding-freebsd-x64": "0.14.0-snapshot-12d7e71-20241201004055",
122
+ "@rolldown/binding-linux-arm64-gnu": "0.14.0-snapshot-12d7e71-20241201004055",
123
+ "@rolldown/binding-linux-arm-gnueabihf": "0.14.0-snapshot-12d7e71-20241201004055",
124
+ "@rolldown/binding-linux-arm64-musl": "0.14.0-snapshot-12d7e71-20241201004055",
125
+ "@rolldown/binding-linux-x64-gnu": "0.14.0-snapshot-12d7e71-20241201004055",
126
+ "@rolldown/binding-linux-x64-musl": "0.14.0-snapshot-12d7e71-20241201004055",
127
+ "@rolldown/binding-wasm32-wasi": "0.14.0-snapshot-12d7e71-20241201004055",
128
+ "@rolldown/binding-win32-ia32-msvc": "0.14.0-snapshot-12d7e71-20241201004055",
129
+ "@rolldown/binding-win32-arm64-msvc": "0.14.0-snapshot-12d7e71-20241201004055",
130
+ "@rolldown/binding-win32-x64-msvc": "0.14.0-snapshot-12d7e71-20241201004055"
131
131
  },
132
132
  "scripts": {
133
133
  "# Scrips for binding #": "_",