@skuba-lib/api 2.2.0 → 3.0.0-add-cdk-NodejsFunction-20260620003026

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 (47) hide show
  1. package/buildkite/package.json +1 -2
  2. package/cdk/nodejsFunction/package.json +5 -0
  3. package/cdk/package.json +1 -2
  4. package/git/package.json +1 -2
  5. package/github/package.json +1 -2
  6. package/lib/buildkite/index.mjs +1 -1
  7. package/lib/{buildkite-DdGh6ljO.mjs → buildkite-DCSmKf_B.mjs} +1 -1
  8. package/lib/cdk/bridges/rolldown.mjs +50 -0
  9. package/lib/cdk/index.d.mts +13 -5
  10. package/lib/cdk/index.mjs +18 -4
  11. package/lib/cdk/nodejsFunction/index.d.mts +2 -0
  12. package/lib/cdk/nodejsFunction/index.mjs +334 -0
  13. package/lib/git/index.mjs +1 -1
  14. package/lib/{git-CmP3a9Z9.mjs → git-BHbneN9r.mjs} +1 -1
  15. package/lib/github/index.mjs +2 -2
  16. package/lib/{github-BUEZ_y2Y.mjs → github-Buehx6Xt.mjs} +2 -2
  17. package/lib/index-DnMMX6Ji.d.mts +32 -0
  18. package/lib/index.d.mts +4 -5
  19. package/lib/index.mjs +5 -6
  20. package/lib/net/index.mjs +1 -1
  21. package/lib/{net-Bi0PXcTy.mjs → net-CbEVAvJj.mjs} +1 -1
  22. package/lib/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-8H4AJuhK.mjs} +1 -0
  23. package/net/package.json +1 -2
  24. package/package.json +28 -29
  25. package/lib/buildkite/index.cjs +0 -4
  26. package/lib/buildkite/index.d.cts +0 -2
  27. package/lib/buildkite-_FU8d_a-.cjs +0 -62
  28. package/lib/cdk/index.cjs +0 -13
  29. package/lib/cdk/index.d.cts +0 -6
  30. package/lib/error-BnrwrJEG.cjs +0 -62
  31. package/lib/exec-Da3EoDZ1.cjs +0 -82
  32. package/lib/git/index.cjs +0 -14
  33. package/lib/git/index.d.cts +0 -2
  34. package/lib/git-D98vomnD.cjs +0 -460
  35. package/lib/github/index.cjs +0 -12
  36. package/lib/github/index.d.cts +0 -2
  37. package/lib/github-D12IboDc.cjs +0 -296
  38. package/lib/index-C9WMO_Y9.d.cts +0 -278
  39. package/lib/index-CNxgBJm_.d.cts +0 -39
  40. package/lib/index-D4JUiy2k.d.cts +0 -259
  41. package/lib/index-Kyp8ZCwF.d.cts +0 -38
  42. package/lib/index.cjs +0 -36
  43. package/lib/index.d.cts +0 -6
  44. package/lib/net/index.cjs +0 -3
  45. package/lib/net/index.d.cts +0 -2
  46. package/lib/net-4Ly1AB2r.cjs +0 -79
  47. package/lib/rolldown-runtime-DakpK96I.cjs +0 -43
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skuba-lib/api",
3
- "version": "2.2.0",
3
+ "version": "3.0.0-add-cdk-NodejsFunction-20260620003026",
4
4
  "description": "Node.js development API for skuba",
5
5
  "homepage": "https://github.com/seek-oss/skuba#readme",
