| //#region src/binding.d.cts | ||
| type MaybePromise<T> = T | Promise<T>; | ||
| type VoidNullable<T = void> = T | null | undefined | void; | ||
| type BindingStringOrRegex = string | RegExp; | ||
| interface CodegenOptions { | ||
| /** | ||
| * Remove whitespace. | ||
| * | ||
| * @default true | ||
| */ | ||
| removeWhitespace?: boolean; | ||
| } | ||
| interface CompressOptions { | ||
| /** | ||
| * Set desired EcmaScript standard version for output. | ||
| * | ||
| * Set `esnext` to enable all target highering. | ||
| * | ||
| * Example: | ||
| * | ||
| * * `'es2015'` | ||
| * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` | ||
| * | ||
| * @default 'esnext' | ||
| * | ||
| * @see [esbuild#target](https://esbuild.github.io/api/#target) | ||
| */ | ||
| target?: string | Array<string>; | ||
| /** | ||
| * Pass true to discard calls to `console.*`. | ||
| * | ||
| * @default false | ||
| */ | ||
| dropConsole?: boolean; | ||
| /** | ||
| * Remove `debugger;` statements. | ||
| * | ||
| * @default true | ||
| */ | ||
| dropDebugger?: boolean; | ||
| /** | ||
| * Pass `true` to drop unreferenced functions and variables. | ||
| * | ||
| * Simple direct variable assignments do not count as references unless set to `keep_assign`. | ||
| * @default true | ||
| */ | ||
| unused?: boolean | 'keep_assign'; | ||
| /** Keep function / class names. */ | ||
| keepNames?: CompressOptionsKeepNames; | ||
| /** | ||
| * Join consecutive var, let and const statements. | ||
| * | ||
| * @default true | ||
| */ | ||
| joinVars?: boolean; | ||
| /** | ||
| * Join consecutive simple statements using the comma operator. | ||
| * | ||
| * `a; b` -> `a, b` | ||
| * | ||
| * @default true | ||
| */ | ||
| sequences?: boolean; | ||
| /** | ||
| * Set of label names to drop from the code. | ||
| * | ||
| * Labeled statements matching these names will be removed during minification. | ||
| * | ||
| * @default [] | ||
| */ | ||
| dropLabels?: Array<string>; | ||
| /** Limit the maximum number of iterations for debugging purpose. */ | ||
| maxIterations?: number; | ||
| /** Treeshake options. */ | ||
| treeshake?: TreeShakeOptions; | ||
| } | ||
| interface CompressOptionsKeepNames { | ||
| /** | ||
| * Keep function names so that `Function.prototype.name` is preserved. | ||
| * | ||
| * This does not guarantee that the `undefined` name is preserved. | ||
| * | ||
| * @default false | ||
| */ | ||
| function: boolean; | ||
| /** | ||
| * Keep class names so that `Class.prototype.name` is preserved. | ||
| * | ||
| * This does not guarantee that the `undefined` name is preserved. | ||
| * | ||
| * @default false | ||
| */ | ||
| class: boolean; | ||
| } | ||
| interface MangleOptions { | ||
| /** | ||
| * Pass `true` to mangle names declared in the top level scope. | ||
| * | ||
| * @default true for modules and commonjs, otherwise false | ||
| */ | ||
| toplevel?: boolean; | ||
| /** | ||
| * Preserve `name` property for functions and classes. | ||
| * | ||
| * @default false | ||
| */ | ||
| keepNames?: boolean | MangleOptionsKeepNames; | ||
| /** Debug mangled names. */ | ||
| debug?: boolean; | ||
| } | ||
| interface MangleOptionsKeepNames { | ||
| /** | ||
| * Preserve `name` property for functions. | ||
| * | ||
| * @default false | ||
| */ | ||
| function: boolean; | ||
| /** | ||
| * Preserve `name` property for classes. | ||
| * | ||
| * @default false | ||
| */ | ||
| class: boolean; | ||
| } | ||
| interface MinifyOptions { | ||
| /** Use when minifying an ES module. */ | ||
| module?: boolean; | ||
| compress?: boolean | CompressOptions; | ||
| mangle?: boolean | MangleOptions; | ||
| codegen?: boolean | CodegenOptions; | ||
| sourcemap?: boolean; | ||
| } | ||
| interface MinifyResult { | ||
| code: string; | ||
| map?: SourceMap; | ||
| errors: Array<OxcError>; | ||
| } | ||
| interface TreeShakeOptions { | ||
| /** | ||
| * Whether to respect the pure annotations. | ||
| * | ||
| * Pure annotations are comments that mark an expression as pure. | ||
| * For example: @__PURE__ or #__NO_SIDE_EFFECTS__. | ||
| * | ||
| * @default true | ||
| */ | ||
| annotations?: boolean; | ||
| /** | ||
| * Whether to treat this function call as pure. | ||
| * | ||
| * This function is called for normal function calls, new calls, and | ||
| * tagged template calls. | ||
| */ | ||
| manualPureFunctions?: Array<string>; | ||
| /** | ||
| * Whether property read accesses have side effects. | ||
| * | ||
| * @default 'always' | ||
| */ | ||
| propertyReadSideEffects?: boolean | 'always'; | ||
| /** | ||
| * Whether property write accesses (assignments to member expressions) have side effects. | ||
| * | ||
| * When false, assignments like `obj.prop = value` are considered side-effect-free | ||
| * (assuming the object and value expressions themselves are side-effect-free). | ||
| * | ||
| * @default true | ||
| */ | ||
| propertyWriteSideEffects?: boolean; | ||
| /** | ||
| * Whether accessing a global variable has side effects. | ||
| * | ||
| * Accessing a non-existing global variable will throw an error. | ||
| * Global variable may be a getter that has side effects. | ||
| * | ||
| * @default true | ||
| */ | ||
| unknownGlobalSideEffects?: boolean; | ||
| /** | ||
| * Whether invalid import statements have side effects. | ||
| * | ||
| * Accessing a non-existing import name will throw an error. | ||
| * Also import statements that cannot be resolved will throw an error. | ||
| * | ||
| * @default true | ||
| */ | ||
| invalidImportSideEffects?: boolean; | ||
| } | ||
| interface Comment { | ||
| type: 'Line' | 'Block'; | ||
| value: string; | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface ErrorLabel { | ||
| message: string | null; | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface OxcError { | ||
| severity: Severity; | ||
| message: string; | ||
| labels: Array<ErrorLabel>; | ||
| helpMessage: string | null; | ||
| codeframe: string | null; | ||
| } | ||
| type Severity = 'Error' | 'Warning' | 'Advice'; | ||
| declare class ParseResult { | ||
| get program(): import("@oxc-project/types").Program; | ||
| get module(): EcmaScriptModule; | ||
| get comments(): Array<Comment>; | ||
| get errors(): Array<OxcError>; | ||
| } | ||
| interface DynamicImport { | ||
| start: number; | ||
| end: number; | ||
| moduleRequest: Span; | ||
| } | ||
| interface EcmaScriptModule { | ||
| /** | ||
| * Has ESM syntax. | ||
| * | ||
| * i.e. `import` and `export` statements, and `import.meta`. | ||
| * | ||
| * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files. | ||
| */ | ||
| hasModuleSyntax: boolean; | ||
| /** Import statements. */ | ||
| staticImports: Array<StaticImport>; | ||
| /** Export statements. */ | ||
| staticExports: Array<StaticExport>; | ||
| /** Dynamic import expressions. */ | ||
| dynamicImports: Array<DynamicImport>; | ||
| /** Span positions` of `import.meta` */ | ||
| importMetas: Array<Span>; | ||
| } | ||
| interface ExportExportName { | ||
| kind: ExportExportNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ExportExportNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' | /** `export * from "mod" */'None'; | ||
| interface ExportImportName { | ||
| kind: ExportImportNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ExportImportNameKind = /** `export { name } */'Name' | /** `export * as ns from "mod"` */'All' | /** `export * from "mod"` */'AllButDefault' | /** Does not have a specifier. */'None'; | ||
| interface ExportLocalName { | ||
| kind: ExportLocalNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ExportLocalNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' | | ||
| /** | ||
| * If the exported value is not locally accessible from within the module. | ||
| * `export default function () {}` | ||
| */ | ||
| 'None'; | ||
| interface ImportName { | ||
| kind: ImportNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ImportNameKind = /** `import { x } from "mod"` */'Name' | /** `import * as ns from "mod"` */'NamespaceObject' | /** `import defaultExport from "mod"` */'Default'; | ||
| interface ParserOptions { | ||
| /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */ | ||
| lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; | ||
| /** Treat the source text as `script` or `module` code. */ | ||
| sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined; | ||
| /** | ||
| * Return an AST which includes TypeScript-related properties, or excludes them. | ||
| * | ||
| * `'js'` is default for JS / JSX files. | ||
| * `'ts'` is default for TS / TSX files. | ||
| * The type of the file is determined from `lang` option, or extension of provided `filename`. | ||
| */ | ||
| astType?: 'js' | 'ts'; | ||
| /** | ||
| * Controls whether the `range` property is included on AST nodes. | ||
| * The `range` property is a `[number, number]` which indicates the start/end offsets | ||
| * of the node in the file contents. | ||
| * | ||
| * @default false | ||
| */ | ||
| range?: boolean; | ||
| /** | ||
| * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. | ||
| * | ||
| * If this option is true, parenthesized expressions are represented by | ||
| * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that | ||
| * have a single `expression` property containing the expression inside parentheses. | ||
| * | ||
| * @default true | ||
| */ | ||
| preserveParens?: boolean; | ||
| /** | ||
| * Produce semantic errors with an additional AST pass. | ||
| * Semantic errors depend on symbols and scopes, where the parser does not construct. | ||
| * This adds a small performance overhead. | ||
| * | ||
| * @default false | ||
| */ | ||
| showSemanticErrors?: boolean; | ||
| } | ||
| interface Span { | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface StaticExport { | ||
| start: number; | ||
| end: number; | ||
| entries: Array<StaticExportEntry>; | ||
| } | ||
| interface StaticExportEntry { | ||
| start: number; | ||
| end: number; | ||
| moduleRequest: ValueSpan | null; | ||
| /** The name under which the desired binding is exported by the module`. */ | ||
| importName: ExportImportName; | ||
| /** The name used to export this binding by this module. */ | ||
| exportName: ExportExportName; | ||
| /** The name that is used to locally access the exported value from within the importing module. */ | ||
| localName: ExportLocalName; | ||
| /** | ||
| * Whether the export is a TypeScript `export type`. | ||
| * | ||
| * Examples: | ||
| * | ||
| * ```ts | ||
| * export type * from 'mod'; | ||
| * export type * as ns from 'mod'; | ||
| * export type { foo }; | ||
| * export { type foo }: | ||
| * export type { foo } from 'mod'; | ||
| * ``` | ||
| */ | ||
| isType: boolean; | ||
| } | ||
| interface StaticImport { | ||
| /** Start of import statement. */ | ||
| start: number; | ||
| /** End of import statement. */ | ||
| end: number; | ||
| /** | ||
| * Import source. | ||
| * | ||
| * ```js | ||
| * import { foo } from "mod"; | ||
| * // ^^^ | ||
| * ``` | ||
| */ | ||
| moduleRequest: ValueSpan; | ||
| /** | ||
| * Import specifiers. | ||
| * | ||
| * Empty for `import "mod"`. | ||
| */ | ||
| entries: Array<StaticImportEntry>; | ||
| } | ||
| interface StaticImportEntry { | ||
| /** | ||
| * The name under which the desired binding is exported by the module. | ||
| * | ||
| * ```js | ||
| * import { foo } from "mod"; | ||
| * // ^^^ | ||
| * import { foo as bar } from "mod"; | ||
| * // ^^^ | ||
| * ``` | ||
| */ | ||
| importName: ImportName; | ||
| /** | ||
| * The name that is used to locally access the imported value from within the importing module. | ||
| * ```js | ||
| * import { foo } from "mod"; | ||
| * // ^^^ | ||
| * import { foo as bar } from "mod"; | ||
| * // ^^^ | ||
| * ``` | ||
| */ | ||
| localName: ValueSpan; | ||
| /** | ||
| * Whether this binding is for a TypeScript type-only import. | ||
| * | ||
| * `true` for the following imports: | ||
| * ```ts | ||
| * import type { foo } from "mod"; | ||
| * import { type foo } from "mod"; | ||
| * ``` | ||
| */ | ||
| isType: boolean; | ||
| } | ||
| interface ValueSpan { | ||
| value: string; | ||
| start: number; | ||
| end: number; | ||
| } | ||
| declare class ResolverFactory { | ||
| constructor(options?: NapiResolveOptions | undefined | null); | ||
| static default(): ResolverFactory; | ||
| /** Clone the resolver using the same underlying cache. */ | ||
| cloneWithOptions(options: NapiResolveOptions): ResolverFactory; | ||
| /** | ||
| * Clear the underlying cache. | ||
| * | ||
| * Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result. | ||
| */ | ||
| clearCache(): void; | ||
| /** Synchronously resolve `specifier` at an absolute path to a `directory`. */ | ||
| sync(directory: string, request: string): ResolveResult; | ||
| /** Asynchronously resolve `specifier` at an absolute path to a `directory`. */ | ||
| async(directory: string, request: string): Promise<ResolveResult>; | ||
| /** | ||
| * Synchronously resolve `specifier` at an absolute path to a `file`. | ||
| * | ||
| * This method automatically discovers tsconfig.json by traversing parent directories. | ||
| */ | ||
| resolveFileSync(file: string, request: string): ResolveResult; | ||
| /** | ||
| * Asynchronously resolve `specifier` at an absolute path to a `file`. | ||
| * | ||
| * This method automatically discovers tsconfig.json by traversing parent directories. | ||
| */ | ||
| resolveFileAsync(file: string, request: string): Promise<ResolveResult>; | ||
| /** | ||
| * Synchronously resolve `specifier` for TypeScript declaration files. | ||
| * | ||
| * `file` is the absolute path to the containing file. | ||
| * Uses TypeScript's `moduleResolution: "bundler"` algorithm. | ||
| */ | ||
| resolveDtsSync(file: string, request: string): ResolveResult; | ||
| /** | ||
| * Asynchronously resolve `specifier` for TypeScript declaration files. | ||
| * | ||
| * `file` is the absolute path to the containing file. | ||
| * Uses TypeScript's `moduleResolution: "bundler"` algorithm. | ||
| */ | ||
| resolveDtsAsync(file: string, request: string): Promise<ResolveResult>; | ||
| } | ||
| /** Node.js builtin module when `Options::builtin_modules` is enabled. */ | ||
| interface Builtin { | ||
| /** | ||
| * Resolved module. | ||
| * | ||
| * Always prefixed with "node:" in compliance with the ESM specification. | ||
| */ | ||
| resolved: string; | ||
| /** | ||
| * Whether the request was prefixed with `node:` or not. | ||
| * `fs` -> `false`. | ||
| * `node:fs` returns `true`. | ||
| */ | ||
| isRuntimeModule: boolean; | ||
| } | ||
| declare enum EnforceExtension { | ||
| Auto = 0, | ||
| Enabled = 1, | ||
| Disabled = 2 | ||
| } | ||
| type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon'; | ||
| /** | ||
| * Module Resolution Options | ||
| * | ||
| * Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options). | ||
| * | ||
| * See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples | ||
| */ | ||
| interface NapiResolveOptions { | ||
| /** | ||
| * Discover tsconfig automatically or use the specified tsconfig.json path. | ||
| * | ||
| * Default `None` | ||
| */ | ||
| tsconfig?: 'auto' | TsconfigOptions; | ||
| /** | ||
| * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback]. | ||
| * | ||
| * For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) -> | ||
| * AliasValue::Path(String)` | ||
| * Create aliases to import or require certain modules more easily. | ||
| * A trailing $ can also be added to the given object's keys to signify an exact match. | ||
| * Default `{}` | ||
| */ | ||
| alias?: Record<string, Array<string | undefined | null>>; | ||
| /** | ||
| * A list of alias fields in description files. | ||
| * Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec). | ||
| * Can be a path to json object such as `["path", "to", "exports"]`. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| aliasFields?: (string | string[])[]; | ||
| /** | ||
| * Condition names for exports field which defines entry points of a package. | ||
| * The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| conditionNames?: Array<string>; | ||
| /** | ||
| * If true, it will not allow extension-less files. | ||
| * So by default `require('./foo')` works if `./foo` has a `.js` extension, | ||
| * but with this enabled only `require('./foo.js')` will work. | ||
| * | ||
| * Default to `true` when [ResolveOptions::extensions] contains an empty string. | ||
| * Use `Some(false)` to disable the behavior. | ||
| * See <https://github.com/webpack/enhanced-resolve/pull/285> | ||
| * | ||
| * Default None, which is the same as `Some(false)` when the above empty rule is not applied. | ||
| */ | ||
| enforceExtension?: EnforceExtension; | ||
| /** | ||
| * A list of exports fields in description files. | ||
| * Can be a path to json object such as `["path", "to", "exports"]`. | ||
| * | ||
| * Default `[["exports"]]`. | ||
| */ | ||
| exportsFields?: (string | string[])[]; | ||
| /** | ||
| * Fields from `package.json` which are used to provide the internal requests of a package | ||
| * (requests starting with # are considered internal). | ||
| * | ||
| * Can be a path to a JSON object such as `["path", "to", "imports"]`. | ||
| * | ||
| * Default `[["imports"]]`. | ||
| */ | ||
| importsFields?: (string | string[])[]; | ||
| /** | ||
| * An object which maps extension to extension aliases. | ||
| * | ||
| * Default `{}` | ||
| */ | ||
| extensionAlias?: Record<string, Array<string>>; | ||
| /** | ||
| * Attempt to resolve these extensions in order. | ||
| * If multiple files share the same name but have different extensions, | ||
| * will resolve the one with the extension listed first in the array and skip the rest. | ||
| * | ||
| * Default `[".js", ".json", ".node"]` | ||
| */ | ||
| extensions?: Array<string>; | ||
| /** | ||
| * Redirect module requests when normal resolving fails. | ||
| * | ||
| * Default `{}` | ||
| */ | ||
| fallback?: Record<string, Array<string | undefined | null>>; | ||
| /** | ||
| * Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests). | ||
| * | ||
| * See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified) | ||
| * | ||
| * Default `false` | ||
| */ | ||
| fullySpecified?: boolean; | ||
| /** | ||
| * A list of main fields in description files | ||
| * | ||
| * Default `["main"]`. | ||
| */ | ||
| mainFields?: string | string[]; | ||
| /** | ||
| * The filename to be used while resolving directories. | ||
| * | ||
| * Default `["index"]` | ||
| */ | ||
| mainFiles?: Array<string>; | ||
| /** | ||
| * A list of directories to resolve modules from, can be absolute path or folder name. | ||
| * | ||
| * Default `["node_modules"]` | ||
| */ | ||
| modules?: string | string[]; | ||
| /** | ||
| * Resolve to a context instead of a file. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| resolveToContext?: boolean; | ||
| /** | ||
| * Prefer to resolve module requests as relative requests instead of using modules from node_modules directories. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| preferRelative?: boolean; | ||
| /** | ||
| * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| preferAbsolute?: boolean; | ||
| /** | ||
| * A list of resolve restrictions to restrict the paths that a request can be resolved on. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| restrictions?: Array<Restriction>; | ||
| /** | ||
| * A list of directories where requests of server-relative URLs (starting with '/') are resolved. | ||
| * On non-Windows systems these requests are resolved as an absolute path first. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| roots?: Array<string>; | ||
| /** | ||
| * Whether to resolve symlinks to their symlinked location. | ||
| * When enabled, symlinked resources are resolved to their real path, not their symlinked location. | ||
| * Note that this may cause module resolution to fail when using tools that symlink packages (like npm link). | ||
| * | ||
| * Default `true` | ||
| */ | ||
| symlinks?: boolean; | ||
| /** | ||
| * Whether to read the `NODE_PATH` environment variable and append its entries to `modules`. | ||
| * | ||
| * `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution. | ||
| * Set this to `false` to disable the behavior. | ||
| * | ||
| * Default `true` | ||
| */ | ||
| nodePath?: boolean; | ||
| /** | ||
| * Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not. | ||
| * For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| builtinModules?: boolean; | ||
| /** | ||
| * Resolve [ResolveResult::moduleType]. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| moduleType?: boolean; | ||
| /** | ||
| * Allow `exports` field in `require('../directory')`. | ||
| * | ||
| * This is not part of the spec but some vite projects rely on this behavior. | ||
| * See | ||
| * * <https://github.com/vitejs/vite/pull/20252> | ||
| * * <https://github.com/nodejs/node/issues/58827> | ||
| * | ||
| * Default: `false` | ||
| */ | ||
| allowPackageExportsInDirectoryResolve?: boolean; | ||
| } | ||
| interface ResolveResult { | ||
| path?: string; | ||
| error?: string; | ||
| builtin?: Builtin; | ||
| /** | ||
| * Module type for this path. | ||
| * | ||
| * Enable with `ResolveOptions#moduleType`. | ||
| * | ||
| * The module type is computed `ESM_FILE_FORMAT` from the [ESM resolution algorithm specification](https://nodejs.org/docs/latest/api/esm.html#resolution-algorithm-specification). | ||
| * | ||
| * The algorithm uses the file extension or finds the closest `package.json` with the `type` field. | ||
| */ | ||
| moduleType?: ModuleType; | ||
| /** `package.json` path for the given module. */ | ||
| packageJsonPath?: string; | ||
| } | ||
| /** | ||
| * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback]. | ||
| * Use struct because napi don't support structured union now | ||
| */ | ||
| interface Restriction { | ||
| path?: string; | ||
| regex?: string; | ||
| } | ||
| /** | ||
| * Tsconfig Options | ||
| * | ||
| * Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options) | ||
| */ | ||
| interface TsconfigOptions { | ||
| /** | ||
| * Allows you to specify where to find the TypeScript configuration file. | ||
| * You may provide | ||
| * * a relative path to the configuration file. It will be resolved relative to cwd. | ||
| * * an absolute path to the configuration file. | ||
| */ | ||
| configFile: string; | ||
| /** | ||
| * Support for Typescript Project References. | ||
| * | ||
| * * `'auto'`: use the `references` field from tsconfig of `config_file`. | ||
| */ | ||
| references?: 'auto'; | ||
| } | ||
| interface SourceMap { | ||
| file?: string; | ||
| mappings: string; | ||
| names: Array<string>; | ||
| sourceRoot?: string; | ||
| sources: Array<string>; | ||
| sourcesContent?: Array<string>; | ||
| version: number; | ||
| x_google_ignoreList?: Array<number>; | ||
| } | ||
| interface CompilerAssumptions { | ||
| ignoreFunctionLength?: boolean; | ||
| noDocumentAll?: boolean; | ||
| objectRestNoSymbols?: boolean; | ||
| pureGetters?: boolean; | ||
| /** | ||
| * When using public class fields, assume that they don't shadow any getter in the current class, | ||
| * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using | ||
| * `Object.defineProperty`. | ||
| * | ||
| * For example: | ||
| * | ||
| * Input: | ||
| * ```js | ||
| * class Test { | ||
| * field = 2; | ||
| * | ||
| * static staticField = 3; | ||
| * } | ||
| * ``` | ||
| * | ||
| * When `set_public_class_fields` is `true`, the output will be: | ||
| * ```js | ||
| * class Test { | ||
| * constructor() { | ||
| * this.field = 2; | ||
| * } | ||
| * } | ||
| * Test.staticField = 3; | ||
| * ``` | ||
| * | ||
| * Otherwise, the output will be: | ||
| * ```js | ||
| * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty"; | ||
| * class Test { | ||
| * constructor() { | ||
| * _defineProperty(this, "field", 2); | ||
| * } | ||
| * } | ||
| * _defineProperty(Test, "staticField", 3); | ||
| * ``` | ||
| * | ||
| * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should | ||
| * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`] | ||
| * to `true`. | ||
| */ | ||
| setPublicClassFields?: boolean; | ||
| } | ||
| interface DecoratorOptions { | ||
| /** | ||
| * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process. | ||
| * | ||
| * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification. | ||
| * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39. | ||
| * | ||
| * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators | ||
| * @default false | ||
| */ | ||
| legacy?: boolean; | ||
| /** | ||
| * Enables emitting decorator metadata. | ||
| * | ||
| * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata) | ||
| * in TypeScript, and it only works when `legacy` is true. | ||
| * | ||
| * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata | ||
| * @default false | ||
| */ | ||
| emitDecoratorMetadata?: boolean; | ||
| } | ||
| type HelperMode = | ||
| /** | ||
| * Runtime mode (default): Helper functions are imported from a runtime package. | ||
| * | ||
| * Example: | ||
| * | ||
| * ```js | ||
| * import helperName from "@oxc-project/runtime/helpers/helperName"; | ||
| * helperName(...arguments); | ||
| * ``` | ||
| */ | ||
| 'Runtime' | | ||
| /** | ||
| * External mode: Helper functions are accessed from a global `babelHelpers` object. | ||
| * | ||
| * Example: | ||
| * | ||
| * ```js | ||
| * babelHelpers.helperName(...arguments); | ||
| * ``` | ||
| */ | ||
| 'External'; | ||
| interface Helpers { | ||
| mode?: HelperMode; | ||
| } | ||
| /** | ||
| * TypeScript Isolated Declarations for Standalone DTS Emit (async) | ||
| * | ||
| * Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread. | ||
| */ | ||
| declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): Promise<IsolatedDeclarationsResult>; | ||
| interface IsolatedDeclarationsOptions { | ||
| /** | ||
| * Do not emit declarations for code that has an @internal annotation in its JSDoc comment. | ||
| * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid. | ||
| * | ||
| * Default: `false` | ||
| * | ||
| * See <https://www.typescriptlang.org/tsconfig/#stripInternal> | ||
| */ | ||
| stripInternal?: boolean; | ||
| sourcemap?: boolean; | ||
| } | ||
| interface IsolatedDeclarationsResult { | ||
| code: string; | ||
| map?: SourceMap; | ||
| errors: Array<OxcError>; | ||
| } | ||
| /** TypeScript Isolated Declarations for Standalone DTS Emit */ | ||
| declare function isolatedDeclarationSync(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult; | ||
| /** | ||
| * Configure how TSX and JSX are transformed. | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx} | ||
| */ | ||
| interface JsxOptions { | ||
| /** | ||
| * Decides which runtime to use. | ||
| * | ||
| * - 'automatic' - auto-import the correct JSX factories | ||
| * - 'classic' - no auto-import | ||
| * | ||
| * @default 'automatic' | ||
| */ | ||
| runtime?: 'classic' | 'automatic'; | ||
| /** | ||
| * Emit development-specific information, such as `__source` and `__self`. | ||
| * | ||
| * @default false | ||
| */ | ||
| development?: boolean; | ||
| /** | ||
| * Toggles whether or not to throw an error if an XML namespaced tag name | ||
| * is used. | ||
| * | ||
| * Though the JSX spec allows this, it is disabled by default since React's | ||
| * JSX does not currently have support for it. | ||
| * | ||
| * @default true | ||
| */ | ||
| throwIfNamespace?: boolean; | ||
| /** | ||
| * Mark JSX elements and top-level React method calls as pure for tree shaking. | ||
| * | ||
| * @default true | ||
| */ | ||
| pure?: boolean; | ||
| /** | ||
| * Replaces the import source when importing functions. | ||
| * | ||
| * @default 'react' | ||
| */ | ||
| importSource?: string; | ||
| /** | ||
| * Replace the function used when compiling JSX expressions. It should be a | ||
| * qualified name (e.g. `React.createElement`) or an identifier (e.g. | ||
| * `createElement`). | ||
| * | ||
| * Only used for `classic` {@link runtime}. | ||
| * | ||
| * @default 'React.createElement' | ||
| */ | ||
| pragma?: string; | ||
| /** | ||
| * Replace the component used when compiling JSX fragments. It should be a | ||
| * valid JSX tag name. | ||
| * | ||
| * Only used for `classic` {@link runtime}. | ||
| * | ||
| * @default 'React.Fragment' | ||
| */ | ||
| pragmaFrag?: string; | ||
| /** | ||
| * Enable React Fast Refresh . | ||
| * | ||
| * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh} | ||
| * | ||
| * @default false | ||
| */ | ||
| refresh?: boolean | ReactRefreshOptions; | ||
| } | ||
| /** | ||
| * Transform JavaScript code to a Vite Node runnable module. | ||
| * | ||
| * @param filename The name of the file being transformed. | ||
| * @param sourceText the source code itself | ||
| * @param options The options for the transformation. See {@link | ||
| * ModuleRunnerTransformOptions} for more information. | ||
| * | ||
| * @returns an object containing the transformed code, source maps, and any | ||
| * errors that occurred during parsing or transformation. | ||
| * | ||
| * Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread. | ||
| * | ||
| * @deprecated Only works for Vite. | ||
| */ | ||
| declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): Promise<ModuleRunnerTransformResult>; | ||
| interface ModuleRunnerTransformOptions { | ||
| /** | ||
| * Enable source map generation. | ||
| * | ||
| * When `true`, the `sourceMap` field of transform result objects will be populated. | ||
| * | ||
| * @default false | ||
| * | ||
| * @see {@link SourceMap} | ||
| */ | ||
| sourcemap?: boolean; | ||
| } | ||
| interface ModuleRunnerTransformResult { | ||
| /** | ||
| * The transformed code. | ||
| * | ||
| * If parsing failed, this will be an empty string. | ||
| */ | ||
| code: string; | ||
| /** | ||
| * The source map for the transformed code. | ||
| * | ||
| * This will be set if {@link TransformOptions#sourcemap} is `true`. | ||
| */ | ||
| map?: SourceMap; | ||
| deps: Array<string>; | ||
| dynamicDeps: Array<string>; | ||
| /** | ||
| * Parse and transformation errors. | ||
| * | ||
| * Oxc's parser recovers from common syntax errors, meaning that | ||
| * transformed code may still be available even if there are errors in this | ||
| * list. | ||
| */ | ||
| errors: Array<OxcError>; | ||
| } | ||
| interface PluginsOptions { | ||
| styledComponents?: StyledComponentsOptions; | ||
| taggedTemplateEscape?: boolean; | ||
| } | ||
| interface ReactRefreshOptions { | ||
| /** | ||
| * Specify the identifier of the refresh registration variable. | ||
| * | ||
| * @default `$RefreshReg$`. | ||
| */ | ||
| refreshReg?: string; | ||
| /** | ||
| * Specify the identifier of the refresh signature variable. | ||
| * | ||
| * @default `$RefreshSig$`. | ||
| */ | ||
| refreshSig?: string; | ||
| emitFullSignatures?: boolean; | ||
| } | ||
| /** | ||
| * Configure how styled-components are transformed. | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins#styled-components} | ||
| */ | ||
| interface StyledComponentsOptions { | ||
| /** | ||
| * Enhances the attached CSS class name on each component with richer output to help | ||
| * identify your components in the DOM without React DevTools. | ||
| * | ||
| * @default true | ||
| */ | ||
| displayName?: boolean; | ||
| /** | ||
| * Controls whether the `displayName` of a component will be prefixed with the filename | ||
| * to make the component name as unique as possible. | ||
| * | ||
| * @default true | ||
| */ | ||
| fileName?: boolean; | ||
| /** | ||
| * Adds a unique identifier to every styled component to avoid checksum mismatches | ||
| * due to different class generation on the client and server during server-side rendering. | ||
| * | ||
| * @default true | ||
| */ | ||
| ssr?: boolean; | ||
| /** | ||
| * Transpiles styled-components tagged template literals to a smaller representation | ||
| * than what Babel normally creates, helping to reduce bundle size. | ||
| * | ||
| * @default true | ||
| */ | ||
| transpileTemplateLiterals?: boolean; | ||
| /** | ||
| * Minifies CSS content by removing all whitespace and comments from your CSS, | ||
| * keeping valuable bytes out of your bundles. | ||
| * | ||
| * @default true | ||
| */ | ||
| minify?: boolean; | ||
| /** | ||
| * Enables transformation of JSX `css` prop when using styled-components. | ||
| * | ||
| * **Note: This feature is not yet implemented in oxc.** | ||
| * | ||
| * @default true | ||
| */ | ||
| cssProp?: boolean; | ||
| /** | ||
| * Enables "pure annotation" to aid dead code elimination by bundlers. | ||
| * | ||
| * @default false | ||
| */ | ||
| pure?: boolean; | ||
| /** | ||
| * Adds a namespace prefix to component identifiers to ensure class names are unique. | ||
| * | ||
| * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"` | ||
| */ | ||
| namespace?: string; | ||
| /** | ||
| * List of file names that are considered meaningless for component naming purposes. | ||
| * | ||
| * When the `fileName` option is enabled and a component is in a file with a name | ||
| * from this list, the directory name will be used instead of the file name for | ||
| * the component's display name. | ||
| * | ||
| * @default `["index"]` | ||
| */ | ||
| meaninglessFileNames?: Array<string>; | ||
| /** | ||
| * Import paths to be considered as styled-components imports at the top level. | ||
| * | ||
| * **Note: This feature is not yet implemented in oxc.** | ||
| */ | ||
| topLevelImportPaths?: Array<string>; | ||
| } | ||
| /** | ||
| * Options for transforming a JavaScript or TypeScript file. | ||
| * | ||
| * @see {@link transform} | ||
| */ | ||
| interface TransformOptions { | ||
| /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */ | ||
| lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; | ||
| /** Treat the source text as `script` or `module` code. */ | ||
| sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined; | ||
| /** | ||
| * The current working directory. Used to resolve relative paths in other | ||
| * options. | ||
| */ | ||
| cwd?: string; | ||
| /** | ||
| * Enable source map generation. | ||
| * | ||
| * When `true`, the `sourceMap` field of transform result objects will be populated. | ||
| * | ||
| * @default false | ||
| * | ||
| * @see {@link SourceMap} | ||
| */ | ||
| sourcemap?: boolean; | ||
| /** Set assumptions in order to produce smaller output. */ | ||
| assumptions?: CompilerAssumptions; | ||
| /** | ||
| * Configure how TypeScript is transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript} | ||
| */ | ||
| typescript?: TypeScriptOptions; | ||
| /** | ||
| * Configure how TSX and JSX are transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx} | ||
| */ | ||
| jsx?: 'preserve' | JsxOptions; | ||
| /** | ||
| * Sets the target environment for the generated JavaScript. | ||
| * | ||
| * The lowest target is `es2015`. | ||
| * | ||
| * Example: | ||
| * | ||
| * * `'es2015'` | ||
| * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` | ||
| * | ||
| * @default `esnext` (No transformation) | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target} | ||
| */ | ||
| target?: string | Array<string>; | ||
| /** Behaviour for runtime helpers. */ | ||
| helpers?: Helpers; | ||
| /** | ||
| * Define Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define} | ||
| */ | ||
| define?: Record<string, string>; | ||
| /** | ||
| * Inject Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject} | ||
| */ | ||
| inject?: Record<string, string | [string, string]>; | ||
| /** Decorator plugin */ | ||
| decorator?: DecoratorOptions; | ||
| /** | ||
| * Third-party plugins to use. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins} | ||
| */ | ||
| plugins?: PluginsOptions; | ||
| } | ||
| interface TypeScriptOptions { | ||
| jsxPragma?: string; | ||
| jsxPragmaFrag?: string; | ||
| onlyRemoveTypeImports?: boolean; | ||
| allowNamespaces?: boolean; | ||
| /** | ||
| * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier: | ||
| * | ||
| * @deprecated | ||
| * | ||
| * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields | ||
| * without initializer, you can use `remove_class_fields_without_initializer: true` instead. | ||
| */ | ||
| allowDeclareFields?: boolean; | ||
| /** | ||
| * When enabled, class fields without initializers are removed. | ||
| * | ||
| * For example: | ||
| * ```ts | ||
| * class Foo { | ||
| * x: number; | ||
| * y: number = 0; | ||
| * } | ||
| * ``` | ||
| * // transform into | ||
| * ```js | ||
| * class Foo { | ||
| * x: number; | ||
| * } | ||
| * ``` | ||
| * | ||
| * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option. | ||
| * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`] | ||
| * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is | ||
| * equivalent to `useDefineForClassFields: false` in TypeScript. | ||
| * | ||
| * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into: | ||
| * | ||
| * ```js | ||
| * class Foo { | ||
| * constructor() { | ||
| * this.y = 0; | ||
| * } | ||
| * } | ||
| * ``` | ||
| * | ||
| * Defaults to `false`. | ||
| */ | ||
| removeClassFieldsWithoutInitializer?: boolean; | ||
| /** | ||
| * When true, optimize const enums by inlining their values at usage sites | ||
| * and removing the enum declaration. | ||
| * | ||
| * @default false | ||
| */ | ||
| optimizeConstEnums?: boolean; | ||
| /** | ||
| * When true, optimize regular (non-const) enums by inlining their member | ||
| * accesses at usage sites when the member value is statically known. | ||
| * | ||
| * Non-exported enum declarations are also removed when all members are | ||
| * evaluable and no references to the enum as a runtime value exist | ||
| * (e.g., `console.log(Foo)`, `typeof Foo`, or passing the enum as an argument). | ||
| * | ||
| * @default false | ||
| */ | ||
| optimizeEnums?: boolean; | ||
| /** | ||
| * Also generate a `.d.ts` declaration file for TypeScript files. | ||
| * | ||
| * The source file must be compliant with all | ||
| * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations) | ||
| * requirements. | ||
| * | ||
| * @default false | ||
| */ | ||
| declaration?: IsolatedDeclarationsOptions; | ||
| /** | ||
| * Rewrite or remove TypeScript import/export declaration extensions. | ||
| * | ||
| * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively. | ||
| * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely. | ||
| * - When set to `true`, it's equivalent to `rewrite`. | ||
| * - When set to `false` or omitted, no changes will be made to the extensions. | ||
| * | ||
| * @default false | ||
| */ | ||
| rewriteImportExtensions?: 'rewrite' | 'remove' | boolean; | ||
| } | ||
| /** A decoded source map with mappings as an array of arrays instead of VLQ-encoded string. */ | ||
| declare class BindingDecodedMap { | ||
| /** The source map version (always 3). */ | ||
| get version(): number; | ||
| /** The generated file name. */ | ||
| get file(): string | null; | ||
| /** The list of original source files. */ | ||
| get sources(): Array<string>; | ||
| /** The original source contents (if `includeContent` was true). */ | ||
| get sourcesContent(): Array<string | undefined | null>; | ||
| /** The list of symbol names used in mappings. */ | ||
| get names(): Array<string>; | ||
| /** | ||
| * The decoded mappings as an array of line arrays. | ||
| * Each line is an array of segments, where each segment is [generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex?]. | ||
| */ | ||
| get mappings(): Array<Array<Array<number>>>; | ||
| /** The list of source indices that should be excluded from debugging. */ | ||
| get x_google_ignoreList(): Array<number> | null; | ||
| } | ||
| declare class BindingMagicString { | ||
| constructor(source: string, options?: BindingMagicStringOptions | undefined | null); | ||
| get original(): string; | ||
| get filename(): string | null; | ||
| get indentExclusionRanges(): Array<Array<number>> | Array<number> | null; | ||
| get ignoreList(): boolean; | ||
| get offset(): number; | ||
| set offset(offset: number); | ||
| replace(from: string, to: string): this; | ||
| replaceAll(from: string, to: string): this; | ||
| /** | ||
| * Returns the UTF-16 offset past the last match, or -1 if no match was found. | ||
| * The JS wrapper uses this to update `lastIndex` on the caller's RegExp. | ||
| * Global/sticky behavior is derived from the regex's own flags. | ||
| */ | ||
| replaceRegex(from: RegExp, to: string): number; | ||
| prepend(content: string): this; | ||
| append(content: string): this; | ||
| prependLeft(index: number, content: string): this; | ||
| prependRight(index: number, content: string): this; | ||
| appendLeft(index: number, content: string): this; | ||
| appendRight(index: number, content: string): this; | ||
| overwrite(start: number, end: number, content: string, options?: BindingOverwriteOptions | undefined | null): this; | ||
| toString(): string; | ||
| hasChanged(): boolean; | ||
| length(): number; | ||
| isEmpty(): boolean; | ||
| remove(start: number, end: number): this; | ||
| update(start: number, end: number, content: string, options?: BindingUpdateOptions | undefined | null): this; | ||
| relocate(start: number, end: number, to: number): this; | ||
| /** | ||
| * Alias for `relocate` to match the original magic-string API. | ||
| * Moves the characters from `start` to `end` to `index`. | ||
| * Returns `this` for method chaining. | ||
| */ | ||
| move(start: number, end: number, index: number): this; | ||
| indent(indentor?: string | undefined | null, options?: BindingIndentOptions | undefined | null): this; | ||
| /** Trims whitespace or specified characters from the start and end. */ | ||
| trim(charType?: string | undefined | null): this; | ||
| /** Trims whitespace or specified characters from the start. */ | ||
| trimStart(charType?: string | undefined | null): this; | ||
| /** Trims whitespace or specified characters from the end. */ | ||
| trimEnd(charType?: string | undefined | null): this; | ||
| /** Trims newlines from the start and end. */ | ||
| trimLines(): this; | ||
| /** | ||
| * Deprecated method that throws an error directing users to use prependRight or appendLeft. | ||
| * This matches the original magic-string API which deprecated this method. | ||
| */ | ||
| insert(index: number, content: string): void; | ||
| /** Returns a clone of the MagicString instance. */ | ||
| clone(): BindingMagicString; | ||
| /** Returns the last character of the generated string, or an empty string if empty. */ | ||
| lastChar(): string; | ||
| /** Returns the content after the last newline in the generated string. */ | ||
| lastLine(): string; | ||
| /** Returns the guessed indentation string, or `\t` if none is found. */ | ||
| getIndentString(): string; | ||
| /** Returns a clone with content outside the specified range removed. */ | ||
| snip(start: number, end: number): BindingMagicString; | ||
| /** | ||
| * Resets the portion of the string from `start` to `end` to its original content. | ||
| * This undoes any modifications made to that range. | ||
| * Supports negative indices (counting from the end). | ||
| */ | ||
| reset(start: number, end: number): this; | ||
| /** | ||
| * Returns the content between the specified UTF-16 code unit positions (JS string indices). | ||
| * Supports negative indices (counting from the end). | ||
| * | ||
| * When an index falls in the middle of a surrogate pair, the lone surrogate is | ||
| * included in the result (matching the original magic-string / JS behavior). | ||
| * This is done by returning a UTF-16 encoded JS string via `napi_create_string_utf16`. | ||
| */ | ||
| slice(start?: number | undefined | null, end?: number | undefined | null): string; | ||
| /** | ||
| * Generates a source map for the transformations applied to this MagicString. | ||
| * Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings. | ||
| */ | ||
| generateMap(options?: BindingSourceMapOptions | undefined | null): BindingSourceMap; | ||
| /** | ||
| * Generates a decoded source map for the transformations applied to this MagicString. | ||
| * Returns a BindingDecodedMap object with mappings as an array of arrays. | ||
| */ | ||
| generateDecodedMap(options?: BindingSourceMapOptions | undefined | null): BindingDecodedMap; | ||
| } | ||
| declare class BindingNormalizedOptions { | ||
| get input(): Array<string> | Record<string, string>; | ||
| get cwd(): string; | ||
| get platform(): 'node' | 'browser' | 'neutral'; | ||
| get shimMissingExports(): boolean; | ||
| get name(): string | null; | ||
| get entryFilenames(): string | undefined; | ||
| get chunkFilenames(): string | undefined; | ||
| get assetFilenames(): string | undefined; | ||
| get dir(): string | null; | ||
| get file(): string | null; | ||
| get format(): 'es' | 'cjs' | 'iife' | 'umd'; | ||
| get exports(): 'default' | 'named' | 'none' | 'auto'; | ||
| get esModule(): boolean | 'if-default-prop'; | ||
| get codeSplitting(): boolean; | ||
| get dynamicImportInCjs(): boolean; | ||
| get sourcemap(): boolean | 'inline' | 'hidden'; | ||
| get sourcemapBaseUrl(): string | null; | ||
| get banner(): string | undefined | null | undefined; | ||
| get footer(): string | undefined | null | undefined; | ||
| get intro(): string | undefined | null | undefined; | ||
| get outro(): string | undefined | null | undefined; | ||
| get postBanner(): string | undefined | null | undefined; | ||
| get postFooter(): string | undefined | null | undefined; | ||
| get externalLiveBindings(): boolean; | ||
| get extend(): boolean; | ||
| get globals(): Record<string, string> | undefined; | ||
| get hashCharacters(): 'base64' | 'base36' | 'hex'; | ||
| get sourcemapDebugIds(): boolean; | ||
| get sourcemapExcludeSources(): boolean; | ||
| get polyfillRequire(): boolean; | ||
| get minify(): false | 'dce-only' | MinifyOptions; | ||
| get legalComments(): 'none' | 'inline'; | ||
| get comments(): BindingCommentsOptions; | ||
| get preserveModules(): boolean; | ||
| get preserveModulesRoot(): string | undefined; | ||
| get virtualDirname(): string; | ||
| get topLevelVar(): boolean; | ||
| get minifyInternalExports(): boolean; | ||
| get context(): string; | ||
| } | ||
| declare class BindingRenderedChunk { | ||
| get name(): string; | ||
| get isEntry(): boolean; | ||
| get isDynamicEntry(): boolean; | ||
| get facadeModuleId(): string | null; | ||
| get moduleIds(): Array<string>; | ||
| get exports(): Array<string>; | ||
| get fileName(): string; | ||
| get modules(): BindingModules; | ||
| get imports(): Array<string>; | ||
| get dynamicImports(): Array<string>; | ||
| } | ||
| declare class BindingRenderedModule { | ||
| get code(): string | null; | ||
| get renderedExports(): Array<string>; | ||
| } | ||
| /** A source map object with properties matching the SourceMap V3 specification. */ | ||
| declare class BindingSourceMap { | ||
| /** The source map version (always 3). */ | ||
| get version(): number; | ||
| /** The generated file name. */ | ||
| get file(): string | null; | ||
| /** The list of original source files. */ | ||
| get sources(): Array<string>; | ||
| /** The original source contents (if `includeContent` was true). */ | ||
| get sourcesContent(): Array<string | undefined | null>; | ||
| /** The list of symbol names used in mappings. */ | ||
| get names(): Array<string>; | ||
| /** The VLQ-encoded mappings string. */ | ||
| get mappings(): string; | ||
| /** The list of source indices that should be excluded from debugging. */ | ||
| get x_google_ignoreList(): Array<number> | null; | ||
| /** Returns the source map as a JSON string. */ | ||
| toString(): string; | ||
| /** Returns the source map as a base64-encoded data URL. */ | ||
| toUrl(): string; | ||
| } | ||
| /** | ||
| * Minimal wrapper around a `BundleHandle` for watcher events. | ||
| * This is returned from watcher event data to allow calling `result.close()`. | ||
| */ | ||
| declare class BindingWatcherBundler { | ||
| close(): Promise<void>; | ||
| } | ||
| declare class TsconfigCache { | ||
| /** Create a new transform cache with auto tsconfig discovery enabled. */ | ||
| constructor(yarnPnp: boolean); | ||
| /** | ||
| * Clear the cache. | ||
| * | ||
| * Call this when tsconfig files have changed to ensure fresh resolution. | ||
| */ | ||
| clear(): void; | ||
| /** Get the number of cached entries. */ | ||
| size(): number; | ||
| } | ||
| type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-wasm-fallback' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime'; | ||
| interface BindingBundleAnalyzerPluginConfig { | ||
| /** Output filename for the bundle analysis data (default: "analyze-data.json") */ | ||
| fileName?: string; | ||
| /** Output format: "json" (default) or "md" for LLM-friendly markdown */ | ||
| format?: 'json' | 'md'; | ||
| } | ||
| interface BindingBundleState { | ||
| lastFullBuildFailed: boolean; | ||
| hasStaleOutput: boolean; | ||
| } | ||
| interface BindingClientHmrUpdate { | ||
| clientId: string; | ||
| update: BindingHmrUpdate; | ||
| } | ||
| interface BindingCommentsOptions { | ||
| legal?: boolean; | ||
| annotation?: boolean; | ||
| jsdoc?: boolean; | ||
| } | ||
| interface BindingCompilerOptions { | ||
| baseUrl?: string; | ||
| paths?: Record<string, Array<string>>; | ||
| experimentalDecorators?: boolean; | ||
| emitDecoratorMetadata?: boolean; | ||
| useDefineForClassFields?: boolean; | ||
| rewriteRelativeImportExtensions?: boolean; | ||
| jsx?: string; | ||
| jsxFactory?: string; | ||
| jsxFragmentFactory?: string; | ||
| jsxImportSource?: string; | ||
| verbatimModuleSyntax?: boolean; | ||
| preserveValueImports?: boolean; | ||
| importsNotUsedAsValues?: string; | ||
| target?: string; | ||
| module?: string; | ||
| allowJs?: boolean; | ||
| rootDirs?: Array<string>; | ||
| } | ||
| /** Enhanced transform options with tsconfig and inputMap support. */ | ||
| interface BindingEnhancedTransformOptions { | ||
| /** Treat the source text as 'js', 'jsx', 'ts', 'tsx', or 'dts'. */ | ||
| lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; | ||
| /** Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'. */ | ||
| sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined; | ||
| /** | ||
| * The current working directory. Used to resolve relative paths in other | ||
| * options. | ||
| */ | ||
| cwd?: string; | ||
| /** | ||
| * Enable source map generation. | ||
| * | ||
| * When `true`, the `sourceMap` field of transform result objects will be populated. | ||
| * | ||
| * @default false | ||
| */ | ||
| sourcemap?: boolean; | ||
| /** Set assumptions in order to produce smaller output. */ | ||
| assumptions?: CompilerAssumptions; | ||
| /** | ||
| * Configure how TypeScript is transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript} | ||
| */ | ||
| typescript?: TypeScriptOptions; | ||
| /** | ||
| * Configure how TSX and JSX are transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx} | ||
| */ | ||
| jsx?: 'preserve' | JsxOptions; | ||
| /** | ||
| * Sets the target environment for the generated JavaScript. | ||
| * | ||
| * The lowest target is `es2015`. | ||
| * | ||
| * Example: | ||
| * | ||
| * * `'es2015'` | ||
| * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` | ||
| * | ||
| * @default `esnext` (No transformation) | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target} | ||
| */ | ||
| target?: string | Array<string>; | ||
| /** Behaviour for runtime helpers. */ | ||
| helpers?: Helpers; | ||
| /** | ||
| * Define Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define} | ||
| */ | ||
| define?: Record<string, string>; | ||
| /** | ||
| * Inject Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject} | ||
| */ | ||
| inject?: Record<string, string | [string, string]>; | ||
| /** Decorator plugin */ | ||
| decorator?: DecoratorOptions; | ||
| /** | ||
| * Third-party plugins to use. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins} | ||
| */ | ||
| plugins?: PluginsOptions; | ||
| /** | ||
| * Configure tsconfig handling. | ||
| * - true: Auto-discover and load the nearest tsconfig.json | ||
| * - TsconfigRawOptions: Use the provided inline tsconfig options | ||
| */ | ||
| tsconfig?: boolean | BindingTsconfigRawOptions; | ||
| /** An input source map to collapse with the output source map. */ | ||
| inputMap?: SourceMap; | ||
| } | ||
| /** Result of the enhanced transform API. */ | ||
| interface BindingEnhancedTransformResult { | ||
| /** | ||
| * The transformed code. | ||
| * | ||
| * If parsing failed, this will be an empty string. | ||
| */ | ||
| code: string; | ||
| /** | ||
| * The source map for the transformed code. | ||
| * | ||
| * This will be set if {@link BindingEnhancedTransformOptions#sourcemap} is `true`. | ||
| */ | ||
| map?: SourceMap; | ||
| /** | ||
| * The `.d.ts` declaration file for the transformed code. Declarations are | ||
| * only generated if `declaration` is set to `true` and a TypeScript file | ||
| * is provided. | ||
| * | ||
| * If parsing failed and `declaration` is set, this will be an empty string. | ||
| * | ||
| * @see {@link TypeScriptOptions#declaration} | ||
| * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration) | ||
| */ | ||
| declaration?: string; | ||
| /** | ||
| * Declaration source map. Only generated if both | ||
| * {@link TypeScriptOptions#declaration declaration} and | ||
| * {@link BindingEnhancedTransformOptions#sourcemap sourcemap} are set to `true`. | ||
| */ | ||
| declarationMap?: SourceMap; | ||
| /** | ||
| * Helpers used. | ||
| * | ||
| * @internal | ||
| * | ||
| * Example: | ||
| * | ||
| * ```text | ||
| * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" } | ||
| * ``` | ||
| */ | ||
| helpersUsed: Record<string, string>; | ||
| /** Parse and transformation errors. */ | ||
| errors: Array<BindingError>; | ||
| /** Parse and transformation warnings. */ | ||
| warnings: Array<BindingError>; | ||
| /** Paths to tsconfig files that were loaded during transformation. */ | ||
| tsconfigFilePaths: Array<string>; | ||
| } | ||
| type BindingError = { | ||
| type: 'JsError'; | ||
| field0: Error; | ||
| } | { | ||
| type: 'NativeError'; | ||
| field0: NativeError; | ||
| }; | ||
| interface BindingEsmExternalRequirePluginConfig { | ||
| external: Array<BindingStringOrRegex>; | ||
| skipDuplicateCheck?: boolean; | ||
| } | ||
| interface BindingHmrBoundaryOutput { | ||
| boundary: string; | ||
| acceptedVia: string; | ||
| } | ||
| type BindingHmrUpdate = { | ||
| type: 'Patch'; | ||
| code: string; | ||
| filename: string; | ||
| sourcemap?: string; | ||
| sourcemapFilename?: string; | ||
| hmrBoundaries: Array<BindingHmrBoundaryOutput>; | ||
| } | { | ||
| type: 'FullReload'; | ||
| reason?: string; | ||
| } | { | ||
| type: 'Noop'; | ||
| }; | ||
| interface BindingHookResolveIdExtraArgs { | ||
| custom?: number; | ||
| isEntry: boolean; | ||
| /** | ||
| * - `import-statement`: `import { foo } from './lib.js';` | ||
| * - `dynamic-import`: `import('./lib.js')` | ||
| * - `require-call`: `require('./lib.js')` | ||
| * - `import-rule`: `@import 'bg-color.css'` | ||
| * - `url-token`: `url('./icon.png')` | ||
| * - `new-url`: `new URL('./worker.js', import.meta.url)` | ||
| * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})` | ||
| */ | ||
| kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'; | ||
| } | ||
| interface BindingIndentOptions { | ||
| exclude?: Array<Array<number>> | Array<number>; | ||
| } | ||
| interface BindingIsolatedDeclarationPluginConfig { | ||
| stripInternal?: boolean; | ||
| } | ||
| interface BindingLogLocation { | ||
| /** 1-based */ | ||
| line: number; | ||
| /** 0-based position in the line in UTF-16 code units */ | ||
| column: number; | ||
| file?: string; | ||
| } | ||
| interface BindingMagicStringOptions { | ||
| filename?: string; | ||
| offset?: number; | ||
| indentExclusionRanges?: Array<Array<number>> | Array<number>; | ||
| ignoreList?: boolean; | ||
| } | ||
| interface BindingModulePreloadOptions { | ||
| polyfill: boolean; | ||
| resolveDependencies?: (filename: string, deps: string[], context: { | ||
| hostId: string; | ||
| hostType: 'html' | 'js'; | ||
| }) => string[]; | ||
| } | ||
| interface BindingModules { | ||
| values: Array<BindingRenderedModule>; | ||
| keys: Array<string>; | ||
| } | ||
| interface BindingOverwriteOptions { | ||
| contentOnly?: boolean; | ||
| } | ||
| interface BindingPluginContextResolveOptions { | ||
| /** | ||
| * - `import-statement`: `import { foo } from './lib.js';` | ||
| * - `dynamic-import`: `import('./lib.js')` | ||
| * - `require-call`: `require('./lib.js')` | ||
| * - `import-rule`: `@import 'bg-color.css'` | ||
| * - `url-token`: `url('./icon.png')` | ||
| * - `new-url`: `new URL('./worker.js', import.meta.url)` | ||
| * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})` | ||
| */ | ||
| importKind?: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'; | ||
| isEntry?: boolean; | ||
| skipSelf?: boolean; | ||
| custom?: number; | ||
| vitePluginCustom?: BindingVitePluginCustom; | ||
| } | ||
| declare enum BindingRebuildStrategy { | ||
| Always = 0, | ||
| Auto = 1, | ||
| Never = 2 | ||
| } | ||
| interface BindingRenderBuiltUrlConfig { | ||
| ssr: boolean; | ||
| type: 'asset' | 'public'; | ||
| hostId: string; | ||
| hostType: 'js' | 'css' | 'html'; | ||
| } | ||
| interface BindingRenderBuiltUrlRet { | ||
| relative?: boolean; | ||
| runtime?: string; | ||
| } | ||
| interface BindingReplacePluginConfig { | ||
| values: Record<string, string>; | ||
| delimiters?: [string, string]; | ||
| preventAssignment?: boolean; | ||
| objectGuards?: boolean; | ||
| sourcemap?: boolean; | ||
| } | ||
| interface BindingSourceMapOptions { | ||
| /** The filename for the generated file (goes into `map.file`) */ | ||
| file?: string; | ||
| /** The filename of the original source (goes into `map.sources`) */ | ||
| source?: string; | ||
| includeContent?: boolean; | ||
| /** | ||
| * Accepts boolean or string: true, false, "boundary" | ||
| * - true: high-resolution sourcemaps (character-level) | ||
| * - false: low-resolution sourcemaps (line-level) - default | ||
| * - "boundary": high-resolution only at word boundaries | ||
| */ | ||
| hires?: boolean | string; | ||
| } | ||
| interface BindingTransformHookExtraArgs { | ||
| moduleType: string; | ||
| } | ||
| interface BindingTsconfig { | ||
| files?: Array<string>; | ||
| include?: Array<string>; | ||
| exclude?: Array<string>; | ||
| compilerOptions: BindingCompilerOptions; | ||
| } | ||
| /** | ||
| * TypeScript compiler options for inline tsconfig configuration. | ||
| * | ||
| * @category Utilities | ||
| */ | ||
| interface BindingTsconfigCompilerOptions { | ||
| /** Specifies the JSX factory function to use. */ | ||
| jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native'; | ||
| /** Specifies the JSX factory function. */ | ||
| jsxFactory?: string; | ||
| /** Specifies the JSX fragment factory function. */ | ||
| jsxFragmentFactory?: string; | ||
| /** Specifies the module specifier for JSX imports. */ | ||
| jsxImportSource?: string; | ||
| /** Enables experimental decorators. */ | ||
| experimentalDecorators?: boolean; | ||
| /** Enables decorator metadata emission. */ | ||
| emitDecoratorMetadata?: boolean; | ||
| /** Preserves module structure of imports/exports. */ | ||
| verbatimModuleSyntax?: boolean; | ||
| /** Configures how class fields are emitted. */ | ||
| useDefineForClassFields?: boolean; | ||
| /** The ECMAScript target version. */ | ||
| target?: string; | ||
| /** @deprecated Use verbatimModuleSyntax instead. */ | ||
| preserveValueImports?: boolean; | ||
| /** @deprecated Use verbatimModuleSyntax instead. */ | ||
| importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'; | ||
| } | ||
| /** | ||
| * Raw tsconfig options for inline configuration. | ||
| * | ||
| * @category Utilities | ||
| */ | ||
| interface BindingTsconfigRawOptions { | ||
| /** TypeScript compiler options. */ | ||
| compilerOptions?: BindingTsconfigCompilerOptions; | ||
| } | ||
| interface BindingTsconfigResult { | ||
| tsconfig: BindingTsconfig; | ||
| tsconfigFilePaths: Array<string>; | ||
| } | ||
| interface BindingUpdateOptions { | ||
| overwrite?: boolean; | ||
| } | ||
| interface BindingViteBuildImportAnalysisPluginConfig { | ||
| preloadCode: string; | ||
| insertPreload: boolean; | ||
| optimizeModulePreloadRelativePaths: boolean; | ||
| renderBuiltUrl: boolean; | ||
| isRelativeBase: boolean; | ||
| v2?: BindingViteBuildImportAnalysisPluginV2Config; | ||
| } | ||
| interface BindingViteBuildImportAnalysisPluginV2Config { | ||
| isSsr: boolean; | ||
| urlBase: string; | ||
| decodedBase: string; | ||
| modulePreload: false | BindingModulePreloadOptions; | ||
| renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet; | ||
| } | ||
| interface BindingViteDynamicImportVarsPluginConfig { | ||
| sourcemap?: boolean; | ||
| include?: Array<BindingStringOrRegex>; | ||
| exclude?: Array<BindingStringOrRegex>; | ||
| resolver?: (id: string, importer: string) => MaybePromise<string | undefined>; | ||
| } | ||
| interface BindingViteImportGlobPluginConfig { | ||
| root?: string; | ||
| sourcemap?: boolean; | ||
| restoreQueryExtension?: boolean; | ||
| } | ||
| interface BindingViteJsonPluginConfig { | ||
| minify?: boolean; | ||
| namedExports?: boolean; | ||
| stringify?: BindingViteJsonPluginStringify; | ||
| } | ||
| type BindingViteJsonPluginStringify = boolean | string; | ||
| interface BindingViteManifestPluginConfig { | ||
| root: string; | ||
| outPath: string; | ||
| isEnableV2?: boolean; | ||
| isLegacy?: (args: BindingNormalizedOptions) => boolean; | ||
| cssEntries: () => Record<string, string>; | ||
| } | ||
| interface BindingViteModulePreloadPolyfillPluginConfig { | ||
| isServer?: boolean; | ||
| } | ||
| interface BindingVitePluginCustom { | ||
| 'vite:import-glob'?: ViteImportGlobMeta; | ||
| } | ||
| interface BindingViteReactRefreshWrapperPluginConfig { | ||
| cwd: string; | ||
| include?: Array<BindingStringOrRegex>; | ||
| exclude?: Array<BindingStringOrRegex>; | ||
| jsxImportSource: string; | ||
| reactRefreshHost: string; | ||
| } | ||
| interface BindingViteReporterPluginConfig { | ||
| root: string; | ||
| isTty: boolean; | ||
| isLib: boolean; | ||
| assetsDir: string; | ||
| chunkLimit: number; | ||
| warnLargeChunks: boolean; | ||
| reportCompressedSize: boolean; | ||
| logInfo?: (msg: string) => void; | ||
| } | ||
| interface BindingViteResolvePluginConfig { | ||
| resolveOptions: BindingViteResolvePluginResolveOptions; | ||
| environmentConsumer: string; | ||
| environmentName: string; | ||
| builtins: Array<BindingStringOrRegex>; | ||
| external: true | string[]; | ||
| noExternal: true | Array<string | RegExp>; | ||
| dedupe: Array<string>; | ||
| disableCache?: boolean; | ||
| legacyInconsistentCjsInterop?: boolean; | ||
| finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>; | ||
| finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>; | ||
| resolveSubpathImports: (id: string, importer: string, isRequire: boolean, scan: boolean) => VoidNullable<string>; | ||
| onWarn?: (message: string) => void; | ||
| onDebug?: (message: string) => void; | ||
| yarnPnp: boolean; | ||
| } | ||
| interface BindingViteResolvePluginResolveOptions { | ||
| isBuild: boolean; | ||
| isProduction: boolean; | ||
| asSrc: boolean; | ||
| preferRelative: boolean; | ||
| isRequire?: boolean; | ||
| root: string; | ||
| scan: boolean; | ||
| mainFields: Array<string>; | ||
| conditions: Array<string>; | ||
| externalConditions: Array<string>; | ||
| extensions: Array<string>; | ||
| tryIndex: boolean; | ||
| tryPrefix?: string; | ||
| preserveSymlinks: boolean; | ||
| tsconfigPaths: boolean; | ||
| } | ||
| interface BindingViteTransformPluginConfig { | ||
| root: string; | ||
| include?: Array<BindingStringOrRegex>; | ||
| exclude?: Array<BindingStringOrRegex>; | ||
| jsxRefreshInclude?: Array<BindingStringOrRegex>; | ||
| jsxRefreshExclude?: Array<BindingStringOrRegex>; | ||
| isServerConsumer?: boolean; | ||
| jsxInject?: string; | ||
| transformOptions?: TransformOptions; | ||
| yarnPnp?: boolean; | ||
| } | ||
| interface ExternalMemoryStatus { | ||
| freed: boolean; | ||
| reason?: string; | ||
| } | ||
| /** Error emitted from native side, it only contains kind and message, no stack trace. */ | ||
| interface NativeError { | ||
| kind: string; | ||
| message: string; | ||
| /** The id of the file associated with the error */ | ||
| id?: string; | ||
| /** The exporter associated with the error (for import/export errors) */ | ||
| exporter?: string; | ||
| /** Location information (line, column, file) */ | ||
| loc?: BindingLogLocation; | ||
| /** Position in the source file in UTF-16 code units */ | ||
| pos?: number; | ||
| } | ||
| interface PreRenderedChunk { | ||
| /** The name of this chunk, which is used in naming patterns. */ | ||
| name: string; | ||
| /** Whether this chunk is a static entry point. */ | ||
| isEntry: boolean; | ||
| /** Whether this chunk is a dynamic entry point. */ | ||
| isDynamicEntry: boolean; | ||
| /** The id of a module that this chunk corresponds to. */ | ||
| facadeModuleId?: string; | ||
| /** The list of ids of modules included in this chunk. */ | ||
| moduleIds: Array<string>; | ||
| /** Exported variable names from this chunk. */ | ||
| exports: Array<string>; | ||
| } | ||
| interface ViteImportGlobMeta { | ||
| isSubImportsPattern?: boolean; | ||
| } | ||
| //#endregion | ||
| export { ExternalMemoryStatus as A, ResolveResult as B, BindingViteManifestPluginConfig as C, BindingViteResolvePluginConfig as D, BindingViteReporterPluginConfig as E, MinifyResult as F, isolatedDeclaration as G, SourceMap as H, NapiResolveOptions as I, isolatedDeclarationSync as K, ParseResult as L, IsolatedDeclarationsResult as M, JsxOptions as N, BindingViteTransformPluginConfig as O, MinifyOptions as P, ParserOptions as R, BindingViteJsonPluginConfig as S, BindingViteReactRefreshWrapperPluginConfig as T, TransformOptions as U, ResolverFactory as V, TsconfigCache as W, BindingTsconfigRawOptions as _, BindingEnhancedTransformOptions as a, BindingViteDynamicImportVarsPluginConfig as b, BindingHookResolveIdExtraArgs as c, BindingPluginContextResolveOptions as d, BindingRebuildStrategy as f, BindingTsconfigCompilerOptions as g, BindingTransformHookExtraArgs as h, BindingClientHmrUpdate as i, IsolatedDeclarationsOptions as j, BindingWatcherBundler as k, BindingIsolatedDeclarationPluginConfig as l, BindingReplacePluginConfig as m, BindingBundleAnalyzerPluginConfig as n, BindingEnhancedTransformResult as o, BindingRenderedChunk as p, moduleRunnerTransform as q, BindingBundleState as r, BindingEsmExternalRequirePluginConfig as s, BindingBuiltinPluginName as t, BindingMagicString as u, BindingTsconfigResult as v, BindingViteModulePreloadPolyfillPluginConfig as w, BindingViteImportGlobPluginConfig as x, BindingViteBuildImportAnalysisPluginConfig as y, PreRenderedChunk as z }; |
| 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), cb = null), 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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.2" && 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.2 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 }; |
Sorry, the diff of this file is too big to display
| import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DqWsYC5b.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 }; |
| 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-DktDDYoY.mjs"; | ||
| import { P as BuiltinPlugin, Ut as StringOrRegExp } from "./define-config-Bo24xyUK.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 }; |
Sorry, the diff of this file is too big to display
| //#region src/utils/define-config.ts | ||
| function defineConfig(config) { | ||
| return config; | ||
| } | ||
| //#endregion | ||
| export { defineConfig as t }; |
| import { t as require_binding } from "./binding-lLxFxuG-.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 }; |
| import { a as RolldownLog } from "./logging-BSNejiLS.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 }; |
| import { t as rolldown } from "./rolldown-B9_Kw98b.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 }; |
| //#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 }; |
| //#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 }; |
| //#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 }; |
| import { n as __toESM, t as require_binding } from "./binding-lLxFxuG-.mjs"; | ||
| import { c as logPluginError, n as error } from "./logs-aMKUxRpj.mjs"; | ||
| //#region src/builtin-plugin/utils.ts | ||
| var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1); | ||
| var BuiltinPlugin = class { | ||
| name; | ||
| _options; | ||
| /** 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) { | ||
| const wrappedHook = 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 | ||
| })); | ||
| } | ||
| }; | ||
| const order = callablePlugin.getOrder(key); | ||
| if (order == void 0) wrappedPlugin[key] = wrappedHook; | ||
| else wrappedPlugin[key] = { | ||
| handler: wrappedHook, | ||
| order | ||
| }; | ||
| } | ||
| 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 }; |
| import { n as __toESM, t as require_binding } from "./binding-lLxFxuG-.mjs"; | ||
| //#region ../../node_modules/.pnpm/oxc-parser@0.132.0/node_modules/oxc-parser/src-js/wrap.js | ||
| var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1); | ||
| 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 | ||
| /** | ||
| * 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 }; |
| import process$1, { stdin, stdout } from "node:process"; | ||
| import { WriteStream } from "node:tty"; | ||
| import f from "node:readline"; | ||
| //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs | ||
| function getDefaultExportFromCjs(x) { | ||
| return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; | ||
| } | ||
| var src; | ||
| var hasRequiredSrc; | ||
| function requireSrc() { | ||
| if (hasRequiredSrc) return src; | ||
| hasRequiredSrc = 1; | ||
| const ESC = "\x1B"; | ||
| const CSI = `${ESC}[`; | ||
| const beep = "\x07"; | ||
| const cursor = { | ||
| to(x, y) { | ||
| if (!y) return `${CSI}${x + 1}G`; | ||
| return `${CSI}${y + 1};${x + 1}H`; | ||
| }, | ||
| move(x, y) { | ||
| let ret = ""; | ||
| if (x < 0) ret += `${CSI}${-x}D`; | ||
| else if (x > 0) ret += `${CSI}${x}C`; | ||
| if (y < 0) ret += `${CSI}${-y}A`; | ||
| else if (y > 0) ret += `${CSI}${y}B`; | ||
| return ret; | ||
| }, | ||
| up: (count = 1) => `${CSI}${count}A`, | ||
| down: (count = 1) => `${CSI}${count}B`, | ||
| forward: (count = 1) => `${CSI}${count}C`, | ||
| backward: (count = 1) => `${CSI}${count}D`, | ||
| nextLine: (count = 1) => `${CSI}E`.repeat(count), | ||
| prevLine: (count = 1) => `${CSI}F`.repeat(count), | ||
| left: `${CSI}G`, | ||
| hide: `${CSI}?25l`, | ||
| show: `${CSI}?25h`, | ||
| save: `${ESC}7`, | ||
| restore: `${ESC}8` | ||
| }; | ||
| src = { | ||
| cursor, | ||
| scroll: { | ||
| up: (count = 1) => `${CSI}S`.repeat(count), | ||
| down: (count = 1) => `${CSI}T`.repeat(count) | ||
| }, | ||
| erase: { | ||
| screen: `${CSI}2J`, | ||
| up: (count = 1) => `${CSI}1J`.repeat(count), | ||
| down: (count = 1) => `${CSI}J`.repeat(count), | ||
| line: `${CSI}2K`, | ||
| lineEnd: `${CSI}K`, | ||
| lineStart: `${CSI}1K`, | ||
| lines(count) { | ||
| let clear = ""; | ||
| for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : ""); | ||
| if (count) clear += cursor.left; | ||
| return clear; | ||
| } | ||
| }, | ||
| beep | ||
| }; | ||
| return src; | ||
| } | ||
| var srcExports = requireSrc(); | ||
| var picocolors = { exports: {} }; | ||
| var hasRequiredPicocolors; | ||
| function requirePicocolors() { | ||
| if (hasRequiredPicocolors) return picocolors.exports; | ||
| hasRequiredPicocolors = 1; | ||
| let p = process || {}, argv = p.argv || [], env = p.env || {}; | ||
| let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI); | ||
| let formatter = (open, close, replace = open) => (input) => { | ||
| let string = "" + input, index = string.indexOf(close, open.length); | ||
| return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close; | ||
| }; | ||
| let replaceClose = (string, close, replace, index) => { | ||
| let result = "", cursor = 0; | ||
| do { | ||
| result += string.substring(cursor, index) + replace; | ||
| cursor = index + close.length; | ||
| index = string.indexOf(close, cursor); | ||
| } while (~index); | ||
| return result + string.substring(cursor); | ||
| }; | ||
| let createColors = (enabled = isColorSupported) => { | ||
| let f = enabled ? formatter : () => String; | ||
| return { | ||
| isColorSupported: enabled, | ||
| reset: f("\x1B[0m", "\x1B[0m"), | ||
| bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"), | ||
| dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"), | ||
| italic: f("\x1B[3m", "\x1B[23m"), | ||
| underline: f("\x1B[4m", "\x1B[24m"), | ||
| inverse: f("\x1B[7m", "\x1B[27m"), | ||
| hidden: f("\x1B[8m", "\x1B[28m"), | ||
| strikethrough: f("\x1B[9m", "\x1B[29m"), | ||
| black: f("\x1B[30m", "\x1B[39m"), | ||
| red: f("\x1B[31m", "\x1B[39m"), | ||
| green: f("\x1B[32m", "\x1B[39m"), | ||
| yellow: f("\x1B[33m", "\x1B[39m"), | ||
| blue: f("\x1B[34m", "\x1B[39m"), | ||
| magenta: f("\x1B[35m", "\x1B[39m"), | ||
| cyan: f("\x1B[36m", "\x1B[39m"), | ||
| white: f("\x1B[37m", "\x1B[39m"), | ||
| gray: f("\x1B[90m", "\x1B[39m"), | ||
| bgBlack: f("\x1B[40m", "\x1B[49m"), | ||
| bgRed: f("\x1B[41m", "\x1B[49m"), | ||
| bgGreen: f("\x1B[42m", "\x1B[49m"), | ||
| bgYellow: f("\x1B[43m", "\x1B[49m"), | ||
| bgBlue: f("\x1B[44m", "\x1B[49m"), | ||
| bgMagenta: f("\x1B[45m", "\x1B[49m"), | ||
| bgCyan: f("\x1B[46m", "\x1B[49m"), | ||
| bgWhite: f("\x1B[47m", "\x1B[49m"), | ||
| blackBright: f("\x1B[90m", "\x1B[39m"), | ||
| redBright: f("\x1B[91m", "\x1B[39m"), | ||
| greenBright: f("\x1B[92m", "\x1B[39m"), | ||
| yellowBright: f("\x1B[93m", "\x1B[39m"), | ||
| blueBright: f("\x1B[94m", "\x1B[39m"), | ||
| magentaBright: f("\x1B[95m", "\x1B[39m"), | ||
| cyanBright: f("\x1B[96m", "\x1B[39m"), | ||
| whiteBright: f("\x1B[97m", "\x1B[39m"), | ||
| bgBlackBright: f("\x1B[100m", "\x1B[49m"), | ||
| bgRedBright: f("\x1B[101m", "\x1B[49m"), | ||
| bgGreenBright: f("\x1B[102m", "\x1B[49m"), | ||
| bgYellowBright: f("\x1B[103m", "\x1B[49m"), | ||
| bgBlueBright: f("\x1B[104m", "\x1B[49m"), | ||
| bgMagentaBright: f("\x1B[105m", "\x1B[49m"), | ||
| bgCyanBright: f("\x1B[106m", "\x1B[49m"), | ||
| bgWhiteBright: f("\x1B[107m", "\x1B[49m") | ||
| }; | ||
| }; | ||
| picocolors.exports = createColors(); | ||
| picocolors.exports.createColors = createColors; | ||
| return picocolors.exports; | ||
| } | ||
| const e = /* @__PURE__ */ getDefaultExportFromCjs(/* @__PURE__ */ requirePicocolors()); | ||
| function J({ onlyFirst: t = false } = {}) { | ||
| const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|"); | ||
| return new RegExp(F, t ? void 0 : "g"); | ||
| } | ||
| const Q = J(); | ||
| function T$1(t) { | ||
| if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``); | ||
| return t.replace(Q, ""); | ||
| } | ||
| function O(t) { | ||
| return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; | ||
| } | ||
| var P$1 = { exports: {} }; | ||
| (function(t) { | ||
| var u = {}; | ||
| t.exports = u, u.eastAsianWidth = function(e) { | ||
| var s = e.charCodeAt(0), i = e.length == 2 ? e.charCodeAt(1) : 0, D = s; | ||
| return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N"; | ||
| }, u.characterLength = function(e) { | ||
| var s = this.eastAsianWidth(e); | ||
| return s == "F" || s == "W" || s == "A" ? 2 : 1; | ||
| }; | ||
| function F(e) { | ||
| return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || []; | ||
| } | ||
| u.length = function(e) { | ||
| for (var s = F(e), i = 0, D = 0; D < s.length; D++) i = i + this.characterLength(s[D]); | ||
| return i; | ||
| }, u.slice = function(e, s, i) { | ||
| textLen = u.length(e), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i); | ||
| for (var D = "", C = 0, o = F(e), E = 0; E < o.length; E++) { | ||
| var a = o[E], n = u.length(a); | ||
| if (C >= s - (n == 2 ? 1 : 0)) if (C + n <= i) D += a; | ||
| else break; | ||
| C += n; | ||
| } | ||
| return D; | ||
| }; | ||
| })(P$1); | ||
| var X = P$1.exports; | ||
| const DD = O(X); | ||
| var uD = function() { | ||
| return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; | ||
| }; | ||
| const FD = O(uD); | ||
| function A$1(t, u = {}) { | ||
| if (typeof t != "string" || t.length === 0 || (u = { | ||
| ambiguousIsNarrow: true, | ||
| ...u | ||
| }, t = T$1(t), t.length === 0)) return 0; | ||
| t = t.replace(FD(), " "); | ||
| const F = u.ambiguousIsNarrow ? 1 : 2; | ||
| let e = 0; | ||
| for (const s of t) { | ||
| const i = s.codePointAt(0); | ||
| if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue; | ||
| switch (DD.eastAsianWidth(s)) { | ||
| case "F": | ||
| case "W": | ||
| e += 2; | ||
| break; | ||
| case "A": | ||
| e += F; | ||
| break; | ||
| default: e += 1; | ||
| } | ||
| } | ||
| return e; | ||
| } | ||
| const m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`, I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`, r = { | ||
| modifier: { | ||
| reset: [0, 0], | ||
| bold: [1, 22], | ||
| dim: [2, 22], | ||
| italic: [3, 23], | ||
| underline: [4, 24], | ||
| overline: [53, 55], | ||
| inverse: [7, 27], | ||
| hidden: [8, 28], | ||
| strikethrough: [9, 29] | ||
| }, | ||
| color: { | ||
| black: [30, 39], | ||
| red: [31, 39], | ||
| green: [32, 39], | ||
| yellow: [33, 39], | ||
| blue: [34, 39], | ||
| magenta: [35, 39], | ||
| cyan: [36, 39], | ||
| white: [37, 39], | ||
| blackBright: [90, 39], | ||
| gray: [90, 39], | ||
| grey: [90, 39], | ||
| redBright: [91, 39], | ||
| greenBright: [92, 39], | ||
| yellowBright: [93, 39], | ||
| blueBright: [94, 39], | ||
| magentaBright: [95, 39], | ||
| cyanBright: [96, 39], | ||
| whiteBright: [97, 39] | ||
| }, | ||
| bgColor: { | ||
| bgBlack: [40, 49], | ||
| bgRed: [41, 49], | ||
| bgGreen: [42, 49], | ||
| bgYellow: [43, 49], | ||
| bgBlue: [44, 49], | ||
| bgMagenta: [45, 49], | ||
| bgCyan: [46, 49], | ||
| bgWhite: [47, 49], | ||
| bgBlackBright: [100, 49], | ||
| bgGray: [100, 49], | ||
| bgGrey: [100, 49], | ||
| bgRedBright: [101, 49], | ||
| bgGreenBright: [102, 49], | ||
| bgYellowBright: [103, 49], | ||
| bgBlueBright: [104, 49], | ||
| bgMagentaBright: [105, 49], | ||
| bgCyanBright: [106, 49], | ||
| bgWhiteBright: [107, 49] | ||
| } | ||
| }; | ||
| Object.keys(r.modifier); | ||
| const tD = Object.keys(r.color), eD = Object.keys(r.bgColor); | ||
| [...tD, ...eD]; | ||
| function sD() { | ||
| const t = /* @__PURE__ */ new Map(); | ||
| for (const [u, F] of Object.entries(r)) { | ||
| for (const [e, s] of Object.entries(F)) r[e] = { | ||
| open: `\x1B[${s[0]}m`, | ||
| close: `\x1B[${s[1]}m` | ||
| }, F[e] = r[e], t.set(s[0], s[1]); | ||
| Object.defineProperty(r, u, { | ||
| value: F, | ||
| enumerable: false | ||
| }); | ||
| } | ||
| return Object.defineProperty(r, "codes", { | ||
| value: t, | ||
| enumerable: false | ||
| }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { | ||
| rgbToAnsi256: { | ||
| value: (u, F, e) => u === F && F === e ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e / 255 * 5), | ||
| enumerable: false | ||
| }, | ||
| hexToRgb: { | ||
| value: (u) => { | ||
| const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16)); | ||
| if (!F) return [ | ||
| 0, | ||
| 0, | ||
| 0 | ||
| ]; | ||
| let [e] = F; | ||
| e.length === 3 && (e = [...e].map((i) => i + i).join("")); | ||
| const s = Number.parseInt(e, 16); | ||
| return [ | ||
| s >> 16 & 255, | ||
| s >> 8 & 255, | ||
| s & 255 | ||
| ]; | ||
| }, | ||
| enumerable: false | ||
| }, | ||
| hexToAnsi256: { | ||
| value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), | ||
| enumerable: false | ||
| }, | ||
| ansi256ToAnsi: { | ||
| value: (u) => { | ||
| if (u < 8) return 30 + u; | ||
| if (u < 16) return 90 + (u - 8); | ||
| let F, e, s; | ||
| if (u >= 232) F = ((u - 232) * 10 + 8) / 255, e = F, s = F; | ||
| else { | ||
| u -= 16; | ||
| const C = u % 36; | ||
| F = Math.floor(u / 36) / 5, e = Math.floor(C / 6) / 5, s = C % 6 / 5; | ||
| } | ||
| const i = Math.max(F, e, s) * 2; | ||
| if (i === 0) return 30; | ||
| let D = 30 + (Math.round(s) << 2 | Math.round(e) << 1 | Math.round(F)); | ||
| return i === 2 && (D += 60), D; | ||
| }, | ||
| enumerable: false | ||
| }, | ||
| rgbToAnsi: { | ||
| value: (u, F, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e)), | ||
| enumerable: false | ||
| }, | ||
| hexToAnsi: { | ||
| value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), | ||
| enumerable: false | ||
| } | ||
| }), r; | ||
| } | ||
| const iD = sD(), v = new Set(["\x1B", ""]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => { | ||
| const e = [...u]; | ||
| let s = false, i = false, D = A$1(T$1(t[t.length - 1])); | ||
| for (const [C, o] of e.entries()) { | ||
| const E = A$1(o); | ||
| if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e.slice(C + 1).join("").startsWith(y)), s) { | ||
| i ? o === w$1 && (s = false, i = false) : o === R && (s = false); | ||
| continue; | ||
| } | ||
| D += E, D === F && C < e.length - 1 && (t.push(""), D = 0); | ||
| } | ||
| !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop()); | ||
| }, nD = (t) => { | ||
| const u = t.split(" "); | ||
| let F = u.length; | ||
| for (; F > 0 && !(A$1(u[F - 1]) > 0);) F--; | ||
| return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join(""); | ||
| }, oD = (t, u, F = {}) => { | ||
| if (F.trim !== false && t.trim() === "") return ""; | ||
| let e = "", s, i; | ||
| const D = ED(t); | ||
| let C = [""]; | ||
| for (const [E, a] of t.split(" ").entries()) { | ||
| F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart()); | ||
| let n = A$1(C[C.length - 1]); | ||
| if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) { | ||
| const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u); | ||
| Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u); | ||
| continue; | ||
| } | ||
| if (n + D[E] > u && n > 0 && D[E] > 0) { | ||
| if (F.wordWrap === false && n < u) { | ||
| _(C, a, u); | ||
| continue; | ||
| } | ||
| C.push(""); | ||
| } | ||
| if (n + D[E] > u && F.wordWrap === false) { | ||
| _(C, a, u); | ||
| continue; | ||
| } | ||
| C[C.length - 1] += a; | ||
| } | ||
| F.trim !== false && (C = C.map((E) => nD(E))); | ||
| const o = [...C.join(` | ||
| `)]; | ||
| for (const [E, a] of o.entries()) { | ||
| if (e += a, v.has(a)) { | ||
| const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} }; | ||
| if (B.code !== void 0) { | ||
| const p = Number.parseFloat(B.code); | ||
| s = p === CD ? void 0 : p; | ||
| } else B.uri !== void 0 && (i = B.uri.length === 0 ? void 0 : B.uri); | ||
| } | ||
| const n = iD.codes.get(Number(s)); | ||
| o[E + 1] === ` | ||
| ` ? (i && (e += z("")), s && n && (e += V$1(n))) : a === ` | ||
| ` && (s && n && (e += V$1(s)), i && (e += z(i))); | ||
| } | ||
| return e; | ||
| }; | ||
| function G(t, u, F) { | ||
| return String(t).normalize().replace(/\r\n/g, ` | ||
| `).split(` | ||
| `).map((e) => oD(e, u, F)).join(` | ||
| `); | ||
| } | ||
| const c = { | ||
| actions: new Set([ | ||
| "up", | ||
| "down", | ||
| "left", | ||
| "right", | ||
| "space", | ||
| "enter", | ||
| "cancel" | ||
| ]), | ||
| aliases: new Map([ | ||
| ["k", "up"], | ||
| ["j", "down"], | ||
| ["h", "left"], | ||
| ["l", "right"], | ||
| ["", "cancel"], | ||
| ["escape", "cancel"] | ||
| ]) | ||
| }; | ||
| function k$1(t, u) { | ||
| if (typeof t == "string") return c.aliases.get(t) === u; | ||
| for (const F of t) if (F !== void 0 && k$1(F, u)) return true; | ||
| return false; | ||
| } | ||
| function lD(t, u) { | ||
| if (t === u) return; | ||
| const F = t.split(` | ||
| `), e = u.split(` | ||
| `), s = []; | ||
| for (let i = 0; i < Math.max(F.length, e.length); i++) F[i] !== e[i] && s.push(i); | ||
| return s; | ||
| } | ||
| globalThis.process.platform.startsWith("win"); | ||
| const S = Symbol("clack:cancel"); | ||
| function d$1(t, u) { | ||
| const F = t; | ||
| F.isTTY && F.setRawMode(u); | ||
| } | ||
| var AD = Object.defineProperty, pD = (t, u, F) => u in t ? AD(t, u, { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: F | ||
| }) : t[u] = F, h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F); | ||
| var x = class { | ||
| constructor(u, F = true) { | ||
| h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value"); | ||
| const { input: e = stdin, output: s = stdout, render: i, signal: D, ...C } = u; | ||
| this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e, this.output = s; | ||
| } | ||
| unsubscribe() { | ||
| this._subscribers.clear(); | ||
| } | ||
| setSubscriber(u, F) { | ||
| const e = this._subscribers.get(u) ?? []; | ||
| e.push(F), this._subscribers.set(u, e); | ||
| } | ||
| on(u, F) { | ||
| this.setSubscriber(u, { cb: F }); | ||
| } | ||
| once(u, F) { | ||
| this.setSubscriber(u, { | ||
| cb: F, | ||
| once: true | ||
| }); | ||
| } | ||
| emit(u, ...F) { | ||
| const e = this._subscribers.get(u) ?? [], s = []; | ||
| for (const i of e) i.cb(...F), i.once && s.push(() => e.splice(e.indexOf(i), 1)); | ||
| for (const i of s) i(); | ||
| } | ||
| prompt() { | ||
| return new Promise((u, F) => { | ||
| if (this._abortSignal) { | ||
| if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u(S); | ||
| this._abortSignal.addEventListener("abort", () => { | ||
| this.state = "cancel", this.close(); | ||
| }, { once: true }); | ||
| } | ||
| const e = new WriteStream(0); | ||
| e._write = (s, i, D) => { | ||
| this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D(); | ||
| }, this.input.pipe(e), this.rl = f.createInterface({ | ||
| input: this.input, | ||
| output: e, | ||
| tabSize: 2, | ||
| prompt: "", | ||
| escapeCodeTimeout: 50 | ||
| }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => { | ||
| this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value); | ||
| }), this.once("cancel", () => { | ||
| this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S); | ||
| }); | ||
| }); | ||
| } | ||
| onKeypress(u, F) { | ||
| if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") { | ||
| if (this.opts.validate) { | ||
| const e = this.opts.validate(this.value); | ||
| e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.value)); | ||
| } | ||
| this.state !== "error" && (this.state = "submit"); | ||
| } | ||
| k$1([ | ||
| u, | ||
| F?.name, | ||
| F?.sequence | ||
| ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close(); | ||
| } | ||
| close() { | ||
| this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(` | ||
| `), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe(); | ||
| } | ||
| restoreCursor() { | ||
| const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(` | ||
| `).length - 1; | ||
| this.output.write(srcExports.cursor.move(-999, u * -1)); | ||
| } | ||
| render() { | ||
| const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true }); | ||
| if (u !== this._prevFrame) { | ||
| if (this.state === "initial") this.output.write(srcExports.cursor.hide); | ||
| else { | ||
| const F = lD(this._prevFrame, u); | ||
| if (this.restoreCursor(), F && F?.length === 1) { | ||
| const e = F[0]; | ||
| this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.lines(1)); | ||
| const s = u.split(` | ||
| `); | ||
| this.output.write(s[e]), this._prevFrame = u, this.output.write(srcExports.cursor.move(0, s.length - e - 1)); | ||
| return; | ||
| } | ||
| if (F && F?.length > 1) { | ||
| const e = F[0]; | ||
| this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.down()); | ||
| const s = u.split(` | ||
| `).slice(e); | ||
| this.output.write(s.join(` | ||
| `)), this._prevFrame = u; | ||
| return; | ||
| } | ||
| this.output.write(srcExports.erase.down()); | ||
| } | ||
| this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u; | ||
| } | ||
| } | ||
| }; | ||
| var fD = class extends x { | ||
| get cursor() { | ||
| return this.value ? 0 : 1; | ||
| } | ||
| get _value() { | ||
| return this.cursor === 0; | ||
| } | ||
| constructor(u) { | ||
| super(u, false), this.value = !!u.initialValue, this.on("value", () => { | ||
| this.value = this._value; | ||
| }), this.on("confirm", (F) => { | ||
| this.output.write(srcExports.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close(); | ||
| }), this.on("cursor", () => { | ||
| this.value = !this.value; | ||
| }); | ||
| } | ||
| }; | ||
| var bD = Object.defineProperty, mD = (t, u, F) => u in t ? bD(t, u, { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: F | ||
| }) : t[u] = F, Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F); | ||
| let wD = class extends x { | ||
| constructor(u) { | ||
| super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => { | ||
| F === "a" && this.toggleAll(); | ||
| }), this.on("cursor", (F) => { | ||
| switch (F) { | ||
| case "left": | ||
| case "up": | ||
| this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1; | ||
| break; | ||
| case "down": | ||
| case "right": | ||
| this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1; | ||
| break; | ||
| case "space": | ||
| this.toggleValue(); | ||
| break; | ||
| } | ||
| }); | ||
| } | ||
| get _value() { | ||
| return this.options[this.cursor].value; | ||
| } | ||
| toggleAll() { | ||
| const u = this.value.length === this.options.length; | ||
| this.value = u ? [] : this.options.map((F) => F.value); | ||
| } | ||
| toggleValue() { | ||
| const u = this.value.includes(this._value); | ||
| this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value]; | ||
| } | ||
| }; | ||
| var SD = Object.defineProperty, $D = (t, u, F) => u in t ? SD(t, u, { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: F | ||
| }) : t[u] = F, q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F); | ||
| var jD = class extends x { | ||
| constructor(u) { | ||
| super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => { | ||
| switch (F) { | ||
| case "left": | ||
| case "up": | ||
| this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1; | ||
| break; | ||
| case "down": | ||
| case "right": | ||
| this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1; | ||
| break; | ||
| } | ||
| this.changeValue(); | ||
| }); | ||
| } | ||
| get _value() { | ||
| return this.options[this.cursor]; | ||
| } | ||
| changeValue() { | ||
| this.value = this._value.value; | ||
| } | ||
| }; | ||
| var PD = class extends x { | ||
| get valueWithCursor() { | ||
| if (this.state === "submit") return this.value; | ||
| if (this.cursor >= this.value.length) return `${this.value}\u2588`; | ||
| const u = this.value.slice(0, this.cursor), [F, ...e$1] = this.value.slice(this.cursor); | ||
| return `${u}${e.inverse(F)}${e$1.join("")}`; | ||
| } | ||
| get cursor() { | ||
| return this._cursor; | ||
| } | ||
| constructor(u) { | ||
| super(u), this.on("finalize", () => { | ||
| this.value || (this.value = u.defaultValue); | ||
| }); | ||
| } | ||
| }; | ||
| function ce() { | ||
| return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm"; | ||
| } | ||
| const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"), W = u("▲", "x"), C = u("✔", "√"), o = u(""), d = u(""), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), w = (t) => { | ||
| switch (t) { | ||
| case "initial": | ||
| case "active": return e.cyan(le); | ||
| case "cancel": return e.red(L); | ||
| case "error": return e.yellow(W); | ||
| case "submit": return e.green(C); | ||
| } | ||
| }, B = (t) => { | ||
| const { cursor: n, options: s, style: r } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c = Math.min(a, Math.max(i, 5)); | ||
| let l = 0; | ||
| n >= l + c - 3 ? l = Math.max(Math.min(n - c + 3, s.length - c), 0) : n < l + 2 && (l = Math.max(n - 2, 0)); | ||
| const $ = c < s.length && l > 0, p = c < s.length && l + c < s.length; | ||
| return s.slice(l, l + c).map((M, v, x) => { | ||
| const j = v === 0 && $, E = v === x.length - 1 && p; | ||
| return j || E ? e.dim("...") : r(M, v + l === n); | ||
| }); | ||
| }, he = (t) => new PD({ | ||
| validate: t.validate, | ||
| placeholder: t.placeholder, | ||
| defaultValue: t.defaultValue, | ||
| initialValue: t.initialValue, | ||
| render() { | ||
| const n = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `, s = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), r = this.value ? this.valueWithCursor : s; | ||
| switch (this.state) { | ||
| case "error": return `${n.trim()} | ||
| ${e.yellow(o)} ${r} | ||
| ${e.yellow(d)} ${e.yellow(this.error)} | ||
| `; | ||
| case "submit": return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`; | ||
| case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? ` | ||
| ${e.gray(o)}` : ""}`; | ||
| default: return `${n}${e.cyan(o)} ${r} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(), ye = (t) => { | ||
| const n = t.active ?? "Yes", s = t.inactive ?? "No"; | ||
| return new fD({ | ||
| active: n, | ||
| inactive: s, | ||
| initialValue: t.initialValue ?? true, | ||
| render() { | ||
| const r = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `, i = this.value ? n : s; | ||
| switch (this.state) { | ||
| case "submit": return `${r}${e.gray(o)} ${e.dim(i)}`; | ||
| case "cancel": return `${r}${e.gray(o)} ${e.strikethrough(e.dim(i))} | ||
| ${e.gray(o)}`; | ||
| default: return `${r}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s)}` : `${e.green(k)} ${s}`} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(); | ||
| }, ve = (t) => { | ||
| const n = (s, r) => { | ||
| const i = s.label ?? String(s.value); | ||
| switch (r) { | ||
| case "selected": return `${e.dim(i)}`; | ||
| case "active": return `${e.green(k)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}`; | ||
| case "cancelled": return `${e.strikethrough(e.dim(i))}`; | ||
| default: return `${e.dim(P)} ${e.dim(i)}`; | ||
| } | ||
| }; | ||
| return new jD({ | ||
| options: t.options, | ||
| initialValue: t.initialValue, | ||
| render() { | ||
| const s = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `; | ||
| switch (this.state) { | ||
| case "submit": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`; | ||
| case "cancel": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")} | ||
| ${e.gray(o)}`; | ||
| default: return `${s}${e.cyan(o)} ${B({ | ||
| cursor: this.cursor, | ||
| options: this.options, | ||
| maxItems: t.maxItems, | ||
| style: (r, i) => n(r, i ? "active" : "inactive") | ||
| }).join(` | ||
| ${e.cyan(o)} `)} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(); | ||
| }, fe = (t) => { | ||
| const n = (s, r) => { | ||
| const i = s.label ?? String(s.value); | ||
| return r === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "selected" ? `${e.green(T)} ${e.dim(i)}` : r === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`; | ||
| }; | ||
| return new wD({ | ||
| options: t.options, | ||
| initialValues: t.initialValues, | ||
| required: t.required ?? true, | ||
| cursorAt: t.cursorAt, | ||
| validate(s) { | ||
| if (this.required && s.length === 0) return `Please select at least one option. | ||
| ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`; | ||
| }, | ||
| render() { | ||
| const s = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `, r = (i, a) => { | ||
| const c = this.value.includes(i.value); | ||
| return a && c ? n(i, "active-selected") : c ? n(i, "selected") : n(i, a ? "active" : "inactive"); | ||
| }; | ||
| switch (this.state) { | ||
| case "submit": return `${s}${e.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e.dim(", ")) || e.dim("none")}`; | ||
| case "cancel": { | ||
| const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(e.dim(", ")); | ||
| return `${s}${e.gray(o)} ${i.trim() ? `${i} | ||
| ${e.gray(o)}` : ""}`; | ||
| } | ||
| case "error": { | ||
| const i = this.error.split(` | ||
| `).map((a, c) => c === 0 ? `${e.yellow(d)} ${e.yellow(a)}` : ` ${a}`).join(` | ||
| `); | ||
| return `${s + e.yellow(o)} ${B({ | ||
| options: this.options, | ||
| cursor: this.cursor, | ||
| maxItems: t.maxItems, | ||
| style: r | ||
| }).join(` | ||
| ${e.yellow(o)} `)} | ||
| ${i} | ||
| `; | ||
| } | ||
| default: return `${s}${e.cyan(o)} ${B({ | ||
| options: this.options, | ||
| cursor: this.cursor, | ||
| maxItems: t.maxItems, | ||
| style: r | ||
| }).join(` | ||
| ${e.cyan(o)} `)} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(); | ||
| }; | ||
| `${e.gray(o)}`; | ||
| const kCancel = Symbol.for("cancel"); | ||
| async function prompt(message, opts = {}) { | ||
| const handleCancel = (value) => { | ||
| if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") return value; | ||
| switch (opts.cancel) { | ||
| case "reject": { | ||
| const error = /* @__PURE__ */ new Error("Prompt cancelled."); | ||
| error.name = "ConsolaPromptCancelledError"; | ||
| if (Error.captureStackTrace) Error.captureStackTrace(error, prompt); | ||
| throw error; | ||
| } | ||
| case "undefined": return; | ||
| case "null": return null; | ||
| case "symbol": return kCancel; | ||
| default: | ||
| case "default": return opts.default ?? opts.initial; | ||
| } | ||
| }; | ||
| if (!opts.type || opts.type === "text") return await he({ | ||
| message, | ||
| defaultValue: opts.default, | ||
| placeholder: opts.placeholder, | ||
| initialValue: opts.initial | ||
| }).then(handleCancel); | ||
| if (opts.type === "confirm") return await ye({ | ||
| message, | ||
| initialValue: opts.initial | ||
| }).then(handleCancel); | ||
| if (opts.type === "select") return await ve({ | ||
| message, | ||
| options: opts.options.map((o) => typeof o === "string" ? { | ||
| value: o, | ||
| label: o | ||
| } : o), | ||
| initialValue: opts.initial | ||
| }).then(handleCancel); | ||
| if (opts.type === "multiselect") return await fe({ | ||
| message, | ||
| options: opts.options.map((o) => typeof o === "string" ? { | ||
| value: o, | ||
| label: o | ||
| } : o), | ||
| required: opts.required, | ||
| initialValues: opts.initial | ||
| }).then(handleCancel); | ||
| throw new Error(`Unknown prompt type: ${opts.type}`); | ||
| } | ||
| //#endregion | ||
| export { prompt }; |
| import { n as __toESM, t as require_binding } from "./binding-lLxFxuG-.mjs"; | ||
| import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-B8po7KiL.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 }; |
| import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-9MccaWPU.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 }; |
Sorry, the diff of this file is too big to display
| import { a as RolldownLog } from "./logging-BSNejiLS.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-DktDDYoY.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 }; |
| import { n as __toESM, t as require_binding } from "./binding-lLxFxuG-.mjs"; | ||
| import { o as logMultipleWatcherOption } from "./logs-aMKUxRpj.mjs"; | ||
| import { v as LOG_LEVEL_WARN } from "./bindingify-input-options-DmY7myA4.mjs"; | ||
| import { t as arraify } from "./misc-CoQm4NHO.mjs"; | ||
| import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-9MccaWPU.mjs"; | ||
| import { t as aggregateBindingErrorsIntoJsError } from "./error-B8po7KiL.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 }; |
+7
-7
@@ -1,7 +0,7 @@ | ||
| import { n as onExit, t as watch } from "./shared/watch-RBs0UNYA.mjs"; | ||
| import { C as version, S as description } from "./shared/bindingify-input-options-BnfFBV6b.mjs"; | ||
| import { t as arraify } from "./shared/misc-DJYbNKZX.mjs"; | ||
| import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-BVD3dIdE.mjs"; | ||
| import { t as rolldown } from "./shared/rolldown-CWsV1rrO.mjs"; | ||
| import { t as loadConfig } from "./shared/load-config-CYoi2Wo1.mjs"; | ||
| import { n as onExit, t as watch } from "./shared/watch-HI3wX0Zu.mjs"; | ||
| import { C as version, S as description } from "./shared/bindingify-input-options-DmY7myA4.mjs"; | ||
| import { t as arraify } from "./shared/misc-CoQm4NHO.mjs"; | ||
| import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-9MccaWPU.mjs"; | ||
| import { t as rolldown } from "./shared/rolldown-B9_Kw98b.mjs"; | ||
| import { t as loadConfig } from "./shared/load-config-ByfeVF0s.mjs"; | ||
| import path from "node:path"; | ||
@@ -850,3 +850,3 @@ import process$1 from "node:process"; | ||
| //#endregion | ||
| //#region \0@oxc-project+runtime@0.130.0/helpers/usingCtx.js | ||
| //#region \0@oxc-project+runtime@0.132.0/helpers/usingCtx.js | ||
| function _usingCtx() { | ||
@@ -853,0 +853,0 @@ var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) { |
@@ -1,2 +0,2 @@ | ||
| import { I as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-CeKzMIcs.mjs"; | ||
| import { I as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-Bo24xyUK.mjs"; | ||
@@ -3,0 +3,0 @@ //#region src/utils/load-config.d.ts |
+3
-3
@@ -1,4 +0,4 @@ | ||
| import { x as VERSION } from "./shared/bindingify-input-options-BnfFBV6b.mjs"; | ||
| import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs"; | ||
| import { t as loadConfig } from "./shared/load-config-CYoi2Wo1.mjs"; | ||
| import { x as VERSION } from "./shared/bindingify-input-options-DmY7myA4.mjs"; | ||
| import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs"; | ||
| import { t as loadConfig } from "./shared/load-config-ByfeVF0s.mjs"; | ||
| export { VERSION, defineConfig, loadConfig }; |
@@ -1,5 +0,5 @@ | ||
| 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-zH1vcmbM.mjs"; | ||
| import { Jt as RolldownOutput, P as BuiltinPlugin, Xt as freeExternalMemory, Z as defineParallelPlugin, ct as NormalizedOutputOptions, l as InputOptions, zt as OutputOptions } from "./shared/define-config-CeKzMIcs.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-DgZ3paSD.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-DAnSz-_I.mjs"; | ||
| 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-DktDDYoY.mjs"; | ||
| import { Jt as RolldownOutput, P as BuiltinPlugin, Ut as StringOrRegExp, Xt as freeExternalMemory, Z as defineParallelPlugin, ct as NormalizedOutputOptions, l as InputOptions, zt as OutputOptions } from "./shared/define-config-Bo24xyUK.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-BpeSEA-X.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-Dc4Y1bfN.mjs"; | ||
@@ -51,2 +51,18 @@ //#region src/api/dev/dev-options.d.ts | ||
| debounceTickRate?: number; | ||
| /** | ||
| * Filter to limit which discovered files are registered with the file watcher. | ||
| * | ||
| * Strings are treated as glob patterns. | ||
| * | ||
| * @default [] | ||
| */ | ||
| include?: StringOrRegExp | StringOrRegExp[]; | ||
| /** | ||
| * Filter to prevent discovered files from being registered with the file watcher. | ||
| * | ||
| * Strings are treated as glob patterns. | ||
| * | ||
| * @default [] | ||
| */ | ||
| exclude?: StringOrRegExp | StringOrRegExp[]; | ||
| } | ||
@@ -53,0 +69,0 @@ interface DevOptions { |
@@ -1,9 +0,9 @@ | ||
| import { n as __toESM, t as require_binding } from "./shared/binding-C9S351wt.mjs"; | ||
| import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-C-WttzRA.mjs"; | ||
| import { o as transformToRollupOutput } from "./shared/bindingify-input-options-BnfFBV6b.mjs"; | ||
| import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-BVD3dIdE.mjs"; | ||
| import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-CkdMJ9ps.mjs"; | ||
| import { n as parseSync$1, t as parse$1 } from "./shared/parse-Ch28GO2f.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-Ciqn_yS7.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-DkVV0OYf.mjs"; | ||
| import { n as __toESM, t as require_binding } from "./shared/binding-lLxFxuG-.mjs"; | ||
| import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-DqWsYC5b.mjs"; | ||
| import { o as transformToRollupOutput } from "./shared/bindingify-input-options-DmY7myA4.mjs"; | ||
| import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-9MccaWPU.mjs"; | ||
| import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-B8po7KiL.mjs"; | ||
| import { n as parseSync$1, t as parse$1 } from "./shared/parse-DRL-bdRR.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-BWzinPZW.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-B5gzX9_3.mjs"; | ||
| import { pathToFileURL } from "node:url"; | ||
@@ -50,3 +50,5 @@ //#region src/api/dev/dev-engine.ts | ||
| compareContentsForPolling: devOptions.watch.compareContentsForPolling, | ||
| debounceTickRate: devOptions.watch.debounceTickRate | ||
| debounceTickRate: devOptions.watch.debounceTickRate, | ||
| include: normalizedStringOrRegex(devOptions.watch.include), | ||
| exclude: normalizedStringOrRegex(devOptions.watch.exclude) | ||
| } | ||
@@ -53,0 +55,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
| import { N as withFilter } from "./shared/define-config-CeKzMIcs.mjs"; | ||
| import { N as withFilter } from "./shared/define-config-Bo24xyUK.mjs"; | ||
@@ -3,0 +3,0 @@ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.d.ts |
@@ -1,2 +0,2 @@ | ||
| import { n as isPromiseLike, t as arraify } from "./shared/misc-DJYbNKZX.mjs"; | ||
| import { n as isPromiseLike, t as arraify } from "./shared/misc-CoQm4NHO.mjs"; | ||
| //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0/node_modules/@rolldown/pluginutils/dist/utils.js | ||
@@ -3,0 +3,0 @@ const postfixRE = /[?#].*$/; |
@@ -1,3 +0,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 }; | ||
| import { a as RolldownLog } from "./shared/logging-BSNejiLS.mjs"; | ||
| import { n as getLogFilter, t as GetLogFilter } from "./shared/get-log-filter-BpNVNJ5-.mjs"; | ||
| export { GetLogFilter, type RolldownLog, type RolldownLog as RollupLog, getLogFilter as default }; |
+4
-4
@@ -1,4 +0,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-zH1vcmbM.mjs"; | ||
| import { $ as PluginContextMeta, A as RolldownPluginOption, At as CodeSplittingGroup, B as OutputBundle, Bt as PreRenderedAsset, C as ParallelPluginHooks, Ct as build, D as ResolveIdResult, Dt as BuiltinModuleTag, E as ResolveIdExtraOptions, Et as AdvancedChunksOptions, F as RUNTIME_MODULE_ID, Ft as GeneratedCodePreset, G as EmittedFile, Gt as OutputChunk, H as TransformPluginContext, Ht as PartialNull, I as VERSION, It as GlobalsFunction, J as PluginContext, Jt as RolldownOutput, K as EmittedPrebuiltChunk, Kt as RenderedChunk, L as BundleError, Lt as MinifyOptions, M as TransformResult, Mt as CodeSplittingOptions, Nt as CommentsOptions, O as ResolvedId, Ot as ChunkFileNamesFunction, Pt as GeneratedCodeOptions, Q as MinimalPluginContext, Qt as SourcemapIgnoreListOption, R as ExistingRawSourceMap, Rt as ModuleFormat, S as ObjectHook, St as BuildOptions, T as Plugin, Tt as AdvancedChunksGroup, U as EmittedAsset, V as TreeshakingOptions, W as EmittedChunk, Wt as OutputAsset, X as DefineParallelPluginResult, Y as PluginContextResolveOptions, Yt as SourceMap, Zt as ModuleInfo, _ as HookFilterExtension, _t as RolldownWatcherEvent, a as ChunkOptimizationOptions, at as RolldownFileStats, b as ModuleOptions, bt as rolldown, c as InputOption, ct as NormalizedOutputOptions, d as OptimizationOptions, dt as ChecksOptions, et as GeneralHookFilter, f as WatcherFileWatcherOptions, ft as LoggingFunction, g as FunctionPluginHooks, gt as RolldownWatcher, h as CustomPluginOptions, ht as watch, i as RolldownOptions, it as RolldownDirectoryEntry, j as SourceDescription, jt as CodeSplittingNameFunction, k as RolldownPlugin, kt as ChunkingContext, l as InputOptions, lt as NormalizedInputOptions, m as AsyncPluginHooks, mt as RolldownMagicString, n as RolldownOptionsFunction, nt as ModuleTypeFilter, o as ExternalOption, ot as RolldownFsModule, p as WatcherOptions, pt as WarningHandlerWithDefault, q as GetModuleInfo, qt as RenderedModule, r as defineConfig, rt as BufferEncoding, s as ExternalOptionFunction, st as InternalModuleFormat, t as ConfigExport, tt as HookFilter, u as ModuleTypes, ut as TransformOptions, v as ImportKind, vt as RolldownWatcherWatcherEventMap, w as PartialResolvedId, wt as AddonFunction, x as ModuleType, xt as RolldownBuild, y as LoadResult, yt as WatchOptions, z as SourceMapInput, zt as OutputOptions } from "./shared/define-config-CeKzMIcs.mjs"; | ||
| export { AddonFunction, AdvancedChunksGroup, AdvancedChunksOptions, AsyncPluginHooks, BufferEncoding, BuildOptions, BuiltinModuleTag, BundleError, ChecksOptions, ChunkFileNamesFunction, ChunkOptimizationOptions, 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 }; | ||
| import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-BSNejiLS.mjs"; | ||
| import { z as PreRenderedChunk } from "./shared/binding-DktDDYoY.mjs"; | ||
| import { $ as PluginContextMeta, A as RolldownPluginOption, At as CodeSplittingGroup, B as OutputBundle, Bt as PreRenderedAsset, C as ParallelPluginHooks, Ct as build, D as ResolveIdResult, Dt as BuiltinModuleTag, E as ResolveIdExtraOptions, Et as AdvancedChunksOptions, F as RUNTIME_MODULE_ID, Ft as GeneratedCodePreset, G as EmittedFile, Gt as OutputChunk, H as TransformPluginContext, Ht as PartialNull, I as VERSION, It as GlobalsFunction, J as PluginContext, Jt as RolldownOutput, K as EmittedPrebuiltChunk, Kt as RenderedChunk, L as BundleError, Lt as MinifyOptions, M as TransformResult, Mt as CodeSplittingOptions, Nt as CommentsOptions, O as ResolvedId, Ot as ChunkFileNamesFunction, Pt as GeneratedCodeOptions, Q as MinimalPluginContext, Qt as SourcemapIgnoreListOption, R as ExistingRawSourceMap, Rt as ModuleFormat, S as ObjectHook, St as BuildOptions, T as Plugin, Tt as AdvancedChunksGroup, U as EmittedAsset, V as TreeshakingOptions, W as EmittedChunk, Wt as OutputAsset, X as DefineParallelPluginResult, Y as PluginContextResolveOptions, Yt as SourceMap, Zt as ModuleInfo, _ as HookFilterExtension, _t as RolldownWatcherEvent, a as ChunkOptimizationOptions, at as RolldownFileStats, b as ModuleOptions, bt as rolldown, c as InputOption, ct as NormalizedOutputOptions, d as OptimizationOptions, dt as ChecksOptions, et as GeneralHookFilter, f as WatcherFileWatcherOptions, ft as LoggingFunction, g as FunctionPluginHooks, gt as RolldownWatcher, h as CustomPluginOptions, ht as watch, i as RolldownOptions, it as RolldownDirectoryEntry, j as SourceDescription, jt as CodeSplittingNameFunction, k as RolldownPlugin, kt as ChunkingContext, l as InputOptions, lt as NormalizedInputOptions, m as AsyncPluginHooks, mt as RolldownMagicString, n as RolldownOptionsFunction, nt as ModuleTypeFilter, o as ExternalOption, ot as RolldownFsModule, p as WatcherOptions, pt as WarningHandlerWithDefault, q as GetModuleInfo, qt as RenderedModule, r as defineConfig, rt as BufferEncoding, s as ExternalOptionFunction, st as InternalModuleFormat, t as ConfigExport, tt as HookFilter, u as ModuleTypes, ut as TransformOptions, v as ImportKind, vt as RolldownWatcherWatcherEventMap, w as PartialResolvedId, wt as AddonFunction, x as ModuleType, xt as RolldownBuild, y as LoadResult, yt as WatchOptions, z as SourceMapInput, zt as OutputOptions } from "./shared/define-config-Bo24xyUK.mjs"; | ||
| export { type AddonFunction, type AdvancedChunksGroup, type AdvancedChunksOptions, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, type BuiltinModuleTag, type BundleError, type ChecksOptions, type ChunkFileNamesFunction, type ChunkOptimizationOptions, type ChunkingContext, type CodeSplittingGroup, type CodeSplittingNameFunction, type CodeSplittingOptions, type CommentsOptions, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedChunk, type EmittedFile, type EmittedPrebuiltChunk, type ExistingRawSourceMap, type ExternalOption, type ExternalOptionFunction, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PluginContextResolveOptions, type PreRenderedAsset, type PreRenderedChunk, RUNTIME_MODULE_ID, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownError, type RolldownError as RollupError, type RolldownFileStats, type RolldownFsModule, type RolldownLog, type RolldownLog as RollupLog, type RolldownLogWithString, type RolldownLogWithString as RollupLogWithString, RolldownMagicString, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RolldownWatcherWatcherEventMap, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, type TransformOptions, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherFileWatcherOptions, type WatcherOptions, build, defineConfig, rolldown, watch }; |
+5
-5
@@ -1,6 +0,6 @@ | ||
| import { n as __toESM, t as require_binding } from "./shared/binding-C9S351wt.mjs"; | ||
| import { n as onExit, t as watch } from "./shared/watch-RBs0UNYA.mjs"; | ||
| import { a as RolldownMagicString, b as RUNTIME_MODULE_ID, x as VERSION } from "./shared/bindingify-input-options-BnfFBV6b.mjs"; | ||
| import { t as rolldown } from "./shared/rolldown-CWsV1rrO.mjs"; | ||
| import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs"; | ||
| import { n as __toESM, t as require_binding } from "./shared/binding-lLxFxuG-.mjs"; | ||
| import { n as onExit, t as watch } from "./shared/watch-HI3wX0Zu.mjs"; | ||
| import { a as RolldownMagicString, b as RUNTIME_MODULE_ID, x as VERSION } from "./shared/bindingify-input-options-DmY7myA4.mjs"; | ||
| import { t as rolldown } from "./shared/rolldown-B9_Kw98b.mjs"; | ||
| import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs"; | ||
| import { isMainThread } from "node:worker_threads"; | ||
@@ -7,0 +7,0 @@ //#region src/setup.ts |
@@ -1,3 +0,3 @@ | ||
| import { n as __toESM, t as require_binding } from "./shared/binding-C9S351wt.mjs"; | ||
| import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-BnfFBV6b.mjs"; | ||
| import { n as __toESM, t as require_binding } from "./shared/binding-lLxFxuG-.mjs"; | ||
| import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-DmY7myA4.mjs"; | ||
| import { parentPort, workerData } from "node:worker_threads"; | ||
@@ -4,0 +4,0 @@ //#region src/parallel-plugin-worker.ts |
@@ -1,2 +0,2 @@ | ||
| import { T as Plugin, Vt as MaybePromise } from "./shared/define-config-CeKzMIcs.mjs"; | ||
| import { T as Plugin, Vt as MaybePromise } from "./shared/define-config-Bo24xyUK.mjs"; | ||
@@ -3,0 +3,0 @@ //#region src/plugin/parallel-plugin-implementation.d.ts |
@@ -1,2 +0,2 @@ | ||
| import { L as ParseResult$1, R as ParserOptions$1 } from "./shared/binding-zH1vcmbM.mjs"; | ||
| import { L as ParseResult$1, R as ParserOptions$1 } from "./shared/binding-DktDDYoY.mjs"; | ||
| import { Program } from "@oxc-project/types"; | ||
@@ -3,0 +3,0 @@ |
@@ -1,3 +0,3 @@ | ||
| 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-Ch28GO2f.mjs"; | ||
| import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-aMKUxRpj.mjs"; | ||
| import { n as parseSync, t as parse } from "./shared/parse-DRL-bdRR.mjs"; | ||
| //#region src/parse-ast-index.ts | ||
@@ -4,0 +4,0 @@ function wrap(result, filename, sourceText) { |
@@ -1,4 +0,4 @@ | ||
| import { m as BindingReplacePluginConfig } from "./shared/binding-zH1vcmbM.mjs"; | ||
| import { P as BuiltinPlugin } from "./shared/define-config-CeKzMIcs.mjs"; | ||
| import { t as esmExternalRequirePlugin } from "./shared/constructors-DAnSz-_I.mjs"; | ||
| import { m as BindingReplacePluginConfig } from "./shared/binding-DktDDYoY.mjs"; | ||
| import { P as BuiltinPlugin } from "./shared/define-config-Bo24xyUK.mjs"; | ||
| import { t as esmExternalRequirePlugin } from "./shared/constructors-Dc4Y1bfN.mjs"; | ||
@@ -5,0 +5,0 @@ //#region src/builtin-plugin/replace-plugin.d.ts |
@@ -1,3 +0,3 @@ | ||
| import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-C-WttzRA.mjs"; | ||
| import { t as esmExternalRequirePlugin } from "./shared/constructors-Ciqn_yS7.mjs"; | ||
| import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-DqWsYC5b.mjs"; | ||
| import { t as esmExternalRequirePlugin } from "./shared/constructors-BWzinPZW.mjs"; | ||
| //#region src/builtin-plugin/replace-plugin.ts | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,7 +0,7 @@ | ||
| import { _ as BindingTsconfigRawOptions, g as BindingTsconfigCompilerOptions } from "./shared/binding-zH1vcmbM.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-DgZ3paSD.mjs"; | ||
| import { _ as BindingTsconfigRawOptions, g as BindingTsconfigCompilerOptions } from "./shared/binding-DktDDYoY.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-BpeSEA-X.mjs"; | ||
| import * as ESTree from "@oxc-project/types"; | ||
| import { Program } from "@oxc-project/types"; | ||
| //#region ../../node_modules/.pnpm/oxc-parser@0.130.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts | ||
| //#region ../../node_modules/.pnpm/oxc-parser@0.132.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts | ||
| interface VisitorObject$1 { | ||
@@ -8,0 +8,0 @@ DebuggerStatement?: (node: ESTree.DebuggerStatement) => void; |
+22
-22
| { | ||
| "name": "rolldown", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@oxc-project/types": "=0.130.0", | ||
| "@oxc-project/types": "=0.132.0", | ||
| "@rolldown/pluginutils": "^1.0.0" | ||
@@ -70,7 +70,7 @@ }, | ||
| "glob": "^13.0.0", | ||
| "oxc-parser": "=0.130.0", | ||
| "oxc-parser": "=0.132.0", | ||
| "pathe": "^2.0.3", | ||
| "remeda": "^2.10.0", | ||
| "rolldown-plugin-dts": "^0.25.0", | ||
| "rollup": "^4.18.0", | ||
| "remeda": "^2.34.1", | ||
| "rolldown-plugin-dts": "^0.25.1", | ||
| "rollup": "^4.60.4", | ||
| "signal-exit": "4.1.0", | ||
@@ -80,3 +80,3 @@ "source-map": "0.7.6", | ||
| "valibot": "1.4.0", | ||
| "rolldown": "1.0.1" | ||
| "rolldown": "1.0.2" | ||
| }, | ||
@@ -117,17 +117,17 @@ "napi": { | ||
| "optionalDependencies": { | ||
| "@rolldown/binding-darwin-x64": "1.0.1", | ||
| "@rolldown/binding-win32-x64-msvc": "1.0.1", | ||
| "@rolldown/binding-linux-x64-gnu": "1.0.1", | ||
| "@rolldown/binding-linux-x64-musl": "1.0.1", | ||
| "@rolldown/binding-freebsd-x64": "1.0.1", | ||
| "@rolldown/binding-linux-arm-gnueabihf": "1.0.1", | ||
| "@rolldown/binding-linux-arm64-gnu": "1.0.1", | ||
| "@rolldown/binding-darwin-arm64": "1.0.1", | ||
| "@rolldown/binding-linux-arm64-musl": "1.0.1", | ||
| "@rolldown/binding-openharmony-arm64": "1.0.1", | ||
| "@rolldown/binding-win32-arm64-msvc": "1.0.1", | ||
| "@rolldown/binding-android-arm64": "1.0.1", | ||
| "@rolldown/binding-wasm32-wasi": "1.0.1", | ||
| "@rolldown/binding-linux-s390x-gnu": "1.0.1", | ||
| "@rolldown/binding-linux-ppc64-gnu": "1.0.1" | ||
| "@rolldown/binding-darwin-x64": "1.0.2", | ||
| "@rolldown/binding-win32-x64-msvc": "1.0.2", | ||
| "@rolldown/binding-linux-x64-gnu": "1.0.2", | ||
| "@rolldown/binding-linux-x64-musl": "1.0.2", | ||
| "@rolldown/binding-freebsd-x64": "1.0.2", | ||
| "@rolldown/binding-linux-arm-gnueabihf": "1.0.2", | ||
| "@rolldown/binding-linux-arm64-gnu": "1.0.2", | ||
| "@rolldown/binding-darwin-arm64": "1.0.2", | ||
| "@rolldown/binding-linux-arm64-musl": "1.0.2", | ||
| "@rolldown/binding-openharmony-arm64": "1.0.2", | ||
| "@rolldown/binding-win32-arm64-msvc": "1.0.2", | ||
| "@rolldown/binding-android-arm64": "1.0.2", | ||
| "@rolldown/binding-wasm32-wasi": "1.0.2", | ||
| "@rolldown/binding-linux-s390x-gnu": "1.0.2", | ||
| "@rolldown/binding-linux-ppc64-gnu": "1.0.2" | ||
| }, | ||
@@ -134,0 +134,0 @@ "scripts": { |
| 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), cb = null), 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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.1" && 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.1 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 }; |
| import * as _$_oxc_project_types0 from "@oxc-project/types"; | ||
| //#region src/binding.d.cts | ||
| type MaybePromise<T> = T | Promise<T>; | ||
| type VoidNullable<T = void> = T | null | undefined | void; | ||
| type BindingStringOrRegex = string | RegExp; | ||
| interface CodegenOptions { | ||
| /** | ||
| * Remove whitespace. | ||
| * | ||
| * @default true | ||
| */ | ||
| removeWhitespace?: boolean; | ||
| } | ||
| interface CompressOptions { | ||
| /** | ||
| * Set desired EcmaScript standard version for output. | ||
| * | ||
| * Set `esnext` to enable all target highering. | ||
| * | ||
| * Example: | ||
| * | ||
| * * `'es2015'` | ||
| * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` | ||
| * | ||
| * @default 'esnext' | ||
| * | ||
| * @see [esbuild#target](https://esbuild.github.io/api/#target) | ||
| */ | ||
| target?: string | Array<string>; | ||
| /** | ||
| * Pass true to discard calls to `console.*`. | ||
| * | ||
| * @default false | ||
| */ | ||
| dropConsole?: boolean; | ||
| /** | ||
| * Remove `debugger;` statements. | ||
| * | ||
| * @default true | ||
| */ | ||
| dropDebugger?: boolean; | ||
| /** | ||
| * Pass `true` to drop unreferenced functions and variables. | ||
| * | ||
| * Simple direct variable assignments do not count as references unless set to `keep_assign`. | ||
| * @default true | ||
| */ | ||
| unused?: boolean | 'keep_assign'; | ||
| /** Keep function / class names. */ | ||
| keepNames?: CompressOptionsKeepNames; | ||
| /** | ||
| * Join consecutive var, let and const statements. | ||
| * | ||
| * @default true | ||
| */ | ||
| joinVars?: boolean; | ||
| /** | ||
| * Join consecutive simple statements using the comma operator. | ||
| * | ||
| * `a; b` -> `a, b` | ||
| * | ||
| * @default true | ||
| */ | ||
| sequences?: boolean; | ||
| /** | ||
| * Set of label names to drop from the code. | ||
| * | ||
| * Labeled statements matching these names will be removed during minification. | ||
| * | ||
| * @default [] | ||
| */ | ||
| dropLabels?: Array<string>; | ||
| /** Limit the maximum number of iterations for debugging purpose. */ | ||
| maxIterations?: number; | ||
| /** Treeshake options. */ | ||
| treeshake?: TreeShakeOptions; | ||
| } | ||
| interface CompressOptionsKeepNames { | ||
| /** | ||
| * Keep function names so that `Function.prototype.name` is preserved. | ||
| * | ||
| * This does not guarantee that the `undefined` name is preserved. | ||
| * | ||
| * @default false | ||
| */ | ||
| function: boolean; | ||
| /** | ||
| * Keep class names so that `Class.prototype.name` is preserved. | ||
| * | ||
| * This does not guarantee that the `undefined` name is preserved. | ||
| * | ||
| * @default false | ||
| */ | ||
| class: boolean; | ||
| } | ||
| interface MangleOptions { | ||
| /** | ||
| * Pass `true` to mangle names declared in the top level scope. | ||
| * | ||
| * @default true for modules and commonjs, otherwise false | ||
| */ | ||
| toplevel?: boolean; | ||
| /** | ||
| * Preserve `name` property for functions and classes. | ||
| * | ||
| * @default false | ||
| */ | ||
| keepNames?: boolean | MangleOptionsKeepNames; | ||
| /** Debug mangled names. */ | ||
| debug?: boolean; | ||
| } | ||
| interface MangleOptionsKeepNames { | ||
| /** | ||
| * Preserve `name` property for functions. | ||
| * | ||
| * @default false | ||
| */ | ||
| function: boolean; | ||
| /** | ||
| * Preserve `name` property for classes. | ||
| * | ||
| * @default false | ||
| */ | ||
| class: boolean; | ||
| } | ||
| interface MinifyOptions { | ||
| /** Use when minifying an ES module. */ | ||
| module?: boolean; | ||
| compress?: boolean | CompressOptions; | ||
| mangle?: boolean | MangleOptions; | ||
| codegen?: boolean | CodegenOptions; | ||
| sourcemap?: boolean; | ||
| } | ||
| interface MinifyResult { | ||
| code: string; | ||
| map?: SourceMap; | ||
| errors: Array<OxcError>; | ||
| } | ||
| interface TreeShakeOptions { | ||
| /** | ||
| * Whether to respect the pure annotations. | ||
| * | ||
| * Pure annotations are comments that mark an expression as pure. | ||
| * For example: @__PURE__ or #__NO_SIDE_EFFECTS__. | ||
| * | ||
| * @default true | ||
| */ | ||
| annotations?: boolean; | ||
| /** | ||
| * Whether to treat this function call as pure. | ||
| * | ||
| * This function is called for normal function calls, new calls, and | ||
| * tagged template calls. | ||
| */ | ||
| manualPureFunctions?: Array<string>; | ||
| /** | ||
| * Whether property read accesses have side effects. | ||
| * | ||
| * @default 'always' | ||
| */ | ||
| propertyReadSideEffects?: boolean | 'always'; | ||
| /** | ||
| * Whether property write accesses (assignments to member expressions) have side effects. | ||
| * | ||
| * When false, assignments like `obj.prop = value` are considered side-effect-free | ||
| * (assuming the object and value expressions themselves are side-effect-free). | ||
| * | ||
| * @default true | ||
| */ | ||
| propertyWriteSideEffects?: boolean; | ||
| /** | ||
| * Whether accessing a global variable has side effects. | ||
| * | ||
| * Accessing a non-existing global variable will throw an error. | ||
| * Global variable may be a getter that has side effects. | ||
| * | ||
| * @default true | ||
| */ | ||
| unknownGlobalSideEffects?: boolean; | ||
| /** | ||
| * Whether invalid import statements have side effects. | ||
| * | ||
| * Accessing a non-existing import name will throw an error. | ||
| * Also import statements that cannot be resolved will throw an error. | ||
| * | ||
| * @default true | ||
| */ | ||
| invalidImportSideEffects?: boolean; | ||
| } | ||
| interface Comment { | ||
| type: 'Line' | 'Block'; | ||
| value: string; | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface ErrorLabel { | ||
| message: string | null; | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface OxcError { | ||
| severity: Severity; | ||
| message: string; | ||
| labels: Array<ErrorLabel>; | ||
| helpMessage: string | null; | ||
| codeframe: string | null; | ||
| } | ||
| type Severity = 'Error' | 'Warning' | 'Advice'; | ||
| declare class ParseResult { | ||
| get program(): _$_oxc_project_types0.Program; | ||
| get module(): EcmaScriptModule; | ||
| get comments(): Array<Comment>; | ||
| get errors(): Array<OxcError>; | ||
| } | ||
| interface DynamicImport { | ||
| start: number; | ||
| end: number; | ||
| moduleRequest: Span; | ||
| } | ||
| interface EcmaScriptModule { | ||
| /** | ||
| * Has ESM syntax. | ||
| * | ||
| * i.e. `import` and `export` statements, and `import.meta`. | ||
| * | ||
| * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files. | ||
| */ | ||
| hasModuleSyntax: boolean; | ||
| /** Import statements. */ | ||
| staticImports: Array<StaticImport>; | ||
| /** Export statements. */ | ||
| staticExports: Array<StaticExport>; | ||
| /** Dynamic import expressions. */ | ||
| dynamicImports: Array<DynamicImport>; | ||
| /** Span positions` of `import.meta` */ | ||
| importMetas: Array<Span>; | ||
| } | ||
| interface ExportExportName { | ||
| kind: ExportExportNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ExportExportNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' | /** `export * from "mod" */'None'; | ||
| interface ExportImportName { | ||
| kind: ExportImportNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ExportImportNameKind = /** `export { name } */'Name' | /** `export * as ns from "mod"` */'All' | /** `export * from "mod"` */'AllButDefault' | /** Does not have a specifier. */'None'; | ||
| interface ExportLocalName { | ||
| kind: ExportLocalNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ExportLocalNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' | | ||
| /** | ||
| * If the exported value is not locally accessible from within the module. | ||
| * `export default function () {}` | ||
| */ | ||
| 'None'; | ||
| interface ImportName { | ||
| kind: ImportNameKind; | ||
| name: string | null; | ||
| start: number | null; | ||
| end: number | null; | ||
| } | ||
| type ImportNameKind = /** `import { x } from "mod"` */'Name' | /** `import * as ns from "mod"` */'NamespaceObject' | /** `import defaultExport from "mod"` */'Default'; | ||
| interface ParserOptions { | ||
| /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */ | ||
| lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; | ||
| /** Treat the source text as `script` or `module` code. */ | ||
| sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined; | ||
| /** | ||
| * Return an AST which includes TypeScript-related properties, or excludes them. | ||
| * | ||
| * `'js'` is default for JS / JSX files. | ||
| * `'ts'` is default for TS / TSX files. | ||
| * The type of the file is determined from `lang` option, or extension of provided `filename`. | ||
| */ | ||
| astType?: 'js' | 'ts'; | ||
| /** | ||
| * Controls whether the `range` property is included on AST nodes. | ||
| * The `range` property is a `[number, number]` which indicates the start/end offsets | ||
| * of the node in the file contents. | ||
| * | ||
| * @default false | ||
| */ | ||
| range?: boolean; | ||
| /** | ||
| * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST. | ||
| * | ||
| * If this option is true, parenthesized expressions are represented by | ||
| * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that | ||
| * have a single `expression` property containing the expression inside parentheses. | ||
| * | ||
| * @default true | ||
| */ | ||
| preserveParens?: boolean; | ||
| /** | ||
| * Produce semantic errors with an additional AST pass. | ||
| * Semantic errors depend on symbols and scopes, where the parser does not construct. | ||
| * This adds a small performance overhead. | ||
| * | ||
| * @default false | ||
| */ | ||
| showSemanticErrors?: boolean; | ||
| } | ||
| interface Span { | ||
| start: number; | ||
| end: number; | ||
| } | ||
| interface StaticExport { | ||
| start: number; | ||
| end: number; | ||
| entries: Array<StaticExportEntry>; | ||
| } | ||
| interface StaticExportEntry { | ||
| start: number; | ||
| end: number; | ||
| moduleRequest: ValueSpan | null; | ||
| /** The name under which the desired binding is exported by the module`. */ | ||
| importName: ExportImportName; | ||
| /** The name used to export this binding by this module. */ | ||
| exportName: ExportExportName; | ||
| /** The name that is used to locally access the exported value from within the importing module. */ | ||
| localName: ExportLocalName; | ||
| /** | ||
| * Whether the export is a TypeScript `export type`. | ||
| * | ||
| * Examples: | ||
| * | ||
| * ```ts | ||
| * export type * from 'mod'; | ||
| * export type * as ns from 'mod'; | ||
| * export type { foo }; | ||
| * export { type foo }: | ||
| * export type { foo } from 'mod'; | ||
| * ``` | ||
| */ | ||
| isType: boolean; | ||
| } | ||
| interface StaticImport { | ||
| /** Start of import statement. */ | ||
| start: number; | ||
| /** End of import statement. */ | ||
| end: number; | ||
| /** | ||
| * Import source. | ||
| * | ||
| * ```js | ||
| * import { foo } from "mod"; | ||
| * // ^^^ | ||
| * ``` | ||
| */ | ||
| moduleRequest: ValueSpan; | ||
| /** | ||
| * Import specifiers. | ||
| * | ||
| * Empty for `import "mod"`. | ||
| */ | ||
| entries: Array<StaticImportEntry>; | ||
| } | ||
| interface StaticImportEntry { | ||
| /** | ||
| * The name under which the desired binding is exported by the module. | ||
| * | ||
| * ```js | ||
| * import { foo } from "mod"; | ||
| * // ^^^ | ||
| * import { foo as bar } from "mod"; | ||
| * // ^^^ | ||
| * ``` | ||
| */ | ||
| importName: ImportName; | ||
| /** | ||
| * The name that is used to locally access the imported value from within the importing module. | ||
| * ```js | ||
| * import { foo } from "mod"; | ||
| * // ^^^ | ||
| * import { foo as bar } from "mod"; | ||
| * // ^^^ | ||
| * ``` | ||
| */ | ||
| localName: ValueSpan; | ||
| /** | ||
| * Whether this binding is for a TypeScript type-only import. | ||
| * | ||
| * `true` for the following imports: | ||
| * ```ts | ||
| * import type { foo } from "mod"; | ||
| * import { type foo } from "mod"; | ||
| * ``` | ||
| */ | ||
| isType: boolean; | ||
| } | ||
| interface ValueSpan { | ||
| value: string; | ||
| start: number; | ||
| end: number; | ||
| } | ||
| declare class ResolverFactory { | ||
| constructor(options?: NapiResolveOptions | undefined | null); | ||
| static default(): ResolverFactory; | ||
| /** Clone the resolver using the same underlying cache. */ | ||
| cloneWithOptions(options: NapiResolveOptions): ResolverFactory; | ||
| /** | ||
| * Clear the underlying cache. | ||
| * | ||
| * Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result. | ||
| */ | ||
| clearCache(): void; | ||
| /** Synchronously resolve `specifier` at an absolute path to a `directory`. */ | ||
| sync(directory: string, request: string): ResolveResult; | ||
| /** Asynchronously resolve `specifier` at an absolute path to a `directory`. */ | ||
| async(directory: string, request: string): Promise<ResolveResult>; | ||
| /** | ||
| * Synchronously resolve `specifier` at an absolute path to a `file`. | ||
| * | ||
| * This method automatically discovers tsconfig.json by traversing parent directories. | ||
| */ | ||
| resolveFileSync(file: string, request: string): ResolveResult; | ||
| /** | ||
| * Asynchronously resolve `specifier` at an absolute path to a `file`. | ||
| * | ||
| * This method automatically discovers tsconfig.json by traversing parent directories. | ||
| */ | ||
| resolveFileAsync(file: string, request: string): Promise<ResolveResult>; | ||
| /** | ||
| * Synchronously resolve `specifier` for TypeScript declaration files. | ||
| * | ||
| * `file` is the absolute path to the containing file. | ||
| * Uses TypeScript's `moduleResolution: "bundler"` algorithm. | ||
| */ | ||
| resolveDtsSync(file: string, request: string): ResolveResult; | ||
| /** | ||
| * Asynchronously resolve `specifier` for TypeScript declaration files. | ||
| * | ||
| * `file` is the absolute path to the containing file. | ||
| * Uses TypeScript's `moduleResolution: "bundler"` algorithm. | ||
| */ | ||
| resolveDtsAsync(file: string, request: string): Promise<ResolveResult>; | ||
| } | ||
| /** Node.js builtin module when `Options::builtin_modules` is enabled. */ | ||
| interface Builtin { | ||
| /** | ||
| * Resolved module. | ||
| * | ||
| * Always prefixed with "node:" in compliance with the ESM specification. | ||
| */ | ||
| resolved: string; | ||
| /** | ||
| * Whether the request was prefixed with `node:` or not. | ||
| * `fs` -> `false`. | ||
| * `node:fs` returns `true`. | ||
| */ | ||
| isRuntimeModule: boolean; | ||
| } | ||
| declare enum EnforceExtension { | ||
| Auto = 0, | ||
| Enabled = 1, | ||
| Disabled = 2 | ||
| } | ||
| type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon'; | ||
| /** | ||
| * Module Resolution Options | ||
| * | ||
| * Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options). | ||
| * | ||
| * See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples | ||
| */ | ||
| interface NapiResolveOptions { | ||
| /** | ||
| * Discover tsconfig automatically or use the specified tsconfig.json path. | ||
| * | ||
| * Default `None` | ||
| */ | ||
| tsconfig?: 'auto' | TsconfigOptions; | ||
| /** | ||
| * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback]. | ||
| * | ||
| * For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) -> | ||
| * AliasValue::Path(String)` | ||
| * Create aliases to import or require certain modules more easily. | ||
| * A trailing $ can also be added to the given object's keys to signify an exact match. | ||
| * Default `{}` | ||
| */ | ||
| alias?: Record<string, Array<string | undefined | null>>; | ||
| /** | ||
| * A list of alias fields in description files. | ||
| * Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec). | ||
| * Can be a path to json object such as `["path", "to", "exports"]`. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| aliasFields?: (string | string[])[]; | ||
| /** | ||
| * Condition names for exports field which defines entry points of a package. | ||
| * The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| conditionNames?: Array<string>; | ||
| /** | ||
| * If true, it will not allow extension-less files. | ||
| * So by default `require('./foo')` works if `./foo` has a `.js` extension, | ||
| * but with this enabled only `require('./foo.js')` will work. | ||
| * | ||
| * Default to `true` when [ResolveOptions::extensions] contains an empty string. | ||
| * Use `Some(false)` to disable the behavior. | ||
| * See <https://github.com/webpack/enhanced-resolve/pull/285> | ||
| * | ||
| * Default None, which is the same as `Some(false)` when the above empty rule is not applied. | ||
| */ | ||
| enforceExtension?: EnforceExtension; | ||
| /** | ||
| * A list of exports fields in description files. | ||
| * Can be a path to json object such as `["path", "to", "exports"]`. | ||
| * | ||
| * Default `[["exports"]]`. | ||
| */ | ||
| exportsFields?: (string | string[])[]; | ||
| /** | ||
| * Fields from `package.json` which are used to provide the internal requests of a package | ||
| * (requests starting with # are considered internal). | ||
| * | ||
| * Can be a path to a JSON object such as `["path", "to", "imports"]`. | ||
| * | ||
| * Default `[["imports"]]`. | ||
| */ | ||
| importsFields?: (string | string[])[]; | ||
| /** | ||
| * An object which maps extension to extension aliases. | ||
| * | ||
| * Default `{}` | ||
| */ | ||
| extensionAlias?: Record<string, Array<string>>; | ||
| /** | ||
| * Attempt to resolve these extensions in order. | ||
| * If multiple files share the same name but have different extensions, | ||
| * will resolve the one with the extension listed first in the array and skip the rest. | ||
| * | ||
| * Default `[".js", ".json", ".node"]` | ||
| */ | ||
| extensions?: Array<string>; | ||
| /** | ||
| * Redirect module requests when normal resolving fails. | ||
| * | ||
| * Default `{}` | ||
| */ | ||
| fallback?: Record<string, Array<string | undefined | null>>; | ||
| /** | ||
| * Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests). | ||
| * | ||
| * See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified) | ||
| * | ||
| * Default `false` | ||
| */ | ||
| fullySpecified?: boolean; | ||
| /** | ||
| * A list of main fields in description files | ||
| * | ||
| * Default `["main"]`. | ||
| */ | ||
| mainFields?: string | string[]; | ||
| /** | ||
| * The filename to be used while resolving directories. | ||
| * | ||
| * Default `["index"]` | ||
| */ | ||
| mainFiles?: Array<string>; | ||
| /** | ||
| * A list of directories to resolve modules from, can be absolute path or folder name. | ||
| * | ||
| * Default `["node_modules"]` | ||
| */ | ||
| modules?: string | string[]; | ||
| /** | ||
| * Resolve to a context instead of a file. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| resolveToContext?: boolean; | ||
| /** | ||
| * Prefer to resolve module requests as relative requests instead of using modules from node_modules directories. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| preferRelative?: boolean; | ||
| /** | ||
| * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| preferAbsolute?: boolean; | ||
| /** | ||
| * A list of resolve restrictions to restrict the paths that a request can be resolved on. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| restrictions?: Array<Restriction>; | ||
| /** | ||
| * A list of directories where requests of server-relative URLs (starting with '/') are resolved. | ||
| * On non-Windows systems these requests are resolved as an absolute path first. | ||
| * | ||
| * Default `[]` | ||
| */ | ||
| roots?: Array<string>; | ||
| /** | ||
| * Whether to resolve symlinks to their symlinked location. | ||
| * When enabled, symlinked resources are resolved to their real path, not their symlinked location. | ||
| * Note that this may cause module resolution to fail when using tools that symlink packages (like npm link). | ||
| * | ||
| * Default `true` | ||
| */ | ||
| symlinks?: boolean; | ||
| /** | ||
| * Whether to read the `NODE_PATH` environment variable and append its entries to `modules`. | ||
| * | ||
| * `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution. | ||
| * Set this to `false` to disable the behavior. | ||
| * | ||
| * Default `true` | ||
| */ | ||
| nodePath?: boolean; | ||
| /** | ||
| * Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not. | ||
| * For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| builtinModules?: boolean; | ||
| /** | ||
| * Resolve [ResolveResult::moduleType]. | ||
| * | ||
| * Default `false` | ||
| */ | ||
| moduleType?: boolean; | ||
| /** | ||
| * Allow `exports` field in `require('../directory')`. | ||
| * | ||
| * This is not part of the spec but some vite projects rely on this behavior. | ||
| * See | ||
| * * <https://github.com/vitejs/vite/pull/20252> | ||
| * * <https://github.com/nodejs/node/issues/58827> | ||
| * | ||
| * Default: `false` | ||
| */ | ||
| allowPackageExportsInDirectoryResolve?: boolean; | ||
| } | ||
| interface ResolveResult { | ||
| path?: string; | ||
| error?: string; | ||
| builtin?: Builtin; | ||
| /** | ||
| * Module type for this path. | ||
| * | ||
| * Enable with `ResolveOptions#moduleType`. | ||
| * | ||
| * The module type is computed `ESM_FILE_FORMAT` from the [ESM resolution algorithm specification](https://nodejs.org/docs/latest/api/esm.html#resolution-algorithm-specification). | ||
| * | ||
| * The algorithm uses the file extension or finds the closest `package.json` with the `type` field. | ||
| */ | ||
| moduleType?: ModuleType; | ||
| /** `package.json` path for the given module. */ | ||
| packageJsonPath?: string; | ||
| } | ||
| /** | ||
| * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback]. | ||
| * Use struct because napi don't support structured union now | ||
| */ | ||
| interface Restriction { | ||
| path?: string; | ||
| regex?: string; | ||
| } | ||
| /** | ||
| * Tsconfig Options | ||
| * | ||
| * Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options) | ||
| */ | ||
| interface TsconfigOptions { | ||
| /** | ||
| * Allows you to specify where to find the TypeScript configuration file. | ||
| * You may provide | ||
| * * a relative path to the configuration file. It will be resolved relative to cwd. | ||
| * * an absolute path to the configuration file. | ||
| */ | ||
| configFile: string; | ||
| /** | ||
| * Support for Typescript Project References. | ||
| * | ||
| * * `'auto'`: use the `references` field from tsconfig of `config_file`. | ||
| */ | ||
| references?: 'auto'; | ||
| } | ||
| interface SourceMap { | ||
| file?: string; | ||
| mappings: string; | ||
| names: Array<string>; | ||
| sourceRoot?: string; | ||
| sources: Array<string>; | ||
| sourcesContent?: Array<string>; | ||
| version: number; | ||
| x_google_ignoreList?: Array<number>; | ||
| } | ||
| interface CompilerAssumptions { | ||
| ignoreFunctionLength?: boolean; | ||
| noDocumentAll?: boolean; | ||
| objectRestNoSymbols?: boolean; | ||
| pureGetters?: boolean; | ||
| /** | ||
| * When using public class fields, assume that they don't shadow any getter in the current class, | ||
| * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using | ||
| * `Object.defineProperty`. | ||
| * | ||
| * For example: | ||
| * | ||
| * Input: | ||
| * ```js | ||
| * class Test { | ||
| * field = 2; | ||
| * | ||
| * static staticField = 3; | ||
| * } | ||
| * ``` | ||
| * | ||
| * When `set_public_class_fields` is `true`, the output will be: | ||
| * ```js | ||
| * class Test { | ||
| * constructor() { | ||
| * this.field = 2; | ||
| * } | ||
| * } | ||
| * Test.staticField = 3; | ||
| * ``` | ||
| * | ||
| * Otherwise, the output will be: | ||
| * ```js | ||
| * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty"; | ||
| * class Test { | ||
| * constructor() { | ||
| * _defineProperty(this, "field", 2); | ||
| * } | ||
| * } | ||
| * _defineProperty(Test, "staticField", 3); | ||
| * ``` | ||
| * | ||
| * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should | ||
| * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`] | ||
| * to `true`. | ||
| */ | ||
| setPublicClassFields?: boolean; | ||
| } | ||
| interface DecoratorOptions { | ||
| /** | ||
| * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process. | ||
| * | ||
| * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification. | ||
| * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39. | ||
| * | ||
| * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators | ||
| * @default false | ||
| */ | ||
| legacy?: boolean; | ||
| /** | ||
| * Enables emitting decorator metadata. | ||
| * | ||
| * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata) | ||
| * in TypeScript, and it only works when `legacy` is true. | ||
| * | ||
| * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata | ||
| * @default false | ||
| */ | ||
| emitDecoratorMetadata?: boolean; | ||
| } | ||
| type HelperMode = | ||
| /** | ||
| * Runtime mode (default): Helper functions are imported from a runtime package. | ||
| * | ||
| * Example: | ||
| * | ||
| * ```js | ||
| * import helperName from "@oxc-project/runtime/helpers/helperName"; | ||
| * helperName(...arguments); | ||
| * ``` | ||
| */ | ||
| 'Runtime' | | ||
| /** | ||
| * External mode: Helper functions are accessed from a global `babelHelpers` object. | ||
| * | ||
| * Example: | ||
| * | ||
| * ```js | ||
| * babelHelpers.helperName(...arguments); | ||
| * ``` | ||
| */ | ||
| 'External'; | ||
| interface Helpers { | ||
| mode?: HelperMode; | ||
| } | ||
| /** | ||
| * TypeScript Isolated Declarations for Standalone DTS Emit (async) | ||
| * | ||
| * Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread. | ||
| */ | ||
| declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): Promise<IsolatedDeclarationsResult>; | ||
| interface IsolatedDeclarationsOptions { | ||
| /** | ||
| * Do not emit declarations for code that has an @internal annotation in its JSDoc comment. | ||
| * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid. | ||
| * | ||
| * Default: `false` | ||
| * | ||
| * See <https://www.typescriptlang.org/tsconfig/#stripInternal> | ||
| */ | ||
| stripInternal?: boolean; | ||
| sourcemap?: boolean; | ||
| } | ||
| interface IsolatedDeclarationsResult { | ||
| code: string; | ||
| map?: SourceMap; | ||
| errors: Array<OxcError>; | ||
| } | ||
| /** TypeScript Isolated Declarations for Standalone DTS Emit */ | ||
| declare function isolatedDeclarationSync(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult; | ||
| /** | ||
| * Configure how TSX and JSX are transformed. | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx} | ||
| */ | ||
| interface JsxOptions { | ||
| /** | ||
| * Decides which runtime to use. | ||
| * | ||
| * - 'automatic' - auto-import the correct JSX factories | ||
| * - 'classic' - no auto-import | ||
| * | ||
| * @default 'automatic' | ||
| */ | ||
| runtime?: 'classic' | 'automatic'; | ||
| /** | ||
| * Emit development-specific information, such as `__source` and `__self`. | ||
| * | ||
| * @default false | ||
| */ | ||
| development?: boolean; | ||
| /** | ||
| * Toggles whether or not to throw an error if an XML namespaced tag name | ||
| * is used. | ||
| * | ||
| * Though the JSX spec allows this, it is disabled by default since React's | ||
| * JSX does not currently have support for it. | ||
| * | ||
| * @default true | ||
| */ | ||
| throwIfNamespace?: boolean; | ||
| /** | ||
| * Mark JSX elements and top-level React method calls as pure for tree shaking. | ||
| * | ||
| * @default true | ||
| */ | ||
| pure?: boolean; | ||
| /** | ||
| * Replaces the import source when importing functions. | ||
| * | ||
| * @default 'react' | ||
| */ | ||
| importSource?: string; | ||
| /** | ||
| * Replace the function used when compiling JSX expressions. It should be a | ||
| * qualified name (e.g. `React.createElement`) or an identifier (e.g. | ||
| * `createElement`). | ||
| * | ||
| * Only used for `classic` {@link runtime}. | ||
| * | ||
| * @default 'React.createElement' | ||
| */ | ||
| pragma?: string; | ||
| /** | ||
| * Replace the component used when compiling JSX fragments. It should be a | ||
| * valid JSX tag name. | ||
| * | ||
| * Only used for `classic` {@link runtime}. | ||
| * | ||
| * @default 'React.Fragment' | ||
| */ | ||
| pragmaFrag?: string; | ||
| /** | ||
| * Enable React Fast Refresh . | ||
| * | ||
| * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh} | ||
| * | ||
| * @default false | ||
| */ | ||
| refresh?: boolean | ReactRefreshOptions; | ||
| } | ||
| /** | ||
| * Transform JavaScript code to a Vite Node runnable module. | ||
| * | ||
| * @param filename The name of the file being transformed. | ||
| * @param sourceText the source code itself | ||
| * @param options The options for the transformation. See {@link | ||
| * ModuleRunnerTransformOptions} for more information. | ||
| * | ||
| * @returns an object containing the transformed code, source maps, and any | ||
| * errors that occurred during parsing or transformation. | ||
| * | ||
| * Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread. | ||
| * | ||
| * @deprecated Only works for Vite. | ||
| */ | ||
| declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): Promise<ModuleRunnerTransformResult>; | ||
| interface ModuleRunnerTransformOptions { | ||
| /** | ||
| * Enable source map generation. | ||
| * | ||
| * When `true`, the `sourceMap` field of transform result objects will be populated. | ||
| * | ||
| * @default false | ||
| * | ||
| * @see {@link SourceMap} | ||
| */ | ||
| sourcemap?: boolean; | ||
| } | ||
| interface ModuleRunnerTransformResult { | ||
| /** | ||
| * The transformed code. | ||
| * | ||
| * If parsing failed, this will be an empty string. | ||
| */ | ||
| code: string; | ||
| /** | ||
| * The source map for the transformed code. | ||
| * | ||
| * This will be set if {@link TransformOptions#sourcemap} is `true`. | ||
| */ | ||
| map?: SourceMap; | ||
| deps: Array<string>; | ||
| dynamicDeps: Array<string>; | ||
| /** | ||
| * Parse and transformation errors. | ||
| * | ||
| * Oxc's parser recovers from common syntax errors, meaning that | ||
| * transformed code may still be available even if there are errors in this | ||
| * list. | ||
| */ | ||
| errors: Array<OxcError>; | ||
| } | ||
| interface PluginsOptions { | ||
| styledComponents?: StyledComponentsOptions; | ||
| taggedTemplateEscape?: boolean; | ||
| } | ||
| interface ReactRefreshOptions { | ||
| /** | ||
| * Specify the identifier of the refresh registration variable. | ||
| * | ||
| * @default `$RefreshReg$`. | ||
| */ | ||
| refreshReg?: string; | ||
| /** | ||
| * Specify the identifier of the refresh signature variable. | ||
| * | ||
| * @default `$RefreshSig$`. | ||
| */ | ||
| refreshSig?: string; | ||
| emitFullSignatures?: boolean; | ||
| } | ||
| /** | ||
| * Configure how styled-components are transformed. | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins#styled-components} | ||
| */ | ||
| interface StyledComponentsOptions { | ||
| /** | ||
| * Enhances the attached CSS class name on each component with richer output to help | ||
| * identify your components in the DOM without React DevTools. | ||
| * | ||
| * @default true | ||
| */ | ||
| displayName?: boolean; | ||
| /** | ||
| * Controls whether the `displayName` of a component will be prefixed with the filename | ||
| * to make the component name as unique as possible. | ||
| * | ||
| * @default true | ||
| */ | ||
| fileName?: boolean; | ||
| /** | ||
| * Adds a unique identifier to every styled component to avoid checksum mismatches | ||
| * due to different class generation on the client and server during server-side rendering. | ||
| * | ||
| * @default true | ||
| */ | ||
| ssr?: boolean; | ||
| /** | ||
| * Transpiles styled-components tagged template literals to a smaller representation | ||
| * than what Babel normally creates, helping to reduce bundle size. | ||
| * | ||
| * @default true | ||
| */ | ||
| transpileTemplateLiterals?: boolean; | ||
| /** | ||
| * Minifies CSS content by removing all whitespace and comments from your CSS, | ||
| * keeping valuable bytes out of your bundles. | ||
| * | ||
| * @default true | ||
| */ | ||
| minify?: boolean; | ||
| /** | ||
| * Enables transformation of JSX `css` prop when using styled-components. | ||
| * | ||
| * **Note: This feature is not yet implemented in oxc.** | ||
| * | ||
| * @default true | ||
| */ | ||
| cssProp?: boolean; | ||
| /** | ||
| * Enables "pure annotation" to aid dead code elimination by bundlers. | ||
| * | ||
| * @default false | ||
| */ | ||
| pure?: boolean; | ||
| /** | ||
| * Adds a namespace prefix to component identifiers to ensure class names are unique. | ||
| * | ||
| * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"` | ||
| */ | ||
| namespace?: string; | ||
| /** | ||
| * List of file names that are considered meaningless for component naming purposes. | ||
| * | ||
| * When the `fileName` option is enabled and a component is in a file with a name | ||
| * from this list, the directory name will be used instead of the file name for | ||
| * the component's display name. | ||
| * | ||
| * @default `["index"]` | ||
| */ | ||
| meaninglessFileNames?: Array<string>; | ||
| /** | ||
| * Import paths to be considered as styled-components imports at the top level. | ||
| * | ||
| * **Note: This feature is not yet implemented in oxc.** | ||
| */ | ||
| topLevelImportPaths?: Array<string>; | ||
| } | ||
| /** | ||
| * Options for transforming a JavaScript or TypeScript file. | ||
| * | ||
| * @see {@link transform} | ||
| */ | ||
| interface TransformOptions { | ||
| /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */ | ||
| lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; | ||
| /** Treat the source text as `script` or `module` code. */ | ||
| sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined; | ||
| /** | ||
| * The current working directory. Used to resolve relative paths in other | ||
| * options. | ||
| */ | ||
| cwd?: string; | ||
| /** | ||
| * Enable source map generation. | ||
| * | ||
| * When `true`, the `sourceMap` field of transform result objects will be populated. | ||
| * | ||
| * @default false | ||
| * | ||
| * @see {@link SourceMap} | ||
| */ | ||
| sourcemap?: boolean; | ||
| /** Set assumptions in order to produce smaller output. */ | ||
| assumptions?: CompilerAssumptions; | ||
| /** | ||
| * Configure how TypeScript is transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript} | ||
| */ | ||
| typescript?: TypeScriptOptions; | ||
| /** | ||
| * Configure how TSX and JSX are transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx} | ||
| */ | ||
| jsx?: 'preserve' | JsxOptions; | ||
| /** | ||
| * Sets the target environment for the generated JavaScript. | ||
| * | ||
| * The lowest target is `es2015`. | ||
| * | ||
| * Example: | ||
| * | ||
| * * `'es2015'` | ||
| * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` | ||
| * | ||
| * @default `esnext` (No transformation) | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target} | ||
| */ | ||
| target?: string | Array<string>; | ||
| /** Behaviour for runtime helpers. */ | ||
| helpers?: Helpers; | ||
| /** | ||
| * Define Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define} | ||
| */ | ||
| define?: Record<string, string>; | ||
| /** | ||
| * Inject Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject} | ||
| */ | ||
| inject?: Record<string, string | [string, string]>; | ||
| /** Decorator plugin */ | ||
| decorator?: DecoratorOptions; | ||
| /** | ||
| * Third-party plugins to use. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins} | ||
| */ | ||
| plugins?: PluginsOptions; | ||
| } | ||
| interface TypeScriptOptions { | ||
| jsxPragma?: string; | ||
| jsxPragmaFrag?: string; | ||
| onlyRemoveTypeImports?: boolean; | ||
| allowNamespaces?: boolean; | ||
| /** | ||
| * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier: | ||
| * | ||
| * @deprecated | ||
| * | ||
| * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields | ||
| * without initializer, you can use `remove_class_fields_without_initializer: true` instead. | ||
| */ | ||
| allowDeclareFields?: boolean; | ||
| /** | ||
| * When enabled, class fields without initializers are removed. | ||
| * | ||
| * For example: | ||
| * ```ts | ||
| * class Foo { | ||
| * x: number; | ||
| * y: number = 0; | ||
| * } | ||
| * ``` | ||
| * // transform into | ||
| * ```js | ||
| * class Foo { | ||
| * x: number; | ||
| * } | ||
| * ``` | ||
| * | ||
| * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option. | ||
| * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`] | ||
| * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is | ||
| * equivalent to `useDefineForClassFields: false` in TypeScript. | ||
| * | ||
| * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into: | ||
| * | ||
| * ```js | ||
| * class Foo { | ||
| * constructor() { | ||
| * this.y = 0; | ||
| * } | ||
| * } | ||
| * ``` | ||
| * | ||
| * Defaults to `false`. | ||
| */ | ||
| removeClassFieldsWithoutInitializer?: boolean; | ||
| /** | ||
| * When true, optimize const enums by inlining their values at usage sites | ||
| * and removing the enum declaration. | ||
| * | ||
| * @default false | ||
| */ | ||
| optimizeConstEnums?: boolean; | ||
| /** | ||
| * When true, optimize regular (non-const) enums by inlining their member | ||
| * accesses at usage sites when the member value is statically known. | ||
| * | ||
| * Non-exported enum declarations are also removed when all members are | ||
| * evaluable and no references to the enum as a runtime value exist | ||
| * (e.g., `console.log(Foo)`, `typeof Foo`, or passing the enum as an argument). | ||
| * | ||
| * @default false | ||
| */ | ||
| optimizeEnums?: boolean; | ||
| /** | ||
| * Also generate a `.d.ts` declaration file for TypeScript files. | ||
| * | ||
| * The source file must be compliant with all | ||
| * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations) | ||
| * requirements. | ||
| * | ||
| * @default false | ||
| */ | ||
| declaration?: IsolatedDeclarationsOptions; | ||
| /** | ||
| * Rewrite or remove TypeScript import/export declaration extensions. | ||
| * | ||
| * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively. | ||
| * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely. | ||
| * - When set to `true`, it's equivalent to `rewrite`. | ||
| * - When set to `false` or omitted, no changes will be made to the extensions. | ||
| * | ||
| * @default false | ||
| */ | ||
| rewriteImportExtensions?: 'rewrite' | 'remove' | boolean; | ||
| } | ||
| /** A decoded source map with mappings as an array of arrays instead of VLQ-encoded string. */ | ||
| declare class BindingDecodedMap { | ||
| /** The source map version (always 3). */ | ||
| get version(): number; | ||
| /** The generated file name. */ | ||
| get file(): string | null; | ||
| /** The list of original source files. */ | ||
| get sources(): Array<string>; | ||
| /** The original source contents (if `includeContent` was true). */ | ||
| get sourcesContent(): Array<string | undefined | null>; | ||
| /** The list of symbol names used in mappings. */ | ||
| get names(): Array<string>; | ||
| /** | ||
| * The decoded mappings as an array of line arrays. | ||
| * Each line is an array of segments, where each segment is [generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex?]. | ||
| */ | ||
| get mappings(): Array<Array<Array<number>>>; | ||
| /** The list of source indices that should be excluded from debugging. */ | ||
| get x_google_ignoreList(): Array<number> | null; | ||
| } | ||
| declare class BindingMagicString { | ||
| constructor(source: string, options?: BindingMagicStringOptions | undefined | null); | ||
| get original(): string; | ||
| get filename(): string | null; | ||
| get indentExclusionRanges(): Array<Array<number>> | Array<number> | null; | ||
| get ignoreList(): boolean; | ||
| get offset(): number; | ||
| set offset(offset: number); | ||
| replace(from: string, to: string): this; | ||
| replaceAll(from: string, to: string): this; | ||
| /** | ||
| * Returns the UTF-16 offset past the last match, or -1 if no match was found. | ||
| * The JS wrapper uses this to update `lastIndex` on the caller's RegExp. | ||
| * Global/sticky behavior is derived from the regex's own flags. | ||
| */ | ||
| replaceRegex(from: RegExp, to: string): number; | ||
| prepend(content: string): this; | ||
| append(content: string): this; | ||
| prependLeft(index: number, content: string): this; | ||
| prependRight(index: number, content: string): this; | ||
| appendLeft(index: number, content: string): this; | ||
| appendRight(index: number, content: string): this; | ||
| overwrite(start: number, end: number, content: string, options?: BindingOverwriteOptions | undefined | null): this; | ||
| toString(): string; | ||
| hasChanged(): boolean; | ||
| length(): number; | ||
| isEmpty(): boolean; | ||
| remove(start: number, end: number): this; | ||
| update(start: number, end: number, content: string, options?: BindingUpdateOptions | undefined | null): this; | ||
| relocate(start: number, end: number, to: number): this; | ||
| /** | ||
| * Alias for `relocate` to match the original magic-string API. | ||
| * Moves the characters from `start` to `end` to `index`. | ||
| * Returns `this` for method chaining. | ||
| */ | ||
| move(start: number, end: number, index: number): this; | ||
| indent(indentor?: string | undefined | null, options?: BindingIndentOptions | undefined | null): this; | ||
| /** Trims whitespace or specified characters from the start and end. */ | ||
| trim(charType?: string | undefined | null): this; | ||
| /** Trims whitespace or specified characters from the start. */ | ||
| trimStart(charType?: string | undefined | null): this; | ||
| /** Trims whitespace or specified characters from the end. */ | ||
| trimEnd(charType?: string | undefined | null): this; | ||
| /** Trims newlines from the start and end. */ | ||
| trimLines(): this; | ||
| /** | ||
| * Deprecated method that throws an error directing users to use prependRight or appendLeft. | ||
| * This matches the original magic-string API which deprecated this method. | ||
| */ | ||
| insert(index: number, content: string): void; | ||
| /** Returns a clone of the MagicString instance. */ | ||
| clone(): BindingMagicString; | ||
| /** Returns the last character of the generated string, or an empty string if empty. */ | ||
| lastChar(): string; | ||
| /** Returns the content after the last newline in the generated string. */ | ||
| lastLine(): string; | ||
| /** Returns the guessed indentation string, or `\t` if none is found. */ | ||
| getIndentString(): string; | ||
| /** Returns a clone with content outside the specified range removed. */ | ||
| snip(start: number, end: number): BindingMagicString; | ||
| /** | ||
| * Resets the portion of the string from `start` to `end` to its original content. | ||
| * This undoes any modifications made to that range. | ||
| * Supports negative indices (counting from the end). | ||
| */ | ||
| reset(start: number, end: number): this; | ||
| /** | ||
| * Returns the content between the specified UTF-16 code unit positions (JS string indices). | ||
| * Supports negative indices (counting from the end). | ||
| * | ||
| * When an index falls in the middle of a surrogate pair, the lone surrogate is | ||
| * included in the result (matching the original magic-string / JS behavior). | ||
| * This is done by returning a UTF-16 encoded JS string via `napi_create_string_utf16`. | ||
| */ | ||
| slice(start?: number | undefined | null, end?: number | undefined | null): string; | ||
| /** | ||
| * Generates a source map for the transformations applied to this MagicString. | ||
| * Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings. | ||
| */ | ||
| generateMap(options?: BindingSourceMapOptions | undefined | null): BindingSourceMap; | ||
| /** | ||
| * Generates a decoded source map for the transformations applied to this MagicString. | ||
| * Returns a BindingDecodedMap object with mappings as an array of arrays. | ||
| */ | ||
| generateDecodedMap(options?: BindingSourceMapOptions | undefined | null): BindingDecodedMap; | ||
| } | ||
| declare class BindingNormalizedOptions { | ||
| get input(): Array<string> | Record<string, string>; | ||
| get cwd(): string; | ||
| get platform(): 'node' | 'browser' | 'neutral'; | ||
| get shimMissingExports(): boolean; | ||
| get name(): string | null; | ||
| get entryFilenames(): string | undefined; | ||
| get chunkFilenames(): string | undefined; | ||
| get assetFilenames(): string | undefined; | ||
| get dir(): string | null; | ||
| get file(): string | null; | ||
| get format(): 'es' | 'cjs' | 'iife' | 'umd'; | ||
| get exports(): 'default' | 'named' | 'none' | 'auto'; | ||
| get esModule(): boolean | 'if-default-prop'; | ||
| get codeSplitting(): boolean; | ||
| get dynamicImportInCjs(): boolean; | ||
| get sourcemap(): boolean | 'inline' | 'hidden'; | ||
| get sourcemapBaseUrl(): string | null; | ||
| get banner(): string | undefined | null | undefined; | ||
| get footer(): string | undefined | null | undefined; | ||
| get intro(): string | undefined | null | undefined; | ||
| get outro(): string | undefined | null | undefined; | ||
| get postBanner(): string | undefined | null | undefined; | ||
| get postFooter(): string | undefined | null | undefined; | ||
| get externalLiveBindings(): boolean; | ||
| get extend(): boolean; | ||
| get globals(): Record<string, string> | undefined; | ||
| get hashCharacters(): 'base64' | 'base36' | 'hex'; | ||
| get sourcemapDebugIds(): boolean; | ||
| get sourcemapExcludeSources(): boolean; | ||
| get polyfillRequire(): boolean; | ||
| get minify(): false | 'dce-only' | MinifyOptions; | ||
| get legalComments(): 'none' | 'inline'; | ||
| get comments(): BindingCommentsOptions; | ||
| get preserveModules(): boolean; | ||
| get preserveModulesRoot(): string | undefined; | ||
| get virtualDirname(): string; | ||
| get topLevelVar(): boolean; | ||
| get minifyInternalExports(): boolean; | ||
| get context(): string; | ||
| } | ||
| declare class BindingRenderedChunk { | ||
| get name(): string; | ||
| get isEntry(): boolean; | ||
| get isDynamicEntry(): boolean; | ||
| get facadeModuleId(): string | null; | ||
| get moduleIds(): Array<string>; | ||
| get exports(): Array<string>; | ||
| get fileName(): string; | ||
| get modules(): BindingModules; | ||
| get imports(): Array<string>; | ||
| get dynamicImports(): Array<string>; | ||
| } | ||
| declare class BindingRenderedModule { | ||
| get code(): string | null; | ||
| get renderedExports(): Array<string>; | ||
| } | ||
| /** A source map object with properties matching the SourceMap V3 specification. */ | ||
| declare class BindingSourceMap { | ||
| /** The source map version (always 3). */ | ||
| get version(): number; | ||
| /** The generated file name. */ | ||
| get file(): string | null; | ||
| /** The list of original source files. */ | ||
| get sources(): Array<string>; | ||
| /** The original source contents (if `includeContent` was true). */ | ||
| get sourcesContent(): Array<string | undefined | null>; | ||
| /** The list of symbol names used in mappings. */ | ||
| get names(): Array<string>; | ||
| /** The VLQ-encoded mappings string. */ | ||
| get mappings(): string; | ||
| /** The list of source indices that should be excluded from debugging. */ | ||
| get x_google_ignoreList(): Array<number> | null; | ||
| /** Returns the source map as a JSON string. */ | ||
| toString(): string; | ||
| /** Returns the source map as a base64-encoded data URL. */ | ||
| toUrl(): string; | ||
| } | ||
| /** | ||
| * Minimal wrapper around a `BundleHandle` for watcher events. | ||
| * This is returned from watcher event data to allow calling `result.close()`. | ||
| */ | ||
| declare class BindingWatcherBundler { | ||
| close(): Promise<void>; | ||
| } | ||
| declare class TsconfigCache { | ||
| /** Create a new transform cache with auto tsconfig discovery enabled. */ | ||
| constructor(yarnPnp: boolean); | ||
| /** | ||
| * Clear the cache. | ||
| * | ||
| * Call this when tsconfig files have changed to ensure fresh resolution. | ||
| */ | ||
| clear(): void; | ||
| /** Get the number of cached entries. */ | ||
| size(): number; | ||
| } | ||
| type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-wasm-fallback' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime'; | ||
| interface BindingBundleAnalyzerPluginConfig { | ||
| /** Output filename for the bundle analysis data (default: "analyze-data.json") */ | ||
| fileName?: string; | ||
| /** Output format: "json" (default) or "md" for LLM-friendly markdown */ | ||
| format?: 'json' | 'md'; | ||
| } | ||
| interface BindingBundleState { | ||
| lastFullBuildFailed: boolean; | ||
| hasStaleOutput: boolean; | ||
| } | ||
| interface BindingClientHmrUpdate { | ||
| clientId: string; | ||
| update: BindingHmrUpdate; | ||
| } | ||
| interface BindingCommentsOptions { | ||
| legal?: boolean; | ||
| annotation?: boolean; | ||
| jsdoc?: boolean; | ||
| } | ||
| interface BindingCompilerOptions { | ||
| baseUrl?: string; | ||
| paths?: Record<string, Array<string>>; | ||
| experimentalDecorators?: boolean; | ||
| emitDecoratorMetadata?: boolean; | ||
| useDefineForClassFields?: boolean; | ||
| rewriteRelativeImportExtensions?: boolean; | ||
| jsx?: string; | ||
| jsxFactory?: string; | ||
| jsxFragmentFactory?: string; | ||
| jsxImportSource?: string; | ||
| verbatimModuleSyntax?: boolean; | ||
| preserveValueImports?: boolean; | ||
| importsNotUsedAsValues?: string; | ||
| target?: string; | ||
| module?: string; | ||
| allowJs?: boolean; | ||
| rootDirs?: Array<string>; | ||
| } | ||
| /** Enhanced transform options with tsconfig and inputMap support. */ | ||
| interface BindingEnhancedTransformOptions { | ||
| /** Treat the source text as 'js', 'jsx', 'ts', 'tsx', or 'dts'. */ | ||
| lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'; | ||
| /** Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'. */ | ||
| sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined; | ||
| /** | ||
| * The current working directory. Used to resolve relative paths in other | ||
| * options. | ||
| */ | ||
| cwd?: string; | ||
| /** | ||
| * Enable source map generation. | ||
| * | ||
| * When `true`, the `sourceMap` field of transform result objects will be populated. | ||
| * | ||
| * @default false | ||
| */ | ||
| sourcemap?: boolean; | ||
| /** Set assumptions in order to produce smaller output. */ | ||
| assumptions?: CompilerAssumptions; | ||
| /** | ||
| * Configure how TypeScript is transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript} | ||
| */ | ||
| typescript?: TypeScriptOptions; | ||
| /** | ||
| * Configure how TSX and JSX are transformed. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx} | ||
| */ | ||
| jsx?: 'preserve' | JsxOptions; | ||
| /** | ||
| * Sets the target environment for the generated JavaScript. | ||
| * | ||
| * The lowest target is `es2015`. | ||
| * | ||
| * Example: | ||
| * | ||
| * * `'es2015'` | ||
| * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']` | ||
| * | ||
| * @default `esnext` (No transformation) | ||
| * | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target} | ||
| */ | ||
| target?: string | Array<string>; | ||
| /** Behaviour for runtime helpers. */ | ||
| helpers?: Helpers; | ||
| /** | ||
| * Define Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define} | ||
| */ | ||
| define?: Record<string, string>; | ||
| /** | ||
| * Inject Plugin | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject} | ||
| */ | ||
| inject?: Record<string, string | [string, string]>; | ||
| /** Decorator plugin */ | ||
| decorator?: DecoratorOptions; | ||
| /** | ||
| * Third-party plugins to use. | ||
| * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins} | ||
| */ | ||
| plugins?: PluginsOptions; | ||
| /** | ||
| * Configure tsconfig handling. | ||
| * - true: Auto-discover and load the nearest tsconfig.json | ||
| * - TsconfigRawOptions: Use the provided inline tsconfig options | ||
| */ | ||
| tsconfig?: boolean | BindingTsconfigRawOptions; | ||
| /** An input source map to collapse with the output source map. */ | ||
| inputMap?: SourceMap; | ||
| } | ||
| /** Result of the enhanced transform API. */ | ||
| interface BindingEnhancedTransformResult { | ||
| /** | ||
| * The transformed code. | ||
| * | ||
| * If parsing failed, this will be an empty string. | ||
| */ | ||
| code: string; | ||
| /** | ||
| * The source map for the transformed code. | ||
| * | ||
| * This will be set if {@link BindingEnhancedTransformOptions#sourcemap} is `true`. | ||
| */ | ||
| map?: SourceMap; | ||
| /** | ||
| * The `.d.ts` declaration file for the transformed code. Declarations are | ||
| * only generated if `declaration` is set to `true` and a TypeScript file | ||
| * is provided. | ||
| * | ||
| * If parsing failed and `declaration` is set, this will be an empty string. | ||
| * | ||
| * @see {@link TypeScriptOptions#declaration} | ||
| * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration) | ||
| */ | ||
| declaration?: string; | ||
| /** | ||
| * Declaration source map. Only generated if both | ||
| * {@link TypeScriptOptions#declaration declaration} and | ||
| * {@link BindingEnhancedTransformOptions#sourcemap sourcemap} are set to `true`. | ||
| */ | ||
| declarationMap?: SourceMap; | ||
| /** | ||
| * Helpers used. | ||
| * | ||
| * @internal | ||
| * | ||
| * Example: | ||
| * | ||
| * ```text | ||
| * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" } | ||
| * ``` | ||
| */ | ||
| helpersUsed: Record<string, string>; | ||
| /** Parse and transformation errors. */ | ||
| errors: Array<BindingError>; | ||
| /** Parse and transformation warnings. */ | ||
| warnings: Array<BindingError>; | ||
| /** Paths to tsconfig files that were loaded during transformation. */ | ||
| tsconfigFilePaths: Array<string>; | ||
| } | ||
| type BindingError = { | ||
| type: 'JsError'; | ||
| field0: Error; | ||
| } | { | ||
| type: 'NativeError'; | ||
| field0: NativeError; | ||
| }; | ||
| interface BindingEsmExternalRequirePluginConfig { | ||
| external: Array<BindingStringOrRegex>; | ||
| skipDuplicateCheck?: boolean; | ||
| } | ||
| interface BindingHmrBoundaryOutput { | ||
| boundary: string; | ||
| acceptedVia: string; | ||
| } | ||
| type BindingHmrUpdate = { | ||
| type: 'Patch'; | ||
| code: string; | ||
| filename: string; | ||
| sourcemap?: string; | ||
| sourcemapFilename?: string; | ||
| hmrBoundaries: Array<BindingHmrBoundaryOutput>; | ||
| } | { | ||
| type: 'FullReload'; | ||
| reason?: string; | ||
| } | { | ||
| type: 'Noop'; | ||
| }; | ||
| interface BindingHookResolveIdExtraArgs { | ||
| custom?: number; | ||
| isEntry: boolean; | ||
| /** | ||
| * - `import-statement`: `import { foo } from './lib.js';` | ||
| * - `dynamic-import`: `import('./lib.js')` | ||
| * - `require-call`: `require('./lib.js')` | ||
| * - `import-rule`: `@import 'bg-color.css'` | ||
| * - `url-token`: `url('./icon.png')` | ||
| * - `new-url`: `new URL('./worker.js', import.meta.url)` | ||
| * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})` | ||
| */ | ||
| kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'; | ||
| } | ||
| interface BindingIndentOptions { | ||
| exclude?: Array<Array<number>> | Array<number>; | ||
| } | ||
| interface BindingIsolatedDeclarationPluginConfig { | ||
| stripInternal?: boolean; | ||
| } | ||
| interface BindingLogLocation { | ||
| /** 1-based */ | ||
| line: number; | ||
| /** 0-based position in the line in UTF-16 code units */ | ||
| column: number; | ||
| file?: string; | ||
| } | ||
| interface BindingMagicStringOptions { | ||
| filename?: string; | ||
| offset?: number; | ||
| indentExclusionRanges?: Array<Array<number>> | Array<number>; | ||
| ignoreList?: boolean; | ||
| } | ||
| interface BindingModulePreloadOptions { | ||
| polyfill: boolean; | ||
| resolveDependencies?: (filename: string, deps: string[], context: { | ||
| hostId: string; | ||
| hostType: 'html' | 'js'; | ||
| }) => string[]; | ||
| } | ||
| interface BindingModules { | ||
| values: Array<BindingRenderedModule>; | ||
| keys: Array<string>; | ||
| } | ||
| interface BindingOverwriteOptions { | ||
| contentOnly?: boolean; | ||
| } | ||
| interface BindingPluginContextResolveOptions { | ||
| /** | ||
| * - `import-statement`: `import { foo } from './lib.js';` | ||
| * - `dynamic-import`: `import('./lib.js')` | ||
| * - `require-call`: `require('./lib.js')` | ||
| * - `import-rule`: `@import 'bg-color.css'` | ||
| * - `url-token`: `url('./icon.png')` | ||
| * - `new-url`: `new URL('./worker.js', import.meta.url)` | ||
| * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})` | ||
| */ | ||
| importKind?: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept'; | ||
| isEntry?: boolean; | ||
| skipSelf?: boolean; | ||
| custom?: number; | ||
| vitePluginCustom?: BindingVitePluginCustom; | ||
| } | ||
| declare enum BindingRebuildStrategy { | ||
| Always = 0, | ||
| Auto = 1, | ||
| Never = 2 | ||
| } | ||
| interface BindingRenderBuiltUrlConfig { | ||
| ssr: boolean; | ||
| type: 'asset' | 'public'; | ||
| hostId: string; | ||
| hostType: 'js' | 'css' | 'html'; | ||
| } | ||
| interface BindingRenderBuiltUrlRet { | ||
| relative?: boolean; | ||
| runtime?: string; | ||
| } | ||
| interface BindingReplacePluginConfig { | ||
| values: Record<string, string>; | ||
| delimiters?: [string, string]; | ||
| preventAssignment?: boolean; | ||
| objectGuards?: boolean; | ||
| sourcemap?: boolean; | ||
| } | ||
| interface BindingSourceMapOptions { | ||
| /** The filename for the generated file (goes into `map.file`) */ | ||
| file?: string; | ||
| /** The filename of the original source (goes into `map.sources`) */ | ||
| source?: string; | ||
| includeContent?: boolean; | ||
| /** | ||
| * Accepts boolean or string: true, false, "boundary" | ||
| * - true: high-resolution sourcemaps (character-level) | ||
| * - false: low-resolution sourcemaps (line-level) - default | ||
| * - "boundary": high-resolution only at word boundaries | ||
| */ | ||
| hires?: boolean | string; | ||
| } | ||
| interface BindingTransformHookExtraArgs { | ||
| moduleType: string; | ||
| } | ||
| interface BindingTsconfig { | ||
| files?: Array<string>; | ||
| include?: Array<string>; | ||
| exclude?: Array<string>; | ||
| compilerOptions: BindingCompilerOptions; | ||
| } | ||
| /** | ||
| * TypeScript compiler options for inline tsconfig configuration. | ||
| * | ||
| * @category Utilities | ||
| */ | ||
| interface BindingTsconfigCompilerOptions { | ||
| /** Specifies the JSX factory function to use. */ | ||
| jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native'; | ||
| /** Specifies the JSX factory function. */ | ||
| jsxFactory?: string; | ||
| /** Specifies the JSX fragment factory function. */ | ||
| jsxFragmentFactory?: string; | ||
| /** Specifies the module specifier for JSX imports. */ | ||
| jsxImportSource?: string; | ||
| /** Enables experimental decorators. */ | ||
| experimentalDecorators?: boolean; | ||
| /** Enables decorator metadata emission. */ | ||
| emitDecoratorMetadata?: boolean; | ||
| /** Preserves module structure of imports/exports. */ | ||
| verbatimModuleSyntax?: boolean; | ||
| /** Configures how class fields are emitted. */ | ||
| useDefineForClassFields?: boolean; | ||
| /** The ECMAScript target version. */ | ||
| target?: string; | ||
| /** @deprecated Use verbatimModuleSyntax instead. */ | ||
| preserveValueImports?: boolean; | ||
| /** @deprecated Use verbatimModuleSyntax instead. */ | ||
| importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'; | ||
| } | ||
| /** | ||
| * Raw tsconfig options for inline configuration. | ||
| * | ||
| * @category Utilities | ||
| */ | ||
| interface BindingTsconfigRawOptions { | ||
| /** TypeScript compiler options. */ | ||
| compilerOptions?: BindingTsconfigCompilerOptions; | ||
| } | ||
| interface BindingTsconfigResult { | ||
| tsconfig: BindingTsconfig; | ||
| tsconfigFilePaths: Array<string>; | ||
| } | ||
| interface BindingUpdateOptions { | ||
| overwrite?: boolean; | ||
| } | ||
| interface BindingViteBuildImportAnalysisPluginConfig { | ||
| preloadCode: string; | ||
| insertPreload: boolean; | ||
| optimizeModulePreloadRelativePaths: boolean; | ||
| renderBuiltUrl: boolean; | ||
| isRelativeBase: boolean; | ||
| v2?: BindingViteBuildImportAnalysisPluginV2Config; | ||
| } | ||
| interface BindingViteBuildImportAnalysisPluginV2Config { | ||
| isSsr: boolean; | ||
| urlBase: string; | ||
| decodedBase: string; | ||
| modulePreload: false | BindingModulePreloadOptions; | ||
| renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet; | ||
| } | ||
| interface BindingViteDynamicImportVarsPluginConfig { | ||
| sourcemap?: boolean; | ||
| include?: Array<BindingStringOrRegex>; | ||
| exclude?: Array<BindingStringOrRegex>; | ||
| resolver?: (id: string, importer: string) => MaybePromise<string | undefined>; | ||
| } | ||
| interface BindingViteImportGlobPluginConfig { | ||
| root?: string; | ||
| sourcemap?: boolean; | ||
| restoreQueryExtension?: boolean; | ||
| } | ||
| interface BindingViteJsonPluginConfig { | ||
| minify?: boolean; | ||
| namedExports?: boolean; | ||
| stringify?: BindingViteJsonPluginStringify; | ||
| } | ||
| type BindingViteJsonPluginStringify = boolean | string; | ||
| interface BindingViteManifestPluginConfig { | ||
| root: string; | ||
| outPath: string; | ||
| isEnableV2?: boolean; | ||
| isLegacy?: (args: BindingNormalizedOptions) => boolean; | ||
| cssEntries: () => Record<string, string>; | ||
| } | ||
| interface BindingViteModulePreloadPolyfillPluginConfig { | ||
| isServer?: boolean; | ||
| } | ||
| interface BindingVitePluginCustom { | ||
| 'vite:import-glob'?: ViteImportGlobMeta; | ||
| } | ||
| interface BindingViteReactRefreshWrapperPluginConfig { | ||
| cwd: string; | ||
| include?: Array<BindingStringOrRegex>; | ||
| exclude?: Array<BindingStringOrRegex>; | ||
| jsxImportSource: string; | ||
| reactRefreshHost: string; | ||
| } | ||
| interface BindingViteReporterPluginConfig { | ||
| root: string; | ||
| isTty: boolean; | ||
| isLib: boolean; | ||
| assetsDir: string; | ||
| chunkLimit: number; | ||
| warnLargeChunks: boolean; | ||
| reportCompressedSize: boolean; | ||
| logInfo?: (msg: string) => void; | ||
| } | ||
| interface BindingViteResolvePluginConfig { | ||
| resolveOptions: BindingViteResolvePluginResolveOptions; | ||
| environmentConsumer: string; | ||
| environmentName: string; | ||
| builtins: Array<BindingStringOrRegex>; | ||
| external: true | string[]; | ||
| noExternal: true | Array<string | RegExp>; | ||
| dedupe: Array<string>; | ||
| disableCache?: boolean; | ||
| legacyInconsistentCjsInterop?: boolean; | ||
| finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>; | ||
| finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>; | ||
| resolveSubpathImports: (id: string, importer: string, isRequire: boolean, scan: boolean) => VoidNullable<string>; | ||
| onWarn?: (message: string) => void; | ||
| onDebug?: (message: string) => void; | ||
| yarnPnp: boolean; | ||
| } | ||
| interface BindingViteResolvePluginResolveOptions { | ||
| isBuild: boolean; | ||
| isProduction: boolean; | ||
| asSrc: boolean; | ||
| preferRelative: boolean; | ||
| isRequire?: boolean; | ||
| root: string; | ||
| scan: boolean; | ||
| mainFields: Array<string>; | ||
| conditions: Array<string>; | ||
| externalConditions: Array<string>; | ||
| extensions: Array<string>; | ||
| tryIndex: boolean; | ||
| tryPrefix?: string; | ||
| preserveSymlinks: boolean; | ||
| tsconfigPaths: boolean; | ||
| } | ||
| interface BindingViteTransformPluginConfig { | ||
| root: string; | ||
| include?: Array<BindingStringOrRegex>; | ||
| exclude?: Array<BindingStringOrRegex>; | ||
| jsxRefreshInclude?: Array<BindingStringOrRegex>; | ||
| jsxRefreshExclude?: Array<BindingStringOrRegex>; | ||
| isServerConsumer?: boolean; | ||
| jsxInject?: string; | ||
| transformOptions?: TransformOptions; | ||
| yarnPnp?: boolean; | ||
| } | ||
| interface ExternalMemoryStatus { | ||
| freed: boolean; | ||
| reason?: string; | ||
| } | ||
| /** Error emitted from native side, it only contains kind and message, no stack trace. */ | ||
| interface NativeError { | ||
| kind: string; | ||
| message: string; | ||
| /** The id of the file associated with the error */ | ||
| id?: string; | ||
| /** The exporter associated with the error (for import/export errors) */ | ||
| exporter?: string; | ||
| /** Location information (line, column, file) */ | ||
| loc?: BindingLogLocation; | ||
| /** Position in the source file in UTF-16 code units */ | ||
| pos?: number; | ||
| } | ||
| interface PreRenderedChunk { | ||
| /** The name of this chunk, which is used in naming patterns. */ | ||
| name: string; | ||
| /** Whether this chunk is a static entry point. */ | ||
| isEntry: boolean; | ||
| /** Whether this chunk is a dynamic entry point. */ | ||
| isDynamicEntry: boolean; | ||
| /** The id of a module that this chunk corresponds to. */ | ||
| facadeModuleId?: string; | ||
| /** The list of ids of modules included in this chunk. */ | ||
| moduleIds: Array<string>; | ||
| /** Exported variable names from this chunk. */ | ||
| exports: Array<string>; | ||
| } | ||
| interface ViteImportGlobMeta { | ||
| isSubImportsPattern?: boolean; | ||
| } | ||
| //#endregion | ||
| export { ExternalMemoryStatus as A, ResolveResult as B, BindingViteManifestPluginConfig as C, BindingViteResolvePluginConfig as D, BindingViteReporterPluginConfig as E, MinifyResult as F, isolatedDeclaration as G, SourceMap as H, NapiResolveOptions as I, isolatedDeclarationSync as K, ParseResult as L, IsolatedDeclarationsResult as M, JsxOptions as N, BindingViteTransformPluginConfig as O, MinifyOptions as P, ParserOptions as R, BindingViteJsonPluginConfig as S, BindingViteReactRefreshWrapperPluginConfig as T, TransformOptions as U, ResolverFactory as V, TsconfigCache as W, BindingTsconfigRawOptions as _, BindingEnhancedTransformOptions as a, BindingViteDynamicImportVarsPluginConfig as b, BindingHookResolveIdExtraArgs as c, BindingPluginContextResolveOptions as d, BindingRebuildStrategy as f, BindingTsconfigCompilerOptions as g, BindingTransformHookExtraArgs as h, BindingClientHmrUpdate as i, IsolatedDeclarationsOptions as j, BindingWatcherBundler as k, BindingIsolatedDeclarationPluginConfig as l, BindingReplacePluginConfig as m, BindingBundleAnalyzerPluginConfig as n, BindingEnhancedTransformResult as o, BindingRenderedChunk as p, moduleRunnerTransform as q, BindingBundleState as r, BindingEsmExternalRequirePluginConfig as s, BindingBuiltinPluginName as t, BindingMagicString as u, BindingTsconfigResult as v, BindingViteModulePreloadPolyfillPluginConfig as w, BindingViteImportGlobPluginConfig as x, BindingViteBuildImportAnalysisPluginConfig as y, PreRenderedChunk as z }; |
Sorry, the diff of this file is too big to display
| import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-C-WttzRA.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, | ||
| async resolveSubpathImports(id, importer, isRequire, scan) { | ||
| return config.resolveSubpathImports(id, importer, isRequire, scan); | ||
| }, | ||
| 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 }; |
| 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-zH1vcmbM.mjs"; | ||
| import { P as BuiltinPlugin, Ut as StringOrRegExp } from "./define-config-CeKzMIcs.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 }; |
Sorry, the diff of this file is too big to display
| //#region src/utils/define-config.ts | ||
| function defineConfig(config) { | ||
| return config; | ||
| } | ||
| //#endregion | ||
| export { defineConfig as t }; |
| import { t as require_binding } from "./binding-C9S351wt.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 }; |
| 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 }; |
| import { t as rolldown } from "./rolldown-CWsV1rrO.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 }; |
| //#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 }; |
| //#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 }; |
| //#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 }; |
| import { n as __toESM, t as require_binding } from "./binding-C9S351wt.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 { | ||
| name; | ||
| _options; | ||
| /** 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) { | ||
| const wrappedHook = 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 | ||
| })); | ||
| } | ||
| }; | ||
| const order = callablePlugin.getOrder(key); | ||
| if (order == void 0) wrappedPlugin[key] = wrappedHook; | ||
| else wrappedPlugin[key] = { | ||
| handler: wrappedHook, | ||
| order | ||
| }; | ||
| } | ||
| 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 }; |
| import { n as __toESM, t as require_binding } from "./binding-C9S351wt.mjs"; | ||
| //#region ../../node_modules/.pnpm/oxc-parser@0.130.0/node_modules/oxc-parser/src-js/wrap.js | ||
| var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1); | ||
| 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 | ||
| /** | ||
| * 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 }; |
| import process$1, { stdin, stdout } from "node:process"; | ||
| import { WriteStream } from "node:tty"; | ||
| import f from "node:readline"; | ||
| //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs | ||
| function getDefaultExportFromCjs(x) { | ||
| return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; | ||
| } | ||
| var src; | ||
| var hasRequiredSrc; | ||
| function requireSrc() { | ||
| if (hasRequiredSrc) return src; | ||
| hasRequiredSrc = 1; | ||
| const ESC = "\x1B"; | ||
| const CSI = `${ESC}[`; | ||
| const beep = "\x07"; | ||
| const cursor = { | ||
| to(x, y) { | ||
| if (!y) return `${CSI}${x + 1}G`; | ||
| return `${CSI}${y + 1};${x + 1}H`; | ||
| }, | ||
| move(x, y) { | ||
| let ret = ""; | ||
| if (x < 0) ret += `${CSI}${-x}D`; | ||
| else if (x > 0) ret += `${CSI}${x}C`; | ||
| if (y < 0) ret += `${CSI}${-y}A`; | ||
| else if (y > 0) ret += `${CSI}${y}B`; | ||
| return ret; | ||
| }, | ||
| up: (count = 1) => `${CSI}${count}A`, | ||
| down: (count = 1) => `${CSI}${count}B`, | ||
| forward: (count = 1) => `${CSI}${count}C`, | ||
| backward: (count = 1) => `${CSI}${count}D`, | ||
| nextLine: (count = 1) => `${CSI}E`.repeat(count), | ||
| prevLine: (count = 1) => `${CSI}F`.repeat(count), | ||
| left: `${CSI}G`, | ||
| hide: `${CSI}?25l`, | ||
| show: `${CSI}?25h`, | ||
| save: `${ESC}7`, | ||
| restore: `${ESC}8` | ||
| }; | ||
| src = { | ||
| cursor, | ||
| scroll: { | ||
| up: (count = 1) => `${CSI}S`.repeat(count), | ||
| down: (count = 1) => `${CSI}T`.repeat(count) | ||
| }, | ||
| erase: { | ||
| screen: `${CSI}2J`, | ||
| up: (count = 1) => `${CSI}1J`.repeat(count), | ||
| down: (count = 1) => `${CSI}J`.repeat(count), | ||
| line: `${CSI}2K`, | ||
| lineEnd: `${CSI}K`, | ||
| lineStart: `${CSI}1K`, | ||
| lines(count) { | ||
| let clear = ""; | ||
| for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : ""); | ||
| if (count) clear += cursor.left; | ||
| return clear; | ||
| } | ||
| }, | ||
| beep | ||
| }; | ||
| return src; | ||
| } | ||
| var srcExports = requireSrc(); | ||
| var picocolors = { exports: {} }; | ||
| var hasRequiredPicocolors; | ||
| function requirePicocolors() { | ||
| if (hasRequiredPicocolors) return picocolors.exports; | ||
| hasRequiredPicocolors = 1; | ||
| let p = process || {}, argv = p.argv || [], env = p.env || {}; | ||
| let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI); | ||
| let formatter = (open, close, replace = open) => (input) => { | ||
| let string = "" + input, index = string.indexOf(close, open.length); | ||
| return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close; | ||
| }; | ||
| let replaceClose = (string, close, replace, index) => { | ||
| let result = "", cursor = 0; | ||
| do { | ||
| result += string.substring(cursor, index) + replace; | ||
| cursor = index + close.length; | ||
| index = string.indexOf(close, cursor); | ||
| } while (~index); | ||
| return result + string.substring(cursor); | ||
| }; | ||
| let createColors = (enabled = isColorSupported) => { | ||
| let f = enabled ? formatter : () => String; | ||
| return { | ||
| isColorSupported: enabled, | ||
| reset: f("\x1B[0m", "\x1B[0m"), | ||
| bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"), | ||
| dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"), | ||
| italic: f("\x1B[3m", "\x1B[23m"), | ||
| underline: f("\x1B[4m", "\x1B[24m"), | ||
| inverse: f("\x1B[7m", "\x1B[27m"), | ||
| hidden: f("\x1B[8m", "\x1B[28m"), | ||
| strikethrough: f("\x1B[9m", "\x1B[29m"), | ||
| black: f("\x1B[30m", "\x1B[39m"), | ||
| red: f("\x1B[31m", "\x1B[39m"), | ||
| green: f("\x1B[32m", "\x1B[39m"), | ||
| yellow: f("\x1B[33m", "\x1B[39m"), | ||
| blue: f("\x1B[34m", "\x1B[39m"), | ||
| magenta: f("\x1B[35m", "\x1B[39m"), | ||
| cyan: f("\x1B[36m", "\x1B[39m"), | ||
| white: f("\x1B[37m", "\x1B[39m"), | ||
| gray: f("\x1B[90m", "\x1B[39m"), | ||
| bgBlack: f("\x1B[40m", "\x1B[49m"), | ||
| bgRed: f("\x1B[41m", "\x1B[49m"), | ||
| bgGreen: f("\x1B[42m", "\x1B[49m"), | ||
| bgYellow: f("\x1B[43m", "\x1B[49m"), | ||
| bgBlue: f("\x1B[44m", "\x1B[49m"), | ||
| bgMagenta: f("\x1B[45m", "\x1B[49m"), | ||
| bgCyan: f("\x1B[46m", "\x1B[49m"), | ||
| bgWhite: f("\x1B[47m", "\x1B[49m"), | ||
| blackBright: f("\x1B[90m", "\x1B[39m"), | ||
| redBright: f("\x1B[91m", "\x1B[39m"), | ||
| greenBright: f("\x1B[92m", "\x1B[39m"), | ||
| yellowBright: f("\x1B[93m", "\x1B[39m"), | ||
| blueBright: f("\x1B[94m", "\x1B[39m"), | ||
| magentaBright: f("\x1B[95m", "\x1B[39m"), | ||
| cyanBright: f("\x1B[96m", "\x1B[39m"), | ||
| whiteBright: f("\x1B[97m", "\x1B[39m"), | ||
| bgBlackBright: f("\x1B[100m", "\x1B[49m"), | ||
| bgRedBright: f("\x1B[101m", "\x1B[49m"), | ||
| bgGreenBright: f("\x1B[102m", "\x1B[49m"), | ||
| bgYellowBright: f("\x1B[103m", "\x1B[49m"), | ||
| bgBlueBright: f("\x1B[104m", "\x1B[49m"), | ||
| bgMagentaBright: f("\x1B[105m", "\x1B[49m"), | ||
| bgCyanBright: f("\x1B[106m", "\x1B[49m"), | ||
| bgWhiteBright: f("\x1B[107m", "\x1B[49m") | ||
| }; | ||
| }; | ||
| picocolors.exports = createColors(); | ||
| picocolors.exports.createColors = createColors; | ||
| return picocolors.exports; | ||
| } | ||
| const e = /* @__PURE__ */ getDefaultExportFromCjs(/* @__PURE__ */ requirePicocolors()); | ||
| function J({ onlyFirst: t = false } = {}) { | ||
| const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|"); | ||
| return new RegExp(F, t ? void 0 : "g"); | ||
| } | ||
| const Q = J(); | ||
| function T$1(t) { | ||
| if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``); | ||
| return t.replace(Q, ""); | ||
| } | ||
| function O(t) { | ||
| return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; | ||
| } | ||
| var P$1 = { exports: {} }; | ||
| (function(t) { | ||
| var u = {}; | ||
| t.exports = u, u.eastAsianWidth = function(e) { | ||
| var s = e.charCodeAt(0), i = e.length == 2 ? e.charCodeAt(1) : 0, D = s; | ||
| return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N"; | ||
| }, u.characterLength = function(e) { | ||
| var s = this.eastAsianWidth(e); | ||
| return s == "F" || s == "W" || s == "A" ? 2 : 1; | ||
| }; | ||
| function F(e) { | ||
| return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || []; | ||
| } | ||
| u.length = function(e) { | ||
| for (var s = F(e), i = 0, D = 0; D < s.length; D++) i = i + this.characterLength(s[D]); | ||
| return i; | ||
| }, u.slice = function(e, s, i) { | ||
| textLen = u.length(e), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i); | ||
| for (var D = "", C = 0, o = F(e), E = 0; E < o.length; E++) { | ||
| var a = o[E], n = u.length(a); | ||
| if (C >= s - (n == 2 ? 1 : 0)) if (C + n <= i) D += a; | ||
| else break; | ||
| C += n; | ||
| } | ||
| return D; | ||
| }; | ||
| })(P$1); | ||
| var X = P$1.exports; | ||
| const DD = O(X); | ||
| var uD = function() { | ||
| return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; | ||
| }; | ||
| const FD = O(uD); | ||
| function A$1(t, u = {}) { | ||
| if (typeof t != "string" || t.length === 0 || (u = { | ||
| ambiguousIsNarrow: true, | ||
| ...u | ||
| }, t = T$1(t), t.length === 0)) return 0; | ||
| t = t.replace(FD(), " "); | ||
| const F = u.ambiguousIsNarrow ? 1 : 2; | ||
| let e = 0; | ||
| for (const s of t) { | ||
| const i = s.codePointAt(0); | ||
| if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue; | ||
| switch (DD.eastAsianWidth(s)) { | ||
| case "F": | ||
| case "W": | ||
| e += 2; | ||
| break; | ||
| case "A": | ||
| e += F; | ||
| break; | ||
| default: e += 1; | ||
| } | ||
| } | ||
| return e; | ||
| } | ||
| const m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`, I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`, r = { | ||
| modifier: { | ||
| reset: [0, 0], | ||
| bold: [1, 22], | ||
| dim: [2, 22], | ||
| italic: [3, 23], | ||
| underline: [4, 24], | ||
| overline: [53, 55], | ||
| inverse: [7, 27], | ||
| hidden: [8, 28], | ||
| strikethrough: [9, 29] | ||
| }, | ||
| color: { | ||
| black: [30, 39], | ||
| red: [31, 39], | ||
| green: [32, 39], | ||
| yellow: [33, 39], | ||
| blue: [34, 39], | ||
| magenta: [35, 39], | ||
| cyan: [36, 39], | ||
| white: [37, 39], | ||
| blackBright: [90, 39], | ||
| gray: [90, 39], | ||
| grey: [90, 39], | ||
| redBright: [91, 39], | ||
| greenBright: [92, 39], | ||
| yellowBright: [93, 39], | ||
| blueBright: [94, 39], | ||
| magentaBright: [95, 39], | ||
| cyanBright: [96, 39], | ||
| whiteBright: [97, 39] | ||
| }, | ||
| bgColor: { | ||
| bgBlack: [40, 49], | ||
| bgRed: [41, 49], | ||
| bgGreen: [42, 49], | ||
| bgYellow: [43, 49], | ||
| bgBlue: [44, 49], | ||
| bgMagenta: [45, 49], | ||
| bgCyan: [46, 49], | ||
| bgWhite: [47, 49], | ||
| bgBlackBright: [100, 49], | ||
| bgGray: [100, 49], | ||
| bgGrey: [100, 49], | ||
| bgRedBright: [101, 49], | ||
| bgGreenBright: [102, 49], | ||
| bgYellowBright: [103, 49], | ||
| bgBlueBright: [104, 49], | ||
| bgMagentaBright: [105, 49], | ||
| bgCyanBright: [106, 49], | ||
| bgWhiteBright: [107, 49] | ||
| } | ||
| }; | ||
| Object.keys(r.modifier); | ||
| const tD = Object.keys(r.color), eD = Object.keys(r.bgColor); | ||
| [...tD, ...eD]; | ||
| function sD() { | ||
| const t = /* @__PURE__ */ new Map(); | ||
| for (const [u, F] of Object.entries(r)) { | ||
| for (const [e, s] of Object.entries(F)) r[e] = { | ||
| open: `\x1B[${s[0]}m`, | ||
| close: `\x1B[${s[1]}m` | ||
| }, F[e] = r[e], t.set(s[0], s[1]); | ||
| Object.defineProperty(r, u, { | ||
| value: F, | ||
| enumerable: false | ||
| }); | ||
| } | ||
| return Object.defineProperty(r, "codes", { | ||
| value: t, | ||
| enumerable: false | ||
| }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { | ||
| rgbToAnsi256: { | ||
| value: (u, F, e) => u === F && F === e ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e / 255 * 5), | ||
| enumerable: false | ||
| }, | ||
| hexToRgb: { | ||
| value: (u) => { | ||
| const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16)); | ||
| if (!F) return [ | ||
| 0, | ||
| 0, | ||
| 0 | ||
| ]; | ||
| let [e] = F; | ||
| e.length === 3 && (e = [...e].map((i) => i + i).join("")); | ||
| const s = Number.parseInt(e, 16); | ||
| return [ | ||
| s >> 16 & 255, | ||
| s >> 8 & 255, | ||
| s & 255 | ||
| ]; | ||
| }, | ||
| enumerable: false | ||
| }, | ||
| hexToAnsi256: { | ||
| value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), | ||
| enumerable: false | ||
| }, | ||
| ansi256ToAnsi: { | ||
| value: (u) => { | ||
| if (u < 8) return 30 + u; | ||
| if (u < 16) return 90 + (u - 8); | ||
| let F, e, s; | ||
| if (u >= 232) F = ((u - 232) * 10 + 8) / 255, e = F, s = F; | ||
| else { | ||
| u -= 16; | ||
| const C = u % 36; | ||
| F = Math.floor(u / 36) / 5, e = Math.floor(C / 6) / 5, s = C % 6 / 5; | ||
| } | ||
| const i = Math.max(F, e, s) * 2; | ||
| if (i === 0) return 30; | ||
| let D = 30 + (Math.round(s) << 2 | Math.round(e) << 1 | Math.round(F)); | ||
| return i === 2 && (D += 60), D; | ||
| }, | ||
| enumerable: false | ||
| }, | ||
| rgbToAnsi: { | ||
| value: (u, F, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e)), | ||
| enumerable: false | ||
| }, | ||
| hexToAnsi: { | ||
| value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), | ||
| enumerable: false | ||
| } | ||
| }), r; | ||
| } | ||
| const iD = sD(), v = new Set(["\x1B", ""]), CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y = `${rD}8;;`, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => { | ||
| const e = [...u]; | ||
| let s = false, i = false, D = A$1(T$1(t[t.length - 1])); | ||
| for (const [C, o] of e.entries()) { | ||
| const E = A$1(o); | ||
| if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e.slice(C + 1).join("").startsWith(y)), s) { | ||
| i ? o === w$1 && (s = false, i = false) : o === R && (s = false); | ||
| continue; | ||
| } | ||
| D += E, D === F && C < e.length - 1 && (t.push(""), D = 0); | ||
| } | ||
| !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop()); | ||
| }, nD = (t) => { | ||
| const u = t.split(" "); | ||
| let F = u.length; | ||
| for (; F > 0 && !(A$1(u[F - 1]) > 0);) F--; | ||
| return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join(""); | ||
| }, oD = (t, u, F = {}) => { | ||
| if (F.trim !== false && t.trim() === "") return ""; | ||
| let e = "", s, i; | ||
| const D = ED(t); | ||
| let C = [""]; | ||
| for (const [E, a] of t.split(" ").entries()) { | ||
| F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart()); | ||
| let n = A$1(C[C.length - 1]); | ||
| if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) { | ||
| const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u); | ||
| Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u); | ||
| continue; | ||
| } | ||
| if (n + D[E] > u && n > 0 && D[E] > 0) { | ||
| if (F.wordWrap === false && n < u) { | ||
| _(C, a, u); | ||
| continue; | ||
| } | ||
| C.push(""); | ||
| } | ||
| if (n + D[E] > u && F.wordWrap === false) { | ||
| _(C, a, u); | ||
| continue; | ||
| } | ||
| C[C.length - 1] += a; | ||
| } | ||
| F.trim !== false && (C = C.map((E) => nD(E))); | ||
| const o = [...C.join(` | ||
| `)]; | ||
| for (const [E, a] of o.entries()) { | ||
| if (e += a, v.has(a)) { | ||
| const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} }; | ||
| if (B.code !== void 0) { | ||
| const p = Number.parseFloat(B.code); | ||
| s = p === CD ? void 0 : p; | ||
| } else B.uri !== void 0 && (i = B.uri.length === 0 ? void 0 : B.uri); | ||
| } | ||
| const n = iD.codes.get(Number(s)); | ||
| o[E + 1] === ` | ||
| ` ? (i && (e += z("")), s && n && (e += V$1(n))) : a === ` | ||
| ` && (s && n && (e += V$1(s)), i && (e += z(i))); | ||
| } | ||
| return e; | ||
| }; | ||
| function G(t, u, F) { | ||
| return String(t).normalize().replace(/\r\n/g, ` | ||
| `).split(` | ||
| `).map((e) => oD(e, u, F)).join(` | ||
| `); | ||
| } | ||
| const c = { | ||
| actions: new Set([ | ||
| "up", | ||
| "down", | ||
| "left", | ||
| "right", | ||
| "space", | ||
| "enter", | ||
| "cancel" | ||
| ]), | ||
| aliases: new Map([ | ||
| ["k", "up"], | ||
| ["j", "down"], | ||
| ["h", "left"], | ||
| ["l", "right"], | ||
| ["", "cancel"], | ||
| ["escape", "cancel"] | ||
| ]) | ||
| }; | ||
| function k$1(t, u) { | ||
| if (typeof t == "string") return c.aliases.get(t) === u; | ||
| for (const F of t) if (F !== void 0 && k$1(F, u)) return true; | ||
| return false; | ||
| } | ||
| function lD(t, u) { | ||
| if (t === u) return; | ||
| const F = t.split(` | ||
| `), e = u.split(` | ||
| `), s = []; | ||
| for (let i = 0; i < Math.max(F.length, e.length); i++) F[i] !== e[i] && s.push(i); | ||
| return s; | ||
| } | ||
| globalThis.process.platform.startsWith("win"); | ||
| const S = Symbol("clack:cancel"); | ||
| function d$1(t, u) { | ||
| const F = t; | ||
| F.isTTY && F.setRawMode(u); | ||
| } | ||
| var AD = Object.defineProperty, pD = (t, u, F) => u in t ? AD(t, u, { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: F | ||
| }) : t[u] = F, h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F); | ||
| var x = class { | ||
| constructor(u, F = true) { | ||
| h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value"); | ||
| const { input: e = stdin, output: s = stdout, render: i, signal: D, ...C } = u; | ||
| this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e, this.output = s; | ||
| } | ||
| unsubscribe() { | ||
| this._subscribers.clear(); | ||
| } | ||
| setSubscriber(u, F) { | ||
| const e = this._subscribers.get(u) ?? []; | ||
| e.push(F), this._subscribers.set(u, e); | ||
| } | ||
| on(u, F) { | ||
| this.setSubscriber(u, { cb: F }); | ||
| } | ||
| once(u, F) { | ||
| this.setSubscriber(u, { | ||
| cb: F, | ||
| once: true | ||
| }); | ||
| } | ||
| emit(u, ...F) { | ||
| const e = this._subscribers.get(u) ?? [], s = []; | ||
| for (const i of e) i.cb(...F), i.once && s.push(() => e.splice(e.indexOf(i), 1)); | ||
| for (const i of s) i(); | ||
| } | ||
| prompt() { | ||
| return new Promise((u, F) => { | ||
| if (this._abortSignal) { | ||
| if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u(S); | ||
| this._abortSignal.addEventListener("abort", () => { | ||
| this.state = "cancel", this.close(); | ||
| }, { once: true }); | ||
| } | ||
| const e = new WriteStream(0); | ||
| e._write = (s, i, D) => { | ||
| this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D(); | ||
| }, this.input.pipe(e), this.rl = f.createInterface({ | ||
| input: this.input, | ||
| output: e, | ||
| tabSize: 2, | ||
| prompt: "", | ||
| escapeCodeTimeout: 50 | ||
| }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => { | ||
| this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value); | ||
| }), this.once("cancel", () => { | ||
| this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S); | ||
| }); | ||
| }); | ||
| } | ||
| onKeypress(u, F) { | ||
| if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") { | ||
| if (this.opts.validate) { | ||
| const e = this.opts.validate(this.value); | ||
| e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.value)); | ||
| } | ||
| this.state !== "error" && (this.state = "submit"); | ||
| } | ||
| k$1([ | ||
| u, | ||
| F?.name, | ||
| F?.sequence | ||
| ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close(); | ||
| } | ||
| close() { | ||
| this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(` | ||
| `), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe(); | ||
| } | ||
| restoreCursor() { | ||
| const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(` | ||
| `).length - 1; | ||
| this.output.write(srcExports.cursor.move(-999, u * -1)); | ||
| } | ||
| render() { | ||
| const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true }); | ||
| if (u !== this._prevFrame) { | ||
| if (this.state === "initial") this.output.write(srcExports.cursor.hide); | ||
| else { | ||
| const F = lD(this._prevFrame, u); | ||
| if (this.restoreCursor(), F && F?.length === 1) { | ||
| const e = F[0]; | ||
| this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.lines(1)); | ||
| const s = u.split(` | ||
| `); | ||
| this.output.write(s[e]), this._prevFrame = u, this.output.write(srcExports.cursor.move(0, s.length - e - 1)); | ||
| return; | ||
| } | ||
| if (F && F?.length > 1) { | ||
| const e = F[0]; | ||
| this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.down()); | ||
| const s = u.split(` | ||
| `).slice(e); | ||
| this.output.write(s.join(` | ||
| `)), this._prevFrame = u; | ||
| return; | ||
| } | ||
| this.output.write(srcExports.erase.down()); | ||
| } | ||
| this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u; | ||
| } | ||
| } | ||
| }; | ||
| var fD = class extends x { | ||
| get cursor() { | ||
| return this.value ? 0 : 1; | ||
| } | ||
| get _value() { | ||
| return this.cursor === 0; | ||
| } | ||
| constructor(u) { | ||
| super(u, false), this.value = !!u.initialValue, this.on("value", () => { | ||
| this.value = this._value; | ||
| }), this.on("confirm", (F) => { | ||
| this.output.write(srcExports.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close(); | ||
| }), this.on("cursor", () => { | ||
| this.value = !this.value; | ||
| }); | ||
| } | ||
| }; | ||
| var bD = Object.defineProperty, mD = (t, u, F) => u in t ? bD(t, u, { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: F | ||
| }) : t[u] = F, Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F); | ||
| let wD = class extends x { | ||
| constructor(u) { | ||
| super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => { | ||
| F === "a" && this.toggleAll(); | ||
| }), this.on("cursor", (F) => { | ||
| switch (F) { | ||
| case "left": | ||
| case "up": | ||
| this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1; | ||
| break; | ||
| case "down": | ||
| case "right": | ||
| this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1; | ||
| break; | ||
| case "space": | ||
| this.toggleValue(); | ||
| break; | ||
| } | ||
| }); | ||
| } | ||
| get _value() { | ||
| return this.options[this.cursor].value; | ||
| } | ||
| toggleAll() { | ||
| const u = this.value.length === this.options.length; | ||
| this.value = u ? [] : this.options.map((F) => F.value); | ||
| } | ||
| toggleValue() { | ||
| const u = this.value.includes(this._value); | ||
| this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value]; | ||
| } | ||
| }; | ||
| var SD = Object.defineProperty, $D = (t, u, F) => u in t ? SD(t, u, { | ||
| enumerable: true, | ||
| configurable: true, | ||
| writable: true, | ||
| value: F | ||
| }) : t[u] = F, q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F); | ||
| var jD = class extends x { | ||
| constructor(u) { | ||
| super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => { | ||
| switch (F) { | ||
| case "left": | ||
| case "up": | ||
| this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1; | ||
| break; | ||
| case "down": | ||
| case "right": | ||
| this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1; | ||
| break; | ||
| } | ||
| this.changeValue(); | ||
| }); | ||
| } | ||
| get _value() { | ||
| return this.options[this.cursor]; | ||
| } | ||
| changeValue() { | ||
| this.value = this._value.value; | ||
| } | ||
| }; | ||
| var PD = class extends x { | ||
| get valueWithCursor() { | ||
| if (this.state === "submit") return this.value; | ||
| if (this.cursor >= this.value.length) return `${this.value}\u2588`; | ||
| const u = this.value.slice(0, this.cursor), [F, ...e$1] = this.value.slice(this.cursor); | ||
| return `${u}${e.inverse(F)}${e$1.join("")}`; | ||
| } | ||
| get cursor() { | ||
| return this._cursor; | ||
| } | ||
| constructor(u) { | ||
| super(u), this.on("finalize", () => { | ||
| this.value || (this.value = u.defaultValue); | ||
| }); | ||
| } | ||
| }; | ||
| function ce() { | ||
| return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm"; | ||
| } | ||
| const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"), W = u("▲", "x"), C = u("✔", "√"), o = u(""), d = u(""), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), w = (t) => { | ||
| switch (t) { | ||
| case "initial": | ||
| case "active": return e.cyan(le); | ||
| case "cancel": return e.red(L); | ||
| case "error": return e.yellow(W); | ||
| case "submit": return e.green(C); | ||
| } | ||
| }, B = (t) => { | ||
| const { cursor: n, options: s, style: r } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c = Math.min(a, Math.max(i, 5)); | ||
| let l = 0; | ||
| n >= l + c - 3 ? l = Math.max(Math.min(n - c + 3, s.length - c), 0) : n < l + 2 && (l = Math.max(n - 2, 0)); | ||
| const $ = c < s.length && l > 0, p = c < s.length && l + c < s.length; | ||
| return s.slice(l, l + c).map((M, v, x) => { | ||
| const j = v === 0 && $, E = v === x.length - 1 && p; | ||
| return j || E ? e.dim("...") : r(M, v + l === n); | ||
| }); | ||
| }, he = (t) => new PD({ | ||
| validate: t.validate, | ||
| placeholder: t.placeholder, | ||
| defaultValue: t.defaultValue, | ||
| initialValue: t.initialValue, | ||
| render() { | ||
| const n = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `, s = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), r = this.value ? this.valueWithCursor : s; | ||
| switch (this.state) { | ||
| case "error": return `${n.trim()} | ||
| ${e.yellow(o)} ${r} | ||
| ${e.yellow(d)} ${e.yellow(this.error)} | ||
| `; | ||
| case "submit": return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`; | ||
| case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? ` | ||
| ${e.gray(o)}` : ""}`; | ||
| default: return `${n}${e.cyan(o)} ${r} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(), ye = (t) => { | ||
| const n = t.active ?? "Yes", s = t.inactive ?? "No"; | ||
| return new fD({ | ||
| active: n, | ||
| inactive: s, | ||
| initialValue: t.initialValue ?? true, | ||
| render() { | ||
| const r = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `, i = this.value ? n : s; | ||
| switch (this.state) { | ||
| case "submit": return `${r}${e.gray(o)} ${e.dim(i)}`; | ||
| case "cancel": return `${r}${e.gray(o)} ${e.strikethrough(e.dim(i))} | ||
| ${e.gray(o)}`; | ||
| default: return `${r}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s)}` : `${e.green(k)} ${s}`} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(); | ||
| }, ve = (t) => { | ||
| const n = (s, r) => { | ||
| const i = s.label ?? String(s.value); | ||
| switch (r) { | ||
| case "selected": return `${e.dim(i)}`; | ||
| case "active": return `${e.green(k)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}`; | ||
| case "cancelled": return `${e.strikethrough(e.dim(i))}`; | ||
| default: return `${e.dim(P)} ${e.dim(i)}`; | ||
| } | ||
| }; | ||
| return new jD({ | ||
| options: t.options, | ||
| initialValue: t.initialValue, | ||
| render() { | ||
| const s = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `; | ||
| switch (this.state) { | ||
| case "submit": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`; | ||
| case "cancel": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")} | ||
| ${e.gray(o)}`; | ||
| default: return `${s}${e.cyan(o)} ${B({ | ||
| cursor: this.cursor, | ||
| options: this.options, | ||
| maxItems: t.maxItems, | ||
| style: (r, i) => n(r, i ? "active" : "inactive") | ||
| }).join(` | ||
| ${e.cyan(o)} `)} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(); | ||
| }, fe = (t) => { | ||
| const n = (s, r) => { | ||
| const i = s.label ?? String(s.value); | ||
| return r === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "selected" ? `${e.green(T)} ${e.dim(i)}` : r === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`; | ||
| }; | ||
| return new wD({ | ||
| options: t.options, | ||
| initialValues: t.initialValues, | ||
| required: t.required ?? true, | ||
| cursorAt: t.cursorAt, | ||
| validate(s) { | ||
| if (this.required && s.length === 0) return `Please select at least one option. | ||
| ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`; | ||
| }, | ||
| render() { | ||
| const s = `${e.gray(o)} | ||
| ${w(this.state)} ${t.message} | ||
| `, r = (i, a) => { | ||
| const c = this.value.includes(i.value); | ||
| return a && c ? n(i, "active-selected") : c ? n(i, "selected") : n(i, a ? "active" : "inactive"); | ||
| }; | ||
| switch (this.state) { | ||
| case "submit": return `${s}${e.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e.dim(", ")) || e.dim("none")}`; | ||
| case "cancel": { | ||
| const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(e.dim(", ")); | ||
| return `${s}${e.gray(o)} ${i.trim() ? `${i} | ||
| ${e.gray(o)}` : ""}`; | ||
| } | ||
| case "error": { | ||
| const i = this.error.split(` | ||
| `).map((a, c) => c === 0 ? `${e.yellow(d)} ${e.yellow(a)}` : ` ${a}`).join(` | ||
| `); | ||
| return `${s + e.yellow(o)} ${B({ | ||
| options: this.options, | ||
| cursor: this.cursor, | ||
| maxItems: t.maxItems, | ||
| style: r | ||
| }).join(` | ||
| ${e.yellow(o)} `)} | ||
| ${i} | ||
| `; | ||
| } | ||
| default: return `${s}${e.cyan(o)} ${B({ | ||
| options: this.options, | ||
| cursor: this.cursor, | ||
| maxItems: t.maxItems, | ||
| style: r | ||
| }).join(` | ||
| ${e.cyan(o)} `)} | ||
| ${e.cyan(d)} | ||
| `; | ||
| } | ||
| } | ||
| }).prompt(); | ||
| }; | ||
| `${e.gray(o)}`; | ||
| const kCancel = Symbol.for("cancel"); | ||
| async function prompt(message, opts = {}) { | ||
| const handleCancel = (value) => { | ||
| if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") return value; | ||
| switch (opts.cancel) { | ||
| case "reject": { | ||
| const error = /* @__PURE__ */ new Error("Prompt cancelled."); | ||
| error.name = "ConsolaPromptCancelledError"; | ||
| if (Error.captureStackTrace) Error.captureStackTrace(error, prompt); | ||
| throw error; | ||
| } | ||
| case "undefined": return; | ||
| case "null": return null; | ||
| case "symbol": return kCancel; | ||
| default: | ||
| case "default": return opts.default ?? opts.initial; | ||
| } | ||
| }; | ||
| if (!opts.type || opts.type === "text") return await he({ | ||
| message, | ||
| defaultValue: opts.default, | ||
| placeholder: opts.placeholder, | ||
| initialValue: opts.initial | ||
| }).then(handleCancel); | ||
| if (opts.type === "confirm") return await ye({ | ||
| message, | ||
| initialValue: opts.initial | ||
| }).then(handleCancel); | ||
| if (opts.type === "select") return await ve({ | ||
| message, | ||
| options: opts.options.map((o) => typeof o === "string" ? { | ||
| value: o, | ||
| label: o | ||
| } : o), | ||
| initialValue: opts.initial | ||
| }).then(handleCancel); | ||
| if (opts.type === "multiselect") return await fe({ | ||
| message, | ||
| options: opts.options.map((o) => typeof o === "string" ? { | ||
| value: o, | ||
| label: o | ||
| } : o), | ||
| required: opts.required, | ||
| initialValues: opts.initial | ||
| }).then(handleCancel); | ||
| throw new Error(`Unknown prompt type: ${opts.type}`); | ||
| } | ||
| //#endregion | ||
| export { prompt }; |
| import { n as __toESM, t as require_binding } from "./binding-C9S351wt.mjs"; | ||
| import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-CkdMJ9ps.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 }; |
Sorry, the diff of this file is too big to display
| import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-BVD3dIdE.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 }; |
| 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-zH1vcmbM.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 }; |
| import { n as __toESM, t as require_binding } from "./binding-C9S351wt.mjs"; | ||
| import { o as logMultipleWatcherOption } from "./logs-D80CXhvg.mjs"; | ||
| import { v as LOG_LEVEL_WARN } from "./bindingify-input-options-BnfFBV6b.mjs"; | ||
| import { t as arraify } from "./misc-DJYbNKZX.mjs"; | ||
| import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-BVD3dIdE.mjs"; | ||
| import { t as aggregateBindingErrorsIntoJsError } from "./error-CkdMJ9ps.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 }; |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 11 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 11 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
765834
0.1%12926
-0.31%127
1.6%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated