mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
chore: update wasm related configs (#7511)
This commit is contained in:
parent
2077ff9269
commit
df58ebd914
6 changed files with 810 additions and 859 deletions
1
.ignore
1
.ignore
|
|
@ -11,3 +11,4 @@ tasks/prettier_conformance/prettier/**
|
|||
**/*.snap
|
||||
|
||||
crates/oxc_transformer/src/options/es_features.rs
|
||||
npm/oxc-wasm/**
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"napi/{parser,transform,minify}/index.d.ts",
|
||||
"npm/*/package.json",
|
||||
"npm/oxlint/configuration_schema.json",
|
||||
"npm/oxc-wasm/**",
|
||||
".github/.generated_ast_watch_list.yml"
|
||||
],
|
||||
"plugins": [
|
||||
|
|
|
|||
1
justfile
1
justfile
|
|
@ -144,6 +144,7 @@ watch-wasm:
|
|||
|
||||
build-wasm mode="release":
|
||||
wasm-pack build --out-dir ../../npm/oxc-wasm --target web --{{mode}} --scope oxc crates/oxc_wasm
|
||||
echo '*.wasm' > npm/oxc-wasm/.gitignore
|
||||
cp crates/oxc_wasm/package.json npm/oxc-wasm/package.json
|
||||
|
||||
# Generate the JavaScript global variables. See `tasks/javascript_globals`
|
||||
|
|
|
|||
2
npm/oxc-wasm/.gitignore
vendored
2
npm/oxc-wasm/.gitignore
vendored
|
|
@ -1 +1 @@
|
|||
.wasm
|
||||
*.wasm
|
||||
|
|
|
|||
202
npm/oxc-wasm/oxc_wasm.d.ts
vendored
202
npm/oxc-wasm/oxc_wasm.d.ts
vendored
|
|
@ -7,32 +7,32 @@
|
|||
*/
|
||||
export function browserslist(query: string, opts: any): any;
|
||||
export interface OxcOptions {
|
||||
run?: OxcRunOptions;
|
||||
parser?: OxcParserOptions;
|
||||
linter?: OxcLinterOptions;
|
||||
transformer?: OxcTransformerOptions;
|
||||
codegen?: OxcCodegenOptions;
|
||||
minifier?: OxcMinifierOptions;
|
||||
controlFlow?: OxcControlFlowOptions;
|
||||
run?: OxcRunOptions;
|
||||
parser?: OxcParserOptions;
|
||||
linter?: OxcLinterOptions;
|
||||
transformer?: OxcTransformerOptions;
|
||||
codegen?: OxcCodegenOptions;
|
||||
minifier?: OxcMinifierOptions;
|
||||
controlFlow?: OxcControlFlowOptions;
|
||||
}
|
||||
|
||||
export interface OxcRunOptions {
|
||||
syntax?: boolean;
|
||||
lint?: boolean;
|
||||
format?: boolean;
|
||||
prettierFormat?: boolean;
|
||||
prettierIr?: boolean;
|
||||
transform?: boolean;
|
||||
typeCheck?: boolean;
|
||||
scope?: boolean;
|
||||
symbol?: boolean;
|
||||
syntax?: boolean;
|
||||
lint?: boolean;
|
||||
format?: boolean;
|
||||
prettierFormat?: boolean;
|
||||
prettierIr?: boolean;
|
||||
transform?: boolean;
|
||||
typeCheck?: boolean;
|
||||
scope?: boolean;
|
||||
symbol?: boolean;
|
||||
}
|
||||
|
||||
export interface OxcParserOptions {
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
preserveParens?: boolean;
|
||||
sourceType?: 'script' | 'module';
|
||||
sourceFilename?: string;
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
preserveParens?: boolean;
|
||||
sourceType?: "script" | "module";
|
||||
sourceFilename?: string;
|
||||
}
|
||||
|
||||
export interface OxcLinterOptions {}
|
||||
|
|
@ -40,100 +40,112 @@ export interface OxcLinterOptions {}
|
|||
export interface OxcTransformerOptions {}
|
||||
|
||||
export interface OxcCodegenOptions {
|
||||
indentation?: number;
|
||||
enableTypescript?: boolean;
|
||||
indentation?: number;
|
||||
enableTypescript?: boolean;
|
||||
}
|
||||
|
||||
export interface OxcControlFlowOptions {
|
||||
verbose?: boolean;
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
export interface OxcMinifierOptions {
|
||||
whitespace?: boolean;
|
||||
mangle?: boolean;
|
||||
compress?: boolean;
|
||||
compressOptions?: OxcCompressOptions;
|
||||
whitespace?: boolean;
|
||||
mangle?: boolean;
|
||||
compress?: boolean;
|
||||
compressOptions?: OxcCompressOptions;
|
||||
}
|
||||
|
||||
export interface OxcCompressOptions {
|
||||
booleans: boolean;
|
||||
drop_debugger: boolean;
|
||||
drop_console: boolean;
|
||||
evaluate: boolean;
|
||||
join_vars: boolean;
|
||||
loops: boolean;
|
||||
typeofs: boolean;
|
||||
booleans: boolean;
|
||||
drop_debugger: boolean;
|
||||
drop_console: boolean;
|
||||
evaluate: boolean;
|
||||
join_vars: boolean;
|
||||
loops: boolean;
|
||||
typeofs: boolean;
|
||||
}
|
||||
|
||||
import type { Program, Span } from '@oxc-project/types';
|
||||
export * from '@oxc-project/types';
|
||||
|
||||
import type { Program, Span } from "@oxc-project/types";
|
||||
export * from "@oxc-project/types";
|
||||
|
||||
|
||||
export interface Oxc {
|
||||
ast: Program;
|
||||
ir: string;
|
||||
controlFlowGraph: string;
|
||||
symbols: SymbolTable;
|
||||
scopeText: string;
|
||||
codegenText: string;
|
||||
formattedText: string;
|
||||
prettierFormattedText: string;
|
||||
prettierIrText: string;
|
||||
comments: Comment[];
|
||||
diagnostics: Error[];
|
||||
ast: Program;
|
||||
ir: string;
|
||||
controlFlowGraph: string;
|
||||
symbols: SymbolTable;
|
||||
scopeText: string;
|
||||
codegenText: string;
|
||||
formattedText: string;
|
||||
prettierFormattedText: string;
|
||||
prettierIrText: string;
|
||||
comments: Comment[];
|
||||
diagnostics: Error[];
|
||||
}
|
||||
|
||||
export interface Comment {
|
||||
type: CommentType;
|
||||
value: string;
|
||||
start: number;
|
||||
end: number;
|
||||
type: CommentType;
|
||||
value: string;
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
export type CommentType = 'Line' | 'Block';
|
||||
export type CommentType = "Line" | "Block";
|
||||
|
||||
|
||||
export type IndexVec<I, T> = Array<T>;
|
||||
export type CompactStr = string;
|
||||
|
||||
|
||||
export interface SymbolTable {
|
||||
spans: IndexVec<SymbolId, Span>;
|
||||
names: IndexVec<SymbolId, CompactStr>;
|
||||
flags: IndexVec<SymbolId, SymbolFlags>;
|
||||
scopeIds: IndexVec<SymbolId, ScopeId>;
|
||||
declarations: IndexVec<SymbolId, NodeId>;
|
||||
resolvedReferences: IndexVec<SymbolId, ReferenceId[]>;
|
||||
redeclarations: IndexVec<SymbolId, RedeclarationId | null>;
|
||||
redeclarationSpans: IndexVec<RedeclarationId, Span[]>;
|
||||
references: IndexVec<ReferenceId, Reference>;
|
||||
spans: IndexVec<SymbolId, Span>;
|
||||
names: IndexVec<SymbolId, CompactStr>;
|
||||
flags: IndexVec<SymbolId, SymbolFlags>;
|
||||
scopeIds: IndexVec<SymbolId, ScopeId>;
|
||||
declarations: IndexVec<SymbolId, NodeId>;
|
||||
resolvedReferences: IndexVec<SymbolId, ReferenceId[]>;
|
||||
redeclarations: IndexVec<SymbolId, RedeclarationId | null>;
|
||||
redeclarationSpans: IndexVec<RedeclarationId, Span[]>;
|
||||
references: IndexVec<ReferenceId, Reference>;
|
||||
}
|
||||
|
||||
export interface Reference {
|
||||
nodeId: NodeId;
|
||||
symbolId: SymbolId | null;
|
||||
flags: ReferenceFlags;
|
||||
nodeId: NodeId;
|
||||
symbolId: SymbolId | null;
|
||||
flags: ReferenceFlags;
|
||||
}
|
||||
|
||||
export type NodeId = number;
|
||||
export type NodeFlags = {
|
||||
JSDoc: 1;
|
||||
Class: 2;
|
||||
HasYield: 4;
|
||||
Parameter: 8;
|
||||
};
|
||||
|
||||
export type ReferenceId = number;
|
||||
export type ReferenceFlags = {
|
||||
None: 0,
|
||||
Read: 0b1,
|
||||
Write: 0b10,
|
||||
Type: 0b100,
|
||||
Value: 0b11
|
||||
}
|
||||
|
||||
|
||||
|
||||
export type ScopeId = number;
|
||||
|
||||
|
||||
|
||||
export type SymbolId = number;
|
||||
export type SymbolFlags = unknown;
|
||||
export type RedeclarationId = unknown;
|
||||
|
||||
export type ReferenceId = number;
|
||||
export type ReferenceFlags = {
|
||||
None: 0;
|
||||
Read: 0b1;
|
||||
Write: 0b10;
|
||||
Type: 0b100;
|
||||
Value: 0b11;
|
||||
|
||||
|
||||
export type NodeId = number;
|
||||
export type NodeFlags = {
|
||||
JSDoc: 1,
|
||||
Class: 2,
|
||||
HasYield: 4
|
||||
Parameter: 8
|
||||
};
|
||||
|
||||
export type ScopeId = number;
|
||||
|
||||
export class Oxc {
|
||||
free(): void;
|
||||
|
|
@ -188,23 +200,21 @@ export interface InitOutput {
|
|||
|
||||
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
||||
/**
|
||||
* Instantiates the given `module`, which can either be bytes or
|
||||
* a precompiled `WebAssembly.Module`.
|
||||
*
|
||||
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {InitOutput}
|
||||
*/
|
||||
* Instantiates the given `module`, which can either be bytes or
|
||||
* a precompiled `WebAssembly.Module`.
|
||||
*
|
||||
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {InitOutput}
|
||||
*/
|
||||
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
||||
|
||||
/**
|
||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||
*
|
||||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function __wbg_init(
|
||||
module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>,
|
||||
): Promise<InitOutput>;
|
||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||
*
|
||||
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
||||
*
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue