@redwoodjs/agent-ci 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESM loader hook that adds `type: "json"` to bare JSON imports.
|
|
3
|
+
*
|
|
4
|
+
* Node 22+ enforces import attributes for JSON modules, but
|
|
5
|
+
* @actions/workflow-parser imports .json files without them.
|
|
6
|
+
* Registering this hook via `module.register()` before the
|
|
7
|
+
* dynamic import transparently patches the missing attribute.
|
|
8
|
+
*/
|
|
9
|
+
export async function load(url, context, nextLoad) {
|
|
10
|
+
if (url.endsWith(".json") && context.importAttributes?.type !== "json") {
|
|
11
|
+
return nextLoad(url, {
|
|
12
|
+
...context,
|
|
13
|
+
importAttributes: { ...context.importAttributes, type: "json" },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return nextLoad(url, context);
|
|
17
|
+
}
|
|
@@ -4,10 +4,22 @@ import crypto from "crypto";
|
|
|
4
4
|
import { execSync } from "child_process";
|
|
5
5
|
import { minimatch } from "minimatch";
|
|
6
6
|
import { parse as parseYaml } from "yaml";
|
|
7
|
-
// @actions/workflow-parser imports
|
|
8
|
-
// which
|
|
9
|
-
//
|
|
7
|
+
// @actions/workflow-parser imports .json files without `with { type: "json" }`,
|
|
8
|
+
// which Node 22+ rejects. Register a custom ESM loader hook that transparently
|
|
9
|
+
// adds the missing attribute before we dynamically import the module.
|
|
10
|
+
import { register } from "node:module";
|
|
11
|
+
let hookRegistered = false;
|
|
10
12
|
async function loadWorkflowParser() {
|
|
13
|
+
if (!hookRegistered) {
|
|
14
|
+
hookRegistered = true;
|
|
15
|
+
try {
|
|
16
|
+
register("../hooks/json-loader.js", import.meta.url);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// In test environments (Vitest), the hook file may not resolve and
|
|
20
|
+
// Vite already handles JSON imports via its inline config.
|
|
21
|
+
}
|
|
22
|
+
}
|
|
11
23
|
return await import("@actions/workflow-parser");
|
|
12
24
|
}
|
|
13
25
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redwoodjs/agent-ci",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Local GitHub Actions runner",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "FSL-1.1-MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"log-update": "^7.2.0",
|
|
28
28
|
"minimatch": "^10.2.1",
|
|
29
29
|
"yaml": "^2.8.2",
|
|
30
|
-
"dtu-github-actions": "0.3.
|
|
30
|
+
"dtu-github-actions": "0.3.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/dockerode": "^3.3.34",
|