@skuba-lib/api 3.0.1 → 3.1.0-handle-test-envs-better-20261028234113

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.
Files changed (63) hide show
  1. package/lib/buildkite/index.cjs +1 -1
  2. package/lib/buildkite/index.d.cts +1 -1
  3. package/lib/buildkite/index.d.mts +1 -1
  4. package/lib/buildkite/index.mjs +1 -2
  5. package/lib/{buildkite-D6oioQR_.mjs → buildkite-ChVcxGm7.mjs} +6 -9
  6. package/lib/{buildkite-Br2Fyde2.cjs → buildkite-ClGGPaJV.cjs} +6 -9
  7. package/lib/cdk/index.cjs +2 -12
  8. package/lib/cdk/index.d.cts +2 -6
  9. package/lib/cdk/index.d.mts +2 -6
  10. package/lib/cdk/index.mjs +1 -7
  11. package/lib/cdk-BvLDfu0E.cjs +16 -0
  12. package/lib/cdk-BzLbww9n.mjs +6 -0
  13. package/lib/{error-UWg8a0Ma.mjs → error-B7tbxXTQ.mjs} +2 -4
  14. package/lib/{error-C1BybmHW.cjs → error-CG8rNpOB.cjs} +2 -4
  15. package/lib/{exec-DqBpB5Vp.cjs → exec-BIvSnwhj.cjs} +11 -9
  16. package/lib/{exec-GeacTdU5.mjs → exec-DC-QAW0e.mjs} +10 -8
  17. package/lib/{fs-Cjt5C6XD.mjs → fs-Bac0LYeg.mjs} +2 -3
  18. package/lib/{fs-CuSraRTN.cjs → fs-DF1Qj2xv.cjs} +3 -4
  19. package/lib/git/index.cjs +1 -1
  20. package/lib/git/index.d.cts +1 -1
  21. package/lib/git/index.d.mts +1 -1
  22. package/lib/git/index.mjs +1 -2
  23. package/lib/{git-CSGc8r3Q.cjs → git-BOuG-9aF.cjs} +18 -32
  24. package/lib/{git-BygvGOZr.mjs → git-DsCvTj_4.mjs} +16 -30
  25. package/lib/github/index.cjs +2 -2
  26. package/lib/github/index.d.cts +1 -1
  27. package/lib/github/index.d.mts +1 -1
  28. package/lib/github/index.mjs +2 -2
  29. package/lib/{github-BLyV25Ac.mjs → github-B_q9oeR0.mjs} +11 -16
  30. package/lib/{github-CuWb88m1.cjs → github-CY8WyO3R.cjs} +11 -16
  31. package/lib/{index-J0PI37zH.d.mts → index-BIoXUgOB.d.mts} +8 -12
  32. package/lib/{index-BKHTGdUP.d.cts → index-BWrOiE96.d.cts} +5 -2
  33. package/lib/{index-BKHTGdUP.d.mts → index-BWrOiE96.d.mts} +5 -2
  34. package/lib/{index-CLEYcnJY.d.cts → index-CX5l1M9F.d.cts} +0 -22
  35. package/lib/{index-CLEYcnJY.d.mts → index-CX5l1M9F.d.mts} +0 -22
  36. package/lib/{index-CNxgBJm_.d.cts → index-DhV1vmV_.d.cts} +0 -4
  37. package/lib/{index-CNxgBJm_.d.mts → index-DhV1vmV_.d.mts} +0 -4
  38. package/lib/index-i7y5Qwvk.d.cts +5 -0
  39. package/lib/index-i7y5Qwvk.d.mts +5 -0
  40. package/lib/{index--hWvZI6b.d.cts → index-ozhcNkrB.d.cts} +8 -12
  41. package/lib/{index-C9lVo3vU.d.cts → index-tjm5vla2.d.cts} +0 -4
  42. package/lib/{index-C9lVo3vU.d.mts → index-tjm5vla2.d.mts} +0 -4
  43. package/lib/index.cjs +7 -7
  44. package/lib/index.d.cts +6 -6
  45. package/lib/index.d.mts +6 -6
  46. package/lib/index.mjs +6 -6
  47. package/lib/{logging-BQNEupxh.mjs → logging-BnwLxc05.mjs} +1 -2
  48. package/lib/{logging-BqpzZfsF.cjs → logging-DlMiOLHo.cjs} +1 -2
  49. package/lib/net/index.cjs +1 -1
  50. package/lib/net/index.d.cts +1 -1
  51. package/lib/net/index.d.mts +1 -1
  52. package/lib/net/index.mjs +1 -2
  53. package/lib/{net-BONidEnf.cjs → net-B0uYVMTV.cjs} +6 -10
  54. package/lib/{net-BxPK6QHR.mjs → net-Biz58RYT.mjs} +6 -10
  55. package/lib/rolldown/index.cjs +1 -1
  56. package/lib/rolldown/index.d.cts +1 -1
  57. package/lib/rolldown/index.d.mts +1 -1
  58. package/lib/rolldown/index.mjs +1 -2
  59. package/lib/{rolldown-B47lAoi7.cjs → rolldown-CR7S2KPn.cjs} +55 -12
  60. package/lib/{rolldown-runtime-C0BPl7ul.cjs → rolldown-runtime-BW-eSwOZ.cjs} +1 -2
  61. package/lib/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-D8jQpDG7.mjs} +1 -2
  62. package/lib/{rolldown-CHdN4G5F.mjs → rolldown-rxuJncaa.mjs} +55 -12
  63. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- //#region src/buildkite/annotate.d.ts
