Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
fb81fb2
chore: bump to 0.28.4, fix dynamic-node re-render and standards viola…
vshengbro Sep 30, 2026
5890f9d
test(ui): reset i18n state in the shared locked helper
vshengbro Sep 30, 2026
14d5ea6
fix: derive the injected DOM-op names per page load, bump to 0.28.5
vshengbro Sep 30, 2026
440a218
fix(core): clear the last clippy warning, shadowed `Iterator` and two…
vshengbro Sep 30, 2026
4bde451
fix: remove the non-keyword `inline.rs`, the inline test module, and 8
vshengbro Sep 30, 2026
a5e4044
fix(engine): clear all §2.1/§2.2 doc-comment and §1.3c hardcoded-stri…
vshengbro Sep 30, 2026
963c3a7
fix: clear the §1.3c hardcoded-string violations in ui/, example/ and…
vshengbro Oct 1, 2026
136ebea
fix(docs): drop the unnecessary braces around static class constants
vshengbro Oct 1, 2026
a6a765a
fix(macros): support bare static attribute values in html!
vshengbro Oct 1, 2026
86c7b2c
fix(deps): upgrade hyperlane to 21.9.0 and drop the removed fmt API
vshengbro Oct 1, 2026
305a967
Merge origin/master into fix/dom-op-names-and-pool-tests
vshengbro Oct 1, 2026
d6e0ae9
style(macros): wrap the attribute value expression to satisfy rustfmt
vshengbro Oct 1, 2026
62360c3
refactor(cli): drop the build-time cargo fmt side effect
vshengbro Oct 1, 2026
27a1269
fix(ui): tighten the nav footer and mark top-level sidebar rows
vshengbro Oct 1, 2026
335b9cb
perf(engine): fuse the particle sweep and bound the spatial grid
vshengbro Oct 1, 2026
54479ee
fix(example,docs): add the missing explicit types on the five closure…
vshengbro Oct 1, 2026
0928f9e
refactor(euv): inline the single-use constants that only existed for …
vshengbro Oct 1, 2026
b9f3161
fix(ui): centre the mobile sidebar footer against the page bottom
vshengbro Oct 1, 2026
c2cb819
refactor(euv): move the remaining static inline styles onto classes
vshengbro Oct 1, 2026
7f8f09b
test(engine): cover the math module's public API
vshengbro Oct 1, 2026
5342809
test(engine): cover the physics and config public APIs
vshengbro Oct 1, 2026
28b89eb
test(engine): cover the nine-slice geometry and the quadtree bounds
vshengbro Oct 1, 2026
4f5fd77
test(engine): cover the input state machine and the tween accessors
vshengbro Oct 1, 2026
acf913b
test(engine): cover the light factories, the pool accessors and the c…
vshengbro Oct 1, 2026
788bed3
test(engine): cover the math traits, Ray2D and the gamepad query surface
vshengbro Oct 1, 2026
5dc1629
test(engine): cover the sprite animator state machine
vshengbro Oct 1, 2026
bbb5eed
test(engine): cover entity id allocation, the ray bounce budget and p…
vshengbro Oct 1, 2026
b53e8df
fix(docs): add the missing §2.2 Arguments and Returns sections
vshengbro Oct 1, 2026
aec671f
fix(docs): correct the remaining §2.2 type literals and the malformed…
vshengbro Oct 1, 2026
5bf6c2d
fix: add the six missing §5.1 let type annotations
vshengbro Oct 1, 2026
4bcce2c
refactor(example): name the event page's repeated placeholder strings
vshengbro Oct 1, 2026
69183ef
refactor(ui): name the layout hook's safe-area quartet
vshengbro Oct 1, 2026
e2566aa
refactor: name the reused literals §1.3c was written to catch
vshengbro Oct 1, 2026
764ca29
test(engine): cover the renderer's natively-testable descriptor and c…
vshengbro Oct 2, 2026
504cb2e
test(engine): cover the collider traits, box overlap, interpolation a…
vshengbro Oct 2, 2026
bf44f91
test(engine): exercise the collider traits as trait objects, interpol…
vshengbro Oct 2, 2026
3852f44
test(engine): cover the 3D camera, gradients, and drop blank lines fr…
vshengbro Oct 2, 2026
ea30e75
test(engine): cover the quad tree node value type and its loose-entry…
vshengbro Oct 2, 2026
d521f34
test(cli): cover the pure build-argument and path-resolution surface
vshengbro Oct 2, 2026
47c41f4
test(core): cover the CSS pseudo and media rule parsers and the style…
vshengbro Oct 2, 2026
54f7ac9
test(cli): cover the dev server's path-traversal guard
vshengbro Oct 2, 2026
f6b9c6d
test(core): cover signal subscription, detachment and the deferred-re…
vshengbro Oct 2, 2026
4bd6eab
docs: repair every unresolved intra-doc link in the workspace
vshengbro Oct 2, 2026
1930755
docs: describe the popstate guard, async slot and suspense phase as t…
vshengbro Oct 2, 2026
0fb3b44
test(ui): cover route matching, the outlet chain, and the size token …
vshengbro Oct 2, 2026
cd95be9
test: cover the no-DOM fallbacks under wasm-pack test --node
vshengbro Oct 2, 2026
ac65285
test: pin the no-DOM capability probes and history fallbacks under node
vshengbro Oct 2, 2026
99aadb4
test(cli): cover the error messages, their causes, and the argument r…
vshengbro Oct 2, 2026
cdaeaee
test(core): cover reactive attributes, the event adapter cast, and th…
vshengbro Oct 2, 2026
ee739a3
test(engine): cover the render layers, the default GL viewport, and s…
vshengbro Oct 2, 2026
5fcd999
fix: stop two Option getters from unwrapping a value the API document…
vshengbro Oct 2, 2026
c792c6e
style: hoist std and external-crate imports to the outermost lib.rs /…
vshengbro Oct 2, 2026
1970cc4
style: route every qualified std path through a top-level import
vshengbro Oct 2, 2026
7d14d94
style: hoist the remaining test-directory imports and the byte litera…
vshengbro Oct 6, 2026
59e9507
style: hoist every remaining test-tree import to the outermost mod.rs
vshengbro Oct 6, 2026
b8cb242
test: fill the pub-API gaps across engine, ui, core and cli, clear th…
vshengbro Oct 8, 2026
8468ad1
merge: fix/dom-op-names-and-pool-tests into perf/engine-hot-path-allo…
vshengbro Oct 8, 2026
3b9bf80
refactor: stop re-exporting std and wasm_bindgen_futures from euv-ui,…
vshengbro Oct 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
echo "::error::GITEE_TOKEN secret is missing"; exit 1
fi
git remote remove gitee 2>/dev/null || true
git remote add gitee "https://eastspire:${GITEE_TOKEN}@gitee.com/eastspire/${REPO_NAME}.git"
git remote add gitee "https://vshengbro:${GITEE_TOKEN}@gitee.com/vshengbro/${REPO_NAME}.git"
attempt=0
max_retries=8
while [ $attempt -le $max_retries ]; do
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
echo "::error::GITCODE_TOKEN secret is missing"; exit 1
fi
git remote remove gitcode 2>/dev/null || true
git remote add gitcode "https://oauth2:${GITCODE_TOKEN}@gitcode.com/eastspire/${REPO_NAME}.git"
git remote add gitcode "https://oauth2:${GITCODE_TOKEN}@gitcode.com/vshengbro/${REPO_NAME}.git"
attempt=0
max_retries=8
while [ $attempt -le $max_retries ]; do
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
- name: Configure git
if: steps.check_branch.outputs.skip == 'false'
run: |
git config user.name "eastspire"
git config user.name "vshengbro"
git config user.email "root@ltpp.vip"
- name: Sync workspace versions
if: steps.check_branch.outputs.skip == 'false'
Expand Down
23 changes: 13 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ categories = ["network-programming", "web-programming"]
exclude.workspace = true

