[32788f42] feat: implement database persistence, modernized UI with Tailwind, and Calendly-integrated QR card generator for Fotograf.de scraper

This commit is contained in:
2026-03-21 09:04:03 +00:00
parent 22fe4dbd9f
commit c02facdf5d
6975 changed files with 1835694 additions and 179 deletions

View File

@@ -0,0 +1 @@
export { };

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
import { F as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-CV9D_Qea.mjs";
//#region src/utils/load-config.d.ts
/**
* Load config from a file in a way that Rolldown does.
*
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
* @returns The loaded config export
*
* @category Config
*/
declare function loadConfig(configPath: string): Promise<ConfigExport>;
//#endregion
export { VERSION, defineConfig, loadConfig };

View File

@@ -0,0 +1,10 @@
import "./shared/binding-BV_UWDF3.mjs";
import "./shared/normalize-string-or-regex-D7wlw16t.mjs";
import { x as VERSION } from "./shared/bindingify-input-options-DoaqRULI.mjs";
import "./shared/rolldown-build-yQC7KN8K.mjs";
import "./shared/error-BO4SlZV_.mjs";
import "./shared/parse-nWsWXhOL.mjs";
import "./shared/rolldown-BOb3gBhW.mjs";
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
import { t as loadConfig } from "./shared/load-config-ezHg7sBf.mjs";
export { VERSION, defineConfig, loadConfig };

View File

@@ -0,0 +1,253 @@
import { B as ResolveResult, C as BindingViteManifestPluginConfig, G as isolatedDeclaration, I as NapiResolveOptions, K as isolatedDeclarationSync, M as IsolatedDeclarationsResult, O as BindingViteTransformPluginConfig, V as ResolverFactory, _ as BindingTsconfigRawOptions, f as BindingRebuildStrategy, g as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, j as IsolatedDeclarationsOptions, n as BindingBundleAnalyzerPluginConfig, q as moduleRunnerTransform, r as BindingBundleState } from "./shared/binding-Dsq9Azhm.mjs";
import { Jt as freeExternalMemory, Kt as RolldownOutput, Lt as OutputOptions, N as BuiltinPlugin, X as defineParallelPlugin, c as InputOptions, st as NormalizedOutputOptions } from "./shared/define-config-CV9D_Qea.mjs";
import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-B5D1aA1B.mjs";
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-DfpIbfMG.mjs";
//#region src/api/dev/dev-options.d.ts
type DevOnHmrUpdates = (result: Error | {
updates: BindingClientHmrUpdate[];
changedFiles: string[];
}) => void | Promise<void>;
type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
interface DevWatchOptions {
/**
* If `true`, files are not written to disk.
* @default false
*/
skipWrite?: boolean;
/**
* If `true`, use polling instead of native file system events for watching.
* @default false
*/
usePolling?: boolean;
/**
* Poll interval in milliseconds (only used when usePolling is true).
* @default 100
*/
pollInterval?: number;
/**
* If `true`, use debounced watcher. If `false`, use non-debounced watcher for immediate responses.
* @default true
*/
useDebounce?: boolean;
/**
* Debounce duration in milliseconds (only used when useDebounce is true).
* @default 10
*/
debounceDuration?: number;
/**
* Whether to compare file contents for poll-based watchers (only used when usePolling is true).
* When enabled, poll watchers will check file contents to determine if they actually changed.
* @default false
*/
compareContentsForPolling?: boolean;
/**
* Tick rate in milliseconds for debounced watchers (only used when useDebounce is true).
* Controls how frequently the debouncer checks for events to process.
* When not specified, the debouncer will auto-select an appropriate tick rate (1/4 of the debounce duration).
* @default undefined (auto-select)
*/
debounceTickRate?: number;
}
interface DevOptions {
onHmrUpdates?: DevOnHmrUpdates;
onOutput?: DevOnOutput;
/**
* Strategy for triggering rebuilds after HMR updates.
* - `'always'`: Always trigger a rebuild after HMR updates
* - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
* - `'never'`: Never trigger rebuild after HMR updates (default)
* @default 'auto'
*/
rebuildStrategy?: "always" | "auto" | "never";
watch?: DevWatchOptions;
}
//#endregion
//#region src/api/dev/dev-engine.d.ts
declare class DevEngine {
#private;
static create(inputOptions: InputOptions, outputOptions?: OutputOptions, devOptions?: DevOptions): Promise<DevEngine>;
private constructor();
run(): Promise<void>;
ensureCurrentBuildFinish(): Promise<void>;
getBundleState(): Promise<BindingBundleState>;
ensureLatestBuildOutput(): Promise<void>;
invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
registerModules(clientId: string, modules: string[]): Promise<void>;
removeClient(clientId: string): Promise<void>;
close(): Promise<void>;
/**
* Compile a lazy entry module and return HMR-style patch code.
*
* This is called when a dynamically imported module is first requested at runtime.
* The module was previously stubbed with a proxy, and now we need to compile the
* actual module and its dependencies.
*
* @param moduleId - The absolute file path of the module to compile
* @param clientId - The client ID requesting this compilation
* @returns The compiled JavaScript code as a string (HMR patch format)
*/
compileEntry(moduleId: string, clientId: string): Promise<string>;
}
//#endregion
//#region src/api/dev/index.d.ts
declare const dev: typeof DevEngine.create;
//#endregion
//#region src/api/experimental.d.ts
/**
* This is an experimental API. Its behavior may change in the future.
*
* - Calling this API will only execute the `scan/build` stage of rolldown.
* - `scan` will clean up all resources automatically, but if you want to ensure timely cleanup, you need to wait for the returned promise to resolve.
*
* @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
* ```ts
* import { scan } from 'rolldown/api/experimental';
*
* const cleanupPromise = await scan(...);
* await cleanupPromise;
* // Now all resources have been cleaned up.
* ```
*/
declare const scan: (rawInputOptions: InputOptions, rawOutputOptions?: {}) => Promise<Promise<void>>;
//#endregion
//#region src/builtin-plugin/alias-plugin.d.ts
type ViteAliasPluginConfig = {
entries: {
find: string | RegExp;
replacement: string;
}[];
};
declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
//#endregion
//#region src/builtin-plugin/bundle-analyzer-plugin.d.ts
/**
* A plugin that analyzes bundle composition and generates detailed reports.
*
* The plugin outputs a file containing detailed information about:
* - All chunks and their relationships
* - Modules bundled in each chunk
* - Import dependencies between chunks
* - Reachable modules from each entry point
*
* @example
* ```js
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
*
* export default {
* plugins: [
* bundleAnalyzerPlugin()
* ]
* }
* ```
*
* @example
* **Custom filename**
* ```js
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
*
* export default {
* plugins: [
* bundleAnalyzerPlugin({
* fileName: 'bundle-analysis.json'
* })
* ]
* }
* ```
*
* @example
* **LLM-friendly markdown output**
* ```js
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
*
* export default {
* plugins: [
* bundleAnalyzerPlugin({
* format: 'md'
* })
* ]
* }
* ```
*/
declare function bundleAnalyzerPlugin(config?: BindingBundleAnalyzerPluginConfig): BuiltinPlugin;
//#endregion
//#region src/builtin-plugin/transform-plugin.d.ts
type TransformPattern = string | RegExp | readonly (RegExp | string)[];
type TransformPluginConfig = Omit<BindingViteTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude" | "yarnPnp"> & {
include?: TransformPattern;
exclude?: TransformPattern;
jsxRefreshInclude?: TransformPattern;
jsxRefreshExclude?: TransformPattern;
};
declare function viteTransformPlugin(config: TransformPluginConfig): BuiltinPlugin;
//#endregion
//#region src/builtin-plugin/vite-manifest-plugin.d.ts
type ViteManifestPluginConfig = Omit<BindingViteManifestPluginConfig, "isLegacy"> & {
isOutputOptionsForLegacyChunks?: (outputOptions: NormalizedOutputOptions) => boolean;
};
declare function viteManifestPlugin(config: ViteManifestPluginConfig): BuiltinPlugin;
//#endregion
//#region src/experimental-index.d.ts
/**
* In-memory file system for browser builds.
*
* This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
* It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
*
* - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
* - `volume`: The underlying `Volume` instance that stores the filesystem state
*
* Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
*
* @example
* ```typescript
* import { memfs } from 'rolldown/experimental';
*
* // Write files to virtual filesystem before bundling
* memfs?.volume.fromJSON({
* '/src/index.js': 'export const foo = 42;',
* '/package.json': '{"name": "my-app"}'
* });
*
* // Read files from the virtual filesystem
* const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
* ```
*
* @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
*/
declare const memfs: {
fs: any;
volume: any;
} | undefined;
/** @deprecated Use from `rolldown/utils` instead. */
declare const parse: typeof parse$1;
/** @deprecated Use from `rolldown/utils` instead. */
declare const parseSync: typeof parseSync$1;
/** @deprecated Use from `rolldown/utils` instead. */
type ParseResult = ParseResult$1;
/** @deprecated Use from `rolldown/utils` instead. */
type ParserOptions = ParserOptions$1;
/** @deprecated Use from `rolldown/utils` instead. */
declare const minify: typeof minify$1;
/** @deprecated Use from `rolldown/utils` instead. */
declare const minifySync: typeof minifySync$1;
/** @deprecated Use from `rolldown/utils` instead. */
type MinifyOptions = MinifyOptions$1;
/** @deprecated Use from `rolldown/utils` instead. */
type MinifyResult = MinifyResult$1;
/** @deprecated Use from `rolldown/utils` instead. */
declare const transform: typeof transform$1;
/** @deprecated Use from `rolldown/utils` instead. */
declare const transformSync: typeof transformSync$1;
/** @deprecated Use from `rolldown/utils` instead. */
type TransformOptions = TransformOptions$1;
/** @deprecated Use from `rolldown/utils` instead. */
type TransformResult = TransformResult$1;
/** @deprecated Use from `rolldown/utils` instead. */
declare const TsconfigCache: typeof TsconfigCache$1;
/** @deprecated Use from `rolldown/utils` instead. */
type TsconfigRawOptions = BindingTsconfigRawOptions;
/** @deprecated Use from `rolldown/utils` instead. */
type TsconfigCompilerOptions = BindingTsconfigCompilerOptions;
//#endregion
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, TransformOptions, TransformResult, TsconfigCache, TsconfigCompilerOptions, TsconfigRawOptions, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };

View File

@@ -0,0 +1,320 @@
import { n as __toESM, t as require_binding } from "./shared/binding-BV_UWDF3.mjs";
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-D7wlw16t.mjs";
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-DoaqRULI.mjs";
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-yQC7KN8K.mjs";
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BO4SlZV_.mjs";
import { n as parseSync$1, t as parse$1 } from "./shared/parse-nWsWXhOL.mjs";
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-DqC7XSXy.mjs";
import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-C3OzszY-.mjs";
import { pathToFileURL } from "node:url";
//#region src/api/dev/dev-engine.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
var DevEngine = class DevEngine {
#inner;
#cachedBuildFinishPromise = null;
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
const options = await createBundlerOptions(inputOptions, outputOptions, false);
const userOnHmrUpdates = devOptions.onHmrUpdates;
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
const result = normalizeBindingResult(rawResult);
if (result instanceof Error) {
userOnHmrUpdates(result);
return;
}
const [updates, changedFiles] = result;
userOnHmrUpdates({
updates,
changedFiles
});
} : void 0;
const userOnOutput = devOptions.onOutput;
const bindingDevOptions = {
onHmrUpdates: bindingOnHmrUpdates,
onOutput: userOnOutput ? function(rawResult) {
const result = normalizeBindingResult(rawResult);
if (result instanceof Error) {
userOnOutput(result);
return;
}
userOnOutput(transformToRollupOutput(result));
} : void 0,
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding.BindingRebuildStrategy.Auto : import_binding.BindingRebuildStrategy.Never : void 0,
watch: devOptions.watch && {
skipWrite: devOptions.watch.skipWrite,
usePolling: devOptions.watch.usePolling,
pollInterval: devOptions.watch.pollInterval,
useDebounce: devOptions.watch.useDebounce,
debounceDuration: devOptions.watch.debounceDuration,
compareContentsForPolling: devOptions.watch.compareContentsForPolling,
debounceTickRate: devOptions.watch.debounceTickRate
}
};
return new DevEngine(new import_binding.BindingDevEngine(options.bundlerOptions, bindingDevOptions));
}
constructor(inner) {
this.#inner = inner;
}
async run() {
await this.#inner.run();
}
async ensureCurrentBuildFinish() {
if (this.#cachedBuildFinishPromise) return this.#cachedBuildFinishPromise;
const promise = this.#inner.ensureCurrentBuildFinish().then(() => {
this.#cachedBuildFinishPromise = null;
});
this.#cachedBuildFinishPromise = promise;
return promise;
}
async getBundleState() {
return this.#inner.getBundleState();
}
async ensureLatestBuildOutput() {
await this.#inner.ensureLatestBuildOutput();
}
async invalidate(file, firstInvalidatedBy) {
return this.#inner.invalidate(file, firstInvalidatedBy);
}
async registerModules(clientId, modules) {
await this.#inner.registerModules(clientId, modules);
}
async removeClient(clientId) {
await this.#inner.removeClient(clientId);
}
async close() {
await this.#inner.close();
}
/**
* Compile a lazy entry module and return HMR-style patch code.
*
* This is called when a dynamically imported module is first requested at runtime.
* The module was previously stubbed with a proxy, and now we need to compile the
* actual module and its dependencies.
*
* @param moduleId - The absolute file path of the module to compile
* @param clientId - The client ID requesting this compilation
* @returns The compiled JavaScript code as a string (HMR patch format)
*/
async compileEntry(moduleId, clientId) {
return this.#inner.compileEntry(moduleId, clientId);
}
};
//#endregion
//#region src/api/dev/index.ts
const dev = (...args) => DevEngine.create(...args);
//#endregion
//#region src/types/external-memory-handle.ts
const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
/**
* Frees the external memory held by the given handle.
*
* This is useful when you want to manually release memory held by Rust objects
* (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
*
* @param handle - The object with external memory to free
* @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
* This will take time to copy data from Rust to JavaScript, but prevents errors
* when accessing properties after the memory is freed.
* @returns Status object with `freed` boolean and optional `reason` string.
* - `{ freed: true }` if memory was successfully freed
* - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
*
* @example
* ```typescript
* import { freeExternalMemory } from 'rolldown/experimental';
*
* const output = await bundle.generate();
* const chunk = output.output[0];
*
* // Use the chunk...
*
* // Manually free the memory (fast, but accessing properties after will throw)
* const status = freeExternalMemory(chunk); // { freed: true }
* const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
*
* // Keep data alive before freeing (slower, but data remains accessible)
* freeExternalMemory(chunk, true); // Evaluates all lazy fields first
* console.log(chunk.code); // OK - data was copied to JavaScript before freeing
*
* // Without keepDataAlive, accessing chunk properties after freeing will throw an error
* ```
*/
function freeExternalMemory(handle, keepDataAlive = false) {
return handle[symbolForExternalMemoryHandle](keepDataAlive);
}
//#endregion
//#region src/api/experimental.ts
/**
* This is an experimental API. Its behavior may change in the future.
*
* - Calling this API will only execute the `scan/build` stage of rolldown.
* - `scan` will clean up all resources automatically, but if you want to ensure timely cleanup, you need to wait for the returned promise to resolve.
*
* @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
* ```ts
* import { scan } from 'rolldown/api/experimental';
*
* const cleanupPromise = await scan(...);
* await cleanupPromise;
* // Now all resources have been cleaned up.
* ```
*/
const scan = async (rawInputOptions, rawOutputOptions = {}) => {
validateOption("input", rawInputOptions);
validateOption("output", rawOutputOptions);
const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false);
const bundler = new import_binding.BindingBundler();
if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
async function cleanup() {
await bundler.close();
await ret.stopWorkers?.();
(0, import_binding.shutdownAsyncRuntime)();
RolldownBuild.asyncRuntimeShutdown = true;
}
let cleanupPromise = Promise.resolve();
try {
unwrapBindingResult(await bundler.scan(ret.bundlerOptions));
} catch (err) {
await cleanup();
throw err;
} finally {
cleanupPromise = cleanup();
}
return cleanupPromise;
};
//#endregion
//#region src/plugin/parallel-plugin.ts
function defineParallelPlugin(pluginPath) {
return (options) => {
return { _parallel: {
fileUrl: pathToFileURL(pluginPath).href,
options
} };
};
}
//#endregion
//#region src/builtin-plugin/alias-plugin.ts
function viteAliasPlugin(config) {
return new BuiltinPlugin("builtin:vite-alias", config);
}
//#endregion
//#region src/builtin-plugin/bundle-analyzer-plugin.ts
/**
* A plugin that analyzes bundle composition and generates detailed reports.
*
* The plugin outputs a file containing detailed information about:
* - All chunks and their relationships
* - Modules bundled in each chunk
* - Import dependencies between chunks
* - Reachable modules from each entry point
*
* @example
* ```js
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
*
* export default {
* plugins: [
* bundleAnalyzerPlugin()
* ]
* }
* ```
*
* @example
* **Custom filename**
* ```js
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
*
* export default {
* plugins: [
* bundleAnalyzerPlugin({
* fileName: 'bundle-analysis.json'
* })
* ]
* }
* ```
*
* @example
* **LLM-friendly markdown output**
* ```js
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
*
* export default {
* plugins: [
* bundleAnalyzerPlugin({
* format: 'md'
* })
* ]
* }
* ```
*/
function bundleAnalyzerPlugin(config) {
return new BuiltinPlugin("builtin:bundle-analyzer", config);
}
//#endregion
//#region src/builtin-plugin/transform-plugin.ts
function viteTransformPlugin(config) {
return new BuiltinPlugin("builtin:vite-transform", {
...config,
include: normalizedStringOrRegex(config.include),
exclude: normalizedStringOrRegex(config.exclude),
jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude),
yarnPnp: typeof process === "object" && !!process.versions?.pnp
});
}
//#endregion
//#region src/builtin-plugin/vite-manifest-plugin.ts
function viteManifestPlugin(config) {
return new BuiltinPlugin("builtin:vite-manifest", config);
}
//#endregion
//#region src/experimental-index.ts
/**
* In-memory file system for browser builds.
*
* This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
* It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
*
* - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
* - `volume`: The underlying `Volume` instance that stores the filesystem state
*
* Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
*
* @example
* ```typescript
* import { memfs } from 'rolldown/experimental';
*
* // Write files to virtual filesystem before bundling
* memfs?.volume.fromJSON({
* '/src/index.js': 'export const foo = 42;',
* '/package.json': '{"name": "my-app"}'
* });
*
* // Read files from the virtual filesystem
* const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
* ```
*
* @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
*/
const memfs = void 0;
/** @deprecated Use from `rolldown/utils` instead. */
const parse = parse$1;
/** @deprecated Use from `rolldown/utils` instead. */
const parseSync = parseSync$1;
/** @deprecated Use from `rolldown/utils` instead. */
const minify = minify$1;
/** @deprecated Use from `rolldown/utils` instead. */
const minifySync = minifySync$1;
/** @deprecated Use from `rolldown/utils` instead. */
const transform = transform$1;
/** @deprecated Use from `rolldown/utils` instead. */
const transformSync = transformSync$1;
/** @deprecated Use from `rolldown/utils` instead. */
const TsconfigCache = TsconfigCache$1;
//#endregion
var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
var ResolverFactory = import_binding.ResolverFactory;
var isolatedDeclaration = import_binding.isolatedDeclaration;
var isolatedDeclarationSync = import_binding.isolatedDeclarationSync;
var moduleRunnerTransform = import_binding.moduleRunnerTransform;
export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };

