🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

rolldown

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rolldown - npm Package Compare versions

Comparing version

to
1.0.0-beta.3-commit.e170e6e

@@ -12,2 +12,3 @@ import type { InputOptions } from '../../options/input-options';

[Symbol.asyncDispose](): Promise<void>;
generateHmrPatch(changedFiles: string[]): Promise<string | void>;
}

@@ -23,7 +23,2 @@ type MaybePromise<T> = T | Promise<T>

export declare class BindingLog {
code: string
message: string
}
export declare class BindingModuleInfo {

@@ -67,3 +62,3 @@ id: string

get sourcemapDebugIds(): boolean
get minify(): boolean
get minify(): false | BindingMinifyOptions
get polyfillRequire(): boolean

@@ -118,2 +113,3 @@ get comments(): 'none' | 'preserve-legal'

get code(): string | null
get renderedExports(): Array<string>
}

@@ -152,39 +148,5 @@

get closed(): boolean
generateHmrPatch(changedFiles: Array<string>): Promise<string>
}
export declare class MagicString {
/** Get source text from utf8 offset. */
getSourceText(start: number, end: number): string
/** Get 0-based line and column number from utf8 offset. */
getLineColumnNumber(offset: number): LineColumn
/** Get UTF16 byte offset from UTF8 byte offset. */
getUtf16ByteOffset(offset: number): number
length(): number
toString(): string
hasChanged(): boolean
append(input: string): this
appendLeft(index: number, input: string): this
appendRight(index: number, input: string): this
indent(): this
prepend(input: string): this
prependLeft(index: number, input: string): this
prependRight(index: number, input: string): this
relocate(start: number, end: number, to: number): this
remove(start: number, end: number): this
generateMap(options?: Partial<GenerateDecodedMapOptions>): {
toString: () => string;
toUrl: () => string;
toMap: () => {
file?: string
mappings: string
names: Array<string>
sourceRoot?: string
sources: Array<string>
sourcesContent?: Array<string>
version: number
x_google_ignoreList?: Array<number>
}
}
}
export declare class ParallelJsPluginRegistry {

@@ -201,3 +163,2 @@ id: number

get errors(): Array<OxcError>
get magicString(): MagicString
}

@@ -295,2 +256,8 @@

export interface BindingDeferSyncScanData {
/** ModuleId */
id: string
sideEffects?: BindingHookSideEffects
}
export interface BindingEmittedAsset {

@@ -315,3 +282,3 @@ name?: string

resolveNewUrlToAsset?: boolean
developmentMode?: boolean
hmr?: boolean
}

@@ -418,5 +385,7 @@

jsx?: BindingJsx
transform?: TransformOptions
watch?: BindingWatchOption
keepNames?: boolean
checks?: BindingChecksOptions
deferSyncScanData?: undefined | (() => BindingDeferSyncScanData[])
}

@@ -440,2 +409,4 @@

names?: Array<string>
debugId?: string
x_google_ignoreList?: Array<number>
}

@@ -447,7 +418,17 @@

/** TODO: support `preserve-react` mode */
export type BindingJsx =
| { type: 'Disable' }
| { type: 'Preserve' }
| { type: 'React' }
| { type: 'ReactJsx' }
| { type: 'Enable', field0: JsxOptions }
export interface BindingLog {
code: string
message: string
id?: string
exporter?: string
}
export declare enum BindingLogLevel {

@@ -476,2 +457,14 @@ Silent = 0,

export interface BindingMfManifest {
filePath?: string
disableAssetsAnalyze?: boolean
fileName?: string
}
export interface BindingMinifyOptions {
mangle: boolean
compress: boolean
removeWhitespace: boolean
}
export interface BindingModuleFederationPluginOption {

@@ -484,2 +477,4 @@ name: string

runtimePlugins?: Array<string>
manifest?: BindingMfManifest
getPublicPath?: string
}

@@ -492,4 +487,4 @@

export interface BindingModules {
value: Array<BindingRenderedModule>
idToIndex: Record<string, number>
values: Array<BindingRenderedModule>
keys: Array<string>
}

@@ -535,3 +530,3 @@

sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
minify?: boolean
minify?: boolean | 'dce-only' | BindingMinifyOptions
advancedChunks?: BindingAdvancedChunksOptions

@@ -685,2 +680,4 @@ comments?: 'none' | 'preserve-legal'

annotations?: boolean
manualPureFunctions?: Array<string>
unknownGlobalSideEffects?: boolean
}

@@ -721,2 +718,3 @@

exclude?: Array<BindingStringOrRegex>
buildDelay?: number
}

@@ -739,2 +737,25 @@

