Skip to content

Commit

Permalink
Merge branch 'canary' into feedthejim/next-918-make-default-pagets-404
Browse files Browse the repository at this point in the history
  • Loading branch information
feedthejim committed Apr 4, 2023
2 parents 6ce7349 + f621830 commit b59a53d
Show file tree
Hide file tree
Showing 39 changed files with 1,135 additions and 755 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/1.bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ body:
- 'Data fetching (gS(S)P, getInitialProps)'
- 'Dynamic imports (next/dynamic)'
- 'ESLint (eslint-config-next)'
- 'Font optimization (@next/font)'
- 'Font optimization (next/font)'
- 'Image optimization (next/image, next/legacy/image)'
- 'Internationalization (i18n)'
- 'Jest (next/jest)'
- 'MDX (@next/mdx)'
- 'Metadata (metadata, generateMetadata, next/head, head.js)'
- 'Middleware / Edge (API routes, runtime)'
- 'Operating System (Windows, MacOS, Linux)'
- 'Package manager (npm, pnpm, Yarn)'
- 'Routing (next/router, next/navigation, next/link)'
- 'Script optimization (next/script)'
Expand All @@ -47,7 +48,7 @@ body:
- 'SWC minifier (swcMinify: true)'
- 'SWC transpilation'
- 'Turbopack (--turbo)'
- 'TypeScript'
- 'TypeScript (plugin, built-in types)'
- type: input
attributes:
label: Link to the code that reproduces this issue
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [canary]
branches: ['canary', 'trunk-merge/*']
pull_request:
types: [opened, synchronize]

Expand Down Expand Up @@ -655,7 +655,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_TEST_JOB=1 NEXT_TEST_CNA=1 xvfb-run node run-tests.js test/integration/create-next-app/index.test.ts test/integration/create-next-app/templates.test.ts >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_TEST_JOB=1 NEXT_TEST_CNA=1 xvfb-run node run-tests.js test/integration/create-next-app/index.test.ts test/integration/create-next-app/templates.test.ts >> /proc/1/fd/1"
if: ${{ needs.build.outputs.docsChange == 'nope' }}

- name: Upload test trace
Expand Down Expand Up @@ -693,7 +693,7 @@ jobs:
key: ${{ github.sha }}-${{ github.run_number }}

- name: Run tests
run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && cd ./packages/next-codemod && pnpm build && pnpm test >> /proc/1/fd/1"
run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && npm i -g pnpm@${PNPM_VERSION} > /dev/null && cd ./packages/next-codemod && pnpm build && pnpm test >> /proc/1/fd/1"

testIntegration:
name: Test Integration
Expand Down Expand Up @@ -758,7 +758,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_TEST_JOB=1 TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/28 >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_TEST_JOB=1 TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --timings -g ${{ matrix.group }}/28 >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

- name: Upload test trace
Expand Down Expand Up @@ -855,7 +855,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type development --timings -c 1 $TEST_FILES_LIST >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type development --timings -c 1 $TEST_FILES_LIST >> /proc/1/fd/1"
name: Run test/development
if: ${{needs.build.outputs.docsChange == 'nope'}}

Expand Down Expand Up @@ -901,7 +901,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_MAINTENANCE_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && BROWSERNAME=firefox NEXT_TEST_JOB=1 TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js test/integration/production/test/index.test.js >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_MAINTENANCE_VERSION }} ./scripts/setup-node.sh && npm i -g pnpm@${PNPM_VERSION} > /dev/null && BROWSERNAME=firefox NEXT_TEST_JOB=1 TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js test/integration/production/test/index.test.js >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

testSafari:
Expand Down Expand Up @@ -955,7 +955,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && BROWSER_NAME=firefox NEXT_TEST_JOB=1 TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js test/integration/production/test/index.test.js >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && BROWSER_NAME=firefox NEXT_TEST_JOB=1 TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js test/integration/production/test/index.test.js >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

