feat(rust-port): Split up shim and cli (#2970)
* Created two separate chains for executing commands: One that uses the parsed arguments from clap that are
serialized to json, the other that still uses Cobra. Now to test to ensure that both do the same thing
* Adjusted json serialization. Now debugging
* Hooked up new CLI to commands
* Fixing compile error
* fixing lint error
* Fixing more Go lint errors
* Fixing lint errors
* fixing up tests
* Only using turbo state with link, login, and logout commands
* Reverting changes
* Removing more changes
* Deleting code and fixing lints
* Removed unlink command
* Fixing bugs
* Reverting more changes
* fixed all tests
* Refactored away duplicates using CLIConfigProvider interface
* Lint fixes
* Minor order tweak
* Added error if command is not handled
* PR feedback
* Minor fixes. Adding --__test-run flag
* Added workaround for subcommand help
* Moved logic around to accomodate login/logout/link/unlink
* Added some documentation, removed some printf
* Adding more tests.
* Hooked up link/login/unlink to --__test-run flag. Also added prysk tests for it.
* Split up derive into multiple lines
* Added comment explaining clap v3 in Cargo.toml
* Ported daemon
* Cleaning up code. Removed imports
* Fix lints
* Fixing lints
* Ported prune to Rust CLI
* Going all the way. Porting run to Rust CLI and upgrading back to clap v4
* Always gotta be testing
* Always be testing. Always. Be. Testing.
* Added tests for each singular flag. Now for combination tests
* WIP: Hooking up Rust CLI to Go run logic
* Disable color
* Removed root inference from Go side
* Fixing compile errors
* Update cli/cmd/turbo/main.go
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
* Patching up code for run
* PR changes
* Restored labeler
* Restore og.tsx
* Reverted run changes that somehow made it in here
* Fix run
* Update cli/internal/turbostate/turbostate.go
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
* feat: polyfill `global` with `globalThis` (#2666)
This PR changes the ecmascript chunk logic to polyfill `global` with `globalThis`. A more complex and less performant solution (but with the benefit of us knowing the runtime environment) would be to add an effect for simple identifier expressions.
* delete IsYarn util (#2668)
* feat(docs): new authors & consistent filesnames (#2680)
* Added caveat to environment variables docs (#2703)
Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>
* Fix publish workflow (#2681)
* change from yarn to pnpm (#2686)
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
* Reverted workflow changes
* Fixing tests. Added run args to base
* Trying to fix tests
* Rewrote some logic around run args handling
* Fixing up tests by adding flags and fixing parsing bugs
* Hooked up RepoState to Go code
* Fixing e2e tests
* Fixing e2e
* Gotta build shim, not turbo in package.json
* Patched integration test
* Reverted Cargo.toml
* Cargo.lock too
* Fixing tests
* Moving turbo binary to shim
* Fixed tests and CI
* Check for TURBO_BINARY_PATH
* Ported shell completions to Rust
* Fixed logic issue with TURBO_BINARY_PATH
* Created .gitignore file with generated rust and header files
* Second try on cleaning up generated files
* More CI fixes
* Realized we still need some inference
* Removed files that are edited by run-examples.sh
* Switched order of `cargo fmt --check` and `cargo clippy` because `cargo clippy` generates files needed for `cargo fmt --check`.
* Cleaning up changes.
* Fix one thing break another
* Accept integration changes
* Deleting more unused code
* Test fixes
* No longer need this line now that src/ffi.rs is gitignored
* PR feedback
* Update cli/internal/run/run.go
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
* Fixing typo
* Merged main
* PR feedback
* PR feedback
* Merge main
* Reverted workflow change
* Error on invalid unicode instead of lossy conversion
* PR feedback
* Squashed commit of the following:
commit 096b8b8b357abe985e4116108af8a87aaba968cb
Author: David Barrat <david@barrat.io>
Date: Mon Dec 5 15:29:41 2022 +0100
Docs: Add Authdog to Turbo Showcase page (#2921)
[Authdog](https://www.authdog.com/) is an Identity and Access Management as a Service platform, built upon Serverless technologies (AWS Lambda, Vercel, Fastly and Cloudflare Workers). I started looking for alternatives to Nx, some times ago and experimented with Turbo, decided to migrate some projects to this tool, awesome stuff!
commit e39d65eb5b97140fe6338dabfbd0ac3be2987d8f
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 15:23:40 2022 +0100
enable id reusing (#2895)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
commit 6b99818abd358ebb4fa3506b493e2fae34372d25
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 15:22:53 2022 +0100
Reduce wrapper tasks by eagerly resolving Vcs (#2933)
* resolve codegenerateable before calling it
* eagerly resolve some constructors to avoid creating many wrapper tasks
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
commit ce4c445cd2c17021b4397c8e3cf93d91921146ef
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 15:22:32 2022 +0100
Share TaskInputs between task cache and task (#2923)
Move bound task function into TaskState to allow unloading
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
commit e1bf5e2cde7ca2006c8a4c3455dec38e971aa3eb
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 14:32:24 2022 +0100
make sure that removing collectibles will cleanup helper entries (#2872)
commit 532eff76326fb9237a450345b45073c1061e5a37
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 13:27:22 2022 +0100
Reduce the number of Strings and wrapper tasks (#2834)
* use Cow to avoid creating Strings for trait function names
* trait calls avoid the resolve trait wrapper task when called on a resolved VC
* eagerly resolve some Vc that would otherwise create a lot of wrapper tasks
Depends on #2416
commit dc36fc41586e5763520b4a16d249cdd6779bc902
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 11:00:10 2022 +0100
reduce number of allocations (#2833)
VecDeque::new always allocates 7 elements
commit 4f247be94b03f44765ac8bd334194545cd992b9b
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date: Mon Dec 5 15:39:15 2022 +0800
Upgrade to Next.js 13 (#2906)
This gets our site updated to Next.js 13 and Nextra 2. As a bonus, this should help prevent some of the issues we're seeing in Sentry.
commit 1e818068241c308cd3260bd83eba294d890a6151
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Mon Dec 5 07:42:19 2022 +0100
shrink lists and sets that are stored in Tasks (#2873)
Reduces memory usage by 14%
commit cac79bbe35c5ee7d2bf14625bb709dff8010b8ad
Author: Ahab <ahabhgk@gmail.com>
Date: Sun Dec 4 13:23:26 2022 +0800
make lazy bundling for dynamic import more lazy (#2918)
For example:
```js
// index.js
setTimeout(() => {
import('./async.js').then(() => console.log('async.js loaded'))
}, 1000)
```
```js
// async.js
import './async.css';
console.log('async.js content')
```
For now the graph generated by above code will be like this:
<img width="1461" alt="Screen Shot 2022-12-03 at 21 22 24" src="https://user-images.githubusercontent.com/42857895/205442932-ebfd5126-ef3d-4205-b5b5-434126ad46f7.png">
The `ChunkGroup_async` will be a async chunk group of `ChunkGroup_index`, pushed at [turbopack-core/src/chunk/mod.rs#L462](https://github.com/vercel/turbo/blob/b7bcfc312e41367e2ec7f5fb37a6ee88a6b6545a/crates/turbopack-core/src/chunk/mod.rs#L462), and it will have a reference between `ChunkGroup_index` and `ChunkGroup_async`, but `ChunkGroup_async` will also be a chunk group of `ChunkGroup_async-manifest-chunk` created at [turbopack-ecmascript/src/chunk/loader.rs#L165](https://github.com/vercel/turbo/blob/b7bcfc312e41367e2ec7f5fb37a6ee88a6b6545a/crates/turbopack-ecmascript/src/chunk/loader.rs#L165), and will have a reference between `ChunkGroup_async-manifest-chunk` and `ChunkGroup_async`.
This leads to when the browser request '/_a8a837.js', turbopack will compile chunks in `ChunkGroup_index` ('/_a8a837.js'), `ChunkGroup_async-manifest-chunk` ('/src_async.js_manifest-chunk.js'), and also chunks in `ChunkGroup_async` ('/src_async.js', '/src_async.css'), because of the reference between `ChunkGroup_index` and `ChunkGroup_async`.
But the expected behavior is only compile chunks in `ChunkGroup_index` and `ChunkGroup_async-manifest-chunk`, so this PR deleted the reference between `ChunkGroup_index` and `ChunkGroup_async`, makes the graph be like this:
<img width="1461" alt="Screen Shot 2022-12-03 at 21 50 29" src="https://user-images.githubusercontent.com/42857895/205444165-7b266dce-9aa6-4829-b8dc-d2bf74642aff.png">
And makes chunks in `ChunkGroup_async` to be compiled only when the browser request '/src_async.js_manifest-chunk.js'.
commit fd09f2e7cba7bcff030c1f10f31fc0155dd055fe
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date: Sun Dec 4 03:26:37 2022 +0000
chore(deps): update dependency @types/node to v18.11.10 (#2928)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>
commit 429e91eae5c313556fe8cb0bde87ab521e28d7cf
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat Dec 3 22:21:26 2022 -0500
chore(deps): update dependency @babel/core to v7.20.5 (#2919)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
commit 6478d61585f414ec9fb6ec822d8c5c052156b690
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date: Sat Dec 3 22:11:10 2022 +0100
update chromiumoxide (#2916)
updating in hope that this fixes the random errors in test runs
commit b7bcfc312e41367e2ec7f5fb37a6ee88a6b6545a
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat Dec 3 08:54:50 2022 +0000
chore(deps): update rust crate futures to 0.3.25 (#2915)
[](https://renovatebot.com)
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dev-dependencies | patch | `0.3.21` -> `0.3.25` |
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.21` -> `0.3.25` |
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.24` -> `0.3.25` |
---
### ⚠ Dependency Lookup Warnings ⚠
Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information.
---
### Release Notes
<details>
<summary>rust-lang/futures-rs</summary>
### [`v0.3.25`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#​0325---2022-10-20)
[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.24...0.3.25)
- Fix soundness issue in `join!` and `try_join!` macros ([#​2649](https://togithub.com/rust-lang/futures-rs/issues/2649))
- Implement `Clone` for `sink::Drain` ([#​2650](https://togithub.com/rust-lang/futures-rs/issues/2650))
### [`v0.3.24`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#​0324---2022-08-29)
[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.23...0.3.24)
- Fix incorrect termination of `select_with_strategy` streams ([#​2635](https://togithub.com/rust-lang/futures-rs/issues/2635))
### [`v0.3.23`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#​0323---2022-08-14)
[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.22...0.3.23)
- Work around MSRV increase due to a cargo bug.
### [`v0.3.22`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#​0322---2022-08-14)
[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.21...0.3.22)
- Fix `Sync` impl of `BiLockGuard` ([#​2570](https://togithub.com/rust-lang/futures-rs/issues/2570))
- Fix partial iteration in `FuturesUnordered` ([#​2574](https://togithub.com/rust-lang/futures-rs/issues/2574))
- Fix false detection of inner panics in `Shared` ([#​2576](https://togithub.com/rust-lang/futures-rs/issues/2576))
- Add `Mutex::lock_owned` and `Mutex::try_lock_owned` ([#​2571](https://togithub.com/rust-lang/futures-rs/issues/2571))
- Add `io::copy_buf_abortable` ([#​2507](https://togithub.com/rust-lang/futures-rs/issues/2507))
- Remove `Unpin` bound from `TryStreamExt::into_async_read` ([#​2599](https://togithub.com/rust-lang/futures-rs/issues/2599))
- Make `run_until_stalled` handle self-waking futures ([#​2593](https://togithub.com/rust-lang/futures-rs/issues/2593))
- Use `FuturesOrdered` in `try_join_all` ([#​2556](https://togithub.com/rust-lang/futures-rs/issues/2556))
- Fix orderings in `LocalPool` waker ([#​2608](https://togithub.com/rust-lang/futures-rs/issues/2608))
- Fix `stream::Chunk` adapters size hints ([#​2611](https://togithub.com/rust-lang/futures-rs/issues/2611))
- Add `push_front` and `push_back` to `FuturesOrdered` ([#​2591](https://togithub.com/rust-lang/futures-rs/issues/2591))
- Deprecate `FuturesOrdered::push` in favor of `FuturesOrdered::push_back` ([#​2591](https://togithub.com/rust-lang/futures-rs/issues/2591))
- Performance improvements ([#​2583](https://togithub.com/rust-lang/futures-rs/issues/2583), [#​2626](https://togithub.com/rust-lang/futures-rs/issues/2626))
- Documentation improvements ([#​2579](https://togithub.com/rust-lang/futures-rs/issues/2579), [#​2604](https://togithub.com/rust-lang/futures-rs/issues/2604), [#​2613](https://togithub.com/rust-lang/futures-rs/issues/2613))
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.
---
- [ ] If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/vercel/turbo).
commit 93222f2b22d43bd9c1d917350f810e5398ca9d49
Author: Anthony Shew <anthony.shew@vercel.com>
Date: Fri Dec 2 16:36:55 2022 -0800
feat(docs): document topology outside of a task (#2879)
* Docs for topology outside of a task
Documentation for behavior in #2855!
* Minor cleanup.
* Some copy updates and add image.
Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>
commit f8aaf81cb7c833f672001eb36d30d700e1cf6cc9
Author: Will Binns-Smith <wbinnssmith@gmail.com>
Date: Fri Dec 2 16:32:35 2022 -0800
Link to Turbopack's architecture.md from CONTRIBUTING.md (#2913)
commit 07231701892cbca7b73e35bfb490f2514770628e
Author: Thomas Knickman <tom.knickman@vercel.com>
Date: Fri Dec 2 16:40:08 2022 -0500
feat(docs): add github (#2912)
commit c69298c4a31516129bb62263f163a1da9c5614da
Author: OJ Kwon <1210596+kwonoj@users.noreply.github.com>
Date: Fri Dec 2 11:58:55 2022 -0800
build(cargo): update swc_core, dependencies to resolve circular deps (#2869)
* build(cargo): bump up swc_core
* build(cargo): unpin indexmap
* build(cargo): update dependencies
* style(cargo): adjust format
commit 6965cb81ef5693b3e7a23e6a999be04d6590fad5
Author: Leah <github.leah@hrmny.sh>
Date: Fri Dec 2 19:42:05 2022 +0100
set correct cwd for server renderer (#2886)
commit 4a3cb941b42923883a665a54270c7b6fdd46034a
Author: Leah <github.leah@hrmny.sh>
Date: Fri Dec 2 18:27:02 2022 +0100
fix dynamic paths (#2884)
commit eead9063968a3b8571e3ba2c7a897522f890e2fc
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date: Fri Dec 2 16:09:08 2022 +0800
Fix the missing links. (#2707)
This PR does three things:
1. Prevents double redirects by setting the correct destination the first time.
2. Redirects URLs accidentally recreated in the new scope. 🤦♂️
3. Removes a catch-all to trigger any additional missing links to appear.
Changes are easy to review commit-by-commit.
commit b8c0c3c74636fd4b0586951011919bc05e1f651d
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date: Fri Dec 2 14:37:03 2022 +0800
Update lint-staged behavior. (#2904)
Before #2859:
`eslint --quiet --fix`
After #2859:
`pnpm run lint --quiet --fix --`
=>
`eslint . --ext js,jsx,ts,tsx --quiet --fix --`
After this:
`eslint --ext js,jsx,ts,tsx --quiet --fix --`
Removes the sneaky `.`.
commit 336ea22098ff8825e83baa2561d8ec0acf5b52af
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date: Fri Dec 2 08:33:21 2022 +0800
Add additional detailed warning message if no tasks were run. (#2778)
This is a quality of life improvement output log so that you don't have to tease it out from the overall run summary and the situation is more-apparent.
commit 9359c46a3663834aefb8df6479ac86a0668925a3
Author: Leah <github.leah@hrmny.sh>
Date: Thu Dec 1 21:02:33 2022 +0100
simplify `next-binding` (#2899)
commit 22c1440283ed4dfd1e310210108244c4c12d4c56
Author: Justin Ridgewell <justin@ridgewell.name>
Date: Thu Dec 1 13:55:15 2022 -0500
Implement import.meta (#2816)
I chose to have the `import.meta.url` to have the relative project path on disk.
Webpack makes it the absolute system path, but that would make the JS output system dependent and I didn't like that. Vite doesn't bundle and uses the browser's behavior, which is the dev server path.
I'm splitting this from the in-progress PR to implement `new URL(…, import.meta.url)` support. That requires a bunch of changes to the analysis code and a new FS content source, so it's taking longer to ship.
Fixes WEB-137.
commit 75a7d1ea450cdaa629920464b509f3098997ae06
Author: Thomas Knickman <tom.knickman@vercel.com>
Date: Thu Dec 1 11:40:15 2022 -0500
fix(examples): cra pnpm fix (#2897)
* Merged main
* Reverting changes that snuck in
* Fixing tests
* Final fixes for tests
* Moving shim to crates/turborepo
* More refactoring
* First pass at splitting up shim and cli
* Fixing tests
* Added detection for help flag so users can get help outside of a valid repo
* Update crates/turborepo-lib/src/shim.rs
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
* Update crates/turborepo/Cargo.toml
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
* PR feedback and test fixing
* Set process's cwd
* Have to do inference even with TURBO_BINARY_PATH
* Comments
* PR feedback
* Moved single_package back to RunArgs
* Removed print
* Fixing bugs
* Fixing rust tests
* fixing bug with verbosity and Go tests
* add local turbo version checking
* remove ffi inclusion
* Fixed integration tests
* Linting fixes
* Integrated local_turbo_supports_skip_shim
* Fixed bug with cwd and restored yarn.lock
* Okay back to setting current_dir
* Fixed bug with canonicalization
* Removed print
starting
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
Co-authored-by: Florentin / 珞辰 <ecklf@icloud.com>
Co-authored-by: Chris Olszewski <chris.olszewski@vercel.com>
Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>
Co-authored-by: Matt Pocock <mattpocockvoice@gmail.com>
Co-authored-by: Mehul Kar <mehul.kar@vercel.com>
Co-authored-by: Yota Hada <hadayota33@gmail.com>
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>