diff --git a/napi/parser/bindings.js b/napi/parser/bindings.js index dd2a81432d5f3..ce77b62db19d8 100644 --- a/napi/parser/bindings.js +++ b/napi/parser/bindings.js @@ -388,10 +388,7 @@ module.exports.ParseResult = nativeBinding.ParseResult module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind -module.exports.getBufferOffset = nativeBinding.getBufferOffset module.exports.ImportNameKind = nativeBinding.ImportNameKind module.exports.parseAsync = nativeBinding.parseAsync -module.exports.parseAsyncRaw = nativeBinding.parseAsyncRaw module.exports.parseSync = nativeBinding.parseSync -module.exports.parseSyncRaw = nativeBinding.parseSyncRaw module.exports.rawTransferSupported = nativeBinding.rawTransferSupported diff --git a/napi/parser/index.d.ts b/napi/parser/index.d.ts index 347862ff4d621..7ea81ee0e379c 100644 --- a/napi/parser/index.d.ts +++ b/napi/parser/index.d.ts @@ -113,14 +113,6 @@ export declare const enum ExportLocalNameKind { None = 'None' } -/** - * Get offset within a `Uint8Array` which is aligned on 4 GiB. - * - * Does not check that the offset is within bounds of `buffer`. - * To ensure it always is, provide a `Uint8Array` of at least 4 GiB size. - */ -export declare function getBufferOffset(buffer: Uint8Array): number - export interface ImportName { kind: ImportNameKind name?: string @@ -144,38 +136,6 @@ export declare const enum ImportNameKind { */ export declare function parseAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise -/** - * Parse AST into provided `Uint8Array` buffer, asynchronously. - * - * Note: This function can be slower than `parseSyncRaw` due to the overhead of spawning a thread. - * - * Source text must be written into the start of the buffer, and its length (in UTF-8 bytes) - * provided as `source_len`. - * - * This function will parse the source, and write the AST into the buffer, starting at the end. - * - * It also writes to the very end of the buffer the offset of `Program` within the buffer. - * - * Caller can deserialize data from the buffer on JS side. - * - * # SAFETY - * - * Caller must ensure: - * * Source text is written into start of the buffer. - * * Source text's UTF-8 byte length is `source_len`. - * * The 1st `source_len` bytes of the buffer comprises a valid UTF-8 string. - * * Contents of buffer must not be mutated by caller until the `AsyncTask` returned by this - * function resolves. - * - * If source text is originally a JS string on JS side, and converted to a buffer with - * `Buffer.from(str)` or `new TextEncoder().encode(str)`, this guarantees it's valid UTF-8. - * - * # Panics - * - * Panics if source text is too long, or AST takes more memory than is available in the buffer. - */ -export declare function parseAsyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): Promise - export interface ParserOptions { /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */ lang?: 'js' | 'jsx' | 'ts' | 'tsx' @@ -220,34 +180,6 @@ export interface ParserOptions { /** Parse synchronously. */ export declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult -/** - * Parse AST into provided `Uint8Array` buffer, synchronously. - * - * Source text must be written into the start of the buffer, and its length (in UTF-8 bytes) - * provided as `source_len`. - * - * This function will parse the source, and write the AST into the buffer, starting at the end. - * - * It also writes to the very end of the buffer the offset of `Program` within the buffer. - * - * Caller can deserialize data from the buffer on JS side. - * - * # SAFETY - * - * Caller must ensure: - * * Source text is written into start of the buffer. - * * Source text's UTF-8 byte length is `source_len`. - * * The 1st `source_len` bytes of the buffer comprises a valid UTF-8 string. - * - * If source text is originally a JS string on JS side, and converted to a buffer with - * `Buffer.from(str)` or `new TextEncoder().encode(str)`, this guarantees it's valid UTF-8. - * - * # Panics - * - * Panics if source text is too long, or AST takes more memory than is available in the buffer. - */ -export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void - /** Returns `true` if raw transfer is supported on this platform. */ export declare function rawTransferSupported(): boolean diff --git a/napi/parser/parser.wasi-browser.js b/napi/parser/parser.wasi-browser.js index d2d9ec4606f97..8fee51bfea18e 100644 --- a/napi/parser/parser.wasi-browser.js +++ b/napi/parser/parser.wasi-browser.js @@ -59,10 +59,7 @@ export const ParseResult = __napiModule.exports.ParseResult export const ExportExportNameKind = __napiModule.exports.ExportExportNameKind export const ExportImportNameKind = __napiModule.exports.ExportImportNameKind export const ExportLocalNameKind = __napiModule.exports.ExportLocalNameKind -export const getBufferOffset = __napiModule.exports.getBufferOffset export const ImportNameKind = __napiModule.exports.ImportNameKind export const parseAsync = __napiModule.exports.parseAsync -export const parseAsyncRaw = __napiModule.exports.parseAsyncRaw export const parseSync = __napiModule.exports.parseSync -export const parseSyncRaw = __napiModule.exports.parseSyncRaw export const rawTransferSupported = __napiModule.exports.rawTransferSupported diff --git a/napi/parser/parser.wasi.cjs b/napi/parser/parser.wasi.cjs index 08b74b9b9e59c..46a73a7d36b4d 100644 --- a/napi/parser/parser.wasi.cjs +++ b/napi/parser/parser.wasi.cjs @@ -90,10 +90,7 @@ module.exports.ParseResult = __napiModule.exports.ParseResult module.exports.ExportExportNameKind = __napiModule.exports.ExportExportNameKind module.exports.ExportImportNameKind = __napiModule.exports.ExportImportNameKind module.exports.ExportLocalNameKind = __napiModule.exports.ExportLocalNameKind -module.exports.getBufferOffset = __napiModule.exports.getBufferOffset module.exports.ImportNameKind = __napiModule.exports.ImportNameKind module.exports.parseAsync = __napiModule.exports.parseAsync -module.exports.parseAsyncRaw = __napiModule.exports.parseAsyncRaw module.exports.parseSync = __napiModule.exports.parseSync -module.exports.parseSyncRaw = __napiModule.exports.parseSyncRaw module.exports.rawTransferSupported = __napiModule.exports.rawTransferSupported diff --git a/napi/parser/src/raw_transfer.rs b/napi/parser/src/raw_transfer.rs index 254205233d312..b24f116b0da18 100644 --- a/napi/parser/src/raw_transfer.rs +++ b/napi/parser/src/raw_transfer.rs @@ -46,7 +46,7 @@ const BUMP_ALIGN: usize = 16; /// /// Does not check that the offset is within bounds of `buffer`. /// To ensure it always is, provide a `Uint8Array` of at least 4 GiB size. -#[napi] +#[napi(skip_typescript)] pub fn get_buffer_offset(buffer: Uint8Array) -> u32 { let buffer = &*buffer; let buffer_addr32 = buffer.as_ptr() as u32; @@ -77,7 +77,7 @@ pub fn get_buffer_offset(buffer: Uint8Array) -> u32 { /// # Panics /// /// Panics if source text is too long, or AST takes more memory than is available in the buffer. -#[napi] +#[napi(skip_typescript)] pub unsafe fn parse_sync_raw( filename: String, mut buffer: Uint8Array, @@ -120,7 +120,7 @@ pub unsafe fn parse_sync_raw( /// # Panics /// /// Panics if source text is too long, or AST takes more memory than is available in the buffer. -#[napi] +#[napi(skip_typescript)] pub fn parse_async_raw( filename: String, buffer: Uint8Array,