publishRelease:
Expand Down Expand Up @@ -1052,7 +1052,7 @@ jobs:
- run: RESET_VC_PROJECT=true node scripts/reset-vercel-project.mjs
name: Reset test project

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && npm i -g pnpm@${PNPM_VERSION} > /dev/null && VERCEL_TEST_TOKEN=${{ secrets.VERCEL_TEST_TOKEN }} VERCEL_TEST_TEAM=vtest314-next-e2e-tests NEXT_TEST_JOB=1 NEXT_TEST_MODE=deploy TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type e2e >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && npm i -g pnpm@${PNPM_VERSION} > /dev/null && VERCEL_TEST_TOKEN=${{ secrets.VERCEL_TEST_TOKEN }} VERCEL_TEST_TEAM=vtest314-next-e2e-tests NEXT_TEST_JOB=1 NEXT_TEST_MODE=deploy TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type e2e >> /proc/1/fd/1"
name: Run test/e2e (deploy)

- name: Upload test trace
Expand Down Expand Up @@ -1274,7 +1274,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && curl -s https://install-node.vercel.app/v${{ env.NODE_LTS_VERSION }} | FORCE=1 bash && node -v && node ./scripts/setup-wasm.mjs && npm i -g pnpm@${PNPM_VERSION} > /dev/null && TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js test/e2e/streaming-ssr/index.test.ts >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && node -v && node ./scripts/setup-wasm.mjs && npm i -g pnpm@${PNPM_VERSION} > /dev/null && TEST_WASM=true xvfb-run node run-tests.js test/integration/production/test/index.test.js test/e2e/streaming-ssr/index.test.ts >> /proc/1/fd/1"
if: ${{needs.build.outputs.docsChange == 'nope'}}