[workspace.package]
version = "0.28.9"
version = "0.28.12"
readme = "README.md"
edition = "2024"
authors = ["root@ltpp.vip"]
Expand All @@ -38,13 +38,13 @@ resolver = "3"
crate-type = ["rlib"]

[workspace.dependencies]
euv = { path = ".", version = "0.28.9" }
euv-ui = { path = "ui", version = "0.28.9" }
euv-cli = { path = "cli", version = "0.28.9" }
euv-core = { path = "core", version = "0.28.9" }
euv-engine = { path = "engine", version = "0.28.9" }
euv-macros = { path = "macros", version = "0.28.9" }
euv-example = { path = "example", version = "0.28.9" }
euv = { path = ".", version = "0.28.10" }
euv-ui = { path = "ui", version = "0.28.10" }
euv-cli = { path = "cli", version = "0.28.10" }
euv-core = { path = "core", version = "0.28.10" }
euv-engine = { path = "engine", version = "0.28.10" }
euv-macros = { path = "macros", version = "0.28.10" }
euv-example = { path = "example", version = "0.28.10" }

log = "0.4.33"
toml = "0.9.12"
Expand All @@ -53,15 +53,15 @@ chrono = "0.4.45"
ignore = "0.4.31"
js-sys = "0.3.103"
if-addrs = "0.15.0"
hyperlane = "21.9.1"
serde_json = "1.0.151"
color-output = "10.2.2"
proc-macro2 = "1.0.107"
hyperlane-cli = "21.9.1"
hyperlane-cli = "21.9.0"
lombok-macros = "10.2.2"
wasm-bindgen = "0.2.126"
alloc-no-stdlib = "3.0.0"
compare_version = "10.2.2"
hyperlane-core = "=21.9.0"
bin-encode-decode = "1.2.6"
serde-wasm-bindgen = "0.6.5"
wasm-bindgen-test = "0.3.76"
Expand All @@ -82,6 +82,9 @@ tokio = { version = "1.53.1", features = [
"process",
"rt-multi-thread",
] }
hyperlane = "21.9.0"
# hyperlane-core 21.11.0 changed Server::route to take two generic
# arguments; pin the transitive dependency until euv-cli migrates.
web-sys = { version = "0.3.103", features = [
"Gpu",
"Blob",
Expand Down
5 changes: 5 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ proc-macro2 = { workspace = true }
color-output = { workspace = true }
hyperlane-cli = { workspace = true }
lombok-macros = { workspace = true }
hyperlane-core = { workspace = true }

[dev-dependencies]
clap = { workspace = true }
tokio = { workspace = true }
100 changes: 50 additions & 50 deletions cli/src/build/const.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/// The default output subdirectory name for wasm-pack artifacts.
pub(crate) const PKG_DIR_NAME: &str = "pkg";

/// The index HTML file name.
pub(crate) const INDEX_HTML_FILE_NAME: &str = "index.html";

/// The hyphen character used when normalizing crate names to wasm-pack's
/// underscore output convention.
pub(crate) const STR_HYPHEN: &str = "-";

/// Placeholder token used in HTML templates for the JS import path.
///
/// Replaced at runtime with the resolved import path relative to the www directory.
pub const IMPORT_PATH_PLACEHOLDER: &str = "__IMPORT_PATH__";
pub(crate) const IMPORT_PATH_PLACEHOLDER: &str = "__IMPORT_PATH__";

/// Placeholder token used in HTML templates for the reload endpoint URL.
///
/// Replaced at runtime with the actual reload route path.
pub const RELOAD_ROUTE_PLACEHOLDER: &str = "__RELOAD_ROUTE__";
pub(crate) const RELOAD_ROUTE_PLACEHOLDER: &str = "__RELOAD_ROUTE__";

/// Placeholder token used in HTML templates for the inlined wasm-bindgen JS bridge.
///
Expand All @@ -15,7 +25,7 @@ pub const RELOAD_ROUTE_PLACEHOLDER: &str = "__RELOAD_ROUTE__";
/// wrapped in a synchronous IIFE that fetches the wasm module and calls
/// `main()`. This eliminates the separate HTTP request for the JS bridge file
/// and skips ES module graph parsing on the critical path.
pub const INLINE_JS_PLACEHOLDER: &str = "__EUV_INLINE_JS__";
pub(crate) const INLINE_JS_PLACEHOLDER: &str = "__EUV_INLINE_JS__";

/// Placeholder token used in HTML templates for the `<base href="..."/>` tag.
///
Expand All @@ -25,104 +35,91 @@ pub const INLINE_JS_PLACEHOLDER: &str = "__EUV_INLINE_JS__";
/// resource the HTML references — against the euv serving root rather
/// than the page URL. This makes the dev server robust to users landing
/// on `http://host:port/` instead of `http://host:port/www/`.
pub const BASE_HREF_PLACEHOLDER: &str = "__EUV_BASE_HREF_TAG__";
pub(crate) const BASE_HREF_PLACEHOLDER: &str = "__EUV_BASE_HREF_TAG__";

/// Environment variable to disable JS bridge inlining and fall back to the
/// classic `<script type="module">import init, { main } from '__IMPORT_PATH__'`
/// bootstrap. Set to any non-empty value to opt out (e.g. when the wasm-pack
/// output structure changes and the inline pipeline can't recover).
pub const EUV_NO_INLINE_BRIDGE_ENV: &str = "EUV_NO_INLINE_BRIDGE";
pub(crate) const EUV_NO_INLINE_BRIDGE_ENV: &str = "EUV_NO_INLINE_BRIDGE";

/// The URL path for the reload endpoint.
///
/// Used by the live-reload script in the HTML template and the server route registration.
pub const RELOAD_ROUTE: &str = "/__euv_reload";
pub(crate) const RELOAD_ROUTE: &str = "/__euv_reload";

/// The wasm-pack flag indicating a release build.
pub const RELEASE_FLAG: &str = "--release";
pub(crate) const RELEASE_FLAG: &str = "--release";

/// The CLI command name for wasm-pack.
pub const WASM_PACK_COMMAND: &str = "wasm-pack";
pub(crate) const WASM_PACK_COMMAND: &str = "wasm-pack";

/// The wasm-pack subcommand for building.
pub const WASM_PACK_BUILD_SUBCOMMAND: &str = "build";
pub(crate) const WASM_PACK_BUILD_SUBCOMMAND: &str = "build";

/// The wasm-pack argument for specifying the output directory.
pub const OUT_DIR_ARG: &str = "--out-dir";
pub(crate) const OUT_DIR_ARG: &str = "--out-dir";

/// The wasm-pack argument for specifying the output name.
pub const OUT_NAME_ARG: &str = "--out-name";
pub(crate) const OUT_NAME_ARG: &str = "--out-name";

/// The wasm-pack argument for specifying the target.
pub const TARGET_ARG: &str = "--target";
pub(crate) const TARGET_ARG: &str = "--target";

/// The default wasm-pack target for browser usage.
pub const TARGET_WEB: &str = "web";

/// The default output subdirectory name for wasm-pack artifacts.
pub const PKG_DIR_NAME: &str = "pkg";
pub(crate) const TARGET_WEB: &str = "web";

/// The JavaScript file extension.
pub const JS_EXTENSION: &str = ".js";
pub(crate) const JS_EXTENSION: &str = ".js";

/// The source directory name within a Cargo project.
pub const SRC_DIR_NAME: &str = "src";
pub(crate) const SRC_DIR_NAME: &str = "src";

/// The name of the gitignore file.
pub const GITIGNORE_FILE_NAME: &str = ".gitignore";
pub(crate) const GITIGNORE_FILE_NAME: &str = ".gitignore";

/// The name of the Cargo manifest file.
pub const CARGO_TOML_FILE_NAME: &str = "Cargo.toml";

/// The index HTML file name.
pub const INDEX_HTML_FILE_NAME: &str = "index.html";
pub(crate) const CARGO_TOML_FILE_NAME: &str = "Cargo.toml";

/// The relative path prefix used for import path construction.
pub const RELATIVE_PATH_PREFIX: &str = "./";
pub(crate) const RELATIVE_PATH_PREFIX: &str = "./";

/// The path separator used for joining path components.
pub const PATH_SEPARATOR: &str = "/";
pub(crate) const PATH_SEPARATOR: &str = "/";

/// The parent directory indicator used in relative path computation.
pub const PARENT_DIR: &str = "..";

/// The hyphen character used when normalizing crate names to wasm-pack's
/// underscore output convention.
pub const STR_HYPHEN: &str = "-";
pub(crate) const PARENT_DIR: &str = "..";

/// The underscore character used when normalizing crate names to wasm-pack's
/// output convention.
pub const STR_UNDERSCORE: &str = "_";
pub(crate) const STR_UNDERSCORE: &str = "_";

/// The wasm-pack flag for development builds.
pub const DEV_FLAG: &str = "--dev";
pub(crate) const DEV_FLAG: &str = "--dev";

/// The wasm-pack flag for profiling builds.
pub const PROFILING_FLAG: &str = "--profiling";
pub(crate) const PROFILING_FLAG: &str = "--profiling";

/// The euv-specific argument for specifying the crate path.
pub const CRATE_PATH_ARG: &str = "--crate-path";
pub(crate) const CRATE_PATH_ARG: &str = "--crate-path";

/// The short form of the crate-path argument.
pub const CRATE_PATH_ARG_SHORT: &str = "-c";

/// The euv-specific argument for specifying the server port.
pub const PORT_ARG: &str = "--port";
pub(crate) const CRATE_PATH_ARG_SHORT: &str = "-c";

/// The short form of the port argument.
pub const PORT_ARG_SHORT: &str = "-p";
pub(crate) const PORT_ARG_SHORT: &str = "-p";

/// The euv-specific argument for specifying the www directory.
pub const WWW_DIR_ARG: &str = "--www-dir";
pub(crate) const WWW_DIR_ARG: &str = "--www-dir";

/// The euv-specific argument for specifying a custom index.html template.
pub const INDEX_HTML_ARG: &str = "--index-html";
pub(crate) const INDEX_HTML_ARG: &str = "--index-html";

/// The euv-specific argument for removing the .gitignore file from the output directory.
pub const NO_GITIGNORE_ARG: &str = "--no-gitignore";
pub(crate) const NO_GITIGNORE_ARG: &str = "--no-gitignore";

/// The euv-specific argument names that should not be forwarded to wasm-pack.
pub const EUV_ARGS: &[&str] = &[
pub(crate) const EUV_ARGS: &[&str] = &[
CRATE_PATH_ARG,
CRATE_PATH_ARG_SHORT,
PORT_ARG,
Expand All @@ -133,19 +130,19 @@ pub const EUV_ARGS: &[&str] = &[
];

/// The double-dash separator used to distinguish euv args from wasm-pack args.
pub const DOUBLE_DASH: &str = "--";
pub(crate) const DOUBLE_DASH: &str = "--";

/// The `run` action name used in banner display.
pub const ACTION_RUN: &str = "run";
pub(crate) const ACTION_RUN: &str = "run";

/// The `build` action name used in banner display.
pub const ACTION_BUILD: &str = "build";
pub(crate) const ACTION_BUILD: &str = "build";

/// The environment variable name for setting the minimum stack size of rustc threads.
pub const RUST_MIN_STACK_ENV: &str = "RUST_MIN_STACK";
pub(crate) const RUST_MIN_STACK_ENV: &str = "RUST_MIN_STACK";

/// The minimum stack size in bytes for rustc threads (16 MiB).
pub const RUST_MIN_STACK_VALUE: &str = "16777216";
pub(crate) const RUST_MIN_STACK_VALUE: &str = "16777216";

/// The `index.html` template for the development profile.
///
Expand All @@ -156,7 +153,7 @@ pub const RUST_MIN_STACK_VALUE: &str = "16777216";
/// - `{"type":"Error","message":"..."}` — a build error occurred.
///
/// The `__IMPORT_PATH__` placeholder is replaced with the resolved JS import path at runtime.
pub const INDEX_HTML_DEV: &str = r#"<!doctype html>
pub(crate) const INDEX_HTML_DEV: &str = r#"<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -228,7 +225,7 @@ __EUV_INLINE_JS__
/// A minimal `index.html` without any live-reload instrumentation.
/// Used when building for release to produce a clean, static entry point.
/// The `__IMPORT_PATH__` placeholder is replaced with the resolved JS import path at runtime.
pub const INDEX_HTML_RELEASE: &str = r#"<!doctype html>
pub(crate) const INDEX_HTML_RELEASE: &str = r#"<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -273,3 +270,6 @@ __EUV_INLINE_JS__
</script>
</html>
"#;

/// The euv-specific argument for specifying the server port.
pub(crate) const PORT_ARG: &str = "--port";
31 changes: 20 additions & 11 deletions cli/src/build/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ pub fn filter_euv_args(wasm_pack_args: &[String]) -> Vec<String> {
skip_next = false;
continue;
}
if EUV_ARGS.contains(&arg.as_str()) {
if arg.contains('=') {
// Compare the flag NAME, not the whole argument: clap accepts both
// `--port 3000` and `--port=3000`, and only the first form ever
// matched `EUV_ARGS` exactly. Without the split, `--port=3000` was
// forwarded to wasm-pack even though `reconcile_args` had already
// consumed its value — the same string both used and leaked.
let name: &str = arg.split('=').next().unwrap_or(arg.as_str());
if EUV_ARGS.contains(&name) {
if arg.contains('=') || name == NO_GITIGNORE_ARG {
// `--no-gitignore` is a bare boolean: there is no value to
// skip, so treating it like `--port 3000` ate whatever
// argument followed it.
continue;
}
skip_next = true;
Expand Down Expand Up @@ -341,7 +350,7 @@ pub fn resolve_out_name(args: &ModeArgs) -> String {
///
/// - `Option<String>` - The crate name if found.
fn read_crate_name_from_toml(path: &Path) -> Option<String> {
let content: String = std::fs::read_to_string(path).ok()?;
let content: String = sync_read_to_string(path).ok()?;
let mut in_package: bool = false;
for line in content.lines() {
let trimmed: &str = line.trim();
Expand Down Expand Up @@ -740,7 +749,7 @@ pub async fn build_wasm(args: &ModeArgs) -> Result<(), EuvError> {
let display_args: Vec<String> = (if has_existing_build_mode {
filtered_args.to_vec()
} else {
std::iter::once(build_mode_flag.to_string())
once(build_mode_flag.to_string())
.chain(filtered_args.iter().cloned())
.collect::<Vec<String>>()
})
Expand Down Expand Up @@ -901,7 +910,7 @@ pub(crate) async fn build_inline_bridge(
js_name: &str,
wasm_url: &str,
) -> Result<String, EuvError> {
let js_path: std::path::PathBuf = pkg_dir.join(js_name);
let js_path: PathBuf = pkg_dir.join(js_name);
let bridge_source: String =
read_to_string(&js_path)
.await
Expand Down Expand Up @@ -958,7 +967,7 @@ pub(crate) fn build_module_fallback_bridge(import_path: &str) -> String {
///
/// - `bool` - `true` if the env var is set to a non-empty value.
pub(crate) fn inline_bridge_disabled() -> bool {
matches!(std::env::var(EUV_NO_INLINE_BRIDGE_ENV), Ok(value) if !value.is_empty())
matches!(var(EUV_NO_INLINE_BRIDGE_ENV), Ok(value) if !value.is_empty())
}

/// Collects the source of every module the bridge imports, inlined in
Expand Down Expand Up @@ -1008,7 +1017,7 @@ async fn collect_snippet_bodies(bridge_source: &str, pkg_dir: &Path) -> Result<S
}
}
for ns in &namespace_imports {
let snippet_path: std::path::PathBuf = resolve_snippet_path(pkg_dir, &ns.spec)?;
let snippet_path: PathBuf = resolve_snippet_path(pkg_dir, &ns.spec)?;
let exports: Vec<String> = if snippet_path.exists() {
let raw: String = read_to_string(&snippet_path)
.await
Expand Down Expand Up @@ -1153,7 +1162,7 @@ pub fn extract_import_spec(rest: &str) -> Option<&str> {
/// - `Result<Option<String>, EuvError>` - The stripped body, `None` if the
/// file does not exist, or an error if it cannot be read or decoded.
async fn read_snippet_module(pkg_dir: &Path, spec: &str) -> Result<Option<String>, EuvError> {
let snippet_path: std::path::PathBuf = resolve_snippet_path(pkg_dir, spec)?;
let snippet_path: PathBuf = resolve_snippet_path(pkg_dir, spec)?;
if !snippet_path.exists() {
return Ok(None);
}
Expand Down Expand Up @@ -1181,11 +1190,11 @@ async fn read_snippet_module(pkg_dir: &Path, spec: &str) -> Result<Option<String
///
/// # Returns
///
/// - `Result<std::path::PathBuf, EuvError>` - The resolved path, or an error if the
/// - `Result<PathBuf, EuvError>` - The resolved path, or an error if the
/// specifier climbs above `pkg_dir`.
fn resolve_snippet_path(pkg_dir: &Path, spec: &str) -> Result<std::path::PathBuf, EuvError> {
fn resolve_snippet_path(pkg_dir: &Path, spec: &str) -> Result<PathBuf, EuvError> {
let base: &str = spec.trim_start_matches('.').trim_start_matches('/');
let mut path: std::path::PathBuf = pkg_dir.to_path_buf();
let mut path: PathBuf = pkg_dir.to_path_buf();
for segment in base.split('/') {
if segment.is_empty() || segment == "." {
continue;
Expand Down
Loading
Loading