From 6e3eeacefcf256814d6b3cc18c4c205f1c7d9c8f Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Sun, 12 Nov 2023 13:02:47 +0100 Subject: [PATCH 1/2] Build without the need to compile Using internal conditional exports, we can avoid the prerequisite to run `tsc` before triggering a build or running the unit tests. This also eliminates the compilation in watch mode, so that rebuilds in webpack can be done immediately when the sources are changed. This allows us to achieve the speed of using [internal packages](https://turbo.build/repo/docs/handbook/sharing-code/internal-packages) also for external (i.e. published) packages, while still being able to use TypeScript project references. --- .github/workflows/ci.yml | 2 +- .github/workflows/deployment.yml | 2 +- .node-version | 2 +- apps/cloudflare-app/package.json | 9 +- apps/cloudflare-app/tailwind.config.cjs | 2 +- apps/cloudflare-app/webpack.config.js | 13 +- apps/shared-app/package.json | 14 +- apps/vercel-app/package.json | 9 +- apps/vercel-app/tailwind.config.cjs | 2 +- apps/vercel-app/webpack.config.js | 13 +- jest.config.js | 2 + package-lock.json | 438 +++++++++++++++++++++++- package.json | 6 +- packages/core/package.json | 7 + packages/webpack-rsc/package.json | 1 + turbo.json | 16 +- 16 files changed, 495 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e3d18d..2c3eee1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version-file: '.node-version' cache: 'npm' - name: Install run: npm i diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 4818563..3a51374 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version-file: '.node-version' cache: 'npm' - name: Install run: npm i diff --git a/.node-version b/.node-version index 3c03207..209e3ef 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18 +20 diff --git a/apps/cloudflare-app/package.json b/apps/cloudflare-app/package.json index a780e54..1c4730d 100644 --- a/apps/cloudflare-app/package.json +++ b/apps/cloudflare-app/package.json @@ -6,13 +6,13 @@ "author": "Hendrik Liebau ", "type": "module", "scripts": { - "build": "webpack --mode production", - "build:dev": "webpack --mode development", + "build": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode production", + "build:dev": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode development", "deploy": "wrangler publish -c src/worker/wrangler.toml", "dev": "npm run start", "start": "wrangler dev -c src/worker/wrangler.toml -l", - "watch": "webpack --mode production --watch", - "watch:dev": "webpack --mode development --watch" + "watch": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode production --watch", + "watch:dev": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode development --watch" }, "dependencies": { "@cloudflare/kv-asset-handler": "^0.3.0", @@ -40,6 +40,7 @@ "source-map-loader": "^4.0.1", "swc-loader": "^0.2.3", "tailwindcss": "^3.2.7", + "tsx": "^4.1.0", "webpack": "^5.77.0", "webpack-cli": "^5.0.1", "webpack-manifest-plugin": "^5.0.0", diff --git a/apps/cloudflare-app/tailwind.config.cjs b/apps/cloudflare-app/tailwind.config.cjs index 9c62acc..d640602 100644 --- a/apps/cloudflare-app/tailwind.config.cjs +++ b/apps/cloudflare-app/tailwind.config.cjs @@ -3,5 +3,5 @@ const config = require(`@mfng/shared-app/tailwind.config.cjs`); /** @type {import('tailwindcss').Config} */ module.exports = { ...config, - content: [`./src/**/*.{ts,tsx}`, `../shared-app/lib/**/*.js`], + content: [`./src/**/*.{ts,tsx}`, `../shared-app/src/**/*.{ts,tsx}`], }; diff --git a/apps/cloudflare-app/webpack.config.js b/apps/cloudflare-app/webpack.config.js index 95a44d6..4f1c357 100644 --- a/apps/cloudflare-app/webpack.config.js +++ b/apps/cloudflare-app/webpack.config.js @@ -95,20 +95,26 @@ export default function createConfigs(_env, argv) { }, resolve: { plugins: [new ResolveTypeScriptPlugin()], - conditionNames: [`workerd`, `node`, `...`], + conditionNames: [ + `@mfng:internal:node`, + `@mfng:internal`, + `workerd`, + `node`, + `...`, + ], }, module: { rules: [ { resource: (value) => - /core\/lib\/server\/rsc\.js$/.test(value) || + /core\/src\/server\/rsc\.ts$/.test(value) || /create-rsc-app\.tsx$/.test(value), layer: webpackRscLayerName, }, { // AsyncLocalStorage module instances must be in a shared layer. layer: `shared`, - test: /(router-location-async-local-storage|core\/lib\/server\/use-router-location\.js)/, + test: /(router-location-async-local-storage|use-router-location)/, }, { issuerLayer: webpackRscLayerName, @@ -169,6 +175,7 @@ export default function createConfigs(_env, argv) { }, resolve: { plugins: [new ResolveTypeScriptPlugin()], + conditionNames: [`@mfng:internal`, `...`], }, module: { rules: [ diff --git a/apps/shared-app/package.json b/apps/shared-app/package.json index 6ac4483..6d4a169 100644 --- a/apps/shared-app/package.json +++ b/apps/shared-app/package.json @@ -6,11 +6,17 @@ "author": "Hendrik Liebau ", "type": "module", "exports": { - "./app.js": "./lib/src/server/app.js", - "./location-server-context.js": "./lib/src/shared/location-server-context.js", - "./navigation-context.js": "./lib/src/client/navigation-context.js", + "./app.js": { + "@mfng:internal": "./src/server/app.tsx", + "types": "./lib/src/server/app.d.ts", + "default": "./lib/src/server/app.js" + }, "./package.json": "./package.json", - "./tailwind.config.cjs": "./lib/tailwind.config.cjs" + "./tailwind.config.cjs": { + "@mfng:internal": "./tailwind.config.cjs", + "types": "./lib/tailwind.config.d.cts", + "default": "./lib/tailwind.config.cjs" + } }, "files": [ "lib", diff --git a/apps/vercel-app/package.json b/apps/vercel-app/package.json index a9d8c69..0309b36 100644 --- a/apps/vercel-app/package.json +++ b/apps/vercel-app/package.json @@ -6,13 +6,13 @@ "author": "Hendrik Liebau ", "type": "module", "scripts": { - "build": "webpack --mode production", - "build:dev": "webpack --mode development", + "build": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode production", + "build:dev": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode development", "deploy": "vercel deploy --prebuilt", "dev": "npm run start", "start": "node dev-server/run.js", - "watch": "webpack --mode production --watch", - "watch:dev": "webpack --mode development --watch" + "watch": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode production --watch", + "watch:dev": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode development --watch" }, "dependencies": { "@mfng/core": "*", @@ -44,6 +44,7 @@ "source-map-loader": "^4.0.1", "swc-loader": "^0.2.3", "tailwindcss": "^3.2.7", + "tsx": "^4.1.0", "vercel": "^28.18.3", "webpack": "^5.77.0", "webpack-cli": "^5.0.1", diff --git a/apps/vercel-app/tailwind.config.cjs b/apps/vercel-app/tailwind.config.cjs index 9c62acc..d640602 100644 --- a/apps/vercel-app/tailwind.config.cjs +++ b/apps/vercel-app/tailwind.config.cjs @@ -3,5 +3,5 @@ const config = require(`@mfng/shared-app/tailwind.config.cjs`); /** @type {import('tailwindcss').Config} */ module.exports = { ...config, - content: [`./src/**/*.{ts,tsx}`, `../shared-app/lib/**/*.js`], + content: [`./src/**/*.{ts,tsx}`, `../shared-app/src/**/*.{ts,tsx}`], }; diff --git a/apps/vercel-app/webpack.config.js b/apps/vercel-app/webpack.config.js index d14dbfa..55d52a8 100644 --- a/apps/vercel-app/webpack.config.js +++ b/apps/vercel-app/webpack.config.js @@ -122,20 +122,26 @@ export default function createConfigs(_env, argv) { }, resolve: { plugins: [new ResolveTypeScriptPlugin()], - conditionNames: [`workerd`, `node`, `...`], + conditionNames: [ + `@mfng:internal:node`, + `@mfng:internal`, + `workerd`, + `node`, + `...`, + ], }, module: { rules: [ { resource: (value) => - /core\/lib\/server\/rsc\.js$/.test(value) || + /core\/src\/server\/rsc\.ts$/.test(value) || /create-rsc-app\.tsx$/.test(value), layer: webpackRscLayerName, }, { // AsyncLocalStorage module instances must be in a shared layer. layer: `shared`, - test: /(router-location-async-local-storage|core\/lib\/server\/use-router-location\.js)/, + test: /(router-location-async-local-storage|use-router-location)/, }, { issuerLayer: webpackRscLayerName, @@ -210,6 +216,7 @@ export default function createConfigs(_env, argv) { }, resolve: { plugins: [new ResolveTypeScriptPlugin()], + conditionNames: [`@mfng:internal`, `...`], }, module: { rules: [ diff --git a/jest.config.js b/jest.config.js index 6dabddb..f055d77 100644 --- a/jest.config.js +++ b/jest.config.js @@ -19,6 +19,8 @@ export default { moduleFileExtensions: [...defaults.moduleFileExtensions, `cts`], moduleNameMapper: { '^(\\.{1,2}/.*)\\.c?js$': `$1`, + '@mfng/core/client': `/packages/core/src/client/index.ts`, + '@mfng/core/(.*)': `/packages/core/src/$1.ts`, }, restoreMocks: true, testMatch: [`**/src/**/*.test.{ts,tsx}`], diff --git a/package-lock.json b/package-lock.json index a6f5367..c44fc87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,6 +67,7 @@ "source-map-loader": "^4.0.1", "swc-loader": "^0.2.3", "tailwindcss": "^3.2.7", + "tsx": "^4.1.0", "webpack": "^5.77.0", "webpack-cli": "^5.0.1", "webpack-manifest-plugin": "^5.0.0", @@ -176,6 +177,7 @@ "source-map-loader": "^4.0.1", "swc-loader": "^0.2.3", "tailwindcss": "^3.2.7", + "tsx": "^4.1.0", "vercel": "^28.18.3", "webpack": "^5.77.0", "webpack-cli": "^5.0.1", @@ -10193,9 +10195,9 @@ "dev": true }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -10393,6 +10395,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-tsconfig": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", + "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/get-uri": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-3.0.2.tgz", @@ -16835,6 +16849,15 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve-typescript-plugin": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/resolve-typescript-plugin/-/resolve-typescript-plugin-2.0.0.tgz", @@ -18354,6 +18377,415 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, + "node_modules/tsx": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.1.0.tgz", + "integrity": "sha512-u4l17Yd63Wsk2fzNn1wZCmcS9kwJ/2ysl7wuoVggv2hd3NjLA5JQPpyJMXoWSXOwOvoQUzNcu/sf/35HEsnXsg==", + "dev": true, + "dependencies": { + "esbuild": "~0.18.20", + "get-tsconfig": "^4.7.2", + "source-map-support": "^0.5.21" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" + } + }, "node_modules/turbo": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/turbo/-/turbo-1.9.1.tgz", diff --git a/package.json b/package.json index ebd07db..57b6f64 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,12 @@ "compile:clean": "tsc --build --clean", "compile:watch": "tsc --build --watch --preserveWatchOutput", "deploy": "turbo deploy", - "dev": "turbo --concurrency 16 compile:watch watch:dev dev", + "dev": "turbo --concurrency 11 watch:dev dev", "format:check": "prettier --check .", "format:write": "prettier --write .", "lint": "eslint .", - "start": "turbo --concurrency 16 compile:watch watch start", - "pretest": "turbo build:dev", + "start": "turbo --concurrency 11 watch start", + "pretest": "turbo build:dev --filter cloudflare-app", "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest" }, "devDependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index c641762..6c4ed1f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -12,27 +12,34 @@ "type": "module", "exports": { "./client": { + "@mfng:internal": "./src/client/index.ts", "types": "./lib/client/index.d.ts", "default": "./lib/client/index.js" }, "./client/browser": { + "@mfng:internal": "./src/client/browser.ts", "types": "./lib/client/browser.d.ts", "default": "./lib/client/browser.js" }, "./server/rsc": { + "@mfng:internal": "./src/server/rsc.ts", "types": "./lib/server/rsc.d.ts", "default": "./lib/server/rsc.js" }, "./server/ssr": { + "@mfng:internal": "./src/server/ssr.ts", "types": "./lib/server/ssr.d.ts", "default": "./lib/server/ssr.js" }, "./use-router-location": { + "@mfng:internal:node": "./src/server/use-router-location.ts", + "@mfng:internal": "./src/client/use-router-location.ts", "types": "./lib/use-router-location.d.ts", "node": "./lib/server/use-router-location.js", "default": "./lib/client/use-router-location.js" }, "./router-location-async-local-storage": { + "@mfng:internal": "./src/server/router-location-async-local-storage.ts", "types": "./lib/server/router-location-async-local-storage.d.ts", "default": "./lib/server/router-location-async-local-storage.js" } diff --git a/packages/webpack-rsc/package.json b/packages/webpack-rsc/package.json index e5e2c35..890e849 100644 --- a/packages/webpack-rsc/package.json +++ b/packages/webpack-rsc/package.json @@ -12,6 +12,7 @@ "type": "module", "exports": { ".": { + "@mfng:internal": "./src/index.ts", "types": "./lib/index.d.ts", "default": "./lib/index.js" } diff --git a/turbo.json b/turbo.json index 7038063..455096a 100644 --- a/turbo.json +++ b/turbo.json @@ -1,20 +1,8 @@ { "$schema": "https://turbo.build/schema.json", "pipeline": { - "//#compile": { - "cache": false - }, - "//#compile:watch": { - "dependsOn": ["//#compile"], - "cache": false, - "persistent": true - }, - "build": { - "dependsOn": ["//#compile"] - }, - "build:dev": { - "dependsOn": ["//#compile"] - }, + "build": {}, + "build:dev": {}, "deploy": { "dependsOn": ["build"], "cache": false From e6395c8da7597534a762bbb9cacc58036e68e813 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Sun, 12 Nov 2023 13:15:00 +0100 Subject: [PATCH 2/2] Add node 18 compatible build command for Vercel CI --- apps/vercel-app/package.json | 1 + apps/vercel-app/turbo.json | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/apps/vercel-app/package.json b/apps/vercel-app/package.json index 0309b36..248072b 100644 --- a/apps/vercel-app/package.json +++ b/apps/vercel-app/package.json @@ -8,6 +8,7 @@ "scripts": { "build": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode production", "build:dev": "NODE_OPTIONS='--import=tsx --conditions=@mfng:internal' webpack --mode development", + "build:node18": "NODE_OPTIONS='--loader=tsx --conditions=@mfng:internal' webpack --mode production", "deploy": "vercel deploy --prebuilt", "dev": "npm run start", "start": "node dev-server/run.js", diff --git a/apps/vercel-app/turbo.json b/apps/vercel-app/turbo.json index abc852c..cf8d322 100644 --- a/apps/vercel-app/turbo.json +++ b/apps/vercel-app/turbo.json @@ -11,6 +11,15 @@ ], "outputs": ["dist/**", ".vercel/output/**"] }, + "build:node18": { + "inputs": [ + "src/**/*", + "package.json", + "tailwind.config.cjs", + "webpack.config.js" + ], + "outputs": ["dist/**", ".vercel/output/**"] + }, "build:dev": { "inputs": [ "src/**/*",