Skip to content

Commit 4f29353

Browse files
atilafassinaCopilotBrendonovich
authored
Publish @solidjs/vite-plugin-nitro-2 (#2004)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Brendan Allan <brendonovich@outlook.com>
1 parent 29c5127 commit 4f29353

File tree

9 files changed

+254
-200
lines changed

9 files changed

+254
-200
lines changed

.changeset/honest-needles-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/vite-plugin-nitro-2": minor
3+
---
4+
5+
Publishing as NPM package

.github/workflows/cr.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ jobs:
3232
- name: Install dependencies
3333
run: pnpm install --frozen-lockfile
3434

35-
- name: Build start
35+
- name: Build Packages
3636
run: |
3737
pnpm run build
38-
# rewrite .ts exports to .js
39-
pnpm --filter='./packages/*' -c exec "echo \$(cat package.json | jq '.exports = .publishConfig.exports') > package.json"
38+
pnpm rewrite-exports
4039
41-
- name: Release
40+
- name: Release Packages
41+
# remove the compat flag until all packages are available on npm
42+
# run: |
43+
# pnpm dlx pkg-pr-new@0.0 publish './packages/*' --template './examples/*' --compact
4244
run: |
43-
pnpm dlx pkg-pr-new@0.0 publish './packages/start' --template './examples/*' --compact
45+
pnpm dlx pkg-pr-new@0.0 publish './packages/*'

.github/workflows/dist-typecheck.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ jobs:
3434
# build the package and all its dependencies
3535
run: pnpm --filter ${{ matrix.package }}... build
3636

37+
- run: pnpm rewrite-exports
38+
3739
- name: Check types with @arethetypeswrong/cli
38-
run: pnpx @arethetypeswrong/cli --pack packages/${{ matrix.package }} --profile esm-only
40+
run: pnpm --filter ${{ matrix.package }} typecheck:dist

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"packages:build": "pnpm --filter=./packages/* build",
2525
"packages:clean": "pnpx rimraf ./packages/*/node_modules/ ./packages/*/dist/",
2626
"clean:test": "pnpx rimraf .tmp",
27-
"release": "pnpm build && changeset publish"
27+
"release": "pnpm build && changeset publish",
28+
"rewrite-exports": "pnpm --filter='./packages/*' -c exec \"echo \\$(cat package.json | jq '.exports = .publishConfig.exports') > package.json\""
2829
},
2930
"devDependencies": {
3031
"@changesets/cli": "^2.27.12",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Vite-Plugin-Nitro-2
2+
3+
This package moves Nitro into a Vite-Plugin to consolidate the API surface between Nitro v2 and v3.
4+
5+
## Usage
6+
7+
This plugin will provide SolidStart with the needed Node.js runtime to run in the backend.
8+
9+
```ts
10+
import { defineConfig } from "vite";
11+
import { nitroV2Plugin } from "@solidjs/vite-plugin-nitro-2";
12+
import { solidStart } from "@solidjs/start/config";
13+
14+
export default defineConfig({
15+
plugins: [solidStart(), nitroV2Plugin()]
16+
});
17+
```
18+
19+
Some features that previously were re-exported by SolidStart are available directly through this plugin now.
20+
21+
### Example: Prerendering
22+
23+
```ts
24+
import { defineConfig } from "vite";
25+
import { nitroV2Plugin } from "@solidjs/vite-plugin-nitro-2";
26+
import { solidStart } from "@solidjs/start/config";
27+
28+
export default defineConfig({
29+
plugins: [
30+
solidStart(),
31+
nitroV2Plugin({
32+
prerender: {
33+
crawlLinks: true
34+
}
35+
})
36+
]
37+
});
38+
```
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
{
2-
"name": "@solidjs/start-nitro-v2-vite-plugin",
2+
"name": "@solidjs/vite-plugin-nitro-2",
3+
"description": "Nitro v2 plugin for development with SolidStart 2.0",
34
"version": "0.0.1",
45
"type": "module",
56
"scripts": {
6-
"build": "tsc"
7+
"build": "tsc",
8+
"typecheck": "tsc --noEmit",
9+
"typecheck:dist": "pnpm build && pnpx @arethetypeswrong/cli --pack . --profile esm-only"
710
},
11+
"files": [
12+
"dist",
13+
"package.json",
14+
"README.md"
15+
],
816
"exports": {
917
".": "./src/index.ts"
1018
},
@@ -15,7 +23,12 @@
1523
}
1624
},
1725
"dependencies": {
18-
"nitropack": "^2.11.10",
26+
"nitropack": "^2.11.10"
27+
},
28+
"devDependencies": {
1929
"vite": "^7.1.10"
30+
},
31+
"peerDependencies": {
32+
"vite": "^7"
2033
}
2134
}

0 commit comments

Comments
 (0)