Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
641 commits
Select commit Hold shift + click to select a range
f16151e
fix(vite-node): correctly resolve virtual modules (#3544)
sheremet-va Jun 15, 2023
e77b9cf
fix(vite-node): fix errors caused by commonjs export circular referen…
rxliuli Jun 15, 2023
08f9896
chore: release v0.32.1
sheremet-va Jun 16, 2023
8ef8131
chore: release v0.32.2
sheremet-va Jun 16, 2023
8a62049
chore(deps): update all non-major dependencies (#3315)
renovate[bot] Jun 20, 2023
1797f38
chore(deps): update all non-major dependencies (#3662)
renovate[bot] Jun 28, 2023
a3494d7
chore: release v0.32.3
sheremet-va Jul 3, 2023
c8b5ff8
chore: release v0.32.4
sheremet-va Jul 3, 2023
4b036e2
fix(vite-node): don't fail when importing Promise module
sheremet-va Jul 4, 2023
630303e
fix(vite-node): allow importing node:test
sheremet-va Jul 4, 2023
1acc210
chore: release v0.33.0
sheremet-va Jul 6, 2023
db9ceb1
feat!: remove `@vitest/coverage-c8` package (#3614)
AriPerkkio Jul 11, 2023
37db78f
fix(vite-node): always treat node_modules as modulesDirectory (#3830)
sheremet-va Jul 28, 2023
589fb23
feat(vite-node): make CLI arguments parsing behavior consistent with …
rxliuli Jul 28, 2023
f689c97
chore: improve helpers to test vite-node (#3842)
sheremet-va Jul 29, 2023
797f68a
fix(vite-node): normalize drive letter to keep the same reference to …
sheremet-va Jul 29, 2023
d1bfc6c
fix(vite-node): correctly resolve hmr filepath (#3834)
sheremet-va Jul 29, 2023
87a07d1
feat: running vitest with `--related --watch` reruns non-affected tes…
sheremet-va Jul 30, 2023
202d469
feat: introduce `server` option (#3725)
fenghan34 Jul 31, 2023
3776331
feat!: support running tests using VM context (#3203)
sheremet-va Aug 1, 2023
b2153d3
chore: release v0.34.0
sheremet-va Aug 1, 2023
5dcea8b
chore: release v0.34.1
sheremet-va Aug 1, 2023
3f1b6e5
feat: allow importing CSS and assets inside external dependencies (#3…
sheremet-va Aug 3, 2023
7f12d6f
fix: define process variable and using import.meta.env together did n…
Dunqing Aug 15, 2023
05a7238
chore: release v0.34.2
sheremet-va Aug 17, 2023
392c0b3
fix(vite-node): inline HMR types (#3993)
sheremet-va Aug 21, 2023
87e50db
chore: release v0.34.3
sheremet-va Aug 25, 2023
c950819
chore(vite-node): update `ViteNodeServer` options link (#4054)
btea Aug 31, 2023
506d2e4
fix(vite-node): check more precisely for root/base paths (#4049)
danielroe Aug 31, 2023
8eea26d
chore: update sources type for vite 5 (#4069)
bluwy Sep 7, 2023
6a0f649
docs(vite-node): fix typos in vite-node README (#4082)
mkantor Sep 8, 2023
c92d26a
chore: release v0.34.4
sheremet-va Sep 8, 2023
02b2dba
build: upgrade to rollup@3 and fix re-export error (#4108)
Dunqing Sep 15, 2023
d32c1d7
fix(vite-node): export `SourceMapInput` to fix CYCLIC_CROSS_CHUNK_REE…
Dunqing Sep 15, 2023
3423491
fix(vite-node): align vite dependency version with vitest
sheremet-va Sep 18, 2023
6402c54
chore: release v0.34.5
sheremet-va Sep 21, 2023
da2d846
chore: release v0.34.6
sheremet-va Sep 29, 2023
4229d3d
chore: release v1.0.0-beta.0
sheremet-va Oct 2, 2023
ad7c8b6
fix(vite-node): have a separate cache for web/ssr transforms (#4221)
sheremet-va Oct 3, 2023
0e0b424
fix(vite-node): mjs files watch not work (#3982)
Dunqing Oct 3, 2023
e3a2c73
chore: release v1.0.0-beta.1
sheremet-va Oct 3, 2023
6f89346
fix(vitest): deduplicate vitest when running globally or in a workspa…
sheremet-va Oct 4, 2023
c9172a1
chore: release v1.0.0-beta.2
sheremet-va Oct 12, 2023
2432375
feat(vite-node): support import.meta.hot.off for vite 5 (#4315)
bluwy Oct 16, 2023
1b55ae6
feat!: bump minimum node version to 18 and match Vite 5 requirement (…
ghiscoding Oct 24, 2023
5f4056a
chore: remove unused dependencies from monorepo (#4359)
sheremet-va Oct 24, 2023
13a71c7
chore: improve build time and memory usage (#4369)
sheremet-va Oct 25, 2023
e549e45
chore: release v1.0.0-beta.3
sheremet-va Oct 27, 2023
ed643de
fix: don't bundle import from rollup (#4392)
sheremet-va Oct 30, 2023
9a4474d
chore: release v1.0.0-beta.4
sheremet-va Nov 9, 2023
9679489
perf: remove isValidNodeImport
Dunqing Oct 31, 2023
a573aa8
perf: remove mlly
Dunqing Oct 31, 2023
500353c
feat: inline isValidNodeImport
Dunqing Nov 1, 2023
5d47232
fix: remove protocol
Dunqing Nov 1, 2023
51488da
perf: fix
Dunqing Nov 1, 2023
9383509
feat: should externalize
Dunqing Nov 1, 2023
bbc2589
feat: port findNearestPackageData, remove pkg-types
Dunqing Nov 1, 2023
3dab4a8
fix: remove processed logic
Dunqing Nov 1, 2023
058fbdd
chore: update deps
Dunqing Nov 2, 2023
05fa094
chore: update version
Dunqing Nov 2, 2023
5d6653d
chore: use require('./package.json') in rollup.config instead of asse…
sheremet-va Nov 10, 2023
bf4ffd8
chore: update packages (#4468)
sheremet-va Nov 10, 2023
c46a7fd
chore: update packages (#4470)
sheremet-va Nov 10, 2023
8ebc6f3
chore: migrate to flat eslint config (#4472)
sheremet-va Nov 11, 2023
25b6ef3
fix(vitest): throw an error if Vite wasn't able to resolve aliased pa…
sheremet-va Nov 15, 2023
8ed2905
chore: release v1.0.0-beta.5
sheremet-va Nov 18, 2023
86f56d8
chore: release v1.0.0-beta.6
sheremet-va Nov 28, 2023
86e5051
chore: release v1.0.0
sheremet-va Dec 4, 2023
3e57c81
chore: release v1.0.1
sheremet-va Dec 4, 2023
fb00ab7
chore: update vite to latest (#4665)
Dunqing Dec 6, 2023
157e881
chore: release v1.0.2
sheremet-va Dec 7, 2023
4dc4ae4
chore: release v1.0.3
sheremet-va Dec 9, 2023
4f09139
chore: release v1.0.4
sheremet-va Dec 9, 2023
e536104
feat: Add es-main compatibility to vite-node (#4751)
zookatron Dec 15, 2023
d258cb9
chore: release v1.1.0
sheremet-va Dec 19, 2023
d468232
fix: don't fail if `inline: true` is set (#4815)
sheremet-va Dec 28, 2023
6c46f5e
chore: release v1.1.1
sheremet-va Dec 31, 2023
bbc160a
fix(vite-node): correctly return cached result (#4870)
sheremet-va Jan 4, 2024
c0ab3ca
chore: release v1.1.2
sheremet-va Jan 4, 2024
840a338
chore: release v1.1.3
sheremet-va Jan 5, 2024
abe09bd
fix(vitest): add inlined deps to ssr.noExternal so they are added to …
sheremet-va Jan 12, 2024
1a5f13b
chore: release v1.2.0
sheremet-va Jan 12, 2024
f62fe58
fix(vitest): correctly find module if it has a version query (#4976)
sheremet-va Jan 16, 2024
69ae9f7
chore(deps): update dependency @jridgewell/trace-mapping to ^0.3.21 (…
renovate[bot] Jan 16, 2024
cfef98d
fix(vite-node): externalize network imports (#4987)
hi-ogawa Jan 17, 2024
5da8efa
chore: release v1.2.1
sheremet-va Jan 17, 2024
ce3f9ab
fix(vite-node): provide import.meta.filename and dirname (#5011)
sheremet-va Jan 19, 2024
6fabc27
fix(vitest): throw an error if vi.mock is exported (#5034)
sheremet-va Jan 23, 2024
0d2ae6b
chore(deps): update dependency @jridgewell/trace-mapping to ^0.3.22 (…
renovate[bot] Jan 26, 2024
202e9cf
chore: release v1.2.2
sheremet-va Jan 26, 2024
b870011
chore(deps): update antfu stylelint config (#5127)
sheremet-va Feb 6, 2024
e014da7
chore(deps): update dependency @antfu/eslint-config to v2 (#5153)
renovate[bot] Feb 8, 2024
010ea85
ci: add publish workflow (#5168)
sheremet-va Feb 16, 2024
1b67602
docs: README: fixed grammar error (#5192)
movahhedi Feb 16, 2024
dc9e35b
chore: release v1.3.0
sheremet-va Feb 16, 2024
48ceece
chore: release v1.3.1
sheremet-va Feb 20, 2024
ada5baf
fix: `--inspect-brk` to pause before execution (#5355)
AriPerkkio Mar 14, 2024
ba43d27
chore: release v1.4.0
sheremet-va Mar 15, 2024
40f8b0c
fix(vite-node): fix `isValidNodeImport` to check `"type": "module"` f…
hi-ogawa Mar 26, 2024
959a6a6
chore(deps): update vite (#5311)
hi-ogawa Apr 6, 2024
f139f24
chore: release v1.5.0
sheremet-va Apr 11, 2024
a04dd8d
chore: release v1.5.1
sheremet-va Apr 24, 2024
efd8311
chore: release v1.5.2
sheremet-va Apr 25, 2024
f1fafec
chore: release v1.5.3
sheremet-va Apr 30, 2024
64f3520
perf: improve performance of forks pool (#5592)
sheremet-va May 1, 2024
4a8eab8
chore: release v1.6.0
sheremet-va May 3, 2024
8fe6973
chore(deps): update all non-major dependencies (#5499)
renovate[bot] May 9, 2024
e0dc658
chore: release v2.0.0-beta.1
sheremet-va May 9, 2024
c3f5143
chore: release v2.0.0-beta.2
sheremet-va May 9, 2024
783dd08
feat: add blob reporter (#5663)
sheremet-va May 14, 2024
3e1dd54
chore: update eslint rules (#5721)
sheremet-va May 14, 2024
6e451e2
chore: release v2.0.0-beta.3
sheremet-va May 14, 2024
0679106
feat: implement module mocking in browser mode (#5765)
sheremet-va May 31, 2024
a6a3d93
chore: release v2.0.0-beta.4
sheremet-va Jun 2, 2024
ac4a0cf
chore: release v2.0.0-beta.5
sheremet-va Jun 2, 2024
10a5552
chore: release v2.0.0-beta.6
sheremet-va Jun 2, 2024
f3d01d6
chore: release v2.0.0-beta.7
sheremet-va Jun 3, 2024
6c8488a
chore: release v2.0.0-beta.8
sheremet-va Jun 4, 2024
a7d3443
chore: release v2.0.0-beta.9
sheremet-va Jun 5, 2024
37d253f
chore(deps): update all non-major dependencies (#5712)
renovate[bot] Jun 11, 2024
9087221
chore: release v2.0.0-beta.10
sheremet-va Jun 12, 2024
8079ad9
chore: always require curly braces (#5885)
sheremet-va Jun 16, 2024
f1da8ef
chore: fix some comments (#5904)
sjtucoder Jun 17, 2024
09209e3
feat: image type add bmp (#5921)
btea Jun 19, 2024
a014fef
refactor(browser): move the browser server into its own entity (#5924)
sheremet-va Jun 19, 2024
4a82ad9
chore: release v2.0.0-beta.11
sheremet-va Jun 19, 2024
6df3a36
chore: release v2.0.0-beta.12
sheremet-va Jun 25, 2024
0bf94b2
chore(deps): update all non-major dependencies (#5957)
renovate[bot] Jul 1, 2024
8cf67e1
fix(vite-node): expose all envs from .env file, not just with a prefi…
sheremet-va Jul 2, 2024
8024597
chore: release v2.0.0-beta.13
sheremet-va Jul 4, 2024
6fa1452
chore: release v2.0.0
sheremet-va Jul 8, 2024
e54706b
chore: release v2.0.1
sheremet-va Jul 8, 2024
029582f
fix(browser): inline pretty-format and replace picocolors with tinyra…
sheremet-va Jul 10, 2024
6ad754a
chore: release v2.0.2
sheremet-va Jul 10, 2024
7b13836
fix(vite-node): remove suffix slash on file protocol for window (#6109)
syi0808 Jul 15, 2024
7a97619
chore: release v2.0.3
sheremet-va Jul 15, 2024
db402e5
chore(deps): update all non-major dependencies (#6046)
renovate[bot] Jul 15, 2024
71efa34
chore: release v2.0.4
sheremet-va Jul 22, 2024
ed067e1
chore: release v2.0.5
sheremet-va Jul 31, 2024
3c96682
chore(deps): update all non-major dependencies (#6235)
renovate[bot] Jul 31, 2024
d720918
fix(vite-node): disable watcher if hmr is disabled (#6251)
sheremet-va Jul 31, 2024
3b3643d
chore: release v2.1.0-beta.1
sheremet-va Aug 7, 2024
b0378a6
chore: release v2.1.0-beta.2
sheremet-va Aug 7, 2024
e3e59e8
chore: release v2.1.0-beta.3
sheremet-va Aug 7, 2024
93e776f
chore: release v2.1.0-beta.4
sheremet-va Aug 7, 2024
fe23fde
chore: release v2.1.0-beta.5
sheremet-va Aug 12, 2024
91aa0e8
chore: release v2.1.0-beta.6
sheremet-va Aug 20, 2024
2b3632d
fix: cjs build of vite node server (#6389)
AkaraChen Aug 29, 2024
4442c26
fix: allow inlining vite's cached dependencies (#6284)
chriswheeldon-peakon Sep 4, 2024
09d99ba
fix(vite-node): fix watch on vite 6 (#6422)
hi-ogawa Sep 5, 2024
74a2b8f
chore: release v2.1.0-beta.7
sheremet-va Sep 9, 2024
8b8d842
chore: release v2.1.0
sheremet-va Sep 12, 2024
2604e36
chore: release v2.1.1
sheremet-va Sep 13, 2024
82fe616
fix(vite-node): fix esm false-detection inside comment (#6506)
hi-ogawa Sep 17, 2024
7d333a6
chore: release v2.1.2
sheremet-va Oct 2, 2024
ddc34c7
fix(vitest): always inline setup files (#6689)
sheremet-va Oct 11, 2024
b638f48
chore: release v2.1.3
sheremet-va Oct 14, 2024
7a5d07c
chore(deps): update all non-major dependencies (#6360)
renovate[bot] Oct 14, 2024
4588489
chore(deps): update `@antfu/eslint-config` v3.8.0 (#6751)
hi-ogawa Oct 23, 2024
59fd088
fix(vitest): don't fail if the working directory starts with a lowerc…
sheremet-va Oct 25, 2024
11b093c
chore: release v2.1.4
sheremet-va Oct 28, 2024
a880c31
fix(vite-node): improve esm check to decide external (#6816)
hi-ogawa Nov 5, 2024
14ed537
fix(vite-node): top-level throw in module is not reported properly (#…
vanaigr Nov 5, 2024
b61843b
chore: release v2.1.5
sheremet-va Nov 13, 2024
6b9b252
chore: release v2.2.0-beta.1
sheremet-va Nov 13, 2024
907adf9
chore: release v2.2.0-beta.2
sheremet-va Nov 18, 2024
4d8682c
fix(vite-node): fix error stack on Windows (#6786)
hi-ogawa Dec 1, 2024
2925b04
feat!: support Vite 6 (#7026)
sheremet-va Dec 5, 2024
deb0bb2
chore: release v3.0.0-beta.1
sheremet-va Dec 5, 2024
4a38065
chore(deps): update all non-major dependencies (#7052)
renovate[bot] Dec 9, 2024
2f7738d
chore: release v3.0.0-beta.2
sheremet-va Dec 10, 2024
27dc4b2
chore: release v3.0.0-beta.3
sheremet-va Dec 20, 2024
7fdee99
fix(vite-node): properly normalize file url import (#7087)
hi-ogawa Dec 23, 2024
849532c
chore: update nuxt repo link (#7140)
TheAlexLichter Dec 28, 2024
2863092
fix(vite-node): fix mandatory node prefix (#7179)
hi-ogawa Jan 7, 2025
619b077
fix(deps): update dependency pathe to v2 (#7181)
renovate[bot] Jan 7, 2025
de10cee
chore: fix various typos (#7054)
aryaemami59 Jan 8, 2025
1659080
chore: release v3.0.0-beta.4
sheremet-va Jan 8, 2025
aee601a
fix: colors on `forks` pool (#7090)
AriPerkkio Jan 14, 2025
09e5a2f
chore: release v3.0.0
sheremet-va Jan 16, 2025
5be43c6
fix(deps): update all non-major dependencies (#7147)
renovate[bot] Jan 16, 2025
8319188
chore: release v3.0.1
sheremet-va Jan 16, 2025
44f2aca
chore: release v3.0.2
sheremet-va Jan 17, 2025
d8ee8d9
chore: release v3.0.3
sheremet-va Jan 21, 2025
2c17f25
chore(deps): update eslint packages (#7086)
renovate[bot] Jan 22, 2025
095d392
fix(deps): update all non-major dependencies (#7297)
renovate[bot] Jan 23, 2025
f32d98b
chore: release v3.0.4
sheremet-va Jan 23, 2025
773d6d2
fix(vite-node): differentiate file url with hash and query (#7365)
hi-ogawa Feb 3, 2025
f7b4bff
chore: release v3.0.5
sheremet-va Feb 3, 2025
fee6e9d
fix(vite-node): remove fake first line mapping on Vite 6 (#7124)
hi-ogawa Feb 5, 2025
b7f6feb
fix(coverage): `vite-node` to pass correct execution wrapper offset (…
AriPerkkio Feb 13, 2025
4e71fce
refactor: enable `isolatedDeclarations` (#7473)
sxzz Feb 13, 2025
936369e
fix(deps): update all non-major dependencies (#7507)
renovate[bot] Feb 18, 2025
0a27a8c
chore: release v3.0.6
AriPerkkio Feb 18, 2025
1d2aa59
chore: release v3.0.7
sheremet-va Feb 24, 2025
45d03ae
fix(vite-node): fix `buildStart` on Vite 6 (#7480)
hi-ogawa Feb 27, 2025
01cff85
chore: release v3.0.8
sheremet-va Mar 6, 2025
a9f242b
fix(vite-node): fix source map of inlined node_modules (#7557)
hi-ogawa Mar 7, 2025
38fab07
chore: use `unplugin-isolated-decl` with `oxc-transform` for dts buil…
hi-ogawa Mar 7, 2025
88bc069
chore: use pnpm catalog (#7590)
btea Mar 7, 2025
a19099e
chore(deps): update dependency @antfu/eslint-config to v4 (#7407)
renovate[bot] Mar 11, 2025
2bab362
fix(vite-node): fix missing `buildStart` (#7652)
hi-ogawa Mar 14, 2025
09da3df
fix(coverage): browser mode + `coverage.all` (#7597)
AriPerkkio Mar 17, 2025
0e460aa
chore: release v3.0.9
sheremet-va Mar 17, 2025
cccc4fc
chore: release v3.1.0-beta.1
sheremet-va Mar 17, 2025
254255e
chore: replace `rollup-plugin-esbuild` with `unplugin-oxc` (#7680)
hi-ogawa Mar 18, 2025
c602a64
chore: release v3.1.0-beta.2
sheremet-va Mar 21, 2025
30daf65
chore: release v3.1.0
sheremet-va Mar 31, 2025
73cf612
chore: release v3.1.1
sheremet-va Mar 31, 2025
82740bf
fix(vite-node): named export should overwrite export all (#7846)
hi-ogawa Apr 17, 2025
dd571e5
fix(vite-node): add ERR_MODULE_NOT_FOUND code error if module cannot …
sheremet-va Apr 18, 2025
3f22f1c
chore: release v3.1.2
sheremet-va Apr 21, 2025
fcb8232
fix(deps): update all non-major dependencies (#7867)
renovate[bot] Apr 24, 2025
1faabd1
chore: release v3.1.3
sheremet-va May 5, 2025
6c60214
chore: release v3.2.0-beta.1
sheremet-va May 5, 2025
c7b3491
chore: release v3.2.0-beta.2
sheremet-va May 19, 2025
046ad71
chore(deps): update all non-major dependencies (#7929)
renovate[bot] May 20, 2025
3a058ac
fix(vite-node): add `__vite_ssr_exportName__` (#7925)
hi-ogawa May 23, 2025
5a251bc
feat: support Vite 7 (#8003)
sheremet-va May 26, 2025
1642158
ci(rollup): disable watcher for types generators (#8035)
sheremet-va May 26, 2025
dd661b9
chore: release v3.2.0-beta.3
sheremet-va May 28, 2025
70a2508
chore: simplify working with UI package in dev (#8044)
sheremet-va May 29, 2025
4faf2a5
feat: track module execution totalTime and selfTime (#8027)
abrenneke May 29, 2025
4b69d89
feat: annotation API (#7953)
sheremet-va May 30, 2025
7bbe6ab
chore(deps): update Vite to 6.3.5 (#8051)
sapphi-red May 31, 2025
c682c06
chore: release v3.2.0
sheremet-va Jun 2, 2025
f0abf38
chore: release v3.2.1
sheremet-va Jun 3, 2025
2b5d950
chore: release v3.2.2
sheremet-va Jun 5, 2025
b19f870
fix(vite-node): unable to handle errors where sourcemap mapping empty…
blake-newman Jun 9, 2025
29fe872
chore: release v3.2.3
sheremet-va Jun 9, 2025
48f3ec7
chore: release v3.2.4
sheremet-va Jun 17, 2025
9da1207
chore: release v4.0.0-beta.1
sheremet-va Jun 20, 2025
8b41dc8
chore: release v4.0.0-beta.2
sheremet-va Jun 24, 2025
1efe96f
chore(deps): update eslint packages (#8124)
renovate[bot] Jul 14, 2025
b58cf1b
docs(vite-node): Update programmatic usage example (#8275)
Tobbe Jul 14, 2025
8240306
chore: release v4.0.0-beta.3
sheremet-va Jul 15, 2025
46591b6
chore: release v4.0.0-beta.4
sheremet-va Jul 22, 2025
e2aa60b
chore: merge changes from vitest
antfu Jul 24, 2025
3d3fbc0
chore: update setup scripts
antfu Jul 24, 2025
b7fc936
feat!: esm-only build, require Vite v7
antfu Jul 24, 2025
129aee8
chore: update docs
antfu Jul 24, 2025
c253d1a
chore: typo
antfu Jul 24, 2025
7f1c312
test: migrate some tests
antfu Jul 24, 2025
b38521a
wip: fixing tests
antfu Jul 24, 2025
a87fd1b
chore: update ci script
antfu Jul 31, 2025
e791579
chore: update deps
antfu Aug 5, 2025
51790a3
chore: update
antfu Aug 13, 2025
4e27bf8
fix: lint, tests (#6)
sheremet-va Nov 6, 2025
69d1018
chore: update deps
antfu Nov 6, 2025
91f86c2
chore: update deps
antfu Nov 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintrc

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm

- run: pnpm i -g @antfu/ni
- run: nci
- run: nr lint
- run: nr typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [lts/*]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm

- run: pnpm i -g @antfu/ni
- run: nci
- run: nr build
- run: nr test
31 changes: 6 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,9 @@ on:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# - name: Install pnpm
# uses: pnpm/[email protected]
# with:
# version: 6.15.1

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
# cache: "pnpm"

# - run: pnpm i -g @antfu/ni
# - run: nci
# - run: nr test --if-present
# - run: npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- run: npx conventional-github-releaser -p angular
env:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{secrets.GITHUB_TOKEN}}
uses: sxzz/workflows/.github/workflows/release.yml@v1
with:
publish: true
permissions:
contents: write
id-token: write
46 changes: 0 additions & 46 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Anthony Fu <https://github.com/antfu>
Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
179 changes: 154 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
# Project Moved to [Vitest Monorepo](https://github.com/vitest-dev/vitest/tree/main/packages/vite-node)
<p align="center">
<img src="https://github.com/vitest-dev/vitest/blob/main/packages/vite-node/assets/vite-node.svg?raw=true" height="120">
</p>

<details>
<h1 align="center">
vite-node
</h1>
<p align="center">
Vite as Node runtime.<br>The engine that powers <a href="https://github.com/nuxt/nuxt">Nuxt 3 Dev SSR</a> and <i><a href="https://github.com/vitest-dev/vitest/pull/8208">used to</a></i> power <a href="https://github.com/vitest-dev/vitest">Vitest</a>.

# vite-node
<p>
<p align="center">
<a href="https://www.npmjs.com/package/vite-node"><img src="https://img.shields.io/npm/v/vite-node?color=FCC72B&label="></a>
<p>

[![NPM version](https://img.shields.io/npm/v/vite-node?color=a1b858&label=)](https://www.npmjs.com/package/vite-node)
> [!NOTE]
> This project is firstly inspired by [Nuxt 3's SSR](https://antfu.me/posts/dev-ssr-on-nuxt) implementation made by [@pi0](https://github.com/pi0), as a PoC. Later, it made [Vitest](https://github.com/vitest-dev/vitest) possible by providing the same pipeline as in Vite. It served the ecosystem well for a few years and later became a more generalized built-in solution as [Vite Environment Module Runner](https://vite.dev/guide/api-environment.html). Vitest has [migrated to the new official solution](https://github.com/vitest-dev/vitest/pull/8208), which means `vite-node` has finished its mission. We will still keep it around for the ecosystem that built around it, but for new projects, please consider using the builtin Vite one instead.

Vite as Node runtime.
## Features

> **EXPERIMENTAL**
- On-demand evaluation
- Vite's pipeline, plugins, resolve, aliasing
- Out-of-box ESM & TypeScript support
- Respect `vite.config.ts`
- Hot module replacement (HMR)
- Separate server/client architecture
- Top-level `await`
- Shims for `__dirname` and `__filename` in ESM
- Access to native node modules like `fs`, `path`, etc.

## CLI Usage

## Usage
Run JS/TS file on Node.js using Vite's resolvers and transformers.

```bash
npx vite-node index.ts
Expand All @@ -23,29 +42,141 @@ Options:
npx vite-node -h
```

## Features
### Options via CLI

- Out-of-box ESM & TypeScript support (possible for more with plugins)
- Top-level await
- Vite plugins, resolve, aliasing
- Respect `vite.config.ts`
- Shims for `__dirname` and `__filename` in ESM
- Access to native node modules like `fs`, `path`, etc.
- Watch mode (like `nodemon`)
[All `ViteNodeServer` options](https://github.com/antfu-collective/vite-node/blob/main/src/types.ts#L92-L111) are supported by the CLI. They may be defined through the dot syntax, as shown below:

## When NOT to Use
```bash
npx vite-node --options.deps.inline="module-name" --options.deps.external="/module-regexp/" index.ts
```

Note that for options supporting RegExps, strings passed to the CLI must start _and_ end with a `/`;

- Production, yet - in very early stage, check it later
- Most of the time, when other tools can do that job
- We need to start a Vite server upon each execution, which inevitably introduces some overhead. Only use it when you want the same behavior as Vite or the powerful plugins system (for example, testing components with a Vite-specific setup).
### Hashbang

## Why?
If you prefer to write scripts that don't need to be passed into Vite Node, you can declare it in the [hashbang](https://bash.cyberciti.biz/guide/Shebang).

It runs Vite's id resolving, module transforming, and most importantly, the powerful plugins system!
Simply add `#!/usr/bin/env vite-node --script` at the top of your file:

## How?
_file.ts_

```ts
#!/usr/bin/env vite-node --script

console.log('argv:', process.argv.slice(2))
```

It fires up a Vite dev server, transforms the requests, and runs them in Node.
And make the file executable:

```sh
chmod +x ./file.ts
```

Now, you can run the file without passing it into Vite Node:

```sh
$ ./file.ts hello
argv: [ 'hello' ]
```

Note that when using the `--script` option, Vite Node forwards every argument and option to the script to execute, even the one supported by Vite Node itself.

## Programmatic Usage

In Vite Node, the server and runner (client) are separated, so you can integrate them in different contexts (workers, cross-process, or remote) if needed. The demo below shows a simple example of having both (server and runner) running in the same context

```ts
import { createServer, version as viteVersion } from 'vite'
import { ViteNodeRunner } from 'vite-node/client'
import { ViteNodeServer } from 'vite-node/server'
import { installSourcemapsSupport } from 'vite-node/source-map'

// create vite server
const server = await createServer({
optimizeDeps: {
// It's recommended to disable deps optimization
noDiscovery: true,
include: undefined,
},
})

// For old Vite, this is needed to initialize the plugins.
if (Number(viteVersion.split('.')[0]) < 6) {
await server.pluginContainer.buildStart({})
}

// create vite-node server
const node = new ViteNodeServer(server)

// fixes stacktraces in Errors
installSourcemapsSupport({
getSourceMap: source => node.getSourceMap(source),
})

// create vite-node runner
const runner = new ViteNodeRunner({
root: server.config.root,
base: server.config.base,
// when having the server and runner in a different context,
// you will need to handle the communication between them
// and pass to this function
fetchModule(id) {
return node.fetchModule(id)
},
resolveId(id, importer) {
return node.resolveId(id, importer)
},
})

// execute the file
await runner.executeFile('./example.ts')

// close the vite server
await server.close()
```

## Debugging

### Debug Transformation

Sometimes you might want to inspect the transformed code to investigate issues. You can set environment variable `VITE_NODE_DEBUG_DUMP=true` to let vite-node write the transformed result of each module under `.vite-node/dump`.

If you want to debug by modifying the dumped code, you can change the value of `VITE_NODE_DEBUG_DUMP` to `load` and search for the dumped files and use them for executing.

```bash
VITE_NODE_DEBUG_DUMP=load vite-node example.ts
```

Or programmatically:

```js
import { ViteNodeServer } from 'vite-node/server'

const server = new ViteNodeServer(viteServer, {
debug: {
dumpModules: true,
loadDumppedModules: true,
},
})
```

### Debug Execution

If the process gets stuck, it might be because there are unresolvable circular dependencies. You can set `VITE_NODE_DEBUG_RUNNER=true` for vite-node to warn about this.

```bash
VITE_NODE_DEBUG_RUNNER=true vite-node example.ts
```

Or programmatically:

```js
import { ViteNodeRunner } from 'vite-node/client'

const runner = new ViteNodeRunner({
debug: true,
})
```

## Credits

Expand All @@ -64,5 +195,3 @@ Thanks [@brillout](https://github.com/brillout) for kindly sharing this package
## License

[MIT](./LICENSE) License © 2021 [Anthony Fu](https://github.com/antfu)

</details>
4 changes: 4 additions & 0 deletions assets/vite-node.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading