diff --git a/node-swc/src/Visitor.ts b/node-swc/src/Visitor.ts index dac288f969e..83e74160c09 100644 --- a/node-swc/src/Visitor.ts +++ b/node-swc/src/Visitor.ts @@ -173,7 +173,7 @@ import { WhileStatement, WithStatement, YieldExpression, -} from "./types"; +} from "@swc/types"; export class Visitor { visitProgram(n: Program): Program { diff --git a/node-swc/src/index.ts b/node-swc/src/index.ts index e14587d14c2..ab55a79c337 100644 --- a/node-swc/src/index.ts +++ b/node-swc/src/index.ts @@ -1,5 +1,5 @@ import { resolve } from "path"; -import { +import type { Plugin, ParseOptions, Module, @@ -8,8 +8,8 @@ import { Script, Program, JsMinifyOptions, -} from "./types"; -export * from "./types"; +} from "@swc/types"; +export * from "@swc/types"; import { BundleInput, compileBundleOptions } from "./spack"; import * as assert from "assert"; diff --git a/node-swc/src/spack.ts b/node-swc/src/spack.ts index befd93d931b..9d67a7179bb 100644 --- a/node-swc/src/spack.ts +++ b/node-swc/src/spack.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import { Options } from "./types"; +import { Options } from "@swc/types"; export type BundleInput = BundleOptions | BundleOptions[]; diff --git a/node-swc/src/types.ts b/node-swc/src/types.ts deleted file mode 100644 index 5a03002eed9..00000000000 --- a/node-swc/src/types.ts +++ /dev/null @@ -1,2817 +0,0 @@ -export interface Plugin { - (module: Program): Program; -} - -// TODO: -export type ParseOptions = ParserConfig & { - comments?: boolean; - script?: boolean; - /** - * Defaults to es3. - */ - target?: JscTarget; -}; - -export type TerserEcmaVersion = 5 | 2015 | 2016 | string | number; - -export interface JsMinifyOptions { - compress?: TerserCompressOptions | boolean, - - format?: JsFormatOptions & ToSnakeCaseProperties, - - mangle?: TerserMangleOptions | boolean, - - ecma?: TerserEcmaVersion, - - keep_classnames?: boolean, - - keep_fnames?: boolean, - - module?: boolean, - - safari10?: boolean - - toplevel?: boolean - - sourceMap?: boolean - - outputPath?: string - - inlineSourcesContent?: boolean -} - -/** - * @example ToSnakeCase<'indentLevel'> == 'indent_level' - */ -type ToSnakeCase = T extends `${infer A}${infer B}` - ? `${A extends Lowercase ? A : `_${Lowercase}`}${ToSnakeCase}` - : T - -/** - * @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3} - */ -type ToSnakeCaseProperties = { - [K in keyof T as (K extends string ? ToSnakeCase : K)]: T[K] -} - -/** - * These properties are mostly not implemented yet, - * but it exists to support passing terser config to swc minify - * without modification. - */ -export interface JsFormatOptions { - /** - * Currently noop. - * @default false - * @alias ascii_only - */ - asciiOnly?: boolean - - /** - * Currently noop. - * @default false - */ - beautify?: boolean - - /** - * Currently noop. - * @default false - */ - braces?: boolean - - /** - * - `false`: removes all comments - * - `'some'`: preserves some comments - * - `'all'`: preserves all comments - * @default false - */ - comments?: false | 'some' | 'all' - - /** - * Currently noop. - * @default 5 - */ - ecma?: TerserEcmaVersion - - /** - * Currently noop. - * @alias indent_level - */ - indentLevel?: number - - /** - * Currently noop. - * @alias indent_start - */ - indentStart?: number - - /** - * Currently noop. - * @alias inline_script - */ - inlineScript?: number - - /** - * Currently noop. - * @alias keep_numbers - */ - keepNumbers?: number - - /** - * Currently noop. - * @alias keep_quoted_props - */ - keepQuotedProps?: boolean - - /** - * Currently noop. - * @alias max_line_len - */ - maxLineLen?: number | false - - /** - * Currently noop. - */ - preamble?: string - - /** - * Currently noop. - * @alias quote_keys - */ - quoteKeys?: boolean - - /** - * Currently noop. - * @alias quote_style - */ - quoteStyle?: boolean - - /** - * Currently noop. - * @alias preserve_annotations - */ - preserveAnnotations?: boolean - - /** - * Currently noop. - */ - safari10?: boolean - - /** - * Currently noop. - */ - semicolons?: boolean - - /** - * Currently noop. - */ - shebang?: boolean - - /** - * Currently noop. - */ - webkit?: boolean - - /** - * Currently noop. - * @alias wrap_iife - */ - wrapIife?: boolean - - /** - * Currently noop. - * @alias wrap_func_args - */ - wrapFuncArgs?: boolean -} - -export interface TerserCompressOptions { - arguments?: boolean, - arrows?: boolean, - - - booleans?: boolean, - - - booleans_as_integers?: boolean, - - - collapse_vars?: boolean, - - - comparisons?: boolean, - - - computed_props?: boolean, - - - conditionals?: boolean, - - - dead_code?: boolean, - - defaults?: boolean, - - - directives?: boolean, - - - drop_console?: boolean, - - - drop_debugger?: boolean, - - ecma?: TerserEcmaVersion, - - - evaluate?: boolean, - - - expression?: boolean, - - - global_defs?: any, - - - hoist_funs?: boolean, - - - hoist_props?: boolean, - - - hoist_vars?: boolean, - - - ie8?: boolean, - - - if_return?: boolean, - - - inline?: 0 | 1 | 2 | 3 - - - join_vars?: boolean, - - - keep_classnames?: boolean, - - - keep_fargs?: boolean, - - - keep_fnames?: boolean, - - - keep_infinity?: boolean, - - - loops?: boolean, - // module : false, - - negate_iife?: boolean, - - - passes?: number, - - - properties?: boolean, - - - pure_getters?: any, - - - pure_funcs?: string[], - - - reduce_funcs?: boolean, - - - reduce_vars?: boolean, - - - sequences?: any, - - - side_effects?: boolean, - - - switches?: boolean, - - - top_retain?: any, - - - toplevel?: any, - - - typeofs?: boolean, - - - unsafe?: boolean, - - - unsafe_passes?: boolean, - - - unsafe_arrows?: boolean, - - - unsafe_comps?: boolean, - - - unsafe_function?: boolean, - - - unsafe_math?: boolean, - - - unsafe_symbols?: boolean, - - - unsafe_methods?: boolean, - - - unsafe_proto?: boolean, - - - unsafe_regexp?: boolean, - - - unsafe_undefined?: boolean, - - - unused?: boolean, - - const_to_let?: boolean - - module?: boolean, -} - -export interface TerserMangleOptions { - props?: TerserManglePropertiesOptions, - - toplevel?: boolean, - - keep_classnames?: boolean, - - keep_fnames?: boolean, - - keep_private_props?: boolean, - - ie8?: boolean, - - safari10?: boolean, - - reserved?: string[], -} - -export interface TerserManglePropertiesOptions { - -} - - -/** - * Programmatic options. - */ -export interface Options extends Config { - /** - * If true, a file is parsed as a script instead of module. - */ - script?: boolean; - - /** - * The working directory that all paths in the programmatic - * options will be resolved relative to. - * - * Defaults to `process.cwd()`. - */ - cwd?: string; - caller?: CallerOptions; - /** The filename associated with the code currently being compiled, - * if there is one. The filename is optional, but not all of Swc's - * functionality is available when the filename is unknown, because a - * subset of options rely on the filename for their functionality. - * - * The three primary cases users could run into are: - * - * - The filename is exposed to plugins. Some plugins may require the - * presence of the filename. - * - Options like "test", "exclude", and "ignore" require the filename - * for string/RegExp matching. - * - .swcrc files are loaded relative to the file being compiled. - * If this option is omitted, Swc will behave as if swcrc: false has been set. - */ - filename?: string; - - /** - * The initial path that will be processed based on the "rootMode" to - * determine the conceptual root folder for the current Swc project. - * This is used in two primary cases: - * - * - The base directory when checking for the default "configFile" value - * - The default value for "swcrcRoots". - * - * Defaults to `opts.cwd` - */ - root?: string; - - /** - * This option, combined with the "root" value, defines how Swc chooses - * its project root. The different modes define different ways that Swc - * can process the "root" value to get the final project root. - * - * "root" - Passes the "root" value through as unchanged. - * "upward" - Walks upward from the "root" directory, looking for a directory - * containing a swc.config.js file, and throws an error if a swc.config.js - * is not found. - * "upward-optional" - Walk upward from the "root" directory, looking for - * a directory containing a swc.config.js file, and falls back to "root" - * if a swc.config.js is not found. - * - * - * "root" is the default mode because it avoids the risk that Swc - * will accidentally load a swc.config.js that is entirely outside - * of the current project folder. If you use "upward-optional", - * be aware that it will walk up the directory structure all the - * way to the filesystem root, and it is always possible that someone - * will have a forgotten swc.config.js in their home directory, - * which could cause unexpected errors in your builds. - * - * - * Users with monorepo project structures that run builds/tests on a - * per-package basis may well want to use "upward" since monorepos - * often have a swc.config.js in the project root. Running Swc - * in a monorepo subdirectory without "upward", will cause Swc - * to skip loading any swc.config.js files in the project root, - * which can lead to unexpected errors and compilation failure. - */ - rootMode?: "root" | "upward" | "upward-optional"; - - /** - * The current active environment used during configuration loading. - * This value is used as the key when resolving "env" configs, - * and is also available inside configuration functions, plugins, - * and presets, via the api.env() function. - * - * Defaults to `process.env.SWC_ENV || process.env.NODE_ENV || "development"` - */ - envName?: string; - - /** - * Defaults to searching for a default `.swcrc` file, but can - * be passed the path of any JS or JSON5 config file. - * - * - * NOTE: This option does not affect loading of .swcrc files, - * so while it may be tempting to do configFile: "./foo/.swcrc", - * it is not recommended. If the given .swcrc is loaded via the - * standard file-relative logic, you'll end up loading the same - * config file twice, merging it with itself. If you are linking - * a specific config file, it is recommended to stick with a - * naming scheme that is independent of the "swcrc" name. - * - * Defaults to `path.resolve(opts.root, ".swcrc")` - */ - configFile?: string | boolean; - - /** - * true will enable searching for configuration files relative to the "filename" provided to Swc. - * - * A swcrc value passed in the programmatic options will override one set within a configuration file. - * - * Note: .swcrc files are only loaded if the current "filename" is inside of - * a package that matches one of the "swcrcRoots" packages. - * - * - * Defaults to true as long as the filename option has been specified - */ - swcrc?: boolean; - - /** - * By default, Babel will only search for .babelrc files within the "root" package - * because otherwise Babel cannot know if a given .babelrc is meant to be loaded, - * or if it's "plugins" and "presets" have even been installed, since the file - * being compiled could be inside node_modules, or have been symlinked into the project. - * - * - * This option allows users to provide a list of other packages that should be - * considered "root" packages when considering whether to load .babelrc files. - * - * - * For example, a monorepo setup that wishes to allow individual packages - * to have their own configs might want to do - * - * - * - * Defaults to `opts.root` - */ - swcrcRoots?: boolean | MatchPattern | MatchPattern[]; - - /** - * `true` will attempt to load an input sourcemap from the file itself, if it - * contains a //# sourceMappingURL=... comment. If no map is found, or the - * map fails to load and parse, it will be silently discarded. - * - * If an object is provided, it will be treated as the source map object itself. - * - * Defaults to `true`. - */ - inputSourceMap?: boolean | string; - - /** - * The name to use for the file inside the source map object. - * - * Defaults to `path.basename(opts.filenameRelative)` when available, or `"unknown"`. - */ - sourceFileName?: string; - - /** - * The sourceRoot fields to set in the generated source map, if one is desired. - */ - sourceRoot?: string; - - plugin?: Plugin; - - isModule?: boolean | 'unknown'; - - /** - * Destination path. Note that this value is used only to fix source path - * of source map files and swc does not write output to this path. - */ - outputPath?: string -} - -export interface CallerOptions { - name: string; - [key: string]: any; -} - -export type Swcrc = Config | Config[]; - -/** - * .swcrc - */ -export interface Config { - /** - * Note: The type is string because it follows rust's regex syntax. - */ - test?: string | string[]; - /** - * Note: The type is string because it follows rust's regex syntax. - */ - exclude?: string | string[]; - env?: EnvConfig; - jsc?: JscConfig; - module?: ModuleConfig; - minify?: boolean; - - /** - * - true to generate a sourcemap for the code and include it in the result object. - * - "inline" to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object. - * - * `swc-cli` overloads some of these to also affect how maps are written to disk: - * - * - true will write the map to a .map file on disk - * - "inline" will write the file directly, so it will have a data: containing the map - * - Note: These options are bit weird, so it may make the most sense to just use true - * and handle the rest in your own code, depending on your use case. - */ - sourceMaps?: boolean | "inline"; - - inlineSourcesContent?: boolean -} - -/** - * Configuration ported from babel-preset-env - */ -export interface EnvConfig { - mode?: "usage" | "entry"; - debug?: boolean; - dynamicImport?: boolean; - - loose?: boolean; - - /// Skipped es features. - /// - /// e.g.) - /// - `core-js/modules/foo` - skip?: string[]; - - include?: string[]; - - exclude?: string[]; - - /** - * The version of the used core js. - * - */ - coreJs?: string; - - targets?: any; - - path?: string; - - shippedProposals?: boolean; - - /** - * Enable all transforms - */ - forceAllTransforms?: boolean; -} - -export interface JscConfig { - loose?: boolean; - - /** - * Defaults to EsParserConfig - */ - parser?: ParserConfig; - transform?: TransformConfig; - /** - * Use `@swc/helpers` instead of inline helpers. - */ - externalHelpers?: boolean; - - /** - * Defaults to `es3` (which enabled **all** pass). - */ - target?: JscTarget; - - /** - * Keep class names. - */ - keepClassNames?: boolean - - experimental?: { - optimizeHygiene?: boolean, - keepImportAssertions?: boolean, - /** - * Specify the location where SWC stores its intermediate cache files. - * Currently only transform plugin uses this. If not specified, SWC will - * create `.swc` directories. - */ - cacheRoot?: string; - /** - * List of custom transform plugins written in WebAssembly. - * First parameter of tuple indicates the name of the plugin - it can be either - * a name of the npm package can be resolved, or absolute path to .wasm binary. - * - * Second parameter of tuple is JSON based configuration for the plugin. - */ - plugins?: Array<[string, Record]> - }, - - baseUrl?: string - - paths?: { - [from: string]: string[] - } - - minify?: JsMinifyOptions; - - preserveAllComments?: boolean; -} - -export type JscTarget = - | "es3" - | "es5" - | "es2015" - | "es2016" - | "es2017" - | "es2018" - | "es2019" - | "es2020" - | "es2021" - | "es2022" - | "esnext"; - -export type ParserConfig = TsParserConfig | EsParserConfig; -export interface TsParserConfig { - syntax: "typescript"; - /** - * Defaults to `false`. - */ - tsx?: boolean; - /** - * Defaults to `false`. - */ - decorators?: boolean; - /** - * Defaults to `false` - */ - dynamicImport?: boolean; -} - -export interface EsParserConfig { - syntax: "ecmascript"; - /** - * Defaults to false. - */ - jsx?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - numericSeparator?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - classPrivateProperty?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - privateMethod?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - classProperty?: boolean; - /** - * Defaults to `false` - */ - functionBind?: boolean; - /** - * Defaults to `false` - */ - decorators?: boolean; - /** - * Defaults to `false` - */ - decoratorsBeforeExport?: boolean; - /** - * Defaults to `false` - */ - exportDefaultFrom?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - exportNamespaceFrom?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - dynamicImport?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - nullishCoalescing?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - optionalChaining?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - importMeta?: boolean; - /** - * @deprecated Always true because it's in ecmascript spec. - */ - topLevelAwait?: boolean; - /** - * Defaults to `false` - */ - importAssertions?: boolean; -} - -/** - * Options for transform. - */ -export interface TransformConfig { - /** - * Effective only if `syntax` supports ƒ. - */ - react?: ReactConfig; - - constModules?: ConstModulesConfig; - - /** - * Defaults to null, which skips optimizer pass. - */ - optimizer?: OptimizerConfig; - - /** - * https://swc.rs/docs/configuring-swc.html#jsctransformlegacydecorator - */ - legacyDecorator?: boolean; - - /** - * https://swc.rs/docs/configuring-swc.html#jsctransformdecoratormetadata - */ - decoratorMetadata?: boolean; - - treatConstEnumAsEnum?: boolean; - - useDefineForClassFields?: boolean; -} - -export interface ReactConfig { - /** - * Replace the function used when compiling JSX expressions. - * - * Defaults to `React.createElement`. - */ - pragma?: string; - /** - * Replace the component used when compiling JSX fragments. - * - * Defaults to `React.Fragment` - */ - pragmaFrag?: string; - /** - * Toggles whether or not to throw an error if a XML namespaced tag name is used. For example: - * `` - * - * Though the JSX spec allows this, it is disabled by default since React's - * JSX does not currently have support for it. - * - */ - throwIfNamespace?: boolean; - /** - * Toggles plugins that aid in development, such as @swc/plugin-transform-react-jsx-self - * and @swc/plugin-transform-react-jsx-source. - * - * Defaults to `false`, - * - */ - development?: boolean; - /** - * Use `Object.assign()` instead of `_extends`. Defaults to false. - * @deprecated - */ - useBuiltins?: boolean; - - /** - * Enable fast refresh feature for React app - */ - refresh?: boolean; - - /** - * jsx runtime - */ - runtime?: 'automatic' | 'classic' - - /** - * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic' - */ - importSource?: string -} -/** - * - `import { DEBUG } from '@ember/env-flags';` - * - `import { FEATURE_A, FEATURE_B } from '@ember/features';` - * - * See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558 - */ -export interface ConstModulesConfig { - globals?: { - [module: string]: { - [name: string]: string; - }; - }; -} - -/// https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerjsonify -export interface OptimizerConfig { - /// https://swc.rs/docs/configuration/compilation#jsctransformoptimizersimplify - simplify?: boolean; - /// https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerglobals - globals?: GlobalPassOption; - /// https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerjsonify - jsonify?: { minCost: number }; -} - -/** - * Options for inline-global pass. - */ -export interface GlobalPassOption { - /** - * Global variables that should be inlined with passed value. - * - * e.g. `{ __DEBUG__: true }` - */ - vars?: Record; - - /** - * Names of environment variables that should be inlined with the value of corresponding env during build. - * - * Defaults to `["NODE_ENV", "SWC_ENV"]` - */ - envs?: string[]; - - /** - * Replaces typeof calls for passed variables with corresponding value - * - * e.g. `{ window: 'object' }` - */ - typeofs?: Record; -} - -export type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig; - -export interface BaseModuleConfig { - /** - * By default, when using exports with babel a non-enumerable `__esModule` - * property is exported. In some cases this property is used to determine - * if the import is the default export or if it contains the default export. - * - * In order to prevent the __esModule property from being exported, you - * can set the strict option to true. - * - * Defaults to `false`. - */ - strict?: boolean; - - /** - * Emits 'use strict' directive. - * - * Defaults to `true`. - */ - strictMode?: boolean; - - /** - * Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time. - * - * This can improve initial load time of your module because evaluating dependencies up - * front is sometimes entirely un-necessary. This is especially the case when implementing - * a library module. - * - * - * The value of `lazy` has a few possible effects: - * - * - `false` - No lazy initialization of any imported module. - * - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies. - * - * Local paths are much more likely to have circular dependencies, which may break if loaded lazily, - * so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical. - * - * - `Array` - Lazy-initialize all imports with source matching one of the given strings. - * - * ----- - * - * The two cases where imports can never be lazy are: - * - * - `import "foo";` - * - * Side-effect imports are automatically non-lazy since their very existence means - * that there is no binding to later kick off initialization. - * - * - `export * from "foo"` - * - * Re-exporting all names requires up-front execution because otherwise there is no - * way to know what names need to be exported. - * - * Defaults to `false`. - */ - lazy?: boolean | string[]; - /** - * @deprecated Use the `importInterop` option instead. - * - * By default, when using exports with swc a non-enumerable __esModule property is exported. - * This property is then used to determine if the import is the default export or if - * it contains the default export. - * - * In cases where the auto-unwrapping of default is not needed, you can set the noInterop option - * to true to avoid the usage of the interopRequireDefault helper (shown in inline form above). - * - * Defaults to `false`. - */ - noInterop?: boolean; - /** - * Defaults to `swc`. - * - * CommonJS modules and ECMAScript modules are not fully compatible. - * However, compilers, bundlers and JavaScript runtimes developed different strategies - * to make them work together as well as possible. - * - * - `swc` (alias: `babel`) - * - * When using exports with `swc` a non-enumerable `__esModule` property is exported - * This property is then used to determine if the import is the default export - * or if it contains the default export. - * - * ```javascript - * import foo from "foo"; - * import { bar } from "bar"; - * foo; - * bar; - * - * // Is compiled to ... - * - * "use strict"; - * - * function _interop_require_default(obj) { - * return obj && obj.__esModule ? obj : { default: obj }; - * } - * - * var _foo = _interop_require_default(require("foo")); - * var _bar = require("bar"); - * - * _foo.default; - * _bar.bar; - * ``` - * - * When this import interop is used, if both the imported and the importer module are compiled - * with swc they behave as if none of them was compiled. - * - * This is the default behavior. - * - * - `node` - * - * When importing CommonJS files (either directly written in CommonJS, or generated with a compiler) - * Node.js always binds the `default` export to the value of `module.exports`. - * - * ```javascript - * import foo from "foo"; - * import { bar } from "bar"; - * foo; - * bar; - * - * // Is compiled to ... - * - * "use strict"; - * - * var _foo = require("foo"); - * var _bar = require("bar"); - * - * _foo; - * _bar.bar; - * ``` - * This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports` - * as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`. - * However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`. - * - * - `none` - * - * If you know that the imported file has been transformed with a compiler that stores the `default` export on - * `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper. - * - * ```javascript - * import foo from "foo"; - * import { bar } from "bar"; - * foo; - * bar; - * - * // Is compiled to ... - * - * "use strict"; - * - * var _foo = require("foo"); - * var _bar = require("bar"); - * - * _foo.default; - * _bar.bar; - * ``` - */ - importInterop?: "swc" | "babel" | "node" | "none"; - /** - * Emits `cjs-module-lexer` annotation - * `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM. - * swc will emit `cjs-module-lexer` detectable annotation with this option enabled. - * - * Defaults to `true` if import_interop is Node, else `false` - */ - exportInteropAnnotation?: boolean; - /** - * If set to true, dynamic imports will be preserved. - */ - ignoreDynamic?: boolean; - allowTopLevelThis?: boolean; - preserveImportMeta?: boolean; -} - -export interface Es6Config extends BaseModuleConfig { - type: "es6"; -} - -export interface NodeNextConfig extends BaseModuleConfig { - type: "nodenext"; -} - -export interface CommonJsConfig extends BaseModuleConfig { - type: "commonjs"; -} - -export interface UmdConfig extends BaseModuleConfig { - type: "umd"; - globals?: { [key: string]: string }; -} - -export interface AmdConfig extends BaseModuleConfig { - type: "amd"; - moduleId?: string; -} -export interface SystemjsConfig { - type: "systemjs"; - allowTopLevelThis?: boolean; -} -export interface Output { - /** - * Transformed code - */ - code: string; - /** - * Sourcemap (**not** base64 encoded) - */ - map?: string; -} - -export interface MatchPattern { } - -// ------------------------------- -// ---------- Ast nodes ---------- -// ------------------------------- - -export interface Span { - start: number; - end: number; - ctxt: number; -} - -export interface Node { - type: string; -} - -export interface HasSpan { - span: Span; -} - -export interface HasDecorator { - decorators?: Decorator[]; -} - -export interface Class extends HasSpan, HasDecorator { - body: ClassMember[]; - - superClass?: Expression; - - isAbstract: boolean; - - typeParams?: TsTypeParameterDeclaration; - - superTypeParams?: TsTypeParameterInstantiation; - - implements: TsExpressionWithTypeArguments[]; -} - -export type ClassMember = - | Constructor - | ClassMethod - | PrivateMethod - | ClassProperty - | PrivateProperty - | TsIndexSignature - | EmptyStatement - | StaticBlock; - -export interface ClassPropertyBase extends Node, HasSpan, HasDecorator { - value?: Expression; - - typeAnnotation?: TsTypeAnnotation; - - isStatic: boolean; - - accessibility?: Accessibility; - - isOptional: boolean; - - isOverride: boolean; - - readonly: boolean; - - definite: boolean; -} - -export interface ClassProperty extends ClassPropertyBase { - type: "ClassProperty"; - - key: PropertyName; - - isAbstract: boolean; - - declare: boolean; -} - -export interface PrivateProperty extends ClassPropertyBase { - type: "PrivateProperty"; - - key: PrivateName; -} - -export interface Param extends Node, HasSpan, HasDecorator { - type: "Parameter"; - pat: Pattern; -} - -export interface Constructor extends Node, HasSpan { - type: "Constructor"; - - key: PropertyName; - - params: (TsParameterProperty | Param)[]; - - body?: BlockStatement; - - accessibility?: Accessibility; - - isOptional: boolean; -} - -export interface ClassMethodBase extends Node, HasSpan { - function: Fn; - - kind: MethodKind; - - isStatic: boolean; - - accessibility?: Accessibility; - - isAbstract: boolean; - - isOptional: boolean; - - isOverride: boolean; -} - -export interface ClassMethod extends ClassMethodBase { - type: "ClassMethod"; - - key: PropertyName; -} - -export interface PrivateMethod extends ClassMethodBase { - type: "PrivateMethod"; - - key: PrivateName; -} - -export interface StaticBlock extends Node, HasSpan { - type: "StaticBlock"; - - body: BlockStatement; -} - -export interface Decorator extends Node, HasSpan { - type: "Decorator"; - - expression: Expression; -} - -export type MethodKind = "method" | "getter" | "setter"; - -export type Declaration = - | ClassDeclaration - | FunctionDeclaration - | VariableDeclaration - | TsInterfaceDeclaration - | TsTypeAliasDeclaration - | TsEnumDeclaration - | TsModuleDeclaration; - -export interface FunctionDeclaration extends Fn { - type: "FunctionDeclaration"; - - identifier: Identifier; - - declare: boolean; -} - -export interface ClassDeclaration extends Class, Node { - type: "ClassDeclaration"; - - identifier: Identifier; - - declare: boolean; -} - -export interface VariableDeclaration extends Node, HasSpan { - type: "VariableDeclaration"; - - kind: VariableDeclarationKind; - - declare: boolean; - - declarations: VariableDeclarator[]; -} - -export type VariableDeclarationKind = "var" | "let" | "const"; - -export interface VariableDeclarator extends Node, HasSpan { - type: "VariableDeclarator"; - - id: Pattern; - - /// Initialization expression. - init?: Expression; - - /// Typescript only - definite: boolean; -} - -export type Expression = - | ThisExpression - | ArrayExpression - | ObjectExpression - | FunctionExpression - | UnaryExpression - | UpdateExpression - | BinaryExpression - | AssignmentExpression - | MemberExpression - | SuperPropExpression - | ConditionalExpression - | CallExpression - | NewExpression - | SequenceExpression - | Identifier - | Literal - | TemplateLiteral - | TaggedTemplateExpression - | ArrowFunctionExpression - | ClassExpression - | YieldExpression - | MetaProperty - | AwaitExpression - | ParenthesisExpression - | JSXMemberExpression - | JSXNamespacedName - | JSXEmptyExpression - | JSXElement - | JSXFragment - | TsTypeAssertion - | TsConstAssertion - | TsNonNullExpression - | TsAsExpression - | TsSatisfiesExpression - | TsInstantiation - | PrivateName - | OptionalChainingExpression - | Invalid; - -interface ExpressionBase extends Node, HasSpan { } - -export interface Identifier extends ExpressionBase { - type: "Identifier"; - - value: string; - - /// TypeScript only. Used in case of an optional parameter. - optional: boolean; -} - -export interface OptionalChainingExpression extends ExpressionBase { - type: "OptionalChainingExpression"; - questionDotToken: Span; - /** - * Call expression or member expression. - */ - base: MemberExpression | OptionalChainingCall; -} - -export interface OptionalChainingCall extends ExpressionBase { - type: "CallExpression"; - callee: Expression; - arguments: ExprOrSpread[]; - typeArguments?: TsTypeParameterInstantiation; -} - -export interface ThisExpression extends ExpressionBase { - type: "ThisExpression"; -} - -export interface ArrayExpression extends ExpressionBase { - type: "ArrayExpression"; - - elements: (ExprOrSpread | undefined)[]; -} - -export interface ExprOrSpread { - spread?: Span; - expression: Expression; -} - -export interface ObjectExpression extends ExpressionBase { - type: "ObjectExpression"; - - properties: (SpreadElement | Property)[]; -} - -export interface Argument { - spread?: Span; - expression: Expression; -} - -export interface SpreadElement extends Node { - type: "SpreadElement"; - - spread: Span; - - arguments: Expression; -} - -export interface UnaryExpression extends ExpressionBase { - type: "UnaryExpression"; - - operator: UnaryOperator; - - argument: Expression; -} - -export interface UpdateExpression extends ExpressionBase { - type: "UpdateExpression"; - - operator: UpdateOperator; - - prefix: boolean; - - argument: Expression; -} - -export interface BinaryExpression extends ExpressionBase { - type: "BinaryExpression"; - - operator: BinaryOperator; - - left: Expression; - - right: Expression; -} - -export interface FunctionExpression extends Fn, ExpressionBase { - type: "FunctionExpression"; - - identifier?: Identifier; -} - -export interface ClassExpression extends Class, ExpressionBase { - type: "ClassExpression"; - - identifier?: Identifier; -} - -export interface AssignmentExpression extends ExpressionBase { - type: "AssignmentExpression"; - - operator: AssignmentOperator; - - left: Expression | Pattern; - - right: Expression; -} - -export interface MemberExpression extends ExpressionBase { - type: "MemberExpression"; - - object: Expression; - - property: Identifier | PrivateName | ComputedPropName; -} - -export interface SuperPropExpression extends ExpressionBase { - type: "SuperPropExpression"; - - obj: Super; - - property: Identifier | ComputedPropName; -} - -export interface ConditionalExpression extends ExpressionBase { - type: "ConditionalExpression"; - - test: Expression; - - consequent: Expression; - - alternate: Expression; -} - -export interface Super extends Node, HasSpan { - type: "Super"; -} - -export interface Import extends Node, HasSpan { - type: "Import"; -} - -export interface CallExpression extends ExpressionBase { - type: "CallExpression"; - - callee: Super | Import | Expression; - - arguments: Argument[]; - - typeArguments?: TsTypeParameterInstantiation; -} - -export interface NewExpression extends ExpressionBase { - type: "NewExpression"; - - callee: Expression; - - arguments?: Argument[]; - - typeArguments?: TsTypeParameterInstantiation; -} - -export interface SequenceExpression extends ExpressionBase { - type: "SequenceExpression"; - - expressions: Expression[]; -} - -export interface ArrowFunctionExpression extends ExpressionBase { - type: "ArrowFunctionExpression"; - - params: Pattern[]; - - body: BlockStatement | Expression; - - async: boolean; - - generator: boolean; - - typeParameters?: TsTypeParameterDeclaration; - - returnType?: TsTypeAnnotation; -} - -export interface YieldExpression extends ExpressionBase { - type: "YieldExpression"; - - argument?: Expression; - - delegate: boolean; -} - -export interface MetaProperty extends Node, HasSpan { - type: "MetaProperty"; - - kind: "new.target" | "import.meta"; -} - -export interface AwaitExpression extends ExpressionBase { - type: "AwaitExpression"; - - argument: Expression; -} - -export interface TemplateLiteral extends ExpressionBase { - type: "TemplateLiteral"; - - expressions: Expression[]; - - quasis: TemplateElement[]; -} - -export interface TaggedTemplateExpression extends ExpressionBase { - type: "TaggedTemplateExpression"; - - tag: Expression; - - typeParameters?: TsTypeParameterInstantiation; - - template: TemplateLiteral; -} - -export interface TemplateElement extends ExpressionBase { - type: "TemplateElement"; - - tail: boolean; - cooked?: string; - raw: string; -} - -export interface ParenthesisExpression extends ExpressionBase { - type: "ParenthesisExpression"; - - expression: Expression; -} - -export interface Fn extends HasSpan, HasDecorator { - params: Param[]; - - body?: BlockStatement; - - generator: boolean; - - async: boolean; - - typeParameters?: TsTypeParameterDeclaration; - - returnType?: TsTypeAnnotation; -} - -interface PatternBase extends Node, HasSpan { - typeAnnotation?: TsTypeAnnotation; -} - -export interface PrivateName extends ExpressionBase { - type: "PrivateName"; - - id: Identifier; -} - -export type JSXObject = JSXMemberExpression | Identifier; - -export interface JSXMemberExpression extends Node { - type: "JSXMemberExpression"; - - object: JSXObject; - property: Identifier; -} - -/** - * XML-based namespace syntax: - */ -export interface JSXNamespacedName extends Node { - type: "JSXNamespacedName"; - - namespace: Identifier; - name: Identifier; -} - -export interface JSXEmptyExpression extends Node, HasSpan { - type: "JSXEmptyExpression"; -} - -export interface JSXExpressionContainer extends Node, HasSpan { - type: "JSXExpressionContainer"; - - expression: JSXExpression; -} - -export type JSXExpression = JSXEmptyExpression | Expression; - -export interface JSXSpreadChild extends Node, HasSpan { - type: "JSXSpreadChild"; - - expression: Expression; -} - -export type JSXElementName = - | Identifier - | JSXMemberExpression - | JSXNamespacedName; - -export interface JSXOpeningElement extends Node, HasSpan { - type: "JSXOpeningElement"; - - name: JSXElementName; - - attributes: JSXAttributeOrSpread[]; - - selfClosing: boolean; - - typeArguments?: TsTypeParameterInstantiation; -} - -export type JSXAttributeOrSpread = JSXAttribute | SpreadElement; - -export interface JSXClosingElement extends Node, HasSpan { - type: "JSXClosingElement"; - - name: JSXElementName; -} - -export interface JSXAttribute extends Node, HasSpan { - type: "JSXAttribute"; - - name: JSXAttributeName; - - value?: JSXAttrValue; -} - -export type JSXAttributeName = Identifier | JSXNamespacedName; - -export type JSXAttrValue = - | Literal - | JSXExpressionContainer - | JSXElement - | JSXFragment; - -export interface JSXText extends Node, HasSpan { - type: "JSXText"; - - value: string; - raw: string; -} - -export interface JSXElement extends Node, HasSpan { - type: "JSXElement"; - - opening: JSXOpeningElement; - children: JSXElementChild[]; - closing?: JSXClosingElement; -} - -export type JSXElementChild = - | JSXText - | JSXExpressionContainer - | JSXSpreadChild - | JSXElement - | JSXFragment; - -export interface JSXFragment extends Node, HasSpan { - type: "JSXFragment"; - - opening: JSXOpeningFragment; - - children: JSXElementChild[]; - - closing: JSXClosingFragment; -} - -export interface JSXOpeningFragment extends Node, HasSpan { - type: "JSXOpeningFragment"; -} - -export interface JSXClosingFragment extends Node, HasSpan { - type: "JSXClosingFragment"; -} - -export type Literal = - | StringLiteral - | BooleanLiteral - | NullLiteral - | NumericLiteral - | BigIntLiteral - | RegExpLiteral - | JSXText; - -export interface StringLiteral extends Node, HasSpan { - type: "StringLiteral"; - - value: string; - - raw?: string; -} - -export interface BooleanLiteral extends Node, HasSpan { - type: "BooleanLiteral"; - - value: boolean; -} - -export interface NullLiteral extends Node, HasSpan { - type: "NullLiteral"; -} - -export interface RegExpLiteral extends Node, HasSpan { - type: "RegExpLiteral"; - - pattern: string; - flags: string; -} - -export interface NumericLiteral extends Node, HasSpan { - type: "NumericLiteral"; - - value: number; - - raw?: string; -} - -export interface BigIntLiteral extends Node, HasSpan { - type: "BigIntLiteral"; - - value: bigint; - - raw?: string; -} - -export type ModuleDeclaration = - | ImportDeclaration - | ExportDeclaration - | ExportNamedDeclaration - | ExportDefaultDeclaration - | ExportDefaultExpression - | ExportAllDeclaration - | TsImportEqualsDeclaration - | TsExportAssignment - | TsNamespaceExportDeclaration; - -export interface ExportDefaultExpression extends Node, HasSpan { - type: "ExportDefaultExpression"; - - expression: Expression; -} - -export interface ExportDeclaration extends Node, HasSpan { - type: "ExportDeclaration"; - - declaration: Declaration; -} - -export interface ImportDeclaration extends Node, HasSpan { - type: "ImportDeclaration"; - - specifiers: ImportSpecifier[]; - - source: StringLiteral; - - typeOnly: boolean; - - asserts?: ObjectExpression; -} - -export interface ExportAllDeclaration extends Node, HasSpan { - type: "ExportAllDeclaration"; - - source: StringLiteral; - - asserts?: ObjectExpression; -} - -/** - * - `export { foo } from 'mod'` - * - `export { foo as bar } from 'mod'` - */ -export interface ExportNamedDeclaration extends Node, HasSpan { - type: "ExportNamedDeclaration"; - - specifiers: ExportSpecifier[]; - - source?: StringLiteral; - - typeOnly: boolean; - - asserts?: ObjectExpression; -} - -export interface ExportDefaultDeclaration extends Node, HasSpan { - type: "ExportDefaultDeclaration"; - - decl: DefaultDecl; -} - -export type DefaultDecl = - | ClassExpression - | FunctionExpression - | TsInterfaceDeclaration; - -export type ImportSpecifier = - | NamedImportSpecifier - | ImportDefaultSpecifier - | ImportNamespaceSpecifier; - -/** - * e.g. `import foo from 'mod.js'` - */ -export interface ImportDefaultSpecifier extends Node, HasSpan { - type: "ImportDefaultSpecifier"; - local: Identifier; -} - -/** - * e.g. `import * as foo from 'mod.js'`. - */ -export interface ImportNamespaceSpecifier extends Node, HasSpan { - type: "ImportNamespaceSpecifier"; - - local: Identifier; -} - -/** - * e.g. - `import { foo } from 'mod.js'` - * - * local = foo, imported = None - * - * e.g. `import { foo as bar } from 'mod.js'` - * - * local = bar, imported = Some(foo) for - */ -export interface NamedImportSpecifier extends Node, HasSpan { - type: "ImportSpecifier"; - local: Identifier; - imported?: ModuleExportName; - isTypeOnly: boolean; -} - -export type ModuleExportName = Identifier | StringLiteral; - -export type ExportSpecifier = - | ExportNamespaceSpecifier - | ExportDefaultSpecifier - | NamedExportSpecifier; - -/** - * `export * as foo from 'src';` - */ -export interface ExportNamespaceSpecifier extends Node, HasSpan { - type: "ExportNamespaceSpecifier"; - - name: ModuleExportName; -} - -export interface ExportDefaultSpecifier extends Node, HasSpan { - type: "ExportDefaultSpecifier"; - - exported: Identifier; -} - -export interface NamedExportSpecifier extends Node, HasSpan { - type: "ExportSpecifier"; - - orig: ModuleExportName; - /** - * `Some(bar)` in `export { foo as bar }` - */ - exported?: ModuleExportName; - isTypeOnly: boolean; -} - -interface HasInterpreter { - /** - * e.g. `/usr/bin/node` for `#!/usr/bin/node` - */ - interpreter: string; -} - -export type Program = Module | Script; - -export interface Module extends Node, HasSpan, HasInterpreter { - type: "Module"; - - body: ModuleItem[]; -} - -export interface Script extends Node, HasSpan, HasInterpreter { - type: "Script"; - - body: Statement[]; -} - -export type ModuleItem = ModuleDeclaration | Statement; - -export type BinaryOperator = - | "==" - | "!=" - | "===" - | "!==" - | "<" - | "<=" - | ">" - | ">=" - | "<<" - | ">>" - | ">>>" - | "+" - | "-" - | "*" - | "/" - | "%" - | "|" - | "^" - | "&" - | "||" - | "&&" - | "in" - | "instanceof" - | "**" - | "??"; - -export type AssignmentOperator = - | "=" - | "+=" - | "-=" - | "*=" - | "/=" - | "%=" - | "<<=" - | ">>=" - | ">>>=" - | "|=" - | "^=" - | "&=" - | "**=" - | "&&=" - | "||=" - | "??="; - -export type UpdateOperator = "++" | "--"; - -export type UnaryOperator = - | "-" - | "+" - | "!" - | "~" - | "typeof" - | "void" - | "delete"; - -export type Pattern = - | BindingIdentifier - | ArrayPattern - | RestElement - | ObjectPattern - | AssignmentPattern - | Invalid - | Expression; - -export interface BindingIdentifier extends PatternBase { - type: "Identifier"; - value: string; - optional: boolean; -} - -export interface ArrayPattern extends PatternBase { - type: "ArrayPattern"; - - elements: (Pattern | undefined)[]; - - optional: boolean; -} - -export interface ObjectPattern extends PatternBase { - type: "ObjectPattern"; - - properties: ObjectPatternProperty[]; - - optional: boolean; -} - -export interface AssignmentPattern extends PatternBase { - type: "AssignmentPattern"; - - left: Pattern; - right: Expression; -} - -export interface RestElement extends PatternBase { - type: "RestElement"; - - rest: Span; - - argument: Pattern; -} - -export type ObjectPatternProperty = - | KeyValuePatternProperty - | AssignmentPatternProperty - | RestElement; - -/** - * `{key: value}` - */ -export interface KeyValuePatternProperty extends Node { - type: "KeyValuePatternProperty"; - - key: PropertyName; - value: Pattern; -} - -/** - * `{key}` or `{key = value}` - */ -export interface AssignmentPatternProperty extends Node, HasSpan { - type: "AssignmentPatternProperty"; - - key: Identifier; - value?: Expression; -} - -/** Identifier is `a` in `{ a, }` */ -export type Property = - | Identifier - | KeyValueProperty - | AssignmentProperty - | GetterProperty - | SetterProperty - | MethodProperty; - -interface PropBase extends Node { - key: PropertyName; -} - -export interface KeyValueProperty extends PropBase { - type: "KeyValueProperty"; - - value: Expression; -} - -export interface AssignmentProperty extends Node { - type: "AssignmentProperty"; - - key: Identifier; - value: Expression; -} - -export interface GetterProperty extends PropBase, HasSpan { - type: "GetterProperty"; - - typeAnnotation?: TsTypeAnnotation; - - body?: BlockStatement; -} - -export interface SetterProperty extends PropBase, HasSpan { - type: "SetterProperty"; - - param: Pattern; - body?: BlockStatement; -} - -export interface MethodProperty extends PropBase, Fn { - type: "MethodProperty"; -} - -export type PropertyName = - | Identifier - | StringLiteral - | NumericLiteral - | ComputedPropName - | BigIntLiteral; - -export interface ComputedPropName extends Node, HasSpan { - type: "Computed"; - expression: Expression; -} - -export interface BlockStatement extends Node, HasSpan { - type: "BlockStatement"; - - stmts: Statement[]; -} - -export interface ExpressionStatement extends Node, HasSpan { - type: "ExpressionStatement"; - expression: Expression; -} - -export type Statement = - | BlockStatement - | EmptyStatement - | DebuggerStatement - | WithStatement - | ReturnStatement - | LabeledStatement - | BreakStatement - | ContinueStatement - | IfStatement - | SwitchStatement - | ThrowStatement - | TryStatement - | WhileStatement - | DoWhileStatement - | ForStatement - | ForInStatement - | ForOfStatement - | Declaration - | ExpressionStatement; - -export interface EmptyStatement extends Node, HasSpan { - type: "EmptyStatement"; -} - -export interface DebuggerStatement extends Node, HasSpan { - type: "DebuggerStatement"; -} - -export interface WithStatement extends Node, HasSpan { - type: "WithStatement"; - - object: Expression; - body: Statement; -} - -export interface ReturnStatement extends Node, HasSpan { - type: "ReturnStatement"; - - argument?: Expression; -} - -export interface LabeledStatement extends Node, HasSpan { - type: "LabeledStatement"; - - label: Identifier; - body: Statement; -} - -export interface BreakStatement extends Node, HasSpan { - type: "BreakStatement"; - - label?: Identifier; -} - -export interface ContinueStatement extends Node, HasSpan { - type: "ContinueStatement"; - - label?: Identifier; -} - -export interface IfStatement extends Node, HasSpan { - type: "IfStatement"; - - test: Expression; - consequent: Statement; - alternate?: Statement; -} - -export interface SwitchStatement extends Node, HasSpan { - type: "SwitchStatement"; - - discriminant: Expression; - cases: SwitchCase[]; -} - -export interface ThrowStatement extends Node, HasSpan { - type: "ThrowStatement"; - - argument: Expression; -} - -export interface TryStatement extends Node, HasSpan { - type: "TryStatement"; - - block: BlockStatement; - handler?: CatchClause; - finalizer?: BlockStatement; -} - -export interface WhileStatement extends Node, HasSpan { - type: "WhileStatement"; - - test: Expression; - body: Statement; -} - -export interface DoWhileStatement extends Node, HasSpan { - type: "DoWhileStatement"; - - test: Expression; - body: Statement; -} - -export interface ForStatement extends Node, HasSpan { - type: "ForStatement"; - - init?: VariableDeclaration | Expression; - test?: Expression; - update?: Expression; - body: Statement; -} - -export interface ForInStatement extends Node, HasSpan { - type: "ForInStatement"; - - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; -} - -export interface ForOfStatement extends Node, HasSpan { - type: "ForOfStatement"; - - /** - * Span of the await token. - * - * es2018 for-await-of statements, e.g., `for await (const x of xs) {` - */ - await?: Span; - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; -} - -export interface SwitchCase extends Node, HasSpan { - type: "SwitchCase"; - - /** - * Undefined for default case - */ - test?: Expression; - consequent: Statement[]; -} - -export interface CatchClause extends Node, HasSpan { - type: "CatchClause"; - - /** - * The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}` - */ - param?: Pattern; - body: BlockStatement; -} - -export interface TsTypeAnnotation extends Node, HasSpan { - type: "TsTypeAnnotation"; - - typeAnnotation: TsType; -} - -export interface TsTypeParameterDeclaration extends Node, HasSpan { - type: "TsTypeParameterDeclaration"; - - parameters: TsTypeParameter[]; -} - -export interface TsTypeParameter extends Node, HasSpan { - type: "TsTypeParameter"; - - name: Identifier; - in: boolean; - out: boolean; - constraint?: TsType; - default?: TsType; -} - -export interface TsTypeParameterInstantiation extends Node, HasSpan { - type: "TsTypeParameterInstantiation"; - - params: TsType[]; -} - -export interface TsParameterProperty extends Node, HasSpan, HasDecorator { - type: "TsParameterProperty"; - - accessibility?: Accessibility; - override: boolean; - readonly: boolean; - param: TsParameterPropertyParameter; -} - -export type TsParameterPropertyParameter = - | BindingIdentifier - | AssignmentPattern; - -export interface TsQualifiedName extends Node { - type: "TsQualifiedName"; - - left: TsEntityName; - right: Identifier; -} - -export type TsEntityName = TsQualifiedName | Identifier; - -export type TsTypeElement = - | TsCallSignatureDeclaration - | TsConstructSignatureDeclaration - | TsPropertySignature - | TsGetterSignature - | TsSetterSignature - | TsMethodSignature - | TsIndexSignature; - -export interface TsCallSignatureDeclaration extends Node, HasSpan { - type: "TsCallSignatureDeclaration"; - - params: TsFnParameter[]; - typeAnnotation?: TsTypeAnnotation; - typeParams?: TsTypeParameterDeclaration; -} - -export interface TsConstructSignatureDeclaration extends Node, HasSpan { - type: "TsConstructSignatureDeclaration"; - - params: TsFnParameter[]; - typeAnnotation?: TsTypeAnnotation; - typeParams?: TsTypeParameterDeclaration; -} - -export interface TsPropertySignature extends Node, HasSpan { - type: "TsPropertySignature"; - - readonly: boolean; - key: Expression; - computed: boolean; - optional: boolean; - - init?: Expression; - params: TsFnParameter[]; - - typeAnnotation?: TsTypeAnnotation; - typeParams?: TsTypeParameterDeclaration; -} - -export interface TsGetterSignature extends Node, HasSpan { - type: "TsGetterSignature"; - - readonly: boolean; - key: Expression; - computed: boolean; - optional: boolean; - typeAnnotation?: TsTypeAnnotation; -} - -export interface TsSetterSignature extends Node, HasSpan { - type: "TsSetterSignature"; - - readonly: boolean; - key: Expression; - computed: boolean; - optional: boolean; - param: TsFnParameter; -} - -export interface TsMethodSignature extends Node, HasSpan { - type: "TsMethodSignature"; - - readonly: boolean; - key: Expression; - computed: boolean; - optional: boolean; - params: TsFnParameter[]; - - typeAnn?: TsTypeAnnotation; - typeParams?: TsTypeParameterDeclaration; -} - -export interface TsIndexSignature extends Node, HasSpan { - type: "TsIndexSignature"; - - params: TsFnParameter[]; - - typeAnnotation?: TsTypeAnnotation; - - readonly: boolean; - static: boolean; -} - -export type TsType = - | TsKeywordType - | TsThisType - | TsFnOrConstructorType - | TsTypeReference - | TsTypeQuery - | TsTypeLiteral - | TsArrayType - | TsTupleType - | TsOptionalType - | TsRestType - | TsUnionOrIntersectionType - | TsConditionalType - | TsInferType - | TsParenthesizedType - | TsTypeOperator - | TsIndexedAccessType - | TsMappedType - | TsLiteralType - | TsTypePredicate - | TsImportType; - -export type TsFnOrConstructorType = TsFunctionType | TsConstructorType; - -export interface TsKeywordType extends Node, HasSpan { - type: "TsKeywordType"; - - kind: TsKeywordTypeKind; -} - -export type TsKeywordTypeKind = - | "any" - | "unknown" - | "number" - | "object" - | "boolean" - | "bigint" - | "string" - | "symbol" - | "void" - | "undefined" - | "null" - | "never" - | "intrinsic"; - -export interface TsThisType extends Node, HasSpan { - type: "TsThisType"; -} - -export type TsFnParameter = - | BindingIdentifier - | ArrayPattern - | RestElement - | ObjectPattern; - -export interface TsFunctionType extends Node, HasSpan { - type: "TsFunctionType"; - - params: TsFnParameter[]; - - typeParams?: TsTypeParameterDeclaration; - typeAnnotation: TsTypeAnnotation; -} - -export interface TsConstructorType extends Node, HasSpan { - type: "TsConstructorType"; - - params: TsFnParameter[]; - - typeParams?: TsTypeParameterDeclaration; - typeAnnotation: TsTypeAnnotation; - isAbstract: boolean; -} - -export interface TsTypeReference extends Node, HasSpan { - type: "TsTypeReference"; - - typeName: TsEntityName; - typeParams?: TsTypeParameterInstantiation; -} - -export interface TsTypePredicate extends Node, HasSpan { - type: "TsTypePredicate"; - - asserts: boolean; - - paramName: TsThisTypeOrIdent; - typeAnnotation?: TsTypeAnnotation; -} - -export type TsThisTypeOrIdent = TsThisType | Identifier; - -export interface TsImportType extends Node, HasSpan { - type: "TsImportType"; - - argument: StringLiteral; - qualifier?: TsEntityName; - typeArguments?: TsTypeParameterInstantiation; -} - -/** - * `typeof` operator - */ -export interface TsTypeQuery extends Node, HasSpan { - type: "TsTypeQuery"; - - exprName: TsTypeQueryExpr; - typeArguments?: TsTypeParameterInstantiation; -} - -export type TsTypeQueryExpr = TsEntityName | TsImportType; - -export interface TsTypeLiteral extends Node, HasSpan { - type: "TsTypeLiteral"; - - members: TsTypeElement[]; -} - -export interface TsArrayType extends Node, HasSpan { - type: "TsArrayType"; - - elemType: TsType; -} - -export interface TsTupleType extends Node, HasSpan { - type: "TsTupleType"; - - elemTypes: TsTupleElement[]; -} - -export interface TsTupleElement extends Node, HasSpan { - type: "TsTupleElement"; - - label?: Pattern; - ty: TsType; -} - -export interface TsOptionalType extends Node, HasSpan { - type: "TsOptionalType"; - - typeAnnotation: TsType; -} - -export interface TsRestType extends Node, HasSpan { - type: "TsRestType"; - - typeAnnotation: TsType; -} - -export type TsUnionOrIntersectionType = TsUnionType | TsIntersectionType; - -export interface TsUnionType extends Node, HasSpan { - type: "TsUnionType"; - - types: TsType[]; -} - -export interface TsIntersectionType extends Node, HasSpan { - type: "TsIntersectionType"; - - types: TsType[]; -} - -export interface TsConditionalType extends Node, HasSpan { - type: "TsConditionalType"; - - checkType: TsType; - extendsType: TsType; - trueType: TsType; - falseType: TsType; -} - -export interface TsInferType extends Node, HasSpan { - type: "TsInferType"; - - typeParam: TsTypeParameter; -} - -export interface TsParenthesizedType extends Node, HasSpan { - type: "TsParenthesizedType"; - - typeAnnotation: TsType; -} - -export interface TsTypeOperator extends Node, HasSpan { - type: "TsTypeOperator"; - - op: TsTypeOperatorOp; - typeAnnotation: TsType; -} - -export type TsTypeOperatorOp = "keyof" | "unique" | "readonly"; - -export interface TsIndexedAccessType extends Node, HasSpan { - type: "TsIndexedAccessType"; - - readonly: boolean; - objectType: TsType; - indexType: TsType; -} - -export type TruePlusMinus = true | "+" | "-"; - -export interface TsMappedType extends Node, HasSpan { - type: "TsMappedType"; - - readonly?: TruePlusMinus; - typeParam: TsTypeParameter; - nameType?: TsType; - optional?: TruePlusMinus; - typeAnnotation?: TsType; -} - -export interface TsLiteralType extends Node, HasSpan { - type: "TsLiteralType"; - - literal: TsLiteral; -} - -export type TsLiteral = - | NumericLiteral - | StringLiteral - | BooleanLiteral - | BigIntLiteral - | TsTemplateLiteralType; - -export interface TsTemplateLiteralType extends Node, HasSpan { - type: "TemplateLiteral"; - types: TsType[]; - quasis: TemplateElement[]; -} - -// // ================ -// // TypeScript declarations -// // ================ - -export interface TsInterfaceDeclaration extends Node, HasSpan { - type: "TsInterfaceDeclaration"; - - id: Identifier; - declare: boolean; - typeParams?: TsTypeParameterDeclaration; - extends: TsExpressionWithTypeArguments[]; - body: TsInterfaceBody; -} - -export interface TsInterfaceBody extends Node, HasSpan { - type: "TsInterfaceBody"; - - body: TsTypeElement[]; -} - -export interface TsExpressionWithTypeArguments extends Node, HasSpan { - type: "TsExpressionWithTypeArguments"; - - expression: Expression; - typeArguments?: TsTypeParameterInstantiation; -} - -export interface TsTypeAliasDeclaration extends Node, HasSpan { - type: "TsTypeAliasDeclaration"; - - declare: boolean; - id: Identifier; - typeParams?: TsTypeParameterDeclaration; - typeAnnotation: TsType; -} - -export interface TsEnumDeclaration extends Node, HasSpan { - type: "TsEnumDeclaration"; - - declare: boolean; - isConst: boolean; - id: Identifier; - members: TsEnumMember[]; -} - -export interface TsEnumMember extends Node, HasSpan { - type: "TsEnumMember"; - - id: TsEnumMemberId; - init?: Expression; -} - -export type TsEnumMemberId = Identifier | StringLiteral; - -export interface TsModuleDeclaration extends Node, HasSpan { - type: "TsModuleDeclaration"; - - declare: boolean; - global: boolean; - id: TsModuleName; - body?: TsNamespaceBody; -} - -/** - * `namespace A.B { }` is a namespace named `A` with another TsNamespaceDecl as its body. - */ -export type TsNamespaceBody = TsModuleBlock | TsNamespaceDeclaration; - -export interface TsModuleBlock extends Node, HasSpan { - type: "TsModuleBlock"; - - body: ModuleItem[]; -} - -export interface TsNamespaceDeclaration extends Node, HasSpan { - type: "TsNamespaceDeclaration"; - - declare: boolean; - global: boolean; - id: Identifier; - body: TsNamespaceBody; -} - -export type TsModuleName = Identifier | StringLiteral; - -export interface TsImportEqualsDeclaration extends Node, HasSpan { - type: "TsImportEqualsDeclaration"; - - declare: boolean; - isExport: boolean; - isTypeOnly: boolean; - id: Identifier; - moduleRef: TsModuleReference; -} - -export type TsModuleReference = TsEntityName | TsExternalModuleReference; - -export interface TsExternalModuleReference extends Node, HasSpan { - type: "TsExternalModuleReference"; - - expression: StringLiteral; -} - -export interface TsExportAssignment extends Node, HasSpan { - type: "TsExportAssignment"; - - expression: Expression; -} - -export interface TsNamespaceExportDeclaration extends Node, HasSpan { - type: "TsNamespaceExportDeclaration"; - - id: Identifier; -} - -export interface TsAsExpression extends ExpressionBase { - type: "TsAsExpression"; - - expression: Expression; - typeAnnotation: TsType; -} - -export interface TsSatisfiesExpression extends ExpressionBase { - type: "TsSatisfiesExpression"; - - expression: Expression; - typeAnnotation: TsType; -} - -export interface TsInstantiation extends Node, HasSpan { - type: "TsInstantiation"; - - expression: Expression; - typeArguments: TsTypeParameterInstantiation; -} - -export interface TsTypeAssertion extends ExpressionBase { - type: "TsTypeAssertion"; - - expression: Expression; - typeAnnotation: TsType; -} - -export interface TsConstAssertion extends ExpressionBase { - type: "TsConstAssertion"; - - expression: Expression; -} - -export interface TsNonNullExpression extends ExpressionBase { - type: "TsNonNullExpression"; - - expression: Expression; -} - -export type Accessibility = "public" | "protected" | "private"; - -export interface Invalid extends Node, HasSpan { - type: "Invalid"; -} diff --git a/package.json b/package.json index 46d4965be0e..03128213014 100644 --- a/package.json +++ b/package.json @@ -176,5 +176,8 @@ "postinstall.js", "bindings/binding_core_wasm/pkg/binding_core_wasm.d.ts" ], - "packageManager": "yarn@3.5.0" + "packageManager": "yarn@3.5.0", + "dependencies": { + "@swc/types": "^0.1.3" + } } diff --git a/packages/package.json b/packages/package.json new file mode 100644 index 00000000000..b73d64c5281 --- /dev/null +++ b/packages/package.json @@ -0,0 +1,8 @@ +{ + "name": "@swc/workspace", + "private": true, + "workspaces": [ + "./*" + ], + "packageManager": "yarn@3.2.3" +} diff --git a/packages/types/.gitignore b/packages/types/.gitignore new file mode 100644 index 00000000000..116dc3469fa --- /dev/null +++ b/packages/types/.gitignore @@ -0,0 +1,18 @@ +target/ +native/index.node +native/artifacts.json +**/*~ +**/node_modules +**/.DS_Store + +pkg/ + +yarn.lock +package-lock.json +*.log +.idea/ + +# Built files +/*.js +/*.d.ts +/*.map \ No newline at end of file diff --git a/packages/types/.npmignore b/packages/types/.npmignore new file mode 100644 index 00000000000..f1a308f015f --- /dev/null +++ b/packages/types/.npmignore @@ -0,0 +1,12 @@ +native/target +native/index.node +native/artifacts.json +**/*~ +**/node_modules +**/.DS_Store + +yarn.lock +package-lock.json +*.log +.idea/ +wasm/ \ No newline at end of file diff --git a/packages/types/LICENSE b/packages/types/LICENSE new file mode 100644 index 00000000000..f8e5e5ea034 --- /dev/null +++ b/packages/types/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/packages/types/README.md b/packages/types/README.md new file mode 100644 index 00000000000..dc14caece20 --- /dev/null +++ b/packages/types/README.md @@ -0,0 +1,4 @@ +# @swc/types + +Typings for `@swc/core` APIs. This is a separate package because SWC is used by various tools but not all of them want to depend on `@swc/core`. +This package is very cheap, so feel free to depend on this. diff --git a/packages/types/index.ts b/packages/types/index.ts new file mode 100644 index 00000000000..137b9c97b7c --- /dev/null +++ b/packages/types/index.ts @@ -0,0 +1,2771 @@ +export interface Plugin { + (module: Program): Program; +} + +// TODO: +export type ParseOptions = ParserConfig & { + comments?: boolean; + script?: boolean; + /** + * Defaults to es3. + */ + target?: JscTarget; +}; + +export type TerserEcmaVersion = 5 | 2015 | 2016 | string | number; + +export interface JsMinifyOptions { + compress?: TerserCompressOptions | boolean; + + format?: JsFormatOptions & ToSnakeCaseProperties; + + mangle?: TerserMangleOptions | boolean; + + ecma?: TerserEcmaVersion; + + keep_classnames?: boolean; + + keep_fnames?: boolean; + + module?: boolean; + + safari10?: boolean; + + toplevel?: boolean; + + sourceMap?: boolean; + + outputPath?: string; + + inlineSourcesContent?: boolean; +} + +/** + * @example ToSnakeCase<'indentLevel'> == 'indent_level' + */ +type ToSnakeCase = T extends `${infer A}${infer B}` + ? `${A extends Lowercase ? A : `_${Lowercase}`}${ToSnakeCase}` + : T; + +/** + * @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3} + */ +type ToSnakeCaseProperties = { + [K in keyof T as K extends string ? ToSnakeCase : K]: T[K]; +}; + +/** + * These properties are mostly not implemented yet, + * but it exists to support passing terser config to swc minify + * without modification. + */ +export interface JsFormatOptions { + /** + * Currently noop. + * @default false + * @alias ascii_only + */ + asciiOnly?: boolean; + + /** + * Currently noop. + * @default false + */ + beautify?: boolean; + + /** + * Currently noop. + * @default false + */ + braces?: boolean; + + /** + * - `false`: removes all comments + * - `'some'`: preserves some comments + * - `'all'`: preserves all comments + * @default false + */ + comments?: false | "some" | "all"; + + /** + * Currently noop. + * @default 5 + */ + ecma?: TerserEcmaVersion; + + /** + * Currently noop. + * @alias indent_level + */ + indentLevel?: number; + + /** + * Currently noop. + * @alias indent_start + */ + indentStart?: number; + + /** + * Currently noop. + * @alias inline_script + */ + inlineScript?: number; + + /** + * Currently noop. + * @alias keep_numbers + */ + keepNumbers?: number; + + /** + * Currently noop. + * @alias keep_quoted_props + */ + keepQuotedProps?: boolean; + + /** + * Currently noop. + * @alias max_line_len + */ + maxLineLen?: number | false; + + /** + * Currently noop. + */ + preamble?: string; + + /** + * Currently noop. + * @alias quote_keys + */ + quoteKeys?: boolean; + + /** + * Currently noop. + * @alias quote_style + */ + quoteStyle?: boolean; + + /** + * Currently noop. + * @alias preserve_annotations + */ + preserveAnnotations?: boolean; + + /** + * Currently noop. + */ + safari10?: boolean; + + /** + * Currently noop. + */ + semicolons?: boolean; + + /** + * Currently noop. + */ + shebang?: boolean; + + /** + * Currently noop. + */ + webkit?: boolean; + + /** + * Currently noop. + * @alias wrap_iife + */ + wrapIife?: boolean; + + /** + * Currently noop. + * @alias wrap_func_args + */ + wrapFuncArgs?: boolean; +} + +export interface TerserCompressOptions { + arguments?: boolean; + arrows?: boolean; + + booleans?: boolean; + + booleans_as_integers?: boolean; + + collapse_vars?: boolean; + + comparisons?: boolean; + + computed_props?: boolean; + + conditionals?: boolean; + + dead_code?: boolean; + + defaults?: boolean; + + directives?: boolean; + + drop_console?: boolean; + + drop_debugger?: boolean; + + ecma?: TerserEcmaVersion; + + evaluate?: boolean; + + expression?: boolean; + + global_defs?: any; + + hoist_funs?: boolean; + + hoist_props?: boolean; + + hoist_vars?: boolean; + + ie8?: boolean; + + if_return?: boolean; + + inline?: 0 | 1 | 2 | 3; + + join_vars?: boolean; + + keep_classnames?: boolean; + + keep_fargs?: boolean; + + keep_fnames?: boolean; + + keep_infinity?: boolean; + + loops?: boolean; + // module : false, + + negate_iife?: boolean; + + passes?: number; + + properties?: boolean; + + pure_getters?: any; + + pure_funcs?: string[]; + + reduce_funcs?: boolean; + + reduce_vars?: boolean; + + sequences?: any; + + side_effects?: boolean; + + switches?: boolean; + + top_retain?: any; + + toplevel?: any; + + typeofs?: boolean; + + unsafe?: boolean; + + unsafe_passes?: boolean; + + unsafe_arrows?: boolean; + + unsafe_comps?: boolean; + + unsafe_function?: boolean; + + unsafe_math?: boolean; + + unsafe_symbols?: boolean; + + unsafe_methods?: boolean; + + unsafe_proto?: boolean; + + unsafe_regexp?: boolean; + + unsafe_undefined?: boolean; + + unused?: boolean; + + const_to_let?: boolean; + + module?: boolean; +} + +export interface TerserMangleOptions { + props?: TerserManglePropertiesOptions; + + toplevel?: boolean; + + keep_classnames?: boolean; + + keep_fnames?: boolean; + + keep_private_props?: boolean; + + ie8?: boolean; + + safari10?: boolean; + + reserved?: string[]; +} + +export interface TerserManglePropertiesOptions {} + +/** + * Programmatic options. + */ +export interface Options extends Config { + /** + * If true, a file is parsed as a script instead of module. + */ + script?: boolean; + + /** + * The working directory that all paths in the programmatic + * options will be resolved relative to. + * + * Defaults to `process.cwd()`. + */ + cwd?: string; + caller?: CallerOptions; + /** The filename associated with the code currently being compiled, + * if there is one. The filename is optional, but not all of Swc's + * functionality is available when the filename is unknown, because a + * subset of options rely on the filename for their functionality. + * + * The three primary cases users could run into are: + * + * - The filename is exposed to plugins. Some plugins may require the + * presence of the filename. + * - Options like "test", "exclude", and "ignore" require the filename + * for string/RegExp matching. + * - .swcrc files are loaded relative to the file being compiled. + * If this option is omitted, Swc will behave as if swcrc: false has been set. + */ + filename?: string; + + /** + * The initial path that will be processed based on the "rootMode" to + * determine the conceptual root folder for the current Swc project. + * This is used in two primary cases: + * + * - The base directory when checking for the default "configFile" value + * - The default value for "swcrcRoots". + * + * Defaults to `opts.cwd` + */ + root?: string; + + /** + * This option, combined with the "root" value, defines how Swc chooses + * its project root. The different modes define different ways that Swc + * can process the "root" value to get the final project root. + * + * "root" - Passes the "root" value through as unchanged. + * "upward" - Walks upward from the "root" directory, looking for a directory + * containing a swc.config.js file, and throws an error if a swc.config.js + * is not found. + * "upward-optional" - Walk upward from the "root" directory, looking for + * a directory containing a swc.config.js file, and falls back to "root" + * if a swc.config.js is not found. + * + * + * "root" is the default mode because it avoids the risk that Swc + * will accidentally load a swc.config.js that is entirely outside + * of the current project folder. If you use "upward-optional", + * be aware that it will walk up the directory structure all the + * way to the filesystem root, and it is always possible that someone + * will have a forgotten swc.config.js in their home directory, + * which could cause unexpected errors in your builds. + * + * + * Users with monorepo project structures that run builds/tests on a + * per-package basis may well want to use "upward" since monorepos + * often have a swc.config.js in the project root. Running Swc + * in a monorepo subdirectory without "upward", will cause Swc + * to skip loading any swc.config.js files in the project root, + * which can lead to unexpected errors and compilation failure. + */ + rootMode?: "root" | "upward" | "upward-optional"; + + /** + * The current active environment used during configuration loading. + * This value is used as the key when resolving "env" configs, + * and is also available inside configuration functions, plugins, + * and presets, via the api.env() function. + * + * Defaults to `process.env.SWC_ENV || process.env.NODE_ENV || "development"` + */ + envName?: string; + + /** + * Defaults to searching for a default `.swcrc` file, but can + * be passed the path of any JS or JSON5 config file. + * + * + * NOTE: This option does not affect loading of .swcrc files, + * so while it may be tempting to do configFile: "./foo/.swcrc", + * it is not recommended. If the given .swcrc is loaded via the + * standard file-relative logic, you'll end up loading the same + * config file twice, merging it with itself. If you are linking + * a specific config file, it is recommended to stick with a + * naming scheme that is independent of the "swcrc" name. + * + * Defaults to `path.resolve(opts.root, ".swcrc")` + */ + configFile?: string | boolean; + + /** + * true will enable searching for configuration files relative to the "filename" provided to Swc. + * + * A swcrc value passed in the programmatic options will override one set within a configuration file. + * + * Note: .swcrc files are only loaded if the current "filename" is inside of + * a package that matches one of the "swcrcRoots" packages. + * + * + * Defaults to true as long as the filename option has been specified + */ + swcrc?: boolean; + + /** + * By default, Babel will only search for .babelrc files within the "root" package + * because otherwise Babel cannot know if a given .babelrc is meant to be loaded, + * or if it's "plugins" and "presets" have even been installed, since the file + * being compiled could be inside node_modules, or have been symlinked into the project. + * + * + * This option allows users to provide a list of other packages that should be + * considered "root" packages when considering whether to load .babelrc files. + * + * + * For example, a monorepo setup that wishes to allow individual packages + * to have their own configs might want to do + * + * + * + * Defaults to `opts.root` + */ + swcrcRoots?: boolean | MatchPattern | MatchPattern[]; + + /** + * `true` will attempt to load an input sourcemap from the file itself, if it + * contains a //# sourceMappingURL=... comment. If no map is found, or the + * map fails to load and parse, it will be silently discarded. + * + * If an object is provided, it will be treated as the source map object itself. + * + * Defaults to `true`. + */ + inputSourceMap?: boolean | string; + + /** + * The name to use for the file inside the source map object. + * + * Defaults to `path.basename(opts.filenameRelative)` when available, or `"unknown"`. + */ + sourceFileName?: string; + + /** + * The sourceRoot fields to set in the generated source map, if one is desired. + */ + sourceRoot?: string; + + plugin?: Plugin; + + isModule?: boolean | "unknown"; + + /** + * Destination path. Note that this value is used only to fix source path + * of source map files and swc does not write output to this path. + */ + outputPath?: string; +} + +export interface CallerOptions { + name: string; + [key: string]: any; +} + +export type Swcrc = Config | Config[]; + +/** + * .swcrc + */ +export interface Config { + /** + * Note: The type is string because it follows rust's regex syntax. + */ + test?: string | string[]; + /** + * Note: The type is string because it follows rust's regex syntax. + */ + exclude?: string | string[]; + env?: EnvConfig; + jsc?: JscConfig; + module?: ModuleConfig; + minify?: boolean; + + /** + * - true to generate a sourcemap for the code and include it in the result object. + * - "inline" to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object. + * + * `swc-cli` overloads some of these to also affect how maps are written to disk: + * + * - true will write the map to a .map file on disk + * - "inline" will write the file directly, so it will have a data: containing the map + * - Note: These options are bit weird, so it may make the most sense to just use true + * and handle the rest in your own code, depending on your use case. + */ + sourceMaps?: boolean | "inline"; + + inlineSourcesContent?: boolean; +} + +/** + * Configuration ported from babel-preset-env + */ +export interface EnvConfig { + mode?: "usage" | "entry"; + debug?: boolean; + dynamicImport?: boolean; + + loose?: boolean; + + /// Skipped es features. + /// + /// e.g.) + /// - `core-js/modules/foo` + skip?: string[]; + + include?: string[]; + + exclude?: string[]; + + /** + * The version of the used core js. + * + */ + coreJs?: string; + + targets?: any; + + path?: string; + + shippedProposals?: boolean; + + /** + * Enable all transforms + */ + forceAllTransforms?: boolean; +} + +export interface JscConfig { + loose?: boolean; + + /** + * Defaults to EsParserConfig + */ + parser?: ParserConfig; + transform?: TransformConfig; + /** + * Use `@swc/helpers` instead of inline helpers. + */ + externalHelpers?: boolean; + + /** + * Defaults to `es3` (which enabled **all** pass). + */ + target?: JscTarget; + + /** + * Keep class names. + */ + keepClassNames?: boolean; + + experimental?: { + optimizeHygiene?: boolean; + keepImportAssertions?: boolean; + /** + * Specify the location where SWC stores its intermediate cache files. + * Currently only transform plugin uses this. If not specified, SWC will + * create `.swc` directories. + */ + cacheRoot?: string; + /** + * List of custom transform plugins written in WebAssembly. + * First parameter of tuple indicates the name of the plugin - it can be either + * a name of the npm package can be resolved, or absolute path to .wasm binary. + * + * Second parameter of tuple is JSON based configuration for the plugin. + */ + plugins?: Array<[string, Record]>; + }; + + baseUrl?: string; + + paths?: { + [from: string]: string[]; + }; + + minify?: JsMinifyOptions; + + preserveAllComments?: boolean; +} + +export type JscTarget = + | "es3" + | "es5" + | "es2015" + | "es2016" + | "es2017" + | "es2018" + | "es2019" + | "es2020" + | "es2021" + | "es2022" + | "esnext"; + +export type ParserConfig = TsParserConfig | EsParserConfig; +export interface TsParserConfig { + syntax: "typescript"; + /** + * Defaults to `false`. + */ + tsx?: boolean; + /** + * Defaults to `false`. + */ + decorators?: boolean; + /** + * Defaults to `false` + */ + dynamicImport?: boolean; +} + +export interface EsParserConfig { + syntax: "ecmascript"; + /** + * Defaults to false. + */ + jsx?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + numericSeparator?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + classPrivateProperty?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + privateMethod?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + classProperty?: boolean; + /** + * Defaults to `false` + */ + functionBind?: boolean; + /** + * Defaults to `false` + */ + decorators?: boolean; + /** + * Defaults to `false` + */ + decoratorsBeforeExport?: boolean; + /** + * Defaults to `false` + */ + exportDefaultFrom?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + exportNamespaceFrom?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + dynamicImport?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + nullishCoalescing?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + optionalChaining?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + importMeta?: boolean; + /** + * @deprecated Always true because it's in ecmascript spec. + */ + topLevelAwait?: boolean; + /** + * Defaults to `false` + */ + importAssertions?: boolean; +} + +/** + * Options for transform. + */ +export interface TransformConfig { + /** + * Effective only if `syntax` supports ƒ. + */ + react?: ReactConfig; + + constModules?: ConstModulesConfig; + + /** + * Defaults to null, which skips optimizer pass. + */ + optimizer?: OptimizerConfig; + + /** + * https://swc.rs/docs/configuring-swc.html#jsctransformlegacydecorator + */ + legacyDecorator?: boolean; + + /** + * https://swc.rs/docs/configuring-swc.html#jsctransformdecoratormetadata + */ + decoratorMetadata?: boolean; + + treatConstEnumAsEnum?: boolean; + + useDefineForClassFields?: boolean; +} + +export interface ReactConfig { + /** + * Replace the function used when compiling JSX expressions. + * + * Defaults to `React.createElement`. + */ + pragma?: string; + /** + * Replace the component used when compiling JSX fragments. + * + * Defaults to `React.Fragment` + */ + pragmaFrag?: string; + /** + * Toggles whether or not to throw an error if a XML namespaced tag name is used. For example: + * `` + * + * Though the JSX spec allows this, it is disabled by default since React's + * JSX does not currently have support for it. + * + */ + throwIfNamespace?: boolean; + /** + * Toggles plugins that aid in development, such as @swc/plugin-transform-react-jsx-self + * and @swc/plugin-transform-react-jsx-source. + * + * Defaults to `false`, + * + */ + development?: boolean; + /** + * Use `Object.assign()` instead of `_extends`. Defaults to false. + * @deprecated + */ + useBuiltins?: boolean; + + /** + * Enable fast refresh feature for React app + */ + refresh?: boolean; + + /** + * jsx runtime + */ + runtime?: "automatic" | "classic"; + + /** + * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic' + */ + importSource?: string; +} +/** + * - `import { DEBUG } from '@ember/env-flags';` + * - `import { FEATURE_A, FEATURE_B } from '@ember/features';` + * + * See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558 + */ +export interface ConstModulesConfig { + globals?: { + [module: string]: { + [name: string]: string; + }; + }; +} + +/// https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerjsonify +export interface OptimizerConfig { + /// https://swc.rs/docs/configuration/compilation#jsctransformoptimizersimplify + simplify?: boolean; + /// https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerglobals + globals?: GlobalPassOption; + /// https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerjsonify + jsonify?: { minCost: number }; +} + +/** + * Options for inline-global pass. + */ +export interface GlobalPassOption { + /** + * Global variables that should be inlined with passed value. + * + * e.g. `{ __DEBUG__: true }` + */ + vars?: Record; + + /** + * Names of environment variables that should be inlined with the value of corresponding env during build. + * + * Defaults to `["NODE_ENV", "SWC_ENV"]` + */ + envs?: string[]; + + /** + * Replaces typeof calls for passed variables with corresponding value + * + * e.g. `{ window: 'object' }` + */ + typeofs?: Record; +} + +export type ModuleConfig = + | Es6Config + | CommonJsConfig + | UmdConfig + | AmdConfig + | NodeNextConfig + | SystemjsConfig; + +export interface BaseModuleConfig { + /** + * By default, when using exports with babel a non-enumerable `__esModule` + * property is exported. In some cases this property is used to determine + * if the import is the default export or if it contains the default export. + * + * In order to prevent the __esModule property from being exported, you + * can set the strict option to true. + * + * Defaults to `false`. + */ + strict?: boolean; + + /** + * Emits 'use strict' directive. + * + * Defaults to `true`. + */ + strictMode?: boolean; + + /** + * Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time. + * + * This can improve initial load time of your module because evaluating dependencies up + * front is sometimes entirely un-necessary. This is especially the case when implementing + * a library module. + * + * + * The value of `lazy` has a few possible effects: + * + * - `false` - No lazy initialization of any imported module. + * - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies. + * + * Local paths are much more likely to have circular dependencies, which may break if loaded lazily, + * so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical. + * + * - `Array` - Lazy-initialize all imports with source matching one of the given strings. + * + * ----- + * + * The two cases where imports can never be lazy are: + * + * - `import "foo";` + * + * Side-effect imports are automatically non-lazy since their very existence means + * that there is no binding to later kick off initialization. + * + * - `export * from "foo"` + * + * Re-exporting all names requires up-front execution because otherwise there is no + * way to know what names need to be exported. + * + * Defaults to `false`. + */ + lazy?: boolean | string[]; + /** + * @deprecated Use the `importInterop` option instead. + * + * By default, when using exports with swc a non-enumerable __esModule property is exported. + * This property is then used to determine if the import is the default export or if + * it contains the default export. + * + * In cases where the auto-unwrapping of default is not needed, you can set the noInterop option + * to true to avoid the usage of the interopRequireDefault helper (shown in inline form above). + * + * Defaults to `false`. + */ + noInterop?: boolean; + /** + * Defaults to `swc`. + * + * CommonJS modules and ECMAScript modules are not fully compatible. + * However, compilers, bundlers and JavaScript runtimes developed different strategies + * to make them work together as well as possible. + * + * - `swc` (alias: `babel`) + * + * When using exports with `swc` a non-enumerable `__esModule` property is exported + * This property is then used to determine if the import is the default export + * or if it contains the default export. + * + * ```javascript + * import foo from "foo"; + * import { bar } from "bar"; + * foo; + * bar; + * + * // Is compiled to ... + * + * "use strict"; + * + * function _interop_require_default(obj) { + * return obj && obj.__esModule ? obj : { default: obj }; + * } + * + * var _foo = _interop_require_default(require("foo")); + * var _bar = require("bar"); + * + * _foo.default; + * _bar.bar; + * ``` + * + * When this import interop is used, if both the imported and the importer module are compiled + * with swc they behave as if none of them was compiled. + * + * This is the default behavior. + * + * - `node` + * + * When importing CommonJS files (either directly written in CommonJS, or generated with a compiler) + * Node.js always binds the `default` export to the value of `module.exports`. + * + * ```javascript + * import foo from "foo"; + * import { bar } from "bar"; + * foo; + * bar; + * + * // Is compiled to ... + * + * "use strict"; + * + * var _foo = require("foo"); + * var _bar = require("bar"); + * + * _foo; + * _bar.bar; + * ``` + * This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports` + * as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`. + * However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`. + * + * - `none` + * + * If you know that the imported file has been transformed with a compiler that stores the `default` export on + * `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper. + * + * ```javascript + * import foo from "foo"; + * import { bar } from "bar"; + * foo; + * bar; + * + * // Is compiled to ... + * + * "use strict"; + * + * var _foo = require("foo"); + * var _bar = require("bar"); + * + * _foo.default; + * _bar.bar; + * ``` + */ + importInterop?: "swc" | "babel" | "node" | "none"; + /** + * Emits `cjs-module-lexer` annotation + * `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM. + * swc will emit `cjs-module-lexer` detectable annotation with this option enabled. + * + * Defaults to `true` if import_interop is Node, else `false` + */ + exportInteropAnnotation?: boolean; + /** + * If set to true, dynamic imports will be preserved. + */ + ignoreDynamic?: boolean; + allowTopLevelThis?: boolean; + preserveImportMeta?: boolean; +} + +export interface Es6Config extends BaseModuleConfig { + type: "es6"; +} + +export interface NodeNextConfig extends BaseModuleConfig { + type: "nodenext"; +} + +export interface CommonJsConfig extends BaseModuleConfig { + type: "commonjs"; +} + +export interface UmdConfig extends BaseModuleConfig { + type: "umd"; + globals?: { [key: string]: string }; +} + +export interface AmdConfig extends BaseModuleConfig { + type: "amd"; + moduleId?: string; +} +export interface SystemjsConfig { + type: "systemjs"; + allowTopLevelThis?: boolean; +} +export interface Output { + /** + * Transformed code + */ + code: string; + /** + * Sourcemap (**not** base64 encoded) + */ + map?: string; +} + +export interface MatchPattern {} + +// ------------------------------- +// ---------- Ast nodes ---------- +// ------------------------------- + +export interface Span { + start: number; + end: number; + ctxt: number; +} + +export interface Node { + type: string; +} + +export interface HasSpan { + span: Span; +} + +export interface HasDecorator { + decorators?: Decorator[]; +} + +export interface Class extends HasSpan, HasDecorator { + body: ClassMember[]; + + superClass?: Expression; + + isAbstract: boolean; + + typeParams?: TsTypeParameterDeclaration; + + superTypeParams?: TsTypeParameterInstantiation; + + implements: TsExpressionWithTypeArguments[]; +} + +export type ClassMember = + | Constructor + | ClassMethod + | PrivateMethod + | ClassProperty + | PrivateProperty + | TsIndexSignature + | EmptyStatement + | StaticBlock; + +export interface ClassPropertyBase extends Node, HasSpan, HasDecorator { + value?: Expression; + + typeAnnotation?: TsTypeAnnotation; + + isStatic: boolean; + + accessibility?: Accessibility; + + isOptional: boolean; + + isOverride: boolean; + + readonly: boolean; + + definite: boolean; +} + +export interface ClassProperty extends ClassPropertyBase { + type: "ClassProperty"; + + key: PropertyName; + + isAbstract: boolean; + + declare: boolean; +} + +export interface PrivateProperty extends ClassPropertyBase { + type: "PrivateProperty"; + + key: PrivateName; +} + +export interface Param extends Node, HasSpan, HasDecorator { + type: "Parameter"; + pat: Pattern; +} + +export interface Constructor extends Node, HasSpan { + type: "Constructor"; + + key: PropertyName; + + params: (TsParameterProperty | Param)[]; + + body?: BlockStatement; + + accessibility?: Accessibility; + + isOptional: boolean; +} + +export interface ClassMethodBase extends Node, HasSpan { + function: Fn; + + kind: MethodKind; + + isStatic: boolean; + + accessibility?: Accessibility; + + isAbstract: boolean; + + isOptional: boolean; + + isOverride: boolean; +} + +export interface ClassMethod extends ClassMethodBase { + type: "ClassMethod"; + + key: PropertyName; +} + +export interface PrivateMethod extends ClassMethodBase { + type: "PrivateMethod"; + + key: PrivateName; +} + +export interface StaticBlock extends Node, HasSpan { + type: "StaticBlock"; + + body: BlockStatement; +} + +export interface Decorator extends Node, HasSpan { + type: "Decorator"; + + expression: Expression; +} + +export type MethodKind = "method" | "getter" | "setter"; + +export type Declaration = + | ClassDeclaration + | FunctionDeclaration + | VariableDeclaration + | TsInterfaceDeclaration + | TsTypeAliasDeclaration + | TsEnumDeclaration + | TsModuleDeclaration; + +export interface FunctionDeclaration extends Fn { + type: "FunctionDeclaration"; + + identifier: Identifier; + + declare: boolean; +} + +export interface ClassDeclaration extends Class, Node { + type: "ClassDeclaration"; + + identifier: Identifier; + + declare: boolean; +} + +export interface VariableDeclaration extends Node, HasSpan { + type: "VariableDeclaration"; + + kind: VariableDeclarationKind; + + declare: boolean; + + declarations: VariableDeclarator[]; +} + +export type VariableDeclarationKind = "var" | "let" | "const"; + +export interface VariableDeclarator extends Node, HasSpan { + type: "VariableDeclarator"; + + id: Pattern; + + /// Initialization expression. + init?: Expression; + + /// Typescript only + definite: boolean; +} + +export type Expression = + | ThisExpression + | ArrayExpression + | ObjectExpression + | FunctionExpression + | UnaryExpression + | UpdateExpression + | BinaryExpression + | AssignmentExpression + | MemberExpression + | SuperPropExpression + | ConditionalExpression + | CallExpression + | NewExpression + | SequenceExpression + | Identifier + | Literal + | TemplateLiteral + | TaggedTemplateExpression + | ArrowFunctionExpression + | ClassExpression + | YieldExpression + | MetaProperty + | AwaitExpression + | ParenthesisExpression + | JSXMemberExpression + | JSXNamespacedName + | JSXEmptyExpression + | JSXElement + | JSXFragment + | TsTypeAssertion + | TsConstAssertion + | TsNonNullExpression + | TsAsExpression + | TsSatisfiesExpression + | TsInstantiation + | PrivateName + | OptionalChainingExpression + | Invalid; + +interface ExpressionBase extends Node, HasSpan {} + +export interface Identifier extends ExpressionBase { + type: "Identifier"; + + value: string; + + /// TypeScript only. Used in case of an optional parameter. + optional: boolean; +} + +export interface OptionalChainingExpression extends ExpressionBase { + type: "OptionalChainingExpression"; + questionDotToken: Span; + /** + * Call expression or member expression. + */ + base: MemberExpression | OptionalChainingCall; +} + +export interface OptionalChainingCall extends ExpressionBase { + type: "CallExpression"; + callee: Expression; + arguments: ExprOrSpread[]; + typeArguments?: TsTypeParameterInstantiation; +} + +export interface ThisExpression extends ExpressionBase { + type: "ThisExpression"; +} + +export interface ArrayExpression extends ExpressionBase { + type: "ArrayExpression"; + + elements: (ExprOrSpread | undefined)[]; +} + +export interface ExprOrSpread { + spread?: Span; + expression: Expression; +} + +export interface ObjectExpression extends ExpressionBase { + type: "ObjectExpression"; + + properties: (SpreadElement | Property)[]; +} + +export interface Argument { + spread?: Span; + expression: Expression; +} + +export interface SpreadElement extends Node { + type: "SpreadElement"; + + spread: Span; + + arguments: Expression; +} + +export interface UnaryExpression extends ExpressionBase { + type: "UnaryExpression"; + + operator: UnaryOperator; + + argument: Expression; +} + +export interface UpdateExpression extends ExpressionBase { + type: "UpdateExpression"; + + operator: UpdateOperator; + + prefix: boolean; + + argument: Expression; +} + +export interface BinaryExpression extends ExpressionBase { + type: "BinaryExpression"; + + operator: BinaryOperator; + + left: Expression; + + right: Expression; +} + +export interface FunctionExpression extends Fn, ExpressionBase { + type: "FunctionExpression"; + + identifier?: Identifier; +} + +export interface ClassExpression extends Class, ExpressionBase { + type: "ClassExpression"; + + identifier?: Identifier; +} + +export interface AssignmentExpression extends ExpressionBase { + type: "AssignmentExpression"; + + operator: AssignmentOperator; + + left: Expression | Pattern; + + right: Expression; +} + +export interface MemberExpression extends ExpressionBase { + type: "MemberExpression"; + + object: Expression; + + property: Identifier | PrivateName | ComputedPropName; +} + +export interface SuperPropExpression extends ExpressionBase { + type: "SuperPropExpression"; + + obj: Super; + + property: Identifier | ComputedPropName; +} + +export interface ConditionalExpression extends ExpressionBase { + type: "ConditionalExpression"; + + test: Expression; + + consequent: Expression; + + alternate: Expression; +} + +export interface Super extends Node, HasSpan { + type: "Super"; +} + +export interface Import extends Node, HasSpan { + type: "Import"; +} + +export interface CallExpression extends ExpressionBase { + type: "CallExpression"; + + callee: Super | Import | Expression; + + arguments: Argument[]; + + typeArguments?: TsTypeParameterInstantiation; +} + +export interface NewExpression extends ExpressionBase { + type: "NewExpression"; + + callee: Expression; + + arguments?: Argument[]; + + typeArguments?: TsTypeParameterInstantiation; +} + +export interface SequenceExpression extends ExpressionBase { + type: "SequenceExpression"; + + expressions: Expression[]; +} + +export interface ArrowFunctionExpression extends ExpressionBase { + type: "ArrowFunctionExpression"; + + params: Pattern[]; + + body: BlockStatement | Expression; + + async: boolean; + + generator: boolean; + + typeParameters?: TsTypeParameterDeclaration; + + returnType?: TsTypeAnnotation; +} + +export interface YieldExpression extends ExpressionBase { + type: "YieldExpression"; + + argument?: Expression; + + delegate: boolean; +} + +export interface MetaProperty extends Node, HasSpan { + type: "MetaProperty"; + + kind: "new.target" | "import.meta"; +} + +export interface AwaitExpression extends ExpressionBase { + type: "AwaitExpression"; + + argument: Expression; +} + +export interface TemplateLiteral extends ExpressionBase { + type: "TemplateLiteral"; + + expressions: Expression[]; + + quasis: TemplateElement[]; +} + +export interface TaggedTemplateExpression extends ExpressionBase { + type: "TaggedTemplateExpression"; + + tag: Expression; + + typeParameters?: TsTypeParameterInstantiation; + + template: TemplateLiteral; +} + +export interface TemplateElement extends ExpressionBase { + type: "TemplateElement"; + + tail: boolean; + cooked?: string; + raw: string; +} + +export interface ParenthesisExpression extends ExpressionBase { + type: "ParenthesisExpression"; + + expression: Expression; +} + +export interface Fn extends HasSpan, HasDecorator { + params: Param[]; + + body?: BlockStatement; + + generator: boolean; + + async: boolean; + + typeParameters?: TsTypeParameterDeclaration; + + returnType?: TsTypeAnnotation; +} + +interface PatternBase extends Node, HasSpan { + typeAnnotation?: TsTypeAnnotation; +} + +export interface PrivateName extends ExpressionBase { + type: "PrivateName"; + + id: Identifier; +} + +export type JSXObject = JSXMemberExpression | Identifier; + +export interface JSXMemberExpression extends Node { + type: "JSXMemberExpression"; + + object: JSXObject; + property: Identifier; +} + +/** + * XML-based namespace syntax: + */ +export interface JSXNamespacedName extends Node { + type: "JSXNamespacedName"; + + namespace: Identifier; + name: Identifier; +} + +export interface JSXEmptyExpression extends Node, HasSpan { + type: "JSXEmptyExpression"; +} + +export interface JSXExpressionContainer extends Node, HasSpan { + type: "JSXExpressionContainer"; + + expression: JSXExpression; +} + +export type JSXExpression = JSXEmptyExpression | Expression; + +export interface JSXSpreadChild extends Node, HasSpan { + type: "JSXSpreadChild"; + + expression: Expression; +} + +export type JSXElementName = + | Identifier + | JSXMemberExpression + | JSXNamespacedName; + +export interface JSXOpeningElement extends Node, HasSpan { + type: "JSXOpeningElement"; + + name: JSXElementName; + + attributes: JSXAttributeOrSpread[]; + + selfClosing: boolean; + + typeArguments?: TsTypeParameterInstantiation; +} + +export type JSXAttributeOrSpread = JSXAttribute | SpreadElement; + +export interface JSXClosingElement extends Node, HasSpan { + type: "JSXClosingElement"; + + name: JSXElementName; +} + +export interface JSXAttribute extends Node, HasSpan { + type: "JSXAttribute"; + + name: JSXAttributeName; + + value?: JSXAttrValue; +} + +export type JSXAttributeName = Identifier | JSXNamespacedName; + +export type JSXAttrValue = + | Literal + | JSXExpressionContainer + | JSXElement + | JSXFragment; + +export interface JSXText extends Node, HasSpan { + type: "JSXText"; + + value: string; + raw: string; +} + +export interface JSXElement extends Node, HasSpan { + type: "JSXElement"; + + opening: JSXOpeningElement; + children: JSXElementChild[]; + closing?: JSXClosingElement; +} + +export type JSXElementChild = + | JSXText + | JSXExpressionContainer + | JSXSpreadChild + | JSXElement + | JSXFragment; + +export interface JSXFragment extends Node, HasSpan { + type: "JSXFragment"; + + opening: JSXOpeningFragment; + + children: JSXElementChild[]; + + closing: JSXClosingFragment; +} + +export interface JSXOpeningFragment extends Node, HasSpan { + type: "JSXOpeningFragment"; +} + +export interface JSXClosingFragment extends Node, HasSpan { + type: "JSXClosingFragment"; +} + +export type Literal = + | StringLiteral + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | JSXText; + +export interface StringLiteral extends Node, HasSpan { + type: "StringLiteral"; + + value: string; + + raw?: string; +} + +export interface BooleanLiteral extends Node, HasSpan { + type: "BooleanLiteral"; + + value: boolean; +} + +export interface NullLiteral extends Node, HasSpan { + type: "NullLiteral"; +} + +export interface RegExpLiteral extends Node, HasSpan { + type: "RegExpLiteral"; + + pattern: string; + flags: string; +} + +export interface NumericLiteral extends Node, HasSpan { + type: "NumericLiteral"; + + value: number; + + raw?: string; +} + +export interface BigIntLiteral extends Node, HasSpan { + type: "BigIntLiteral"; + + value: bigint; + + raw?: string; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportDeclaration + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportDefaultExpression + | ExportAllDeclaration + | TsImportEqualsDeclaration + | TsExportAssignment + | TsNamespaceExportDeclaration; + +export interface ExportDefaultExpression extends Node, HasSpan { + type: "ExportDefaultExpression"; + + expression: Expression; +} + +export interface ExportDeclaration extends Node, HasSpan { + type: "ExportDeclaration"; + + declaration: Declaration; +} + +export interface ImportDeclaration extends Node, HasSpan { + type: "ImportDeclaration"; + + specifiers: ImportSpecifier[]; + + source: StringLiteral; + + typeOnly: boolean; + + asserts?: ObjectExpression; +} + +export interface ExportAllDeclaration extends Node, HasSpan { + type: "ExportAllDeclaration"; + + source: StringLiteral; + + asserts?: ObjectExpression; +} + +/** + * - `export { foo } from 'mod'` + * - `export { foo as bar } from 'mod'` + */ +export interface ExportNamedDeclaration extends Node, HasSpan { + type: "ExportNamedDeclaration"; + + specifiers: ExportSpecifier[]; + + source?: StringLiteral; + + typeOnly: boolean; + + asserts?: ObjectExpression; +} + +export interface ExportDefaultDeclaration extends Node, HasSpan { + type: "ExportDefaultDeclaration"; + + decl: DefaultDecl; +} + +export type DefaultDecl = + | ClassExpression + | FunctionExpression + | TsInterfaceDeclaration; + +export type ImportSpecifier = + | NamedImportSpecifier + | ImportDefaultSpecifier + | ImportNamespaceSpecifier; + +/** + * e.g. `import foo from 'mod.js'` + */ +export interface ImportDefaultSpecifier extends Node, HasSpan { + type: "ImportDefaultSpecifier"; + local: Identifier; +} + +/** + * e.g. `import * as foo from 'mod.js'`. + */ +export interface ImportNamespaceSpecifier extends Node, HasSpan { + type: "ImportNamespaceSpecifier"; + + local: Identifier; +} + +/** + * e.g. - `import { foo } from 'mod.js'` + * + * local = foo, imported = None + * + * e.g. `import { foo as bar } from 'mod.js'` + * + * local = bar, imported = Some(foo) for + */ +export interface NamedImportSpecifier extends Node, HasSpan { + type: "ImportSpecifier"; + local: Identifier; + imported?: ModuleExportName; + isTypeOnly: boolean; +} + +export type ModuleExportName = Identifier | StringLiteral; + +export type ExportSpecifier = + | ExportNamespaceSpecifier + | ExportDefaultSpecifier + | NamedExportSpecifier; + +/** + * `export * as foo from 'src';` + */ +export interface ExportNamespaceSpecifier extends Node, HasSpan { + type: "ExportNamespaceSpecifier"; + + name: ModuleExportName; +} + +export interface ExportDefaultSpecifier extends Node, HasSpan { + type: "ExportDefaultSpecifier"; + + exported: Identifier; +} + +export interface NamedExportSpecifier extends Node, HasSpan { + type: "ExportSpecifier"; + + orig: ModuleExportName; + /** + * `Some(bar)` in `export { foo as bar }` + */ + exported?: ModuleExportName; + isTypeOnly: boolean; +} + +interface HasInterpreter { + /** + * e.g. `/usr/bin/node` for `#!/usr/bin/node` + */ + interpreter: string; +} + +export type Program = Module | Script; + +export interface Module extends Node, HasSpan, HasInterpreter { + type: "Module"; + + body: ModuleItem[]; +} + +export interface Script extends Node, HasSpan, HasInterpreter { + type: "Script"; + + body: Statement[]; +} + +export type ModuleItem = ModuleDeclaration | Statement; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "|" + | "^" + | "&" + | "||" + | "&&" + | "in" + | "instanceof" + | "**" + | "??"; + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "**=" + | "&&=" + | "||=" + | "??="; + +export type UpdateOperator = "++" | "--"; + +export type UnaryOperator = + | "-" + | "+" + | "!" + | "~" + | "typeof" + | "void" + | "delete"; + +export type Pattern = + | BindingIdentifier + | ArrayPattern + | RestElement + | ObjectPattern + | AssignmentPattern + | Invalid + | Expression; + +export interface BindingIdentifier extends PatternBase { + type: "Identifier"; + value: string; + optional: boolean; +} + +export interface ArrayPattern extends PatternBase { + type: "ArrayPattern"; + + elements: (Pattern | undefined)[]; + + optional: boolean; +} + +export interface ObjectPattern extends PatternBase { + type: "ObjectPattern"; + + properties: ObjectPatternProperty[]; + + optional: boolean; +} + +export interface AssignmentPattern extends PatternBase { + type: "AssignmentPattern"; + + left: Pattern; + right: Expression; +} + +export interface RestElement extends PatternBase { + type: "RestElement"; + + rest: Span; + + argument: Pattern; +} + +export type ObjectPatternProperty = + | KeyValuePatternProperty + | AssignmentPatternProperty + | RestElement; + +/** + * `{key: value}` + */ +export interface KeyValuePatternProperty extends Node { + type: "KeyValuePatternProperty"; + + key: PropertyName; + value: Pattern; +} + +/** + * `{key}` or `{key = value}` + */ +export interface AssignmentPatternProperty extends Node, HasSpan { + type: "AssignmentPatternProperty"; + + key: Identifier; + value?: Expression; +} + +/** Identifier is `a` in `{ a, }` */ +export type Property = + | Identifier + | KeyValueProperty + | AssignmentProperty + | GetterProperty + | SetterProperty + | MethodProperty; + +interface PropBase extends Node { + key: PropertyName; +} + +export interface KeyValueProperty extends PropBase { + type: "KeyValueProperty"; + + value: Expression; +} + +export interface AssignmentProperty extends Node { + type: "AssignmentProperty"; + + key: Identifier; + value: Expression; +} + +export interface GetterProperty extends PropBase, HasSpan { + type: "GetterProperty"; + + typeAnnotation?: TsTypeAnnotation; + + body?: BlockStatement; +} + +export interface SetterProperty extends PropBase, HasSpan { + type: "SetterProperty"; + + param: Pattern; + body?: BlockStatement; +} + +export interface MethodProperty extends PropBase, Fn { + type: "MethodProperty"; +} + +export type PropertyName = + | Identifier + | StringLiteral + | NumericLiteral + | ComputedPropName + | BigIntLiteral; + +export interface ComputedPropName extends Node, HasSpan { + type: "Computed"; + expression: Expression; +} + +export interface BlockStatement extends Node, HasSpan { + type: "BlockStatement"; + + stmts: Statement[]; +} + +export interface ExpressionStatement extends Node, HasSpan { + type: "ExpressionStatement"; + expression: Expression; +} + +export type Statement = + | BlockStatement + | EmptyStatement + | DebuggerStatement + | WithStatement + | ReturnStatement + | LabeledStatement + | BreakStatement + | ContinueStatement + | IfStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | DoWhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | Declaration + | ExpressionStatement; + +export interface EmptyStatement extends Node, HasSpan { + type: "EmptyStatement"; +} + +export interface DebuggerStatement extends Node, HasSpan { + type: "DebuggerStatement"; +} + +export interface WithStatement extends Node, HasSpan { + type: "WithStatement"; + + object: Expression; + body: Statement; +} + +export interface ReturnStatement extends Node, HasSpan { + type: "ReturnStatement"; + + argument?: Expression; +} + +export interface LabeledStatement extends Node, HasSpan { + type: "LabeledStatement"; + + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends Node, HasSpan { + type: "BreakStatement"; + + label?: Identifier; +} + +export interface ContinueStatement extends Node, HasSpan { + type: "ContinueStatement"; + + label?: Identifier; +} + +export interface IfStatement extends Node, HasSpan { + type: "IfStatement"; + + test: Expression; + consequent: Statement; + alternate?: Statement; +} + +export interface SwitchStatement extends Node, HasSpan { + type: "SwitchStatement"; + + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ThrowStatement extends Node, HasSpan { + type: "ThrowStatement"; + + argument: Expression; +} + +export interface TryStatement extends Node, HasSpan { + type: "TryStatement"; + + block: BlockStatement; + handler?: CatchClause; + finalizer?: BlockStatement; +} + +export interface WhileStatement extends Node, HasSpan { + type: "WhileStatement"; + + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends Node, HasSpan { + type: "DoWhileStatement"; + + test: Expression; + body: Statement; +} + +export interface ForStatement extends Node, HasSpan { + type: "ForStatement"; + + init?: VariableDeclaration | Expression; + test?: Expression; + update?: Expression; + body: Statement; +} + +export interface ForInStatement extends Node, HasSpan { + type: "ForInStatement"; + + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface ForOfStatement extends Node, HasSpan { + type: "ForOfStatement"; + + /** + * Span of the await token. + * + * es2018 for-await-of statements, e.g., `for await (const x of xs) {` + */ + await?: Span; + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface SwitchCase extends Node, HasSpan { + type: "SwitchCase"; + + /** + * Undefined for default case + */ + test?: Expression; + consequent: Statement[]; +} + +export interface CatchClause extends Node, HasSpan { + type: "CatchClause"; + + /** + * The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}` + */ + param?: Pattern; + body: BlockStatement; +} + +export interface TsTypeAnnotation extends Node, HasSpan { + type: "TsTypeAnnotation"; + + typeAnnotation: TsType; +} + +export interface TsTypeParameterDeclaration extends Node, HasSpan { + type: "TsTypeParameterDeclaration"; + + parameters: TsTypeParameter[]; +} + +export interface TsTypeParameter extends Node, HasSpan { + type: "TsTypeParameter"; + + name: Identifier; + in: boolean; + out: boolean; + constraint?: TsType; + default?: TsType; +} + +export interface TsTypeParameterInstantiation extends Node, HasSpan { + type: "TsTypeParameterInstantiation"; + + params: TsType[]; +} + +export interface TsParameterProperty extends Node, HasSpan, HasDecorator { + type: "TsParameterProperty"; + + accessibility?: Accessibility; + override: boolean; + readonly: boolean; + param: TsParameterPropertyParameter; +} + +export type TsParameterPropertyParameter = + | BindingIdentifier + | AssignmentPattern; + +export interface TsQualifiedName extends Node { + type: "TsQualifiedName"; + + left: TsEntityName; + right: Identifier; +} + +export type TsEntityName = TsQualifiedName | Identifier; + +export type TsTypeElement = + | TsCallSignatureDeclaration + | TsConstructSignatureDeclaration + | TsPropertySignature + | TsGetterSignature + | TsSetterSignature + | TsMethodSignature + | TsIndexSignature; + +export interface TsCallSignatureDeclaration extends Node, HasSpan { + type: "TsCallSignatureDeclaration"; + + params: TsFnParameter[]; + typeAnnotation?: TsTypeAnnotation; + typeParams?: TsTypeParameterDeclaration; +} + +export interface TsConstructSignatureDeclaration extends Node, HasSpan { + type: "TsConstructSignatureDeclaration"; + + params: TsFnParameter[]; + typeAnnotation?: TsTypeAnnotation; + typeParams?: TsTypeParameterDeclaration; +} + +export interface TsPropertySignature extends Node, HasSpan { + type: "TsPropertySignature"; + + readonly: boolean; + key: Expression; + computed: boolean; + optional: boolean; + + init?: Expression; + params: TsFnParameter[]; + + typeAnnotation?: TsTypeAnnotation; + typeParams?: TsTypeParameterDeclaration; +} + +export interface TsGetterSignature extends Node, HasSpan { + type: "TsGetterSignature"; + + readonly: boolean; + key: Expression; + computed: boolean; + optional: boolean; + typeAnnotation?: TsTypeAnnotation; +} + +export interface TsSetterSignature extends Node, HasSpan { + type: "TsSetterSignature"; + + readonly: boolean; + key: Expression; + computed: boolean; + optional: boolean; + param: TsFnParameter; +} + +export interface TsMethodSignature extends Node, HasSpan { + type: "TsMethodSignature"; + + readonly: boolean; + key: Expression; + computed: boolean; + optional: boolean; + params: TsFnParameter[]; + + typeAnn?: TsTypeAnnotation; + typeParams?: TsTypeParameterDeclaration; +} + +export interface TsIndexSignature extends Node, HasSpan { + type: "TsIndexSignature"; + + params: TsFnParameter[]; + + typeAnnotation?: TsTypeAnnotation; + + readonly: boolean; + static: boolean; +} + +export type TsType = + | TsKeywordType + | TsThisType + | TsFnOrConstructorType + | TsTypeReference + | TsTypeQuery + | TsTypeLiteral + | TsArrayType + | TsTupleType + | TsOptionalType + | TsRestType + | TsUnionOrIntersectionType + | TsConditionalType + | TsInferType + | TsParenthesizedType + | TsTypeOperator + | TsIndexedAccessType + | TsMappedType + | TsLiteralType + | TsTypePredicate + | TsImportType; + +export type TsFnOrConstructorType = TsFunctionType | TsConstructorType; + +export interface TsKeywordType extends Node, HasSpan { + type: "TsKeywordType"; + + kind: TsKeywordTypeKind; +} + +export type TsKeywordTypeKind = + | "any" + | "unknown" + | "number" + | "object" + | "boolean" + | "bigint" + | "string" + | "symbol" + | "void" + | "undefined" + | "null" + | "never" + | "intrinsic"; + +export interface TsThisType extends Node, HasSpan { + type: "TsThisType"; +} + +export type TsFnParameter = + | BindingIdentifier + | ArrayPattern + | RestElement + | ObjectPattern; + +export interface TsFunctionType extends Node, HasSpan { + type: "TsFunctionType"; + + params: TsFnParameter[]; + + typeParams?: TsTypeParameterDeclaration; + typeAnnotation: TsTypeAnnotation; +} + +export interface TsConstructorType extends Node, HasSpan { + type: "TsConstructorType"; + + params: TsFnParameter[]; + + typeParams?: TsTypeParameterDeclaration; + typeAnnotation: TsTypeAnnotation; + isAbstract: boolean; +} + +export interface TsTypeReference extends Node, HasSpan { + type: "TsTypeReference"; + + typeName: TsEntityName; + typeParams?: TsTypeParameterInstantiation; +} + +export interface TsTypePredicate extends Node, HasSpan { + type: "TsTypePredicate"; + + asserts: boolean; + + paramName: TsThisTypeOrIdent; + typeAnnotation?: TsTypeAnnotation; +} + +export type TsThisTypeOrIdent = TsThisType | Identifier; + +export interface TsImportType extends Node, HasSpan { + type: "TsImportType"; + + argument: StringLiteral; + qualifier?: TsEntityName; + typeArguments?: TsTypeParameterInstantiation; +} + +/** + * `typeof` operator + */ +export interface TsTypeQuery extends Node, HasSpan { + type: "TsTypeQuery"; + + exprName: TsTypeQueryExpr; + typeArguments?: TsTypeParameterInstantiation; +} + +export type TsTypeQueryExpr = TsEntityName | TsImportType; + +export interface TsTypeLiteral extends Node, HasSpan { + type: "TsTypeLiteral"; + + members: TsTypeElement[]; +} + +export interface TsArrayType extends Node, HasSpan { + type: "TsArrayType"; + + elemType: TsType; +} + +export interface TsTupleType extends Node, HasSpan { + type: "TsTupleType"; + + elemTypes: TsTupleElement[]; +} + +export interface TsTupleElement extends Node, HasSpan { + type: "TsTupleElement"; + + label?: Pattern; + ty: TsType; +} + +export interface TsOptionalType extends Node, HasSpan { + type: "TsOptionalType"; + + typeAnnotation: TsType; +} + +export interface TsRestType extends Node, HasSpan { + type: "TsRestType"; + + typeAnnotation: TsType; +} + +export type TsUnionOrIntersectionType = TsUnionType | TsIntersectionType; + +export interface TsUnionType extends Node, HasSpan { + type: "TsUnionType"; + + types: TsType[]; +} + +export interface TsIntersectionType extends Node, HasSpan { + type: "TsIntersectionType"; + + types: TsType[]; +} + +export interface TsConditionalType extends Node, HasSpan { + type: "TsConditionalType"; + + checkType: TsType; + extendsType: TsType; + trueType: TsType; + falseType: TsType; +} + +export interface TsInferType extends Node, HasSpan { + type: "TsInferType"; + + typeParam: TsTypeParameter; +} + +export interface TsParenthesizedType extends Node, HasSpan { + type: "TsParenthesizedType"; + + typeAnnotation: TsType; +} + +export interface TsTypeOperator extends Node, HasSpan { + type: "TsTypeOperator"; + + op: TsTypeOperatorOp; + typeAnnotation: TsType; +} + +export type TsTypeOperatorOp = "keyof" | "unique" | "readonly"; + +export interface TsIndexedAccessType extends Node, HasSpan { + type: "TsIndexedAccessType"; + + readonly: boolean; + objectType: TsType; + indexType: TsType; +} + +export type TruePlusMinus = true | "+" | "-"; + +export interface TsMappedType extends Node, HasSpan { + type: "TsMappedType"; + + readonly?: TruePlusMinus; + typeParam: TsTypeParameter; + nameType?: TsType; + optional?: TruePlusMinus; + typeAnnotation?: TsType; +} + +export interface TsLiteralType extends Node, HasSpan { + type: "TsLiteralType"; + + literal: TsLiteral; +} + +export type TsLiteral = + | NumericLiteral + | StringLiteral + | BooleanLiteral + | BigIntLiteral + | TsTemplateLiteralType; + +export interface TsTemplateLiteralType extends Node, HasSpan { + type: "TemplateLiteral"; + types: TsType[]; + quasis: TemplateElement[]; +} + +// // ================ +// // TypeScript declarations +// // ================ + +export interface TsInterfaceDeclaration extends Node, HasSpan { + type: "TsInterfaceDeclaration"; + + id: Identifier; + declare: boolean; + typeParams?: TsTypeParameterDeclaration; + extends: TsExpressionWithTypeArguments[]; + body: TsInterfaceBody; +} + +export interface TsInterfaceBody extends Node, HasSpan { + type: "TsInterfaceBody"; + + body: TsTypeElement[]; +} + +export interface TsExpressionWithTypeArguments extends Node, HasSpan { + type: "TsExpressionWithTypeArguments"; + + expression: Expression; + typeArguments?: TsTypeParameterInstantiation; +} + +export interface TsTypeAliasDeclaration extends Node, HasSpan { + type: "TsTypeAliasDeclaration"; + + declare: boolean; + id: Identifier; + typeParams?: TsTypeParameterDeclaration; + typeAnnotation: TsType; +} + +export interface TsEnumDeclaration extends Node, HasSpan { + type: "TsEnumDeclaration"; + + declare: boolean; + isConst: boolean; + id: Identifier; + members: TsEnumMember[]; +} + +export interface TsEnumMember extends Node, HasSpan { + type: "TsEnumMember"; + + id: TsEnumMemberId; + init?: Expression; +} + +export type TsEnumMemberId = Identifier | StringLiteral; + +export interface TsModuleDeclaration extends Node, HasSpan { + type: "TsModuleDeclaration"; + + declare: boolean; + global: boolean; + id: TsModuleName; + body?: TsNamespaceBody; +} + +/** + * `namespace A.B { }` is a namespace named `A` with another TsNamespaceDecl as its body. + */ +export type TsNamespaceBody = TsModuleBlock | TsNamespaceDeclaration; + +export interface TsModuleBlock extends Node, HasSpan { + type: "TsModuleBlock"; + + body: ModuleItem[]; +} + +export interface TsNamespaceDeclaration extends Node, HasSpan { + type: "TsNamespaceDeclaration"; + + declare: boolean; + global: boolean; + id: Identifier; + body: TsNamespaceBody; +} + +export type TsModuleName = Identifier | StringLiteral; + +export interface TsImportEqualsDeclaration extends Node, HasSpan { + type: "TsImportEqualsDeclaration"; + + declare: boolean; + isExport: boolean; + isTypeOnly: boolean; + id: Identifier; + moduleRef: TsModuleReference; +} + +export type TsModuleReference = TsEntityName | TsExternalModuleReference; + +export interface TsExternalModuleReference extends Node, HasSpan { + type: "TsExternalModuleReference"; + + expression: StringLiteral; +} + +export interface TsExportAssignment extends Node, HasSpan { + type: "TsExportAssignment"; + + expression: Expression; +} + +export interface TsNamespaceExportDeclaration extends Node, HasSpan { + type: "TsNamespaceExportDeclaration"; + + id: Identifier; +} + +export interface TsAsExpression extends ExpressionBase { + type: "TsAsExpression"; + + expression: Expression; + typeAnnotation: TsType; +} + +export interface TsSatisfiesExpression extends ExpressionBase { + type: "TsSatisfiesExpression"; + + expression: Expression; + typeAnnotation: TsType; +} + +export interface TsInstantiation extends Node, HasSpan { + type: "TsInstantiation"; + + expression: Expression; + typeArguments: TsTypeParameterInstantiation; +} + +export interface TsTypeAssertion extends ExpressionBase { + type: "TsTypeAssertion"; + + expression: Expression; + typeAnnotation: TsType; +} + +export interface TsConstAssertion extends ExpressionBase { + type: "TsConstAssertion"; + + expression: Expression; +} + +export interface TsNonNullExpression extends ExpressionBase { + type: "TsNonNullExpression"; + + expression: Expression; +} + +export type Accessibility = "public" | "protected" | "private"; + +export interface Invalid extends Node, HasSpan { + type: "Invalid"; +} diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 00000000000..b4a29d6a907 --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,33 @@ +{ + "name": "@swc/types", + "version": "0.1.3", + "description": "Typings for the swc project.", + "sideEffects": false, + "scripts": { + "build": "tsc", + "prepublishOnly": "yarn build", + "prepack": "yarn build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/swc-project/swc.git" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "keywords": [ + "swc", + "types" + ], + "author": "강동윤 ", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/swc-project/swc/issues" + }, + "homepage": "https://swc.rs", + "packageManager": "yarn@3.2.3", + "devDependencies": { + "typescript": "^5.1.6" + } +} diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json new file mode 100644 index 00000000000..4a12300229f --- /dev/null +++ b/packages/types/tsconfig.json @@ -0,0 +1,102 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Language and Environment */ + "target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true, + // "noEmit": true + } +} \ No newline at end of file diff --git a/packages/yarn.lock b/packages/yarn.lock new file mode 100644 index 00000000000..db3e5818734 --- /dev/null +++ b/packages/yarn.lock @@ -0,0 +1,731 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 6 + cacheKey: 8 + +"@ast-grep/napi-darwin-arm64@npm:0.3.3": + version: 0.3.3 + resolution: "@ast-grep/napi-darwin-arm64@npm:0.3.3" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@ast-grep/napi-darwin-x64@npm:0.3.3": + version: 0.3.3 + resolution: "@ast-grep/napi-darwin-x64@npm:0.3.3" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@ast-grep/napi-linux-x64-gnu@npm:0.3.3": + version: 0.3.3 + resolution: "@ast-grep/napi-linux-x64-gnu@npm:0.3.3" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@ast-grep/napi-win32-arm64-msvc@npm:0.3.3": + version: 0.3.3 + resolution: "@ast-grep/napi-win32-arm64-msvc@npm:0.3.3" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@ast-grep/napi-win32-ia32-msvc@npm:0.3.3": + version: 0.3.3 + resolution: "@ast-grep/napi-win32-ia32-msvc@npm:0.3.3" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@ast-grep/napi-win32-x64-msvc@npm:0.3.3": + version: 0.3.3 + resolution: "@ast-grep/napi-win32-x64-msvc@npm:0.3.3" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@ast-grep/napi@npm:^0.3.1": + version: 0.3.3 + resolution: "@ast-grep/napi@npm:0.3.3" + dependencies: + "@ast-grep/napi-darwin-arm64": 0.3.3 + "@ast-grep/napi-darwin-x64": 0.3.3 + "@ast-grep/napi-linux-x64-gnu": 0.3.3 + "@ast-grep/napi-win32-arm64-msvc": 0.3.3 + "@ast-grep/napi-win32-ia32-msvc": 0.3.3 + "@ast-grep/napi-win32-x64-msvc": 0.3.3 + dependenciesMeta: + "@ast-grep/napi-darwin-arm64": + optional: true + "@ast-grep/napi-darwin-x64": + optional: true + "@ast-grep/napi-linux-x64-gnu": + optional: true + "@ast-grep/napi-win32-arm64-msvc": + optional: true + "@ast-grep/napi-win32-ia32-msvc": + optional: true + "@ast-grep/napi-win32-x64-msvc": + optional: true + checksum: 1f2ce3041cdd93337fcbb24b6dd3ba1e3ee4f4dc621c738ebeee482e5de1d183db976986a21060601ced778a2c0146961f4696858f20c62cb05a9ebebd81d2c7 + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.15": + version: 1.4.15 + resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" + checksum: b881c7e503db3fc7f3c1f35a1dd2655a188cc51a3612d76efc8a6eb74728bef5606e6758ee77423e564092b4a518aba569bbb21c9bac5ab7a35b0c6ae7e344c8 + languageName: node + linkType: hard + +"@nodelib/fs.scandir@npm:2.1.5": + version: 2.1.5 + resolution: "@nodelib/fs.scandir@npm:2.1.5" + dependencies: + "@nodelib/fs.stat": 2.0.5 + run-parallel: ^1.1.9 + checksum: a970d595bd23c66c880e0ef1817791432dbb7acbb8d44b7e7d0e7a22f4521260d4a83f7f9fd61d44fda4610105577f8f58a60718105fb38352baed612fd79e59 + languageName: node + linkType: hard + +"@nodelib/fs.stat@npm:2.0.5, @nodelib/fs.stat@npm:^2.0.2": + version: 2.0.5 + resolution: "@nodelib/fs.stat@npm:2.0.5" + checksum: 012480b5ca9d97bff9261571dbbec7bbc6033f69cc92908bc1ecfad0792361a5a1994bc48674b9ef76419d056a03efadfce5a6cf6dbc0a36559571a7a483f6f0 + languageName: node + linkType: hard + +"@nodelib/fs.walk@npm:^1.2.3": + version: 1.2.8 + resolution: "@nodelib/fs.walk@npm:1.2.8" + dependencies: + "@nodelib/fs.scandir": 2.1.5 + fastq: ^1.6.0 + checksum: 190c643f156d8f8f277bf2a6078af1ffde1fd43f498f187c2db24d35b4b4b5785c02c7dc52e356497b9a1b65b13edc996de08de0b961c32844364da02986dc53 + languageName: node + linkType: hard + +"@swc/helpers@workspace:helpers": + version: 0.0.0-use.local + resolution: "@swc/helpers@workspace:helpers" + dependencies: + "@ast-grep/napi": ^0.3.1 + dprint: ^0.35.3 + magic-string: ^0.30.0 + tslib: ^2.4.0 + zx: ^7.2.1 + languageName: unknown + linkType: soft + +"@swc/types@workspace:types": + version: 0.0.0-use.local + resolution: "@swc/types@workspace:types" + dependencies: + typescript: ^5.1.6 + languageName: unknown + linkType: soft + +"@swc/workspace@workspace:.": + version: 0.0.0-use.local + resolution: "@swc/workspace@workspace:." + languageName: unknown + linkType: soft + +"@types/fs-extra@npm:^11.0.1": + version: 11.0.1 + resolution: "@types/fs-extra@npm:11.0.1" + dependencies: + "@types/jsonfile": "*" + "@types/node": "*" + checksum: 3e930346e5d84f419deb8ced1c582beef8cb20d0bd8a0eb145a37d75bab0572a1895f0e48a0d681d386b3a58b9a992b2d2acecc464bcaec2548f53ea00718651 + languageName: node + linkType: hard + +"@types/jsonfile@npm:*": + version: 6.1.1 + resolution: "@types/jsonfile@npm:6.1.1" + dependencies: + "@types/node": "*" + checksum: 0f8fe0a9221a00e8413cffba723dfe16553868724b830237256fb0052ecd5cac96498189d1235a001cfa815f352008261c9ceb373f0aa58227f891e0c7a12c4d + languageName: node + linkType: hard + +"@types/minimist@npm:^1.2.2": + version: 1.2.2 + resolution: "@types/minimist@npm:1.2.2" + checksum: b8da83c66eb4aac0440e64674b19564d9d86c80ae273144db9681e5eeff66f238ade9515f5006ffbfa955ceff8b89ad2bd8ec577d7caee74ba101431fb07045d + languageName: node + linkType: hard + +"@types/node@npm:*": + version: 20.5.0 + resolution: "@types/node@npm:20.5.0" + checksum: 659bc5fc93b5c02bd88ca4bfae4f6b9dc307d45884d1dd9d69df85819a9943cdc00cd3c87eec3048866df6a67f52297f74d170e47a44f61edb3e8f770d94e85e + languageName: node + linkType: hard + +"@types/node@npm:^18.16.3": + version: 18.17.5 + resolution: "@types/node@npm:18.17.5" + checksum: b8c658a99234b99425243c324b641ed7b9ceb6bee6b06421fdc9bb7c58f9a5552e353225cc549e6982462ac384abe1985022ed76e2e4728797f59b21f659ca2b + languageName: node + linkType: hard + +"@types/ps-tree@npm:^1.1.2": + version: 1.1.2 + resolution: "@types/ps-tree@npm:1.1.2" + checksum: 575c3b2b83ea8935ab296ac9e17f6a2c1a5bb155f9e30663bb7a7c741a8ca4641f0df9748866230f1d6c3f87ed4ffa3fa91f1df444ef9979a3df31114534bf25 + languageName: node + linkType: hard + +"@types/which@npm:^3.0.0": + version: 3.0.0 + resolution: "@types/which@npm:3.0.0" + checksum: 0dccb4b39b19dbf24e45461da581e1e6329ca06f28e467348d982d57ce4da342762c6594d3aa759682d26b9238e0a05938eb64221e7420ea890a1aaca22c2fca + languageName: node + linkType: hard + +"agent-base@npm:6": + version: 6.0.2 + resolution: "agent-base@npm:6.0.2" + dependencies: + debug: 4 + checksum: f52b6872cc96fd5f622071b71ef200e01c7c4c454ee68bc9accca90c98cfb39f2810e3e9aa330435835eedc8c23f4f8a15267f67c6e245d2b33757575bdac49d + languageName: node + linkType: hard + +"braces@npm:^3.0.2": + version: 3.0.2 + resolution: "braces@npm:3.0.2" + dependencies: + fill-range: ^7.0.1 + checksum: e2a8e769a863f3d4ee887b5fe21f63193a891c68b612ddb4b68d82d1b5f3ff9073af066c343e9867a393fe4c2555dcb33e89b937195feb9c1613d259edfcd459 + languageName: node + linkType: hard + +"buffer-crc32@npm:~0.2.3": + version: 0.2.13 + resolution: "buffer-crc32@npm:0.2.13" + checksum: 06252347ae6daca3453b94e4b2f1d3754a3b146a111d81c68924c22d91889a40623264e95e67955b1cb4a68cbedf317abeabb5140a9766ed248973096db5ce1c + languageName: node + linkType: hard + +"chalk@npm:^5.2.0": + version: 5.3.0 + resolution: "chalk@npm:5.3.0" + checksum: 623922e077b7d1e9dedaea6f8b9e9352921f8ae3afe739132e0e00c275971bdd331268183b2628cf4ab1727c45ea1f28d7e24ac23ce1db1eb653c414ca8a5a80 + languageName: node + linkType: hard + +"data-uri-to-buffer@npm:^4.0.0": + version: 4.0.1 + resolution: "data-uri-to-buffer@npm:4.0.1" + checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c + languageName: node + linkType: hard + +"debug@npm:4": + version: 4.3.4 + resolution: "debug@npm:4.3.4" + dependencies: + ms: 2.1.2 + peerDependenciesMeta: + supports-color: + optional: true + checksum: 3dbad3f94ea64f34431a9cbf0bafb61853eda57bff2880036153438f50fb5a84f27683ba0d8e5426bf41a8c6ff03879488120cf5b3a761e77953169c0600a708 + languageName: node + linkType: hard + +"dir-glob@npm:^3.0.1": + version: 3.0.1 + resolution: "dir-glob@npm:3.0.1" + dependencies: + path-type: ^4.0.0 + checksum: fa05e18324510d7283f55862f3161c6759a3f2f8dbce491a2fc14c8324c498286c54282c1f0e933cb930da8419b30679389499b919122952a4f8592362ef4615 + languageName: node + linkType: hard + +"dprint@npm:^0.35.3": + version: 0.35.4 + resolution: "dprint@npm:0.35.4" + dependencies: + https-proxy-agent: =5.0.1 + yauzl: =2.10.0 + bin: + dprint: bin.js + checksum: 7fe3d745f057a7d8abfb75b5bc33df39da680f473fe8a8cd77eb03d37fcd98636baaaaccfe01226061b62c6bd46503d76350a3cd621ae4e0872d4fe7c546e7ea + languageName: node + linkType: hard + +"duplexer@npm:~0.1.1": + version: 0.1.2 + resolution: "duplexer@npm:0.1.2" + checksum: 62ba61a830c56801db28ff6305c7d289b6dc9f859054e8c982abd8ee0b0a14d2e9a8e7d086ffee12e868d43e2bbe8a964be55ddbd8c8957714c87373c7a4f9b0 + languageName: node + linkType: hard + +"event-stream@npm:=3.3.4": + version: 3.3.4 + resolution: "event-stream@npm:3.3.4" + dependencies: + duplexer: ~0.1.1 + from: ~0 + map-stream: ~0.1.0 + pause-stream: 0.0.11 + split: 0.3 + stream-combiner: ~0.0.4 + through: ~2.3.1 + checksum: 80b467820b6daf824d9fb4345d2daf115a056e5c104463f2e98534e92d196a27f2df5ea2aa085624db26f4c45698905499e881d13bc7c01f7a13eac85be72a22 + languageName: node + linkType: hard + +"fast-glob@npm:^3.3.0": + version: 3.3.1 + resolution: "fast-glob@npm:3.3.1" + dependencies: + "@nodelib/fs.stat": ^2.0.2 + "@nodelib/fs.walk": ^1.2.3 + glob-parent: ^5.1.2 + merge2: ^1.3.0 + micromatch: ^4.0.4 + checksum: b6f3add6403e02cf3a798bfbb1183d0f6da2afd368f27456010c0bc1f9640aea308243d4cb2c0ab142f618276e65ecb8be1661d7c62a7b4e5ba774b9ce5432e5 + languageName: node + linkType: hard + +"fastq@npm:^1.6.0": + version: 1.15.0 + resolution: "fastq@npm:1.15.0" + dependencies: + reusify: ^1.0.4 + checksum: 0170e6bfcd5d57a70412440b8ef600da6de3b2a6c5966aeaf0a852d542daff506a0ee92d6de7679d1de82e644bce69d7a574a6c93f0b03964b5337eed75ada1a + languageName: node + linkType: hard + +"fd-slicer@npm:~1.1.0": + version: 1.1.0 + resolution: "fd-slicer@npm:1.1.0" + dependencies: + pend: ~1.2.0 + checksum: c8585fd5713f4476eb8261150900d2cb7f6ff2d87f8feb306ccc8a1122efd152f1783bdb2b8dc891395744583436bfd8081d8e63ece0ec8687eeefea394d4ff2 + languageName: node + linkType: hard + +"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": + version: 3.2.0 + resolution: "fetch-blob@npm:3.2.0" + dependencies: + node-domexception: ^1.0.0 + web-streams-polyfill: ^3.0.3 + checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf + languageName: node + linkType: hard + +"fill-range@npm:^7.0.1": + version: 7.0.1 + resolution: "fill-range@npm:7.0.1" + dependencies: + to-regex-range: ^5.0.1 + checksum: cc283f4e65b504259e64fd969bcf4def4eb08d85565e906b7d36516e87819db52029a76b6363d0f02d0d532f0033c9603b9e2d943d56ee3b0d4f7ad3328ff917 + languageName: node + linkType: hard + +"formdata-polyfill@npm:^4.0.10": + version: 4.0.10 + resolution: "formdata-polyfill@npm:4.0.10" + dependencies: + fetch-blob: ^3.1.2 + checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db + languageName: node + linkType: hard + +"from@npm:~0": + version: 0.1.7 + resolution: "from@npm:0.1.7" + checksum: b85125b7890489656eb2e4f208f7654a93ec26e3aefaf3bbbcc0d496fc1941e4405834fcc9fe7333192aa2187905510ace70417bbf9ac6f6f4784a731d986939 + languageName: node + linkType: hard + +"fs-extra@npm:^11.1.1": + version: 11.1.1 + resolution: "fs-extra@npm:11.1.1" + dependencies: + graceful-fs: ^4.2.0 + jsonfile: ^6.0.1 + universalify: ^2.0.0 + checksum: fb883c68245b2d777fbc1f2082c9efb084eaa2bbf9fddaa366130d196c03608eebef7fb490541276429ee1ca99f317e2d73e96f5ca0999eefedf5a624ae1edfd + languageName: node + linkType: hard + +"fx@npm:*": + version: 28.0.0 + resolution: "fx@npm:28.0.0" + bin: + fx: index.js + checksum: 4175077de379c3bcbcef585e50ac83f510d3f8dcf83247771faf9fee5aeb0a912e9ef1b8ffdd2feb73a40a56fd08aa2517205c239b3ead31520d944fd938b125 + languageName: node + linkType: hard + +"glob-parent@npm:^5.1.2": + version: 5.1.2 + resolution: "glob-parent@npm:5.1.2" + dependencies: + is-glob: ^4.0.1 + checksum: f4f2bfe2425296e8a47e36864e4f42be38a996db40420fe434565e4480e3322f18eb37589617a98640c5dc8fdec1a387007ee18dbb1f3f5553409c34d17f425e + languageName: node + linkType: hard + +"globby@npm:^13.1.4": + version: 13.2.2 + resolution: "globby@npm:13.2.2" + dependencies: + dir-glob: ^3.0.1 + fast-glob: ^3.3.0 + ignore: ^5.2.4 + merge2: ^1.4.1 + slash: ^4.0.0 + checksum: f3d84ced58a901b4fcc29c846983108c426631fe47e94872868b65565495f7bee7b3defd68923bd480582771fd4bbe819217803a164a618ad76f1d22f666f41e + languageName: node + linkType: hard + +"graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0": + version: 4.2.11 + resolution: "graceful-fs@npm:4.2.11" + checksum: ac85f94da92d8eb6b7f5a8b20ce65e43d66761c55ce85ac96df6865308390da45a8d3f0296dd3a663de65d30ba497bd46c696cc1e248c72b13d6d567138a4fc7 + languageName: node + linkType: hard + +"https-proxy-agent@npm:=5.0.1": + version: 5.0.1 + resolution: "https-proxy-agent@npm:5.0.1" + dependencies: + agent-base: 6 + debug: 4 + checksum: 571fccdf38184f05943e12d37d6ce38197becdd69e58d03f43637f7fa1269cf303a7d228aa27e5b27bbd3af8f09fd938e1c91dcfefff2df7ba77c20ed8dfc765 + languageName: node + linkType: hard + +"ignore@npm:^5.2.4": + version: 5.2.4 + resolution: "ignore@npm:5.2.4" + checksum: 3d4c309c6006e2621659311783eaea7ebcd41fe4ca1d78c91c473157ad6666a57a2df790fe0d07a12300d9aac2888204d7be8d59f9aaf665b1c7fcdb432517ef + languageName: node + linkType: hard + +"is-extglob@npm:^2.1.1": + version: 2.1.1 + resolution: "is-extglob@npm:2.1.1" + checksum: df033653d06d0eb567461e58a7a8c9f940bd8c22274b94bf7671ab36df5719791aae15eef6d83bbb5e23283967f2f984b8914559d4449efda578c775c4be6f85 + languageName: node + linkType: hard + +"is-glob@npm:^4.0.1": + version: 4.0.3 + resolution: "is-glob@npm:4.0.3" + dependencies: + is-extglob: ^2.1.1 + checksum: d381c1319fcb69d341cc6e6c7cd588e17cd94722d9a32dbd60660b993c4fb7d0f19438674e68dfec686d09b7c73139c9166b47597f846af387450224a8101ab4 + languageName: node + linkType: hard + +"is-number@npm:^7.0.0": + version: 7.0.0 + resolution: "is-number@npm:7.0.0" + checksum: 456ac6f8e0f3111ed34668a624e45315201dff921e5ac181f8ec24923b99e9f32ca1a194912dc79d539c97d33dba17dc635202ff0b2cf98326f608323276d27a + languageName: node + linkType: hard + +"isexe@npm:^2.0.0": + version: 2.0.0 + resolution: "isexe@npm:2.0.0" + checksum: 26bf6c5480dda5161c820c5b5c751ae1e766c587b1f951ea3fcfc973bafb7831ae5b54a31a69bd670220e42e99ec154475025a468eae58ea262f813fdc8d1c62 + languageName: node + linkType: hard + +"jsonfile@npm:^6.0.1": + version: 6.1.0 + resolution: "jsonfile@npm:6.1.0" + dependencies: + graceful-fs: ^4.1.6 + universalify: ^2.0.0 + dependenciesMeta: + graceful-fs: + optional: true + checksum: 7af3b8e1ac8fe7f1eccc6263c6ca14e1966fcbc74b618d3c78a0a2075579487547b94f72b7a1114e844a1e15bb00d440e5d1720bfc4612d790a6f285d5ea8354 + languageName: node + linkType: hard + +"magic-string@npm:^0.30.0": + version: 0.30.2 + resolution: "magic-string@npm:0.30.2" + dependencies: + "@jridgewell/sourcemap-codec": ^1.4.15 + checksum: c0bbb9b27b2772e6bfaa5d0f6452d47c462d588ae7c43fbaac062b07836d3ec0140fcdd42a57aa53ed990abafcdd0fc17907813921b5df04eccf43e67674bc57 + languageName: node + linkType: hard + +"map-stream@npm:~0.1.0": + version: 0.1.0 + resolution: "map-stream@npm:0.1.0" + checksum: 38abbe4eb883888031e6b2fc0630bc583c99396be16b8ace5794b937b682a8a081f03e8b15bfd4914d1bc88318f0e9ac73ba3512ae65955cd449f63256ddb31d + languageName: node + linkType: hard + +"merge2@npm:^1.3.0, merge2@npm:^1.4.1": + version: 1.4.1 + resolution: "merge2@npm:1.4.1" + checksum: 7268db63ed5169466540b6fb947aec313200bcf6d40c5ab722c22e242f651994619bcd85601602972d3c85bd2cc45a358a4c61937e9f11a061919a1da569b0c2 + languageName: node + linkType: hard + +"micromatch@npm:^4.0.4": + version: 4.0.5 + resolution: "micromatch@npm:4.0.5" + dependencies: + braces: ^3.0.2 + picomatch: ^2.3.1 + checksum: 02a17b671c06e8fefeeb6ef996119c1e597c942e632a21ef589154f23898c9c6a9858526246abb14f8bca6e77734aa9dcf65476fca47cedfb80d9577d52843fc + languageName: node + linkType: hard + +"minimist@npm:^1.2.8": + version: 1.2.8 + resolution: "minimist@npm:1.2.8" + checksum: 75a6d645fb122dad29c06a7597bddea977258957ed88d7a6df59b5cd3fe4a527e253e9bbf2e783e4b73657f9098b96a5fe96ab8a113655d4109108577ecf85b0 + languageName: node + linkType: hard + +"ms@npm:2.1.2": + version: 2.1.2 + resolution: "ms@npm:2.1.2" + checksum: 673cdb2c3133eb050c745908d8ce632ed2c02d85640e2edb3ace856a2266a813b30c613569bf3354fdf4ea7d1a1494add3bfa95e2713baa27d0c2c71fc44f58f + languageName: node + linkType: hard + +"node-domexception@npm:^1.0.0": + version: 1.0.0 + resolution: "node-domexception@npm:1.0.0" + checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f + languageName: node + linkType: hard + +"node-fetch@npm:3.3.1": + version: 3.3.1 + resolution: "node-fetch@npm:3.3.1" + dependencies: + data-uri-to-buffer: ^4.0.0 + fetch-blob: ^3.1.4 + formdata-polyfill: ^4.0.10 + checksum: 62145fd3ba4770a76110bc31fdc0054ab2f5442b5ce96e9c4b39fc9e94a3d305560eec76e1165d9259eab866e02a8eecf9301062bb5dfc9f08a4d08b69d223dd + languageName: node + linkType: hard + +"path-type@npm:^4.0.0": + version: 4.0.0 + resolution: "path-type@npm:4.0.0" + checksum: 5b1e2daa247062061325b8fdbfd1fb56dde0a448fb1455453276ea18c60685bdad23a445dc148cf87bc216be1573357509b7d4060494a6fd768c7efad833ee45 + languageName: node + linkType: hard + +"pause-stream@npm:0.0.11": + version: 0.0.11 + resolution: "pause-stream@npm:0.0.11" + dependencies: + through: ~2.3 + checksum: 3c4a14052a638b92e0c96eb00c0d7977df7f79ea28395250c525d197f1fc02d34ce1165d5362e2e6ebbb251524b94a76f3f0d4abc39ab8b016d97449fe15583c + languageName: node + linkType: hard + +"pend@npm:~1.2.0": + version: 1.2.0 + resolution: "pend@npm:1.2.0" + checksum: 6c72f5243303d9c60bd98e6446ba7d30ae29e3d56fdb6fae8767e8ba6386f33ee284c97efe3230a0d0217e2b1723b8ab490b1bbf34fcbb2180dbc8a9de47850d + languageName: node + linkType: hard + +"picomatch@npm:^2.3.1": + version: 2.3.1 + resolution: "picomatch@npm:2.3.1" + checksum: 050c865ce81119c4822c45d3c84f1ced46f93a0126febae20737bd05ca20589c564d6e9226977df859ed5e03dc73f02584a2b0faad36e896936238238b0446cf + languageName: node + linkType: hard + +"ps-tree@npm:^1.2.0": + version: 1.2.0 + resolution: "ps-tree@npm:1.2.0" + dependencies: + event-stream: =3.3.4 + bin: + ps-tree: ./bin/ps-tree.js + checksum: e635dd00f53d30d31696cf5f95b3a8dbdf9b1aeb36d4391578ce8e8cd22949b7c5536c73b0dc18c78615ea3ddd4be96101166be59ca2e3e3cb1e2f79ba3c7f98 + languageName: node + linkType: hard + +"queue-microtask@npm:^1.2.2": + version: 1.2.3 + resolution: "queue-microtask@npm:1.2.3" + checksum: b676f8c040cdc5b12723ad2f91414d267605b26419d5c821ff03befa817ddd10e238d22b25d604920340fd73efd8ba795465a0377c4adf45a4a41e4234e42dc4 + languageName: node + linkType: hard + +"reusify@npm:^1.0.4": + version: 1.0.4 + resolution: "reusify@npm:1.0.4" + checksum: c3076ebcc22a6bc252cb0b9c77561795256c22b757f40c0d8110b1300723f15ec0fc8685e8d4ea6d7666f36c79ccc793b1939c748bf36f18f542744a4e379fcc + languageName: node + linkType: hard + +"run-parallel@npm:^1.1.9": + version: 1.2.0 + resolution: "run-parallel@npm:1.2.0" + dependencies: + queue-microtask: ^1.2.2 + checksum: cb4f97ad25a75ebc11a8ef4e33bb962f8af8516bb2001082ceabd8902e15b98f4b84b4f8a9b222e5d57fc3bd1379c483886ed4619367a7680dad65316993021d + languageName: node + linkType: hard + +"slash@npm:^4.0.0": + version: 4.0.0 + resolution: "slash@npm:4.0.0" + checksum: da8e4af73712253acd21b7853b7e0dbba776b786e82b010a5bfc8b5051a1db38ed8aba8e1e8f400dd2c9f373be91eb1c42b66e91abb407ff42b10feece5e1d2d + languageName: node + linkType: hard + +"split@npm:0.3": + version: 0.3.3 + resolution: "split@npm:0.3.3" + dependencies: + through: 2 + checksum: 2e076634c9637cfdc54ab4387b6a243b8c33b360874a25adf6f327a5647f07cb3bf1c755d515248eb3afee4e382278d01f62c62d87263c118f28065b86f74f02 + languageName: node + linkType: hard + +"stream-combiner@npm:~0.0.4": + version: 0.0.4 + resolution: "stream-combiner@npm:0.0.4" + dependencies: + duplexer: ~0.1.1 + checksum: 844b622cfe8b9de45a6007404f613b60aaf85200ab9862299066204242f89a7c8033b1c356c998aa6cfc630f6cd9eba119ec1c6dc1f93e245982be4a847aee7d + languageName: node + linkType: hard + +"through@npm:2, through@npm:~2.3, through@npm:~2.3.1": + version: 2.3.8 + resolution: "through@npm:2.3.8" + checksum: a38c3e059853c494af95d50c072b83f8b676a9ba2818dcc5b108ef252230735c54e0185437618596c790bbba8fcdaef5b290405981ffa09dce67b1f1bf190cbd + languageName: node + linkType: hard + +"to-regex-range@npm:^5.0.1": + version: 5.0.1 + resolution: "to-regex-range@npm:5.0.1" + dependencies: + is-number: ^7.0.0 + checksum: f76fa01b3d5be85db6a2a143e24df9f60dd047d151062d0ba3df62953f2f697b16fe5dad9b0ac6191c7efc7b1d9dcaa4b768174b7b29da89d4428e64bc0a20ed + languageName: node + linkType: hard + +"tslib@npm:^2.4.0": + version: 2.6.1 + resolution: "tslib@npm:2.6.1" + checksum: b0d176d176487905b66ae4d5856647df50e37beea7571c53b8d10ba9222c074b81f1410fb91da13debaf2cbc970663609068bdebafa844ea9d69b146527c38fe + languageName: node + linkType: hard + +"typescript@npm:^5.1.6": + version: 5.1.6 + resolution: "typescript@npm:5.1.6" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: b2f2c35096035fe1f5facd1e38922ccb8558996331405eb00a5111cc948b2e733163cc22fab5db46992aba7dd520fff637f2c1df4996ff0e134e77d3249a7350 + languageName: node + linkType: hard + +"typescript@patch:typescript@^5.1.6#~builtin": + version: 5.1.6 + resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin::version=5.1.6&hash=a1c5e5" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 21e88b0a0c0226f9cb9fd25b9626fb05b4c0f3fddac521844a13e1f30beb8f14e90bd409a9ac43c812c5946d714d6e0dee12d5d02dfc1c562c5aacfa1f49b606 + languageName: node + linkType: hard + +"universalify@npm:^2.0.0": + version: 2.0.0 + resolution: "universalify@npm:2.0.0" + checksum: 2406a4edf4a8830aa6813278bab1f953a8e40f2f63a37873ffa9a3bc8f9745d06cc8e88f3572cb899b7e509013f7f6fcc3e37e8a6d914167a5381d8440518c44 + languageName: node + linkType: hard + +"web-streams-polyfill@npm:^3.0.3": + version: 3.2.1 + resolution: "web-streams-polyfill@npm:3.2.1" + checksum: b119c78574b6d65935e35098c2afdcd752b84268e18746606af149e3c424e15621b6f1ff0b42b2676dc012fc4f0d313f964b41a4b5031e525faa03997457da02 + languageName: node + linkType: hard + +"webpod@npm:^0": + version: 0.0.2 + resolution: "webpod@npm:0.0.2" + bin: + webpod: dist/index.js + checksum: 3c6f7376cf06804a0b68adec3c33d1aceb9a1d13854beac542b95dcdb6f6cee34cd05fbd2228e01b67c2ce48673650296976dd694bd8d0ff10920a32dbe2e30a + languageName: node + linkType: hard + +"which@npm:^3.0.0": + version: 3.0.1 + resolution: "which@npm:3.0.1" + dependencies: + isexe: ^2.0.0 + bin: + node-which: bin/which.js + checksum: adf720fe9d84be2d9190458194f814b5e9015ae4b88711b150f30d0f4d0b646544794b86f02c7ebeec1db2029bc3e83a7ff156f542d7521447e5496543e26890 + languageName: node + linkType: hard + +"yaml@npm:^2.2.2": + version: 2.3.1 + resolution: "yaml@npm:2.3.1" + checksum: 2c7bc9a7cd4c9f40d3b0b0a98e370781b68b8b7c4515720869aced2b00d92f5da1762b4ffa947f9e795d6cd6b19f410bd4d15fdd38aca7bd96df59bd9486fb54 + languageName: node + linkType: hard + +"yauzl@npm:=2.10.0": + version: 2.10.0 + resolution: "yauzl@npm:2.10.0" + dependencies: + buffer-crc32: ~0.2.3 + fd-slicer: ~1.1.0 + checksum: 7f21fe0bbad6e2cb130044a5d1d0d5a0e5bf3d8d4f8c4e6ee12163ce798fee3de7388d22a7a0907f563ac5f9d40f8699a223d3d5c1718da90b0156da6904022b + languageName: node + linkType: hard + +"zx@npm:^7.2.1": + version: 7.2.3 + resolution: "zx@npm:7.2.3" + dependencies: + "@types/fs-extra": ^11.0.1 + "@types/minimist": ^1.2.2 + "@types/node": ^18.16.3 + "@types/ps-tree": ^1.1.2 + "@types/which": ^3.0.0 + chalk: ^5.2.0 + fs-extra: ^11.1.1 + fx: "*" + globby: ^13.1.4 + minimist: ^1.2.8 + node-fetch: 3.3.1 + ps-tree: ^1.2.0 + webpod: ^0 + which: ^3.0.0 + yaml: ^2.2.2 + bin: + zx: build/cli.js + checksum: 33b05e26ec3a429de6ff8db759d7b7857b947f4845025416db410bedaa8e613608a6d1916f257e129625d0192b6ba43e482356c6844ff90d15b0fd06dd9b98d2 + languageName: node + linkType: hard diff --git a/yarn.lock b/yarn.lock index dddceb226ee..c310f29f7be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2564,6 +2564,7 @@ __metadata: "@swc/core-win32-x64-msvc": 1.2.146 "@swc/helpers": ^0.5.0 "@swc/plugin-jest": latest + "@swc/types": ^0.1.3 "@taplo/cli": ^0.3.2 "@types/jest": ^28.1.4 "@types/node": ^20.5.0 @@ -2646,6 +2647,13 @@ __metadata: languageName: node linkType: hard +"@swc/types@npm:^0.1.3": + version: 0.1.3 + resolution: "@swc/types@npm:0.1.3" + checksum: 89b86ac338076a4c7ad3b8b016bb7d9ea6357517716d46232c372dc21f93166e08ed334da0a157e02cd5a1b1ff651542ddcd6f43988ee74b16f837a840681143 + languageName: node + linkType: hard + "@taplo/cli@npm:^0.3.2": version: 0.3.2 resolution: "@taplo/cli@npm:0.3.2"