View File

@@ -0,0 +1,98 @@
/**
* @typedef {{ type: 'hmr:module-registered', modules: string[] }} DevRuntimeMessage
* @typedef {{ send(message: DevRuntimeMessage): void }} Messenger
*/
export class DevRuntime {
/**
* @param {Messenger} messenger
* @param {string} clientId
*/
constructor(messenger: Messenger, clientId: string);
/**
* Client ID generated at runtime initialization, used for lazy compilation requests.
* @type {string}
*/
clientId: string;
messenger: Messenger;
/**
* @type {Record<string, Module>}
*/
modules: Record<string, Module>;
/**
* @param {string} _moduleId
*/
createModuleHotContext(_moduleId: string): void;
/**
* @param {[string, string][]} _boundaries
*/
applyUpdates(_boundaries: [string, string][]): void;
/**
* @param {string} id
* @param {{ exports: any }} exportsHolder
*/
registerModule(id: string, exportsHolder: {
exports: any;
}): void;
/**
* @param {string} id
*/
loadExports(id: string): any;
/**
* __esmMin
*
* @type {<T>(fn: any, res: T) => () => T}
* @internal
*/
createEsmInitializer: <T>(fn: any, res: T) => () => T;
/**
* __commonJSMin
*
* @type {<T extends { exports: any }>(cb: any, mod: { exports: any }) => () => T}
* @internal
*/
createCjsInitializer: <T extends {
exports: any;
}>(cb: any, mod: {
exports: any;
}) => () => T;
/** @internal */
__toESM: any;
/** @internal */
__toCommonJS: any;
/** @internal */
__exportAll: any;
/**
* @param {boolean} [isNodeMode]
* @returns {(mod: any) => any}
* @internal
*/
__toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
/** @internal */
__reExport: any;
sendModuleRegisteredMessage: (module: string) => void;
}
export type DevRuntimeMessage = {
type: "hmr:module-registered";
modules: string[];
};
export type Messenger = {
send(message: DevRuntimeMessage): void;
};
declare class Module {
/**
* @param {string} id
*/
constructor(id: string);
/**
* @type {{ exports: any }}
*/
exportsHolder: {
exports: any;
};
/**
* @type {string}
*/
id: string;
get exports(): any;
}
export {};

View File

@@ -0,0 +1,196 @@
import { M as withFilter } from "./shared/define-config-CV9D_Qea.mjs";
//#region ../pluginutils/dist/filter/composable-filters.d.ts
type StringOrRegExp = string | RegExp;
type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
type FilterExpressionKind = FilterExpression['kind'];
type FilterExpression = And | Or | Not | Id | ImporterId | ModuleType | Code | Query;
type TopLevelFilterExpression = Include | Exclude;
declare class And {
kind: 'and';
args: FilterExpression[];
constructor(...args: FilterExpression[]);
}
declare class Or {
kind: 'or';
args: FilterExpression[];
constructor(...args: FilterExpression[]);
}
declare class Not {
kind: 'not';
expr: FilterExpression;
constructor(expr: FilterExpression);
}
interface QueryFilterObject {
[key: string]: StringOrRegExp | boolean;
}
interface IdParams {
cleanUrl?: boolean;
}
declare class Id {
kind: 'id';
pattern: StringOrRegExp;
params: IdParams;
constructor(pattern: StringOrRegExp, params?: IdParams);
}
declare class ImporterId {
kind: 'importerId';
pattern: StringOrRegExp;
params: IdParams;
constructor(pattern: StringOrRegExp, params?: IdParams);
}
declare class ModuleType {
kind: 'moduleType';
pattern: PluginModuleType;
constructor(pattern: PluginModuleType);
}
declare class Code {
kind: 'code';
pattern: StringOrRegExp;
constructor(expr: StringOrRegExp);
}
declare class Query {
kind: 'query';
key: string;
pattern: StringOrRegExp | boolean;
constructor(key: string, pattern: StringOrRegExp | boolean);
}
declare class Include {
kind: 'include';
expr: FilterExpression;
constructor(expr: FilterExpression);
}
declare class Exclude {
kind: 'exclude';
expr: FilterExpression;
constructor(expr: FilterExpression);
}
declare function and(...args: FilterExpression[]): And;
declare function or(...args: FilterExpression[]): Or;
declare function not(expr: FilterExpression): Not;
declare function id(pattern: StringOrRegExp, params?: IdParams): Id;
declare function importerId(pattern: StringOrRegExp, params?: IdParams): ImporterId;
declare function moduleType(pattern: PluginModuleType): ModuleType;
declare function code(pattern: StringOrRegExp): Code;
declare function query(key: string, pattern: StringOrRegExp | boolean): Query;
declare function include(expr: FilterExpression): Include;
declare function exclude(expr: FilterExpression): Exclude;
/**
* convert a queryObject to FilterExpression like
* ```js
* and(query(k1, v1), query(k2, v2))
* ```
* @param queryFilterObject The query filter object needs to be matched.
* @returns a `And` FilterExpression
*/
declare function queries(queryFilter: QueryFilterObject): And;
declare function interpreter(exprs: TopLevelFilterExpression | TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string): boolean;
interface InterpreterCtx {
urlSearchParamsCache?: URLSearchParams;
}
declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
//#endregion
//#region ../pluginutils/dist/filter/filter-vite-plugins.d.ts
/**
* Filters out Vite plugins that have `apply: 'serve'` set.
*
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
* are intended only for Vite's dev server and should be excluded from the build process.
*
* @param plugins - Array of plugins (can include nested arrays)
* @returns Filtered array with serve-only plugins removed
*
* @example
* ```ts
* import { defineConfig } from 'rolldown';
* import { filterVitePlugins } from '@rolldown/pluginutils';
* import viteReact from '@vitejs/plugin-react';
*
* export default defineConfig({
* plugins: filterVitePlugins([
* viteReact(),
* {
* name: 'dev-only',
* apply: 'serve', // This will be filtered out
* // ...
* }
* ])
* });
* ```
*/
declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[];
//#endregion
//#region ../pluginutils/dist/filter/simple-filters.d.ts
/**
* Constructs a RegExp that matches the exact string specified.
*
* This is useful for plugin hook filters.
*
* @param str the string to match.
* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { exactRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: exactRegex('foo') },
* handler(id) {} // will only be called for `foo`
* }
* }
* ```
*/
declare function exactRegex(str: string, flags?: string): RegExp;
/**
* Constructs a RegExp that matches a value that has the specified prefix.
*
* This is useful for plugin hook filters.
*
* @param str the string to match.
* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { prefixRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: prefixRegex('foo') },
* handler(id) {} // will only be called for IDs starting with `foo`
* }
* }
* ```
*/
declare function prefixRegex(str: string, flags?: string): RegExp;
type WidenString<T> = T extends string ? string : T;
/**
* Converts a id filter to match with an id with a query.
*
* @param input the id filters to convert.
*
* @example
* ```ts
* import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* transform: {
* filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
* // The handler will be called for IDs like:
* // - foo.js
* // - foo.js?foo
* // - foo.txt?foo.js
* // - foo.ts
* // - foo.ts?foo
* // - foo.txt?foo.ts
* handler(code, id) {}
* }
* }
* ```
*/
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
//#endregion
export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };

View File

@@ -0,0 +1,386 @@
import { n as isPromiseLike, t as arraify } from "./shared/misc-DJYbNKZX.mjs";
//#region ../pluginutils/dist/utils.js
const postfixRE = /[?#].*$/;
function cleanUrl(url) {
return url.replace(postfixRE, "");
}
function extractQueryWithoutFragment(url) {
const questionMarkIndex = url.indexOf("?");
if (questionMarkIndex === -1) return "";
const fragmentIndex = url.indexOf("#", questionMarkIndex);
if (fragmentIndex === -1) return url.substring(questionMarkIndex);
else return url.substring(questionMarkIndex, fragmentIndex);
}
//#endregion
//#region ../pluginutils/dist/filter/composable-filters.js
var And = class {
kind;
args;
constructor(...args) {
if (args.length === 0) throw new Error("`And` expects at least one operand");
this.args = args;
this.kind = "and";
}
};
var Or = class {
kind;
args;
constructor(...args) {
if (args.length === 0) throw new Error("`Or` expects at least one operand");
this.args = args;
this.kind = "or";
}
};
var Not = class {
kind;
expr;
constructor(expr) {
this.expr = expr;
this.kind = "not";
}
};
var Id = class {
kind;
pattern;
params;
constructor(pattern, params) {
this.pattern = pattern;
this.kind = "id";
this.params = params ?? { cleanUrl: false };
}
};
var ImporterId = class {
kind;
pattern;
params;
constructor(pattern, params) {
this.pattern = pattern;
this.kind = "importerId";
this.params = params ?? { cleanUrl: false };
}
};
var ModuleType = class {
kind;
pattern;
constructor(pattern) {
this.pattern = pattern;
this.kind = "moduleType";
}
};
var Code = class {
kind;
pattern;
constructor(expr) {
this.pattern = expr;
this.kind = "code";
}
};
var Query = class {
kind;
key;
pattern;
constructor(key, pattern) {
this.pattern = pattern;
this.key = key;
this.kind = "query";
}
};
var Include = class {
kind;
expr;
constructor(expr) {
this.expr = expr;
this.kind = "include";
}
};
var Exclude = class {
kind;
expr;
constructor(expr) {
this.expr = expr;
this.kind = "exclude";
}
};
function and(...args) {
return new And(...args);
}
function or(...args) {
return new Or(...args);
}
function not(expr) {
return new Not(expr);
}
function id(pattern, params) {
return new Id(pattern, params);
}
function importerId(pattern, params) {
return new ImporterId(pattern, params);
}
function moduleType(pattern) {
return new ModuleType(pattern);
}
function code(pattern) {
return new Code(pattern);
}
function query(key, pattern) {
return new Query(key, pattern);
}
function include(expr) {
return new Include(expr);
}
function exclude(expr) {
return new Exclude(expr);
}
/**
* convert a queryObject to FilterExpression like
* ```js
* and(query(k1, v1), query(k2, v2))
* ```
* @param queryFilterObject The query filter object needs to be matched.
* @returns a `And` FilterExpression
*/
function queries(queryFilter) {
return and(...Object.entries(queryFilter).map(([key, value]) => {
return new Query(key, value);
}));
}
function interpreter(exprs, code, id, moduleType, importerId) {
let arr = [];
if (Array.isArray(exprs)) arr = exprs;
else arr = [exprs];
return interpreterImpl(arr, code, id, moduleType, importerId);
}
function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
let hasInclude = false;
for (const e of expr) switch (e.kind) {
case "include":
hasInclude = true;
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return true;
break;
case "exclude":
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return false;
break;
}
return !hasInclude;
}
function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
switch (expr.kind) {
case "and": return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
case "or": return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
case "not": return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
case "id": {
if (id === void 0) throw new Error("`id` is required for `id` expression");
let idToMatch = id;
if (expr.params.cleanUrl) idToMatch = cleanUrl(idToMatch);
return typeof expr.pattern === "string" ? idToMatch === expr.pattern : expr.pattern.test(idToMatch);
}
case "importerId": {
if (importerId === void 0) return false;
let importerIdToMatch = importerId;
if (expr.params.cleanUrl) importerIdToMatch = cleanUrl(importerIdToMatch);
return typeof expr.pattern === "string" ? importerIdToMatch === expr.pattern : expr.pattern.test(importerIdToMatch);
}
case "moduleType":
if (moduleType === void 0) throw new Error("`moduleType` is required for `moduleType` expression");
return moduleType === expr.pattern;
case "code":
if (code === void 0) throw new Error("`code` is required for `code` expression");
return typeof expr.pattern === "string" ? code.includes(expr.pattern) : expr.pattern.test(code);
case "query": {
if (id === void 0) throw new Error("`id` is required for `Query` expression");
if (!ctx.urlSearchParamsCache) {
let queryString = extractQueryWithoutFragment(id);
ctx.urlSearchParamsCache = new URLSearchParams(queryString);
}
let urlParams = ctx.urlSearchParamsCache;
if (typeof expr.pattern === "boolean") if (expr.pattern) return urlParams.has(expr.key);
else return !urlParams.has(expr.key);
else if (typeof expr.pattern === "string") return urlParams.get(expr.key) === expr.pattern;
else return expr.pattern.test(urlParams.get(expr.key) ?? "");
}
default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
}
}
//#endregion
//#region ../pluginutils/dist/filter/filter-vite-plugins.js
/**
* Filters out Vite plugins that have `apply: 'serve'` set.
*
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
* are intended only for Vite's dev server and should be excluded from the build process.
*
* @param plugins - Array of plugins (can include nested arrays)
* @returns Filtered array with serve-only plugins removed
*
* @example
* ```ts
* import { defineConfig } from 'rolldown';
* import { filterVitePlugins } from '@rolldown/pluginutils';
* import viteReact from '@vitejs/plugin-react';
*
* export default defineConfig({
* plugins: filterVitePlugins([
* viteReact(),
* {
* name: 'dev-only',
* apply: 'serve', // This will be filtered out
* // ...
* }
* ])
* });
* ```
*/
function filterVitePlugins(plugins) {
if (!plugins) return [];
const pluginArray = Array.isArray(plugins) ? plugins : [plugins];
const result = [];
for (const plugin of pluginArray) {
if (!plugin) continue;
if (Array.isArray(plugin)) {
result.push(...filterVitePlugins(plugin));
continue;
}
const pluginWithApply = plugin;
if ("apply" in pluginWithApply) {
const applyValue = pluginWithApply.apply;
if (typeof applyValue === "function") try {
if (applyValue({}, {
command: "build",
mode: "production"
})) result.push(plugin);
} catch {
result.push(plugin);
}
else if (applyValue === "serve") continue;
else result.push(plugin);
} else result.push(plugin);
}
return result;
}
//#endregion
//#region ../pluginutils/dist/filter/simple-filters.js
/**
* Constructs a RegExp that matches the exact string specified.
*
* This is useful for plugin hook filters.
*
* @param str the string to match.
* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { exactRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: exactRegex('foo') },
* handler(id) {} // will only be called for `foo`
* }
* }
* ```
*/
function exactRegex(str, flags) {
return new RegExp(`^${escapeRegex(str)}$`, flags);
}
/**
* Constructs a RegExp that matches a value that has the specified prefix.
*
* This is useful for plugin hook filters.
*
* @param str the string to match.
* @param flags flags for the RegExp.
*
* @example
* ```ts
* import { prefixRegex } from '@rolldown/pluginutils';
* const plugin = {
* name: 'plugin',
* resolveId: {
* filter: { id: prefixRegex('foo') },
* handler(id) {} // will only be called for IDs starting with `foo`
* }
* }
* ```
*/
function prefixRegex(str, flags) {
return new RegExp(`^${escapeRegex(str)}`, flags);
}
const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
function escapeRegex(str) {
return str.replace(escapeRegexRE, "\\$&");
}
function makeIdFiltersToMatchWithQuery(input) {
if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery(input);
return input.map((i) => makeIdFilterToMatchWithQuery(i));
}
function makeIdFilterToMatchWithQuery(input) {
if (typeof input === "string") return `${input}{?*,}`;
return makeRegexIdFilterToMatchWithQuery(input);
}
function makeRegexIdFilterToMatchWithQuery(input) {
return new RegExp(input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), input.flags);
}
//#endregion
//#region src/plugin/with-filter.ts
function withFilterImpl(pluginOption, filterObjectList) {
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
if (pluginOption == false || pluginOption == null) return pluginOption;
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
let plugin = pluginOption;
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
if (filterObjectIndex === -1) return plugin;
let filterObject = filterObjectList[filterObjectIndex];
Object.keys(plugin).forEach((key) => {
switch (key) {
case "transform":
case "resolveId":
case "load":
if (!plugin[key]) return;
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
else plugin[key] = {
handler: plugin[key],
filter: filterObject[key]
};
break;
default: break;
}
});
return plugin;
}
/**
* A helper function to add plugin hook filters to a plugin or an array of plugins.
*
* @example
* ```ts
* import yaml from '@rollup/plugin-yaml';
* import { defineConfig } from 'rolldown';
* import { withFilter } from 'rolldown/filter';
*
* export default defineConfig({
* plugins: [
* // Run the transform hook of the `yaml` plugin
* // only for modules which end in `.yaml`
* withFilter(
* yaml({}),
* { transform: { id: /\.yaml$/ } },
* ),
* ],
* });
* ```
*
* @category Config
*/
function withFilter(pluginOption, filterObject) {
return withFilterImpl(pluginOption, arraify(filterObject));
}
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
if (typeof pattern === "string" && pattern === pluginName) return i;
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
}
return -1;
}
//#endregion
export { and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };

View File

@@ -0,0 +1,3 @@
import { a as RolldownLog } from "./shared/logging-C6h4g8dA.mjs";
import { n as getLogFilter, t as GetLogFilter } from "./shared/get-log-filter-semyr3Lj.mjs";
export { GetLogFilter, RolldownLog, RolldownLog as RollupLog, getLogFilter as default };

View File

@@ -0,0 +1,68 @@
//#region src/get-log-filter.ts
/**
* A helper function to generate log filters using the same syntax as the CLI.
*
* @example
* ```ts
* import { defineConfig } from 'rolldown';
* import { getLogFilter } from 'rolldown/getLogFilter';
*
* const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
*
* export default defineConfig({
* input: 'main.js',
* onLog(level, log, handler) {
* if (logFilter(log)) {
* handler(level, log);
* }
* }
* });
* ```
*
* @category Config
*/
const getLogFilter = (filters) => {
if (filters.length === 0) return () => true;
const normalizedFilters = filters.map((filter) => filter.split("&").map((subFilter) => {
const inverted = subFilter.startsWith("!");
if (inverted) subFilter = subFilter.slice(1);
const [key, ...value] = subFilter.split(":");
return {
inverted,
key: key.split("."),
parts: value.join(":").split("*")
};
}));
return (log) => {
nextIntersectedFilter: for (const intersectedFilters of normalizedFilters) {
for (const { inverted, key, parts } of intersectedFilters) {
const isFilterSatisfied = testFilter(log, key, parts);
if (inverted ? isFilterSatisfied : !isFilterSatisfied) continue nextIntersectedFilter;
}
return true;
}
return false;
};
};
const testFilter = (log, key, parts) => {
let rawValue = log;
for (let index = 0; index < key.length; index++) {
if (!rawValue) return false;
const part = key[index];
if (!(part in rawValue)) return false;
rawValue = rawValue[part];
}
let value = typeof rawValue === "object" ? JSON.stringify(rawValue) : String(rawValue);
if (parts.length === 1) return value === parts[0];
if (!value.startsWith(parts[0])) return false;
const lastPartIndex = parts.length - 1;
for (let index = 1; index < lastPartIndex; index++) {
const part = parts[index];
const position = value.indexOf(part);
if (position === -1) return false;
value = value.slice(position + part.length);
}
return value.endsWith(parts[lastPartIndex]);
};
//#endregion
export { getLogFilter as default };

View File

@@ -0,0 +1,4 @@
import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-C6h4g8dA.mjs";
import { z as PreRenderedChunk } from "./shared/binding-Dsq9Azhm.mjs";
import { $ as GeneralHookFilter, A as SourceDescription, At as CodeSplittingOptions, B as TreeshakingOptions, Bt as PartialNull, C as PartialResolvedId, Ct as AddonFunction, D as ResolvedId, Dt as ChunkingContext, E as ResolveIdResult, Et as ChunkFileNamesFunction, F as VERSION, Ft as MinifyOptions, G as EmittedPrebuiltChunk, Gt as RenderedModule, H as EmittedAsset, Ht as OutputAsset, I as BundleError, It as ModuleFormat, J as PluginContextResolveOptions, K as GetModuleInfo, Kt as RolldownOutput, L as ExistingRawSourceMap, Lt as OutputOptions, Mt as GeneratedCodeOptions, Nt as GeneratedCodePreset, O as RolldownPlugin, Ot as CodeSplittingGroup, P as RUNTIME_MODULE_ID, Pt as GlobalsFunction, Q as PluginContextMeta, R as SourceMapInput, Rt as PreRenderedAsset, S as ParallelPluginHooks, St as build, T as ResolveIdExtraOptions, Tt as AdvancedChunksOptions, U as EmittedChunk, Ut as OutputChunk, V as TransformPluginContext, W as EmittedFile, Wt as RenderedChunk, Xt as SourcemapIgnoreListOption, Y as DefineParallelPluginResult, Yt as ModuleInfo, Z as MinimalPluginContext, _ as ImportKind, _t as RolldownWatcherWatcherEventMap, a as ExternalOption, at as RolldownFsModule, b as ModuleType, bt as RolldownBuild, c as InputOptions, ct as NormalizedInputOptions, d as WatcherFileWatcherOptions, dt as LoggingFunction, et as HookFilter, f as WatcherOptions, ft as WarningHandlerWithDefault, g as HookFilterExtension, gt as RolldownWatcherEvent, h as FunctionPluginHooks, ht as RolldownWatcher, i as RolldownOptions, it as RolldownFileStats, j as TransformResult, jt as CommentsOptions, k as RolldownPluginOption, kt as CodeSplittingNameFunction, l as ModuleTypes, lt as TransformOptions, m as CustomPluginOptions, mt as watch, n as RolldownOptionsFunction, nt as BufferEncoding, o as ExternalOptionFunction, ot as InternalModuleFormat, p as AsyncPluginHooks, pt as RolldownMagicString, q as PluginContext, qt as SourceMap, r as defineConfig, rt as RolldownDirectoryEntry, s as InputOption, st as NormalizedOutputOptions, t as ConfigExport, tt as ModuleTypeFilter, u as OptimizationOptions, ut as ChecksOptions, v as LoadResult, vt as WatchOptions, w as Plugin, wt as AdvancedChunksGroup, x as ObjectHook, xt as BuildOptions, y as ModuleOptions, yt as rolldown, z as OutputBundle } from "./shared/define-config-CV9D_Qea.mjs";
export { AddonFunction, AdvancedChunksGroup, AdvancedChunksOptions, AsyncPluginHooks, BufferEncoding, BuildOptions, BundleError, ChecksOptions, ChunkFileNamesFunction, ChunkingContext, CodeSplittingGroup, CodeSplittingNameFunction, CodeSplittingOptions, CommentsOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedChunk, EmittedFile, EmittedPrebuiltChunk, ExistingRawSourceMap, ExternalOption, ExternalOptionFunction, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PluginContextResolveOptions, PreRenderedAsset, PreRenderedChunk, RUNTIME_MODULE_ID, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownError, RolldownError as RollupError, RolldownFileStats, RolldownFsModule, RolldownLog, RolldownLog as RollupLog, RolldownLogWithString, RolldownLogWithString as RollupLogWithString, RolldownMagicString, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RolldownWatcherWatcherEventMap, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformOptions, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherFileWatcherOptions, WatcherOptions, build, defineConfig, rolldown, watch };

View File

@@ -0,0 +1,54 @@
import { n as __toESM, t as require_binding } from "./shared/binding-BV_UWDF3.mjs";
import { n as onExit, t as watch } from "./shared/watch-CzsahzPN.mjs";
import "./shared/normalize-string-or-regex-D7wlw16t.mjs";
import { a as RolldownMagicString, b as RUNTIME_MODULE_ID, x as VERSION } from "./shared/bindingify-input-options-DoaqRULI.mjs";
import "./shared/rolldown-build-yQC7KN8K.mjs";
import "./shared/error-BO4SlZV_.mjs";
import "./shared/parse-nWsWXhOL.mjs";
import { t as rolldown } from "./shared/rolldown-BOb3gBhW.mjs";
import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
import { isMainThread } from "node:worker_threads";
//#region src/setup.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
if (isMainThread) {
const subscriberGuard = (0, import_binding.initTraceSubscriber)();
onExit(() => {
subscriberGuard?.close();
});
}
//#endregion
//#region src/api/build.ts
/**
* The API similar to esbuild's `build` function.
*
* @example
* ```js
* import { build } from 'rolldown';
*
* const result = await build({
* input: 'src/main.js',
* output: {
* file: 'bundle.js',
* },
* });
* console.log(result);
* ```
*
* @experimental
* @category Programmatic APIs
*/
async function build(options) {
if (Array.isArray(options)) return Promise.all(options.map((opts) => build(opts)));
else {
const { output, write = true, ...inputOptions } = options;
const build = await rolldown(inputOptions);
try {
if (write) return await build.write(output);
else return await build.generate(output);
} finally {
await build.close();
}
}
}
//#endregion
export { RUNTIME_MODULE_ID, RolldownMagicString, VERSION, build, defineConfig, rolldown, watch };

View File

@@ -0,0 +1 @@
export { };

View File

@@ -0,0 +1,31 @@
import { n as __toESM, t as require_binding } from "./shared/binding-BV_UWDF3.mjs";
import "./shared/normalize-string-or-regex-D7wlw16t.mjs";
import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-DoaqRULI.mjs";
import "./shared/error-BO4SlZV_.mjs";
import "./shared/parse-nWsWXhOL.mjs";
import { parentPort, workerData } from "node:worker_threads";
//#region src/parallel-plugin-worker.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
const { registryId, pluginInfos, threadNumber } = workerData;
(async () => {
try {
(0, import_binding.registerPlugins)(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
return {
index: pluginInfo.index,
plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, [], []), [], () => {}, "info", false)
};
})));
parentPort.postMessage({ type: "success" });
} catch (error) {
parentPort.postMessage({
type: "error",
error
});
} finally {
parentPort.unref();
}
})();
//#endregion
export {};

View File

@@ -0,0 +1,13 @@
import { w as Plugin, zt as MaybePromise } from "./shared/define-config-CV9D_Qea.mjs";
//#region src/plugin/parallel-plugin-implementation.d.ts
type ParallelPluginImplementation = Plugin;
type Context = {
/**
* Thread number
*/
threadNumber: number;
};
declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
//#endregion
export { type Context, type ParallelPluginImplementation, defineParallelPluginImplementation };

View File

@@ -0,0 +1,6 @@
//#region src/plugin/parallel-plugin-implementation.ts
function defineParallelPluginImplementation(plugin) {
return plugin;
}
//#endregion
export { defineParallelPluginImplementation };

View File

