Unverified Commit cad3a510 authored by hrmny's avatar hrmny Committed by GitHub

refactor: move rust crates to the repo root directory (#67780)

### Why?
In preparation for moving all turbopack crates

Also makes them easier to work with in general.

Closes PACK-3164
parent 8a37c2e3
...@@ -34,7 +34,7 @@ test/production/emit-decorator-metadata/**/*.js ...@@ -34,7 +34,7 @@ test/production/emit-decorator-metadata/**/*.js
!test/**/*.test.* !test/**/*.test.*
test/e2e/app-dir/rsc-errors/app/swc/use-client/page.js test/e2e/app-dir/rsc-errors/app/swc/use-client/page.js
test-timings.json test-timings.json
packages/next-swc/crates/** crates/**
bench/nested-deps/** bench/nested-deps/**
bench/nested-deps-app-router/** bench/nested-deps-app-router/**
bench/heavy-npm-deps/** bench/heavy-npm-deps/**
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"examples": ["examples/**"], "examples": ["examples/**"],
"Font (next/font)": ["**/*font*"], "Font (next/font)": ["**/*font*"],
"tests": ["test/**", "bench/**"], "tests": ["test/**", "bench/**"],
"Turbopack": ["packages/next-swc/crates/next-*/**"], "Turbopack": ["crates/next-*/**"],
"created-by: Chrome Aurora": [ "created-by: Chrome Aurora": [
{ "type": "user", "pattern": "atcastle" }, { "type": "user", "pattern": "atcastle" },
{ "type": "user", "pattern": "devknoll" }, { "type": "user", "pattern": "devknoll" },
......
...@@ -429,7 +429,7 @@ jobs: ...@@ -429,7 +429,7 @@ jobs:
run: turbo run build-wasm -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }} run: turbo run build-wasm -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }}
- name: Add target to folder name - name: Add target to folder name
run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-${{ matrix.target }} || ls packages/next-swc/crates/wasm' run: '[[ -d "crates/wasm/pkg" ]] && mv crates/wasm/pkg crates/wasm/pkg-${{ matrix.target }} || ls crates/wasm'
- name: Upload turbo summary artifact - name: Upload turbo summary artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
...@@ -441,7 +441,7 @@ jobs: ...@@ -441,7 +441,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: wasm-binaries-${{matrix.target}} name: wasm-binaries-${{matrix.target}}
path: packages/next-swc/crates/wasm/pkg-* path: crates/wasm/pkg-*
deploy-tarball: deploy-tarball:
if: ${{ needs.deploy-target.outputs.value != 'production' }} if: ${{ needs.deploy-target.outputs.value != 'production' }}
...@@ -486,7 +486,7 @@ jobs: ...@@ -486,7 +486,7 @@ jobs:
with: with:
pattern: wasm-binaries-* pattern: wasm-binaries-*
merge-multiple: true merge-multiple: true
path: packages/next-swc/crates/wasm path: crates/wasm
- name: Create tarballs - name: Create tarballs
run: node scripts/create-preview-tarballs.js "${{ github.sha }}" "${{ runner.temp }}/preview-tarballs" run: node scripts/create-preview-tarballs.js "${{ github.sha }}" "${{ runner.temp }}/preview-tarballs"
...@@ -546,7 +546,7 @@ jobs: ...@@ -546,7 +546,7 @@ jobs:
with: with:
pattern: wasm-binaries-* pattern: wasm-binaries-*
merge-multiple: true merge-multiple: true
path: packages/next-swc/crates/wasm path: crates/wasm
- run: npm i -g npm@10.4.0 # need latest version for provenance (pinning to avoid bugs) - run: npm i -g npm@10.4.0 # need latest version for provenance (pinning to avoid bugs)
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
......
...@@ -241,7 +241,7 @@ jobs: ...@@ -241,7 +241,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: with:
afterBuild: rustup target add wasm32-unknown-unknown && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh && node ./scripts/normalize-version-bump.js && turbo run build-wasm -- --target nodejs && git checkout . && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs && node ./scripts/setup-wasm.mjs && NEXT_TEST_MODE=start TEST_WASM=true node run-tests.js test/production/pages-dir/production/test/index.test.ts test/e2e/streaming-ssr/index.test.ts afterBuild: rustup target add wasm32-unknown-unknown && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh && node ./scripts/normalize-version-bump.js && turbo run build-wasm -- --target nodejs && git checkout . && mv crates/wasm/pkg crates/wasm/pkg-nodejs && node ./scripts/setup-wasm.mjs && NEXT_TEST_MODE=start TEST_WASM=true node run-tests.js test/production/pages-dir/production/test/index.test.ts test/e2e/streaming-ssr/index.test.ts
stepName: 'test-next-swc-wasm' stepName: 'test-next-swc-wasm'
secrets: inherit secrets: inherit
......
...@@ -16,16 +16,16 @@ packages/next/src/bundles/webpack/packages/lazy-compilation-*.js ...@@ -16,16 +16,16 @@ packages/next/src/bundles/webpack/packages/lazy-compilation-*.js
.github/actions/next-stats-action/.work .github/actions/next-stats-action/.work
packages/next-swc/crates/**/tests/**/output* crates/**/tests/**/output*
packages/next-swc/crates/core/tests/loader/issue-32553/input.js crates/core/tests/loader/issue-32553/input.js
# prettier destroys the directives here # prettier destroys the directives here
packages/next-swc/crates/next-custom-transforms/tests/errors/react-server-components/client-graph/use-client/input.js crates/next-custom-transforms/tests/errors/react-server-components/client-graph/use-client/input.js
packages/next-swc/crates/next-custom-transforms/tests/errors/react-server-components/server-graph/fake-client-entry/input.js crates/next-custom-transforms/tests/errors/react-server-components/server-graph/fake-client-entry/input.js
packages/next-swc/crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/input.js crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/input.js
packages/next-swc/crates/next-custom-transforms/tests/errors/server-actions/server-graph/9/input.js crates/next-custom-transforms/tests/errors/server-actions/server-graph/9/input.js
packages/next-swc/crates/next-custom-transforms/tests/fixture/optimize-barrel/normal/4/input.js crates/next-custom-transforms/tests/fixture/optimize-barrel/normal/4/input.js
packages/next-swc/crates/next-custom-transforms/tests/fixture/react-server-components/client-graph/client-entry/input.js crates/next-custom-transforms/tests/fixture/react-server-components/client-graph/client-entry/input.js
packages/next-swc/crates/next-custom-transforms/tests/fixture/react-server-components/server-graph/client-entry/input.js crates/next-custom-transforms/tests/fixture/react-server-components/server-graph/client-entry/input.js
packages/next-swc/native/**/* packages/next-swc/native/**/*
packages/next-swc/docs/assets/**/* packages/next-swc/docs/assets/**/*
......
...@@ -3,13 +3,13 @@ resolver = "2" ...@@ -3,13 +3,13 @@ resolver = "2"
members = [ members = [
"scripts/send-trace-to-jaeger", "scripts/send-trace-to-jaeger",
"packages/next-swc/crates/napi", "crates/napi",
"packages/next-swc/crates/wasm", "crates/wasm",
"packages/next-swc/crates/next-api", "crates/next-api",
"packages/next-swc/crates/next-build-test", "crates/next-build-test",
"packages/next-swc/crates/next-build", "crates/next-build",
"packages/next-swc/crates/next-core", "crates/next-core",
"packages/next-swc/crates/next-custom-transforms", "crates/next-custom-transforms",
] ]
[workspace.lints.clippy] [workspace.lints.clippy]
...@@ -25,10 +25,10 @@ opt-level = 3 ...@@ -25,10 +25,10 @@ opt-level = 3
[workspace.dependencies] [workspace.dependencies]
# Workspace crates # Workspace crates
next-api = { path = "packages/next-swc/crates/next-api" } next-api = { path = "crates/next-api" }
next-build = { path = "packages/next-swc/crates/next-build" } next-build = { path = "crates/next-build" }
next-core = { path = "packages/next-swc/crates/next-core" } next-core = { path = "crates/next-core" }
next-custom-transforms = { path = "packages/next-swc/crates/next-custom-transforms" } next-custom-transforms = { path = "crates/next-custom-transforms" }
# SWC crates # SWC crates
swc_core = { version = "0.96.9", features = [ swc_core = { version = "0.96.9", features = [
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/darwin-arm64" "directory": "crates/napi/npm/darwin-arm64"
}, },
"os": [ "os": [
"darwin" "darwin"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/darwin-x64" "directory": "crates/napi/npm/darwin-x64"
}, },
"os": [ "os": [
"darwin" "darwin"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/linux-arm64-gnu" "directory": "crates/napi/npm/linux-arm64-gnu"
}, },
"os": [ "os": [
"linux" "linux"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/linux-arm64-musl" "directory": "crates/napi/npm/linux-arm64-musl"
}, },
"os": [ "os": [
"linux" "linux"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/linux-x64-gnu" "directory": "crates/napi/npm/linux-x64-gnu"
}, },
"os": [ "os": [
"linux" "linux"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/linux-x64-musl" "directory": "crates/napi/npm/linux-x64-musl"
}, },
"os": [ "os": [
"linux" "linux"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/win32-arm64-msvc" "directory": "crates/napi/npm/win32-arm64-msvc"
}, },
"os": [ "os": [
"win32" "win32"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/win32-ia32-msvc" "directory": "crates/napi/npm/win32-ia32-msvc"
}, },
"os": [ "os": [
"win32" "win32"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/vercel/next.js", "url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/win32-x64-msvc" "directory": "crates/napi/npm/win32-x64-msvc"
}, },
"os": [ "os": [
"win32" "win32"
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
"license": "UNLICENSED", "license": "UNLICENSED",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "pnpm check",
"check": "tsc --noEmit" "check": "tsc --noEmit"
},
"dependencies": {
"next": "workspace:*"
} }
} }
/// <reference types="next/client" />
// inserted by rust code // inserted by rust code
declare const PAGE_PATH: string declare const PAGE_PATH: string
// Adapted from https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/loaders/next-client-pages-loader.ts // Adapted from https://github.com/vercel/next.js/blob/b7f9f1f98fc8ab602e84825105b5727272b72e7d/packages/next/src/build/webpack/loaders/next-client-pages-loader.ts
;(window.__NEXT_P = window.__NEXT_P || []).push([ ;(window.__NEXT_P = window.__NEXT_P || []).push([
PAGE_PATH, PAGE_PATH,
() => { () => {
return require('PAGE') return require('PAGE')
}, },
]) ])
// @ts-expect-error module.hot exists
if (module.hot) { if (module.hot) {
// @ts-expect-error module.hot exists
module.hot.dispose(function () { module.hot.dispose(function () {
window.__NEXT_P.push([PAGE_PATH]) window.__NEXT_P.push([PAGE_PATH])
}) })
......
...@@ -18,15 +18,8 @@ ...@@ -18,15 +18,8 @@
"baseUrl": ".", "baseUrl": ".",
"module": "node16", "module": "node16",
"moduleResolution": "node16", "moduleResolution": "node16",
"paths": {
"@vercel/turbopack-next/*": ["src/*"],
"@vercel/turbopack-next/pages/_app": ["node_modules/next/app"],
"@vercel/turbopack-next/pages/_document": ["node_modules/next/document"],
"@vercel/turbopack-next/pages/_error": ["node_modules/next/error"],
"@vercel/turbopack-next/internal/_error": ["node_modules/next/error"]
},
"resolveJsonModule": true, "resolveJsonModule": true,
"types": ["react/next"], "types": ["next"],
// emit // emit
"noEmit": true, "noEmit": true,
"stripInternal": true "stripInternal": true
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment