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
!test/**/*.test.*
test/e2e/app-dir/rsc-errors/app/swc/use-client/page.js
test-timings.json
packages/next-swc/crates/**
crates/**
bench/nested-deps/**
bench/nested-deps-app-router/**
bench/heavy-npm-deps/**
......
......@@ -5,7 +5,7 @@
"examples": ["examples/**"],
"Font (next/font)": ["**/*font*"],
"tests": ["test/**", "bench/**"],
"Turbopack": ["packages/next-swc/crates/next-*/**"],
"Turbopack": ["crates/next-*/**"],
"created-by: Chrome Aurora": [
{ "type": "user", "pattern": "atcastle" },
{ "type": "user", "pattern": "devknoll" },
......
......@@ -429,7 +429,7 @@ jobs:
run: turbo run build-wasm -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ matrix.target }}
- 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
uses: actions/upload-artifact@v4
......@@ -441,7 +441,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: wasm-binaries-${{matrix.target}}
path: packages/next-swc/crates/wasm/pkg-*
path: crates/wasm/pkg-*
deploy-tarball:
if: ${{ needs.deploy-target.outputs.value != 'production' }}
......@@ -486,7 +486,7 @@ jobs:
with:
pattern: wasm-binaries-*
merge-multiple: true
path: packages/next-swc/crates/wasm
path: crates/wasm
- name: Create tarballs
run: node scripts/create-preview-tarballs.js "${{ github.sha }}" "${{ runner.temp }}/preview-tarballs"
......@@ -546,7 +546,7 @@ jobs:
with:
pattern: wasm-binaries-*
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: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
......
......@@ -241,7 +241,7 @@ jobs:
uses: ./.github/workflows/build_reusable.yml
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'
secrets: inherit
......
......@@ -16,16 +16,16 @@ packages/next/src/bundles/webpack/packages/lazy-compilation-*.js
.github/actions/next-stats-action/.work
packages/next-swc/crates/**/tests/**/output*
packages/next-swc/crates/core/tests/loader/issue-32553/input.js
crates/**/tests/**/output*
crates/core/tests/loader/issue-32553/input.js
# prettier destroys the directives here
packages/next-swc/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
packages/next-swc/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
packages/next-swc/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
packages/next-swc/crates/next-custom-transforms/tests/fixture/react-server-components/server-graph/client-entry/input.js
crates/next-custom-transforms/tests/errors/react-server-components/client-graph/use-client/input.js
crates/next-custom-transforms/tests/errors/react-server-components/server-graph/fake-client-entry/input.js
crates/next-custom-transforms/tests/errors/server-actions/server-graph/8/input.js
crates/next-custom-transforms/tests/errors/server-actions/server-graph/9/input.js
crates/next-custom-transforms/tests/fixture/optimize-barrel/normal/4/input.js
crates/next-custom-transforms/tests/fixture/react-server-components/client-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/docs/assets/**/*
......
......@@ -3,13 +3,13 @@ resolver = "2"
members = [
"scripts/send-trace-to-jaeger",
"packages/next-swc/crates/napi",
"packages/next-swc/crates/wasm",
"packages/next-swc/crates/next-api",
"packages/next-swc/crates/next-build-test",
"packages/next-swc/crates/next-build",
"packages/next-swc/crates/next-core",
"packages/next-swc/crates/next-custom-transforms",
"crates/napi",
"crates/wasm",
"crates/next-api",
"crates/next-build-test",
"crates/next-build",
"crates/next-core",
"crates/next-custom-transforms",
]
[workspace.lints.clippy]
......@@ -25,10 +25,10 @@ opt-level = 3
[workspace.dependencies]
# Workspace crates
next-api = { path = "packages/next-swc/crates/next-api" }
next-build = { path = "packages/next-swc/crates/next-build" }
next-core = { path = "packages/next-swc/crates/next-core" }
next-custom-transforms = { path = "packages/next-swc/crates/next-custom-transforms" }
next-api = { path = "crates/next-api" }
next-build = { path = "crates/next-build" }
next-core = { path = "crates/next-core" }
next-custom-transforms = { path = "crates/next-custom-transforms" }
# SWC crates
swc_core = { version = "0.96.9", features = [
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/darwin-arm64"
"directory": "crates/napi/npm/darwin-arm64"
},
"os": [
"darwin"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"url": "https://github.com/vercel/next.js",
"directory": "packages/next-swc/crates/napi/npm/darwin-x64"
"directory": "crates/napi/npm/darwin-x64"
},
"os": [
"darwin"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"linux"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"linux"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"linux"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"linux"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"win32"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"win32"
......
......@@ -4,7 +4,7 @@
"repository": {
"type": "git",
"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": [
"win32"
......
......@@ -5,6 +5,10 @@
"license": "UNLICENSED",
"private": true,
"scripts": {
"build": "pnpm check",
"check": "tsc --noEmit"
},
"dependencies": {
"next": "workspace:*"
}
}
/// <reference types="next/client" />
// inserted by rust code
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([
PAGE_PATH,
() => {
return require('PAGE')
},
])
// @ts-expect-error module.hot exists
if (module.hot) {
// @ts-expect-error module.hot exists
module.hot.dispose(function () {
window.__NEXT_P.push([PAGE_PATH])
})
......
......@@ -18,15 +18,8 @@
"baseUrl": ".",
"module": "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,
"types": ["react/next"],
"types": ["next"],
// emit
"noEmit": 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