@@ -0,0 +1,32 @@
import { L as ParseResult$1, R as ParserOptions$1 } from "./shared/binding-Dsq9Azhm.mjs";
import { Program } from "@oxc-project/types";
//#region src/parse-ast-index.d.ts
/**
* @hidden
*/
type ParseResult = ParseResult$1;
/**
* @hidden
*/
type ParserOptions = ParserOptions$1;
/**
* Parse code synchronously and return the AST.
*
* This function is similar to Rollup's `parseAst` function.
* Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
*
* @category Utilities
*/
declare function parseAst(sourceText: string, options?: ParserOptions | null, filename?: string): Program;
/**
* Parse code asynchronously and return the AST.
*
* This function is similar to Rollup's `parseAstAsync` function.
* Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
*
* @category Utilities
*/
declare function parseAstAsync(sourceText: string, options?: ParserOptions | null, filename?: string): Promise<Program>;
//#endregion
export { ParseResult, ParserOptions, parseAst, parseAstAsync };

View File

@@ -0,0 +1,61 @@
import "./shared/binding-BV_UWDF3.mjs";
import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-D80CXhvg.mjs";
import { n as parseSync, t as parse } from "./shared/parse-nWsWXhOL.mjs";
//#region src/parse-ast-index.ts
function wrap(result, filename, sourceText) {
if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
return result.program;
}
function normalizeParseError(filename, sourceText, errors) {
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
const pos = errors[0]?.labels?.[0]?.start;
for (let i = 0; i < errors.length; i++) {
if (i >= 5) {
message += "\n...";
break;
}
const e = errors[i];
message += e.message + "\n" + e.labels.map((label) => {
const location = locate(sourceText, label.start, { offsetLine: 1 });
if (!location) return;
return getCodeFrame(sourceText, location.line, location.column);
}).filter(Boolean).join("\n");
}
const log = logParseError(message, filename, pos);
if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
return error(log);
}
const defaultParserOptions = {
lang: "js",
preserveParens: false
};
/**
* Parse code synchronously and return the AST.
*
* This function is similar to Rollup's `parseAst` function.
* Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
*
* @category Utilities
*/
function parseAst(sourceText, options, filename) {
return wrap(parseSync(filename ?? "file.js", sourceText, {
...defaultParserOptions,
...options
}), filename, sourceText);
}
/**
* Parse code asynchronously and return the AST.
*
* This function is similar to Rollup's `parseAstAsync` function.
* Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
*
* @category Utilities
*/
async function parseAstAsync(sourceText, options, filename) {
return wrap(await parse(filename ?? "file.js", sourceText, {
...defaultParserOptions,
...options
}), filename, sourceText);
}
//#endregion
export { parseAst, parseAstAsync };

View File

@@ -0,0 +1,33 @@
import { m as BindingReplacePluginConfig } from "./shared/binding-Dsq9Azhm.mjs";
import { N as BuiltinPlugin } from "./shared/define-config-CV9D_Qea.mjs";
import { t as esmExternalRequirePlugin } from "./shared/constructors-DfpIbfMG.mjs";
//#region src/builtin-plugin/replace-plugin.d.ts
/**
* Replaces targeted strings in files while bundling.
*
* @example
* **Basic usage**
* ```js
* replacePlugin({
* 'process.env.NODE_ENV': JSON.stringify('production'),
* __buildVersion: 15
* })
* ```
* @example
* **With options**
* ```js
* replacePlugin({
* 'process.env.NODE_ENV': JSON.stringify('production'),
* __buildVersion: 15
* }, {
* preventAssignment: false,
* })
* ```
*
* @see https://rolldown.rs/builtin-plugins/replace
* @category Builtin Plugins
*/
declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
//#endregion
export { esmExternalRequirePlugin, replacePlugin };

View File

@@ -0,0 +1,41 @@
import "./shared/binding-BV_UWDF3.mjs";
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-D7wlw16t.mjs";
import { t as esmExternalRequirePlugin } from "./shared/constructors-DqC7XSXy.mjs";
//#region src/builtin-plugin/replace-plugin.ts
/**
* Replaces targeted strings in files while bundling.
*
* @example
* **Basic usage**
* ```js
* replacePlugin({
* 'process.env.NODE_ENV': JSON.stringify('production'),
* __buildVersion: 15
* })
* ```
* @example
* **With options**
* ```js
* replacePlugin({
* 'process.env.NODE_ENV': JSON.stringify('production'),
* __buildVersion: 15
* }, {
* preventAssignment: false,
* })
* ```
*
* @see https://rolldown.rs/builtin-plugins/replace
* @category Builtin Plugins
*/
function replacePlugin(values = {}, options = {}) {
Object.keys(values).forEach((key) => {
const value = values[key];
if (typeof value !== "string") values[key] = String(value);
});
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:replace", {
...options,
values
}));
}
//#endregion
export { esmExternalRequirePlugin, replacePlugin };

View File

@@ -0,0 +1,582 @@
import { createRequire } from "node:module";
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var __require = /* @__PURE__ */ createRequire(import.meta.url);
//#endregion
//#region src/webcontainer-fallback.cjs
var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
const fs = __require("node:fs");
const childProcess = __require("node:child_process");
const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
const baseDir = `/tmp/rolldown-${version}`;
const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
if (!fs.existsSync(bindingEntry)) {
const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
fs.rmSync(baseDir, {
recursive: true,
force: true
});
fs.mkdirSync(baseDir, { recursive: true });
console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
cwd: baseDir,
stdio: "inherit"
});
}
module.exports = __require(bindingEntry);
}));
//#endregion
//#region src/binding.cjs
var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
const { readFileSync } = __require("node:fs");
let nativeBinding = null;
const loadErrors = [];
const isMusl = () => {
let musl = false;
if (process.platform === "linux") {
musl = isMuslFromFilesystem();
if (musl === null) musl = isMuslFromReport();
if (musl === null) musl = isMuslFromChildProcess();
}
return musl;
};
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
const isMuslFromFilesystem = () => {
try {
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
} catch {
return null;
}
};
const isMuslFromReport = () => {
let report = null;
if (typeof process.report?.getReport === "function") {
process.report.excludeNetwork = true;
report = process.report.getReport();
}
if (!report) return null;
if (report.header && report.header.glibcVersionRuntime) return false;
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) return true;
}
return false;
};
const isMuslFromChildProcess = () => {
try {
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
} catch (e) {
return false;
}
};
function requireNative() {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err);
}
else if (process.platform === "android") if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.android-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-android-arm64");
const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm") {
try {
return __require("./rolldown-binding.android-arm-eabi.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-android-arm-eabi");
const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
else if (process.platform === "win32") if (process.arch === "x64") if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
try {
return __require("./rolldown-binding.win32-x64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-x64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.win32-x64-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-x64-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "ia32") {
try {
return __require("./rolldown-binding.win32-ia32-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-ia32-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.win32-arm64-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-arm64-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
else if (process.platform === "darwin") {
try {
return __require("./rolldown-binding.darwin-universal.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-universal");
const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
if (process.arch === "x64") {
try {
return __require("./rolldown-binding.darwin-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-x64");
const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.darwin-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-arm64");
const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
} else if (process.platform === "freebsd") if (process.arch === "x64") {
try {
return __require("./rolldown-binding.freebsd-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-freebsd-x64");
const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.freebsd-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-freebsd-arm64");
const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-x64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-x64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("../rolldown-binding.linux-x64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-x64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "arm64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-arm64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-arm64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "arm") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-arm-musleabihf.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm-musleabihf");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-arm-gnueabihf.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "loong64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-loong64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-loong64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-loong64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-loong64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "riscv64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-riscv64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-riscv64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-riscv64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-riscv64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "ppc64") {
try {
return __require("./rolldown-binding.linux-ppc64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-ppc64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "s390x") {
try {
return __require("./rolldown-binding.linux-s390x-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-s390x-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
else if (process.platform === "openharmony") if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.openharmony-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-arm64");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "x64") {
try {
return __require("./rolldown-binding.openharmony-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-x64");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm") {
try {
return __require("./rolldown-binding.openharmony-arm.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-arm");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
if (bindingPackageVersion !== "1.0.0-rc.10" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-rc.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
}
nativeBinding = requireNative();
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
let wasiBinding = null;
let wasiBindingError = null;
try {
wasiBinding = __require("../rolldown-binding.wasi.cjs");
nativeBinding = wasiBinding;
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) wasiBindingError = err;
}
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) try {
wasiBinding = __require("@rolldown/binding-wasm32-wasi");
nativeBinding = wasiBinding;
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
if (!wasiBindingError) wasiBindingError = err;
else wasiBindingError.cause = err;
loadErrors.push(err);
}
}
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
error.cause = wasiBindingError;
throw error;
}
}
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
nativeBinding = require_webcontainer_fallback();
} catch (err) {
loadErrors.push(err);
}
if (!nativeBinding) {
if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors.reduce((err, cur) => {
cur.cause = err;
return cur;
}) });
throw new Error(`Failed to load native binding`);
}
module.exports = nativeBinding;
module.exports.minify = nativeBinding.minify;
module.exports.minifySync = nativeBinding.minifySync;
module.exports.Severity = nativeBinding.Severity;
module.exports.ParseResult = nativeBinding.ParseResult;
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
module.exports.ImportNameKind = nativeBinding.ImportNameKind;
module.exports.parse = nativeBinding.parse;
module.exports.parseSync = nativeBinding.parseSync;
module.exports.rawTransferSupported = nativeBinding.rawTransferSupported;
module.exports.ResolverFactory = nativeBinding.ResolverFactory;
module.exports.EnforceExtension = nativeBinding.EnforceExtension;
module.exports.ModuleType = nativeBinding.ModuleType;
module.exports.sync = nativeBinding.sync;
module.exports.HelperMode = nativeBinding.HelperMode;
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
module.exports.isolatedDeclarationSync = nativeBinding.isolatedDeclarationSync;
module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform;
module.exports.moduleRunnerTransformSync = nativeBinding.moduleRunnerTransformSync;
module.exports.transform = nativeBinding.transform;
module.exports.transformSync = nativeBinding.transformSync;
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
module.exports.BindingBundleErrorEventData = nativeBinding.BindingBundleErrorEventData;
module.exports.BindingBundler = nativeBinding.BindingBundler;
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
module.exports.BindingChunkingContext = nativeBinding.BindingChunkingContext;
module.exports.BindingDecodedMap = nativeBinding.BindingDecodedMap;
module.exports.BindingDevEngine = nativeBinding.BindingDevEngine;
module.exports.BindingLoadPluginContext = nativeBinding.BindingLoadPluginContext;
module.exports.BindingMagicString = nativeBinding.BindingMagicString;
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
module.exports.BindingSourceMap = nativeBinding.BindingSourceMap;
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
module.exports.BindingWatcherBundler = nativeBinding.BindingWatcherBundler;
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
module.exports.TsconfigCache = nativeBinding.TsconfigCache;
module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
module.exports.BindingPropertyReadSideEffects = nativeBinding.BindingPropertyReadSideEffects;
module.exports.BindingPropertyWriteSideEffects = nativeBinding.BindingPropertyWriteSideEffects;
module.exports.BindingRebuildStrategy = nativeBinding.BindingRebuildStrategy;
module.exports.collapseSourcemaps = nativeBinding.collapseSourcemaps;
module.exports.enhancedTransform = nativeBinding.enhancedTransform;
module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
module.exports.registerPlugins = nativeBinding.registerPlugins;
module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
}));
//#endregion
export { __toESM as n, require_binding as t };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, b as BindingViteDynamicImportVarsPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteBuildImportAnalysisPluginConfig } from "./binding-Dsq9Azhm.mjs";
import { N as BuiltinPlugin, Vt as StringOrRegExp } from "./define-config-CV9D_Qea.mjs";
//#region src/builtin-plugin/constructors.d.ts
declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
include?: StringOrRegExp | StringOrRegExp[];
exclude?: StringOrRegExp | StringOrRegExp[];
};
declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
declare function viteWasmFallbackPlugin(): BuiltinPlugin;
declare function viteLoadFallbackPlugin(): BuiltinPlugin;
declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, "yarnPnp">): BuiltinPlugin;
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
declare function viteWebWorkerPostPlugin(): BuiltinPlugin;
/**
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
*
* @see https://rolldown.rs/builtin-plugins/esm-external-require
* @category Builtin Plugins
*/
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
include?: StringOrRegExp | StringOrRegExp[];
exclude?: StringOrRegExp | StringOrRegExp[];
};
/**
* This plugin should not be used for Rolldown.
*/
declare function oxcRuntimePlugin(): BuiltinPlugin;
declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
//#endregion
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };

View File

@@ -0,0 +1,68 @@
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-D7wlw16t.mjs";
//#region src/builtin-plugin/constructors.ts
function viteModulePreloadPolyfillPlugin(config) {
return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
}
function viteDynamicImportVarsPlugin(config) {
if (config) {
config.include = normalizedStringOrRegex(config.include);
config.exclude = normalizedStringOrRegex(config.exclude);
}
return new BuiltinPlugin("builtin:vite-dynamic-import-vars", config);
}
function viteImportGlobPlugin(config) {
return new BuiltinPlugin("builtin:vite-import-glob", config);
}
function viteReporterPlugin(config) {
return new BuiltinPlugin("builtin:vite-reporter", config);
}
function viteWasmFallbackPlugin() {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
}
function viteLoadFallbackPlugin() {
return new BuiltinPlugin("builtin:vite-load-fallback");
}
function viteJsonPlugin(config) {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-json", config));
}
function viteBuildImportAnalysisPlugin(config) {
return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
}
function viteResolvePlugin(config) {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", {
...config,
yarnPnp: typeof process === "object" && !!process.versions?.pnp
}));
}
function isolatedDeclarationPlugin(config) {
return new BuiltinPlugin("builtin:isolated-declaration", config);
}
function viteWebWorkerPostPlugin() {
return new BuiltinPlugin("builtin:vite-web-worker-post");
}
/**
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
*
* @see https://rolldown.rs/builtin-plugins/esm-external-require
* @category Builtin Plugins
*/
function esmExternalRequirePlugin(config) {
const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
plugin.enforce = "pre";
return plugin;
}
/**
* This plugin should not be used for Rolldown.
*/
function oxcRuntimePlugin() {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:oxc-runtime"));
}
function viteReactRefreshWrapperPlugin(config) {
if (config) {
config.include = normalizedStringOrRegex(config.include);
config.exclude = normalizedStringOrRegex(config.exclude);
}
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
}
//#endregion
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
//#region src/utils/define-config.ts
function defineConfig(config) {
return config;
}
//#endregion
export { defineConfig as t };

View File

@@ -0,0 +1,85 @@
import { t as require_binding } from "./binding-BV_UWDF3.mjs";
//#region src/types/sourcemap.ts
function bindingifySourcemap(map) {
if (map == null) return;
return { inner: typeof map === "string" ? map : {
file: map.file ?? void 0,
mappings: map.mappings,
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
sources: map.sources?.map((s) => s ?? void 0),
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
names: map.names,
x_google_ignoreList: map.x_google_ignoreList,
debugId: "debugId" in map ? map.debugId : void 0
} };
}
require_binding();
function unwrapBindingResult(container) {
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
return container;
}
function normalizeBindingResult(container) {
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
return container;
}
function normalizeBindingError(e) {
return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
code: e.field0.kind,
kind: e.field0.kind,
message: e.field0.message,
id: e.field0.id,
exporter: e.field0.exporter,
loc: e.field0.loc,
pos: e.field0.pos,
stack: void 0
});
}
function aggregateBindingErrorsIntoJsError(rawErrors) {
const errors = rawErrors.map(normalizeBindingError);
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
for (let i = 0; i < errors.length; i++) {
summary += "\n";
if (i >= 5) {
summary += "...";
break;
}
summary += getErrorMessage(errors[i]);
}
const wrapper = new Error(summary);
Object.defineProperty(wrapper, "errors", {
configurable: true,
enumerable: true,
get: () => errors,
set: (value) => Object.defineProperty(wrapper, "errors", {
configurable: true,
enumerable: true,
value
})
});
return wrapper;
}
function getErrorMessage(e) {
if (Object.hasOwn(e, "kind")) return e.message;
let s = "";
if (e.plugin) s += `[plugin ${e.plugin}]`;
const id = e.id ?? e.loc?.file;
if (id) {
s += " " + id;
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
}
if (s) s += "\n";
const message = `${e.name ?? "Error"}: ${e.message}`;
s += message;
if (e.frame) s = joinNewLine(s, e.frame);
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
if (e.cause) {
s = joinNewLine(s, "Caused by:");
s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
}
return s;
}
function joinNewLine(s1, s2) {
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
}
//#endregion
export { bindingifySourcemap as a, unwrapBindingResult as i, normalizeBindingError as n, normalizeBindingResult as r, aggregateBindingErrorsIntoJsError as t };