# Build binaries for publishing
Expand Down
2 changes: 1 addition & 1 deletion examples/with-chakra-ui/src/components/CTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const CTA = () => (
<Button
as={ChakraLink}
isExternal
href="https://github.com/vercel/next.js/blob/canary/examples/with-chakra-ui-typescript"
href="https://github.com/vercel/next.js/blob/canary/examples/with-chakra-ui"
variant="solid"
colorScheme="green"
rounded="button"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-dev-runtime": "https://gitpkg.now.sh/vercel/turbo/crates/turbopack-dev/js?turbopack-230321.3",
"@vercel/turbopack-dev-runtime": "https://gitpkg.vercel.app/vercel/turbo/crates/turbopack-dev/js?turbopack-230321.3",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub mod react_refresh;
pub mod router;
pub mod router_source;
mod runtime;
mod typescript;
mod transform_options;
mod util;
mod web_entry_source;

Expand Down
18 changes: 9 additions & 9 deletions packages/next-swc/crates/next-core/src/next_client/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use turbo_binding::{
turbopack::{
module_options::{
module_options_context::{ModuleOptionsContext, ModuleOptionsContextVc},
JsxTransformOptions, PostCssTransformOptions, WebpackLoadersOptions,
PostCssTransformOptions, WebpackLoadersOptions,
},
resolve_options_context::{ResolveOptionsContext, ResolveOptionsContextVc},
transition::TransitionsByNameVc,
Expand All @@ -46,7 +46,10 @@ use crate::{
get_next_client_resolved_map,
},
react_refresh::assert_can_resolve_react_refresh,
typescript::get_typescript_transform_options,
transform_options::{
get_decorators_transform_options, get_jsx_transform_options,
get_typescript_transform_options,
},
util::foreign_code_context_condition,
};

Expand Down Expand Up @@ -153,6 +156,8 @@ pub async fn get_client_module_options_context(
.is_found();

let tsconfig = get_typescript_transform_options(project_path);
let decorators_options = get_decorators_transform_options(project_path);
let jsx_runtime_options = get_jsx_transform_options(project_path);
let enable_webpack_loaders = {
let options = &*next_config.webpack_loaders_options().await?;
let loaders_options = WebpackLoadersOptions {
Expand All @@ -179,13 +184,7 @@ pub async fn get_client_module_options_context(
// We don't need to resolve React Refresh for each module. Instead,
// we try resolve it once at the root and pass down a context to all
// the modules.
enable_jsx: Some(
JsxTransformOptions {
import_source: None,
runtime: None,
}
.cell(),
),
enable_jsx: Some(jsx_runtime_options),
enable_emotion: true,
enable_react_refresh,
enable_styled_components: true,
Expand All @@ -196,6 +195,7 @@ pub async fn get_client_module_options_context(
}),
enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig),
decorators: Some(decorators_options),
rules: vec![(
foreign_code_context_condition(next_config).await?,
module_options_context.clone().cell(),
Expand Down
33 changes: 17 additions & 16 deletions packages/next-swc/crates/next-core/src/next_server/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use turbo_binding::{
node::execution_context::ExecutionContextVc,
turbopack::{
module_options::{
JsxTransformOptions, JsxTransformOptionsVc, ModuleOptionsContext,
ModuleOptionsContextVc, PostCssTransformOptions, WebpackLoadersOptions,
ModuleOptionsContext, ModuleOptionsContextVc, PostCssTransformOptions,
WebpackLoadersOptions,
},
resolve_options_context::{ResolveOptionsContext, ResolveOptionsContextVc},
},
Expand All @@ -31,7 +31,10 @@ use crate::{
next_build::{get_external_next_compiled_package_mapping, get_postcss_package_mapping},
next_config::NextConfigVc,
next_import_map::get_next_server_import_map,
typescript::get_typescript_transform_options,
transform_options::{
get_decorators_transform_options, get_jsx_transform_options,
get_typescript_transform_options,
},
util::foreign_code_context_condition,
};

Expand Down Expand Up @@ -230,6 +233,8 @@ pub async fn get_server_module_options_context(
};

let tsconfig = get_typescript_transform_options(project_path);
let decorators_options = get_decorators_transform_options(project_path);
let jsx_runtime_options = get_jsx_transform_options(project_path);

let module_options_context = match ty.into_value() {
ServerContextType::Pages { .. } | ServerContextType::PagesData { .. } => {
Expand All @@ -238,11 +243,12 @@ pub async fn get_server_module_options_context(
..Default::default()
};
ModuleOptionsContext {
enable_jsx: Some(get_jsx_transform_options()),
enable_jsx: Some(jsx_runtime_options),
enable_styled_jsx: true,
enable_postcss_transform,
enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig),
decorators: Some(decorators_options),
rules: vec![(
foreign_code_context_condition,
module_options_context.clone().cell(),
Expand All @@ -257,11 +263,12 @@ pub async fn get_server_module_options_context(
..Default::default()
};
ModuleOptionsContext {
enable_jsx: Some(get_jsx_transform_options()),
enable_jsx: Some(jsx_runtime_options),
enable_styled_jsx: true,
enable_postcss_transform,
enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig),
decorators: Some(decorators_options),
rules: vec![(
foreign_code_context_condition,
module_options_context.clone().cell(),
Expand All @@ -279,10 +286,11 @@ pub async fn get_server_module_options_context(
..Default::default()
};
ModuleOptionsContext {
enable_jsx: Some(get_jsx_transform_options()),
enable_jsx: Some(jsx_runtime_options),
enable_postcss_transform,
enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig),
decorators: Some(decorators_options),
rules: vec![(
foreign_code_context_condition,
module_options_context.clone().cell(),
Expand All @@ -300,6 +308,7 @@ pub async fn get_server_module_options_context(
enable_postcss_transform,
enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig),
decorators: Some(decorators_options),
rules: vec![(
foreign_code_context_condition,
module_options_context.clone().cell(),
Expand All @@ -314,11 +323,12 @@ pub async fn get_server_module_options_context(
..Default::default()
};
ModuleOptionsContext {
enable_jsx: Some(get_jsx_transform_options()),
enable_jsx: Some(jsx_runtime_options),
enable_styled_jsx: true,
enable_postcss_transform,
enable_webpack_loaders,
enable_typescript_transform: Some(tsconfig),
decorators: Some(decorators_options),
rules: vec![(
foreign_code_context_condition,
module_options_context.clone().cell(),
Expand All @@ -333,15 +343,6 @@ pub async fn get_server_module_options_context(
Ok(module_options_context)
}

#[turbo_tasks::function]
pub fn get_jsx_transform_options() -> JsxTransformOptionsVc {
JsxTransformOptions {
import_source: None,
runtime: None,
}
.cell()
}

#[turbo_tasks::function]
pub fn get_build_module_options_context() -> ModuleOptionsContextVc {
ModuleOptionsContext {
Expand Down
Loading

0 comments on commit b59a53d

Please sign in to comment.