Skip to content

Commit 7352ee8

Browse files
authored
fix: Audit 10/14 (#2183)
* Test interactive. * Add new field. * chore: Release * Fix test utils. * chore: Release * Fix ci check. * Add optional glob. * Update JS. * Remove debug. * Bump.
1 parent c10e188 commit 7352ee8

26 files changed

Lines changed: 244 additions & 37 deletions

File tree

.yarn/versions/afdd9a82.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
releases:
2+
'@moonrepo/cli': patch
3+
'@moonrepo/core-linux-arm64-gnu': patch
4+
'@moonrepo/core-linux-arm64-musl': patch
5+
'@moonrepo/core-linux-x64-gnu': patch
6+
'@moonrepo/core-linux-x64-musl': patch
7+
'@moonrepo/core-macos-arm64': patch
8+
'@moonrepo/core-macos-x64': patch
9+
'@moonrepo/core-windows-x64-msvc': patch
10+
'@moonrepo/types': patch
11+
12+
declined:
13+
- '@moonrepo/report'
14+
- '@moonrepo/runtime'
15+
- website

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
#### 🚀 Updates
6+
7+
- Added an `optional` parameter to task glob outputs.
8+
- **WASM API**
9+
- Added `ParseManifestInput.root` and `ParseLockInput.root` fields.
10+
11+
#### 🧰 Toolchains
12+
13+
- **JavaScript**
14+
- Added support for Bun v1.3 `package.json` catalogs.
15+
- Updated `parse_manifest` to resolve versions from applicable catalogs.
16+
17+
#### 🐞 Fixes
18+
19+
- Fixed an issue where interactive tasks would constantly print the "running for" message.
20+
- Fixed an issue where touched files that were not staged would not be included in the
21+
affected/hashing calculation in CI.
22+
323
## 1.41.4
424

525
#### 🐞 Fixes

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/actions/src/actions/install_dependencies.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ async fn hash_manifest_contents<'action>(
339339
for manifest_path in manifest_paths {
340340
let app_context = Arc::clone(app_context);
341341
let toolchain = Arc::clone(toolchain);
342+
let deps_root = deps_root.to_owned();
342343

343344
if let Ok(rel_path) = manifest_path.relative_to(&app_context.workspace_root) {
344345
hash_content.manifest_paths.insert(rel_path);
@@ -349,6 +350,7 @@ async fn hash_manifest_contents<'action>(
349350
.parse_manifest(ParseManifestInput {
350351
context: app_context.toolchain_registry.create_context(),
351352
path: toolchain.to_virtual_path(manifest_path),
353+
root: toolchain.to_virtual_path(deps_root),
352354
})
353355
.await
354356
}));

crates/config/src/shapes/output.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,32 @@ config_struct!(
5252
pub struct GlobOutput {
5353
/// The glob pattern.
5454
pub glob: GlobPath,
55+
56+
/// Mark the file as optional instead of failing with
57+
/// an error after running a task and the output doesn't exist.
58+
#[serde(default, skip_serializing_if = "Option::is_none")]
59+
pub optional: Option<bool>,
5560
}
5661
);
5762

5863
generate_io_glob_methods!(GlobOutput);
5964

6065
impl GlobOutput {
6166
pub fn from_uri(uri: Uri) -> Result<Self, ParseError> {
62-
let output = Self {
67+
let mut output = Self {
6368
glob: GlobPath::parse(uri.path.replace("__QM__", "?"))?,
69+
optional: None,
6470
};
6571

66-
if let Some((key, _)) = uri.query.into_iter().next() {
67-
return Err(ParseError::new(format!("unknown glob field `{key}`")));
72+
for (key, value) in uri.query {
73+
match key.as_str() {
74+
"optional" => {
75+
output.optional = Some(parse_bool_field(&key, &value)?);
76+
}
77+
_ => {
78+
return Err(ParseError::new(format!("unknown glob field `{key}`")));
79+
}
80+
};
6881
}
6982

7083
Ok(output)
@@ -114,6 +127,14 @@ impl Output {
114127
pub fn is_glob(&self) -> bool {
115128
matches!(self, Self::Glob(_))
116129
}
130+
131+
pub fn is_optional(&self) -> bool {
132+
match self {
133+
Output::File(value) => value.optional.unwrap_or_default(),
134+
Output::Glob(value) => value.optional.unwrap_or_default(),
135+
_ => false,
136+
}
137+
}
117138
}
118139

119140
impl FromStr for Output {

crates/config/src/toolchain_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl ToolchainConfig {
154154
)),
155155
"unstable_javascript" => Some(find_debug_locator_with_url_fallback(
156156
"javascript_toolchain",
157-
"0.2.1",
157+
"0.2.2",
158158
)),
159159
"unstable_go" => Some(find_debug_locator_with_url_fallback(
160160
"go_toolchain",

crates/config/tests/output_shape_test.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ mod output_shape {
156156
Output::parse("glob:///file.*").unwrap(),
157157
Output::Glob(stub_glob_output("/file.*"))
158158
);
159+
160+
let mut output = stub_glob_output("/file.*");
161+
output.optional = Some(true);
162+
163+
assert_eq!(
164+
Output::parse("glob:///file.*?optional").unwrap(),
165+
Output::Glob(output)
166+
);
159167
}
160168

161169
#[test]
@@ -175,6 +183,7 @@ mod output_shape {
175183
assert_eq!(
176184
Output::Glob(GlobOutput {
177185
glob: GlobPath(pat.into()),
186+
optional: None,
178187
}),
179188
Output::Glob(stub_glob_output(pat))
180189
);

crates/pdk-api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "moon_pdk_api"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
edition = "2024"
55
license = "MIT"
66
description = "Core APIs for creating moon WASM plugins."

crates/pdk-api/src/toolchain/tier2.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ api_struct!(
163163

164164
/// Virtual path to the manifest file.
165165
pub path: VirtualPath,
166+
167+
/// Virtual path to the dependencies root. This is where
168+
/// the lockfile and root manifest should exist.
169+
pub root: VirtualPath,
166170
}
167171
);
168172

@@ -293,8 +297,12 @@ api_struct!(
293297
/// Current moon context.
294298
pub context: MoonContext,
295299

296-
/// Virtual path to the lock file.
300+
/// Virtual path to the lockfile.
297301
pub path: VirtualPath,
302+
303+
/// Virtual path to the dependencies root. This is where
304+
/// the lockfile and root manifest should exist.
305+
pub root: VirtualPath,
298306
}
299307
);
300308

@@ -309,7 +317,7 @@ api_struct!(
309317
);
310318

311319
api_struct!(
312-
/// Represents a dependency definition in a lock file.
320+
/// Represents a dependency definition in a lockfile.
313321
#[serde(default)]
314322
pub struct LockDependency {
315323
/// A unique hash: checksum, integrity, etc.

crates/pdk-test-utils/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "moon_pdk_test_utils"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
edition = "2024"
55
license = "MIT"
66
description = "Utilities for testing moon WASM plugins."
@@ -9,7 +9,7 @@ repository = "https://github.com/moonrepo/moon"
99
publish = true
1010

1111
[dependencies]
12-
moon_pdk_api = { version = "0.4.0", path = "../pdk-api" }
12+
moon_pdk_api = { version = "0.4.1", path = "../pdk-api" }
1313
moon_target = { version = "0.2.0", path = "../target" }
1414
extism = { workspace = true }
1515
proto_core = { workspace = true }

0 commit comments

Comments
 (0)