2
1
  type AnnotationStyle = 'success' | 'info' | 'warning' | 'error';
3
2
  interface AnnotationOptions {
4
3
  context?: string;
@@ -24,8 +23,6 @@ interface AnnotationOptions {
24
23
  * The `buildkite-agent` binary must also be on your `PATH`.
25
24
  */
26
25
  declare const annotate: (markdown: string, opts?: AnnotationOptions) => Promise<void>;
27
- //#endregion
28
- //#region src/buildkite/md.d.ts
29
26
  /**
30
27
  * @internal
31
28
  */
@@ -35,5 +32,4 @@ declare const md: {
35
32
  declare namespace index_d_exports {
36
33
  export { AnnotationStyle, annotate, md };
37
34
  }
38
- //#endregion
39
35
  export { annotate as i, md as n, AnnotationStyle as r, index_d_exports as t };
@@ -0,0 +1,5 @@
1
+ declare namespace index_d_exports {
2
+ export { normaliseTemplate };
3
+ }
4
+ declare const normaliseTemplate: (template: object) => unknown;
5
+ export { normaliseTemplate as n, index_d_exports as t };
@@ -0,0 +1,5 @@
1
+ declare namespace index_d_exports {
2
+ export { normaliseTemplate };
3
+ }
4
+ declare const normaliseTemplate: (template: object) => unknown;
5
+ export { normaliseTemplate as n, index_d_exports as t };
@@ -1,7 +1,6 @@
1
- import { f as ChangedFile, t as index_d_exports$1 } from "./index-CLEYcnJY.cjs";
1
+ import { f as ChangedFile } from "./index-CX5l1M9F.cjs";
2
2
  import { Endpoints } from "@octokit/types";
3
3
  import { Octokit } from "@octokit/rest";
4
- //#region src/github/checkRun.d.ts
5
4
  type Output = NonNullable<Endpoints['PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}']['parameters']['output']>;
6
5
  type Annotation = NonNullable<Output['annotations']>[number];
7
6
  /**
@@ -18,6 +17,12 @@ interface CreateCheckRunParameters {
18
17
  * The final conclusion of the check.
19
18
  */
20
19
  conclusion: 'failure' | 'success';
20
+ /**
21
+ * A URL that links to the full details of the check, such as a CI build.
22
+ *
23
+ * Defaults to the homepage of the GitHub App that created the check run.
24
+ */
25
+ detailsUrl?: string;
21
26
  /**
22
27
  * The name of the check. For example, "code-coverage".
23
28
  */
@@ -43,9 +48,7 @@ interface CreateCheckRunParameters {
43
48
  * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with the `checks:write` permission
44
49
  * must be present on the environment.
45
50
  */
46
- declare const createCheckRun: ({ annotations, conclusion, name, summary, text, title }: CreateCheckRunParameters) => Promise<void>;
47
- //#endregion
48
- //#region src/github/environment.d.ts
51
+ declare const createCheckRun: ({ annotations, conclusion, detailsUrl, name, summary, text, title }: CreateCheckRunParameters) => Promise<void>;
49
52
  /**
50
53
  * Returns the name of the build as seen in GitHub status checks.
51
54
  *
@@ -63,8 +66,6 @@ declare const enabledFromEnvironment: (env?: NodeJS.ProcessEnv) => boolean;
63
66
  * Tries to return a GitHub API token from the environment.
64
67
  */
65
68
  declare const apiTokenFromEnvironment: (env?: NodeJS.ProcessEnv) => string | undefined;
66
- //#endregion
67
- //#region src/github/pullRequest.d.ts
68
69
  interface GetPullRequestParameters {
69
70
  /**
70
71
  * A preconstructed Octokit client to interact with GitHub's APIs.
@@ -84,8 +85,6 @@ interface GetPullRequestParameters {
84
85
  * associated pull requests, or if they are all closed or locked.
85
86
  */
86
87
  declare const getPullRequestNumber: (params?: GetPullRequestParameters) => Promise<number>;
87
- //#endregion
88
- //#region src/github/issueComment.d.ts
89
88
  /**
90
89
  * https://docs.github.com/en/rest/reference/issues#create-an-issue-comment
91
90
  */
@@ -146,8 +145,6 @@ interface IssueComment {
146
145
  * on the environment.
147
146
  */
148
147
  declare const putIssueComment: (params: PutIssueCommentParameters) => Promise<IssueComment | null>;
149
- //#endregion
150
- //#region src/github/push.d.ts
151
148
  interface UploadAllFileChangesParams {
152
149
  dir: string;
153
150
  /**
@@ -234,5 +231,4 @@ declare const uploadFileChanges: ({ dir, branch, messageHeadline, messageBody, f
234
231
  declare namespace index_d_exports {
235
232
  export { Annotation, apiTokenFromEnvironment, buildNameFromEnvironment, createCheckRun, enabledFromEnvironment, getPullRequestNumber, putIssueComment, readFileChanges, uploadAllFileChanges, uploadFileChanges };
236
233
  }
237
- //#endregion
238
234
  export { putIssueComment as a, buildNameFromEnvironment as c, createCheckRun as d, uploadFileChanges as i, enabledFromEnvironment as l, readFileChanges as n, getPullRequestNumber as o, uploadAllFileChanges as r, apiTokenFromEnvironment as s, index_d_exports as t, Annotation as u };
@@ -1,10 +1,7 @@
1
- //#region src/net/socket.d.ts
2
1
  interface SocketAddress {
3
2
  host: string;
4
3
  port: number;
5
4
  }
6
- //#endregion
7
- //#region src/net/waitFor.d.ts
8
5
  /**
9
6
  * Wait for a resource to start listening on a socket address.
10
7
  *
@@ -29,5 +26,4 @@ declare const waitFor: ({ host, port, resolveCompose, timeout }: {
29
26
  declare namespace index_d_exports {
30
27
  export { waitFor };
31
28
  }
32
- //#endregion
33
29
  export { waitFor as n, index_d_exports as t };
@@ -1,10 +1,7 @@
1
- //#region src/net/socket.d.ts
2
1
  interface SocketAddress {
3
2
  host: string;
4
3
  port: number;
5
4
  }
6
- //#endregion
7
- //#region src/net/waitFor.d.ts
8
5
  /**
9
6
  * Wait for a resource to start listening on a socket address.
10
7
  *
@@ -29,5 +26,4 @@ declare const waitFor: ({ host, port, resolveCompose, timeout }: {
29
26
  declare namespace index_d_exports {
30
27
  export { waitFor };
31
28
  }
32
- //#endregion
33
29
  export { waitFor as n, index_d_exports as t };
package/lib/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_buildkite = require("./buildkite-Br2Fyde2.cjs");
3
- const require_cdk_index = require("./cdk/index.cjs");
4
- const require_git = require("./git-CSGc8r3Q.cjs");
5
- const require_github = require("./github-CuWb88m1.cjs");
6
- const require_net = require("./net-BONidEnf.cjs");
7
- const require_rolldown = require("./rolldown-B47lAoi7.cjs");
2
+ const require_buildkite = require("./buildkite-ClGGPaJV.cjs");
3
+ const require_cdk = require("./cdk-BvLDfu0E.cjs");
4
+ const require_git = require("./git-BOuG-9aF.cjs");
5
+ const require_github = require("./github-CY8WyO3R.cjs");
6
+ const require_net = require("./net-B0uYVMTV.cjs");
7
+ const require_rolldown = require("./rolldown-CR7S2KPn.cjs");
8
8
  Object.defineProperty(exports, "Buildkite", {
9
9
  enumerable: true,
10
10
  get: function() {
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "Buildkite", {
14
14
  Object.defineProperty(exports, "Cdk", {
15
15
  enumerable: true,
16
16
  get: function() {
17
- return require_cdk_index.cdk_exports;
17
+ return require_cdk.cdk_exports;
18
18
  }
19
19
  });
20
20
  Object.defineProperty(exports, "Git", {
package/lib/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { t as index_d_exports } from "./index-CNxgBJm_.cjs";
2
- import { t as index_d_exports$1 } from "./cdk/index.cjs";
3
- import { t as index_d_exports$2 } from "./index-CLEYcnJY.cjs";
4
- import { t as index_d_exports$3 } from "./index--hWvZI6b.cjs";
5
- import { t as index_d_exports$4 } from "./index-C9lVo3vU.cjs";
6
- import { t as index_d_exports$5 } from "./index-BKHTGdUP.cjs";
1
+ import { t as index_d_exports } from "./index-DhV1vmV_.cjs";
2
+ import { t as index_d_exports$1 } from "./index-i7y5Qwvk.cjs";
3
+ import { t as index_d_exports$2 } from "./index-CX5l1M9F.cjs";
4
+ import { t as index_d_exports$3 } from "./index-ozhcNkrB.cjs";
5
+ import { t as index_d_exports$4 } from "./index-tjm5vla2.cjs";
6
+ import { t as index_d_exports$5 } from "./index-BWrOiE96.cjs";
7
7
  export { index_d_exports as Buildkite, index_d_exports$1 as Cdk, index_d_exports$2 as Git, index_d_exports$3 as GitHub, index_d_exports$4 as Net, index_d_exports$5 as Rolldown };
package/lib/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { t as index_d_exports } from "./index-CNxgBJm_.mjs";
2
- import { t as index_d_exports$1 } from "./cdk/index.mjs";
3
- import { t as index_d_exports$2 } from "./index-CLEYcnJY.mjs";
4
- import { t as index_d_exports$3 } from "./index-J0PI37zH.mjs";
5
- import { t as index_d_exports$4 } from "./index-C9lVo3vU.mjs";
6
- import { t as index_d_exports$5 } from "./index-BKHTGdUP.mjs";
1
+ import { t as index_d_exports } from "./index-DhV1vmV_.mjs";
2
+ import { t as index_d_exports$1 } from "./index-i7y5Qwvk.mjs";
3
+ import { t as index_d_exports$2 } from "./index-CX5l1M9F.mjs";
4
+ import { t as index_d_exports$3 } from "./index-BIoXUgOB.mjs";
5
+ import { t as index_d_exports$4 } from "./index-tjm5vla2.mjs";
6
+ import { t as index_d_exports$5 } from "./index-BWrOiE96.mjs";
7
7
  export { index_d_exports as Buildkite, index_d_exports$1 as Cdk, index_d_exports$2 as Git, index_d_exports$3 as GitHub, index_d_exports$4 as Net, index_d_exports$5 as Rolldown };
package/lib/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { t as buildkite_exports } from "./buildkite-D6oioQR_.mjs";
2
- import { t as cdk_exports } from "./cdk/index.mjs";
3
- import { t as git_exports } from "./git-BygvGOZr.mjs";
4
- import { t as github_exports } from "./github-BLyV25Ac.mjs";
5
- import { t as net_exports } from "./net-BxPK6QHR.mjs";
6
- import { t as rolldown_exports } from "./rolldown-CHdN4G5F.mjs";
1
+ import { t as buildkite_exports } from "./buildkite-ChVcxGm7.mjs";
2
+ import { t as cdk_exports } from "./cdk-BzLbww9n.mjs";
3
+ import { t as git_exports } from "./git-DsCvTj_4.mjs";
4
+ import { t as github_exports } from "./github-B_q9oeR0.mjs";
5
+ import { t as net_exports } from "./net-Biz58RYT.mjs";
6
+ import { t as rolldown_exports } from "./rolldown-rxuJncaa.mjs";
7
7
  export { buildkite_exports as Buildkite, cdk_exports as Cdk, git_exports as Git, github_exports as GitHub, net_exports as Net, rolldown_exports as Rolldown };
@@ -1,5 +1,5 @@
1
1
  import { styleText } from "node:util";
2
- //#region ../../src/utils/logging.ts
2
+ // ../../src/utils/logging.ts
3
3
  const createLogger = ({ debug, prefixes = [], suffixes = [] }) => {
4
4
  const logWithoutSuffixes = (...message) => console.log(...prefixes, ...message);
5
5
  const log = (...message) => logWithoutSuffixes(...message, ...suffixes);
@@ -24,5 +24,4 @@ const createLogger = ({ debug, prefixes = [], suffixes = [] }) => {
24
24
  };
25
25
  const log = createLogger({ debug: false });
26
26
  const pluralise = (count, subject) => `${count} ${subject}${count === 1 ? "" : "s"}`;
27
- //#endregion
28
27
  export { pluralise as n, log as t };
@@ -1,5 +1,5 @@
1
1
  let node_util = require("node:util");
2
- //#region ../../src/utils/logging.ts
2
+ // ../../src/utils/logging.ts
3
3
  const createLogger = ({ debug, prefixes = [], suffixes = [] }) => {
4
4
  const logWithoutSuffixes = (...message) => console.log(...prefixes, ...message);
5
5
  const log = (...message) => logWithoutSuffixes(...message, ...suffixes);
@@ -24,7 +24,6 @@ const createLogger = ({ debug, prefixes = [], suffixes = [] }) => {
24
24
  };
25
25
  const log = createLogger({ debug: false });
26
26
  const pluralise = (count, subject) => `${count} ${subject}${count === 1 ? "" : "s"}`;
27
- //#endregion
28
27
  Object.defineProperty(exports, "log", {
29
28
  enumerable: true,
30
29
  get: function() {
package/lib/net/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_net = require("../net-BONidEnf.cjs");
2
+ const require_net = require("../net-B0uYVMTV.cjs");
3
3
  exports.waitFor = require_net.waitFor;
@@ -1,2 +1,2 @@
1
- import { n as waitFor } from "../index-C9lVo3vU.cjs";
1
+ import { n as waitFor } from "../index-tjm5vla2.cjs";
2
2
  export { waitFor };
@@ -1,2 +1,2 @@
1
- import { n as waitFor } from "../index-C9lVo3vU.mjs";
1
+ import { n as waitFor } from "../index-tjm5vla2.mjs";
2
2
  export { waitFor };
package/lib/net/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import { n as waitFor } from "../net-BxPK6QHR.mjs";
2
- export { waitFor };
1
+ export { n as waitFor } from "../net-Biz58RYT.mjs";
@@ -1,8 +1,8 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
- const require_exec = require("./exec-DqBpB5Vp.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-BW-eSwOZ.cjs");
2
+ const require_exec = require("./exec-BIvSnwhj.cjs");
3
3
  let net = require("net");
4
4
  net = require_rolldown_runtime.__toESM(net, 1);
5
- //#region src/net/compose.ts
5
+ // src/net/compose.ts
6
6
  const portStringToNumber = (portString) => {
7
7
  const port = Number(portString);
8
8
  if (!Number.isSafeInteger(port)) throw Error(`received non-integer port: '${portString}'`);
@@ -17,8 +17,7 @@ const resolveComposeAddress = async (privateHost, privatePort) => {
17
17
  port: portStringToNumber(portString)
18
18
  };
19
19
  };
20
- //#endregion
21
- //#region src/net/socket.ts
20
+ // src/net/socket.ts
22
21
  const trySocket = async (host, port) => new Promise((resolve) => {
23
22
  const socket = new net.default.Socket();
24
23
  const onFailure = () => {
@@ -45,8 +44,7 @@ const pollSocket = async (host, port, timeout) => new Promise((resolve, reject)
45
44
  }, timeout);
46
45
  callPort().catch(() => void 0);
47
46
  });
48
- //#endregion
49
- //#region src/net/waitFor.ts
47
+ // src/net/waitFor.ts
50
48
  /**
51
49
  * Wait for a resource to start listening on a socket address.
52
50
  *
@@ -61,10 +59,8 @@ const waitFor = async ({ host = "localhost", port, resolveCompose = false, timeo
61
59
  await pollSocket(resolvedAddress.host, resolvedAddress.port, timeout);
62
60
  return resolvedAddress;
63
61
  };
64
- //#endregion
65
- //#region src/net/index.ts
62
+ // src/net/index.ts
66
63
  var net_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ waitFor: () => waitFor });
67
- //#endregion
68
64
  Object.defineProperty(exports, "net_exports", {
69
65
  enumerable: true,
70
66
  get: function() {
@@ -1,7 +1,7 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { t as createExec } from "./exec-GeacTdU5.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
2
+ import { t as createExec } from "./exec-DC-QAW0e.mjs";
3
3
  import net from "net";
4
- //#region src/net/compose.ts
4
+ // src/net/compose.ts
5
5
  const portStringToNumber = (portString) => {
6
6
  const port = Number(portString);
7
7
  if (!Number.isSafeInteger(port)) throw Error(`received non-integer port: '${portString}'`);
@@ -16,8 +16,7 @@ const resolveComposeAddress = async (privateHost, privatePort) => {
16
16
  port: portStringToNumber(portString)
17
17
  };
18
18
  };
19
- //#endregion
20
- //#region src/net/socket.ts
19
+ // src/net/socket.ts
21
20
  const trySocket = async (host, port) => new Promise((resolve) => {
22
21
  const socket = new net.Socket();
23
22
  const onFailure = () => {
@@ -44,8 +43,7 @@ const pollSocket = async (host, port, timeout) => new Promise((resolve, reject)
44
43
  }, timeout);
45
44
  callPort().catch(() => void 0);
46
45
  });
47
- //#endregion
48
- //#region src/net/waitFor.ts
46
+ // src/net/waitFor.ts
49
47
  /**
50
48
  * Wait for a resource to start listening on a socket address.
51
49
  *
@@ -60,8 +58,6 @@ const waitFor = async ({ host = "localhost", port, resolveCompose = false, timeo
60
58
  await pollSocket(resolvedAddress.host, resolvedAddress.port, timeout);
61
59
  return resolvedAddress;
62
60
  };
63
- //#endregion
64
- //#region src/net/index.ts
61
+ // src/net/index.ts
65
62
  var net_exports = /* @__PURE__ */ __exportAll({ waitFor: () => waitFor });
66
- //#endregion
67
63
  export { waitFor as n, net_exports as t };
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown = require("../rolldown-B47lAoi7.cjs");
2
+ const require_rolldown = require("../rolldown-CR7S2KPn.cjs");
3
3
  exports.lambdaAsset = require_rolldown.lambdaAsset;
@@ -1,2 +1,2 @@
1
- import { i as lambdaAsset, n as LambdaAssetFile, r as LambdaAssetOptions } from "../index-BKHTGdUP.cjs";
1
+ import { i as lambdaAsset, n as LambdaAssetFile, r as LambdaAssetOptions } from "../index-BWrOiE96.cjs";
2
2
  export { type LambdaAssetFile, type LambdaAssetOptions, lambdaAsset };
@@ -1,2 +1,2 @@
1
- import { i as lambdaAsset, n as LambdaAssetFile, r as LambdaAssetOptions } from "../index-BKHTGdUP.mjs";
1
+ import { i as lambdaAsset, n as LambdaAssetFile, r as LambdaAssetOptions } from "../index-BWrOiE96.mjs";
2
2
  export { type LambdaAssetFile, type LambdaAssetOptions, lambdaAsset };
@@ -1,2 +1 @@
1
- import { n as lambdaAsset } from "../rolldown-CHdN4G5F.mjs";
2
- export { lambdaAsset };
1
+ export { n as lambdaAsset } from "../rolldown-rxuJncaa.mjs";
@@ -1,7 +1,7 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
- const require_logging = require("./logging-BqpzZfsF.cjs");
3
- const require_exec = require("./exec-DqBpB5Vp.cjs");
4
- const require_fs = require("./fs-CuSraRTN.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-BW-eSwOZ.cjs");
2
+ const require_logging = require("./logging-DlMiOLHo.cjs");
3
+ const require_exec = require("./exec-BIvSnwhj.cjs");
4
+ const require_fs = require("./fs-DF1Qj2xv.cjs");
5
5
  let fs_extra = require("fs-extra");
6
6
  fs_extra = require_rolldown_runtime.__toESM(fs_extra, 1);
7
7
  let node_path = require("node:path");
@@ -10,7 +10,7 @@ let find_up = require("find-up");
10
10
  let node_module = require("node:module");
11
11
  let node_url = require("node:url");
12
12
  let yaml = require("yaml");
13
- //#region src/rolldown/pnpm.ts
13
+ // src/rolldown/pnpm.ts
14
14
  const PNPM_LOCK = "pnpm-lock.yaml";
15
15
  const PNPM_WORKSPACE_YAML = "pnpm-workspace.yaml";
16
16
  const PNPM_PATCHES_DIR = "patches";
@@ -115,9 +115,22 @@ const extractDependencies = async (resolveFrom, modules) => {
115
115
  }
116
116
  return result;
117
117
  };
118
- //#endregion
119
- //#region src/rolldown/lambdaAsset.ts
118
+ // src/rolldown/lambdaAsset.ts
120
119
  const PLUGIN_NAME = "skuba:lambda-asset";
120
+ /**
121
+ * Whether to emit a stub Lambda asset for tests, such as CDK snapshot tests.
122
+ *
123
+ * Set `ENVIRONMENT=test` in your test config (e.g. Vitest's `test.env`) so CDK
124
+ * stack tests can build the real rolldown config and get a directory for
125
+ * `Code.fromAsset` without bundling, installing `nodeModules` or copying
126
+ * `assets`.
127
+ */
128
+ const isTestMode = () => process.env.ENVIRONMENT === "test";
129
+ const TEST_MODE_STUB = [
130
+ `// Placeholder emitted by ${PLUGIN_NAME} when ENVIRONMENT=test.`,
131
+ "export const handler = () => {};",
132
+ ""
133
+ ].join("\n");
121
134
  const resolveOutputDir = ({ dir, file }, cwd) => {
122
135
  if (!dir) throw new Error(`${PLUGIN_NAME} requires \`output.dir\`; it prepares a deployable directory, so a single \`output.file\`${file ? ` (${file})` : ""} has nowhere to install into.`);
123
136
  return node_path.resolve(cwd, dir);
@@ -189,6 +202,11 @@ const stripInstallFiles = async (outputDir, stagedFiles, cause) => {
189
202
  *
190
203
  * The result can be handed to CDK as `aws_lambda.Code.fromAsset(outputDir)`.
191
204
  *
205
+ * When `ENVIRONMENT=test`, the plugin emits a
206
+ * stub asset instead: each entry module is replaced with a placeholder handler,
207
+ * and `nodeModules` and `assets` are skipped. This lets CDK stack tests build
208
+ * the rolldown config cheaply and deterministically before synthesising.
209
+ *
192
210
  * @example
193
211
  * ```js
194
212
  * // rolldown.config.mjs
@@ -209,23 +227,50 @@ const stripInstallFiles = async (outputDir, stagedFiles, cause) => {
209
227
  */
210
228
  const lambdaAsset = ({ nodeModules = [], assets = [], projectRoot: projectRootOption, depsLockFilePath: depsLockFilePathOption } = {}) => {
211
229
  const prepared = /* @__PURE__ */ new Set();
230
+ const stubbedEntries = /* @__PURE__ */ new Set();
212
231
  let cwd = process.cwd();
232
+ let testMode = false;
213
233
  return {
214
234
  name: PLUGIN_NAME,
215
235
  async buildStart(options) {
216
236
  cwd = options.cwd;
217
237
  prepared.clear();
218
- if (assets.length) {
238
+ stubbedEntries.clear();
239
+ testMode = isTestMode();
240
+ if (assets.length && !testMode) {
219
241
  const projectRoot = node_path.resolve(cwd, projectRootOption ?? ".");
220
242
  await emitAssets((file) => this.emitFile(file), projectRoot, assets);
221
243
  }
222
244
  },
245
+ resolveId: {
246
+ order: "pre",
247
+ async handler(source, importer, extraOptions) {
248
+ if (!testMode || !extraOptions.isEntry) return null;
249
+ const resolved = await this.resolve(source, importer, {
250
+ ...extraOptions,
251
+ skipSelf: true
252
+ });
253
+ const id = resolved && !resolved.external ? resolved.id : node_path.resolve(cwd, source);
254
+ stubbedEntries.add(id);
255
+ return { id };
256
+ }
257
+ },
258
+ load: {
259
+ order: "pre",
260
+ handler(id) {
261
+ if (!stubbedEntries.has(id)) return null;
262
+ return {
263
+ code: TEST_MODE_STUB,
264
+ moduleType: "js"
265
+ };
266
+ }
267
+ },
223
268
  async writeBundle(outputOptions) {
224
269
  const outputDir = resolveOutputDir(outputOptions, cwd);
225
270
  if (prepared.has(outputDir)) return;
226
271
  prepared.add(outputDir);
227
272
  const projectRoot = node_path.resolve(cwd, projectRootOption ?? ".");
228
- if (!nodeModules.length) {
273
+ if (!nodeModules.length || testMode) {
229
274
  await writeOutputPackageJson(outputDir);
230
275
  return;
231
276
  }
@@ -260,10 +305,8 @@ const lambdaAsset = ({ nodeModules = [], assets = [], projectRoot: projectRootOp
260
305
  }
261
306
  };
262
307
  };
263
- //#endregion
264
- //#region src/rolldown/index.ts
308
+ // src/rolldown/index.ts
265
309
  var rolldown_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ lambdaAsset: () => lambdaAsset });
266
- //#endregion
267
310
  Object.defineProperty(exports, "lambdaAsset", {
268
311
  enumerable: true,
269
312
  get: function() {
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  value: mod,
29
29
  enumerable: true
30
30
  }) : target, mod));
31
- //#endregion
32
31
  Object.defineProperty(exports, "__exportAll", {
33
32
  enumerable: true,
34
33
  get: function() {
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __exportAll = (all, no_symbols) => {
4
4
  let target = {};
@@ -9,5 +9,4 @@ var __exportAll = (all, no_symbols) => {
9
9
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
10
  return target;
11
11
  };
12
- //#endregion
13
12
  export { __exportAll as t };
@@ -1,14 +1,14 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { t as log } from "./logging-BQNEupxh.mjs";
3
- import { t as createExec } from "./exec-GeacTdU5.mjs";
4
- import { t as pathExists } from "./fs-Cjt5C6XD.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
2
+ import { t as log } from "./logging-BnwLxc05.mjs";
3
+ import { t as createExec } from "./exec-DC-QAW0e.mjs";
4
+ import { t as pathExists } from "./fs-Bac0LYeg.mjs";
5
5
  import { findPackageJSON } from "node:module";
6
6
  import fs from "fs-extra";
7
7
  import * as path from "node:path";
8
8
  import { findUp } from "find-up";
9
9
  import { pathToFileURL } from "node:url";
10
10
  import { isMap, parseDocument } from "yaml";
11
- //#region src/rolldown/pnpm.ts
11
+ // src/rolldown/pnpm.ts
12
12
  const PNPM_LOCK = "pnpm-lock.yaml";
13
13
  const PNPM_WORKSPACE_YAML = "pnpm-workspace.yaml";
14
14
  const PNPM_PATCHES_DIR = "patches";
@@ -113,9 +113,22 @@ const extractDependencies = async (resolveFrom, modules) => {
113
113
  }
114
114
  return result;
115
115
  };
116
- //#endregion
117
- //#region src/rolldown/lambdaAsset.ts
116
+ // src/rolldown/lambdaAsset.ts
118
117
  const PLUGIN_NAME = "skuba:lambda-asset";
118
+ /**
119
+ * Whether to emit a stub Lambda asset for tests, such as CDK snapshot tests.
120
+ *
121
+ * Set `ENVIRONMENT=test` in your test config (e.g. Vitest's `test.env`) so CDK
122
+ * stack tests can build the real rolldown config and get a directory for
123
+ * `Code.fromAsset` without bundling, installing `nodeModules` or copying
124
+ * `assets`.
125
+ */
126
+ const isTestMode = () => process.env.ENVIRONMENT === "test";
127
+ const TEST_MODE_STUB = [
128
+ `// Placeholder emitted by ${PLUGIN_NAME} when ENVIRONMENT=test.`,
129
+ "export const handler = () => {};",
130
+ ""
131
+ ].join("\n");
119
132
  const resolveOutputDir = ({ dir, file }, cwd) => {
120
133
  if (!dir) throw new Error(`${PLUGIN_NAME} requires \`output.dir\`; it prepares a deployable directory, so a single \`output.file\`${file ? ` (${file})` : ""} has nowhere to install into.`);
121
134
  return path.resolve(cwd, dir);
@@ -187,6 +200,11 @@ const stripInstallFiles = async (outputDir, stagedFiles, cause) => {
187
200
  *
188
201
  * The result can be handed to CDK as `aws_lambda.Code.fromAsset(outputDir)`.
189
202
  *
203
+ * When `ENVIRONMENT=test`, the plugin emits a
204
+ * stub asset instead: each entry module is replaced with a placeholder handler,
205
+ * and `nodeModules` and `assets` are skipped. This lets CDK stack tests build
206
+ * the rolldown config cheaply and deterministically before synthesising.
207
+ *
190
208
  * @example
191
209
  * ```js
192
210
  * // rolldown.config.mjs
@@ -207,23 +225,50 @@ const stripInstallFiles = async (outputDir, stagedFiles, cause) => {
207
225
  */
208
226
  const lambdaAsset = ({ nodeModules = [], assets = [], projectRoot: projectRootOption, depsLockFilePath: depsLockFilePathOption } = {}) => {
209
227
  const prepared = /* @__PURE__ */ new Set();
228
+ const stubbedEntries = /* @__PURE__ */ new Set();
210
229
  let cwd = process.cwd();
230
+ let testMode = false;
211
231
  return {
212
232
  name: PLUGIN_NAME,
213
233
  async buildStart(options) {
214
234
  cwd = options.cwd;
215
235
  prepared.clear();
216
- if (assets.length) {
236
+ stubbedEntries.clear();
237
+ testMode = isTestMode();
238
+ if (assets.length && !testMode) {
217
239
  const projectRoot = path.resolve(cwd, projectRootOption ?? ".");
218
240
  await emitAssets((file) => this.emitFile(file), projectRoot, assets);
219
241
  }
220
242
  },
243
+ resolveId: {
244
+ order: "pre",
245
+ async handler(source, importer, extraOptions) {
246
+ if (!testMode || !extraOptions.isEntry) return null;
247
+ const resolved = await this.resolve(source, importer, {
248
+ ...extraOptions,
249
+ skipSelf: true
250
+ });
251
+ const id = resolved && !resolved.external ? resolved.id : path.resolve(cwd, source);
252
+ stubbedEntries.add(id);
253
+ return { id };
254
+ }
255
+ },
256
+ load: {
257
+ order: "pre",
258
+ handler(id) {
259
+ if (!stubbedEntries.has(id)) return null;
260
+ return {
261
+ code: TEST_MODE_STUB,
262
+ moduleType: "js"
263
+ };
264
+ }
265
+ },
221
266
  async writeBundle(outputOptions) {
222
267
  const outputDir = resolveOutputDir(outputOptions, cwd);
223
268
  if (prepared.has(outputDir)) return;
224
269
  prepared.add(outputDir);
225
270
  const projectRoot = path.resolve(cwd, projectRootOption ?? ".");
226
- if (!nodeModules.length) {
271
+ if (!nodeModules.length || testMode) {
227
272
  await writeOutputPackageJson(outputDir);
228
273
  return;
229
274
  }
@@ -258,8 +303,6 @@ const lambdaAsset = ({ nodeModules = [], assets = [], projectRoot: projectRootOp
258
303
  }
259
304
  };
260
305
  };
261
- //#endregion
262
- //#region src/rolldown/index.ts
306
+ // src/rolldown/index.ts
263
307
  var rolldown_exports = /* @__PURE__ */ __exportAll({ lambdaAsset: () => lambdaAsset });
264
- //#endregion
265
308
  export { lambdaAsset as n, rolldown_exports as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skuba-lib/api",
3
- "version": "3.0.1",
3
+ "version": "3.1.0-handle-test-envs-better-20261028234113",
4
4
  "description": "Node.js development API for skuba",
5
5
  "homepage": "https://github.com/seek-oss/skuba#readme",
6
6
  "bugs": {