export interface DecoratorOptions {
/**
* Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
*
* Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
* This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
*
* @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
* @default false
*/
legacy?: boolean
/**
* Enables emitting decorator metadata.
*
* This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
* in TypeScript, and it only works when `legacy` is true.
*
* @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
* @default false
*/
emitDecoratorMetadata?: boolean
}
export interface DynamicImport {

@@ -828,10 +849,9 @@ start: number

export interface GenerateDecodedMapOptions {
/** The filename of the file containing the original source. */
source?: string
/** Whether to include the original content in the map's `sourcesContent` array. */
includeContent: boolean
/** Whether the mapping should be high-resolution. */
hires: boolean | 'boundary'
}
/**
* Get offset within a `Uint8Array` which is aligned on 4 GiB.
*
* Does not check that the offset is within bounds of `buffer`.
* To ensure it always is, provide a `Uint8Array` of at least 4 GiB size.
*/
export declare function getBufferOffset(buffer: Uint8Array): number

@@ -844,3 +864,3 @@ export type HelperMode = /**

* ```js
* import helperName from "@babel/runtime/helpers/helperName";
* import helperName from "@oxc-project/runtime/helpers/helperName";
* helperName(...arguments);

@@ -1026,9 +1046,53 @@ * ```

export interface LineColumn {
line: number
column: number
/**
* Transform JavaScript code to a Vite Node runnable module.
*
* @param filename The name of the file being transformed.
* @param sourceText the source code itself
* @param options The options for the transformation. See {@link
* ModuleRunnerTransformOptions} for more information.
*
* @returns an object containing the transformed code, source maps, and any
* errors that occurred during parsing or transformation.
*
* @deprecated Only works for Vite.
*/
export declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult
export interface ModuleRunnerTransformOptions {
/**
* Enable source map generation.
*
* When `true`, the `sourceMap` field of transform result objects will be populated.
*
* @default false
*
* @see {@link SourceMap}
*/
sourcemap?: boolean
}
export interface OverwriteOptions {
contentOnly: boolean
export interface ModuleRunnerTransformResult {
/**
* The transformed code.
*
* If parsing failed, this will be an empty string.
*/
code: string
/**
* The source map for the transformed code.
*
* This will be set if {@link TransformOptions#sourcemap} is `true`.
*/
map?: SourceMap
deps: Array<string>
dynamicDeps: Array<string>
/**
* Parse and transformation errors.
*
* Oxc's parser recovers from common syntax errors, meaning that
* transformed code may still be available even if there are errors in this
* list.
*/
errors: Array<OxcError>
}

@@ -1055,2 +1119,10 @@

/**
* Return an AST which includes TypeScript-related properties, or excludes them.
*
* `'js'` is default for JS / JSX files.
* `'ts'` is default for TS / TSX files.
* The type of the file is determined from `lang` option, or extension of provided `filename`.
*/
astType?: 'js' | 'ts'
/**
* Emit `ParenthesizedExpression` in AST.

@@ -1062,5 +1134,13 @@ *

*
* Default: true
* @default true
*/
preserveParens?: boolean
/**
* Produce semantic errors with an additional AST pass.
* Semantic errors depend on symbols and scopes, where the parser does not construct.
* This adds a small performance overhead.
*
* @default false
*/
showSemanticErrors?: boolean
}

@@ -1072,7 +1152,28 @@

/**
* Parse without returning anything.
* Parses AST into provided `Uint8Array` buffer.
*
* This is for benchmark purposes such as measuring napi communication overhead.
* Source text must be written into the start of the buffer, and its length (in UTF-8 bytes)
* provided as `source_len`.
*
* This function will parse the source, and write the AST into the buffer, starting at the end.
*
* It also writes to the very end of the buffer the offset of `Program` within the buffer.
*
* Caller can deserialize data from the buffer on JS side.
*
* # SAFETY
*
* Caller must ensure:
* * Source text is written into start of the buffer.
* * Source text's UTF-8 byte length is `source_len`.
* * The 1st `source_len` bytes of the buffer comprises a valid UTF-8 string.
*
* If source text is originally a JS string on JS side, and converted to a buffer with
* `Buffer.from(str)` or `new TextEncoder().encode(str)`, this guarantees it's valid UTF-8.
*
* # Panics
*
* Panics if source text is too long, or AST takes more memory than is available in the buffer.
*/
export declare function parseWithoutReturn(filename: string, sourceText: string, options?: ParserOptions | undefined | null): void
export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void

@@ -1088,2 +1189,5 @@ export interface PreRenderedChunk {

/** Returns `true` if raw transfer is supported on this platform. */
export declare function rawTransferSupported(): boolean
export interface ReactRefreshOptions {

@@ -1122,8 +1226,2 @@ /**

export interface SourceMapOptions {
includeContent?: boolean
source?: string
hires?: boolean
}
export interface Span {

@@ -1273,2 +1371,4 @@ start: number

inject?: Record<string, string | [string, string]>
/** Decorator plugin */
decorator?: DecoratorOptions
}

@@ -1314,3 +1414,3 @@

* ```text
* { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
* { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
* ```

@@ -1317,0 +1417,0 @@ */

@@ -1,2 +0,2 @@

import { type BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig, BindingBuildImportAnalysisPluginConfig, type BindingViteResolvePluginConfig, BindingModuleFederationPluginOption, BindingRemote } from '../binding';
import { type BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingManifestPluginConfig, BindingModulePreloadPolyfillPluginConfig, BindingJsonPluginConfig, BindingBuildImportAnalysisPluginConfig, type BindingViteResolvePluginConfig, BindingModuleFederationPluginOption, BindingRemote, BindingMfManifest } from '../binding';
export declare class BuiltinPlugin {

@@ -19,3 +19,4 @@ name: BindingBuiltinPluginName;

remotes?: Record<string, string | BindingRemote>;
manifest?: boolean | BindingMfManifest;
};
export declare function moduleFederationPlugin(config: ModuleFederationPluginOption): BuiltinPlugin;
import type { ConfigExport } from '../types/config-export';
export declare function loadTsConfig(configFile: string): Promise<ConfigExport>;
export declare function isFilePathESM(filePath: string): boolean;
export declare function findNearestPackageData(basedir: string): any | null;
export declare function loadConfig(configPath: string): Promise<ConfigExport>;
export { defineParallelPlugin } from './plugin/parallel-plugin';
export { experimental_scan as scan } from './api/experimental';
export { transform } from './binding';
export { transform, moduleRunnerTransform } from './binding';
export type { TransformOptions, TransformResult } from './binding';

@@ -5,0 +5,0 @@ export { composeJsPlugins as composePlugins } from './utils/compose-js-plugins';

@@ -5,3 +5,5 @@ import { RolldownOutput, OutputAsset, OutputChunk, RenderedChunk, SourceMap } from './types/rolldown-output';

import type { RolldownOptions } from './types/rolldown-options';
import type { AsyncPluginHooks, CustomPluginOptions, FunctionPluginHooks, ImportKind, LoadResult, ModuleOptions, ModuleType, ObjectHook, ParallelPluginHooks, PartialResolvedId, Plugin, RolldownPlugin, RolldownPluginOption, ResolveIdResult, ResolvedId, SourceDescription, TransformResult } from './plugin';
import type { AsyncPluginHooks, CustomPluginOptions, FunctionPluginHooks, ImportKind, LoadResult, ModuleOptions, ModuleType, ObjectHook, ParallelPluginHooks, PartialResolvedId, Plugin, RolldownPlugin, RolldownPluginOption, ResolveIdResult, ResolvedId, SourceDescription, TransformResult, HookFilterExtension } from './plugin';
import type { HookFilter, StringFilter, ModuleTypeFilter } from './plugin/hook-filter';
import type { LogOrStringHandler } from './log/logging';
import { DefineParallelPluginResult } from './plugin/parallel-plugin';

@@ -13,3 +15,3 @@ import { defineConfig } from './utils/define-config';

import { RolldownBuild } from './api/rolldown/rolldown-build';
import { EmittedAsset, EmittedFile, PluginContext } from './plugin/plugin-context';
import { EmittedAsset, EmittedFile, GetModuleInfo, PluginContext } from './plugin/plugin-context';
import { TransformPluginContext } from './plugin/transform-plugin-context';

@@ -21,3 +23,3 @@ import { InternalModuleFormat, NormalizedOutputOptions } from './options/normalized-output-options';

import { ModuleInfo } from './types/module-info';
import { MinimalPluginContext } from './plugin/minimal-plugin-context';
import { PluginContextMeta, MinimalPluginContext } from './plugin/minimal-plugin-context';
import { ExistingRawSourceMap, SourceMapInput } from './types/sourcemap';

@@ -30,3 +32,3 @@ import { OutputBundle } from './types/output-bundle';

export declare const VERSION: string;
export type { OutputAsset, OutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, RolldownPlugin, RolldownPluginOption, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, ModuleType, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, PluginContext, TransformPluginContext, ObjectHook, PreRenderedChunk, PreRenderedAsset, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, JsxOptions, WatchOptions, RolldownWatcher, BuildOptions, RenderedChunk, };
export type { RollupError, RollupLog, LoggingFunction } from './types/misc';
export type { OutputAsset, OutputChunk, RolldownOptions, RolldownOutput, RolldownBuild, InputOptions, NormalizedInputOptions, OutputOptions, NormalizedOutputOptions, Plugin, RolldownPlugin, RolldownPluginOption, DefineParallelPluginResult, ConfigExport, ImportKind, InputOption, ExternalOption, ModuleFormat, ModuleType, InternalModuleFormat, LoadResult, TransformResult, ResolveIdResult, HookFilterExtension, HookFilter, StringFilter, ModuleTypeFilter, PluginContext, TransformPluginContext, ObjectHook, PreRenderedChunk, PreRenderedAsset, SourceMap, SourceDescription, PartialNull, PartialResolvedId, ResolvedId, ModuleOptions, ModuleInfo, PluginContextMeta, MinimalPluginContext, EmittedFile, EmittedAsset, CustomPluginOptions, AsyncPluginHooks, ParallelPluginHooks, FunctionPluginHooks, ExistingRawSourceMap, SourceMapInput, OutputBundle, JsxOptions, WatchOptions, RolldownWatcher, BuildOptions, RenderedChunk, LogOrStringHandler, GetModuleInfo, };
export type { RollupError, RollupLog, LoggingFunction, LogLevel, WarningHandlerWithDefault, } from './types/misc';

@@ -6,2 +6,3 @@ export type LogLevel = 'info' | 'debug' | 'warn';

export type RollupLogWithString = RollupLog | string;
export type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
export declare const LOG_LEVEL_SILENT: LogLevelOption;

@@ -8,0 +9,0 @@ export declare const LOG_LEVEL_ERROR = "error";

import type { RolldownPluginOption } from '../plugin';
import type { LogLevel, LogLevelOption, LogLevelWithError, RollupLog, RollupLogWithString } from '../log/logging';
import type { LogLevel, LogLevelOption, LogOrStringHandler, RollupLog, RollupLogWithString } from '../log/logging';
import type { NullValue, StringOrRegExp } from '../types/utils';
import type { TreeshakingOptions } from '../types/module-side-effects';
import { TransformOptions } from '../binding';
export type InputOption = string | string[] | Record<string, string>;
type OxcTransformOption = Omit<TransformOptions, 'sourceType' | 'lang' | 'cwd' | 'sourcemap' | 'jsx' | 'define' | 'inject' | 'target'>;
export type ExternalOption = StringOrRegExp | StringOrRegExp[] | ((id: string, parentId: string | undefined, isResolved: boolean) => NullValue<boolean>);

@@ -19,2 +21,3 @@ export type ModuleTypes = Record<string, 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | 'css'>;

skipWrite?: boolean;
buildDelay?: number;
notify?: {

@@ -26,3 +29,2 @@ pollInterval?: number;

exclude?: StringOrRegExp | StringOrRegExp[];
chokidar?: any;
}

@@ -41,2 +43,8 @@ export interface ChecksOptions {

resolve?: {
/**
* > [!WARNING]
* > `resolve.alias` will not call `resolveId` hooks of other plugin.
* > If you want to call `resolveId` hooks of other plugin, use `aliasPlugin` from `rolldown/experimental` instead.
* > You could find more discussion in [this issue](https://github.com/rolldown/rolldown/issues/3615)
*/
alias?: Record<string, string[] | string>;

@@ -72,3 +80,3 @@ aliasFields?: string[][];

logLevel?: LogLevelOption;
onLog?: (level: LogLevel, log: RollupLog, defaultHandler: (level: LogLevelWithError, log: RollupLogWithString) => void) => void;
onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;

@@ -82,3 +90,3 @@ moduleTypes?: ModuleTypes;

resolveNewUrlToAsset?: boolean;
developmentMode?: boolean;
hmr?: boolean;
};

@@ -158,9 +166,11 @@ /**

/**
* The `false` is disabled jsx parser, it will give you a syntax error if you use jsx syntax
* The `mode: preserve` is disabled jsx transformer, it perverse original jsx syntax in the output.
* The `mode: classic` is enabled jsx `classic` transformer.
* The `mode: automatic` is enabled jsx `automatic` transformer.
* @default mode = 'automatic'
* - `false` disables the JSX parser, resulting in a syntax error if JSX syntax is used.
* - `"preserve"` disables the JSX transformer, preserving the original JSX syntax in the output.
* - `"react"` enables the `classic` JSX transformer.
* - `"react-jsx"` enables the `automatic` JSX transformer.
*
* @default mode = "automatic"
*/
jsx?: false | JsxOptions;
jsx?: false | 'react' | 'react-jsx' | 'preserve' | JsxOptions;
transform?: OxcTransformOption;
watch?: WatchOptions | false;

@@ -167,0 +177,0 @@ dropLabels?: string[];

@@ -1,4 +0,5 @@

import type { BindingNormalizedOptions } from '../binding';
import type { BindingMinifyOptions, BindingNormalizedOptions } from '../binding';
import type { SourcemapIgnoreListOption, SourcemapPathTransformOption } from '../types/misc';
import type { AssetFileNamesFunction, ChunkFileNamesFunction, GlobalsFunction, OutputOptions } from './output-options';
import type { AddonFunction, AssetFileNamesFunction, ChunkFileNamesFunction, GlobalsFunction, OutputOptions } from './output-options';
import { RolldownPlugin } from '..';
export type InternalModuleFormat = 'es' | 'cjs' | 'iife' | 'umd' | 'app';

@@ -19,6 +20,6 @@ export interface NormalizedOutputOptions {

externalLiveBindings: boolean;
banner: OutputOptions['banner'];
footer: OutputOptions['footer'];
intro: OutputOptions['intro'];
outro: OutputOptions['outro'];
banner: AddonFunction;
footer: AddonFunction;
intro: AddonFunction;
outro: AddonFunction;
esModule: boolean | 'if-default-prop';

@@ -29,21 +30,23 @@ extend: boolean;

sourcemapDebugIds: boolean;
sourcemapIgnoreList: SourcemapIgnoreListOption | undefined;
sourcemapIgnoreList: SourcemapIgnoreListOption;
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
minify: boolean;
minify: false | BindingMinifyOptions;
comments: 'none' | 'preserve-legal';
polyfillRequire: boolean;
plugins: RolldownPlugin[];
}
type UnsupportedFnRet = () => never;
export declare class NormalizedOutputOptionsImpl implements NormalizedOutputOptions {
inner: BindingNormalizedOptions;
constructor(inner: BindingNormalizedOptions);
private inner;
private outputOptions;
private normalizedOutputPlugins;
constructor(inner: BindingNormalizedOptions, outputOptions: OutputOptions, normalizedOutputPlugins: RolldownPlugin[]);
get dir(): string | undefined;
get entryFileNames(): string | UnsupportedFnRet;
get chunkFileNames(): string | UnsupportedFnRet;
get assetFileNames(): string | UnsupportedFnRet;
get entryFileNames(): string | ChunkFileNamesFunction;
get chunkFileNames(): string | ChunkFileNamesFunction;
get assetFileNames(): string | AssetFileNamesFunction;
get format(): 'es' | 'cjs' | 'app' | 'iife' | 'umd';
get exports(): 'default' | 'named' | 'none' | 'auto';
get sourcemap(): boolean | 'inline' | 'hidden';
get cssEntryFileNames(): string | UnsupportedFnRet;
get cssChunkFileNames(): string | UnsupportedFnRet;
get cssEntryFileNames(): string | ChunkFileNamesFunction;
get cssChunkFileNames(): string | ChunkFileNamesFunction;
get shimMissingExports(): boolean;

@@ -54,17 +57,17 @@ get name(): string | undefined;

get externalLiveBindings(): boolean;
get banner(): string | UnsupportedFnRet | undefined;
get footer(): string | UnsupportedFnRet | undefined;
get intro(): string | UnsupportedFnRet | undefined;
get outro(): string | UnsupportedFnRet | undefined;
get banner(): AddonFunction;
get footer(): AddonFunction;
get intro(): AddonFunction;
get outro(): AddonFunction;
get esModule(): boolean | 'if-default-prop';
get extend(): boolean;
get globals(): Record<string, string> | UnsupportedFnRet;
get globals(): Record<string, string> | GlobalsFunction;
get hashCharacters(): 'base64' | 'base36' | 'hex';
get sourcemapDebugIds(): boolean;
get sourcemapIgnoreList(): UnsupportedFnRet | undefined;
get sourcemapPathTransform(): UnsupportedFnRet | undefined;
get minify(): boolean;
get sourcemapIgnoreList(): SourcemapIgnoreListOption;
get sourcemapPathTransform(): SourcemapPathTransformOption | undefined;
get minify(): false | BindingMinifyOptions;
get comments(): 'none' | 'preserve-legal';
get polyfillRequire(): boolean;
get plugins(): RolldownPlugin[];
}
export {};

@@ -9,2 +9,7 @@ import type { StringOrRegExp } from '../types/utils';

export type ChunkFileNamesFunction = (chunkInfo: PreRenderedChunk) => string;
export interface MinifyOptions {
mangle: boolean;
compress: boolean;
removeWhitespace: boolean;
}
export interface PreRenderedAsset {

@@ -35,2 +40,3 @@ names: string[];

sourcemap?: boolean | 'inline' | 'hidden';
sourcemapDebugIds?: boolean;
sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption;

@@ -50,3 +56,3 @@ sourcemapPathTransform?: SourcemapPathTransformOption;

sanitizeFileName?: boolean | ((name: string) => string);
minify?: boolean;
minify?: boolean | 'dce-only' | MinifyOptions;
name?: string;

@@ -56,16 +62,98 @@ globals?: Record<string, string> | GlobalsFunction;

inlineDynamicImports?: boolean;
/**
* Allows you to do advanced chunking. Use it to reduce the number of common chunks or split out a chunk that hardly changes to obtain better caching.
*/
advancedChunks?: {
/**
* - Type: `number`
*
* Global fallback of [`{group}.minSize`](#advancedchunks-groups-minsize), if it's not specified in the group.
*/
minSize?: number;
/**
* - Type: `number`
*
* Global fallback of [`{group}.maxSize`](#advancedchunks-groups-maxsize), if it's not specified in the group.
*/
maxSize?: number;
/**
* - Type: `number`
*
* Global fallback of [`{group}.maxModuleSize`](#advancedchunks-groups-maxmodulesize), if it's not specified in the group.
*/
maxModuleSize?: number;
/**
* - Type: `number`
*
* Global fallback of [`{group}.minModuleSize`](#advancedchunks-groups-minmodulesize), if it's not specified in the group.
*/
minModuleSize?: number;
/**
* - Type: `number`
*
* Global fallback of [`{group}.minShareCount`](#advancedchunks-groups-minsharecount), if it's not specified in the group.
*/
minShareCount?: number;
/**
* Groups to be used for advanced chunking.
*/
groups?: {
/**
* - Type: `string`
*
* Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option.
*/
name: string;
/**
* - Type: `string | RegExp`
*
* Controls which modules are captured in this group.
*
* If `test` is a string, the module whose id contains the string will be captured.
* If `test` is a regular expression, the module whose id matches the regular expression will be captured.
* if `test` is empty, any module will be considered as matched.
*/
test?: StringOrRegExp;
/**
* - Type: `number`
*
* Priority of the group. Group with higher priority will be chosen first to match modules and create chunks. When converting the group to a chunk, modules of that group will be removed from other groups.
*
* If two groups have the same priority, the group whose index is smaller will be chosen.
*/
priority?: number;
/**
* - Type: `number`
* - Default: `0`
*
* Minimum size of the desired chunk. If accumulated size of captured modules is smaller than this value, this group will be ignored.s
*/
minSize?: number;
/**
* - Type: `number`
* - Default: `1`
*
* Controls if a module should be captured based on how many entry chunks reference it.
*/
minShareCount?: number;
/**
* - Type: `number`
* - Default: `Infinity`
*
* If final size of this group is larger than this value, this group will be spit into multiple groups that each has size closed to this value.
*/
maxSize?: number;
/**
* - Type: `number`
* - Default: `Infinity`
*
* Controls a module could only be captured if its size is smaller or equal than this value.
*/
maxModuleSize?: number;
/**
* - Type: `number`
* - Default: `0`
*
* Controls a module could only be captured if its size is larger or equal than this value.
*/
minModuleSize?: number;

@@ -72,0 +160,0 @@ }[];

@@ -0,4 +1,5 @@

import { Program } from '@oxc-project/types';
import type { ParseResult, ParserOptions } from './binding';
export declare function parseAst(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult;
export declare function parseAstAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>;
export declare function parseAst(sourceText: string, options?: ParserOptions | undefined | null, filename?: string): Program;
export declare function parseAstAsync(sourceText: string, options?: ParserOptions | undefined | null, filename?: string): Promise<Program>;
export type { ParseResult, ParserOptions };
import type { BindingPluginOptions } from '../binding';
import type { Plugin } from './index';
import type { Plugin, RolldownPlugin } from './index';
import type { OutputOptions } from '../options/output-options';

@@ -14,3 +14,4 @@ import { PluginContextData } from './plugin-context-data';

logLevel: LogLevelOption;
normalizedOutputPlugins: RolldownPlugin[];
}
export declare function bindingifyPlugin(plugin: Plugin, options: InputOptions, outputOptions: OutputOptions, pluginContextData: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption): BindingPluginOptions;
export declare function bindingifyPlugin(plugin: Plugin, options: InputOptions, outputOptions: OutputOptions, pluginContextData: PluginContextData, normalizedOutputPlugins: RolldownPlugin[], onLog: LogHandler, logLevel: LogLevelOption): BindingPluginOptions;

@@ -11,3 +11,3 @@ import type { MaybeArray } from '../types/utils';

}
type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
export type ModuleTypeFilter = ModuleType[] | FormalModuleTypeFilter;
export interface HookFilter {

@@ -14,0 +14,0 @@ /**

@@ -30,2 +30,3 @@ import type { BindingHookResolveIdExtraArgs, BindingTransformHookExtraArgs } from '../binding';

meta: CustomPluginOptions;
invalidate?: boolean;
}

@@ -32,0 +33,0 @@ export interface ResolvedId extends ModuleOptions {

@@ -7,4 +7,5 @@ import type { LoggingFunction, LogHandler, LogLevelOption, RollupError } from '../types/misc';

}
export declare class MinimalPluginContext {
export interface MinimalPluginContext {
readonly pluginName: string;
error: (e: RollupError | string) => never;
info: LoggingFunction;

@@ -14,4 +15,11 @@ warn: LoggingFunction;

meta: PluginContextMeta;
}
export declare class MinimalPluginContextImpl {
readonly pluginName: string;
info: LoggingFunction;
warn: LoggingFunction;
debug: LoggingFunction;
meta: PluginContextMeta;
constructor(onLog: LogHandler, logLevel: LogLevelOption, pluginName: string);
error(e: RollupError | string): never;
}

@@ -9,5 +9,6 @@ import { BindingPluginContext } from '../binding';

loadModulePromiseMap: Map<string, Promise<void>>;
updateModuleOption(id: string, option: ModuleOptions): void;
updateModuleOption(id: string, option: ModuleOptions): ModuleOptions;
getModuleOption(id: string): ModuleOptions;
getModuleInfo(id: string, context: BindingPluginContext): ModuleInfo | null;
proxyModuleInfo(id: string, info: ModuleInfo): ModuleInfo;
getModuleIds(context: BindingPluginContext): ArrayIterator<string>;

@@ -14,0 +15,0 @@ saveResolveOptions(options: PluginContextResolveOptions): number;

@@ -1,4 +0,4 @@

import type { BindingPluginContext } from '../binding';
import type { BindingPluginContext, ParserOptions } from '../binding';
import type { CustomPluginOptions, ModuleOptions, Plugin, ResolvedId } from './index';
import { MinimalPluginContext } from '../plugin/minimal-plugin-context';
import { MinimalPluginContext, MinimalPluginContextImpl } from '../plugin/minimal-plugin-context';
import { AssetSource } from '../utils/asset-source';

@@ -11,2 +11,3 @@ import { ModuleInfo } from '../types/module-info';

import { OutputOptions } from '../options/output-options';
import { Program } from '@oxc-project/types';
export interface EmittedAsset {

@@ -26,3 +27,3 @@ type: 'asset';

}
export type EmittedFile = EmittedAsset;
export type EmittedFile = EmittedAsset | EmittedChunk;
export interface PluginContextResolveOptions {

@@ -35,3 +36,17 @@ skipSelf?: boolean;

}
export declare class PluginContext extends MinimalPluginContext {
export type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
export interface PluginContext extends MinimalPluginContext {
emitFile(file: EmittedFile): string;
getFileName(referenceId: string): string;
getModuleIds(): IterableIterator<string>;
getModuleInfo: GetModuleInfo;
addWatchFile(id: string): void;
load(options: {
id: string;
resolveDependencies?: boolean;
} & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
parse(input: string, options?: ParserOptions | undefined | null): Program;
resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
}
export declare class PluginContextImpl extends MinimalPluginContextImpl {
private outputOptions;

@@ -42,2 +57,3 @@ private context;

private currentLoadingModule?;
getModuleInfo: GetModuleInfo;
constructor(outputOptions: OutputOptions, context: BindingPluginContext, plugin: Plugin, data: PluginContextData, onLog: LogHandler, logLevel: LogLevelOption, currentLoadingModule?: string | undefined);

@@ -49,12 +65,8 @@ load(options: {

resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
emitFile(file: EmittedAsset | EmittedChunk): string;
emitFile: PluginContext['emitFile'];
private getAssetFileNames;
getFileName(referenceId: string): string;
getModuleInfo(id: string): ModuleInfo | null;
getModuleIds(): IterableIterator<string>;
addWatchFile(id: string): void;
/**
* @deprecated This rollup API won't be supported by rolldown. Using this API will cause runtime error.
*/
parse(_input: string, _options?: any): any;
parse(input: string, options?: ParserOptions | undefined | null): Program;
}
import type { BindingPluginContext, BindingTransformPluginContext } from '../binding';
import type { LogHandler, LogLevelOption, RollupError } from '../types/misc';
import { PluginContext } from './plugin-context';
import type { LoggingFunctionWithPosition, LogHandler, LogLevelOption, RollupError } from '../types/misc';
import { PluginContextImpl, type PluginContext } from './plugin-context';
import { PluginContextData } from './plugin-context-data';

@@ -8,3 +8,13 @@ import type { Plugin } from './index';

import { OutputOptions } from '../options/output-options';
export declare class TransformPluginContext extends PluginContext {
export interface TransformPluginContext extends PluginContext {
debug: LoggingFunctionWithPosition;
info: LoggingFunctionWithPosition;
warn: LoggingFunctionWithPosition;
error(e: RollupError | string, pos?: number | {
column: number;
line: number;
}): never;
getCombinedSourcemap(): SourceMap;
}
export declare class TransformPluginContextImpl extends PluginContextImpl {
private inner;

@@ -11,0 +21,0 @@ private moduleId;

@@ -12,3 +12,4 @@ import type { IsEqual } from 'type-fest';

export type IsPropertiesEqual<A, B> = IsValuesOfObjectAllTrue<ShowPropertiesEqualStatus<A, B>>;
export type Extends<A, B> = A extends B ? true : false;
export type AssertNever<T extends never> = T;
export {};

@@ -10,2 +10,4 @@ export interface ModuleSideEffectsRule {

annotations?: boolean;
manualPureFunctions?: string[];
unknownGlobalSideEffects?: boolean;
} | boolean;

@@ -21,2 +21,4 @@ import { AssetSource } from '../utils/asset-source';

version: number;
debugId?: string;
x_google_ignoreList?: number[];
toString(): string;

@@ -28,2 +30,3 @@ toUrl(): string;

renderedLength: number;
renderedExports: string[];
}

@@ -30,0 +33,0 @@ export interface RenderedChunk extends Omit<BindingRenderedChunk, 'modules'> {

import { BindingSourcemap } from '../binding';
import type { SourceMap } from './rolldown-output';
export interface ExistingRawSourceMap {

@@ -13,2 +14,2 @@ file?: string | null;

export type SourceMapInput = ExistingRawSourceMap | string | null;
export declare function bindingifySourcemap(map?: SourceMapInput): undefined | BindingSourcemap;
export declare function bindingifySourcemap(map?: SourceMapInput | SourceMap): undefined | BindingSourcemap;

@@ -7,2 +7,2 @@ import type { RolldownPlugin } from '../plugin';

import { LogLevelOption } from '../log/logging';
export declare function bindingifyInputOptions(rawPlugins: RolldownPlugin[], inputOptions: InputOptions, outputOptions: OutputOptions, onLog: LogHandler, logLevel: LogLevelOption): BindingInputOptions;
export declare function bindingifyInputOptions(rawPlugins: RolldownPlugin[], inputOptions: InputOptions, outputOptions: OutputOptions, normalizedOutputPlugins: RolldownPlugin[], onLog: LogHandler, logLevel: LogLevelOption): BindingInputOptions;
import type { BindingOutputOptions } from '../binding';
import type { OutputOptions } from '../options/output-options';
import { SourcemapIgnoreListOption } from '../types/misc';
export declare function bindingifyOutputOptions(outputOptions: OutputOptions): BindingOutputOptions;
export declare function bindingifySourcemapIgnoreList(sourcemapIgnoreList: OutputOptions['sourcemapIgnoreList']): SourcemapIgnoreListOption;

@@ -5,3 +5,3 @@ import { BindingBundlerOptions } from '../binding';

import type { OutputOptions } from '../options/output-options';
export declare function createBundlerOptions(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<BundlerOptionWithStopWorker>;
export declare function createBundlerOptions(inputOptions: InputOptions, outputOptions: OutputOptions, isClose?: boolean): Promise<BundlerOptionWithStopWorker>;
export interface BundlerOptionWithStopWorker {

@@ -8,0 +8,0 @@ bundlerOptions: BindingBundlerOptions;

import { Bundler } from '../binding';
import type { InputOptions } from '../options/input-options';
import type { OutputOptions } from '../options/output-options';
export declare function createBundler(inputOptions: InputOptions, outputOptions: OutputOptions): Promise<BundlerWithStopWorker>;
export declare function createBundler(inputOptions: InputOptions, outputOptions: OutputOptions, isClose?: boolean): Promise<BundlerWithStopWorker>;
export interface BundlerWithStopWorker {

@@ -6,0 +6,0 @@ bundler: Bundler;

import type { ObjectSchema } from '../types/schema';
import type { TreeshakingOptions } from '../types/module-side-effects';
export declare function validateTreeShakingOptions(options: TreeshakingOptions): void;
export declare function validateCliOptions<T>(options: T): [T, string[]?];
export declare function validateOption<T>(key: 'input' | 'output', options: T): void;
export declare function getInputCliKeys(): string[];
export declare function getOutputCliKeys(): string[];
export declare function getJsonSchema(): ObjectSchema;
{
"name": "rolldown",
"version": "1.0.0-beta.3-commit.e048f55",
"version": "1.0.0-beta.3-commit.e170e6e",
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",

@@ -29,3 +29,2 @@ "homepage": "https://rolldown.rs/",

},
"type": "module",
"main": "./dist/cjs/index.cjs",

@@ -89,11 +88,11 @@ "types": "./dist/types/index.d.ts",

"dependencies": {
"@oxc-project/types": "0.46.0",
"@valibot/to-json-schema": "1.0.0-beta.4",
"valibot": "1.0.0-beta.12"
"@oxc-project/types": "0.56.0",
"@valibot/to-json-schema": "1.0.0-rc.0",
"valibot": "1.0.0-rc.3"
},
"peerDependencies": {
"@babel/runtime": ">=7"
"@oxc-project/runtime": "0.56.0"
},
"peerDependenciesMeta": {
"@babel/runtime": {
"@oxc-project/runtime": {
"optional": true

@@ -104,5 +103,5 @@ }

"@jridgewell/sourcemap-codec": "^1.5.0",
"@napi-rs/cli": "^3.0.0-alpha.70",
"@napi-rs/cli": "^3.0.0-alpha.72",
"@napi-rs/wasm-runtime": "^0.2.4",
"@oxc-node/core": "^0.0.17",
"@oxc-node/core": "^0.0.19",
"@types/fs-extra": "^11.0.4",

@@ -128,18 +127,18 @@ "@types/lodash-es": "^4.17.12",

"why-is-node-running": "^3.0.0",
"rolldown": "1.0.0-beta.3-commit.e048f55",
"rolldown": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/testing": "0.0.1"
},
"optionalDependencies": {
"@rolldown/binding-darwin-arm64": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-darwin-x64": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-freebsd-x64": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.3-commit.e048f55",
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.3-commit.e048f55"
"@rolldown/binding-darwin-arm64": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-freebsd-x64": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-darwin-x64": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-linux-arm64-musl": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-linux-x64-musl": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-wasm32-wasi": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.3-commit.e170e6e",
"@rolldown/binding-win32-x64-msvc": "1.0.0-beta.3-commit.e170e6e"
},

@@ -149,3 +148,3 @@ "scripts": {

"artifacts": "napi artifacts --cwd ./src --package-json-path ../package.json -o=../artifacts --npm-dir ../npm",
"build-binding": "napi build -o=./src --manifest-path ../../crates/rolldown_binding/Cargo.toml --platform -p rolldown_binding --js binding.cjs --dts binding.d.ts --no-const-enum",
"build-binding": "node ./build-binding.js",
"build-binding:release": "pnpm build-binding --release",

@@ -156,8 +155,10 @@ "build-binding:wasi": "pnpm build-binding --target wasm32-wasip1-threads",

"bak_build-node": "unbuild",
"build-node": "node --import @oxc-node/core/register ./build.ts",
"build-node": "tsx ./build.ts",
"build-types": "tsc -p ./tsconfig.json",
"build-native:debug": "run-s build-binding build-types build-node",
"build-native:release": "run-s build-binding:release build-types build-node",
"build-js-glue": "run-s build-types build-node build-types-check",
"build-native:debug": "run-s build-binding build-js-glue",
"build-native:release": "run-s build-binding:release build-js-glue",
"build-wasi:debug": "run-s build-binding build-binding:wasi build-node",
"build-wasi:release": "run-s build-binding build-binding:wasi:release build-node",
"build-types-check": "tsc -p ./tsconfig.check.json",
"# Scrips for docs #": "_",

@@ -164,0 +165,0 @@ "extract-options-doc": "typedoc"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet