feat(navigation): add prominent validation quickstart action
This commit is contained in:
parent
0bbcaba211
commit
9c6b184e39
28614 changed files with 4356173 additions and 23 deletions
351
validation-suite/frontend/atlas/node_modules/unrs-resolver/README.md
generated
vendored
Normal file
351
validation-suite/frontend/atlas/node_modules/unrs-resolver/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
<div align="center">
|
||||
|
||||
[![Crates.io][crates-badge]][crates-url]
|
||||
[![npmjs.com][npm-badge]][npm-url]
|
||||
|
||||
[![Docs.rs][docs-badge]][docs-url]
|
||||
[![Build Status][ci-badge]][ci-url]
|
||||
[![Code Coverage][code-coverage-badge]][code-coverage-url]
|
||||
[![CodSpeed Badge][codspeed-badge]][codspeed-url]
|
||||
[![Sponsors][sponsors-badge]][sponsors-url]
|
||||
[![MIT licensed][license-badge]][license-url]
|
||||
|
||||
</div>
|
||||
|
||||
# UnRS Resolver
|
||||
|
||||
Rust port of [enhanced-resolve], [tsconfig-paths-webpack-plugin] and [tsconfck]
|
||||
|
||||
- Released on [crates.io][crates-url] and [npm][npm-url].
|
||||
- Implements the [ESM](https://nodejs.org/api/esm.html#resolution-algorithm) and [CommonJS](https://nodejs.org/api/modules.html#all-together) module resolution algorithm specification.
|
||||
- Built-in [tsconfig-paths-webpack-plugin]
|
||||
- support extending tsconfig defined in `tsconfig.extends`
|
||||
- support paths alias defined in `tsconfig.compilerOptions.paths`
|
||||
- support project references defined `tsconfig.references`
|
||||
- support [template variable ${configDir} for substitution of config files directory path](https://github.com/microsoft/TypeScript/pull/58042)
|
||||
- Built-in tsconfig discovery ([tsconfck])
|
||||
- Supports in-memory file system via the `FileSystem` trait.
|
||||
- Contains `tracing` instrumentation.
|
||||
|
||||
## Usage
|
||||
|
||||
### npm package
|
||||
|
||||
See `index.d.ts` for `resolveSync` and `ResolverFactory` API.
|
||||
|
||||
Quick example:
|
||||
|
||||
```javascript
|
||||
import assert from "node:assert";
|
||||
import path from "node:path";
|
||||
|
||||
import resolve, { ResolverFactory } from "unrs-resolver";
|
||||
|
||||
// `resolve`
|
||||
assert(resolve.sync(process.cwd(), "./index.js").path, path.resolve("index.js"));
|
||||
|
||||
// `ResolverFactory`
|
||||
const resolver = new ResolverFactory();
|
||||
assert(resolver.sync(process.cwd(), "./index.js").path, path.resolve("index.js"));
|
||||
```
|
||||
|
||||
#### File-based Resolution
|
||||
|
||||
For file-based resolution with automatic tsconfig discovery, use `resolveFileSync` or `resolveFileAsync`:
|
||||
|
||||
```javascript
|
||||
const resolver = new ResolverFactory();
|
||||
|
||||
// Resolves from a file path (not directory)
|
||||
const result = resolver.resolveFileSync("/path/to/file.ts", "./module");
|
||||
|
||||
// Async version
|
||||
const result = await resolver.resolveFileAsync("/path/to/file.ts", "./module");
|
||||
```
|
||||
|
||||
**Key Differences:**
|
||||
|
||||
- `sync(directory, specifier)` - Takes a **directory path**, uses manually configured tsconfig if provided
|
||||
- `resolveFileSync(file, specifier)` - Takes a **file path**, automatically discovers tsconfig.json by traversing parent directories
|
||||
|
||||
**Why use `resolveFileSync`?**
|
||||
|
||||
When resolving from a specific file (e.g., in bundlers, linters, or language servers), `resolveFileSync` automatically finds the correct `tsconfig.json` by:
|
||||
|
||||
- Traversing parent directories from the file location
|
||||
- Respecting TypeScript project references
|
||||
- Honoring `include`, `exclude`, and `files` fields to determine which tsconfig applies
|
||||
- Ensuring tsconfig `paths` aliases work correctly based on the file's context
|
||||
|
||||
#### Supports WASM
|
||||
|
||||
See https://stackblitz.com/edit/unrs-resolver for usage example.
|
||||
|
||||
### Rust
|
||||
|
||||
See [docs.rs/unrs_resolver](https://docs.rs/unrs_resolver/latest/unrs_resolver/).
|
||||
|
||||
### [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp)
|
||||
|
||||
- For node.js, yarn pnp should work without any configuration, given the following conditions:
|
||||
- the program is called with the `yarn` command, where the value [`process.versions.pnp`](https://yarnpkg.com/advanced/pnpapi#processversionspnp) is set.
|
||||
- `.pnp.cjs` manifest file exists in the closest directory, searched from the current working directory,
|
||||
- no multi-project setup, per second bullet point in [FIND_PNP_MANIFEST](https://yarnpkg.com/advanced/pnp-spec#find_pnp_manifest)
|
||||
|
||||
## Terminology
|
||||
|
||||
### `directory`
|
||||
|
||||
An **absolute** path to a directory where the specifier is resolved against.
|
||||
|
||||
For CommonJS modules, it is the `__dirname` variable that contains the absolute path to the folder containing current module.
|
||||
|
||||
For ECMAScript modules, it is the value of `import.meta.dirname`.
|
||||
|
||||
Behavior is undefined when given a path to a file.
|
||||
|
||||
### `specifier`
|
||||
|
||||
The string passed to `require` or `import`, i.e. `require("specifier")` or `import "specifier"`
|
||||
|
||||
## Errors and Trouble Shooting
|
||||
|
||||
- `Error: Package subpath '.' is not defined by "exports" in` - occurs when resolving without `conditionNames`.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following usages apply to both Rust and Node.js; the code snippets are written in JavaScript.
|
||||
|
||||
To handle the `exports` field in `package.json`, ESM and CJS need to be differentiated.
|
||||
|
||||
### ESM
|
||||
|
||||
Per [ESM Resolution algorithm](https://nodejs.org/api/esm.html#resolution-and-loading-algorithm)
|
||||
|
||||
> defaultConditions is the conditional environment name array, ["node", "import"].
|
||||
|
||||
This means when the caller is an ESM import (`import "module"`), resolve options should be
|
||||
|
||||
```javascript
|
||||
{
|
||||
"conditionNames": ["node", "import"]
|
||||
}
|
||||
```
|
||||
|
||||
### CJS
|
||||
|
||||
Per [CJS Resolution algorithm](https://nodejs.org/api/modules.html#all-together)
|
||||
|
||||
> LOAD_PACKAGE_EXPORTS(X, DIR)
|
||||
>
|
||||
> 5. let MATCH = PACKAGE_EXPORTS_RESOLVE(pathToFileURL(DIR/NAME), "." + SUBPATH,
|
||||
> `package.json` "exports", ["node", "require"]) defined in the ESM resolver.
|
||||
|
||||
This means when the caller is a CJS require (`require("module")`), resolve options should be
|
||||
|
||||
```javascript
|
||||
{
|
||||
"conditionNames": ["node", "require"]
|
||||
}
|
||||
```
|
||||
|
||||
### Cache
|
||||
|
||||
To support both CJS and ESM with the same cache:
|
||||
|
||||
```javascript
|
||||
const esmResolver = new ResolverFactory({
|
||||
conditionNames: ["node", "import"],
|
||||
});
|
||||
|
||||
const cjsResolver = esmResolver.cloneWithOptions({
|
||||
conditionNames: ["node", "require"],
|
||||
});
|
||||
```
|
||||
|
||||
### Browser Field
|
||||
|
||||
From this [non-standard spec](https://github.com/defunctzombie/package-browser-field-spec):
|
||||
|
||||
> The `browser` field is provided to JavaScript bundlers or component tools when packaging modules for client side use.
|
||||
|
||||
The option is
|
||||
|
||||
```javascript
|
||||
{
|
||||
"aliasFields": ["browser"]
|
||||
}
|
||||
```
|
||||
|
||||
### Main Field
|
||||
|
||||
```javascript
|
||||
{
|
||||
"mainFields": ["module", "main"]
|
||||
}
|
||||
```
|
||||
|
||||
Quoting esbuild's documentation:
|
||||
|
||||
- `main` - This is [the standard field](https://docs.npmjs.com/files/package.json#main) for all packages that are meant to be used with node. The name main is hard-coded in to node's module resolution logic itself. Because it's intended for use with node, it's reasonable to expect that the file path in this field is a CommonJS-style module.
|
||||
- `module` - This field came from a [proposal](https://github.com/dherman/defense-of-dot-js/blob/f31319be735b21739756b87d551f6711bd7aa283/proposal.md) for how to integrate ECMAScript modules into node. Because of this, it's reasonable to expect that the file path in this field is an ECMAScript-style module. This proposal wasn't adopted by node (node uses "type": "module" instead) but it was adopted by major bundlers because ECMAScript-style modules lead to better tree shaking, or dead code removal.
|
||||
- `browser` - This field came from a [proposal](https://gist.github.com/defunctzombie/4339901/49493836fb873ddaa4b8a7aa0ef2352119f69211) that allows bundlers to replace node-specific files or modules with their browser-friendly versions. It lets you specify an alternate browser-specific entry point. Note that it is possible for a package to use both the browser and module field together (see the note below).
|
||||
|
||||
## Options
|
||||
|
||||
The following options are aligned with [enhanced-resolve], and is implemented for Rust crate usage.
|
||||
|
||||
See [index.d.ts](https://github.com/unrs/unrs-resolver/blob/main/napi/index.d.ts) for Node.js usage.
|
||||
|
||||
| Field | Default | Description |
|
||||
| ------------------------------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| alias | {} | A hash map of module alias configurations |
|
||||
| aliasFields | [] | A list of alias fields in description files |
|
||||
| extensionAlias | {} | An object which maps extension to extension aliases |
|
||||
| conditionNames | [] | A list of exports field condition names |
|
||||
| enforceExtension | false | Enforce that an extension from extensions must be used |
|
||||
| exportsFields | ["exports"] | A list of exports fields in description files |
|
||||
| extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files |
|
||||
| fallback | {} | Same as `alias`, but only used if default resolving fails |
|
||||
| fileSystem | | The file system which should be used |
|
||||
| fullySpecified | false | Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests) |
|
||||
| mainFields | ["main"] | A list of main fields in description files |
|
||||
| mainFiles | ["index"] | A list of main files in directories |
|
||||
| modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name. Absolute `NODE_PATH` entries are appended automatically when set. |
|
||||
| resolveToContext | false | Resolve to a context instead of a file |
|
||||
| preferRelative | false | Prefer to resolve module requests as relative request and fallback to resolving as module |
|
||||
| preferAbsolute | false | Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots |
|
||||
| restrictions | [] | A list of resolve restrictions |
|
||||
| roots | [] | A list of root paths |
|
||||
| symlinks | true | Whether to resolve symlinks to their symlinked location |
|
||||
| allowPackageExportsInDirectoryResolve | false | Allow `exports` field in `require('../directory')`. Not part of `enhanced-resolve`. |
|
||||
|
||||
### TypeScript Configuration
|
||||
|
||||
| Field | Default | Description |
|
||||
| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| tsconfig | None | TypeScript related config for resolver |
|
||||
| tsconfig.configFile | | A relative path to the tsconfig file based on `cwd`, or an absolute path to the tsconfig file. |
|
||||
| tsconfig.references | `[]` | - 'auto': inherits from TypeScript config <br/> - `string []`: relative path (based on directory of the referencing tsconfig file) or absolute path of referenced project's tsconfig |
|
||||
|
||||
### Unimplemented Options
|
||||
|
||||
| Field | Default | Description |
|
||||
| ---------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| descriptionFiles | ["package.json"] | A list of description files to read from |
|
||||
| cachePredicate | function() { return true }; | A function which decides whether a request should be cached or not. An object is passed to the function with `path` and `request` properties. |
|
||||
| cacheWithContext | true | If unsafe cache is enabled, includes `request.context` in the cache key |
|
||||
| plugins | [] | A list of additional resolve plugins which should be applied |
|
||||
| resolver | undefined | A prepared Resolver to which the plugins are attached |
|
||||
| unsafeCache | false | Use this cache object to unsafely cache the successful requests |
|
||||
|
||||
## Debugging
|
||||
|
||||
The following environment variable emits tracing information for the `unrs_resolver::resolve` function.
|
||||
|
||||
e.g.
|
||||
|
||||
```
|
||||
2024-06-11T07:12:20.003537Z DEBUG unrs_resolver: options: ResolveOptions { ... }, path: "...", specifier: "...", ret: "..."
|
||||
at /path/to/unrs_resolver-1.8.1/src/lib.rs:212
|
||||
in unrs_resolver::resolve with path: "...", specifier: "..."
|
||||
```
|
||||
|
||||
The input values are `options`, `path` and `specifier`, the returned value is `ret`.
|
||||
|
||||
### NAPI
|
||||
|
||||
```
|
||||
UNRS_LOG=DEBUG your_program
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
Tests are ported from
|
||||
|
||||
- [enhanced-resolve](https://github.com/webpack/enhanced-resolve/tree/main/test)
|
||||
- [tsconfig-path](https://github.com/dividab/tsconfig-paths/blob/master/src/__tests__/data/match-path-data.ts) and [parcel-resolver](https://github.com/parcel-bundler/parcel/tree/v2/packages/utils/node-resolver-core/test/fixture/tsconfig) for tsconfig-paths
|
||||
|
||||
Test cases are located in `./src/tests`, fixtures are located in `./tests`
|
||||
|
||||
- [x] alias.test.js
|
||||
- [x] browserField.test.js
|
||||
- [x] dependencies.test.js
|
||||
- [x] exportsField.test.js
|
||||
- [x] extension-alias.test.js
|
||||
- [x] extensions.test.js
|
||||
- [x] fallback.test.js
|
||||
- [x] fullSpecified.test.js
|
||||
- [x] identifier.test.js (see unit test in `crates/unrs_resolver/src/request.rs`)
|
||||
- [x] importsField.test.js
|
||||
- [x] incorrect-description-file.test.js (need to add ctx.fileDependencies)
|
||||
- [x] missing.test.js
|
||||
- [x] path.test.js (see unit test in `crates/unrs_resolver/src/path.rs`)
|
||||
- [ ] plugins.test.js
|
||||
- [ ] pnp.test.js
|
||||
- [x] resolve.test.js
|
||||
- [x] restrictions.test.js (partially done, regex is not supported yet)
|
||||
- [x] roots.test.js
|
||||
- [x] scoped-packages.test.js
|
||||
- [x] simple.test.js
|
||||
- [x] symlink.test.js
|
||||
|
||||
Irrelevant tests
|
||||
|
||||
- CachedInputFileSystem.test.js
|
||||
- SyncAsyncFileSystemDecorator.test.js
|
||||
- forEachBail.test.js
|
||||
- getPaths.test.js
|
||||
- pr-53.test.js
|
||||
- unsafe-cache.test.js
|
||||
- yield.test.js
|
||||
|
||||
## [Sponsored By](https://github.com/sponsors/JounQin)
|
||||
|
||||
[](https://github.com/sponsors/JounQin)
|
||||
|
||||
### Sponsors
|
||||
|
||||
| 1stG | UnRs | UnTS |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [](https://opencollective.com/1stG) | [](https://opencollective.com/unrs) | [](https://opencollective.com/unts) |
|
||||
|
||||
### Backers
|
||||
|
||||
| 1stG | UnRs | UnTS |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [](https://opencollective.com/1stG) | [](https://opencollective.com/unrs) | [](https://opencollective.com/unts) |
|
||||
|
||||
## 📖 License
|
||||
|
||||
`unrs_resolver` is free and open-source software licensed under the [MIT License](./LICENSE).
|
||||
|
||||
UnRS partially copies code from the following projects.
|
||||
|
||||
| Project | License |
|
||||
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
||||
| [webpack/enhanced-resolve](https://github.com/webpack/enhanced-resolve) | [MIT](https://github.com/webpack/enhanced-resolve/blob/main/LICENSE) |
|
||||
| [dividab/tsconfig-paths](https://github.com/dividab/tsconfig-paths) | [MIT](https://github.com/dividab/tsconfig-paths/blob/master/LICENSE) |
|
||||
| [parcel-bundler/parcel](https://github.com/parcel-bundler/parcel) | [MIT](https://github.com/parcel-bundler/parcel/blob/v2/LICENSE) |
|
||||
| [tmccombs/json-comments-rs](https://github.com/tmccombs/json-comments-rs) | [Apache 2.0](https://github.com/tmccombs/json-comments-rs/blob/main/LICENSE) |
|
||||
| [dominikg/tsconfck](https://github.com/dominikg/tsconfck) | [MIT](https://github.com/dominikg/tsconfck/blob/main/packages/tsconfck/LICENSE) |
|
||||
|
||||
[enhanced-resolve]: https://github.com/webpack/enhanced-resolve
|
||||
[tsconfig-paths-webpack-plugin]: https://github.com/dividab/tsconfig-paths-webpack-plugin
|
||||
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[license-url]: https://github.com/unrs/unrs-resolver/blob/main/LICENSE
|
||||
[ci-badge]: https://github.com/unrs/unrs-resolver/actions/workflows/ci.yml/badge.svg?event=push&branch=main
|
||||
[ci-url]: https://github.com/unrs/unrs-resolver/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain
|
||||
[code-coverage-badge]: https://codecov.io/github/unrs/unrs-resolver/branch/main/graph/badge.svg
|
||||
[code-coverage-url]: https://codecov.io/gh/unrs/unrs-resolver
|
||||
[sponsors-badge]: https://img.shields.io/github/sponsors/JounQin
|
||||
[sponsors-url]: https://github.com/sponsors/JounQin
|
||||
[codspeed-badge]: https://img.shields.io/endpoint?url=https://codspeed.io/badge.json
|
||||
[codspeed-url]: https://codspeed.io/unrs/unrs-resolver
|
||||
[crates-badge]: https://img.shields.io/crates/dr/unrs_resolver
|
||||
[crates-url]: https://crates.io/crates/unrs_resolver
|
||||
[docs-badge]: https://img.shields.io/docsrs/unrs_resolver
|
||||
[docs-url]: https://docs.rs/unrs_resolver/latest/unrs_resolver/
|
||||
[npm-badge]: https://img.shields.io/npm/dw/unrs-resolver?label=npm
|
||||
[npm-url]: https://npmx.dev/package/unrs-resolver
|
||||
[tsconfck]: https://github.com/dominikg/tsconfck
|
||||
1
validation-suite/frontend/atlas/node_modules/unrs-resolver/browser.js
generated
vendored
Normal file
1
validation-suite/frontend/atlas/node_modules/unrs-resolver/browser.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from '@unrs/resolver-binding-wasm32-wasi'
|
||||
311
validation-suite/frontend/atlas/node_modules/unrs-resolver/index.d.ts
generated
vendored
Normal file
311
validation-suite/frontend/atlas/node_modules/unrs-resolver/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,311 @@
|
|||
/* auto-generated by NAPI-RS */
|
||||
/* eslint-disable */
|
||||
export declare class ResolverFactory {
|
||||
constructor(options?: NapiResolveOptions | undefined | null)
|
||||
static default(): ResolverFactory
|
||||
/** Clone the resolver using the same underlying cache. */
|
||||
cloneWithOptions(options: NapiResolveOptions): ResolverFactory
|
||||
/**
|
||||
* Clear the underlying cache.
|
||||
*
|
||||
* Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result.
|
||||
*/
|
||||
clearCache(): void
|
||||
/** Synchronously resolve `specifier` at an absolute path to a `directory`. */
|
||||
sync(directory: string, request: string): ResolveResult
|
||||
/** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
|
||||
async(directory: string, request: string): Promise<ResolveResult>
|
||||
/**
|
||||
* Synchronously resolve `specifier` at an absolute path to a `file`.
|
||||
*
|
||||
* This method automatically discovers tsconfig.json by traversing parent directories.
|
||||
*/
|
||||
resolveFileSync(file: string, request: string): ResolveResult
|
||||
/**
|
||||
* Asynchronously resolve `specifier` at an absolute path to a `file`.
|
||||
*
|
||||
* This method automatically discovers tsconfig.json by traversing parent directories.
|
||||
*/
|
||||
resolveFileAsync(file: string, request: string): Promise<ResolveResult>
|
||||
/**
|
||||
* Synchronously resolve `specifier` for TypeScript declaration files.
|
||||
*
|
||||
* `file` is the absolute path to the containing file.
|
||||
* Uses TypeScript's `moduleResolution: "bundler"` algorithm.
|
||||
*/
|
||||
resolveDtsSync(file: string, request: string): ResolveResult
|
||||
/**
|
||||
* Asynchronously resolve `specifier` for TypeScript declaration files.
|
||||
*
|
||||
* `file` is the absolute path to the containing file.
|
||||
* Uses TypeScript's `moduleResolution: "bundler"` algorithm.
|
||||
*/
|
||||
resolveDtsAsync(file: string, request: string): Promise<ResolveResult>
|
||||
}
|
||||
|
||||
/** Node.js builtin module when `Options::builtin_modules` is enabled. */
|
||||
export interface Builtin {
|
||||
/**
|
||||
* Resolved module.
|
||||
*
|
||||
* Always prefixed with "node:" in compliance with the ESM specification.
|
||||
*/
|
||||
resolved: string
|
||||
/**
|
||||
* Whether the request was prefixed with `node:` or not.
|
||||
* `fs` -> `false`.
|
||||
* `node:fs` returns `true`.
|
||||
*/
|
||||
isRuntimeModule: boolean
|
||||
}
|
||||
|
||||
export declare const enum EnforceExtension {
|
||||
Auto = 0,
|
||||
Enabled = 1,
|
||||
Disabled = 2
|
||||
}
|
||||
|
||||
export declare const enum ModuleType {
|
||||
Module = 'module',
|
||||
CommonJs = 'commonjs',
|
||||
Json = 'json',
|
||||
Wasm = 'wasm',
|
||||
Addon = 'addon'
|
||||
}
|
||||
|
||||
/**
|
||||
* Module Resolution Options
|
||||
*
|
||||
* Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
|
||||
*
|
||||
* See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples
|
||||
*/
|
||||
export interface NapiResolveOptions {
|
||||
/**
|
||||
* Discover tsconfig automatically or use the specified tsconfig.json path.
|
||||
*
|
||||
* Default `None`
|
||||
*/
|
||||
tsconfig?: 'auto' | TsconfigOptions
|
||||
/**
|
||||
* Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
|
||||
*
|
||||
* For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
|
||||
* AliasValue::Path(String)`
|
||||
* Create aliases to import or require certain modules more easily.
|
||||
* A trailing $ can also be added to the given object's keys to signify an exact match.
|
||||
* Default `{}`
|
||||
*/
|
||||
alias?: Record<string, Array<string | undefined | null>>
|
||||
/**
|
||||
* A list of alias fields in description files.
|
||||
* Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
|
||||
* Can be a path to json object such as `["path", "to", "exports"]`.
|
||||
*
|
||||
* Default `[]`
|
||||
*/
|
||||
aliasFields?: (string | string[])[]
|
||||
/**
|
||||
* Condition names for exports field which defines entry points of a package.
|
||||
* The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
|
||||
*
|
||||
* Default `[]`
|
||||
*/
|
||||
conditionNames?: Array<string>
|
||||
/**
|
||||
* If true, it will not allow extension-less files.
|
||||
* So by default `require('./foo')` works if `./foo` has a `.js` extension,
|
||||
* but with this enabled only `require('./foo.js')` will work.
|
||||
*
|
||||
* Default to `true` when [ResolveOptions::extensions] contains an empty string.
|
||||
* Use `Some(false)` to disable the behavior.
|
||||
* See <https://github.com/webpack/enhanced-resolve/pull/285>
|
||||
*
|
||||
* Default None, which is the same as `Some(false)` when the above empty rule is not applied.
|
||||
*/
|
||||
enforceExtension?: EnforceExtension
|
||||
/**
|
||||
* A list of exports fields in description files.
|
||||
* Can be a path to json object such as `["path", "to", "exports"]`.
|
||||
*
|
||||
* Default `[["exports"]]`.
|
||||
*/
|
||||
exportsFields?: (string | string[])[]
|
||||
/**
|
||||
* Fields from `package.json` which are used to provide the internal requests of a package
|
||||
* (requests starting with # are considered internal).
|
||||
*
|
||||
* Can be a path to a JSON object such as `["path", "to", "imports"]`.
|
||||
*
|
||||
* Default `[["imports"]]`.
|
||||
*/
|
||||
importsFields?: (string | string[])[]
|
||||
/**
|
||||
* An object which maps extension to extension aliases.
|
||||
*
|
||||
* Default `{}`
|
||||
*/
|
||||
extensionAlias?: Record<string, Array<string>>
|
||||
/**
|
||||
* Attempt to resolve these extensions in order.
|
||||
* If multiple files share the same name but have different extensions,
|
||||
* will resolve the one with the extension listed first in the array and skip the rest.
|
||||
*
|
||||
* Default `[".js", ".json", ".node"]`
|
||||
*/
|
||||
extensions?: Array<string>
|
||||
/**
|
||||
* Redirect module requests when normal resolving fails.
|
||||
*
|
||||
* Default `{}`
|
||||
*/
|
||||
fallback?: Record<string, Array<string | undefined | null>>
|
||||
/**
|
||||
* Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests).
|
||||
*
|
||||
* See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified)
|
||||
*
|
||||
* Default `false`
|
||||
*/
|
||||
fullySpecified?: boolean
|
||||
/**
|
||||
* A list of main fields in description files
|
||||
*
|
||||
* Default `["main"]`.
|
||||
*/
|
||||
mainFields?: string | string[]
|
||||
/**
|
||||
* The filename to be used while resolving directories.
|
||||
*
|
||||
* Default `["index"]`
|
||||
*/
|
||||
mainFiles?: Array<string>
|
||||
/**
|
||||
* A list of directories to resolve modules from, can be absolute path or folder name.
|
||||
*
|
||||
* Default `["node_modules"]`
|
||||
*/
|
||||
modules?: string | string[]
|
||||
/**
|
||||
* Resolve to a context instead of a file.
|
||||
*
|
||||
* Default `false`
|
||||
*/
|
||||
resolveToContext?: boolean
|
||||
/**
|
||||
* Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
|
||||
*
|
||||
* Default `false`
|
||||
*/
|
||||
preferRelative?: boolean
|
||||
/**
|
||||
* Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
|
||||
*
|
||||
* Default `false`
|
||||
*/
|
||||
preferAbsolute?: boolean
|
||||
/**
|
||||
* A list of resolve restrictions to restrict the paths that a request can be resolved on.
|
||||
*
|
||||
* Default `[]`
|
||||
*/
|
||||
restrictions?: Array<Restriction>
|
||||
/**
|
||||
* A list of directories where requests of server-relative URLs (starting with '/') are resolved.
|
||||
* On non-Windows systems these requests are resolved as an absolute path first.
|
||||
*
|
||||
* Default `[]`
|
||||
*/
|
||||
roots?: Array<string>
|
||||
/**
|
||||
* Whether to resolve symlinks to their symlinked location.
|
||||
* When enabled, symlinked resources are resolved to their real path, not their symlinked location.
|
||||
* Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
|
||||
*
|
||||
* Default `true`
|
||||
*/
|
||||
symlinks?: boolean
|
||||
/**
|
||||
* Whether to read the `NODE_PATH` environment variable and append its entries to `modules`.
|
||||
*
|
||||
* `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution.
|
||||
* Set this to `false` to disable the behavior.
|
||||
*
|
||||
* Default `true`
|
||||
*/
|
||||
nodePath?: boolean
|
||||
/**
|
||||
* Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
|
||||
* For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
|
||||
*
|
||||
* Default `false`
|
||||
*/
|
||||
builtinModules?: boolean
|
||||
/**
|
||||
* Resolve [ResolveResult::moduleType].
|
||||
*
|
||||
* Default `false`
|
||||
*/
|
||||
moduleType?: boolean
|
||||
/**
|
||||
* Allow `exports` field in `require('../directory')`.
|
||||
*
|
||||
* This is not part of the spec but some vite projects rely on this behavior.
|
||||
* See
|
||||
* * <https://github.com/vitejs/vite/pull/20252>
|
||||
* * <https://github.com/nodejs/node/issues/58827>
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
allowPackageExportsInDirectoryResolve?: boolean
|
||||
}
|
||||
|
||||
export interface ResolveResult {
|
||||
path?: string
|
||||
error?: string
|
||||
builtin?: Builtin
|
||||
/**
|
||||
* Module type for this path.
|
||||
*
|
||||
* Enable with `ResolveOptions#moduleType`.
|
||||
*
|
||||
* The module type is computed `ESM_FILE_FORMAT` from the [ESM resolution algorithm specification](https://nodejs.org/docs/latest/api/esm.html#resolution-algorithm-specification).
|
||||
*
|
||||
* The algorithm uses the file extension or finds the closest `package.json` with the `type` field.
|
||||
*/
|
||||
moduleType?: ModuleType
|
||||
/** `package.json` path for the given module. */
|
||||
packageJsonPath?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
|
||||
* Use struct because napi don't support structured union now
|
||||
*/
|
||||
export interface Restriction {
|
||||
path?: string
|
||||
regex?: string
|
||||
}
|
||||
|
||||
export declare function sync(path: string, request: string): ResolveResult
|
||||
|
||||
/**
|
||||
* Tsconfig Options
|
||||
*
|
||||
* Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
|
||||
*/
|
||||
export interface TsconfigOptions {
|
||||
/**
|
||||
* Allows you to specify where to find the TypeScript configuration file.
|
||||
* You may provide
|
||||
* * a relative path to the configuration file. It will be resolved relative to cwd.
|
||||
* * an absolute path to the configuration file.
|
||||
*/
|
||||
configFile: string
|
||||
/**
|
||||
* Support for Typescript Project References.
|
||||
*
|
||||
* * `'auto'`: use the `references` field from tsconfig of `config_file`.
|
||||
*/
|
||||
references?: 'auto'
|
||||
}
|
||||
594
validation-suite/frontend/atlas/node_modules/unrs-resolver/index.js
generated
vendored
Normal file
594
validation-suite/frontend/atlas/node_modules/unrs-resolver/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,594 @@
|
|||
// prettier-ignore
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { readFileSync } = require('node:fs')
|
||||
let nativeBinding = null
|
||||
const loadErrors = []
|
||||
|
||||
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 = () => {
|
||||
let report = null
|
||||
if (typeof process.report?.getReport === 'function') {
|
||||
process.report.excludeNetwork = true
|
||||
report = process.report.getReport()
|
||||
}
|
||||
if (!report) {
|
||||
return null
|
||||
}
|
||||
if (report.header && report.header.glibcVersionRuntime) {
|
||||
return false
|
||||
}
|
||||
if (Array.isArray(report.sharedObjects)) {
|
||||
if (report.sharedObjects.some(isFileMusl)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
} catch (err) {
|
||||
loadErrors.push(err)
|
||||
}
|
||||
} else if (process.platform === 'android') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./resolver.android-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-android-arm64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-android-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./resolver.android-arm-eabi.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-android-arm-eabi')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-android-arm-eabi/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'win32') {
|
||||
if (process.arch === 'x64') {
|
||||
if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
|
||||
try {
|
||||
return require('./resolver.win32-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-win32-x64-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-win32-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./resolver.win32-x64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-win32-x64-msvc')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-win32-x64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ia32') {
|
||||
try {
|
||||
return require('./resolver.win32-ia32-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-win32-ia32-msvc')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-win32-ia32-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./resolver.win32-arm64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-win32-arm64-msvc')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-win32-arm64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'darwin') {
|
||||
try {
|
||||
return require('./resolver.darwin-universal.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-darwin-universal')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-darwin-universal/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./resolver.darwin-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-darwin-x64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-darwin-x64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./resolver.darwin-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-darwin-arm64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-darwin-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'freebsd') {
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./resolver.freebsd-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-freebsd-x64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-freebsd-x64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./resolver.freebsd-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-freebsd-arm64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-freebsd-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'linux') {
|
||||
if (process.arch === 'x64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./resolver.linux-x64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-x64-musl')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-x64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./resolver.linux-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-x64-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./resolver.linux-arm64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-arm64-musl')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-arm64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./resolver.linux-arm64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-arm64-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-arm64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./resolver.linux-arm-musleabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-arm-musleabihf')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-arm-musleabihf/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./resolver.linux-arm-gnueabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-arm-gnueabihf')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-arm-gnueabihf/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./resolver.linux-loong64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-loong64-musl')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-loong64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./resolver.linux-loong64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-loong64-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-loong64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'riscv64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./resolver.linux-riscv64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-riscv64-musl')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-riscv64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./resolver.linux-riscv64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-riscv64-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-riscv64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ppc64') {
|
||||
try {
|
||||
return require('./resolver.linux-ppc64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-ppc64-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-ppc64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 's390x') {
|
||||
try {
|
||||
return require('./resolver.linux-s390x-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-linux-s390x-gnu')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-linux-s390x-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./resolver.openharmony-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-openharmony-arm64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-openharmony-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./resolver.openharmony-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-openharmony-x64')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-openharmony-x64/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./resolver.openharmony-arm.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@unrs/resolver-binding-openharmony-arm')
|
||||
const bindingPackageVersion = require('@unrs/resolver-binding-openharmony-arm/package.json').version
|
||||
if (bindingPackageVersion !== '1.12.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 1.12.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
||||
}
|
||||
}
|
||||
|
||||
nativeBinding = requireNative()
|
||||
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
let wasiBinding = null
|
||||
let wasiBindingError = null
|
||||
try {
|
||||
wasiBinding = require('./resolver.wasi.cjs')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
wasiBindingError = err
|
||||
}
|
||||
}
|
||||
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
try {
|
||||
wasiBinding = require('@unrs/resolver-binding-wasm32-wasi')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
if (!wasiBindingError) {
|
||||
wasiBindingError = err
|
||||
} else {
|
||||
wasiBindingError.cause = err
|
||||
}
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
||||
error.cause = wasiBindingError
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) {
|
||||
try {
|
||||
nativeBinding = require('napi-postinstall/fallback')(require.resolve('./package.json'), true);
|
||||
} catch (err) {
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
if (loadErrors.length > 0) {
|
||||
throw new Error(
|
||||
`Cannot find native binding. ` +
|
||||
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
||||
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
||||
{
|
||||
cause: loadErrors.reduce((err, cur) => {
|
||||
cur.cause = err
|
||||
return cur
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
throw new Error(`Failed to load native binding`)
|
||||
}
|
||||
|
||||
module.exports = nativeBinding
|
||||
module.exports.ResolverFactory = nativeBinding.ResolverFactory
|
||||
module.exports.EnforceExtension = nativeBinding.EnforceExtension
|
||||
module.exports.ModuleType = nativeBinding.ModuleType
|
||||
module.exports.sync = nativeBinding.sync
|
||||
|
||||
if (process.versions.pnp) {
|
||||
process.env.UNRS_RESOLVER_YARN_PNP = '1'
|
||||
}
|
||||
89
validation-suite/frontend/atlas/node_modules/unrs-resolver/package.json
generated
vendored
Normal file
89
validation-suite/frontend/atlas/node_modules/unrs-resolver/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
"name": "unrs-resolver",
|
||||
"version": "1.12.2",
|
||||
"description": "UnRS Resolver Node API",
|
||||
"homepage": "https://github.com/unrs/unrs-resolver",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/unrs/unrs-resolver.git"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/unrs-resolver"
|
||||
},
|
||||
"files": [
|
||||
"browser.js",
|
||||
"index.d.ts",
|
||||
"index.js",
|
||||
"postinstall.js"
|
||||
],
|
||||
"main": "index.js",
|
||||
"browser": "browser.js",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node postinstall.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"napi-postinstall": "^0.3.4"
|
||||
},
|
||||
"napi": {
|
||||
"binaryName": "resolver",
|
||||
"packageName": "@unrs/resolver-binding",
|
||||
"targets": [
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-linux-android",
|
||||
"aarch64-pc-windows-msvc",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"aarch64-unknown-linux-musl",
|
||||
"aarch64-unknown-linux-ohos",
|
||||
"armv7-linux-androideabi",
|
||||
"armv7-unknown-linux-gnueabihf",
|
||||
"armv7-unknown-linux-musleabihf",
|
||||
"i686-pc-windows-msvc",
|
||||
"loongarch64-unknown-linux-gnu",
|
||||
"loongarch64-unknown-linux-musl",
|
||||
"powerpc64le-unknown-linux-gnu",
|
||||
"riscv64gc-unknown-linux-gnu",
|
||||
"riscv64gc-unknown-linux-musl",
|
||||
"s390x-unknown-linux-gnu",
|
||||
"wasm32-wasip1-threads",
|
||||
"x86_64-apple-darwin",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-unknown-freebsd",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-unknown-linux-musl"
|
||||
],
|
||||
"wasm": {
|
||||
"browser": {
|
||||
"fs": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@unrs/resolver-binding-darwin-arm64": "1.12.2",
|
||||
"@unrs/resolver-binding-android-arm64": "1.12.2",
|
||||
"@unrs/resolver-binding-win32-arm64-msvc": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-arm64-gnu": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-arm64-musl": "1.12.2",
|
||||
"@unrs/resolver-binding-openharmony-arm64": "1.12.2",
|
||||
"@unrs/resolver-binding-android-arm-eabi": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-arm-gnueabihf": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-arm-musleabihf": "1.12.2",
|
||||
"@unrs/resolver-binding-win32-ia32-msvc": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-loong64-gnu": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-loong64-musl": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-ppc64-gnu": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-riscv64-gnu": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-riscv64-musl": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-s390x-gnu": "1.12.2",
|
||||
"@unrs/resolver-binding-wasm32-wasi": "1.12.2",
|
||||
"@unrs/resolver-binding-darwin-x64": "1.12.2",
|
||||
"@unrs/resolver-binding-win32-x64-msvc": "1.12.2",
|
||||
"@unrs/resolver-binding-freebsd-x64": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-x64-gnu": "1.12.2",
|
||||
"@unrs/resolver-binding-linux-x64-musl": "1.12.2"
|
||||
}
|
||||
}
|
||||
5
validation-suite/frontend/atlas/node_modules/unrs-resolver/postinstall.js
generated
vendored
Normal file
5
validation-suite/frontend/atlas/node_modules/unrs-resolver/postinstall.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
const { checkAndPreparePackage } = require("napi-postinstall");
|
||||
|
||||
const packageJson = require("./package.json");
|
||||
|
||||
checkAndPreparePackage(packageJson, true);
|
||||
Loading…
Add table
Add a link
Reference in a new issue