skuba 13.0.0-custom-conditions-exports-20250923055337 → 13.0.0-custom-conditions-exports-20251003064544

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 (169) hide show
  1. package/lib/cli/build/assets.js +3 -7
  2. package/lib/cli/build/assets.js.map +2 -2
  3. package/lib/cli/build/esbuild.d.ts +2 -1
  4. package/lib/cli/build/esbuild.js +4 -3
  5. package/lib/cli/build/esbuild.js.map +2 -2
  6. package/lib/cli/build/index.js +8 -4
  7. package/lib/cli/build/index.js.map +2 -2
  8. package/lib/cli/init/git.js +1 -1
  9. package/lib/cli/init/git.js.map +2 -2
  10. package/lib/cli/init/index.js +4 -4
  11. package/lib/cli/init/index.js.map +3 -3
  12. package/lib/cli/lint/annotate/buildkite/eslint.js +1 -1
  13. package/lib/cli/lint/annotate/buildkite/eslint.js.map +2 -2
  14. package/lib/cli/lint/annotate/buildkite/index.js +1 -1
  15. package/lib/cli/lint/annotate/buildkite/index.js.map +2 -2
  16. package/lib/cli/lint/annotate/buildkite/internal.js +1 -1
  17. package/lib/cli/lint/annotate/buildkite/internal.js.map +2 -2
  18. package/lib/cli/lint/annotate/buildkite/prettier.js +1 -1
  19. package/lib/cli/lint/annotate/buildkite/prettier.js.map +2 -2
  20. package/lib/cli/lint/annotate/buildkite/tsc.js +1 -1
  21. package/lib/cli/lint/annotate/buildkite/tsc.js.map +2 -2
  22. package/lib/cli/lint/annotate/github/eslint.d.ts +1 -1
  23. package/lib/cli/lint/annotate/github/eslint.js.map +2 -2
  24. package/lib/cli/lint/annotate/github/index.js +3 -4
  25. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  26. package/lib/cli/lint/annotate/github/internal.d.ts +1 -1
  27. package/lib/cli/lint/annotate/github/internal.js.map +2 -2
  28. package/lib/cli/lint/annotate/github/prettier.d.ts +1 -1
  29. package/lib/cli/lint/annotate/github/prettier.js.map +2 -2
  30. package/lib/cli/lint/annotate/github/tsc.d.ts +1 -1
  31. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  32. package/lib/cli/lint/autofix.d.ts +1 -1
  33. package/lib/cli/lint/autofix.js +3 -3
  34. package/lib/cli/lint/autofix.js.map +2 -2
  35. package/lib/cli/lint/internalLints/patchRenovateConfig.js +1 -1
  36. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  37. package/lib/{api/buildkite → cli/lint/internalLints/upgrade/patches/12.3.0}/index.js +17 -9
  38. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +7 -0
  39. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +3 -0
  40. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +100 -0
  41. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +7 -0
  42. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +3 -0
  43. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +99 -0
  44. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +7 -0
  45. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +2 -0
  46. package/lib/{api/net → cli/lint/internalLints/upgrade/patches/12.4.0}/index.js +12 -6
  47. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +7 -0
  48. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +3 -0
  49. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +101 -0
  50. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +7 -0
  51. package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.js.map +1 -1
  52. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/index.d.ts +2 -0
  53. package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js.map +1 -1
  54. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.d.ts +13 -0
  55. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js +225 -0
  56. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js.map +7 -0
  57. package/lib/cli/test/reporters/github/annotations.d.ts +1 -1
  58. package/lib/cli/test/reporters/github/annotations.js.map +1 -1
  59. package/lib/cli/test/reporters/github/index.js +3 -4
  60. package/lib/cli/test/reporters/github/index.js.map +2 -2
  61. package/lib/index.d.ts +4 -4
  62. package/lib/index.js +4 -4
  63. package/lib/index.js.map +2 -2
  64. package/lib/utils/dir.js +2 -2
  65. package/lib/utils/dir.js.map +3 -3
  66. package/lib/utils/manifest.d.ts +5 -1
  67. package/lib/utils/manifest.js +16 -7
  68. package/lib/utils/manifest.js.map +2 -2
  69. package/package.json +4 -3
  70. package/template/base/_pnpm-workspace.yaml +1 -0
  71. package/template/express-rest-api/Dockerfile +1 -1
  72. package/template/express-rest-api/Dockerfile.dev-deps +0 -2
  73. package/template/express-rest-api/package.json +1 -1
  74. package/template/greeter/Dockerfile +0 -2
  75. package/template/greeter/package.json +2 -2
  76. package/template/koa-rest-api/Dockerfile +1 -1
  77. package/template/koa-rest-api/Dockerfile.dev-deps +0 -2
  78. package/template/koa-rest-api/package.json +1 -1
  79. package/template/lambda-sqs-worker-cdk/Dockerfile +0 -2
  80. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  81. package/template/lambda-sqs-worker-cdk/package.json +2 -2
  82. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  83. package/template/oss-npm-package/README.md +1 -1
  84. package/lib/api/buildkite/annotate.d.ts +0 -28
  85. package/lib/api/buildkite/annotate.js +0 -62
  86. package/lib/api/buildkite/annotate.js.map +0 -7
  87. package/lib/api/buildkite/index.d.ts +0 -3
  88. package/lib/api/buildkite/index.js.map +0 -7
  89. package/lib/api/buildkite/md.d.ts +0 -6
  90. package/lib/api/buildkite/md.js +0 -33
  91. package/lib/api/buildkite/md.js.map +0 -7
  92. package/lib/api/git/commit.d.ts +0 -15
  93. package/lib/api/git/commit.js +0 -52
  94. package/lib/api/git/commit.js.map +0 -7
  95. package/lib/api/git/commitAllChanges.d.ts +0 -19
  96. package/lib/api/git/commitAllChanges.js +0 -83
  97. package/lib/api/git/commitAllChanges.js.map +0 -7
  98. package/lib/api/git/currentBranch.d.ts +0 -10
  99. package/lib/api/git/currentBranch.js +0 -59
  100. package/lib/api/git/currentBranch.js.map +0 -7
  101. package/lib/api/git/findRoot.d.ts +0 -9
  102. package/lib/api/git/findRoot.js +0 -52
  103. package/lib/api/git/findRoot.js.map +0 -7
  104. package/lib/api/git/getChangedFiles.d.ts +0 -20
  105. package/lib/api/git/getChangedFiles.js +0 -81
  106. package/lib/api/git/getChangedFiles.js.map +0 -7
  107. package/lib/api/git/index.d.ts +0 -12
  108. package/lib/api/git/index.js +0 -61
  109. package/lib/api/git/index.js.map +0 -7
  110. package/lib/api/git/isFileGitIgnored.d.ts +0 -4
  111. package/lib/api/git/isFileGitIgnored.js +0 -49
  112. package/lib/api/git/isFileGitIgnored.js.map +0 -7
  113. package/lib/api/git/log.d.ts +0 -19
  114. package/lib/api/git/log.js +0 -71
  115. package/lib/api/git/log.js.map +0 -7
  116. package/lib/api/git/pull.d.ts +0 -35
  117. package/lib/api/git/pull.js +0 -69
  118. package/lib/api/git/pull.js.map +0 -7
  119. package/lib/api/git/push.d.ts +0 -52
  120. package/lib/api/git/push.js +0 -70
  121. package/lib/api/git/push.js.map +0 -7
  122. package/lib/api/git/remote.d.ts +0 -20
  123. package/lib/api/git/remote.js +0 -73
  124. package/lib/api/git/remote.js.map +0 -7
  125. package/lib/api/git/reset.d.ts +0 -12
  126. package/lib/api/git/reset.js +0 -62
  127. package/lib/api/git/reset.js.map +0 -7
  128. package/lib/api/git/statusMatrix.d.ts +0 -7
  129. package/lib/api/git/statusMatrix.js +0 -47
  130. package/lib/api/git/statusMatrix.js.map +0 -7
  131. package/lib/api/github/checkRun.d.ts +0 -44
  132. package/lib/api/github/checkRun.js +0 -81
  133. package/lib/api/github/checkRun.js.map +0 -7
  134. package/lib/api/github/environment.d.ts +0 -17
  135. package/lib/api/github/environment.js +0 -48
  136. package/lib/api/github/environment.js.map +0 -7
  137. package/lib/api/github/index.d.ts +0 -7
  138. package/lib/api/github/index.js +0 -48
  139. package/lib/api/github/index.js.map +0 -7
  140. package/lib/api/github/issueComment.d.ts +0 -61
  141. package/lib/api/github/issueComment.js +0 -99
  142. package/lib/api/github/issueComment.js.map +0 -7
  143. package/lib/api/github/octokit.d.ts +0 -6
  144. package/lib/api/github/octokit.js +0 -42
  145. package/lib/api/github/octokit.js.map +0 -7
  146. package/lib/api/github/pullRequest.d.ts +0 -21
  147. package/lib/api/github/pullRequest.js +0 -69
  148. package/lib/api/github/pullRequest.js.map +0 -7
  149. package/lib/api/github/push.d.ts +0 -85
  150. package/lib/api/github/push.js +0 -166
  151. package/lib/api/github/push.js.map +0 -7
  152. package/lib/api/net/compose.d.ts +0 -4
  153. package/lib/api/net/compose.js +0 -51
  154. package/lib/api/net/compose.js.map +0 -7
  155. package/lib/api/net/index.d.ts +0 -1
  156. package/lib/api/net/index.js.map +0 -7
  157. package/lib/api/net/socket.d.ts +0 -5
  158. package/lib/api/net/socket.js +0 -68
  159. package/lib/api/net/socket.js.map +0 -7
  160. package/lib/api/net/waitFor.d.ts +0 -22
  161. package/lib/api/net/waitFor.js +0 -40
  162. package/lib/api/net/waitFor.js.map +0 -7
  163. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.d.ts +0 -6
  164. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js +0 -110
  165. package/lib/cli/lint/internalLints/upgrade/patches/12.2.0/rewriteSrcImports.js.map +0 -7
  166. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 12.3.0}/index.d.ts +0 -0
  167. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.d.ts +0 -0
  168. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/configureTsConfigForESM.js +0 -0
  169. /package/lib/cli/lint/internalLints/upgrade/patches/{12.2.0 → 13.0.0}/index.js +0 -0
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var issueComment_exports = {};
30
- __export(issueComment_exports, {
31
- putIssueComment: () => putIssueComment
32
- });
33
- module.exports = __toCommonJS(issueComment_exports);
34
- var Git = __toESM(require("../git/index.js"));
35
- var import_environment = require("./environment.js");
36
- var import_octokit = require("./octokit.js");
37
- var import_pullRequest = require("./pullRequest.js");
38
- const getUserId = async (client) => {
39
- const { data } = await client.users.getAuthenticated();
40
- return data.id;
41
- };
42
- const putIssueComment = async (params) => {
43
- if (params.body === null && !params.internalId) {
44
- throw new Error("Cannot remove comment without an internalId");
45
- }
46
- const env = params.env ?? process.env;
47
- const dir = process.cwd();
48
- const { owner, repo } = await Git.getOwnerAndRepo({ dir });
49
- const client = await (0, import_octokit.createRestClient)({ auth: (0, import_environment.apiTokenFromEnvironment)() });
50
- const issueNumber = params.issueNumber ?? await (0, import_pullRequest.getPullRequestNumber)({ client, env });
51
- if (!issueNumber) {
52
- throw new Error("Failed to infer an issue number");
53
- }
54
- const comments = await client.issues.listComments({
55
- issue_number: issueNumber,
56
- owner,
57
- repo
58
- });
59
- const userId = params.userId === "seek-build-agency" ? (
60
- // https://api.github.com/users/buildagencygitapitoken[bot]
61
- 87109344
62
- ) : params.userId ?? await getUserId(client);
63
- const commentId = comments.data.find(
64
- (comment) => comment.user?.id === userId && (params.internalId ? comment.body?.endsWith(`
65
-
66
- <!-- ${params.internalId} -->`) : true)
67
- )?.id;
68
- if (params.body === null) {
69
- if (commentId) {
70
- await client.issues.deleteComment({
71
- comment_id: commentId,
72
- owner,
73
- repo
74
- });
75
- }
76
- return null;
77
- }
78
- const body = params.internalId ? [params.body.trim(), `<!-- ${params.internalId} -->`].join("\n\n") : params.body.trim();
79
- const response = await (commentId ? client.issues.updateComment({
80
- body,
81
- comment_id: commentId,
82
- issue_number: issueNumber,
83
- owner,
84
- repo
85
- }) : client.issues.createComment({
86
- body,
87
- issue_number: issueNumber,
88
- owner,
89
- repo
90
- }));
91
- return {
92
- id: response.data.id
93
- };
94
- };
95
- // Annotate the CommonJS export names for ESM import in node:
96
- 0 && (module.exports = {
97
- putIssueComment
98
- });
99
- //# sourceMappingURL=issueComment.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/issueComment.ts"],
4
- "sourcesContent": ["import type { Octokit } from '@octokit/rest';\n\nimport * as Git from '../git/index.js';\n\nimport { apiTokenFromEnvironment } from './environment.js';\nimport { createRestClient } from './octokit.js';\nimport { getPullRequestNumber } from './pullRequest.js';\n\nconst getUserId = async (client: Octokit): Promise<number> => {\n const { data } = await client.users.getAuthenticated();\n\n return data.id;\n};\n\n/**\n * https://docs.github.com/en/rest/reference/issues#create-an-issue-comment\n */\ninterface PutIssueCommentParameters {\n /**\n * The body of the issue comment.\n *\n * An explicit `null` value will remove the comment, if `internalId` is provided.\n */\n body: string | null;\n\n /**\n * An internal identifier for the issue comment.\n *\n * This can be used to scope a given `put` to a particular comment, preventing\n * it from clobbering other comments from the same bot or user.\n *\n * The identifier is embedded as hidden content in the comment body.\n */\n internalId?: string;\n\n env?: Record<string, string | undefined>;\n\n /**\n * The number that identifies the GitHub issue.\n *\n * If this is not provided, the number will be inferred from the GitHub Repos\n * API by finding the latest pull request associated with the head commit.\n *\n * https://docs.github.com/en/rest/reference/repos#list-pull-requests-associated-with-a-commit\n */\n issueNumber?: number;\n\n /**\n * The ID of authenticated bot or user that is putting the issue comment.\n *\n * This drives our `put` behaviour, which tries to locate and edit an existing\n * comment before creating a new one. If this is not provided, the ID will be\n * inferred from the GitHub Users API.\n *\n * https://docs.github.com/en/rest/reference/users#get-the-authenticated-user\n *\n * If you're at SEEK and using BuildAgency's GitHub API integration, you may\n * use `'seek-build-agency'` as an optimisation to skip the user lookup.\n *\n * https://api.github.com/users/buildagencygitapitoken[bot]\n */\n userId?: number | 'seek-build-agency';\n}\n\ninterface IssueComment {\n id: number;\n}\n\n/**\n * Asynchronously creates or updates a GitHub issue comment.\n *\n * This emulates `put` behaviour by overwriting the first existing comment by\n * the same author on the issue, enabling use cases like a persistent bot\n * comment at the top of the pull request that reflects the current status of a\n * CI check.\n *\n * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be present\n * on the environment.\n */\nexport const putIssueComment = async (\n params: PutIssueCommentParameters,\n): Promise<IssueComment | null> => {\n if (params.body === null && !params.internalId) {\n // It's dangerous to just delete the first comment, as it may not be\n // from the current flow.\n throw new Error('Cannot remove comment without an internalId');\n }\n\n const env = params.env ?? process.env;\n\n const dir = process.cwd();\n\n const { owner, repo } = await Git.getOwnerAndRepo({ dir });\n\n const client = await createRestClient({ auth: apiTokenFromEnvironment() });\n\n const issueNumber =\n params.issueNumber ?? (await getPullRequestNumber({ client, env }));\n\n if (!issueNumber) {\n throw new Error('Failed to infer an issue number');\n }\n\n const comments = await client.issues.listComments({\n issue_number: issueNumber,\n owner,\n repo,\n });\n\n const userId: number =\n params.userId === 'seek-build-agency'\n ? // https://api.github.com/users/buildagencygitapitoken[bot]\n 87109344\n : (params.userId ?? (await getUserId(client)));\n\n const commentId = comments.data.find(\n (comment) =>\n comment.user?.id === userId &&\n (params.internalId\n ? comment.body?.endsWith(`\\n\\n<!-- ${params.internalId} -->`)\n : true),\n )?.id;\n\n if (params.body === null) {\n if (commentId) {\n await client.issues.deleteComment({\n comment_id: commentId,\n owner,\n repo,\n });\n }\n\n return null;\n }\n\n const body = params.internalId\n ? [params.body.trim(), `<!-- ${params.internalId} -->`].join('\\n\\n')\n : params.body.trim();\n\n const response = await (commentId\n ? client.issues.updateComment({\n body,\n comment_id: commentId,\n issue_number: issueNumber,\n owner,\n repo,\n })\n : client.issues.createComment({\n body,\n issue_number: issueNumber,\n owner,\n repo,\n }));\n\n return {\n id: response.data.id,\n };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,UAAqB;AAErB,yBAAwC;AACxC,qBAAiC;AACjC,yBAAqC;AAErC,MAAM,YAAY,OAAO,WAAqC;AAC5D,QAAM,EAAE,KAAK,IAAI,MAAM,OAAO,MAAM,iBAAiB;AAErD,SAAO,KAAK;AACd;AAmEO,MAAM,kBAAkB,OAC7B,WACiC;AACjC,MAAI,OAAO,SAAS,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Ac;AAAA,IAC1B;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EACF,CAAC;AAEL,SAAO;AAAA,IACL,IAAI,SAAS,KAAK;AAAA,EACpB;AACF;",
6
- "names": []
7
- }
@@ -1,6 +0,0 @@
1
- import type { Octokit } from '@octokit/rest';
2
- import type { RequestParameters } from '@octokit/types';
3
- export declare const createRestClient: (options: {
4
- auth: unknown;
5
- }) => Promise<Octokit>;
6
- export declare const graphql: <ResponseData>(query: string, parameters?: RequestParameters) => Promise<ResponseData>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var octokit_exports = {};
30
- __export(octokit_exports, {
31
- createRestClient: () => createRestClient,
32
- graphql: () => graphql
33
- });
34
- module.exports = __toCommonJS(octokit_exports);
35
- const createRestClient = async (options) => new (await import("@octokit/rest")).Octokit(options);
36
- const graphql = async (query, parameters) => (await import("@octokit/graphql")).graphql(query, parameters);
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- createRestClient,
40
- graphql
41
- });
42
- //# sourceMappingURL=octokit.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/octokit.ts"],
4
- "sourcesContent": ["import type { Octokit } from '@octokit/rest';\nimport type { RequestParameters } from '@octokit/types';\n\nexport const createRestClient = async (options: {\n auth: unknown;\n}): Promise<Octokit> => new (await import('@octokit/rest')).Octokit(options);\n\nexport const graphql = async <ResponseData>(\n query: string,\n parameters?: RequestParameters,\n) =>\n (await import('@octokit/graphql')).graphql<ResponseData>(query, parameters);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,mBAAmB,OAAO,YAEf,KAAK,MAAM,OAAO,eAAe,GAAG,QAAQ,OAAO;AAEpE,MAAM,UAAU,OACrB,OACA,gBAEC,MAAM,OAAO,kBAAkB,GAAG,QAAsB,OAAO,UAAU;",
6
- "names": []
7
- }
@@ -1,21 +0,0 @@
1
- import type { Octokit } from '@octokit/rest' with { 'resolution-mode': 'import' };
2
- interface GetPullRequestParameters {
3
- /**
4
- * A preconstructed Octokit client to interact with GitHub's APIs.
5
- *
6
- * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be
7
- * present on the environment if this is not provided.
8
- */
9
- client?: Octokit;
10
- env?: Record<string, string | undefined>;
11
- }
12
- /**
13
- * Gets the number of the current pull request.
14
- *
15
- * This tries to extract the pull request from common CI environment variables,
16
- * and falls back to querying the GitHub Repos API for the latest pull request
17
- * associated with the head commit. An error is thrown if there are no
18
- * associated pull requests, or if they are all closed or locked.
19
- */
20
- export declare const getPullRequestNumber: (params?: GetPullRequestParameters) => Promise<number>;
21
- export {};
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var pullRequest_exports = {};
30
- __export(pullRequest_exports, {
31
- getPullRequestNumber: () => getPullRequestNumber
32
- });
33
- module.exports = __toCommonJS(pullRequest_exports);
34
- var Git = __toESM(require("../git/index.js"));
35
- var import_environment = require("./environment.js");
36
- var import_octokit = require("./octokit.js");
37
- const getPullRequestNumber = async (params = {}) => {
38
- const env = params.env ?? process.env;
39
- const dir = process.cwd();
40
- const number = Number(
41
- env.BUILDKITE_PULL_REQUEST ?? env.GITHUB_REF?.replace(/^refs\/pull\/(\d+).*$/, "$1")
42
- );
43
- if (Number.isSafeInteger(number)) {
44
- return number;
45
- }
46
- const client = params.client ?? await (0, import_octokit.createRestClient)({ auth: (0, import_environment.apiTokenFromEnvironment)() });
47
- const [commitId, { owner, repo }] = await Promise.all([
48
- Git.getHeadCommitId({ dir, env }),
49
- Git.getOwnerAndRepo({ dir })
50
- ]);
51
- const response = await client.repos.listPullRequestsAssociatedWithCommit({
52
- commit_sha: commitId,
53
- owner,
54
- repo
55
- });
56
- const data = response.data.filter((pr) => pr.state === "open" && !pr.locked).sort((a, b) => b.updated_at.localeCompare(a.updated_at));
57
- const pullRequestData = data[0];
58
- if (!pullRequestData) {
59
- throw new Error(
60
- `Commit ${commitId} is not associated with an open GitHub pull request`
61
- );
62
- }
63
- return pullRequestData.number;
64
- };
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- getPullRequestNumber
68
- });
69
- //# sourceMappingURL=pullRequest.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/pullRequest.ts"],
4
- "sourcesContent": ["import type { Octokit } from '@octokit/rest' with { 'resolution-mode': 'import' };\n\nimport * as Git from '../git/index.js';\n\nimport { apiTokenFromEnvironment } from './environment.js';\nimport { createRestClient } from './octokit.js';\n\ninterface GetPullRequestParameters {\n /**\n * A preconstructed Octokit client to interact with GitHub's APIs.\n *\n * A `GITHUB_API_TOKEN` or `GITHUB_TOKEN` with write permissions must be\n * present on the environment if this is not provided.\n */\n client?: Octokit;\n\n env?: Record<string, string | undefined>;\n}\n\n/**\n * Gets the number of the current pull request.\n *\n * This tries to extract the pull request from common CI environment variables,\n * and falls back to querying the GitHub Repos API for the latest pull request\n * associated with the head commit. An error is thrown if there are no\n * associated pull requests, or if they are all closed or locked.\n */\nexport const getPullRequestNumber = async (\n params: GetPullRequestParameters = {},\n): Promise<number> => {\n const env = params.env ?? process.env;\n\n const dir = process.cwd();\n\n const number = Number(\n env.BUILDKITE_PULL_REQUEST ??\n env.GITHUB_REF?.replace(/^refs\\/pull\\/(\\d+).*$/, '$1'),\n );\n\n if (Number.isSafeInteger(number)) {\n return number;\n }\n\n const client =\n params.client ??\n (await createRestClient({ auth: apiTokenFromEnvironment() }));\n\n const [commitId, { owner, repo }] = await Promise.all([\n Git.getHeadCommitId({ dir, env }),\n Git.getOwnerAndRepo({ dir }),\n ]);\n\n const response = await client.repos.listPullRequestsAssociatedWithCommit({\n commit_sha: commitId,\n owner,\n repo,\n });\n\n const data = response.data\n .filter((pr) => pr.state === 'open' && !pr.locked)\n .sort((a, b) => b.updated_at.localeCompare(a.updated_at));\n\n const pullRequestData = data[0];\n if (!pullRequestData) {\n throw new Error(\n `Commit ${commitId} is not associated with an open GitHub pull request`,\n );\n }\n\n return pullRequestData.number;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,UAAqB;AAErB,yBAAwC;AACxC,qBAAiC;AAsB1B,MAAM,uBAAuB,OAClC,SAAmC,CAAC,MAChB;AACpB,QAAM,MAAM,OAAO,OAAO,QAAQ;AAElC,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,SAAS;AAAA,IACb,IAAI,0BACF,IAAI,YAAY,QAAQ,yBAAyB,IAAI;AAAA,EACzD;AAEA,MAAI,OAAO,cAAc,MAAM,GAAG;AAChC,WAAO;AAAA,EACT;AAEA,QAAM,SACJ,OAAO,UACN,UAAM,iCAAiB,EAAE,UAAM,4CAAwB,EAAE,CAAC;AAE7D,QAAM,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,IACpD,IAAI,gBAAgB,EAAE,KAAK,IAAI,CAAC;AAAA,IAChC,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,EAC7B,CAAC;AAED,QAAM,WAAW,MAAM,OAAO,MAAM,qCAAqC;AAAA,IACvE,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,OAAO,SAAS,KACnB,OAAO,CAAC,OAAO,GAAG,UAAU,UAAU,CAAC,GAAG,MAAM,EAChD,KAAK,CAAC,GAAG,MAAM,EAAE,WAAW,cAAc,EAAE,UAAU,CAAC;AAE1D,QAAM,kBAAkB,KAAK,CAAC;AAC9B,MAAI,CAAC,iBAAiB;AACpB,UAAM,IAAI;AAAA,MACR,UAAU,QAAQ;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,gBAAgB;AACzB;",
6
- "names": []
7
- }
@@ -1,85 +0,0 @@
1
- import * as Git from '../git/index.js';
2
- interface UploadAllFileChangesParams {
3
- dir: string;
4
- /**
5
- * The branch name
6
- */
7
- branch: string;
8
- /**
9
- * The headline of the commit message
10
- */
11
- messageHeadline: string;
12
- /**
13
- * File changes to exclude from the upload.
14
- *
15
- * Defaults to `[]` (no exclusions).
16
- */
17
- ignore?: Git.ChangedFile[];
18
- /**
19
- * The body of the commit message
20
- */
21
- messageBody?: string;
22
- /**
23
- * Updates the local Git repository to match the new remote branch state
24
- */
25
- updateLocal?: boolean;
26
- }
27
- /**
28
- * Retrieves all file changes from the local Git repository using
29
- * `getChangedFiles`, then uploads the changes to a specified GitHub branch
30
- * using `uploadFileChanges`.
31
- *
32
- * Returns the commit ID, or `undefined` if there are no changes to commit.
33
- *
34
- * The file changes will appear as verified commits on GitHub.
35
- *
36
- * This will not update the local Git repository unless `updateLocal` is
37
- * specified.
38
- */
39
- export declare const uploadAllFileChanges: ({ branch, dir, messageHeadline, ignore, messageBody, updateLocal, }: UploadAllFileChangesParams) => Promise<string | undefined>;
40
- interface FileAddition {
41
- contents: unknown;
42
- path: string;
43
- }
44
- interface FileDeletion {
45
- path: string;
46
- }
47
- export interface FileChanges {
48
- additions: FileAddition[];
49
- deletions: FileDeletion[];
50
- }
51
- /**
52
- * Takes a list of `ChangedFiles`, reads them from the file system, and maps
53
- * them to GitHub GraphQL `FileChanges`.
54
- *
55
- * https://docs.github.com/en/graphql/reference/input-objects#filechanges
56
- */
57
- export declare const readFileChanges: (dir: string, changedFiles: Git.ChangedFile[]) => Promise<FileChanges>;
58
- interface UploadFileChangesParams {
59
- dir: string;
60
- /**
61
- * The branch name
62
- */
63
- branch: string;
64
- /**
65
- * The headline of the commit message
66
- */
67
- messageHeadline: string;
68
- /**
69
- * The body of the commit message
70
- */
71
- messageBody?: string;
72
- /**
73
- * File additions and deletions
74
- */
75
- fileChanges: FileChanges;
76
- }
77
- /**
78
- * Uploads file changes from the local workspace to a specified GitHub branch.
79
- *
80
- * The file changes will appear as verified commits on GitHub.
81
- *
82
- * This will not update the local Git repository.
83
- */
84
- export declare const uploadFileChanges: ({ dir, branch, messageHeadline, messageBody, fileChanges, }: UploadFileChangesParams) => Promise<string>;
85
- export {};
@@ -1,166 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var push_exports = {};
30
- __export(push_exports, {
31
- readFileChanges: () => readFileChanges,
32
- uploadAllFileChanges: () => uploadAllFileChanges,
33
- uploadFileChanges: () => uploadFileChanges
34
- });
35
- module.exports = __toCommonJS(push_exports);
36
- var import_path = __toESM(require("path"));
37
- var import_fs_extra = __toESM(require("fs-extra"));
38
- var Git = __toESM(require("../git/index.js"));
39
- var import_environment = require("./environment.js");
40
- var import_octokit = require("./octokit.js");
41
- const uploadAllFileChanges = async ({
42
- branch,
43
- dir,
44
- messageHeadline,
45
- ignore,
46
- messageBody,
47
- updateLocal = false
48
- }) => {
49
- const changedFiles = await Git.getChangedFiles({ dir, ignore });
50
- if (!changedFiles.length) {
51
- return;
52
- }
53
- const fileChanges = await readFileChanges(dir, changedFiles);
54
- const commitId = await uploadFileChanges({
55
- dir,
56
- branch,
57
- messageHeadline,
58
- messageBody,
59
- fileChanges
60
- });
61
- if (updateLocal) {
62
- await Promise.all(
63
- [...fileChanges.additions, ...fileChanges.deletions].map(
64
- (file) => import_fs_extra.default.rm(file.path)
65
- )
66
- );
67
- await Git.fastForwardBranch({
68
- ref: branch,
69
- auth: { type: "gitHubApp" },
70
- dir
71
- });
72
- }
73
- return commitId;
74
- };
75
- const readFileChanges = async (dir, changedFiles) => {
76
- const { added, deleted } = changedFiles.reduce(
77
- (files, changedFile) => {
78
- const filePath = changedFile.path;
79
- if (changedFile.state === "deleted") {
80
- files.deleted.push(filePath);
81
- } else {
82
- files.added.push(filePath);
83
- }
84
- return files;
85
- },
86
- { added: [], deleted: [] }
87
- );
88
- const gitRoot = await Git.findRoot({ dir });
89
- const toRootPath = (filePath) => {
90
- if (!gitRoot) {
91
- return filePath;
92
- }
93
- return import_path.default.resolve(gitRoot, filePath);
94
- };
95
- const additions = await Promise.all(
96
- added.map(async (filePath) => ({
97
- path: filePath,
98
- contents: await import_fs_extra.default.promises.readFile(toRootPath(filePath), {
99
- encoding: "base64"
100
- })
101
- }))
102
- );
103
- const deletions = deleted.map((filePath) => ({
104
- path: filePath
105
- }));
106
- return {
107
- additions,
108
- deletions
109
- };
110
- };
111
- const uploadFileChanges = async ({
112
- dir,
113
- branch,
114
- messageHeadline,
115
- messageBody,
116
- fileChanges
117
- }) => {
118
- const authToken = (0, import_environment.apiTokenFromEnvironment)();
119
- if (!authToken) {
120
- throw new Error(
121
- "Could not read a GitHub API token from the environment. Please set GITHUB_API_TOKEN or GITHUB_TOKEN."
122
- );
123
- }
124
- const [{ owner, repo }, headCommitId] = await Promise.all([
125
- Git.getOwnerAndRepo({ dir }),
126
- Git.getHeadCommitId({ dir })
127
- ]);
128
- const input = {
129
- branch: {
130
- repositoryNameWithOwner: `${owner}/${repo}`,
131
- branchName: branch
132
- },
133
- message: {
134
- headline: messageHeadline,
135
- body: messageBody
136
- },
137
- expectedHeadOid: headCommitId,
138
- clientMutationId: "skuba",
139
- fileChanges
140
- };
141
- const result = await (0, import_octokit.graphql)(
142
- `
143
- mutation Mutation($input: CreateCommitOnBranchInput!) {
144
- createCommitOnBranch(input: $input) {
145
- commit {
146
- oid
147
- }
148
- }
149
- }
150
- `,
151
- {
152
- input,
153
- headers: {
154
- authorization: `Bearer ${authToken}`
155
- }
156
- }
157
- );
158
- return result.createCommitOnBranch.commit.oid;
159
- };
160
- // Annotate the CommonJS export names for ESM import in node:
161
- 0 && (module.exports = {
162
- readFileChanges,
163
- uploadAllFileChanges,
164
- uploadFileChanges
165
- });
166
- //# sourceMappingURL=push.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/github/push.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport type { CreateCommitOnBranchInput } from '@octokit/graphql-schema';\nimport fs from 'fs-extra';\n\nimport * as Git from '../git/index.js';\n\nimport { apiTokenFromEnvironment } from './environment.js';\nimport { graphql } from './octokit.js';\n\ninterface CreateCommitResult {\n createCommitOnBranch: {\n commit: {\n oid: string;\n };\n };\n}\n\ninterface UploadAllFileChangesParams {\n dir: string;\n /**\n * The branch name\n */\n branch: string;\n /**\n * The headline of the commit message\n */\n messageHeadline: string;\n\n /**\n * File changes to exclude from the upload.\n *\n * Defaults to `[]` (no exclusions).\n */\n ignore?: Git.ChangedFile[];\n /**\n * The body of the commit message\n */\n messageBody?: string;\n /**\n * Updates the local Git repository to match the new remote branch state\n */\n updateLocal?: boolean;\n}\n\n/**\n * Retrieves all file changes from the local Git repository using\n * `getChangedFiles`, then uploads the changes to a specified GitHub branch\n * using `uploadFileChanges`.\n *\n * Returns the commit ID, or `undefined` if there are no changes to commit.\n *\n * The file changes will appear as verified commits on GitHub.\n *\n * This will not update the local Git repository unless `updateLocal` is\n * specified.\n */\nexport const uploadAllFileChanges = async ({\n branch,\n dir,\n messageHeadline,\n\n ignore,\n messageBody,\n updateLocal = false,\n}: UploadAllFileChangesParams): Promise<string | undefined> => {\n const changedFiles = await Git.getChangedFiles({ dir, ignore });\n\n if (!changedFiles.length) {\n return;\n }\n\n const fileChanges = await readFileChanges(dir, changedFiles);\n\n const commitId = await uploadFileChanges({\n dir,\n branch,\n messageHeadline,\n messageBody,\n fileChanges,\n });\n\n if (updateLocal) {\n await Promise.all(\n [...fileChanges.additions, ...fileChanges.deletions].map((file) =>\n fs.rm(file.path),\n ),\n );\n\n await Git.fastForwardBranch({\n ref: branch,\n auth: { type: 'gitHubApp' },\n dir,\n });\n }\n\n return commitId;\n};\n\ninterface FileAddition {\n contents: unknown;\n path: string;\n}\n\ninterface FileDeletion {\n path: string;\n}\n\nexport interface FileChanges {\n additions: FileAddition[];\n deletions: FileDeletion[];\n}\n\n/**\n * Takes a list of `ChangedFiles`, reads them from the file system, and maps\n * them to GitHub GraphQL `FileChanges`.\n *\n * https://docs.github.com/en/graphql/reference/input-objects#filechanges\n */\nexport const readFileChanges = async (\n dir: string,\n changedFiles: Git.ChangedFile[],\n): Promise<FileChanges> => {\n const { added, deleted } = changedFiles.reduce<{\n added: string[];\n deleted: string[];\n }>(\n (files, changedFile) => {\n const filePath = changedFile.path;\n if (changedFile.state === 'deleted') {\n files.deleted.push(filePath);\n } else {\n files.added.push(filePath);\n }\n\n return files;\n },\n { added: [], deleted: [] },\n );\n\n const gitRoot = await Git.findRoot({ dir });\n\n const toRootPath = (filePath: string) => {\n if (!gitRoot) {\n return filePath;\n }\n\n return path.resolve(gitRoot, filePath);\n };\n\n const additions: FileAddition[] = await Promise.all(\n added.map(async (filePath) => ({\n path: filePath,\n contents: await fs.promises.readFile(toRootPath(filePath), {\n encoding: 'base64',\n }),\n })),\n );\n\n const deletions: FileDeletion[] = deleted.map((filePath) => ({\n path: filePath,\n }));\n\n return {\n additions,\n deletions,\n };\n};\n\ninterface UploadFileChangesParams {\n dir: string;\n /**\n * The branch name\n */\n branch: string;\n /**\n * The headline of the commit message\n */\n messageHeadline: string;\n /**\n * The body of the commit message\n */\n messageBody?: string;\n /**\n * File additions and deletions\n */\n fileChanges: FileChanges;\n}\n\n/**\n * Uploads file changes from the local workspace to a specified GitHub branch.\n *\n * The file changes will appear as verified commits on GitHub.\n *\n * This will not update the local Git repository.\n */\nexport const uploadFileChanges = async ({\n dir,\n branch,\n messageHeadline,\n messageBody,\n fileChanges,\n}: UploadFileChangesParams): Promise<string> => {\n const authToken = apiTokenFromEnvironment();\n if (!authToken) {\n throw new Error(\n 'Could not read a GitHub API token from the environment. Please set GITHUB_API_TOKEN or GITHUB_TOKEN.',\n );\n }\n\n const [{ owner, repo }, headCommitId] = await Promise.all([\n Git.getOwnerAndRepo({ dir }),\n Git.getHeadCommitId({ dir }),\n ]);\n\n const input: CreateCommitOnBranchInput = {\n branch: {\n repositoryNameWithOwner: `${owner}/${repo}`,\n branchName: branch,\n },\n message: {\n headline: messageHeadline,\n body: messageBody,\n },\n expectedHeadOid: headCommitId,\n clientMutationId: 'skuba',\n fileChanges,\n };\n\n const result = await graphql<CreateCommitResult>(\n `\n mutation Mutation($input: CreateCommitOnBranchInput!) {\n createCommitOnBranch(input: $input) {\n commit {\n oid\n }\n }\n }\n `,\n {\n input,\n headers: {\n auth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nB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASA;AAAA,MACE;AAAA,MACA,SAAS;AAAA,QACP,eAAe,UAAU,SAAS;AAAA,MACpC;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,qBAAqB,OAAO;AAC5C;",
6
- "names": ["fs", "path"]
7
- }
@@ -1,4 +0,0 @@
1
- export declare const resolveComposeAddress: (privateHost: string, privatePort: number) => Promise<{
2
- host: string;
3
- port: number;
4
- }>;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var compose_exports = {};
20
- __export(compose_exports, {
21
- resolveComposeAddress: () => resolveComposeAddress
22
- });
23
- module.exports = __toCommonJS(compose_exports);
24
- var import_exec = require("../../utils/exec.js");
25
- const portStringToNumber = (portString) => {
26
- const port = Number(portString);
27
- if (!Number.isSafeInteger(port)) {
28
- throw Error(`received non-integer port: '${portString}'`);
29
- }
30
- return port;
31
- };
32
- const resolveComposeAddress = async (privateHost, privatePort) => {
33
- const exec = (0, import_exec.createExec)({ stdio: "pipe" });
34
- const { stdout } = await exec(
35
- "docker",
36
- "compose",
37
- "port",
38
- privateHost,
39
- String(privatePort)
40
- );
41
- const [host, portString] = stdout.trim().split(":");
42
- if (!host || !portString) {
43
- throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);
44
- }
45
- return { host, port: portStringToNumber(portString) };
46
- };
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- resolveComposeAddress
50
- });
51
- //# sourceMappingURL=compose.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/net/compose.ts"],
4
- "sourcesContent": ["import { createExec } from '../../utils/exec.js';\n\nconst portStringToNumber = (portString: string) => {\n const port = Number(portString);\n\n if (!Number.isSafeInteger(port)) {\n throw Error(`received non-integer port: '${portString}'`);\n }\n\n return port;\n};\n\nexport const resolveComposeAddress = async (\n privateHost: string,\n privatePort: number,\n) => {\n const exec = createExec({ stdio: 'pipe' });\n\n const { stdout } = await exec(\n 'docker',\n 'compose',\n 'port',\n privateHost,\n String(privatePort),\n );\n\n const [host, portString] = stdout.trim().split(':');\n\n if (!host || !portString) {\n throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);\n }\n\n return { host, port: portStringToNumber(portString) };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAE3B,MAAM,qBAAqB,CAAC,eAAuB;AACjD,QAAM,OAAO,OAAO,UAAU;AAE9B,MAAI,CAAC,OAAO,cAAc,IAAI,GAAG;AAC/B,UAAM,MAAM,+BAA+B,UAAU,GAAG;AAAA,EAC1D;AAEA,SAAO;AACT;AAEO,MAAM,wBAAwB,OACnC,aACA,gBACG;AACH,QAAM,WAAO,wBAAW,EAAE,OAAO,OAAO,CAAC;AAEzC,QAAM,EAAE,OAAO,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,WAAW;AAAA,EACpB;AAEA,QAAM,CAAC,MAAM,UAAU,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AAElD,MAAI,CAAC,QAAQ,CAAC,YAAY;AACxB,UAAM,MAAM,kDAAkD,MAAM,GAAG;AAAA,EACzE;AAEA,SAAO,EAAE,MAAM,MAAM,mBAAmB,UAAU,EAAE;AACtD;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- export { waitFor } from './waitFor.js';
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/api/net/index.ts"],
4
- "sourcesContent": ["export { waitFor } from './waitFor.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;",
6
- "names": []
7
- }
@@ -1,5 +0,0 @@
1
- export interface SocketAddress {
2
- host: string;
3
- port: number;
4
- }
5
- export declare const pollSocket: (host: string, port: number, timeout: number) => Promise<void>;