dev: fix meta and rename preview crates for publish crates (#1804)

* dev: fix meta and rename preview crates for publish crates

* dev: fix meta for publish crates
This commit is contained in:
Myriad-Dreamin 2025-06-09 09:40:05 +08:00 committed by GitHub
parent 5a2509327d
commit 25a446cd99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 98 additions and 62 deletions

View file

@ -52,7 +52,7 @@ jobs:
cargo publish --no-verify -p tinymist-query || true
cargo publish --no-verify -p tinymist-render || true
cargo publish --no-verify -p tinymist-core || true
cargo publish --no-verify -p typst-preview || true
cargo publish --no-verify -p tinymist-preview || true
cargo publish --no-verify -p tinymist || true
- name: Verifies crate health (Optional)
run: |

54
Cargo.lock generated
View file

@ -4085,6 +4085,7 @@ dependencies = [
"tinymist-core",
"tinymist-debug",
"tinymist-l10n",
"tinymist-preview",
"tinymist-project",
"tinymist-query",
"tinymist-render",
@ -4099,7 +4100,6 @@ dependencies = [
"typst-ansi-hl",
"typst-html",
"typst-pdf",
"typst-preview",
"typst-render",
"typst-shim",
"typst-svg",
@ -4221,7 +4221,7 @@ dependencies = [
[[package]]
name = "tinymist-l10n"
version = "0.13.14-rc1"
version = "0.13.12"
dependencies = [
"anyhow",
"clap",
@ -4249,7 +4249,7 @@ dependencies = [
[[package]]
name = "tinymist-package"
version = "0.13.14-rc1"
version = "0.13.12"
dependencies = [
"base64",
"comemo",
@ -4274,6 +4274,30 @@ dependencies = [
"web-sys",
]
[[package]]
name = "tinymist-preview"
version = "0.13.14-rc1"
dependencies = [
"clap",
"comemo",
"env_logger",
"futures",
"indexmap 2.9.0",
"log",
"parking_lot",
"reflexo-typst",
"reflexo-vec2svg",
"serde",
"serde_json",
"tinymist-assets 0.13.12",
"tinymist-std",
"tokio",
"typst",
"typst-assets",
"typst-macros",
"typst-timing",
]
[[package]]
name = "tinymist-project"
version = "0.13.12"
@ -4995,30 +5019,6 @@ dependencies = [
"xmp-writer",
]
[[package]]
name = "typst-preview"
version = "0.13.14-rc1"
dependencies = [
"clap",
"comemo",
"env_logger",
"futures",
"indexmap 2.9.0",
"log",
"parking_lot",
"reflexo-typst",
"reflexo-vec2svg",
"serde",
"serde_json",
"tinymist-assets 0.13.12",
"tinymist-std",
"tokio",
"typst",
"typst-assets",
"typst-macros",
"typst-timing",
]
[[package]]
name = "typst-realize"
version = "0.13.1"

View file

@ -98,7 +98,7 @@ rpds = "1"
# Data/Text Format and Processing
biblatex = "0.10"
cmark-writer = { version = "0.7.5", features = ["gfm"] }
docx-rs = { git = "https://github.com/Myriad-Dreamin/docx-rs", default-features = false, rev = "db49a729f68dbdb9e8e91857fbb1c3d414209871" }
docx-rs = { version = "0.4.18-rc19", git = "https://github.com/Myriad-Dreamin/docx-rs", default-features = false, rev = "db49a729f68dbdb9e8e91857fbb1c3d414209871" }
hayagriva = "0.8"
hex = "0.4.3"
flate2 = "1"
@ -154,7 +154,7 @@ typst-pdf = "0.13.1"
typst-syntax = "0.13.1"
typst-eval = "0.13.1"
typst-assets = "0.13.1"
typstfmt = { git = "https://github.com/Myriad-Dreamin/typstfmt", tag = "v0.13.1" }
typstfmt = { version = "0", git = "https://github.com/Myriad-Dreamin/typstfmt", tag = "v0.13.1" }
typst-ansi-hl = "0.4.0"
typstyle-core = { version = "=0.13.10", default-features = false }
@ -162,7 +162,6 @@ typstyle-core = { version = "=0.13.10", default-features = false }
crossbeam-channel = "0.5.12"
lsp-types = { version = "=0.95.0", features = ["proposed"] }
dapts = "0.0.6"
sync-ls = { path = "./crates/sync-lsp" }
# CLI
clap = { version = "4.5", features = ["derive", "env", "unicode"] }
@ -189,6 +188,8 @@ insta = { version = "1.39", features = ["glob"] }
tinymist-assets = { version = "=0.13.12" }
tinymist-derive = { path = "./crates/tinymist-derive/", version = "0.13.12" }
tinymist-l10n = { path = "./crates/tinymist-l10n/", version = "0.13.12" }
tinymist-package = { path = "./crates/tinymist-package/", version = "0.13.12" }
tinymist-std = { path = "./crates/tinymist-std/", version = "0.13.12", default-features = false }
tinymist-vfs = { path = "./crates/tinymist-vfs/", version = "0.13.12", default-features = false }
tinymist-world = { path = "./crates/tinymist-world/", version = "0.13.12", default-features = false }
@ -198,17 +199,16 @@ typst-shim = { path = "./crates/typst-shim", version = "0.13.12" }
tinymist-tests = { path = "./crates/tinymist-tests/" }
sync-ls = { path = "./crates/sync-lsp", version = "0.13.14-rc1" }
tinymist = { path = "./crates/tinymist/", version = "0.13.14-rc1" }
tinymist-analysis = { path = "./crates/tinymist-analysis/", version = "0.13.14-rc1" }
tinymist-core = { path = "./crates/tinymist-core/", version = "0.13.14-rc1", default-features = false }
tinymist-debug = { path = "./crates/tinymist-debug/", version = "0.13.14-rc1" }
tinymist-l10n = { path = "./crates/tinymist-l10n/", version = "0.13.14-rc1" }
tinymist-lint = { path = "./crates/tinymist-lint/", version = "0.13.14-rc1" }
tinymist-package = { path = "./crates/tinymist-package/", version = "0.13.14-rc1" }
tinymist-query = { path = "./crates/tinymist-query/", version = "0.13.14-rc1" }
tinymist-render = { path = "./crates/tinymist-render/", version = "0.13.14-rc1" }
tinymist-preview = { path = "./crates/typst-preview", version = "0.13.14-rc1" }
typlite = { path = "./crates/typlite", version = "0.13.14-rc1" }
typst-preview = { path = "./crates/typst-preview", version = "0.13.14-rc1" }
[profile.dev.package.insta]
opt-level = 3

View file

@ -3,8 +3,9 @@ name = "tinymist-l10n"
description = "Localization support for tinymist and typst."
categories = ["compilers", "command-line-utilities"]
keywords = ["language", "typst"]
# group: world
version = "0.13.12"
authors.workspace = true
version.workspace = true
license.workspace = true
edition.workspace = true
homepage.workspace = true

View file

@ -3,8 +3,9 @@ name = "tinymist-package"
description = "Tinymist package support for Typst."
categories = ["compilers"]
keywords = ["api", "language", "typst"]
# group: world
version = "0.13.12"
authors.workspace = true
version.workspace = true
license.workspace = true
edition.workspace = true
homepage.workspace = true

View file

@ -73,7 +73,7 @@ typst-render.workspace = true
typst-timing.workspace = true
typst-html = { workspace = true, optional = true }
typst-shim.workspace = true
typst-preview = { workspace = true, optional = true }
tinymist-preview = { workspace = true, optional = true }
typst-ansi-hl.workspace = true
tinymist-task.workspace = true
tinymist-debug.workspace = true
@ -119,14 +119,14 @@ pdf = ["tinymist-task/pdf"]
no-content-hint = [
"tinymist-task/no-content-hint",
"tinymist-project/no-content-hint",
"typst-preview/no-content-hint",
"tinymist-preview/no-content-hint",
"reflexo-typst/no-content-hint",
"reflexo-vec2svg/no-content-hint",
]
preview = [
"typst-preview",
"typst-preview/clap",
"tinymist-preview",
"tinymist-preview/clap",
"tinymist-assets/typst-preview",
"hyper-tungstenite",
]

View file

@ -4,9 +4,9 @@ use lsp_types::notification::Notification;
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use sync_ls::{internal_error, LspClient, LspResult};
use tinymist_preview::{ControlPlaneMessage, Previewer};
use tinymist_std::error::IgnoreLogging;
use tokio::sync::{mpsc, oneshot};
use typst_preview::{ControlPlaneMessage, Previewer};
use crate::project::ProjectPreviewState;
use crate::tool::preview::{HttpServer, ProjectPreviewHandler};

View file

@ -369,7 +369,7 @@ impl ServerState {
/// Scroll preview instances.
#[cfg(feature = "preview")]
pub fn scroll_preview(&mut self, mut args: Vec<JsonValue>) -> AnySchedulableResponse {
use typst_preview::ControlPlaneMessage;
use tinymist_preview::ControlPlaneMessage;
if args.is_empty() {
return self.preview.scroll_all(self.infer_pos()?);

View file

@ -90,7 +90,7 @@ fn main() -> Result<()> {
env_logger::builder()
.filter_module("tinymist", base_level)
.filter_module("typst_preview", preview_level)
.filter_module("tinymist_preview", preview_level)
.filter_module("typlite", base_level)
.filter_module("reflexo", base_level)
.filter_module("sync_ls", base_level)

View file

@ -353,13 +353,17 @@ impl PeriscopeProvider for TypstPeriscopeProvider {
#[derive(Default, Clone)]
pub struct ProjectPreviewState {
#[cfg(feature = "preview")]
pub(crate) inner: Arc<Mutex<FxHashMap<ProjectInsId, Arc<typst_preview::CompileWatcher>>>>,
pub(crate) inner: Arc<Mutex<FxHashMap<ProjectInsId, Arc<tinymist_preview::CompileWatcher>>>>,
}
#[cfg(feature = "preview")]
impl ProjectPreviewState {
#[must_use]
pub fn register(&self, id: &ProjectInsId, handle: &Arc<typst_preview::CompileWatcher>) -> bool {
pub fn register(
&self,
id: &ProjectInsId,
handle: &Arc<tinymist_preview::CompileWatcher>,
) -> bool {
let mut p = self.inner.lock();
// Don't replace the existing watcher if it exists
@ -377,7 +381,7 @@ impl ProjectPreviewState {
}
#[must_use]
pub fn get(&self, task_id: &ProjectInsId) -> Option<Arc<typst_preview::CompileWatcher>> {
pub fn get(&self, task_id: &ProjectInsId) -> Option<Arc<tinymist_preview::CompileWatcher>> {
self.inner.lock().get(task_id).cloned()
}
}
@ -568,8 +572,8 @@ impl CompileHandler<LspCompilerFeat, ProjectInsStateExt> for CompileHandlerImpl
#[cfg(feature = "preview")]
if let Some(inner) = self.preview.get(&rep.id) {
use tinymist_preview::CompileStatus;
use tinymist_project::CompileStatusEnum::*;
use typst_preview::CompileStatus;
inner.status(match &rep.status {
Compiling => CompileStatus::Compiling,

View file

@ -366,8 +366,8 @@ impl ServerState {
}
#[cfg(feature = "preview")]
pub(crate) fn infer_pos(&self) -> LspResult<typst_preview::ControlPlaneMessage> {
use typst_preview::{ControlPlaneMessage, ResolveSourceLocRequest};
pub(crate) fn infer_pos(&self) -> LspResult<tinymist_preview::ControlPlaneMessage> {
use tinymist_preview::{ControlPlaneMessage, ResolveSourceLocRequest};
let focus_file = self.focusing.as_ref();
let focus_file = focus_file.ok_or_else(|| invalid_request("no focusing file"))?;

View file

@ -18,13 +18,13 @@ use serde::Serialize;
use serde_json::Value as JsonValue;
use sync_ls::just_ok;
use tinymist_assets::TYPST_PREVIEW_HTML;
use tinymist_query::{LspPosition, LspRange};
use tinymist_std::error::IgnoreLogging;
use tokio::sync::{mpsc, oneshot};
use typst_preview::{
use tinymist_preview::{
frontend_html, ControlPlaneMessage, ControlPlaneRx, ControlPlaneTx, DocToSrcJumpInfo,
PreviewArgs, PreviewBuilder, PreviewMode, Previewer, WsMessage,
};
use tinymist_query::{LspPosition, LspRange};
use tinymist_std::error::IgnoreLogging;
use tokio::sync::{mpsc, oneshot};
use crate::actor::preview::{PreviewActor, PreviewRequest, PreviewTab};
use crate::project::{ProjectInsId, ProjectPreviewState, WorldProvider};
@ -191,7 +191,7 @@ impl ServerState {
));
}
let previewer = typst_preview::PreviewBuilder::new(cli_args.preview.clone());
let previewer = tinymist_preview::PreviewBuilder::new(cli_args.preview.clone());
let watcher = previewer.compile_watcher();
let primary = &mut self.project.compiler.primary;
@ -334,7 +334,7 @@ impl PreviewState {
self.client.handle.spawn(async move {
let mut resp_rx = resp_rx;
while let Some(resp) = resp_rx.recv().await {
use typst_preview::ControlPlaneResponse::*;
use tinymist_preview::ControlPlaneResponse::*;
match resp {
// ignoring compile status per task.
@ -609,7 +609,7 @@ impl Notification for ScrollSource {
struct NotifDocumentOutline;
impl Notification for NotifDocumentOutline {
type Params = typst_preview::Outline;
type Params = tinymist_preview::Outline;
const METHOD: &'static str = "tinymist/documentOutline";
}

View file

@ -4,14 +4,14 @@ use std::path::Path;
use reflexo::debug_loc::SourceSpanOffset;
use reflexo_typst::{error::prelude::*, Bytes, Error, TypstDocument};
use tinymist_preview::{
CompileStatus, DocToSrcJumpInfo, EditorServer, Location, MemoryFiles, MemoryFilesShort,
};
use tinymist_project::LspCompiledArtifact;
use tinymist_query::{jump_from_click, jump_from_cursor};
use typst::layout::{Abs, Point, Position};
use typst::syntax::{LinkedNode, Source, Span, SyntaxKind};
use typst::World;
use typst_preview::{
CompileStatus, DocToSrcJumpInfo, EditorServer, Location, MemoryFiles, MemoryFilesShort,
};
use typst_shim::syntax::LinkedNodeExt;
use crate::project::{LspInterrupt, ProjectClient, ProjectInsId};
@ -91,7 +91,7 @@ pub struct PreviewCompileView {
pub art: LspCompiledArtifact,
}
impl typst_preview::CompileView for PreviewCompileView {
impl tinymist_preview::CompileView for PreviewCompileView {
fn doc(&self) -> Option<TypstDocument> {
self.art.doc.clone()
}

View file

@ -47,7 +47,7 @@ pub struct GenerateScriptArgs {
}
#[cfg(feature = "preview")]
pub use typst_preview::{PreviewArgs, PreviewMode};
pub use tinymist_preview::{PreviewArgs, PreviewMode};
/// Project task commands.
#[derive(Debug, Clone, clap::Subcommand)]

View file

@ -1,5 +1,5 @@
[package]
name = "typst-preview"
name = "tinymist-preview"
description = "A previewer for the Typst typesetting system."
license = "MIT"
repository = "https://github.com/Enter-tainer/typst-preview"

View file

@ -0,0 +1,30 @@
**This is renamed from `typst-preview` to `tinymist-preview` to publish on `crates.io`.**
# [Typst Preview](https://github.com/Enter-tainer/typst-preview)
Preview your Typst files in vscode instantly!
## Features
- Low latency preview: preview your document instantly on type. The incremental rendering technique makes the preview latency as low as possible.
- Open in browser: open the preview in browser, so you put it in another monitor. https://github.com/typst/typst/issues/1344
- Cross jump between code and preview: We implement SyncTeX-like feature for typst-preview. You can now click on the preview panel to jump to the corresponding code location, and vice versa.
For more information, please visit documentation at [Typst Preview Book](https://enter-tainer.github.io/typst-preview/).
## Extension Settings
See https://enter-tainer.github.io/typst-preview/config.html
## Bug report
To achieve high performance instant preview, we use a **different rendering backend** from official typst. We are making our best effort to keep the rendering result consistent with official typst. We have set up comprehensive tests to ensure the consistency of the rendering result. But we cannot guarantee that the rendering result is the same in all cases. There can be unknown corner cases that we haven't covered.
**Therefore, if you encounter any rendering issue, please report it to this repo other than official typst repo.**
## Known Issues
See [issues](https://github.com/Enter-tainer/typst-preview/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) on GitHub.
## Legal
This project is not affiliated with, created by, or endorsed by Typst the brand.