New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oxc-parser

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oxc-parser - npm Package Compare versions

Comparing version 0.38.0 to 0.39.0

6

bindings.js

@@ -364,6 +364,8 @@ // prettier-ignore

module.exports.moduleLexerAsync = nativeBinding.moduleLexerAsync
module.exports.moduleLexerSync = nativeBinding.moduleLexerSync
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind
module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind
module.exports.ImportNameKind = nativeBinding.ImportNameKind
module.exports.parseAsync = nativeBinding.parseAsync
module.exports.parseSync = nativeBinding.parseSync
module.exports.parseWithoutReturn = nativeBinding.parseWithoutReturn

@@ -12,88 +12,88 @@ /* auto-generated by NAPI-RS */

export interface ModuleLexer {
imports: Array<ModuleLexerImportSpecifier>
exports: Array<ModuleLexerExportSpecifier>
/**
* ESM syntax detection
*
* The use of ESM syntax: import / export statements and `import.meta`
*/
hasModuleSyntax: boolean
/** Facade modules that only use import / export syntax */
facade: boolean
export interface EcmaScriptModule {
/** Import Statements. */
staticImports: Array<StaticImport>
/** Export Statements. */
staticExports: Array<StaticExport>
}
/**
* # Panics
*
* * Tokio crashes
*/
export declare function moduleLexerAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ModuleLexer>
export interface ExportExportName {
kind: ExportExportNameKind
name?: string
start?: number
end?: number
}
export interface ModuleLexerExportSpecifier {
/** Exported name */
n: string
/** Local name, or undefined. */
ln?: string
/** Start of exported name */
s: number
/** End of exported name */
e: number
/** Start of local name */
ls?: number
/** End of local name */
le?: number
export declare const enum ExportExportNameKind {
/** `export { name } */
Name = 'Name',
/** `export default expression` */
Default = 'Default',
/** `export * from "mod" */
None = 'None'
}
export interface ModuleLexerImportSpecifier {
export interface ExportImportName {
kind: ExportImportNameKind
name?: string
start?: number
end?: number
}
export declare const enum ExportImportNameKind {
/** `export { name } */
Name = 'Name',
/** `export * as ns from "mod"` */
All = 'All',
/** `export * from "mod"` */
AllButDefault = 'AllButDefault',
/** Does not have a specifier. */
None = 'None'
}
export interface ExportLocalName {
kind: ExportLocalNameKind
name?: string
start?: number
end?: number
}
export declare const enum ExportLocalNameKind {
/** `export { name } */
Name = 'Name',
/** `export default expression` */
Default = 'Default',
/**
* Module name
*
* To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible.
*
* For dynamic import expressions, this field will be empty if not a valid JS string.
* If the exported value is not locally accessible from within the module.
* `export default function () {}`
*/
n?: string
/** Start of module specifier */
s: number
/** End of module specifier */
e: number
/** Start of import statement */
ss: number
/** End of import statement */
se: number
/**
* Import Type
* * If this import keyword is a dynamic import, this is the start value.
* * If this import keyword is a static import, this is -1.
* * If this import keyword is an import.meta expression, this is -2.
* * If this import is an `export *`, this is -3.
*/
d: number
/**
* If this import has an import assertion, this is the start value
* Otherwise this is `-1`.
*/
a: number
None = 'None'
}
/**
* Outputs the list of exports and locations of import specifiers,
* including dynamic import and import meta handling.
*
* # Panics
*
* * File extension is invalid
*/
export declare function moduleLexerSync(sourceText: string, options?: ParserOptions | undefined | null): ModuleLexer
export interface ImportName {
kind: ImportNameKind
name?: string
start?: number
end?: number
}
export declare const enum ImportNameKind {
/** `import { x } from "mod"` */
Name = 'Name',
/** `import * as ns from "mod"` */
NamespaceObject = 'NamespaceObject',
/** `import defaultExport from "mod"` */
Default = 'Default'
}
/**
* # Panics
* Parse asynchronously.
*
* * Tokio crashes
* Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
*/
export declare function parseAsync(sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
export declare function parseAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
export interface ParseResult {
program: import("@oxc-project/types").Program
module: EcmaScriptModule
comments: Array<Comment>

@@ -103,10 +103,6 @@ errors: Array<string>

/**
* Babel Parser Options
*
* <https://github.com/babel/babel/blob/v7.26.2/packages/babel-parser/typings/babel-parser.d.ts>
*/
export interface ParserOptions {
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
sourceFilename?: string
/** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
lang?: 'js' | 'jsx' | 'ts' | 'tsx'
/**

@@ -124,20 +120,91 @@ * Emit `ParenthesizedExpression` in AST.

/**
* # Panics
*
* * File extension is invalid
* * Serde JSON serialization
*/
export declare function parseSync(sourceText: string, options?: ParserOptions | undefined | null): ParseResult
/** Parse synchronously. */
export declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult
/**
* Parse without returning anything.
*
* This is for benchmark purposes such as measuring napi communication overhead.
*
* # Panics
*
* * File extension is invalid
* * Serde JSON serialization
*/
export declare function parseWithoutReturn(sourceText: string, options?: ParserOptions | undefined | null): void
export declare function parseWithoutReturn(filename: string, sourceText: string, options?: ParserOptions | undefined | null): void
export interface StaticExport {
start: number
end: number
entries: Array<StaticExportEntry>
}
export interface StaticExportEntry {
start: number
end: number
moduleRequest?: ValueSpan
/** The name under which the desired binding is exported by the module`. */
importName: ExportImportName
/** The name used to export this binding by this module. */
exportName: ExportExportName
/** The name that is used to locally access the exported value from within the importing module. */
localName: ExportLocalName
}
export interface StaticImport {
/** Start of import statement. */
start: number
/** End of import statement. */
end: number
/**
* Import source.
*
* ```js
* import { foo } from "mod";
* // ^^^
* ```
*/
moduleRequest: ValueSpan
/**
* Import specifiers.
*
* Empty for `import "mod"`.
*/
entries: Array<StaticImportEntry>
}
export interface StaticImportEntry {
/**
* The name under which the desired binding is exported by the module.
*
* ```js
* import { foo } from "mod";
* // ^^^
* import { foo as bar } from "mod";
* // ^^^
* ```
*/
importName: ImportName
/**
* The name that is used to locally access the imported value from within the importing module.
* ```js
* import { foo } from "mod";
* // ^^^
* import { foo as bar } from "mod";
* // ^^^
* ```
*/
localName: ValueSpan
/**
* Whether this binding is for a TypeScript type-only import.
*
* `true` for the following imports:
* ```ts
* import type { foo } from "mod";
* import { type foo } from "mod";
* ```
*/
isType: boolean
}
export interface ValueSpan {
value: string
start: number
end: number
}
const bindings = require('./bindings.js');
module.exports.moduleLexerAsync = bindings.moduleLexerAsync;
module.exports.moduleLexerSync = bindings.moduleLexerSync;
module.exports.parseWithoutReturn = bindings.parseWithoutReturn;

@@ -6,0 +4,0 @@

{
"name": "oxc-parser",
"version": "0.38.0",
"version": "0.39.0",
"description": "Oxc Parser Node API",

@@ -27,14 +27,14 @@ "keywords": [

"dependencies": {
"@oxc-project/types": "^0.38.0"
"@oxc-project/types": "^0.39.0"
},
"optionalDependencies": {
"@oxc-parser/binding-win32-x64-msvc": "0.38.0",
"@oxc-parser/binding-win32-arm64-msvc": "0.38.0",
"@oxc-parser/binding-linux-x64-gnu": "0.38.0",
"@oxc-parser/binding-linux-arm64-gnu": "0.38.0",
"@oxc-parser/binding-linux-x64-musl": "0.38.0",
"@oxc-parser/binding-linux-arm64-musl": "0.38.0",
"@oxc-parser/binding-darwin-x64": "0.38.0",
"@oxc-parser/binding-darwin-arm64": "0.38.0"
"@oxc-parser/binding-win32-x64-msvc": "0.39.0",
"@oxc-parser/binding-win32-arm64-msvc": "0.39.0",
"@oxc-parser/binding-linux-x64-gnu": "0.39.0",
"@oxc-parser/binding-linux-arm64-gnu": "0.39.0",
"@oxc-parser/binding-linux-x64-musl": "0.39.0",
"@oxc-parser/binding-linux-arm64-musl": "0.39.0",
"@oxc-parser/binding-darwin-x64": "0.39.0",
"@oxc-parser/binding-darwin-arm64": "0.39.0"
}
}

@@ -10,8 +10,7 @@ # The JavaScript Oxidation Compiler

const sourceText = "let foo: Foo = 'foo';";
// Filename extension is used to determine which
// dialect to parse source as
const options = { sourceFilename: 'text.tsx' };
// Filename extension is used to determine which dialect to parse source as.
const filename = 'test.tsx';
test(oxc.parseSync(sourceText, options));
test(await oxc.parseAsync(sourceText, options));
test(oxc.parseSync(filename, sourceText, options));
test(await oxc.parseAsync(filename, sourceText, options));

@@ -18,0 +17,0 @@ function test(ret) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc