Skip to content

Commit

Permalink
Add 'turbopack/' from commit 'fb033c4917bb1bb98b238f1b4c7a928b66a90887'
Browse files Browse the repository at this point in the history
git-subtree-dir: turbopack
git-subtree-mainline: 344ddbf
git-subtree-split: fb033c4
  • Loading branch information
ForsakenHarmony committed Aug 1, 2024
2 parents 344ddbf + fb033c4 commit becc655
Show file tree
Hide file tree
Showing 2,348 changed files with 394,656 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
id: no-context
snapshots:
"fn foo(context: ChunkingContext) -> u32 { 5 };":
labels:
- source: context
style: primary
start: 7
end: 14
- source: "context: ChunkingContext"
style: secondary
start: 7
end: 31
foo(|context| context):
labels:
- source: context
style: primary
start: 5
end: 12
- source: "|context|"
style: secondary
start: 4
end: 13
let context = ChunkingContext::new();:
labels:
- source: context
style: primary
start: 4
end: 11
- source: let context = ChunkingContext::new();
style: secondary
start: 0
end: 37
"struct Foo { context: Context };":
labels:
- source: context
style: primary
start: 13
end: 20
- source: "context: Context"
style: secondary
start: 13
end: 29
11 changes: 11 additions & 0 deletions turbopack/.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 };"
Empty file.
35 changes: 35 additions & 0 deletions turbopack/.config/ast-grep/rules/no-context.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
id: no-context
message: Don't name variables `context`.
note: Use a more specific name, such as chunking_context, asset_context, etc.
severity: error
language: Rust
rule:
regex: \bcontext\b
any:
- all:
- inside:
any:
- kind: closure_parameters
- kind: parameter
- kind: function_item
- kind: let_declaration
- kind: identifier
- all:
- kind: field_identifier
- 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/**"
17 changes: 17 additions & 0 deletions turbopack/.config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[profile.tp-test-linux.junit]
path = "junit.xml"
report-name = "Turbopack tests (Linux)"
store-success-output = true
store-failure-output = true

[profile.tp-test-mac.junit]
path = "junit.xml"
report-name = "Turbopack tests (Mac)"
store-success-output = true
store-failure-output = true

[profile.tp-test-win.junit]
path = "junit.xml"
report-name = "Turbopack tests (Windows)"
store-success-output = true
store-failure-output = true
24 changes: 24 additions & 0 deletions turbopack/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.t]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

[{go.mod,go.sum,*.go}]
indent_style = tab

[*.rs]
# Keep in sync with rustfmt
max_line_length = 100
indent_size = 4
64 changes: 64 additions & 0 deletions turbopack/.github/workflows/test-turbopack-rust-bench-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Turbopack Rust testing benchmarks
on:
workflow_call:
inputs:
runner:
type: string
os:
type: string
all:
type: boolean

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

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 }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
if: inputs.os == 'windows'

- name: Checkout
uses: actions/checkout@v3

- 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
with:
node-version: 18

- name: Build benchmarks for tests
timeout-minutes: 120
run: |
cargo tp-bench-test --no-run
- name: Run cargo test on benchmarks
timeout-minutes: 120
run: |
cargo tp-bench-test
- name: Build benchmarks for tests for other bundlers
if: inputs.all
timeout-minutes: 120
run: |
cargo test --benches --release -p turbopack-bench --no-run
- name: Run cargo test on benchmarks for other bundlers
if: inputs.all
timeout-minutes: 120
run: |
cargo test --benches --release -p turbopack-bench
47 changes: 47 additions & 0 deletions turbopack/crates/node-file-trace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
name = "node-file-trace"
version = "0.1.0"
description = "TBD"
license = "MPL-2.0"
edition = "2021"

[[bin]]
name = "node-file-trace"
path = "src/main.rs"
bench = false

[features]
default = ["cli", "custom_allocator"]
cli = ["dep:clap", "turbo-tasks-malloc"]
persistent_cache = []
serializable = []
tokio_console = [
"dep:console-subscriber",
"tokio/tracing",
"turbo-tasks/tokio_tracing",
]
node-api = []
custom_allocator = ["turbo-tasks-malloc", "turbo-tasks-malloc/custom_allocator"]

[lints]
workspace = true

[dependencies]
anyhow = { workspace = true }
clap = { workspace = true, optional = true, features = ["derive"] }
console-subscriber = { workspace = true, optional = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tokio = { workspace = true, features = ["full"] }

turbo-tasks = { workspace = true }
turbo-tasks-fs = { workspace = true }
turbo-tasks-malloc = { workspace = true, optional = true, default-features = false }
turbo-tasks-memory = { workspace = true }
turbopack = { workspace = true }
turbopack-cli-utils = { workspace = true }
turbopack-core = { workspace = true }
turbopack-resolve = { workspace = true }

[build-dependencies]
turbo-tasks-build = { workspace = true }
5 changes: 5 additions & 0 deletions turbopack/crates/node-file-trace/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use turbo_tasks_build::generate_register;

fn main() {
generate_register();
}
Loading

0 comments on commit becc655

Please sign in to comment.