Skip to content

Commit

Permalink
feat(airlight-resolve): introduce resolver [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Jan 4, 2024
1 parent 346a48d commit 5d0221c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/airlight-resolve/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# airlight-resolve \[WIP\]

\[WIP\] `require.resolve` faster implementation based on [oxc-resolver](https://github.com/oxc-project/oxc_resolver)

## Installation

```bash
npm install airlight-resolve --save-dev
# or
yarn add airlight-resolve -D
```

## License

MIT
29 changes: 29 additions & 0 deletions packages/airlight-resolve/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "airlight-resolve",
"version": "0.0.0",
"description": "[WIP] `require.resolve` faster implementation based on oxc-resolver",
"type": "module",
"main": "resolve.mjs",
"files": ["resolve.cjs", "resolve.mjs"],
"exports": {
"default": "./resolve.mjs",
"require": "./resolve.cjs"
},
"engines": {
"node": ">=18.19.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dalisoft/airlight.git"
},
"keywords": ["resolve", "require"],
"author": "dalisoft",
"license": "MIT",
"bugs": {
"url": "https://github.com/dalisoft/airlight/issues"
},
"homepage": "https://github.com/dalisoft/airlight#readme",
"dependencies": {
"oxc-resolver": "^0.0.3"
}
}
6 changes: 6 additions & 0 deletions packages/airlight-resolve/resolve.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { ResolverFactory } = require('oxc-resolver');

const factory = new ResolverFactory({});
module.exports = function customResolve(...args) {
return factory.sync(args[0], args.join('/')).path;
};
6 changes: 6 additions & 0 deletions packages/airlight-resolve/resolve.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ResolverFactory } from 'oxc-resolver';

const factory = new ResolverFactory({});
export default function customResolve(...args) {
return factory.sync(args[0], args.join('/')).path;
}

0 comments on commit 5d0221c

Please sign in to comment.