Skip to content

Commit

Permalink
feat(register): support resolve file:// path (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jul 12, 2024
1 parent 6130383 commit a190419
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ jobs:
node:
- '18'
- '20'
exclude:
# too slow
- target: aarch64-unknown-linux-gnu
node: '18'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Transformer and register for Node.js projects.
### Usage

```bash
node --import @oxc-node/core ./path/to/entry.ts
node --import @oxc-node/core/register ./path/to/entry.ts
```
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"packageManager": "pnpm@9.5.0",
"devDependencies": {
"@napi-rs/cli": "^3.0.0-alpha.56",
"@napi-rs/cli": "^3.0.0-alpha.58",
"@napi-rs/wasm-runtime": "^0.2.4",
"@oxc-node/core": "workspace:*",
"@taplo/cli": "^0.7.0",
Expand All @@ -25,7 +25,7 @@
"build": "napi build --platform --release -o packages/core --package-json-path packages/core/package.json",
"format": "taplo fmt && prettier --write . && cargo fmt",
"lint": "oxlint",
"test": "pnpm --filter=integrate-module* run test",
"test": "pnpm --sequential --filter=integrate* run test",
"prepare": "husky"
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Transformer and register for Node.js projects.
## Usage

```bash
node --import @oxc-node/core ./path/to/entry.ts
node --import @oxc-node/core/register ./path/to/entry.ts
```
7 changes: 7 additions & 0 deletions packages/integrate-ava/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { transform } from '@oxc-node/core'
import test from 'ava'

test('transform', (t) => {
const result = transform('foo.ts', 'const foo: number = 1')
t.is(result.source(), 'const foo = 1;\n')
})
22 changes: 22 additions & 0 deletions packages/integrate-ava/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "integrate-ava",
"private": true,
"type": "module",
"scripts": {
"test": "ava"
},
"devDependencies": {
"@oxc-node/core": "workspace:*",
"ava": "^6.1.3"
},
"ava": {
"extensions": {
"ts": "module"
},
"cache": false,
"nodeArguments": [
"--import",
"@oxc-node/core/register"
]
}
}
10 changes: 10 additions & 0 deletions packages/integrate-ava/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler"
},
"references": [{ "path": "../core" }]
}
Loading

0 comments on commit a190419

Please sign in to comment.