6
6
  "bugs": {
@@ -14,35 +14,16 @@
14
14
  "license": "MIT",
15
15
  "type": "module",
16
16
  "exports": {
17
- ".": {
18
- "import": "./lib/index.mjs",
19
- "require": "./lib/index.cjs"
20
- },
21
- "./buildkite": {
22
- "import": "./lib/buildkite/index.mjs",
23
- "require": "./lib/buildkite/index.cjs"
24
- },
25
- "./cdk": {
26
- "import": "./lib/cdk/index.mjs",
27
- "require": "./lib/cdk/index.cjs"
28
- },
29
- "./git": {
30
- "import": "./lib/git/index.mjs",
31
- "require": "./lib/git/index.cjs"
32
- },
33
- "./github": {
34
- "import": "./lib/github/index.mjs",
35
- "require": "./lib/github/index.cjs"
36
- },
37
- "./net": {
38
- "import": "./lib/net/index.mjs",
39
- "require": "./lib/net/index.cjs"
40
- },
17
+ ".": "./lib/index.mjs",
18
+ "./buildkite": "./lib/buildkite/index.mjs",
19
+ "./cdk": "./lib/cdk/index.mjs",
20
+ "./cdk/nodejsFunction": "./lib/cdk/nodejsFunction/index.mjs",
21
+ "./git": "./lib/git/index.mjs",
22
+ "./github": "./lib/github/index.mjs",
23
+ "./net": "./lib/net/index.mjs",
41
24
  "./package.json": "./package.json"
42
25
  },
43
- "main": "./lib/index.cjs",
44
- "module": "./lib/index.mjs",
45
- "types": "./lib/index.d.cts",
26
+ "types": "./lib/index.d.mts",
46
27
  "files": [
47
28
  "lib",
48
29
  "buildkite",
@@ -62,13 +43,31 @@
62
43
  "isomorphic-git": "^1.37.6",
63
44
  "npm-run-path": "^6.0.0",
64
45
  "npm-which": "^3.0.1",
46
+ "rolldown": "^1.1.0",
47
+ "yaml": "^2.9.0",
65
48
  "zod": "^4.3.5"
66
49
  },
50
+ "devDependencies": {
51
+ "aws-cdk-lib": "^2.253.0",
52
+ "constructs": "^10.0.17"
53
+ },
54
+ "peerDependencies": {
55
+ "aws-cdk-lib": ">=2.130.0",
56
+ "constructs": "^10.0.0"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "aws-cdk-lib": {
60
+ "optional": true
61
+ },
62
+ "constructs": {
63
+ "optional": true
64
+ }
65
+ },
67
66
  "engines": {
68
67
  "node": ">=22.14.0"
69
68
  },
70
69
  "scripts": {
71
- "build": "pnpm skuba build-package && ./scripts/fix-types.sh",
70
+ "build": "pnpm skuba build-package",
72
71
  "skuba": "node ../../lib/skuba",
73
72
  "test": "pnpm skuba test",
74
73
  "test:ci": "pnpm skuba test --coverage"
@@ -1,4 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_buildkite = require("../buildkite-_FU8d_a-.cjs");
3
- exports.annotate = require_buildkite.annotate;
4
- exports.md = require_buildkite.md;
@@ -1,2 +0,0 @@
1
- import { i as annotate, n as md, r as AnnotationStyle } from "../index-CNxgBJm_.cjs";
2
- export { type AnnotationStyle, annotate, md };
@@ -1,62 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_error = require("./error-BnrwrJEG.cjs");
3
- const require_exec = require("./exec-Da3EoDZ1.cjs");
4
- //#region src/buildkite/annotate.ts
5
- const isAnnotationEnabled = async () => Boolean(process.env.BUILDKITE && process.env.BUILDKITE_AGENT_ACCESS_TOKEN && process.env.BUILDKITE_JOB_ID && await require_exec.hasCommand("buildkite-agent"));
6
- const MAX_SIZE = 1024 * 1024;
7
- const TRUNCATION_WARNING = "... [Truncated due to size limit]";
8
- /**
9
- * Asynchronously uploads a Buildkite annotation.
10
- *
11
- * If the following environment variables are not present,
12
- * the function will silently return without attempting to annotate:
13
- *
14
- * - `BUILDKITE`
15
- * - `BUILDKITE_AGENT_ACCESS_TOKEN`
16
- * - `BUILDKITE_JOB_ID`
17
- *
18
- * The `buildkite-agent` binary must also be on your `PATH`.
19
- */
20
- const annotate = async (markdown, opts = {}) => {
21
- if (!await isAnnotationEnabled()) return;
22
- let truncatedMarkdown = markdown;
23
- if (markdown.length > 1048576) {
24
- const remainingSpace = MAX_SIZE - 33;
25
- truncatedMarkdown = markdown.slice(0, remainingSpace) + TRUNCATION_WARNING;
26
- require_error.log.warn(`Annotation truncated, full message is: ${markdown}`);
27
- }
28
- const context = [opts.scopeContextToStep && process.env.BUILDKITE_STEP_ID, opts.context].filter(Boolean).join("|");
29
- const { style } = opts;
30
- await require_exec.exec("buildkite-agent", "annotate", ...context ? ["--context", context] : [], ...style ? ["--style", style] : [], truncatedMarkdown);
31
- };
32
- //#endregion
33
- //#region src/buildkite/md.ts
34
- /**
35
- * @internal
36
- */
37
- const md = { terminal: (code) => `\`\`\`term\n${code.replace(/```/g, "\\`\\`\\`")}\n\`\`\`` };
38
- //#endregion
39
- //#region src/buildkite/index.ts
40
- var buildkite_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
41
- annotate: () => annotate,
42
- md: () => md
43
- });
44
- //#endregion
45
- Object.defineProperty(exports, "annotate", {
46
- enumerable: true,
47
- get: function() {
48
- return annotate;
49
- }
50
- });
51
- Object.defineProperty(exports, "buildkite_exports", {
52
- enumerable: true,
53
- get: function() {
54
- return buildkite_exports;
55
- }
56
- });
57
- Object.defineProperty(exports, "md", {
58
- enumerable: true,
59
- get: function() {
60
- return md;
61
- }
62
- });
package/lib/cdk/index.cjs DELETED
@@ -1,13 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/cdk/index.ts
3
- var cdk_exports = /* @__PURE__ */ require("../rolldown-runtime-DakpK96I.cjs").__exportAll({ normaliseTemplate: () => normaliseTemplate });
4
- const normaliseTemplateJsonString = (json) => json.replace(/"S3Key":"([0-9a-f]+)\.zip"/g, (_, hash) => `"S3Key":"${"x".repeat(hash.length)}.zip"`).replace(/workerCurrentVersion([0-9a-zA-Z]+)"/g, (_, hash) => `workerCurrentVersion${"x".repeat(hash.length)}"`).replaceAll(/"Value":"\d+\.\d+\.\d+-([^"]+)"/g, (_, hash) => `"Value": "x.x.x-${"x".repeat(hash.length)}"`).replaceAll(/"Value":"v\d+\.\d+\.\d+"/g, (_) => "\"Value\": \"vx.x.x\"").replace(/"DD_TAGS":"git.commit.sha:([0-9a-f]+),git.repository_url:([^\"]+)",/g, "").replaceAll(/(layer:Datadog-[^-]+-.+?:)\d+/g, (_, layer) => `${layer}x`);
5
- const normaliseTemplate = (template) => JSON.parse(normaliseTemplateJsonString(JSON.stringify(template)));
6
- //#endregion
7
- Object.defineProperty(exports, "cdk_exports", {
8
- enumerable: true,
9
- get: function() {
10
- return cdk_exports;
11
- }
12
- });
13
- exports.normaliseTemplate = normaliseTemplate;
@@ -1,6 +0,0 @@
1
- declare namespace index_d_exports {
2
- export { normaliseTemplate };
3
- }
4
- declare const normaliseTemplate: (template: object) => unknown;
5
- //#endregion
6
- export { normaliseTemplate, index_d_exports as t };
@@ -1,62 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- require("util");
3
- let zod_v4 = require("zod/v4");
4
- zod_v4 = require_rolldown_runtime.__toESM(zod_v4, 1);
5
- let node_util = require("node:util");
6
- //#region ../../src/utils/logging.ts
7
- const createLogger = ({ debug, prefixes = [], suffixes = [] }) => {
8
- const logWithoutSuffixes = (...message) => console.log(...prefixes, ...message);
9
- const log = (...message) => logWithoutSuffixes(...message, ...suffixes);
10
- return {
11
- settings: {
12
- debug,
13
- prefixes,
14
- suffixes
15
- },
16
- bold: (text) => (0, node_util.styleText)("bold", text),
17
- dim: (text) => (0, node_util.styleText)("dim", text),
18
- formatSubtle: (text) => (0, node_util.styleText)("gray", text),
19
- timing: (start, end) => `${Number((end - start) / BigInt(1e7)) / 100}s`,
20
- debug: (...message) => debug ? log(...message.map((m) => (0, node_util.styleText)("gray", String(m)))) : void 0,
21
- subtle: (...message) => log(...message.map((m) => (0, node_util.styleText)("gray", String(m)))),
22
- err: (...message) => log(...message.map((m) => (0, node_util.styleText)("red", String(m)))),
23
- newline: () => logWithoutSuffixes(),
24
- ok: (...message) => log(...message.map((m) => (0, node_util.styleText)("green", String(m)))),
25
- plain: (...message) => log(...message),
26
- warn: (...message) => log(...message.map((m) => (0, node_util.styleText)("yellow", String(m))))
27
- };
28
- };
29
- const log = createLogger({ debug: false });
30
- const pluralise = (count, subject) => `${count} ${subject}${count === 1 ? "" : "s"}`;
31
- //#endregion
32
- //#region ../../src/utils/validation.ts
33
- const isObject = (value) => typeof value === "object" && value !== null;
34
- const hasProp = (value, prop) => isObject(value) && value.hasOwnProperty(prop);
35
- zod_v4.array(zod_v4.object({
36
- command: zod_v4.object({
37
- command: zod_v4.string(),
38
- name: zod_v4.string()
39
- }),
40
- index: zod_v4.number(),
41
- exitCode: zod_v4.number()
42
- }));
43
- const isErrorWithCode = (err, code) => hasProp(err, "code") && err.code === code;
44
- //#endregion
45
- Object.defineProperty(exports, "isErrorWithCode", {
46
- enumerable: true,
47
- get: function() {
48
- return isErrorWithCode;
49
- }
50
- });
51
- Object.defineProperty(exports, "log", {
52
- enumerable: true,
53
- get: function() {
54
- return log;
55
- }
56
- });
57
- Object.defineProperty(exports, "pluralise", {
58
- enumerable: true,
59
- get: function() {
60
- return pluralise;
61
- }
62
- });
@@ -1,82 +0,0 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_error = require("./error-BnrwrJEG.cjs");
3
- let stream = require("stream");
4
- stream = require_rolldown_runtime.__toESM(stream, 1);
5
- let util = require("util");
6
- util = require_rolldown_runtime.__toESM(util, 1);
7
- require("concurrently");
8
- let execa = require("execa");
9
- let npm_run_path = require("npm-run-path");
10
- let npm_which = require("npm-which");
11
- npm_which = require_rolldown_runtime.__toESM(npm_which, 1);
12
- //#region ../../src/utils/exec.ts
13
- var YarnSpamFilter = class extends stream.default.Transform {
14
- silenced = false;
15
- _transform(chunk, _encoding, callback) {
16
- const str = Buffer.from(chunk).toString();
17
- if (str.startsWith("info Direct dependencies")) this.silenced = true;
18
- if (!this.silenced && !str.startsWith("info No lockfile found")) this.push(chunk);
19
- callback();
20
- }
21
- };
22
- var YarnWarningFilter = class extends stream.default.Transform {
23
- _transform(chunk, _encoding, callback) {
24
- if (!Buffer.from(chunk).toString().startsWith("warning skuba >")) this.push(chunk);
25
- callback();
26
- }
27
- };
28
- (0, npm_run_path.npmRunPath)({ cwd: __dirname });
29
- const runCommand = (command, args, { streamStdio, ...execaOptions } = {}) => {
30
- const subprocess = (0, execa.execa)(command, args, {
31
- localDir: execaOptions?.localDir ?? __dirname,
32
- preferLocal: true,
33
- stdio: "inherit",
34
- ...execaOptions
35
- });
36
- switch (streamStdio) {
37
- case "yarn":
38
- const stderrFilter = new YarnWarningFilter();
39
- const stdoutFilter = new YarnSpamFilter();
40
- subprocess.stderr?.pipe(stderrFilter).pipe(process.stderr);
41
- subprocess.stdout?.pipe(stdoutFilter).pipe(process.stdout);
42
- break;
43
- case "pnpm":
44
- case true:
45
- subprocess.stderr?.pipe(process.stderr);
46
- subprocess.stdout?.pipe(process.stdout);
47
- break;
48
- }
49
- return subprocess;
50
- };
51
- const whichCallback = (0, npm_which.default)(__dirname);
52
- const which = util.default.promisify(whichCallback);
53
- const createExec = (opts) => (command, ...args) => runCommand(command, args, opts);
54
- const exec = (command, ...args) => runCommand(command, args);
55
- const hasCommand = async (name) => {
56
- try {
57
- await which(name);
58
- return true;
59
- } catch (err) {
60
- if (require_error.isErrorWithCode(err, "ENOENT")) return false;
61
- throw err;
62
- }
63
- };
64
- //#endregion
65
- Object.defineProperty(exports, "createExec", {
66
- enumerable: true,
67
- get: function() {
68
- return createExec;
69
- }
70
- });
71
- Object.defineProperty(exports, "exec", {
72
- enumerable: true,
73
- get: function() {
74
- return exec;
75
- }
76
- });
77
- Object.defineProperty(exports, "hasCommand", {
78
- enumerable: true,
79
- get: function() {
80
- return hasCommand;
81
- }
82
- });
package/lib/git/index.cjs DELETED
@@ -1,14 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_git = require("../git-D98vomnD.cjs");
3
- exports.commit = require_git.commit;
4
- exports.commitAllChanges = require_git.commitAllChanges;
5
- exports.currentBranch = require_git.currentBranch;
6
- exports.fastForwardBranch = require_git.fastForwardBranch;
7
- exports.findRoot = require_git.findRoot;
8
- exports.getChangedFiles = require_git.getChangedFiles;
9
- exports.getHeadCommitId = require_git.getHeadCommitId;
10
- exports.getHeadCommitMessage = require_git.getHeadCommitMessage;
11
- exports.getOwnerAndRepo = require_git.getOwnerAndRepo;
12
- exports.isFileGitIgnored = require_git.isFileGitIgnored;
13
- exports.push = require_git.push;
14
- exports.reset = require_git.reset;
@@ -1,2 +0,0 @@
1
- import { a as push, c as getHeadCommitMessage, d as commitAllChanges, f as ChangedFile, i as fastForwardBranch, l as findRoot, m as commit, n as isFileGitIgnored, o as getOwnerAndRepo, p as getChangedFiles, r as reset, s as getHeadCommitId, u as currentBranch } from "../index-C9WMO_Y9.cjs";
2
- export { type ChangedFile, commit, commitAllChanges, currentBranch, fastForwardBranch, findRoot, getChangedFiles, getHeadCommitId, getHeadCommitMessage, getOwnerAndRepo, isFileGitIgnored, push, reset };