Skip to content

Commit c70bbbf

Browse files
committed
Init
0 parents  commit c70bbbf

31 files changed

+4565
-0
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
7+
[*.{js,json,yml}]
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 2

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.yarn/** linguist-vendored
2+
/.yarn/releases/* binary
3+
/.yarn/plugins/**/* binary
4+
/.pnp.* binary linguist-generated

.gitignore

+243
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
.yarn/*
2+
!.yarn/patches
3+
!.yarn/plugins
4+
!.yarn/releases
5+
!.yarn/sdks
6+
!.yarn/versions
7+
8+
# Swap the comments on the following lines if you wish to use zero-installs
9+
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
10+
# Documentation here: https://yarnpkg.com/features/caching#zero-installs
11+
12+
#!.yarn/cache
13+
.pnp.*
14+
15+
16+
### Created by https://www.gitignore.io
17+
### Node ###
18+
# Logs
19+
logs
20+
*.log
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
lerna-debug.log*
25+
.pnpm-debug.log*
26+
27+
# Diagnostic reports (https://nodejs.org/api/report.html)
28+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
29+
30+
# Runtime data
31+
pids
32+
*.pid
33+
*.seed
34+
*.pid.lock
35+
36+
# Directory for instrumented libs generated by jscoverage/JSCover
37+
lib-cov
38+
39+
# Coverage directory used by tools like istanbul
40+
coverage
41+
*.lcov
42+
43+
# nyc test coverage
44+
.nyc_output
45+
46+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
47+
.grunt
48+
49+
# Bower dependency directory (https://bower.io/)
50+
bower_components
51+
52+
# node-waf configuration
53+
.lock-wscript
54+
55+
# Compiled binary addons (https://nodejs.org/api/addons.html)
56+
build/Release
57+
58+
# Dependency directories
59+
node_modules/
60+
jspm_packages/
61+
62+
# Snowpack dependency directory (https://snowpack.dev/)
63+
web_modules/
64+
65+
# TypeScript cache
66+
*.tsbuildinfo
67+
68+
# Optional npm cache directory
69+
.npm
70+
71+
# Optional eslint cache
72+
.eslintcache
73+
74+
# Optional stylelint cache
75+
.stylelintcache
76+
77+
# Microbundle cache
78+
.rpt2_cache/
79+
.rts2_cache_cjs/
80+
.rts2_cache_es/
81+
.rts2_cache_umd/
82+
83+
# Optional REPL history
84+
.node_repl_history
85+
86+
# Output of 'npm pack'
87+
*.tgz
88+
89+
# Yarn Integrity file
90+
.yarn-integrity
91+
92+
# dotenv environment variable files
93+
.env
94+
.env.development.local
95+
.env.test.local
96+
.env.production.local
97+
.env.local
98+
99+
# parcel-bundler cache (https://parceljs.org/)
100+
.cache
101+
.parcel-cache
102+
103+
# Next.js build output
104+
.next
105+
out
106+
107+
# Nuxt.js build / generate output
108+
.nuxt
109+
dist
110+
111+
# Gatsby files
112+
.cache/
113+
# Comment in the public line in if your project uses Gatsby and not Next.js
114+
# https://nextjs.org/blog/next-9-1#public-directory-support
115+
# public
116+
117+
# vuepress build output
118+
.vuepress/dist
119+
120+
# vuepress v2.x temp and cache directory
121+
.temp
122+
.cache
123+
124+
# Docusaurus cache and generated files
125+
.docusaurus
126+
127+
# Serverless directories
128+
.serverless/
129+
130+
# FuseBox cache
131+
.fusebox/
132+
133+
# DynamoDB Local files
134+
.dynamodb/
135+
136+
# TernJS port file
137+
.tern-port
138+
139+
# Stores VSCode versions used for testing VSCode extensions
140+
.vscode-test
141+
142+
# yarn v2
143+
.yarn/cache
144+
.yarn/unplugged
145+
.yarn/build-state.yml
146+
.yarn/install-state.gz
147+
.pnp.*
148+
149+
### Node Patch ###
150+
# Serverless Webpack directories
151+
.webpack/
152+
153+
# Optional stylelint cache
154+
.stylelintcache
155+
156+
# SvelteKit build / generate output
157+
.svelte-kit
158+
159+
160+
161+
### Created by https://www.gitignore.io
162+
### macOS ###
163+
# General
164+
.DS_Store
165+
.AppleDouble
166+
.LSOverride
167+
168+
# Icon must end with two \r
169+
Icon
170+
171+
# Thumbnails
172+
._*
173+
174+
# Files that might appear in the root of a volume
175+
.DocumentRevisions-V100
176+
.fseventsd
177+
.Spotlight-V100
178+
.TemporaryItems
179+
.Trashes
180+
.VolumeIcon.icns
181+
.com.apple.timemachine.donotpresent
182+
183+
# Directories potentially created on remote AFP share
184+
.AppleDB
185+
.AppleDesktop
186+
Network Trash Folder
187+
Temporary Items
188+
.apdisk
189+
190+
### macOS Patch ###
191+
# iCloud generated files
192+
*.icloud
193+
194+
195+
196+
### Created by https://www.gitignore.io
197+
### Windows ###
198+
# Windows thumbnail cache files
199+
Thumbs.db
200+
Thumbs.db:encryptable
201+
ehthumbs.db
202+
ehthumbs_vista.db
203+
204+
# Dump file
205+
*.stackdump
206+
207+
# Folder config file
208+
[Dd]esktop.ini
209+
210+
# Recycle Bin used on file shares
211+
$RECYCLE.BIN/
212+
213+
# Windows Installer files
214+
*.cab
215+
*.msi
216+
*.msix
217+
*.msm
218+
*.msp
219+
220+
# Windows shortcuts
221+
*.lnk
222+
223+
224+
225+
### Created by https://www.gitignore.io
226+
### Rust ###
227+
# Generated by Cargo
228+
# will have compiled files and executables
229+
debug/
230+
target/
231+
232+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
233+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
234+
Cargo.lock
235+
236+
# These are backup files generated by rustfmt
237+
**/*.rs.bk
238+
239+
# MSVC Windows builds of rustc generate these, which store debugging information
240+
*.pdb
241+
242+
*.node
243+
*.wasm

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packages/*/*.wasi.cjs
2+
packages/*/index.js
3+
packages/*/browser.js
4+
packages/*/wasi-worker*
5+
packages/*/index.d.ts

.taplo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exclude = ["node_modules/**/*.toml"]
2+
3+
# https://taplo.tamasfe.dev/configuration/formatter-options.html
4+
[formatting]
5+
align_entries = true
6+
indent_tables = true
7+
reorder_keys = true
8+
column_width = 180

