Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oxc-resolver

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oxc-resolver - npm Package Compare versions

Comparing version 0.0.3 to 0.1.1

browser.js

51

index.d.ts

@@ -1,6 +0,20 @@

/* tslint:disable */
/* auto-generated by NAPI-RS */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export class ResolverFactory {
constructor(options: NapiResolveOptions)
static default(): ResolverFactory
/** Clone the resolver using the same underlying cache. */
cloneWithOptions(options: NapiResolveOptions): ResolverFactory
/** Clear the underlying cache. */
clearCache(): void
sync(path: string, request: string): ResolveResult
}
export const enum EnforceExtension {
Auto = 0,
Enabled = 1,
Disabled = 2
}
/**

@@ -22,2 +36,3 @@ * Module Resolution Options

* Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
*
* For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->

@@ -27,3 +42,2 @@ * AliasValue::Path(String)`

* A trailing $ can also be added to the given object's keys to signify an exact match.
*
*/

@@ -38,3 +52,3 @@ alias?: Record<string, Array<string | undefined | null>>

*/
aliasFields?: Array<Array<string>>
aliasFields?: (string | string[])[]
/**

@@ -71,3 +85,3 @@ * Condition names for exports field which defines entry points of a package.

*/
exportsFields?: Array<Array<string>>
exportsFields?: (string | string[])[]
/**

@@ -106,3 +120,3 @@ * An object which maps extension to extension aliases.

*/
mainFields?: Array<string>
mainFields?: string | string[]
/**

@@ -119,3 +133,3 @@ * The filename to be used while resolving directories.

*/
modules?: Array<string>
modules?: string | string[]
/**

@@ -168,7 +182,8 @@ * Resolve to a context instead of a file.

}
export const enum EnforceExtension {
Auto = 0,
Enabled = 1,
Disabled = 2
export interface ResolveResult {
path?: string
error?: string
}
/**

@@ -182,2 +197,5 @@ * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].

}
export function sync(path: string, request: string): ResolveResult
/**

@@ -204,11 +222,2 @@ * Tsconfig Options

}
export interface ResolveResult {
path?: string
error?: string
}
export function sync(path: string, request: string): ResolveResult
export class ResolverFactory {
constructor(op: NapiResolveOptions)
static default(): ResolverFactory
sync(path: string, request: string): ResolveResult
}

@@ -1,5 +0,3 @@

/* tslint:disable */
// prettier-ignore
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */

@@ -16,17 +14,51 @@

function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim();
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
const isMusl = () => {
let musl = false
if (process.platform === 'linux') {
musl = isMuslFromFilesystem()
if (musl === null) {
musl = isMuslFromReport()
}
if (musl === null) {
musl = isMuslFromChildProcess()
}
}
return musl
}
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
const isMuslFromFilesystem = () => {
try {
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
} catch {
return null
}
}
const isMuslFromReport = () => {
const report = typeof process.report.getReport === 'function' ? process.report.getReport() : null
if (!report) {
return null
}
if (report.header && report.header.glibcVersionRuntime) {
return false
}
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) {
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
return false
}
const isMuslFromChildProcess = () => {
try {
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
} catch (e) {
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
return false
}
}
switch (platform) {

@@ -241,2 +273,45 @@ case 'android':

break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'resolver.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./resolver.linux-riscv64-musl.node')
} else {
nativeBinding = require('@oxc-resolver/binding-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'resolver.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./resolver.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@oxc-resolver/binding-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'resolver.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./resolver.linux-s390x-gnu.node')
} else {
nativeBinding = require('@oxc-resolver/binding-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:

@@ -250,2 +325,17 @@ throw new Error(`Unsupported architecture on Linux: ${arch}`)

if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
try {
nativeBinding = require('./resolver.wasi.cjs')
} catch {
// ignore
}
if (!nativeBinding) {
try {
nativeBinding = require('@oxc-resolver/binding-wasm32-wasi')
} catch (err) {
console.error(err)
}
}
}
if (!nativeBinding) {

@@ -258,6 +348,4 @@ if (loadError) {

const { EnforceExtension, ResolverFactory, sync } = nativeBinding
module.exports.EnforceExtension = EnforceExtension
module.exports.ResolverFactory = ResolverFactory
module.exports.sync = sync
module.exports.ResolverFactory = nativeBinding.ResolverFactory
module.exports.EnforceExtension = nativeBinding.EnforceExtension
module.exports.sync = nativeBinding.sync

@@ -1,1 +0,53 @@

{"name":"oxc-resolver","version":"0.0.3","description":"Oxc Resolver Node API","main":"index.js","files":["index.d.ts","index.js"],"license":"MIT","homepage":"https://oxc-project.github.io","repository":{"type":"git","url":"https://github.com/oxc-project/oxc_resolver"},"funding":{"url":"https://github.com/sponsors/Boshen"},"optionalDependencies":{"@oxc-resolver/binding-win32-x64-msvc":"0.0.3","@oxc-resolver/binding-win32-arm64-msvc":"0.0.3","@oxc-resolver/binding-linux-x64-gnu":"0.0.3","@oxc-resolver/binding-linux-arm64-gnu":"0.0.3","@oxc-resolver/binding-darwin-x64":"0.0.3","@oxc-resolver/binding-darwin-arm64":"0.0.3"}}
{
"name": "oxc-resolver",
"version": "0.1.1",
"description": "Oxc Resolver Node API",
"main": "index.js",
"browser": "browser.js",
"files": [
"index.d.ts",
"index.js",
"browser.js"
],
"license": "MIT",
"homepage": "https://oxc-project.github.io",
"repository": {
"type": "git",
"url": "git+https://github.com/oxc-project/oxc_resolver.git"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"napi": {
"binaryName": "resolver",
"packageName": "@oxc-resolver/binding",
"targets": [
"x86_64-pc-windows-msvc",
"aarch64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"armv7-unknown-linux-gnueabihf",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"wasm32-wasi-preview1-threads"
]
},
"funding": {
"url": "https://github.com/sponsors/Boshen"
},
"optionalDependencies": {
"@oxc-resolver/binding-win32-x64-msvc": "0.1.1",
"@oxc-resolver/binding-win32-arm64-msvc": "0.1.1",
"@oxc-resolver/binding-linux-x64-gnu": "0.1.1",
"@oxc-resolver/binding-linux-x64-musl": "0.1.1",
"@oxc-resolver/binding-linux-arm64-gnu": "0.1.1",
"@oxc-resolver/binding-linux-arm64-musl": "0.1.1",
"@oxc-resolver/binding-linux-arm-gnueabihf": "0.1.1",
"@oxc-resolver/binding-darwin-x64": "0.1.1",
"@oxc-resolver/binding-darwin-arm64": "0.1.1",
"@oxc-resolver/binding-wasm32-wasi": "0.1.1"
}
}
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