Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch Vite and update dependencies #136

Merged
merged 17 commits into from
Oct 8, 2023
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ yarn create waku
```

```bash
pnpm create waku
pnpm create waku # It may not work correctly with some libs
```

## APIs
Expand Down
10 changes: 5 additions & 5 deletions examples/01_counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/02_async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/03_promise/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/04_callserver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/05_mutation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/06_nesting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
12 changes: 6 additions & 6 deletions examples/07_router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"dependencies": {
"express": "^4.18.2",
"glob": "^10.3.4",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"glob": "^10.3.10",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/08_cookies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"dependencies": {
"cookie-parser": "^1.4.6",
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
10 changes: 5 additions & 5 deletions examples/09_cssmodules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
12 changes: 6 additions & 6 deletions examples/10_dynamicroute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
},
"dependencies": {
"express": "^4.18.2",
"glob": "^10.3.4",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"glob": "^10.3.10",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"waku": "0.15.1"
},
"devDependencies": {
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"typescript": "^5.2.2"
}
}
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
},
"prettier": {},
"devDependencies": {
"@playwright/test": "^1.37.1",
"@types/babel__core": "^7.20.1",
"@types/busboy": "^1.5.0",
"@types/express": "^4.17.17",
"@types/node": "^20.6.0",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"eslint": "^8.49.0",
"@playwright/test": "^1.38.1",
"@types/babel__core": "^7.20.2",
"@types/busboy": "^1.5.1",
"@types/express": "^4.17.18",
"@types/node": "^20.8.2",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.8",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand All @@ -61,5 +61,10 @@
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"typescript": "^5.2.2",
"waku": "workspace:*"
},
"pnpm": {
"patchedDependencies": {
"vite@4.4.10": "packages/waku/patches/vite@4.4.10.patch"
}
}
}
9 changes: 5 additions & 4 deletions packages/create-waku/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"start": "node dist/cli.js",
"compile": "rm -rf template dist && pnpm run template && pnpm run build",
"template": "cp -r ../../examples template/",
"template": "cp -r ../../examples template/; for d in template/*; do cp -r ../waku/patches $d; json -I -f $d/package.json -e 'this.pnpm??={};this.pnpm.patchedDependencies??={};this.pnpm.patchedDependencies[\"vite@4.4.10\"]=\"patches/vite@4.4.10.patch\"'; done",
"build": "esbuild src/* --bundle --platform=node --outdir=dist"
},
"dependencies": {
Expand All @@ -28,8 +28,9 @@
"prompts": "^2.4.2"
},
"devDependencies": {
"@types/fs-extra": "^11.0.1",
"@types/prompts": "^2.4.4",
"esbuild": "0.19.2"
"@types/fs-extra": "^11.0.2",
"@types/prompts": "^2.4.5",
"json": "^11.0.0",
"esbuild": "0.19.4"
}
}
18 changes: 10 additions & 8 deletions packages/waku/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,35 @@
},
"files": [
"src",
"dist"
"dist",
"patches"
],
"scripts": {
"dev": "swc src -d dist -w",
"compile": "rm -rf dist && pnpm run compile:code && pnpm run compile:types",
"compile:code": "swc src -d dist && swc src -d dist/cjs -C module.type=commonjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
"compile:types": "tsc --project tsconfig.build.json"
"compile:types": "tsc --project tsconfig.build.json",
"postinstall": "(cd node_modules/vite && patch -p1 -i ../../patches/vite@4.4.10.patch) || (cd ../vite && patch -p1 -i ../waku/patches/vite@4.4.10.patch) || true"
},
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"@swc/core": "1.3.83",
"@vitejs/plugin-react": "^4.0.4",
"@swc/core": "1.3.91",
"@vitejs/plugin-react": "^4.1.0",
"busboy": "^1.6.0",
"vite": "^4.4.9"
"vite": "4.4.10"
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, doesn't vite should be in the peer dependencies?

Copy link
Owner Author

@dai-shi dai-shi Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need it in the peer deps as it's already in the deps.

},
"devDependencies": {
"@swc/cli": "^0.1.62",
"express": "^4.18.2",
"rollup": "^3.29.1"
"rollup": "^3.29.4"
},
"peerDependencies": {
"express": "^4.18.2",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705"
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914"
},
"peerDependenciesMeta": {
"express": {
Expand Down
19 changes: 19 additions & 0 deletions packages/waku/patches/vite@4.4.10.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/dist/node/chunks/dep-3bba9c7e.js b/dist/node/chunks/dep-3bba9c7e.js
index ae45ac228fd7b14e253be69c824f43334f6811c0..b84149ff4cd78998e397aee2b7cfe57b0d380030 100644
--- a/dist/node/chunks/dep-3bba9c7e.js
+++ b/dist/node/chunks/dep-3bba9c7e.js
@@ -55965,12 +55965,12 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
};
urlStack = urlStack.concat(url);
const isCircular = (url) => urlStack.includes(url);
- const { isProduction, resolve: { dedupe, preserveSymlinks }, root, } = server.config;
+ const { isProduction, resolve: { dedupe, preserveSymlinks, conditions }, root, } = server.config;
const resolveOptions = {
mainFields: ['main'],
browserField: true,
conditions: [],
- overrideConditions: ['production', 'development'],
+ overrideConditions: [...conditions, 'production', 'development'],
extensions: ['.js', '.cjs', '.json'],
dedupe,
preserveSymlinks,
6 changes: 1 addition & 5 deletions packages/waku/src/lib/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,7 @@ const buildClientBundle = async (
const clientBuildOutput = await viteBuild({
...configFileConfig(),
root: path.join(config.root, config.framework.srcDir),
plugins: [
// @ts-expect-error This expression is not callable.
viteReact(),
rscIndexPlugin(cssAssets),
],
plugins: [viteReact(), rscIndexPlugin(cssAssets)],
build: {
outDir: path.join(
config.root,
Expand Down
7 changes: 1 addition & 6 deletions packages/waku/src/lib/middleware/devServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ export function devServer(): Middleware {
// and "Uncaught Error: Missing Router" happens.
exclude: ["waku"],
},
plugins: [
// @ts-expect-error This expression is not callable.
viteReact(),
rscIndexPlugin([]),
rscHmrPlugin(),
],
plugins: [viteReact(), rscIndexPlugin([]), rscHmrPlugin()],
server: { middlewareMode: true },
}),
);
Expand Down
10 changes: 5 additions & 5 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"start": "waku start --with-ssr"
},
"dependencies": {
"autoprefixer": "^10.4.15",
"autoprefixer": "^10.4.16",
"bright": "^0.8.4",
"express": "^4.18.2",
"glob": "^10.3.4",
"react": "18.3.0-canary-7118f5dd7-20230705",
"react-dom": "18.3.0-canary-7118f5dd7-20230705",
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705",
"glob": "^10.3.10",
"react": "18.3.0-canary-d6dcad6a8-20230914",
"react-dom": "18.3.0-canary-d6dcad6a8-20230914",
"react-server-dom-webpack": "18.3.0-canary-d6dcad6a8-20230914",
"tailwindcss": "^3.3.3",
"waku": "workspace:*"
}
Expand Down
Loading
Loading