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

chore: fix references for the new turbopack crates #68128

Merged
merged 5 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }
TURBO_PNPM_WORKSPACE_DIR = { value = "", relative = true }

[build]
rustflags = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
id: no-context
snapshots:
"fn foo(context: ChunkingContext) -> u32 { 5 };":
'fn foo(context: ChunkingContext) -> u32 { 5 };':
labels:
- source: context
style: primary
start: 7
end: 14
- source: "context: ChunkingContext"
- source: 'context: ChunkingContext'
style: secondary
start: 7
end: 31
Expand All @@ -16,7 +16,7 @@ snapshots:
style: primary
start: 5
end: 12
- source: "|context|"
- source: '|context|'
style: secondary
start: 4
end: 13
Expand All @@ -30,13 +30,13 @@ snapshots:
style: secondary
start: 0
end: 37
"struct Foo { context: Context };":
'struct Foo { context: Context };':
labels:
- source: context
style: primary
start: 13
end: 20
- source: "context: Context"
- source: 'context: Context'
style: secondary
start: 13
end: 29
11 changes: 11 additions & 0 deletions .config/ast-grep/rule-tests/no-context-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id: no-context
valid:
- 'let chunking_context = ChunkingContext::new();'
- 'struct Foo { chunking_context: Context };'
- 'foo(|chunking_context| context)'
- 'fn foo(chunking_context: ChunkingContext) -> u32 { 5 };'
invalid:
- 'let context = ChunkingContext::new();'
- 'struct Foo { context: Context };'
- 'foo(|context| context)'
- 'fn foo(context: ChunkingContext) -> u32 { 5 };'
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ rule:
- inside:
kind: field_declaration
ignores:
- "./crates/turbopack-css/**"
- "./crates/turbopack-dev-server/**"
- "./crates/turbopack-browser/**"
- "./crates/turbopack-ecmascript-hmr-protocol/**"
- "./crates/turbopack-ecmascript-plugins/**"
- "./crates/turbopack-ecmascript-runtime/**"
- "./crates/turbopack-json/**"
- "./crates/turbopack-mdx/**"
- "./crates/turbopack-node/**"
- "./crates/turbopack-static/**"
- "./crates/turbopack-tests/**"
- "./crates/turbopack/**"
- "./crates/turborepo-cache/**"
- "./crates/turborepo-scm/**"
- './crates/turbopack-css/**'
- './crates/turbopack-dev-server/**'
- './crates/turbopack-browser/**'
- './crates/turbopack-ecmascript-hmr-protocol/**'
- './crates/turbopack-ecmascript-plugins/**'
- './crates/turbopack-ecmascript-runtime/**'
- './crates/turbopack-json/**'
- './crates/turbopack-mdx/**'
- './crates/turbopack-node/**'
- './crates/turbopack-static/**'
- './crates/turbopack-tests/**'
- './crates/turbopack/**'
- './crates/turborepo-cache/**'
- './crates/turborepo-scm/**'
File renamed without changes.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ packages/next-swc/docs/assets/**/*
test/lib/amp-validator-wasm.js
test/production/pages-dir/production/fixture/amp-validator-wasm.js
test/e2e/async-modules/amp-validator-wasm.js