View File

@@ -0,0 +1,35 @@
import { a as RolldownLog } from "./logging-C6h4g8dA.mjs";
//#region src/get-log-filter.d.ts
/**
* @param filters A list of log filters to apply
* @returns A function that tests whether a log should be output
*
* @category Config
*/
type GetLogFilter = (filters: string[]) => (log: RolldownLog) => boolean;
/**
* A helper function to generate log filters using the same syntax as the CLI.
*
* @example
* ```ts
* import { defineConfig } from 'rolldown';
* import { getLogFilter } from 'rolldown/getLogFilter';
*
* const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
*
* export default defineConfig({
* input: 'main.js',
* onLog(level, log, handler) {
* if (logFilter(log)) {
* handler(level, log);
* }
* }
* });
* ```
*
* @category Config
*/
declare const getLogFilter: GetLogFilter;
//#endregion
export { getLogFilter as n, GetLogFilter as t };

View File

@@ -0,0 +1,120 @@
import { t as rolldown } from "./rolldown-BOb3gBhW.mjs";
import fs from "node:fs";
import path from "node:path";
import { readdir } from "node:fs/promises";
import { cwd } from "node:process";
import { pathToFileURL } from "node:url";
//#region src/utils/load-config.ts
async function bundleTsConfig(configFile, isEsm) {
const dirnameVarName = "injected_original_dirname";
const filenameVarName = "injected_original_filename";
const importMetaUrlVarName = "injected_original_import_meta_url";
const bundle = await rolldown({
input: configFile,
platform: "node",
resolve: { mainFields: ["main"] },
transform: { define: {
__dirname: dirnameVarName,
__filename: filenameVarName,
"import.meta.url": importMetaUrlVarName,
"import.meta.dirname": dirnameVarName,
"import.meta.filename": filenameVarName
} },
treeshake: false,
external: [/^[\w@][^:]/],
plugins: [{
name: "inject-file-scope-variables",
transform: {
filter: { id: /\.[cm]?[jt]s$/ },
async handler(code, id) {
return {
code: `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};` + code,
map: null
};
}
}
}]
});
const outputDir = path.dirname(configFile);
const fileName = (await bundle.write({
dir: outputDir,
format: isEsm ? "esm" : "cjs",
sourcemap: "inline",
entryFileNames: `rolldown.config.[hash]${path.extname(configFile).replace("ts", "js")}`
})).output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
return path.join(outputDir, fileName);
}
const SUPPORTED_JS_CONFIG_FORMATS = [
".js",
".mjs",
".cjs"
];
const SUPPORTED_TS_CONFIG_FORMATS = [
".ts",
".mts",
".cts"
];
const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
const DEFAULT_CONFIG_BASE = "rolldown.config";
async function findConfigFileNameInCwd() {
const filesInWorkingDirectory = new Set(await readdir(cwd()));
for (const extension of SUPPORTED_CONFIG_FORMATS) {
const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
if (filesInWorkingDirectory.has(fileName)) return fileName;
}
throw new Error("No `rolldown.config` configuration file found.");
}
async function loadTsConfig(configFile) {
const file = await bundleTsConfig(configFile, isFilePathESM(configFile));
try {
return (await import(pathToFileURL(file).href)).default;
} finally {
fs.unlink(file, () => {});
}
}
function isFilePathESM(filePath) {
if (/\.m[jt]s$/.test(filePath)) return true;
else if (/\.c[jt]s$/.test(filePath)) return false;
else {
const pkg = findNearestPackageData(path.dirname(filePath));
if (pkg) return pkg.type === "module";
return false;
}
}
function findNearestPackageData(basedir) {
while (basedir) {
const pkgPath = path.join(basedir, "package.json");
if (tryStatSync(pkgPath)?.isFile()) try {
return JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
} catch {}
const nextBasedir = path.dirname(basedir);
if (nextBasedir === basedir) break;
basedir = nextBasedir;
}
return null;
}
function tryStatSync(file) {
try {
return fs.statSync(file, { throwIfNoEntry: false });
} catch {}
}
/**
* Load config from a file in a way that Rolldown does.
*
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
* @returns The loaded config export
*
* @category Config
*/
async function loadConfig(configPath) {
const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
try {
if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
} catch (err) {
throw new Error("Error happened while loading config.", { cause: err });
}
}
//#endregion
export { loadConfig as t };

View File

@@ -0,0 +1,50 @@
//#region src/log/logging.d.ts
/** @inline */
type LogLevel = "info" | "debug" | "warn";
/** @inline */
type LogLevelOption = LogLevel | "silent";
/** @inline */
type LogLevelWithError = LogLevel | "error";
interface RolldownLog {
binding?: string;
cause?: unknown;
/**
* The log code for this log object.
* @example 'PLUGIN_ERROR'
*/
code?: string;
exporter?: string;
frame?: string;
hook?: string;
id?: string;
ids?: string[];
loc?: {
column: number;
file?: string;
line: number;
};
/**
* The message for this log object.
* @example 'The "transform" hook used by the output plugin "rolldown-plugin-foo" is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.'
*/
message: string;
meta?: any;
names?: string[];
plugin?: string;
pluginCode?: unknown;
pos?: number;
reexporter?: string;
stack?: string;
url?: string;
}
/** @inline */
type RolldownLogWithString = RolldownLog | string;
/** @category Plugin APIs */
interface RolldownError extends RolldownLog {
name?: string;
stack?: string;
watchFiles?: string[];
}
type LogOrStringHandler = (level: LogLevelWithError, log: RolldownLogWithString) => void;
//#endregion
export { RolldownLog as a, RolldownError as i, LogLevelOption as n, RolldownLogWithString as o, LogOrStringHandler as r, LogLevel as t };

View File

