Selective typst package staging with typst-gather#14174
Draft
gordonwoodhull wants to merge 3 commits intodeps/typst-gather-0.2.2from
Draft
Selective typst package staging with typst-gather#14174gordonwoodhull wants to merge 3 commits intodeps/typst-gather-0.2.2from
gordonwoodhull wants to merge 3 commits intodeps/typst-gather-0.2.2from
Conversation
Remove the Rust source tree at package/typst-gather/ and switch to the downloaded binary registered in the previous commit. - Remove archiveOnly flag to enable download during configure - Remove cargo build from configure.sh and configure.cmd - Remove typst-gather staging from prepare-dist.ts - Remove Cargo cache step from CI workflow - Add QUARTO_TYPST_GATHER env var override support
…mand for gathering Replace the TypeScript regex-based import scanning with a call to `typst-gather analyze`, which uses Typst's own parser for robust import discovery including nested imports and transitive @Local dependencies. - Remove parseSimpleToml(), discoverImportsFromFiles(), and related types - Add runAnalyze() that pipes TOML config to `typst-gather analyze -` on stdin - Rewrite generateConfigFromAnalysis() to consume structured JSON output - Pipe config on stdin for auto-detected gather (no temp files) - Use `gather` subcommand for all gather invocations - Add QUARTO_TYPST_GATHER env var override to call version - Extract typstGatherBinaryPath() shared helper - Add 12 unit tests for generateConfigFromAnalysis()
Instead of copying ALL packages from built-in resources and extensions into the scratch directory, use typst-gather analyze to determine the exact set of packages needed (including transitive deps), then stage only those. - Create src/core/typst-gather.ts shared module (moved from cmd.ts) - Decompose stageTypstPackages into collectPackageSources, analyzeNeededPackages, stageSelectedPackages, stageAllPackages - Change from first-write-wins to last-write-wins so extensions can override built-in packages - Falls back to staging everything if typst-gather binary is missing or analyze fails - 14 unit tests for staging functions and TOML building - 1 smoke test verifying no packages staged for import-free documents Fixes #14157
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
Summary
Replace copy-all-packages behavior with selective staging using
typst-gather analyze. When rendering a typst document in a project, only the packages actually imported are staged to.quarto/typst/packages/, rather than copying every package from every extension.Changes
Remove in-tree Rust project, activate binary dependency
package/typst-gather/Rust source tree (~4500 lines)archiveOnlyflag to enable download during configureQUARTO_TYPST_GATHERenv var override supportUse typst-gather analyze/gather subcommands
quarto call typst-gatherto useanalyzeandgathersubcommandssrc/core/typst-gather.ts--init-configto use analyze for import discoverySelective package staging during render
analyzeNeededPackages()runstypst-gather analyzeon the generated.typfilestageSelectedPackages()copies only needed packages (vs all).column-margin--init-configTest plan
typst-gather.test.ts+typst-staging.test.ts)typst-gather/typst-gather.test.ts)