Cargo.toml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[package]
2+
authors = ["LongYinan <[email protected]>"]
3+
edition = "2021"
4+
name = "oxc-node"
5+
version = "0.0.0"
6+
7+
[lib]
8+
crate-type = ["cdylib"]
9+
10+
[dependencies]
11+
napi = { version = "3.0.0-alpha.3", default-features = false, features = ["async", "serde-json"] }
12+
napi-derive = { version = "3.0.0-alpha.3", default-features = false, features = ["type-def"] }
13+
oxc = { version = "0.16", features = ["codegen", "transformer"] }
14+
oxc_resolver = "1"
15+
phf = "0.11"
16+
serde = { version = "1.0", features = ["derive"] }
17+
tracing = "0.1"
18+
19+
[target.'cfg(not(target_family = "wasm"))'.dependencies]
20+
tracing-subscriber = { version = "0.3", default-features = false, features = ["std", "fmt"] } # Omit the `regex` feature
21+
22+
[target.'cfg(not(target_os = "linux"))'.dependencies]
23+
mimalloc = "0.1"
24+
25+
[target.'cfg(all(target_os = "linux", not(target_arch = "arm")))'.dependencies]
26+
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }
27+
28+
[build-dependencies]
29+
napi-build = "2"
30+
31+
[profile.release]
32+
codegen-units = 1
33+
lto = true
34+
strip = "symbols"

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# oxc-node
2+
3+
Fast and friendly Node.js devtools based on [OXC](https://github.com/oxc-project/oxc)

build.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
napi_build::setup();
3+
}

package.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "oxc-node",
3+
"packageManager": "[email protected]",
4+
"devDependencies": {
5+
"@napi-rs/cli": "^3.0.0-alpha.56",
6+
"@napi-rs/wasm-runtime": "^0.2.4",
7+
"@oxc/node-core": "workspace:*",
8+
"@taplo/cli": "^0.7.0",
9+
"@types/node": "^20.14.9",
10+
"ava": "^6.1.3",
11+
"cross-env": "^7.0.3",
12+
"husky": "^9.0.11",
13+
"lint-staged": "^15.2.7",
14+
"oxlint": "^0.5.2",
15+
"prettier": "^3.3.2",
16+
"typescript": "^5.5.3"
17+
},
18+
"scripts": {
19+
"build:rs": "napi build --platform --release -o packages/core",
20+
"format": "taplo fmt && prettier --write . && cargo fmt",
21+
"test": "pnpm --filter=integrate-module run test:module"
22+
},
23+
"lint-staged": {
24+
"*.@(js|ts|tsx|yml|yaml|md|json|html)": [
25+
"prettier --write"
26+
],
27+
"*.@(js|ts|tsx)": [
28+
"oxlint --fix"
29+
]
30+
},
31+
"prettier": {
32+
"printWidth": 120,
33+
"semi": false,
34+
"trailingComma": "all",
35+
"singleQuote": true,
36+
"arrowParens": "always"
37+
},
38+
"napi": {
39+
"binaryName": "oxc-node",
40+
"targets": [
41+
"x86_64-apple-darwin",
42+
"aarch64-apple-darwin",
43+
"x86_64-pc-windows-msvc",
44+
"x86_64-unknown-linux-gnu",
45+
"aarch64-linux-android",
46+
"aarch64-unknown-linux-gnu",
47+
"aarch64-unknown-linux-musl",
48+
"aarch64-pc-windows-msvc",
49+
"armv7-unknown-linux-gnueabihf",
50+
"x86_64-unknown-linux-musl",
51+
"i686-pc-windows-msvc",
52+
"armv7-linux-androideabi",
53+
"wasm32-wasip1-threads"
54+
]
55+
}
56+
}

packages/core/esm.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { load, resolve as oxcResolve } from './index.js'
2+
3+
const resolve = async (request, context, next) => {
4+
const result = await oxcResolve(request, context, next)
5+
result.shortCircuit = true
6+
return result
7+
}
8+
9+
export { load, resolve }

0 commit comments

Comments
 (0)