@@ -0,0 +1,180 @@
//#region src/utils/code-frame.ts
function spaces(index) {
let result = "";
while (index--) result += " ";
return result;
}
function tabsToSpaces(value) {
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
}
const LINE_TRUNCATE_LENGTH = 120;
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
const ELLIPSIS = "...";
function getCodeFrame(source, line, column) {
let lines = source.split("\n");
if (line > lines.length) return "";
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + 3, LINE_TRUNCATE_LENGTH);
const frameStart = Math.max(0, line - 3);
let frameEnd = Math.min(line + 2, lines.length);
lines = lines.slice(frameStart, frameEnd);
while (!/\S/.test(lines[lines.length - 1])) {
lines.pop();
frameEnd -= 1;
}
const digits = String(frameEnd).length;
return lines.map((sourceLine, index) => {
const isErrorLine = frameStart + index + 1 === line;
let lineNumber = String(index + frameStart + 1);
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
let displayedLine = tabsToSpaces(sourceLine);
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - 3)}${ELLIPSIS}`;
if (isErrorLine) {
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
return `${lineNumber}: ${displayedLine}\n${indicator}`;
}
return `${lineNumber}: ${displayedLine}`;
}).join("\n");
}
//#endregion
//#region src/log/locate-character/index.js
/** @typedef {import('./types').Location} Location */
/**
* @param {import('./types').Range} range
* @param {number} index
*/
function rangeContains(range, index) {
return range.start <= index && index < range.end;
}
/**
* @param {string} source
* @param {import('./types').Options} [options]
*/
function getLocator(source, options = {}) {
const { offsetLine = 0, offsetColumn = 0 } = options;
let start = 0;
const ranges = source.split("\n").map((line, i) => {
const end = start + line.length + 1;
/** @type {import('./types').Range} */
const range = {
start,
end,
line: i
};
start = end;
return range;
});
let i = 0;
/**
* @param {string | number} search
* @param {number} [index]
* @returns {Location | undefined}
*/
function locator(search, index) {
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
if (search === -1) return void 0;
let range = ranges[i];
const d = search >= range.end ? 1 : -1;
while (range) {
if (rangeContains(range, search)) return {
line: offsetLine + range.line,
column: offsetColumn + search - range.start,
character: search
};
i += d;
range = ranges[i];
}
}
return locator;
}
/**
* @param {string} source
* @param {string | number} search
* @param {import('./types').Options} [options]
* @returns {Location | undefined}
*/
function locate(source, search, options) {
return getLocator(source, options)(search, options && options.startIndex);
}
//#endregion
//#region src/log/logs.ts
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION", PARSE_ERROR = "PARSE_ERROR";
function logParseError(message, id, pos) {
return {
code: PARSE_ERROR,
id,
message,
pos
};
}
function logInvalidLogPosition(pluginName) {
return {
code: INVALID_LOG_POSITION,
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
};
}
function logInputHookInOutputPlugin(pluginName, hookName) {
return {
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
};
}
function logCycleLoading(pluginName, moduleId) {
return {
code: CYCLE_LOADING,
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
};
}
function logMultipleWatcherOption() {
return {
code: MULTIPLE_WATCHER_OPTION,
message: `Found multiple watcher options at watch options, using first one to start watcher.`
};
}
function logPluginError(error, plugin, { hook, id } = {}) {
try {
const code = error.code;
if (!error.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error.pluginCode = code;
error.code = PLUGIN_ERROR;
error.plugin = plugin;
if (hook) error.hook = hook;
if (id) error.id = id;
} catch (_) {} finally {
return error;
}
}
function error(base) {
if (!(base instanceof Error)) {
base = Object.assign(new Error(base.message), base);
Object.defineProperty(base, "name", {
value: "RolldownError",
writable: true
});
}
throw base;
}
function augmentCodeLocation(properties, pos, source, id) {
if (typeof pos === "object") {
const { line, column } = pos;
properties.loc = {
column,
file: id,
line
};
} else {
properties.pos = pos;
const location = locate(source, pos, { offsetLine: 1 });
if (!location) return;
const { line, column } = location;
properties.loc = {
column,
file: id,
line
};
}
if (properties.frame === void 0) {
const { line, column } = properties.loc;
properties.frame = getCodeFrame(source, line, column);
}
}
//#endregion
export { logInvalidLogPosition as a, logPluginError as c, logInputHookInOutputPlugin as i, locate as l, error as n, logMultipleWatcherOption as o, logCycleLoading as r, logParseError as s, augmentCodeLocation as t, getCodeFrame as u };

View File

@@ -0,0 +1,21 @@
//#region src/utils/misc.ts
function arraify(value) {
return Array.isArray(value) ? value : [value];
}
function isPromiseLike(value) {
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
}
function unimplemented(info) {
if (info) throw new Error(`unimplemented: ${info}`);
throw new Error("unimplemented");
}
function unreachable(info) {
if (info) throw new Error(`unreachable: ${info}`);
throw new Error("unreachable");
}
function unsupported(info) {
throw new Error(`UNSUPPORTED: ${info}`);
}
function noop(..._args) {}
//#endregion
export { unreachable as a, unimplemented as i, isPromiseLike as n, unsupported as o, noop as r, arraify as t };

View File

@@ -0,0 +1,58 @@
import { n as __toESM, t as require_binding } from "./binding-BV_UWDF3.mjs";
import { c as logPluginError, n as error } from "./logs-D80CXhvg.mjs";
//#region src/builtin-plugin/utils.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
var BuiltinPlugin = class {
/** Vite-specific option to control plugin ordering */
enforce;
constructor(name, _options) {
this.name = name;
this._options = _options;
}
};
function makeBuiltinPluginCallable(plugin) {
let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
const wrappedPlugin = plugin;
for (const key in callablePlugin) wrappedPlugin[key] = async function(...args) {
try {
return await callablePlugin[key](...args);
} catch (e) {
if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
return error(logPluginError(e, plugin.name, {
hook: key,
id: key === "transform" ? args[2] : void 0
}));
}
};
return wrappedPlugin;
}
function bindingifyBuiltInPlugin(plugin) {
return {
__name: plugin.name,
options: plugin._options
};
}
function bindingifyManifestPlugin(plugin, pluginContextData) {
const { isOutputOptionsForLegacyChunks, ...options } = plugin._options;
return {
__name: plugin.name,
options: {
...options,
isLegacy: isOutputOptionsForLegacyChunks ? (opts) => {
return isOutputOptionsForLegacyChunks(pluginContextData.getOutputOptions(opts));
} : void 0
}
};
}
//#endregion
//#region src/utils/normalize-string-or-regex.ts
function normalizedStringOrRegex(pattern) {
if (!pattern) return;
if (!isReadonlyArray(pattern)) return [pattern];
return pattern;
}
function isReadonlyArray(input) {
return Array.isArray(input);
}
//#endregion
export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };

View File

@@ -0,0 +1,74 @@
import { n as __toESM, t as require_binding } from "./binding-BV_UWDF3.mjs";
//#region ../../node_modules/.pnpm/oxc-parser@0.120.0/node_modules/oxc-parser/src-js/wrap.js
function wrap(result) {
let program, module, comments, errors;
return {
get program() {
if (!program) program = jsonParseAst(result.program);
return program;
},
get module() {
if (!module) module = result.module;
return module;
},
get comments() {
if (!comments) comments = result.comments;
return comments;
},
get errors() {
if (!errors) errors = result.errors;
return errors;
}
};
}
function jsonParseAst(programJson) {
const { node: program, fixes } = JSON.parse(programJson);
for (const fixPath of fixes) applyFix(program, fixPath);
return program;
}
function applyFix(program, fixPath) {
let node = program;
for (const key of fixPath) node = node[key];
if (node.bigint) node.value = BigInt(node.bigint);
else try {
node.value = RegExp(node.regex.pattern, node.regex.flags);
} catch {}
}
//#endregion
//#region src/utils/parse.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
/**
* Parse JS/TS source asynchronously on a separate thread.
*
* Note that not all of the workload can happen on a separate thread.
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
* has to happen on current thread. This synchronous deserialization work typically outweighs
* the asynchronous parsing by a factor of between 3 and 20.
*
* i.e. the majority of the workload cannot be parallelized by using this method.
*
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
*
* @category Utilities
*/
async function parse(filename, sourceText, options) {
return wrap(await (0, import_binding.parse)(filename, sourceText, options));
}
/**
* Parse JS/TS source synchronously on current thread.
*
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
* (see {@linkcode parse} documentation for details).
*
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
* with {@linkcode parseSync} rather than using {@linkcode parse}.
*
* @category Utilities
*/
function parseSync(filename, sourceText, options) {
return wrap((0, import_binding.parseSync)(filename, sourceText, options));
}
//#endregion
export { parseSync as n, parse as t };

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,113 @@
import { n as __toESM, t as require_binding } from "./binding-BV_UWDF3.mjs";
import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-BO4SlZV_.mjs";
//#region src/utils/minify.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
/**
* Minify asynchronously.
*
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
*
* @category Utilities
* @experimental
*/
async function minify(filename, sourceText, options) {
const inputMap = bindingifySourcemap(options?.inputMap);
const result = await (0, import_binding.minify)(filename, sourceText, options);
if (result.map && inputMap) result.map = {
version: 3,
...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
};
return result;
}
/**
* Minify synchronously.
*
* @category Utilities
* @experimental
*/
function minifySync(filename, sourceText, options) {
const inputMap = bindingifySourcemap(options?.inputMap);
const result = (0, import_binding.minifySync)(filename, sourceText, options);
if (result.map && inputMap) result.map = {
version: 3,
...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
};
return result;
}
//#endregion
//#region src/utils/transform.ts
const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
*
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns a promise that resolves to an object containing the transformed code,
* source maps, and any errors that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
async function transform(filename, sourceText, options, cache) {
const result = await (0, import_binding.enhancedTransform)(filename, sourceText, options, cache, yarnPnp$1);
return {
...result,
errors: result.errors.map(normalizeBindingError),
warnings: result.warnings.map((w) => w.field0)
};
}
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns an object containing the transformed code, source maps, and any errors
* that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
function transformSync(filename, sourceText, options, cache) {
const result = (0, import_binding.enhancedTransformSync)(filename, sourceText, options, cache, yarnPnp$1);
return {
...result,
errors: result.errors.map(normalizeBindingError),
warnings: result.warnings.map((w) => w.field0)
};
}
//#endregion
//#region src/utils/resolve-tsconfig.ts
const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
/**
* Cache for tsconfig resolution to avoid redundant file system operations.
*
* The cache stores resolved tsconfig configurations keyed by their file paths.
* When transforming multiple files in the same project, tsconfig lookups are
* deduplicated, improving performance.
*
* @category Utilities
* @experimental
*/
var TsconfigCache = class extends import_binding.TsconfigCache {
constructor() {
super(yarnPnp);
}
};
/** @hidden This is only expected to be used by Vite */
function resolveTsconfig(filename, cache) {
return (0, import_binding.resolveTsconfig)(filename, cache, yarnPnp);
}
//#endregion
export { minify as a, transformSync as i, resolveTsconfig as n, minifySync as o, transform as r, TsconfigCache as t };

View File

@@ -0,0 +1,40 @@
import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-yQC7KN8K.mjs";
//#region src/api/rolldown/index.ts
/**
* The API compatible with Rollup's `rollup` function.
*
* Unlike Rollup, the module graph is not built until the methods of the bundle object are called.
*
* @param input The input options object.
* @returns A Promise that resolves to a bundle object.
*
* @example
* ```js
* import { rolldown } from 'rolldown';
*
* let bundle, failed = false;
* try {
* bundle = await rolldown({
* input: 'src/main.js',
* });
* await bundle.write({
* format: 'esm',
* });
* } catch (e) {
* console.error(e);
* failed = true;
* }
* if (bundle) {
* await bundle.close();
* }
* process.exitCode = failed ? 1 : 0;
* ```
*
* @category Programmatic APIs
*/
const rolldown = async (input) => {
validateOption("input", input);
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
};
//#endregion
export { rolldown as t };

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,149 @@
import { a as RolldownLog } from "./logging-C6h4g8dA.mjs";
import { F as MinifyResult$1, H as SourceMap, L as ParseResult$1, P as MinifyOptions$1, R as ParserOptions$1, W as TsconfigCache$1, a as BindingEnhancedTransformOptions, o as BindingEnhancedTransformResult, v as BindingTsconfigResult } from "./binding-Dsq9Azhm.mjs";
//#region src/utils/resolve-tsconfig.d.ts
/**
* Cache for tsconfig resolution to avoid redundant file system operations.
*
* The cache stores resolved tsconfig configurations keyed by their file paths.
* When transforming multiple files in the same project, tsconfig lookups are
* deduplicated, improving performance.
*
* @category Utilities
* @experimental
*/
declare class TsconfigCache extends TsconfigCache$1 {
constructor();
}
/** @hidden This is only expected to be used by Vite */
declare function resolveTsconfig(filename: string, cache?: TsconfigCache | null): BindingTsconfigResult | null;
//#endregion
//#region src/utils/parse.d.ts
/**
* Result of parsing a code
*
* @category Utilities
*/
interface ParseResult extends ParseResult$1 {}
/**
* Options for parsing a code
*
* @category Utilities
*/
interface ParserOptions extends ParserOptions$1 {}
/**
* Parse JS/TS source asynchronously on a separate thread.
*
* Note that not all of the workload can happen on a separate thread.
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
* has to happen on current thread. This synchronous deserialization work typically outweighs
* the asynchronous parsing by a factor of between 3 and 20.
*
* i.e. the majority of the workload cannot be parallelized by using this method.
*
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
*
* @category Utilities
*/
declare function parse(filename: string, sourceText: string, options?: ParserOptions | null): Promise<ParseResult>;
/**
* Parse JS/TS source synchronously on current thread.
*
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
* (see {@linkcode parse} documentation for details).
*
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
* with {@linkcode parseSync} rather than using {@linkcode parse}.
*
* @category Utilities
*/
declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | null): ParseResult;
//#endregion
//#region src/utils/minify.d.ts
/**
* Options for minification.
*
* @category Utilities
*/
interface MinifyOptions extends MinifyOptions$1 {
inputMap?: SourceMap;
}
/**
* The result of minification.
*
* @category Utilities
*/
interface MinifyResult extends MinifyResult$1 {}
/**
* Minify asynchronously.
*
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
*
* @category Utilities
* @experimental
*/
declare function minify(filename: string, sourceText: string, options?: MinifyOptions | null): Promise<MinifyResult>;
/**
* Minify synchronously.
*
* @category Utilities
* @experimental
*/
declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions | null): MinifyResult;
//#endregion
//#region src/utils/transform.d.ts
/**
* Options for transforming a code.
*
* @category Utilities
*/
interface TransformOptions extends BindingEnhancedTransformOptions {}
/**
* Result of transforming a code.
*
* @category Utilities
*/
type TransformResult = Omit<BindingEnhancedTransformResult, "errors" | "warnings"> & {
errors: Error[];
warnings: RolldownLog[];
};
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
*
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns a promise that resolves to an object containing the transformed code,
* source maps, and any errors that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
declare function transform(filename: string, sourceText: string, options?: TransformOptions | null, cache?: TsconfigCache | null): Promise<TransformResult>;
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns an object containing the transformed code, source maps, and any errors
* that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
declare function transformSync(filename: string, sourceText: string, options?: TransformOptions | null, cache?: TsconfigCache | null): TransformResult;
//#endregion
export { MinifyOptions as a, minifySync as c, parse as d, parseSync as f, transformSync as i, ParseResult as l, resolveTsconfig as m, TransformResult as n, MinifyResult as o, TsconfigCache as p, transform as r, minify as s, TransformOptions as t, ParserOptions as u };

View File

@@ -0,0 +1,374 @@
import { n as __toESM, t as require_binding } from "./binding-BV_UWDF3.mjs";
import { o as logMultipleWatcherOption } from "./logs-D80CXhvg.mjs";
import { v as LOG_LEVEL_WARN } from "./bindingify-input-options-DoaqRULI.mjs";
import { t as arraify } from "./misc-DJYbNKZX.mjs";
import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-yQC7KN8K.mjs";
import { t as aggregateBindingErrorsIntoJsError } from "./error-BO4SlZV_.mjs";
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
/**
* This is not the set of all possible signals.
*
* It IS, however, the set of all signals that trigger
* an exit on either Linux or BSD systems. Linux is a
* superset of the signal names supported on BSD, and
* the unknown signals just fail to register, so we can
* catch that easily enough.
*
* Windows signals are a different set, since there are
* signals that terminate Windows processes, but don't
* terminate (or don't even exist) on Posix systems.
*
* Don't bother with SIGKILL. It's uncatchable, which
* means that we can't fire any callbacks anyway.
*
* If a user does happen to register a handler on a non-
* fatal signal like SIGWINCH or something, and then
* exit, it'll end up firing `process.emit('exit')`, so
* the handler will be fired anyway.
*
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
* artificially, inherently leave the process in a
* state from which it is not safe to try and enter JS
* listeners.
*/
const signals = [];
signals.push("SIGHUP", "SIGINT", "SIGTERM");
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
//#endregion
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
const kExitEmitter = Symbol.for("signal-exit emitter");
const global = globalThis;
const ObjectDefineProperty = Object.defineProperty.bind(Object);
var Emitter = class {
emitted = {
afterExit: false,
exit: false
};
listeners = {
afterExit: [],
exit: []
};
count = 0;
id = Math.random();
constructor() {
if (global[kExitEmitter]) return global[kExitEmitter];
ObjectDefineProperty(global, kExitEmitter, {
value: this,
writable: false,
enumerable: false,
configurable: false
});
}
on(ev, fn) {
this.listeners[ev].push(fn);
}
removeListener(ev, fn) {
const list = this.listeners[ev];
const i = list.indexOf(fn);
/* c8 ignore start */
if (i === -1) return;
/* c8 ignore stop */
if (i === 0 && list.length === 1) list.length = 0;
else list.splice(i, 1);
}
emit(ev, code, signal) {
if (this.emitted[ev]) return false;
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
return ret;
}
};
var SignalExitBase = class {};
const signalExitWrap = (handler) => {
return {
onExit(cb, opts) {
return handler.onExit(cb, opts);
},
load() {
return handler.load();
},
unload() {
return handler.unload();
}
};
};
var SignalExitFallback = class extends SignalExitBase {
onExit() {
return () => {};
}
load() {}
unload() {}
};
var SignalExit = class extends SignalExitBase {
/* c8 ignore start */
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
/* c8 ignore stop */
#emitter = new Emitter();
#process;
#originalProcessEmit;
#originalProcessReallyExit;
#sigListeners = {};
#loaded = false;
constructor(process) {
super();
this.#process = process;
this.#sigListeners = {};
for (const sig of signals) this.#sigListeners[sig] = () => {
const listeners = this.#process.listeners(sig);
let { count } = this.#emitter;
/* c8 ignore start */
const p = process;
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
/* c8 ignore stop */
if (listeners.length === count) {
this.unload();
const ret = this.#emitter.emit("exit", null, sig);
/* c8 ignore start */
const s = sig === "SIGHUP" ? this.#hupSig : sig;
if (!ret) process.kill(process.pid, s);
}
};
this.#originalProcessReallyExit = process.reallyExit;
this.#originalProcessEmit = process.emit;
}
onExit(cb, opts) {
/* c8 ignore start */
if (!processOk(this.#process)) return () => {};
/* c8 ignore stop */
if (this.#loaded === false) this.load();
const ev = opts?.alwaysLast ? "afterExit" : "exit";
this.#emitter.on(ev, cb);
return () => {
this.#emitter.removeListener(ev, cb);
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
};
}
load() {
if (this.#loaded) return;
this.#loaded = true;
this.#emitter.count += 1;
for (const sig of signals) try {
const fn = this.#sigListeners[sig];
if (fn) this.#process.on(sig, fn);
} catch (_) {}
this.#process.emit = (ev, ...a) => {
return this.#processEmit(ev, ...a);
};
this.#process.reallyExit = (code) => {
return this.#processReallyExit(code);
};
}
unload() {
if (!this.#loaded) return;
this.#loaded = false;
signals.forEach((sig) => {
const listener = this.#sigListeners[sig];
/* c8 ignore start */
if (!listener) throw new Error("Listener not defined for signal: " + sig);
/* c8 ignore stop */
try {
this.#process.removeListener(sig, listener);
} catch (_) {}
/* c8 ignore stop */
});
this.#process.emit = this.#originalProcessEmit;
this.#process.reallyExit = this.#originalProcessReallyExit;
this.#emitter.count -= 1;
}
#processReallyExit(code) {
/* c8 ignore start */
if (!processOk(this.#process)) return 0;
this.#process.exitCode = code || 0;
/* c8 ignore stop */
this.#emitter.emit("exit", this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
const og = this.#originalProcessEmit;
if (ev === "exit" && processOk(this.#process)) {
if (typeof args[0] === "number") this.#process.exitCode = args[0];
/* c8 ignore start */
const ret = og.call(this.#process, ev, ...args);
/* c8 ignore start */
this.#emitter.emit("exit", this.#process.exitCode, null);
/* c8 ignore stop */
return ret;
} else return og.call(this.#process, ev, ...args);
}
};
const process$1 = globalThis.process;
const { onExit: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
//#endregion
//#region src/utils/signal-exit.ts
function onExit(...args) {
if (typeof process === "object" && process.versions.webcontainer) {
process.on("exit", (code) => {
args[0](code, null);
});
return;
}
onExit$1(...args);
}
//#endregion
//#region src/api/watch/watch-emitter.ts
var WatcherEmitter = class {
listeners = /* @__PURE__ */ new Map();
on(event, listener) {
const listeners = this.listeners.get(event);
if (listeners) listeners.push(listener);
else this.listeners.set(event, [listener]);
return this;
}
off(event, listener) {
const listeners = this.listeners.get(event);
if (listeners) {
const index = listeners.indexOf(listener);
if (index !== -1) listeners.splice(index, 1);
}
return this;
}
clear(event) {
this.listeners.delete(event);
}
/** Async emit — sequential dispatch so side effects from earlier handlers
* (e.g. `event.result.close()` triggering `closeBundle`) are visible to later handlers. */
async emit(event, ...args) {
const handlers = this.listeners.get(event);
if (handlers?.length) for (const h of handlers) await h(...args);
}
async close() {}
};
//#endregion
//#region src/api/watch/watcher.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
function createEventCallback(emitter) {
return async (event) => {
switch (event.eventKind()) {
case "event": {
const code = event.bundleEventKind();
if (code === "BUNDLE_END") {
const { duration, output, result } = event.bundleEndData();
await emitter.emit("event", {
code: "BUNDLE_END",
duration,
output: [output],
result
});
} else if (code === "ERROR") {
const data = event.bundleErrorData();
await emitter.emit("event", {
code: "ERROR",
error: aggregateBindingErrorsIntoJsError(data.error),
result: data.result
});
} else await emitter.emit("event", { code });
break;
}
case "change": {
const { path, kind } = event.watchChangeData();
await emitter.emit("change", path, { event: kind });
break;
}
case "restart":
await emitter.emit("restart");
break;
case "close":
await emitter.emit("close");
break;
}
};
}
var Watcher = class {
closed;
inner;
emitter;
stopWorkers;
constructor(emitter, inner, stopWorkers) {
this.closed = false;
this.inner = inner;
this.emitter = emitter;
const originClose = emitter.close.bind(emitter);
emitter.close = async () => {
await this.close();
originClose();
};
this.stopWorkers = stopWorkers;
process.nextTick(() => this.run());
}
async close() {
if (this.closed) return;
this.closed = true;
for (const stop of this.stopWorkers) await stop?.();
await this.inner.close();
(0, import_binding.shutdownAsyncRuntime)();
}
async run() {
await this.inner.run();
this.inner.waitForClose();
}
};
async function createWatcher(emitter, input) {
const options = arraify(input);
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
})).flat());
warnMultiplePollingOptions(bundlerOptions);
const callback = createEventCallback(emitter);
new Watcher(emitter, new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), callback), bundlerOptions.map((option) => option.stopWorkers));
}
function warnMultiplePollingOptions(bundlerOptions) {
let found = false;
for (const option of bundlerOptions) {
const watch = option.inputOptions.watch;
const watcher = watch && typeof watch === "object" ? watch.watcher ?? watch.notify : void 0;
if (watcher && (watcher.usePolling != null || watcher.pollInterval != null)) {
if (found) {
option.onLog(LOG_LEVEL_WARN, logMultipleWatcherOption());
return;
}
found = true;
}
}
}
//#endregion
//#region src/api/watch/index.ts
/**
* The API compatible with Rollup's `watch` function.
*
* This function will rebuild the bundle when it detects that the individual modules have changed on disk.
*
* Note that when using this function, it is your responsibility to call `event.result.close()` in response to the `BUNDLE_END` event to avoid resource leaks.
*
* @param input The watch options object or the list of them.
* @returns A watcher object.
*
* @example
* ```js
* import { watch } from 'rolldown';
*
* const watcher = watch({ /* ... *\/ });
* watcher.on('event', (event) => {
* if (event.code === 'BUNDLE_END') {
* console.log(event.duration);
* event.result.close();
* }
* });
*
* // Stop watching
* watcher.close();
* ```
*
* @experimental
* @category Programmatic APIs
*/
function watch(input) {
const emitter = new WatcherEmitter();
createWatcher(emitter, input);
return emitter;
}
//#endregion
export { onExit as n, watch as t };

View File

@@ -0,0 +1,376 @@
import { _ as BindingTsconfigRawOptions, g as BindingTsconfigCompilerOptions } from "./shared/binding-Dsq9Azhm.mjs";
import { a as MinifyOptions, c as minifySync, d as parse, f as parseSync, i as transformSync, l as ParseResult, n as TransformResult, o as MinifyResult, p as TsconfigCache, r as transform, s as minify, t as TransformOptions, u as ParserOptions } from "./shared/transform-B5D1aA1B.mjs";
import * as ESTree from "@oxc-project/types";
import { Program } from "@oxc-project/types";
//#region ../../node_modules/.pnpm/oxc-parser@0.120.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts
interface VisitorObject$1 {
DebuggerStatement?: (node: ESTree.DebuggerStatement) => void;
"DebuggerStatement:exit"?: (node: ESTree.DebuggerStatement) => void;
EmptyStatement?: (node: ESTree.EmptyStatement) => void;
"EmptyStatement:exit"?: (node: ESTree.EmptyStatement) => void;
Literal?: (node: ESTree.BooleanLiteral | ESTree.NullLiteral | ESTree.NumericLiteral | ESTree.StringLiteral | ESTree.BigIntLiteral | ESTree.RegExpLiteral) => void;
"Literal:exit"?: (node: ESTree.BooleanLiteral | ESTree.NullLiteral | ESTree.NumericLiteral | ESTree.StringLiteral | ESTree.BigIntLiteral | ESTree.RegExpLiteral) => void;
PrivateIdentifier?: (node: ESTree.PrivateIdentifier) => void;
"PrivateIdentifier:exit"?: (node: ESTree.PrivateIdentifier) => void;
Super?: (node: ESTree.Super) => void;
"Super:exit"?: (node: ESTree.Super) => void;
TemplateElement?: (node: ESTree.TemplateElement) => void;
"TemplateElement:exit"?: (node: ESTree.TemplateElement) => void;
ThisExpression?: (node: ESTree.ThisExpression) => void;
"ThisExpression:exit"?: (node: ESTree.ThisExpression) => void;
JSXClosingFragment?: (node: ESTree.JSXClosingFragment) => void;
"JSXClosingFragment:exit"?: (node: ESTree.JSXClosingFragment) => void;
JSXEmptyExpression?: (node: ESTree.JSXEmptyExpression) => void;
"JSXEmptyExpression:exit"?: (node: ESTree.JSXEmptyExpression) => void;
JSXIdentifier?: (node: ESTree.JSXIdentifier) => void;
"JSXIdentifier:exit"?: (node: ESTree.JSXIdentifier) => void;
JSXOpeningFragment?: (node: ESTree.JSXOpeningFragment) => void;
"JSXOpeningFragment:exit"?: (node: ESTree.JSXOpeningFragment) => void;
JSXText?: (node: ESTree.JSXText) => void;
"JSXText:exit"?: (node: ESTree.JSXText) => void;
TSAnyKeyword?: (node: ESTree.TSAnyKeyword) => void;
"TSAnyKeyword:exit"?: (node: ESTree.TSAnyKeyword) => void;
TSBigIntKeyword?: (node: ESTree.TSBigIntKeyword) => void;
"TSBigIntKeyword:exit"?: (node: ESTree.TSBigIntKeyword) => void;
TSBooleanKeyword?: (node: ESTree.TSBooleanKeyword) => void;
"TSBooleanKeyword:exit"?: (node: ESTree.TSBooleanKeyword) => void;
TSIntrinsicKeyword?: (node: ESTree.TSIntrinsicKeyword) => void;
"TSIntrinsicKeyword:exit"?: (node: ESTree.TSIntrinsicKeyword) => void;
TSJSDocUnknownType?: (node: ESTree.JSDocUnknownType) => void;
"TSJSDocUnknownType:exit"?: (node: ESTree.JSDocUnknownType) => void;
TSNeverKeyword?: (node: ESTree.TSNeverKeyword) => void;
"TSNeverKeyword:exit"?: (node: ESTree.TSNeverKeyword) => void;
TSNullKeyword?: (node: ESTree.TSNullKeyword) => void;
"TSNullKeyword:exit"?: (node: ESTree.TSNullKeyword) => void;
TSNumberKeyword?: (node: ESTree.TSNumberKeyword) => void;
"TSNumberKeyword:exit"?: (node: ESTree.TSNumberKeyword) => void;
TSObjectKeyword?: (node: ESTree.TSObjectKeyword) => void;
"TSObjectKeyword:exit"?: (node: ESTree.TSObjectKeyword) => void;
TSStringKeyword?: (node: ESTree.TSStringKeyword) => void;
"TSStringKeyword:exit"?: (node: ESTree.TSStringKeyword) => void;
TSSymbolKeyword?: (node: ESTree.TSSymbolKeyword) => void;
"TSSymbolKeyword:exit"?: (node: ESTree.TSSymbolKeyword) => void;
TSThisType?: (node: ESTree.TSThisType) => void;
"TSThisType:exit"?: (node: ESTree.TSThisType) => void;
TSUndefinedKeyword?: (node: ESTree.TSUndefinedKeyword) => void;
"TSUndefinedKeyword:exit"?: (node: ESTree.TSUndefinedKeyword) => void;
TSUnknownKeyword?: (node: ESTree.TSUnknownKeyword) => void;
"TSUnknownKeyword:exit"?: (node: ESTree.TSUnknownKeyword) => void;
TSVoidKeyword?: (node: ESTree.TSVoidKeyword) => void;
"TSVoidKeyword:exit"?: (node: ESTree.TSVoidKeyword) => void;
AccessorProperty?: (node: ESTree.AccessorProperty) => void;
"AccessorProperty:exit"?: (node: ESTree.AccessorProperty) => void;
ArrayExpression?: (node: ESTree.ArrayExpression) => void;
"ArrayExpression:exit"?: (node: ESTree.ArrayExpression) => void;
ArrayPattern?: (node: ESTree.ArrayPattern) => void;
"ArrayPattern:exit"?: (node: ESTree.ArrayPattern) => void;
ArrowFunctionExpression?: (node: ESTree.ArrowFunctionExpression) => void;
"ArrowFunctionExpression:exit"?: (node: ESTree.ArrowFunctionExpression) => void;
AssignmentExpression?: (node: ESTree.AssignmentExpression) => void;
"AssignmentExpression:exit"?: (node: ESTree.AssignmentExpression) => void;
AssignmentPattern?: (node: ESTree.AssignmentPattern) => void;
"AssignmentPattern:exit"?: (node: ESTree.AssignmentPattern) => void;
AwaitExpression?: (node: ESTree.AwaitExpression) => void;
"AwaitExpression:exit"?: (node: ESTree.AwaitExpression) => void;
BinaryExpression?: (node: ESTree.BinaryExpression) => void;
"BinaryExpression:exit"?: (node: ESTree.BinaryExpression) => void;
BlockStatement?: (node: ESTree.BlockStatement) => void;
"BlockStatement:exit"?: (node: ESTree.BlockStatement) => void;
BreakStatement?: (node: ESTree.BreakStatement) => void;
"BreakStatement:exit"?: (node: ESTree.BreakStatement) => void;
CallExpression?: (node: ESTree.CallExpression) => void;
"CallExpression:exit"?: (node: ESTree.CallExpression) => void;
CatchClause?: (node: ESTree.CatchClause) => void;
"CatchClause:exit"?: (node: ESTree.CatchClause) => void;
ChainExpression?: (node: ESTree.ChainExpression) => void;
"ChainExpression:exit"?: (node: ESTree.ChainExpression) => void;
ClassBody?: (node: ESTree.ClassBody) => void;
"ClassBody:exit"?: (node: ESTree.ClassBody) => void;
ClassDeclaration?: (node: ESTree.Class) => void;
"ClassDeclaration:exit"?: (node: ESTree.Class) => void;
ClassExpression?: (node: ESTree.Class) => void;
"ClassExpression:exit"?: (node: ESTree.Class) => void;
ConditionalExpression?: (node: ESTree.ConditionalExpression) => void;
"ConditionalExpression:exit"?: (node: ESTree.ConditionalExpression) => void;
ContinueStatement?: (node: ESTree.ContinueStatement) => void;
"ContinueStatement:exit"?: (node: ESTree.ContinueStatement) => void;
Decorator?: (node: ESTree.Decorator) => void;
"Decorator:exit"?: (node: ESTree.Decorator) => void;
DoWhileStatement?: (node: ESTree.DoWhileStatement) => void;
"DoWhileStatement:exit"?: (node: ESTree.DoWhileStatement) => void;
ExportAllDeclaration?: (node: ESTree.ExportAllDeclaration) => void;
"ExportAllDeclaration:exit"?: (node: ESTree.ExportAllDeclaration) => void;
ExportDefaultDeclaration?: (node: ESTree.ExportDefaultDeclaration) => void;
"ExportDefaultDeclaration:exit"?: (node: ESTree.ExportDefaultDeclaration) => void;
ExportNamedDeclaration?: (node: ESTree.ExportNamedDeclaration) => void;
"ExportNamedDeclaration:exit"?: (node: ESTree.ExportNamedDeclaration) => void;
ExportSpecifier?: (node: ESTree.ExportSpecifier) => void;
"ExportSpecifier:exit"?: (node: ESTree.ExportSpecifier) => void;
ExpressionStatement?: (node: ESTree.ExpressionStatement) => void;
"ExpressionStatement:exit"?: (node: ESTree.ExpressionStatement) => void;
ForInStatement?: (node: ESTree.ForInStatement) => void;
"ForInStatement:exit"?: (node: ESTree.ForInStatement) => void;
ForOfStatement?: (node: ESTree.ForOfStatement) => void;
"ForOfStatement:exit"?: (node: ESTree.ForOfStatement) => void;
ForStatement?: (node: ESTree.ForStatement) => void;
"ForStatement:exit"?: (node: ESTree.ForStatement) => void;
FunctionDeclaration?: (node: ESTree.Function) => void;
"FunctionDeclaration:exit"?: (node: ESTree.Function) => void;
FunctionExpression?: (node: ESTree.Function) => void;
"FunctionExpression:exit"?: (node: ESTree.Function) => void;
Identifier?: (node: ESTree.IdentifierName | ESTree.IdentifierReference | ESTree.BindingIdentifier | ESTree.LabelIdentifier | ESTree.TSThisParameter | ESTree.TSIndexSignatureName) => void;
"Identifier:exit"?: (node: ESTree.IdentifierName | ESTree.IdentifierReference | ESTree.BindingIdentifier | ESTree.LabelIdentifier | ESTree.TSThisParameter | ESTree.TSIndexSignatureName) => void;
IfStatement?: (node: ESTree.IfStatement) => void;
"IfStatement:exit"?: (node: ESTree.IfStatement) => void;
ImportAttribute?: (node: ESTree.ImportAttribute) => void;
"ImportAttribute:exit"?: (node: ESTree.ImportAttribute) => void;
ImportDeclaration?: (node: ESTree.ImportDeclaration) => void;
"ImportDeclaration:exit"?: (node: ESTree.ImportDeclaration) => void;
ImportDefaultSpecifier?: (node: ESTree.ImportDefaultSpecifier) => void;
"ImportDefaultSpecifier:exit"?: (node: ESTree.ImportDefaultSpecifier) => void;
ImportExpression?: (node: ESTree.ImportExpression) => void;
"ImportExpression:exit"?: (node: ESTree.ImportExpression) => void;
ImportNamespaceSpecifier?: (node: ESTree.ImportNamespaceSpecifier) => void;
"ImportNamespaceSpecifier:exit"?: (node: ESTree.ImportNamespaceSpecifier) => void;
ImportSpecifier?: (node: ESTree.ImportSpecifier) => void;
"ImportSpecifier:exit"?: (node: ESTree.ImportSpecifier) => void;
LabeledStatement?: (node: ESTree.LabeledStatement) => void;
"LabeledStatement:exit"?: (node: ESTree.LabeledStatement) => void;
LogicalExpression?: (node: ESTree.LogicalExpression) => void;
"LogicalExpression:exit"?: (node: ESTree.LogicalExpression) => void;
MemberExpression?: (node: ESTree.MemberExpression) => void;
"MemberExpression:exit"?: (node: ESTree.MemberExpression) => void;
MetaProperty?: (node: ESTree.MetaProperty) => void;
"MetaProperty:exit"?: (node: ESTree.MetaProperty) => void;
MethodDefinition?: (node: ESTree.MethodDefinition) => void;
"MethodDefinition:exit"?: (node: ESTree.MethodDefinition) => void;
NewExpression?: (node: ESTree.NewExpression) => void;
"NewExpression:exit"?: (node: ESTree.NewExpression) => void;
ObjectExpression?: (node: ESTree.ObjectExpression) => void;
"ObjectExpression:exit"?: (node: ESTree.ObjectExpression) => void;
ObjectPattern?: (node: ESTree.ObjectPattern) => void;
"ObjectPattern:exit"?: (node: ESTree.ObjectPattern) => void;
ParenthesizedExpression?: (node: ESTree.ParenthesizedExpression) => void;
"ParenthesizedExpression:exit"?: (node: ESTree.ParenthesizedExpression) => void;
Program?: (node: ESTree.Program) => void;
"Program:exit"?: (node: ESTree.Program) => void;
Property?: (node: ESTree.ObjectProperty | ESTree.AssignmentTargetProperty | ESTree.AssignmentTargetPropertyProperty | ESTree.BindingProperty) => void;
"Property:exit"?: (node: ESTree.ObjectProperty | ESTree.AssignmentTargetProperty | ESTree.AssignmentTargetPropertyProperty | ESTree.BindingProperty) => void;
PropertyDefinition?: (node: ESTree.PropertyDefinition) => void;
"PropertyDefinition:exit"?: (node: ESTree.PropertyDefinition) => void;
RestElement?: (node: ESTree.AssignmentTargetRest | ESTree.BindingRestElement | ESTree.FormalParameterRest) => void;
"RestElement:exit"?: (node: ESTree.AssignmentTargetRest | ESTree.BindingRestElement | ESTree.FormalParameterRest) => void;
ReturnStatement?: (node: ESTree.ReturnStatement) => void;
"ReturnStatement:exit"?: (node: ESTree.ReturnStatement) => void;
SequenceExpression?: (node: ESTree.SequenceExpression) => void;
"SequenceExpression:exit"?: (node: ESTree.SequenceExpression) => void;
SpreadElement?: (node: ESTree.SpreadElement) => void;
"SpreadElement:exit"?: (node: ESTree.SpreadElement) => void;
StaticBlock?: (node: ESTree.StaticBlock) => void;
"StaticBlock:exit"?: (node: ESTree.StaticBlock) => void;
SwitchCase?: (node: ESTree.SwitchCase) => void;
"SwitchCase:exit"?: (node: ESTree.SwitchCase) => void;
SwitchStatement?: (node: ESTree.SwitchStatement) => void;
"SwitchStatement:exit"?: (node: ESTree.SwitchStatement) => void;
TaggedTemplateExpression?: (node: ESTree.TaggedTemplateExpression) => void;
"TaggedTemplateExpression:exit"?: (node: ESTree.TaggedTemplateExpression) => void;
TemplateLiteral?: (node: ESTree.TemplateLiteral) => void;
"TemplateLiteral:exit"?: (node: ESTree.TemplateLiteral) => void;
ThrowStatement?: (node: ESTree.ThrowStatement) => void;
"ThrowStatement:exit"?: (node: ESTree.ThrowStatement) => void;
TryStatement?: (node: ESTree.TryStatement) => void;
"TryStatement:exit"?: (node: ESTree.TryStatement) => void;
UnaryExpression?: (node: ESTree.UnaryExpression) => void;
"UnaryExpression:exit"?: (node: ESTree.UnaryExpression) => void;
UpdateExpression?: (node: ESTree.UpdateExpression) => void;
"UpdateExpression:exit"?: (node: ESTree.UpdateExpression) => void;
V8IntrinsicExpression?: (node: ESTree.V8IntrinsicExpression) => void;
"V8IntrinsicExpression:exit"?: (node: ESTree.V8IntrinsicExpression) => void;
VariableDeclaration?: (node: ESTree.VariableDeclaration) => void;
"VariableDeclaration:exit"?: (node: ESTree.VariableDeclaration) => void;
VariableDeclarator?: (node: ESTree.VariableDeclarator) => void;
"VariableDeclarator:exit"?: (node: ESTree.VariableDeclarator) => void;
WhileStatement?: (node: ESTree.WhileStatement) => void;
"WhileStatement:exit"?: (node: ESTree.WhileStatement) => void;
WithStatement?: (node: ESTree.WithStatement) => void;
"WithStatement:exit"?: (node: ESTree.WithStatement) => void;
YieldExpression?: (node: ESTree.YieldExpression) => void;
"YieldExpression:exit"?: (node: ESTree.YieldExpression) => void;
JSXAttribute?: (node: ESTree.JSXAttribute) => void;
"JSXAttribute:exit"?: (node: ESTree.JSXAttribute) => void;
JSXClosingElement?: (node: ESTree.JSXClosingElement) => void;
"JSXClosingElement:exit"?: (node: ESTree.JSXClosingElement) => void;
JSXElement?: (node: ESTree.JSXElement) => void;
"JSXElement:exit"?: (node: ESTree.JSXElement) => void;
JSXExpressionContainer?: (node: ESTree.JSXExpressionContainer) => void;
"JSXExpressionContainer:exit"?: (node: ESTree.JSXExpressionContainer) => void;
JSXFragment?: (node: ESTree.JSXFragment) => void;
"JSXFragment:exit"?: (node: ESTree.JSXFragment) => void;
JSXMemberExpression?: (node: ESTree.JSXMemberExpression) => void;
"JSXMemberExpression:exit"?: (node: ESTree.JSXMemberExpression) => void;
JSXNamespacedName?: (node: ESTree.JSXNamespacedName) => void;
"JSXNamespacedName:exit"?: (node: ESTree.JSXNamespacedName) => void;
JSXOpeningElement?: (node: ESTree.JSXOpeningElement) => void;
"JSXOpeningElement:exit"?: (node: ESTree.JSXOpeningElement) => void;
JSXSpreadAttribute?: (node: ESTree.JSXSpreadAttribute) => void;
"JSXSpreadAttribute:exit"?: (node: ESTree.JSXSpreadAttribute) => void;
JSXSpreadChild?: (node: ESTree.JSXSpreadChild) => void;
"JSXSpreadChild:exit"?: (node: ESTree.JSXSpreadChild) => void;
TSAbstractAccessorProperty?: (node: ESTree.AccessorProperty) => void;
"TSAbstractAccessorProperty:exit"?: (node: ESTree.AccessorProperty) => void;
TSAbstractMethodDefinition?: (node: ESTree.MethodDefinition) => void;
"TSAbstractMethodDefinition:exit"?: (node: ESTree.MethodDefinition) => void;
TSAbstractPropertyDefinition?: (node: ESTree.PropertyDefinition) => void;
"TSAbstractPropertyDefinition:exit"?: (node: ESTree.PropertyDefinition) => void;
TSArrayType?: (node: ESTree.TSArrayType) => void;
"TSArrayType:exit"?: (node: ESTree.TSArrayType) => void;
TSAsExpression?: (node: ESTree.TSAsExpression) => void;
"TSAsExpression:exit"?: (node: ESTree.TSAsExpression) => void;
TSCallSignatureDeclaration?: (node: ESTree.TSCallSignatureDeclaration) => void;
"TSCallSignatureDeclaration:exit"?: (node: ESTree.TSCallSignatureDeclaration) => void;
TSClassImplements?: (node: ESTree.TSClassImplements) => void;
"TSClassImplements:exit"?: (node: ESTree.TSClassImplements) => void;
TSConditionalType?: (node: ESTree.TSConditionalType) => void;
"TSConditionalType:exit"?: (node: ESTree.TSConditionalType) => void;
TSConstructSignatureDeclaration?: (node: ESTree.TSConstructSignatureDeclaration) => void;
"TSConstructSignatureDeclaration:exit"?: (node: ESTree.TSConstructSignatureDeclaration) => void;
TSConstructorType?: (node: ESTree.TSConstructorType) => void;
"TSConstructorType:exit"?: (node: ESTree.TSConstructorType) => void;
TSDeclareFunction?: (node: ESTree.Function) => void;
"TSDeclareFunction:exit"?: (node: ESTree.Function) => void;
TSEmptyBodyFunctionExpression?: (node: ESTree.Function) => void;
"TSEmptyBodyFunctionExpression:exit"?: (node: ESTree.Function) => void;
TSEnumBody?: (node: ESTree.TSEnumBody) => void;
"TSEnumBody:exit"?: (node: ESTree.TSEnumBody) => void;
TSEnumDeclaration?: (node: ESTree.TSEnumDeclaration) => void;
"TSEnumDeclaration:exit"?: (node: ESTree.TSEnumDeclaration) => void;
TSEnumMember?: (node: ESTree.TSEnumMember) => void;
"TSEnumMember:exit"?: (node: ESTree.TSEnumMember) => void;
TSExportAssignment?: (node: ESTree.TSExportAssignment) => void;
"TSExportAssignment:exit"?: (node: ESTree.TSExportAssignment) => void;
TSExternalModuleReference?: (node: ESTree.TSExternalModuleReference) => void;
"TSExternalModuleReference:exit"?: (node: ESTree.TSExternalModuleReference) => void;
TSFunctionType?: (node: ESTree.TSFunctionType) => void;
"TSFunctionType:exit"?: (node: ESTree.TSFunctionType) => void;
TSImportEqualsDeclaration?: (node: ESTree.TSImportEqualsDeclaration) => void;
"TSImportEqualsDeclaration:exit"?: (node: ESTree.TSImportEqualsDeclaration) => void;
TSImportType?: (node: ESTree.TSImportType) => void;
"TSImportType:exit"?: (node: ESTree.TSImportType) => void;
TSIndexSignature?: (node: ESTree.TSIndexSignature) => void;
"TSIndexSignature:exit"?: (node: ESTree.TSIndexSignature) => void;
TSIndexedAccessType?: (node: ESTree.TSIndexedAccessType) => void;
"TSIndexedAccessType:exit"?: (node: ESTree.TSIndexedAccessType) => void;
TSInferType?: (node: ESTree.TSInferType) => void;
"TSInferType:exit"?: (node: ESTree.TSInferType) => void;
TSInstantiationExpression?: (node: ESTree.TSInstantiationExpression) => void;
"TSInstantiationExpression:exit"?: (node: ESTree.TSInstantiationExpression) => void;
TSInterfaceBody?: (node: ESTree.TSInterfaceBody) => void;
"TSInterfaceBody:exit"?: (node: ESTree.TSInterfaceBody) => void;
TSInterfaceDeclaration?: (node: ESTree.TSInterfaceDeclaration) => void;
"TSInterfaceDeclaration:exit"?: (node: ESTree.TSInterfaceDeclaration) => void;
TSInterfaceHeritage?: (node: ESTree.TSInterfaceHeritage) => void;
"TSInterfaceHeritage:exit"?: (node: ESTree.TSInterfaceHeritage) => void;
TSIntersectionType?: (node: ESTree.TSIntersectionType) => void;
"TSIntersectionType:exit"?: (node: ESTree.TSIntersectionType) => void;
TSJSDocNonNullableType?: (node: ESTree.JSDocNonNullableType) => void;
"TSJSDocNonNullableType:exit"?: (node: ESTree.JSDocNonNullableType) => void;
TSJSDocNullableType?: (node: ESTree.JSDocNullableType) => void;
"TSJSDocNullableType:exit"?: (node: ESTree.JSDocNullableType) => void;
TSLiteralType?: (node: ESTree.TSLiteralType) => void;
"TSLiteralType:exit"?: (node: ESTree.TSLiteralType) => void;
TSMappedType?: (node: ESTree.TSMappedType) => void;
"TSMappedType:exit"?: (node: ESTree.TSMappedType) => void;
TSMethodSignature?: (node: ESTree.TSMethodSignature) => void;
"TSMethodSignature:exit"?: (node: ESTree.TSMethodSignature) => void;
TSModuleBlock?: (node: ESTree.TSModuleBlock) => void;
"TSModuleBlock:exit"?: (node: ESTree.TSModuleBlock) => void;
TSModuleDeclaration?: (node: ESTree.TSModuleDeclaration | ESTree.TSGlobalDeclaration) => void;
"TSModuleDeclaration:exit"?: (node: ESTree.TSModuleDeclaration | ESTree.TSGlobalDeclaration) => void;
TSNamedTupleMember?: (node: ESTree.TSNamedTupleMember) => void;
"TSNamedTupleMember:exit"?: (node: ESTree.TSNamedTupleMember) => void;
TSNamespaceExportDeclaration?: (node: ESTree.TSNamespaceExportDeclaration) => void;
"TSNamespaceExportDeclaration:exit"?: (node: ESTree.TSNamespaceExportDeclaration) => void;
TSNonNullExpression?: (node: ESTree.TSNonNullExpression) => void;
"TSNonNullExpression:exit"?: (node: ESTree.TSNonNullExpression) => void;
TSOptionalType?: (node: ESTree.TSOptionalType) => void;
"TSOptionalType:exit"?: (node: ESTree.TSOptionalType) => void;
TSParameterProperty?: (node: ESTree.TSParameterProperty) => void;
"TSParameterProperty:exit"?: (node: ESTree.TSParameterProperty) => void;
TSParenthesizedType?: (node: ESTree.TSParenthesizedType) => void;
"TSParenthesizedType:exit"?: (node: ESTree.TSParenthesizedType) => void;
TSPropertySignature?: (node: ESTree.TSPropertySignature) => void;
"TSPropertySignature:exit"?: (node: ESTree.TSPropertySignature) => void;
TSQualifiedName?: (node: ESTree.TSQualifiedName) => void;
"TSQualifiedName:exit"?: (node: ESTree.TSQualifiedName) => void;
TSRestType?: (node: ESTree.TSRestType) => void;
"TSRestType:exit"?: (node: ESTree.TSRestType) => void;
TSSatisfiesExpression?: (node: ESTree.TSSatisfiesExpression) => void;
"TSSatisfiesExpression:exit"?: (node: ESTree.TSSatisfiesExpression) => void;
TSTemplateLiteralType?: (node: ESTree.TSTemplateLiteralType) => void;
"TSTemplateLiteralType:exit"?: (node: ESTree.TSTemplateLiteralType) => void;
TSTupleType?: (node: ESTree.TSTupleType) => void;
"TSTupleType:exit"?: (node: ESTree.TSTupleType) => void;
TSTypeAliasDeclaration?: (node: ESTree.TSTypeAliasDeclaration) => void;
"TSTypeAliasDeclaration:exit"?: (node: ESTree.TSTypeAliasDeclaration) => void;
TSTypeAnnotation?: (node: ESTree.TSTypeAnnotation) => void;
"TSTypeAnnotation:exit"?: (node: ESTree.TSTypeAnnotation) => void;
TSTypeAssertion?: (node: ESTree.TSTypeAssertion) => void;
"TSTypeAssertion:exit"?: (node: ESTree.TSTypeAssertion) => void;
TSTypeLiteral?: (node: ESTree.TSTypeLiteral) => void;
"TSTypeLiteral:exit"?: (node: ESTree.TSTypeLiteral) => void;
TSTypeOperator?: (node: ESTree.TSTypeOperator) => void;
"TSTypeOperator:exit"?: (node: ESTree.TSTypeOperator) => void;
TSTypeParameter?: (node: ESTree.TSTypeParameter) => void;
"TSTypeParameter:exit"?: (node: ESTree.TSTypeParameter) => void;
TSTypeParameterDeclaration?: (node: ESTree.TSTypeParameterDeclaration) => void;
"TSTypeParameterDeclaration:exit"?: (node: ESTree.TSTypeParameterDeclaration) => void;
TSTypeParameterInstantiation?: (node: ESTree.TSTypeParameterInstantiation) => void;
"TSTypeParameterInstantiation:exit"?: (node: ESTree.TSTypeParameterInstantiation) => void;
TSTypePredicate?: (node: ESTree.TSTypePredicate) => void;
"TSTypePredicate:exit"?: (node: ESTree.TSTypePredicate) => void;
TSTypeQuery?: (node: ESTree.TSTypeQuery) => void;
"TSTypeQuery:exit"?: (node: ESTree.TSTypeQuery) => void;
TSTypeReference?: (node: ESTree.TSTypeReference) => void;
"TSTypeReference:exit"?: (node: ESTree.TSTypeReference) => void;
TSUnionType?: (node: ESTree.TSUnionType) => void;
"TSUnionType:exit"?: (node: ESTree.TSUnionType) => void;
}
//#endregion
//#region src/utils/visitor.d.ts
/**
* Visitor object for traversing AST.
*
* @category Utilities
*/
type VisitorObject = VisitorObject$1;
/**
* Visitor class for traversing AST.
*
* @example
* ```ts
* import { Visitor } from 'rolldown/utils';
* import { parseSync } from 'rolldown/utils';
*
* const result = parseSync(...);
* const visitor = new Visitor({
* VariableDeclaration(path) {
* // Do something with the variable declaration
* },
* "VariableDeclaration:exit"(path) {
* // Do something after visiting the variable declaration
* }
* });
* visitor.visit(result.program);
* ```
*
* @category Utilities
* @experimental
*/
declare class Visitor {
#private;
constructor(visitor: VisitorObject);
visit(program: Program): void;
}
//#endregion
export { type ESTree, type MinifyOptions, type MinifyResult, type ParseResult, type ParserOptions, type TransformOptions, type TransformResult, TsconfigCache, type BindingTsconfigCompilerOptions as TsconfigCompilerOptions, type BindingTsconfigRawOptions as TsconfigRawOptions, Visitor, type VisitorObject, minify, minifySync, parse, parseSync, transform, transformSync };

File diff suppressed because it is too large Load Diff