Repository navigation
Robust VirtualPath type that pre-validates paths - #7688
Merged
Merged
Conversation
laurmaedje
force-pushed
the
proper-virtual-path
branch
from
January 13, 2026 11:49
a6f6d66 to
195b49c
Compare
This was referenced Jan 13, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jan 16, 2026
in typst/typst#7688, typst/typst#7689, typst/typst#7690, typst/typst#7555 to make tinymist-world work
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jan 16, 2026
in typst/typst#7688, typst/typst#7689, typst/typst#7690, typst/typst#7555 to make world crates work a
ParaN3xus
added a commit
to ParaN3xus/typst.ts
that referenced
this pull request
Jan 16, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jan 16, 2026
in typst/typst#7688, typst/typst#7689, typst/typst#7690, typst/typst#7555 to make world crates work a
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jan 16, 2026
in typst/typst#7688, typst/typst#7689, typst/typst#7690, typst/typst#7555 to make crates other than world crates work path path path path path
jassielof
pushed a commit
to jassielof/typst
that referenced
this pull request
Jan 16, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/typst.ts
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/typst.ts
that referenced
this pull request
May 15, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 24, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 24, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 24, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 24, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 24, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
May 24, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
This PR is part of the Typst 0.15 nightly cleanup stack. It sits on top of the world/output API group and keeps this slice focused on the new Typst path model. ## Upstream Typst Changes - [`typst/typst#7555` Add file `path` type](typst/typst#7555) - Introduces the new rooted path model around `RootedPath`, `VirtualRoot`, and `VirtualPath`. - `RootedPath` identifies a virtual file location as a pair of root plus virtual path. - `VirtualRoot::Project` represents the canonical project root; `VirtualRoot::Package(PackageSpec)` represents a package root. - `FileId` is now backed by an interned rooted path instead of the old optional-package plus path shape. This is why tinymist code now creates file IDs with `RootedPath::new(...).intern()` / `FileId::unique(...)` and reads roots through `file_id.root()`. - Tinymist must preserve its own workspace, untitled, rootless, and package-root concepts on top of Typst's new project/package root model. - [`typst/typst#7688` Robust `VirtualPath` type that pre-validates paths](typst/typst#7688) - `VirtualPath` construction is no longer just a lossy wrapper around arbitrary paths; it validates the path shape up front. - Call sites that previously used raw `Path` conversion now need `VirtualPath::new(...)`, `VirtualPath::virtualize(...)`, `join(...)`, `realize(...)`, `get_with_slash()`, or `get_without_slash()` depending on whether the value is still virtual or should be rendered as a platform path. - Tinymist updates workspace entry selection, mock VFS/world paths, query fixtures, docs imports, rename resolution, and document-link resolution so virtual paths remain valid and source-relative. - [`typst/typst#7708` Remove `PartialOrd` and `Ord` for `FileId`](typst/typst#7708) - `FileId` should be treated as an opaque interned identifier, not as a stable ordering key. - Tinymist replaces ordering-sensitive behavior with explicit package/path keys where determinism matters, e.g. coverage summaries and fixture/test ordering. - [`typst/typst#8215` Request standard library from `World` once upfront](typst/typst#8215) - This PR does not include the runtime/engine adaptation from that group. - It only carries over the minimal `typst-utils` workspace dependency because the original nightly order introduced that dependency before `444c2f2a`, while this logical path-model group already needs `typst-utils.workspace = true` in `tinymist-query`. ## Tinymist Changes - Ports the VFS path mapper to `RootedPath`, `VirtualRoot`, and validated `VirtualPath` operations. - Updates `EntryState`, mock VFS/world helpers, and tests to create valid virtual paths instead of relying on raw path wrapping. - Updates workspace/package/rootless path resolution so tinymist's workspace IDs continue to map onto Typst package roots where needed. - Updates analysis, docs, package import, rename, and document-link code to resolve relative imports from the source file's parent in the new path model. - Simplifies import path parent resolution so invalid parent paths naturally short-circuit instead of falling back to the original virtual path. - Adds compatibility helpers in `typst-shim`: - `as_rooted_path_compat()` for rendering a `VirtualPath` with a leading slash across stable/nightly Typst APIs. - `as_rootless_path_compat()` for rendering the same path without a leading slash. - `package_compat()` for obtaining the package root through the old or new `RootedPath` API. - Keeps snapshot churn and unrelated analysis/runtime changes out of this PR; those remain for later groups. --------- Co-authored-by: paran3xus <[email protected]>
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/typst.ts
that referenced
this pull request
Jun 15, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/typst.ts
that referenced
this pull request
Jun 15, 2026
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
This PR is part of the Typst 0.15 nightly cleanup stack. It sits on top of the world/output API group and keeps this slice focused on the new Typst path model. - [`typst/typst#7555` Add file `path` type](typst/typst#7555) - Introduces the new rooted path model around `RootedPath`, `VirtualRoot`, and `VirtualPath`. - `RootedPath` identifies a virtual file location as a pair of root plus virtual path. - `VirtualRoot::Project` represents the canonical project root; `VirtualRoot::Package(PackageSpec)` represents a package root. - `FileId` is now backed by an interned rooted path instead of the old optional-package plus path shape. This is why tinymist code now creates file IDs with `RootedPath::new(...).intern()` / `FileId::unique(...)` and reads roots through `file_id.root()`. - Tinymist must preserve its own workspace, untitled, rootless, and package-root concepts on top of Typst's new project/package root model. - [`typst/typst#7688` Robust `VirtualPath` type that pre-validates paths](typst/typst#7688) - `VirtualPath` construction is no longer just a lossy wrapper around arbitrary paths; it validates the path shape up front. - Call sites that previously used raw `Path` conversion now need `VirtualPath::new(...)`, `VirtualPath::virtualize(...)`, `join(...)`, `realize(...)`, `get_with_slash()`, or `get_without_slash()` depending on whether the value is still virtual or should be rendered as a platform path. - Tinymist updates workspace entry selection, mock VFS/world paths, query fixtures, docs imports, rename resolution, and document-link resolution so virtual paths remain valid and source-relative. - [`typst/typst#7708` Remove `PartialOrd` and `Ord` for `FileId`](typst/typst#7708) - `FileId` should be treated as an opaque interned identifier, not as a stable ordering key. - Tinymist replaces ordering-sensitive behavior with explicit package/path keys where determinism matters, e.g. coverage summaries and fixture/test ordering. - [`typst/typst#8215` Request standard library from `World` once upfront](typst/typst#8215) - This PR does not include the runtime/engine adaptation from that group. - It only carries over the minimal `typst-utils` workspace dependency because the original nightly order introduced that dependency before `444c2f2a`, while this logical path-model group already needs `typst-utils.workspace = true` in `tinymist-query`. - Ports the VFS path mapper to `RootedPath`, `VirtualRoot`, and validated `VirtualPath` operations. - Updates `EntryState`, mock VFS/world helpers, and tests to create valid virtual paths instead of relying on raw path wrapping. - Updates workspace/package/rootless path resolution so tinymist's workspace IDs continue to map onto Typst package roots where needed. - Updates analysis, docs, package import, rename, and document-link code to resolve relative imports from the source file's parent in the new path model. - Simplifies import path parent resolution so invalid parent paths naturally short-circuit instead of falling back to the original virtual path. - Adds compatibility helpers in `typst-shim`: - `as_rooted_path_compat()` for rendering a `VirtualPath` with a leading slash across stable/nightly Typst APIs. - `as_rootless_path_compat()` for rendering the same path without a leading slash. - `package_compat()` for obtaining the package root through the old or new `RootedPath` API. - Keeps snapshot churn and unrelated analysis/runtime changes out of this PR; those remain for later groups. --------- Co-authored-by: paran3xus <[email protected]>
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
This PR is part of the Typst 0.15 nightly cleanup stack. It sits on top of the world/output API group and keeps this slice focused on the new Typst path model. - [`typst/typst#7555` Add file `path` type](typst/typst#7555) - Introduces the new rooted path model around `RootedPath`, `VirtualRoot`, and `VirtualPath`. - `RootedPath` identifies a virtual file location as a pair of root plus virtual path. - `VirtualRoot::Project` represents the canonical project root; `VirtualRoot::Package(PackageSpec)` represents a package root. - `FileId` is now backed by an interned rooted path instead of the old optional-package plus path shape. This is why tinymist code now creates file IDs with `RootedPath::new(...).intern()` / `FileId::unique(...)` and reads roots through `file_id.root()`. - Tinymist must preserve its own workspace, untitled, rootless, and package-root concepts on top of Typst's new project/package root model. - [`typst/typst#7688` Robust `VirtualPath` type that pre-validates paths](typst/typst#7688) - `VirtualPath` construction is no longer just a lossy wrapper around arbitrary paths; it validates the path shape up front. - Call sites that previously used raw `Path` conversion now need `VirtualPath::new(...)`, `VirtualPath::virtualize(...)`, `join(...)`, `realize(...)`, `get_with_slash()`, or `get_without_slash()` depending on whether the value is still virtual or should be rendered as a platform path. - Tinymist updates workspace entry selection, mock VFS/world paths, query fixtures, docs imports, rename resolution, and document-link resolution so virtual paths remain valid and source-relative. - [`typst/typst#7708` Remove `PartialOrd` and `Ord` for `FileId`](typst/typst#7708) - `FileId` should be treated as an opaque interned identifier, not as a stable ordering key. - Tinymist replaces ordering-sensitive behavior with explicit package/path keys where determinism matters, e.g. coverage summaries and fixture/test ordering. - [`typst/typst#8215` Request standard library from `World` once upfront](typst/typst#8215) - This PR does not include the runtime/engine adaptation from that group. - It only carries over the minimal `typst-utils` workspace dependency because the original nightly order introduced that dependency before `444c2f2a`, while this logical path-model group already needs `typst-utils.workspace = true` in `tinymist-query`. - Ports the VFS path mapper to `RootedPath`, `VirtualRoot`, and validated `VirtualPath` operations. - Updates `EntryState`, mock VFS/world helpers, and tests to create valid virtual paths instead of relying on raw path wrapping. - Updates workspace/package/rootless path resolution so tinymist's workspace IDs continue to map onto Typst package roots where needed. - Updates analysis, docs, package import, rename, and document-link code to resolve relative imports from the source file's parent in the new path model. - Simplifies import path parent resolution so invalid parent paths naturally short-circuit instead of falling back to the original virtual path. - Adds compatibility helpers in `typst-shim`: - `as_rooted_path_compat()` for rendering a `VirtualPath` with a leading slash across stable/nightly Typst APIs. - `as_rootless_path_compat()` for rendering the same path without a leading slash. - `package_compat()` for obtaining the package root through the old or new `RootedPath` API. - Keeps snapshot churn and unrelated analysis/runtime changes out of this PR; those remain for later groups. --------- Co-authored-by: paran3xus <[email protected]>
Dikluwe
pushed a commit
to Dikluwe/typst-crystalline
that referenced
this pull request
Sep 12, 2026
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.
This is split off from #7555. There is one difference: The
VirtualPathtype here remains just the true path part and does not contain the root information. I wasn't so happy with unifying both because a path without a root is also sometimes a useful abstraction (e.g. for multi-file HTML output assets). This is mostly the reason why #7555 hasn't landed yet. In the interest of getting it in piece by piece, I'm landing this first now.This PR contains the two breaking changes describes in #7555. It does not contain the hints yet; those will be added in a future PR.