# turbopack crates
turbopack/crates/*/tests/**
turbopack/crates/*/js/src/compiled
7 changes: 6 additions & 1 deletion .eslintrc.cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"files": ["**/*.ts", "**/*.tsx"],
// Linting with type-checked rules is very slow and needs a lot of memory,
// so we exclude non-essential files.
"excludedFiles": ["examples/**/*", "test/**/*", "**/*.d.ts"],
"excludedFiles": [
"examples/**/*",
"test/**/*",
"**/*.d.ts",
"turbopack/**/*"
],
"parserOptions": {
"project": true
},
Expand Down
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"commonjs": true,
"es6": true,
"node": true,
"jest": true
"jest": true,
"es2020": true
},
"parserOptions": {
"requireConfigFile": false,
Expand Down Expand Up @@ -101,7 +102,11 @@
"error",
{
"args": "none",
"ignoreRestSiblings": true
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-use-before-define": "off",
Expand Down
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ packages/next/compiled/** -text linguist-vendored

# Make next/src/build folder indexable for github search
build/** linguist-generated=false

turbopack/crates/turbo-tasks-macros-tests/tests/**/*.stderr linguist-generated=true
turbopack/crates/turbopack-ecmascript/tests/tree-shaker/analyzer/**/output.md linguist-generated=true
turbopack/crates/turbopack-tests/tests/snapshot/**/output/** linguist-generated=true
10 changes: 9 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,21 @@ jobs:
uses: ./.github/workflows/build_reusable.yml
with:
needsRust: 'yes'
skipInstallBuild: 'yes'
needsNextest: 'yes'
skipNativeBuild: 'yes'
afterBuild: turbo run test-cargo-unit
mold: 'yes'
stepName: 'test-cargo-unit'
secrets: inherit

test-bench:
name: test cargo benches
needs: ['changes', 'build-next']
if: ${{ needs.changes.outputs.docs-only == 'false' }}

uses: ./.github/workflows/test-turbopack-rust-bench-test.yml
secrets: inherit

rust-check:
name: rust check
needs: ['changes', 'build-next']
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ jobs:
- run: pnpm install
if: ${{ inputs.skipInstallBuild != 'yes' }}

- name: Install node-file-trace test dependencies
if: ${{ inputs.needsNextest == 'yes' }}
working-directory: turbopack/crates/turbopack/tests/node-file-trace
run: pnpm install -r --side-effects-cache false

- run: ANALYZE=1 pnpm build
if: ${{ inputs.skipInstallBuild != 'yes' }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ on:
inputs:
runner:
type: string
default: '["self-hosted", "linux", "x64", "metal"]'
os:
type: string
default: 'linux'
all:
type: boolean
default: false

env:
TURBOPACK_BENCH_COUNTS: "100"
TURBOPACK_BENCH_PROGRESS: "1"
TURBOPACK_BENCH_COUNTS: '100'
TURBOPACK_BENCH_PROGRESS: '1'

NODE_LTS_VERSION: 20

jobs:
test:
name: Test
# alias custom runner name to our labels array
runs-on: ${{ inputs.runner == 'ubuntu-latest-metal' && fromJSON('[ "self-hosted", "linux", "x64", "metal" ]') || inputs.runner }}
runs-on: ${{ fromJSON(inputs.runner) }}
steps:
- name: Set git to use LF
run: |
Expand All @@ -30,26 +34,23 @@ jobs:

- name: Setup Rust
uses: ./.github/actions/setup-rust
env:
GITHUB_TOKEN: ${{ github.token }}
with:
save-cache: true
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true
- run: corepack enable

- name: Build benchmarks for tests
timeout-minutes: 120
run: |
cargo tp-bench-test --no-run
cargo test --benches --workspace --release --no-fail-fast --exclude turbopack-bench --exclude next-swc-napi --no-run

- name: Run cargo test on benchmarks
timeout-minutes: 120
run: |
cargo tp-bench-test
cargo test --benches --workspace --release --no-fail-fast --exclude turbopack-bench --exclude next-swc-napi

- name: Build benchmarks for tests for other bundlers
if: inputs.all
Expand Down
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ bench/nested-deps/components/**/*
test/lib/amp-validator-wasm.js
test/production/pages-dir/production/fixture/amp-validator-wasm.js
test/e2e/async-modules/amp-validator-wasm.js

# turbopack crates
turbopack/crates/*/js/src/compiled
turbopack/crates/turbopack/bench.json
turbopack/crates/turbopack/tests
turbopack/crates/turbopack-ecmascript/tests/analyzer/graph
turbopack/crates/turbopack-ecmascript/tests/tree-shaker
turbopack/crates/next-transform-strip-page-exports/tests
turbopack/crates/next-transform-dynamic/tests
turbopack/crates/turbopack-tests/tests/execution/turbopack/basic/error/input/broken.js
turbopack/crates/turbopack-tests/tests/**/output*

# temporarily disable prettier for the turbopack directory
turbopack/
Loading
Loading