skuba 13.0.0-subpath-imports-20251003052152 → 13.0.0-update-conditions-20251014052300

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 (48) hide show
  1. package/lib/cli/build/esbuild.js +3 -1
  2. package/lib/cli/build/esbuild.js.map +2 -2
  3. package/lib/cli/configure/ensureTemplateCompletion.js +1 -1
  4. package/lib/cli/configure/ensureTemplateCompletion.js.map +2 -2
  5. package/lib/cli/configure/modules/index.js +1 -1
  6. package/lib/cli/configure/modules/index.js.map +2 -2
  7. package/lib/cli/init/getConfig.d.ts +1 -1
  8. package/lib/cli/init/getConfig.js +5 -7
  9. package/lib/cli/init/getConfig.js.map +3 -3
  10. package/lib/cli/init/prompts.d.ts +5 -5
  11. package/lib/cli/init/prompts.js +4 -5
  12. package/lib/cli/init/prompts.js.map +3 -3
  13. package/lib/cli/lint/internalLints/upgrade/index.js +7 -3
  14. package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
  15. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +23 -0
  16. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +355 -0
  17. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +7 -0
  18. package/lib/cli/lint/internalLints/upgrade/patches/{13.0.0 → 12.4.1}/index.js +15 -0
  19. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +7 -0
  20. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +2 -0
  21. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +152 -0
  22. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +7 -0
  23. package/lib/cli/lint/internalLints/upgrade/patches/{13.0.0 → 12.4.1}/rewriteSrcImports.js +7 -3
  24. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +7 -0
  25. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +3 -0
  26. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +399 -0
  27. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +7 -0
  28. package/lib/cli/start/index.js +2 -4
  29. package/lib/cli/start/index.js.map +2 -2
  30. package/package.json +6 -6
  31. package/template/base/tsconfig.build.json +3 -0
  32. package/template/base/tsconfig.json +0 -1
  33. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  34. package/template/express-rest-api/Dockerfile +1 -0
  35. package/template/express-rest-api/package.json +1 -1
  36. package/template/greeter/.buildkite/pipeline.yml +1 -1
  37. package/template/greeter/package.json +1 -1
  38. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  39. package/template/koa-rest-api/Dockerfile +1 -0
  40. package/template/koa-rest-api/package.json +1 -1
  41. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  42. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -0
  43. package/template/lambda-sqs-worker-cdk/package.json +1 -1
  44. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/index.js.map +0 -7
  45. package/lib/cli/lint/internalLints/upgrade/patches/13.0.0/rewriteSrcImports.js.map +0 -7
  46. package/template/lambda-sqs-worker-cdk/tsconfig.json +0 -14
  47. /package/lib/cli/lint/internalLints/upgrade/patches/{13.0.0 → 12.4.1}/index.d.ts +0 -0
  48. /package/lib/cli/lint/internalLints/upgrade/patches/{13.0.0 → 12.4.1}/rewriteSrcImports.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.ts"],
4
+ "sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nexport const hasSkubaDiveRegisterImportRegex =\n /import\\s+['\"](?:skuba-dive\\/register)(?:\\.js)?['\"];?\\s*/gm;\n\nexport const hasRelativeRegisterImportRegex =\n /import\\s+['\"](\\.\\.?\\/.*?register)(?:\\.js)?['\"];?\\s*/gm;\n\nexport const hasRelativeImportRegex =\n /import\\s+['\"](\\.\\.?\\/[^'\"]*?)(?:\\.js)?['\"];?\\s*/gm;\n\nexport const hasSrcImportRegex =\n /import\\s+(?:type\\s+(?:\\{[^}]*\\}|\\*\\s+as\\s+\\w+)|\\{[^}]*\\}|\\*\\s+as\\s+\\w+|\\w+(?:\\s*,\\s*\\{[^}]*\\})?)\\s+from\\s+['\"]src\\/[^'\"]*['\"]/gm;\n\nexport const hasImportRegex = /import\\(\\s*[\"']src\\/[^'\"]*[\"']\\s*\\)/gm;\n\nexport const hasJestMockRegex = /jest\\.(mock|doMock)\\(\\s*[\"']src\\/[^'\"]*[\"']/gm;\n\nconst multiLineCommentRegex = /\\/\\*[\\s\\S]*?\\*\\//g;\n\nconst singleLineCommentRegex = /\\/\\/.*$/gm;\n\nconst whitespaceRegex = /\\s/g;\n\nconst removeSkubaDiveRegisterImport = (contents: string) =>\n contents.replace(hasSkubaDiveRegisterImportRegex, '');\n\nconst removeRelativeRegisterImport = (contents: string) =>\n contents.replace(hasRelativeRegisterImportRegex, '');\n\nconst removeSelectiveRelativeImports = (\n contents: string,\n file: string,\n deletionSet: Set<string>,\n): string =>\n contents.replace(hasRelativeImportRegex, (match, relativePath: string) => {\n if (!relativePath) {\n return match;\n }\n\n const fileDir = path.dirname(file);\n const resolvedPath = path.resolve(fileDir, relativePath);\n\n if (path.extname(relativePath)) {\n return deletionSet.has(resolvedPath) ? '' : match;\n }\n\n const possiblePaths = [`${resolvedPath}.ts`, `${resolvedPath}.js`];\n const shouldRemove = possiblePaths.some((possiblePath) =>\n deletionSet.has(possiblePath),\n );\n\n return shouldRemove ? '' : match;\n });\n\nexport const isFileEmpty = (contents: string): boolean =>\n contents\n .replace(multiLineCommentRegex, '')\n .replace(singleLineCommentRegex, '')\n .replace(whitespaceRegex, '').length === 0;\n\nexport const replaceSrcImport = (contents: string) => {\n const combinedSrcRegex = new RegExp(\n [\n hasSrcImportRegex.source,\n hasImportRegex.source,\n hasJestMockRegex.source,\n ].join('|'),\n 'gm',\n );\n\n const withReplacedSrcImports = contents.replace(combinedSrcRegex, (match) =>\n match.replace(/(['\"])src\\//g, '$1#src/'),\n );\n\n return removeSkubaDiveRegisterImport(withReplacedSrcImports);\n};\n\nexport const replaceSrcImportWithConditionalRegisterRemoval = (\n contents: string,\n shouldRemoveRelativeRegister: boolean,\n) => {\n const combinedSrcRegex = new RegExp(\n [\n hasSrcImportRegex.source,\n hasImportRegex.source,\n hasJestMockRegex.source,\n ].join('|'),\n 'gm',\n );\n\n const withReplacedSrcImports = contents.replace(combinedSrcRegex, (match) =>\n match.replace(/(['\"])src\\//g, '$1#src/'),\n );\n\n const withoutSkubaDive = removeSkubaDiveRegisterImport(\n withReplacedSrcImports,\n );\n\n return shouldRemoveRelativeRegister\n ? removeRelativeRegisterImport(withoutSkubaDive)\n : withoutSkubaDive;\n};\n\nexport const replaceSrcImportWithSelectiveRegisterRemoval = (\n contents: string,\n file: string,\n deletionSet: Set<string>,\n) => {\n const combinedSrcRegex = new RegExp(\n [\n hasSrcImportRegex.source,\n hasImportRegex.source,\n hasJestMockRegex.source,\n ].join('|'),\n 'gm',\n );\n\n const withReplacedSrcImports = contents.replace(combinedSrcRegex, (match) =>\n match.replace(/(['\"])src\\//g, '$1#src/'),\n );\n\n const withoutSkubaDive = removeSkubaDiveRegisterImport(\n withReplacedSrcImports,\n );\n\n return removeSelectiveRelativeImports(withoutSkubaDive, file, deletionSet);\n};\n\nexport const tryRewriteSrcImports: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const tsFileNames = await glob(['**/*.ts', '**/*.test.ts'], {\n ignore: [\n '**/.git',\n '**/node_modules',\n 'src/cli/lint/internalLints/upgrade/patches/**/*',\n ],\n });\n\n if (!tsFileNames.length) {\n return {\n result: 'skip',\n reason: 'no .ts or test.ts files found',\n };\n }\n\n const tsFiles = await fetchFiles(tsFileNames);\n\n const filesWithSkubaDiveRemoved = tsFiles.map(({ file, contents }) => ({\n file,\n before: contents,\n afterSkubaDiveRemoval: removeSkubaDiveRegisterImport(\n contents.replace(\n new RegExp(\n [\n hasSrcImportRegex.source,\n hasImportRegex.source,\n hasJestMockRegex.source,\n ].join('|'),\n 'gm',\n ),\n (match) => match.replace(/(['\"])src\\//g, '$1#src/'),\n ),\n ),\n }));\n\n const filesToDelete = new Set(\n filesWithSkubaDiveRemoved\n .filter(({ afterSkubaDiveRemoval }) => isFileEmpty(afterSkubaDiveRemoval))\n .map(({ file }) => path.resolve(file)),\n );\n\n const mapped = tsFiles.map(({ file, contents }) => ({\n file,\n before: contents,\n after: replaceSrcImportWithSelectiveRegisterRemoval(\n contents,\n file,\n filesToDelete,\n ),\n }));\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n mapped.map(async ({ file, before, after }) => {\n if (isFileEmpty(after)) {\n await fs.promises.unlink(file);\n return;\n }\n\n if (before !== after) {\n await fs.promises.writeFile(file, after);\n }\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const rewriteSrcImports: PatchFunction = async (config) => {\n try {\n return await tryRewriteSrcImports(config);\n } catch (err) {\n log.warn('Failed to rewrite src imports to #src');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,MACzC;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,oBAAmC,OAAO,WAAW;AAChE,MAAI;AACF,WAAO,MAAM,qBAAqB,MAAM;AAAA,EAC1C,SAAS,KAAK;AACZ,uBAAI,KAAK,uCAAuC;AAChD,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs", "path"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { PatchFunction } from '../../index.js';
2
+ export declare const tryUpdateLambdaConfigs: PatchFunction;
3
+ export declare const updateLambdaConfigs: PatchFunction;
@@ -0,0 +1,399 @@
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 updateLambdaConfigs_exports = {};
30
+ __export(updateLambdaConfigs_exports, {
31
+ tryUpdateLambdaConfigs: () => tryUpdateLambdaConfigs,
32
+ updateLambdaConfigs: () => updateLambdaConfigs
33
+ });
34
+ module.exports = __toCommonJS(updateLambdaConfigs_exports);
35
+ var import_util = require("util");
36
+ var import_fast_glob = require("fast-glob");
37
+ var import_fs_extra = __toESM(require("fs-extra"));
38
+ var import__ = require("../../../../../../index.js");
39
+ var import_logging = require("../../../../../../utils/logging.js");
40
+ const fetchFiles = async (files) => Promise.all(
41
+ files.map(async (file) => {
42
+ const contents = await import_fs_extra.default.promises.readFile(file, "utf8");
43
+ return {
44
+ file,
45
+ contents
46
+ };
47
+ })
48
+ );
49
+ const findBracedBlock = (content, pattern) => {
50
+ const match = pattern.exec(content);
51
+ if (!match) {
52
+ return void 0;
53
+ }
54
+ let braceCount = 1;
55
+ const startIndex = match.index + match[0].length;
56
+ let endIndex = startIndex;
57
+ while (braceCount > 0 && endIndex < content.length) {
58
+ if (content[endIndex] === "{") {
59
+ braceCount++;
60
+ } else if (content[endIndex] === "}") {
61
+ braceCount--;
62
+ }
63
+ endIndex++;
64
+ }
65
+ if (braceCount !== 0) {
66
+ return void 0;
67
+ }
68
+ return {
69
+ content: content.slice(startIndex, endIndex - 1),
70
+ startIndex,
71
+ endIndex,
72
+ matchIndex: match.index
73
+ };
74
+ };
75
+ const replaceAllBracedBlocks = (content, pattern, replacer) => {
76
+ let modified = content;
77
+ let hasChanges = false;
78
+ let match;
79
+ let offset = 0;
80
+ while ((match = pattern.exec(content)) !== null) {
81
+ const adjustedIndex = match.index + offset;
82
+ let braceCount = 1;
83
+ const startIndex = adjustedIndex + match[0].length;
84
+ let endIndex = startIndex;
85
+ while (braceCount > 0 && endIndex < modified.length) {
86
+ if (modified[endIndex] === "{") {
87
+ braceCount++;
88
+ } else if (modified[endIndex] === "}") {
89
+ braceCount--;
90
+ }
91
+ endIndex++;
92
+ }
93
+ if (braceCount !== 0) {
94
+ continue;
95
+ }
96
+ const blockContent = modified.slice(startIndex, endIndex - 1);
97
+ const replacement = replacer(blockContent);
98
+ if (replacement === void 0) {
99
+ continue;
100
+ }
101
+ const before = modified.slice(0, adjustedIndex);
102
+ const after = modified.slice(endIndex);
103
+ const fullReplacement = `${match[0].slice(0, -1)}{${replacement}}`;
104
+ modified = `${before}${fullReplacement}${after}`;
105
+ offset += fullReplacement.length - (endIndex - adjustedIndex);
106
+ hasChanges = true;
107
+ }
108
+ return hasChanges ? modified : void 0;
109
+ };
110
+ const patchCdkTsFile = ({
111
+ contents,
112
+ customCondition
113
+ }) => {
114
+ if (!contents.includes("aws_lambda_nodejs.NodejsFunction")) {
115
+ return void 0;
116
+ }
117
+ const modified = replaceAllBracedBlocks(
118
+ contents,
119
+ /bundling:\s*\{/g,
120
+ (bundlingContent) => {
121
+ if (bundlingContent.includes("--conditions")) {
122
+ return void 0;
123
+ }
124
+ const esbuildArgsBlock = findBracedBlock(
125
+ bundlingContent,
126
+ /esbuildArgs\s*:\s*\{/
127
+ );
128
+ if (esbuildArgsBlock) {
129
+ const argsContent = esbuildArgsBlock.content.trim();
130
+ const separator = argsContent ? ", " : "";
131
+ const newArgsContent = `'--conditions': '${customCondition}'${separator}${argsContent}`;
132
+ const modifiedBundlingContent2 = `${bundlingContent.slice(0, esbuildArgsBlock.matchIndex)}esbuildArgs: {${newArgsContent}}${bundlingContent.slice(esbuildArgsBlock.endIndex)}`;
133
+ return modifiedBundlingContent2;
134
+ }
135
+ const modifiedBundlingContent = bundlingContent.trimStart();
136
+ return `
137
+ esbuildArgs: { '--conditions': '${customCondition}' },
138
+ ${modifiedBundlingContent}`;
139
+ }
140
+ );
141
+ if (!modified) {
142
+ return void 0;
143
+ }
144
+ return {
145
+ original: contents,
146
+ modified
147
+ };
148
+ };
149
+ const patchWebpackConfigFile = ({
150
+ contents,
151
+ customCondition
152
+ }) => {
153
+ const exportsBlock = findBracedBlock(contents, /module\.exports\s*=\s*\{/);
154
+ if (!exportsBlock) {
155
+ return void 0;
156
+ }
157
+ const exportsContent = exportsBlock.content;
158
+ if (exportsContent.includes(customCondition)) {
159
+ return void 0;
160
+ }
161
+ const resolveBlock = findBracedBlock(exportsContent, /resolve\s*:\s*\{/);
162
+ if (resolveBlock) {
163
+ const resolveContent = resolveBlock.content;
164
+ const conditionNamesMatch = /conditionNames\s*:\s*\[([^\]]*)\]/s.exec(
165
+ resolveContent
166
+ );
167
+ if (conditionNamesMatch?.[1] !== void 0) {
168
+ const existingConditions = conditionNamesMatch[1].trim();
169
+ const separator = existingConditions ? ", " : "";
170
+ const newConditionNames = `conditionNames: ['${customCondition}'${separator}${existingConditions}]`;
171
+ const modifiedResolveContent2 = `${resolveContent.slice(0, conditionNamesMatch.index)}${newConditionNames}${resolveContent.slice(conditionNamesMatch.index + conditionNamesMatch[0].length)}`;
172
+ const modifiedExportsContent3 = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${modifiedResolveContent2}}${exportsContent.slice(resolveBlock.endIndex)}`;
173
+ const modified3 = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent3}${contents.slice(exportsBlock.endIndex)}`;
174
+ return {
175
+ original: contents,
176
+ modified: modified3
177
+ };
178
+ }
179
+ const modifiedResolveContent = resolveContent.trimStart();
180
+ const newResolveContent = `
181
+ conditionNames: ['${customCondition}', '...'],
182
+ ${modifiedResolveContent}`;
183
+ const modifiedExportsContent2 = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${newResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;
184
+ const modified2 = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent2}${contents.slice(exportsBlock.endIndex)}`;
185
+ return {
186
+ original: contents,
187
+ modified: modified2
188
+ };
189
+ }
190
+ const modifiedExportsContent = exportsContent.trimStart();
191
+ const newExportsContent = `
192
+ resolve: {
193
+ conditionNames: ['${customCondition}', '...'],
194
+ },
195
+ ${modifiedExportsContent}`;
196
+ const modified = `${contents.slice(0, exportsBlock.startIndex)}${newExportsContent}${contents.slice(exportsBlock.endIndex)}`;
197
+ return {
198
+ original: contents,
199
+ modified
200
+ };
201
+ };
202
+ const patchServerlessEsbuildFile = ({
203
+ contents,
204
+ customCondition
205
+ }) => {
206
+ if (contents.includes(customCondition)) {
207
+ return void 0;
208
+ }
209
+ if (!contents.includes("serverless-esbuild") && !contents.includes("build:") && !contents.includes("custom:")) {
210
+ return void 0;
211
+ }
212
+ const esbuildBlockRegex = /^((?:build|custom):)\s*\n(\s+)(esbuild:)\s*\n((?:\2\s+.+\n)*)/gm;
213
+ let match;
214
+ let modified = contents;
215
+ let hasChanges = false;
216
+ esbuildBlockRegex.lastIndex = 0;
217
+ while ((match = esbuildBlockRegex.exec(contents)) !== null) {
218
+ const [fullMatch, blockType, baseIndent, esbuildLabel, esbuildContent] = match;
219
+ if (/esbuild:\s*false/.exec(fullMatch)) {
220
+ continue;
221
+ }
222
+ if (esbuildContent?.includes("conditions:")) {
223
+ continue;
224
+ }
225
+ const conditionsIndent = `${baseIndent} `;
226
+ const arrayItemIndent = `${conditionsIndent} `;
227
+ const newEsbuildBlock = `${blockType}
228
+ ${baseIndent}${esbuildLabel}
229
+ ${conditionsIndent}conditions:
230
+ ${arrayItemIndent}- '${customCondition}'
231
+ ${esbuildContent}`;
232
+ modified = modified.replace(fullMatch, newEsbuildBlock);
233
+ hasChanges = true;
234
+ }
235
+ if (!hasChanges) {
236
+ return void 0;
237
+ }
238
+ return {
239
+ original: contents,
240
+ modified
241
+ };
242
+ };
243
+ const patchServerlessFile = ({
244
+ contents,
245
+ customCondition
246
+ }) => {
247
+ if (contents.includes("esbuild")) {
248
+ return patchServerlessEsbuildFile({
249
+ contents,
250
+ customCondition
251
+ });
252
+ }
253
+ if (contents.includes("serverless-webpack")) {
254
+ return void 0;
255
+ }
256
+ if (contents.includes("package.json")) {
257
+ return void 0;
258
+ }
259
+ const packageBlockRegex = /^(\s*)(package:)\s*\n(\s+)(patterns:)\s*\n((?:\3\s+-\s+.+\n)*)/gm;
260
+ let match;
261
+ let modified = contents;
262
+ let hasChanges = false;
263
+ packageBlockRegex.lastIndex = 0;
264
+ while ((match = packageBlockRegex.exec(contents)) !== null) {
265
+ const [
266
+ fullMatch,
267
+ baseIndent,
268
+ packageLabel,
269
+ patternsIndent,
270
+ patternsLabel,
271
+ patternsContent
272
+ ] = match;
273
+ if (patternsContent?.includes("package.json")) {
274
+ continue;
275
+ }
276
+ const arrayItemIndent = `${patternsIndent} `;
277
+ const newPackageBlock = `${baseIndent}${packageLabel}
278
+ ${patternsIndent}${patternsLabel}
279
+ ${patternsContent}${arrayItemIndent}- 'package.json'
280
+ `;
281
+ modified = modified.replace(fullMatch, newPackageBlock);
282
+ hasChanges = true;
283
+ }
284
+ if (!hasChanges) {
285
+ return void 0;
286
+ }
287
+ return {
288
+ original: contents,
289
+ modified
290
+ };
291
+ };
292
+ const tryUpdateLambdaConfigs = async ({
293
+ mode
294
+ }) => {
295
+ let customCondition;
296
+ try {
297
+ const { repo } = await import__.Git.getOwnerAndRepo({ dir: process.cwd() });
298
+ customCondition = `@seek/${repo}/source`;
299
+ } catch {
300
+ return { result: "skip", reason: "no repository name found" };
301
+ }
302
+ const [tsFileNames, webpackFileNames, serverlessFileNames] = await Promise.all([
303
+ (0, import_fast_glob.glob)("**/*.ts", {
304
+ ignore: [
305
+ "**/.git",
306
+ "**/node_modules",
307
+ "src/cli/lint/internalLints/upgrade/patches/**/*"
308
+ ]
309
+ }),
310
+ (0, import_fast_glob.glob)("**/*webpack.config.js", {
311
+ ignore: ["**/.git", "**/node_modules"]
312
+ }),
313
+ (0, import_fast_glob.glob)("**/serverless*.y*ml", {
314
+ ignore: ["**/.git", "**/node_modules"]
315
+ })
316
+ ]);
317
+ if (!tsFileNames.length && !webpackFileNames.length && !serverlessFileNames.length) {
318
+ return {
319
+ result: "skip",
320
+ reason: "no .ts or webpack config files or .yml files found"
321
+ };
322
+ }
323
+ const [tsFiles, webpackFiles, serverlessFiles] = await Promise.all([
324
+ fetchFiles(tsFileNames),
325
+ fetchFiles(webpackFileNames),
326
+ fetchFiles(serverlessFileNames)
327
+ ]);
328
+ const filesToPatch = [
329
+ ...tsFiles.flatMap(({ file, contents }) => {
330
+ const patched = patchCdkTsFile({
331
+ contents,
332
+ customCondition
333
+ });
334
+ if (patched && patched.modified !== patched.original) {
335
+ return {
336
+ file,
337
+ original: patched.original,
338
+ modified: patched.modified
339
+ };
340
+ }
341
+ return [];
342
+ }),
343
+ ...webpackFiles.flatMap(({ file, contents }) => {
344
+ const patched = patchWebpackConfigFile({
345
+ contents,
346
+ customCondition
347
+ });
348
+ if (patched && patched.modified !== patched.original) {
349
+ return {
350
+ file,
351
+ original: patched.original,
352
+ modified: patched.modified
353
+ };
354
+ }
355
+ return [];
356
+ }),
357
+ ...serverlessFiles.flatMap(({ file, contents }) => {
358
+ const patched = patchServerlessFile({
359
+ contents,
360
+ customCondition
361
+ });
362
+ if (patched && patched.modified !== patched.original) {
363
+ return {
364
+ file,
365
+ original: patched.original,
366
+ modified: patched.modified
367
+ };
368
+ }
369
+ return [];
370
+ })
371
+ ];
372
+ if (!filesToPatch.length) {
373
+ return { result: "skip", reason: "no lambda configurations to patch" };
374
+ }
375
+ if (mode === "lint") {
376
+ return { result: "apply" };
377
+ }
378
+ await Promise.all(
379
+ filesToPatch.map(async ({ file, modified }) => {
380
+ await import_fs_extra.default.promises.writeFile(file, modified, "utf8");
381
+ })
382
+ );
383
+ return { result: "apply" };
384
+ };
385
+ const updateLambdaConfigs = async (config) => {
386
+ try {
387
+ return await tryUpdateLambdaConfigs(config);
388
+ } catch (err) {
389
+ import_logging.log.warn("Failed to write configure `tsconfig.json` and `package.json`");
390
+ import_logging.log.subtle((0, import_util.inspect)(err));
391
+ return { result: "skip", reason: "due to an error" };
392
+ }
393
+ };
394
+ // Annotate the CommonJS export names for ESM import in node:
395
+ 0 && (module.exports = {
396
+ tryUpdateLambdaConfigs,
397
+ updateLambdaConfigs
398
+ });
399
+ //# sourceMappingURL=updateLambdaConfigs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../../../../index.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n/**\n * Find a block delimited by braces and return its content and position\n * @param content The text to search in\n * @param pattern The regex pattern to match (should match up to the opening brace)\n * @returns Object containing the matched content and indices, or undefined if not found\n */\nconst findBracedBlock = (\n content: string,\n pattern: RegExp,\n):\n | {\n content: string;\n startIndex: number;\n endIndex: number;\n matchIndex: number;\n }\n | undefined => {\n const match = pattern.exec(content);\n if (!match) {\n return undefined;\n }\n\n // Find the matching closing brace\n let braceCount = 1;\n const startIndex = match.index + match[0].length;\n let endIndex = startIndex;\n\n while (braceCount > 0 && endIndex < content.length) {\n if (content[endIndex] === '{') {\n braceCount++;\n } else if (content[endIndex] === '}') {\n braceCount--;\n }\n endIndex++;\n }\n\n if (braceCount !== 0) {\n return undefined;\n }\n\n return {\n content: content.slice(startIndex, endIndex - 1),\n startIndex,\n endIndex,\n matchIndex: match.index,\n };\n};\n\n/**\n * Find and replace all braced blocks matching a pattern\n * @param content The text to search in\n * @param pattern The regex pattern to match (should be global and match up to the opening brace)\n * @param replacer Function that receives the block content and returns the replacement, or undefined to skip\n * @returns The modified content, or undefined if no changes were made\n */\nconst replaceAllBracedBlocks = (\n content: string,\n pattern: RegExp,\n replacer: (blockContent: string) => string | undefined,\n): string | undefined => {\n let modified = content;\n let hasChanges = false;\n let match: RegExpExecArray | null;\n let offset = 0;\n\n while ((match = pattern.exec(content)) !== null) {\n const adjustedIndex = match.index + offset;\n\n // Find the matching closing brace\n let braceCount = 1;\n const startIndex = adjustedIndex + match[0].length;\n let endIndex = startIndex;\n\n while (braceCount > 0 && endIndex < modified.length) {\n if (modified[endIndex] === '{') {\n braceCount++;\n } else if (modified[endIndex] === '}') {\n braceCount--;\n }\n endIndex++;\n }\n\n if (braceCount !== 0) {\n continue;\n }\n\n const blockContent = modified.slice(startIndex, endIndex - 1);\n const replacement = replacer(blockContent);\n\n if (replacement === undefined) {\n continue;\n }\n\n // Replace this block\n const before = modified.slice(0, adjustedIndex);\n const after = modified.slice(endIndex);\n const fullReplacement = `${match[0].slice(0, -1)}{${replacement}}`;\n modified = `${before}${fullReplacement}${after}`;\n\n // Adjust offset for next iteration\n offset += fullReplacement.length - (endIndex - adjustedIndex);\n hasChanges = true;\n }\n\n return hasChanges ? modified : undefined;\n};\n\nconst patchCdkTsFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n if (!contents.includes('aws_lambda_nodejs.NodejsFunction')) {\n return undefined;\n }\n\n const modified = replaceAllBracedBlocks(\n contents,\n /bundling:\\s*\\{/g,\n (bundlingContent) => {\n // Check if --conditions already exists\n if (bundlingContent.includes('--conditions')) {\n return undefined;\n }\n\n // Find esbuildArgs block within bundling\n const esbuildArgsBlock = findBracedBlock(\n bundlingContent,\n /esbuildArgs\\s*:\\s*\\{/,\n );\n\n if (esbuildArgsBlock) {\n const argsContent = esbuildArgsBlock.content.trim();\n const separator = argsContent ? ', ' : '';\n const newArgsContent = `'--conditions': '${customCondition}'${separator}${argsContent}`;\n\n const modifiedBundlingContent = `${bundlingContent.slice(0, esbuildArgsBlock.matchIndex)}esbuildArgs: {${newArgsContent}}${bundlingContent.slice(esbuildArgsBlock.endIndex)}`;\n\n return modifiedBundlingContent;\n }\n\n // Add new esbuildArgs property\n const modifiedBundlingContent = bundlingContent.trimStart();\n return `\\n esbuildArgs: { '--conditions': '${customCondition}' },\\n ${modifiedBundlingContent}`;\n },\n );\n\n if (!modified) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchWebpackConfigFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n // Find module.exports block\n const exportsBlock = findBracedBlock(contents, /module\\.exports\\s*=\\s*\\{/);\n if (!exportsBlock) {\n return undefined;\n }\n\n const exportsContent = exportsBlock.content;\n\n // Check if resolve.conditionNames already has our custom condition\n if (exportsContent.includes(customCondition)) {\n return undefined;\n }\n\n // Find resolve block within module.exports\n const resolveBlock = findBracedBlock(exportsContent, /resolve\\s*:\\s*\\{/);\n\n if (resolveBlock) {\n const resolveContent = resolveBlock.content;\n\n // Find conditionNames array within resolve\n const conditionNamesMatch = /conditionNames\\s*:\\s*\\[([^\\]]*)\\]/s.exec(\n resolveContent,\n );\n\n if (conditionNamesMatch?.[1] !== undefined) {\n // Add custom condition to existing conditionNames array\n const existingConditions = conditionNamesMatch[1].trim();\n const separator = existingConditions ? ', ' : '';\n const newConditionNames = `conditionNames: ['${customCondition}'${separator}${existingConditions}]`;\n\n const modifiedResolveContent = `${resolveContent.slice(0, conditionNamesMatch.index)}${newConditionNames}${resolveContent.slice(conditionNamesMatch.index + conditionNamesMatch[0].length)}`;\n\n const modifiedExportsContent = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${modifiedResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n }\n\n // Add conditionNames property to resolve block\n const modifiedResolveContent = resolveContent.trimStart();\n const newResolveContent = `\\n conditionNames: ['${customCondition}', '...'],\\n ${modifiedResolveContent}`;\n\n const modifiedExportsContent = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${newResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n }\n\n // Add resolve property with conditionNames to module.exports\n const modifiedExportsContent = exportsContent.trimStart();\n const newExportsContent = `\\n resolve: {\\n conditionNames: ['${customCondition}', '...'],\\n },\\n ${modifiedExportsContent}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${newExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchServerlessEsbuildFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n // Check if custom condition already exists\n if (contents.includes(customCondition)) {\n return undefined;\n }\n\n // Check for serverless-esbuild plugin or build.esbuild or custom.esbuild configuration\n if (\n !contents.includes('serverless-esbuild') &&\n !contents.includes('build:') &&\n !contents.includes('custom:')\n ) {\n return undefined;\n }\n\n // Match either build: or custom: followed by esbuild: with nested configuration\n // This regex only matches multi-line esbuild blocks, not inline \"esbuild: false\"\n const esbuildBlockRegex =\n /^((?:build|custom):)\\s*\\n(\\s+)(esbuild:)\\s*\\n((?:\\2\\s+.+\\n)*)/gm;\n\n let match;\n let modified = contents;\n let hasChanges = false;\n\n // Reset regex lastIndex for multiple matches\n esbuildBlockRegex.lastIndex = 0;\n\n while ((match = esbuildBlockRegex.exec(contents)) !== null) {\n const [fullMatch, blockType, baseIndent, esbuildLabel, esbuildContent] =\n match;\n\n // Check if esbuild is disabled (esbuild: false)\n if (/esbuild:\\s*false/.exec(fullMatch)) {\n continue;\n }\n\n // Check if conditions already exists in this block\n if (esbuildContent?.includes('conditions:')) {\n continue;\n }\n\n // Determine indentation (should be baseIndent + 2 spaces for YAML)\n const conditionsIndent = `${baseIndent} `;\n const arrayItemIndent = `${conditionsIndent} `;\n\n // Build the new esbuild block with conditions added\n const newEsbuildBlock = `${blockType}\\n${baseIndent}${esbuildLabel}\\n${conditionsIndent}conditions:\\n${arrayItemIndent}- '${customCondition}'\\n${esbuildContent}`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newEsbuildBlock);\n hasChanges = true;\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchServerlessFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n if (contents.includes('esbuild')) {\n return patchServerlessEsbuildFile({\n contents,\n customCondition,\n });\n }\n\n if (contents.includes('serverless-webpack')) {\n return undefined;\n }\n\n // patch package patterns for serverless framework\n if (contents.includes('package.json')) {\n return undefined;\n }\n\n // Match package: blocks with patterns: arrays\n const packageBlockRegex =\n /^(\\s*)(package:)\\s*\\n(\\s+)(patterns:)\\s*\\n((?:\\3\\s+-\\s+.+\\n)*)/gm;\n\n let match;\n let modified = contents;\n let hasChanges = false;\n\n // Reset regex lastIndex for multiple matches\n packageBlockRegex.lastIndex = 0;\n\n while ((match = packageBlockRegex.exec(contents)) !== null) {\n const [\n fullMatch,\n baseIndent,\n packageLabel,\n patternsIndent,\n patternsLabel,\n patternsContent,\n ] = match;\n\n // Check if package.json already exists in this block\n if (patternsContent?.includes('package.json')) {\n continue;\n }\n\n // Add package.json to the patterns list\n const arrayItemIndent = `${patternsIndent} `;\n const newPackageBlock = `${baseIndent}${packageLabel}\\n${patternsIndent}${patternsLabel}\\n${patternsContent}${arrayItemIndent}- 'package.json'\\n`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newPackageBlock);\n hasChanges = true;\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nexport const tryUpdateLambdaConfigs: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n let customCondition: string;\n try {\n const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });\n customCondition = `@seek/${repo}/source`;\n } catch {\n return { result: 'skip', reason: 'no repository name found' };\n }\n\n const [tsFileNames, webpackFileNames, serverlessFileNames] =\n await Promise.all([\n glob('**/*.ts', {\n ignore: [\n '**/.git',\n '**/node_modules',\n 'src/cli/lint/internalLints/upgrade/patches/**/*',\n ],\n }),\n glob('**/*webpack.config.js', {\n ignore: ['**/.git', '**/node_modules'],\n }),\n glob('**/serverless*.y*ml', {\n ignore: ['**/.git', '**/node_modules'],\n }),\n ]);\n\n if (\n !tsFileNames.length &&\n !webpackFileNames.length &&\n !serverlessFileNames.length\n ) {\n return {\n result: 'skip',\n reason: 'no .ts or webpack config files or .yml files found',\n };\n }\n\n const [tsFiles, webpackFiles, serverlessFiles] = await Promise.all([\n fetchFiles(tsFileNames),\n fetchFiles(webpackFileNames),\n fetchFiles(serverlessFileNames),\n ]);\n\n const filesToPatch = [\n ...tsFiles.flatMap(({ file, contents }) => {\n const patched = patchCdkTsFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ...webpackFiles.flatMap(({ file, contents }) => {\n const patched = patchWebpackConfigFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ...serverlessFiles.flatMap(({ file, contents }) => {\n const patched = patchServerlessFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ];\n\n if (!filesToPatch.length) {\n return { result: 'skip', reason: 'no lambda configurations to patch' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n filesToPatch.map(async ({ file, modified }) => {\n await fs.promises.writeFile(file, modified, 'utf8');\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const updateLambdaConfigs: PatchFunction = async (config) => {\n try {\n return await tryUpdateLambdaConfigs(config);\n } catch (err) {\n log.warn('Failed to write configure `tsconfig.json` and `package.json`');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAqB;AACrB,sBAAe;AAEf,eAAoB;AACpB,qBAAoB;AAGpB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,MAAM,gBAAAA,QAAG,SAAS,SAAS,MAAM,MAAM;AAExD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAQF,MAAM,kBAAkB,CACtB,SACA,YAQe;AACf,QAAM,QAAQ,QAAQ,KAAK,OAAO;AAClC,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAGA,MAAI,aAAa;AACjB,QAAM,aAAa,MAAM,QAAQ,MAAM,CAAC,EAAE;AAC1C,MAAI,WAAW;AAEf,SAAO,aAAa,KAAK,WAAW,QAAQ,QAAQ;AAClD,QAAI,QAAQ,QAAQ,MAAM,KAAK;AAC7B;AAAA,IACF,WAAW,QAAQ,QAAQ,MAAM,KAAK;AACpC;AAAA,IACF;AACA;AAAA,EACF;AAEA,MAAI,eAAe,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,SAAS,QAAQ,MAAM,YAAY,WAAW,CAAC;AAAA,IAC/C;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAAA,EACpB;AACF;AASA,MAAM,yBAAyB,CAC7B,SACA,SACA,aACuB;AACvB,MAAI,WAAW;AACf,MAAI,aAAa;AACjB,MAAI;AACJ,MAAI,SAAS;AAEb,UAAQ,QAAQ,QAAQ,KAAK,OAAO,OAAO,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AK;AACZ,uBAAI,KAAK,8DAA8D;AACvE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs", "modifiedBundlingContent", "modifiedResolveContent", "modifiedExportsContent", "modified"]
7
+ }
@@ -40,10 +40,8 @@ var import_validation = require("../../utils/validation.js");
40
40
  var import_tsc = require("../build/tsc.js");
41
41
  const start = async () => {
42
42
  const customConditions = (0, import_tsc.getCustomConditions)();
43
- const [args, availablePort] = await Promise.all([
44
- (0, import_args.parseRunArgs)(process.argv.slice(2)),
45
- (0, import_get_port.default)()
46
- ]);
43
+ const args = (0, import_args.parseRunArgs)(process.argv.slice(2));
44
+ const availablePort = await (0, import_get_port.default)();
47
45
  const uniqueConditions = [
48
46
  .../* @__PURE__ */ new Set([...args.conditions ?? [], ...customConditions])
49
47
  ];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/start/index.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { getEntryPointFromManifest } from '../../utils/manifest.js';\nimport { isIpPort } from '../../utils/validation.js';\nimport { getCustomConditions } from '../build/tsc.js';\n\nexport const start = async () => {\n const customConditions = getCustomConditions();\n const [args, availablePort] = await Promise.all([\n parseRunArgs(process.argv.slice(2)),\n getPort(),\n ]);\n\n const uniqueConditions = [\n ...new Set([...(args.conditions ?? []), ...customConditions]),\n ];\n\n args.entryPoint ??= await getEntryPointFromManifest();\n\n const execProcess = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return execProcess(\n 'tsx',\n 'watch',\n '--clear-screen=false',\n ...args.node,\n ...uniqueConditions.map((condition) => `--conditions=${condition}`),\n '--env-file-if-exists',\n '.env',\n '--require',\n 'tsconfig-paths/register',\n path.join(__dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,sBAA0C;AAC1C,wBAAyB;AACzB,iBAAoC;AAE7B,MAAM,QAAQ,YAAY;AAC/B,QAAM,uBAAmB,gCAAoB;AAC7C,QAAM,CAAC,MAAM,aAAa,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC9C,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAAA,QAClC,gBAAAA,SAAQ;AAAA,EACV,CAAC;AAED,QAAM,mBAAmB;AAAA,IACvB,GAAG,oBAAI,IAAI,CAAC,GAAI,KAAK,cAAc,CAAC,GAAI,GAAG,gBAAgB,CAAC;AAAA,EAC9D;AAEA,OAAK,eAAe,UAAM,2CAA0B;AAEpD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,qBAAqB,KAAK;AAAA,MAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,KAAK;AAAA,IACR,GAAG,iBAAiB,IAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAAC,QAAK,KAAK,WAAW,MAAM,MAAM,WAAW,UAAU;AAAA,IACtD,GAAG,KAAK;AAAA,EACV;AACF;",
4
+ "sourcesContent": ["import path from 'path';\n\nimport getPort from 'get-port';\n\nimport { parseRunArgs } from '../../utils/args.js';\nimport { createExec } from '../../utils/exec.js';\nimport { getEntryPointFromManifest } from '../../utils/manifest.js';\nimport { isIpPort } from '../../utils/validation.js';\nimport { getCustomConditions } from '../build/tsc.js';\n\nexport const start = async () => {\n const customConditions = getCustomConditions();\n const args = parseRunArgs(process.argv.slice(2));\n const availablePort = await getPort();\n\n const uniqueConditions = [\n ...new Set([...(args.conditions ?? []), ...customConditions]),\n ];\n\n args.entryPoint ??= await getEntryPointFromManifest();\n\n const execProcess = createExec({\n env: {\n __SKUBA_ENTRY_POINT: args.entryPoint,\n __SKUBA_PORT: String(isIpPort(args.port) ? args.port : availablePort),\n },\n });\n\n return execProcess(\n 'tsx',\n 'watch',\n '--clear-screen=false',\n ...args.node,\n ...uniqueConditions.map((condition) => `--conditions=${condition}`),\n '--env-file-if-exists',\n '.env',\n '--require',\n 'tsconfig-paths/register',\n path.join(__dirname, '..', '..', 'wrapper', 'index.js'),\n ...args.script,\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAoB;AAEpB,kBAA6B;AAC7B,kBAA2B;AAC3B,sBAA0C;AAC1C,wBAAyB;AACzB,iBAAoC;AAE7B,MAAM,QAAQ,YAAY;AAC/B,QAAM,uBAAmB,gCAAoB;AAC7C,QAAM,WAAO,0BAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC/C,QAAM,gBAAgB,UAAM,gBAAAA,SAAQ;AAEpC,QAAM,mBAAmB;AAAA,IACvB,GAAG,oBAAI,IAAI,CAAC,GAAI,KAAK,cAAc,CAAC,GAAI,GAAG,gBAAgB,CAAC;AAAA,EAC9D;AAEA,OAAK,eAAe,UAAM,2CAA0B;AAEpD,QAAM,kBAAc,wBAAW;AAAA,IAC7B,KAAK;AAAA,MACH,qBAAqB,KAAK;AAAA,MAC1B,cAAc,WAAO,4BAAS,KAAK,IAAI,IAAI,KAAK,OAAO,aAAa;AAAA,IACtE;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,KAAK;AAAA,IACR,GAAG,iBAAiB,IAAI,CAAC,cAAc,gBAAgB,SAAS,EAAE;AAAA,IAClE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAAC,QAAK,KAAK,WAAW,MAAM,MAAM,WAAW,UAAU;AAAA,IACtD,GAAG,KAAK;AAAA,EACV;AACF;",
6
6
  "names": ["getPort", "path"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "13.0.0-subpath-imports-20251003052152",
3
+ "version": "13.0.0-update-conditions-20251014052300",
4
4
  "private": false,
5
5
  "description": "SEEK development toolkit for backend applications and packages",
6
6
  "homepage": "https://github.com/seek-oss/skuba#readme",
@@ -104,13 +104,13 @@
104
104
  "typescript": "~5.9.0",
105
105
  "zod": "^4.0.0",
106
106
  "@skuba-lib/api": "^1.0.1",
107
- "eslint-config-skuba": "7.1.2"
107
+ "eslint-config-skuba": "7.2.0-update-conditions-20251014052300"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@changesets/cli": "2.29.7",
111
111
  "@changesets/get-github-info": "0.6.0",
112
- "@jest/reporters": "30.1.3",
113
- "@jest/test-result": "30.1.3",
112
+ "@jest/reporters": "30.2.0",
113
+ "@jest/test-result": "30.2.0",
114
114
  "@types/ejs": "3.1.5",
115
115
  "@types/express": "5.0.3",
116
116
  "@types/fs-extra": "11.0.4",
@@ -126,10 +126,10 @@
126
126
  "enhanced-resolve": "5.18.3",
127
127
  "express": "5.1.0",
128
128
  "fastify": "5.6.1",
129
- "jest-diff": "30.1.2",
129
+ "jest-diff": "30.2.0",
130
130
  "jsonfile": "6.2.0",
131
131
  "koa": "3.0.1",
132
- "memfs": "4.43.0",
132
+ "memfs": "4.48.1",
133
133
  "remark-cli": "12.0.1",
134
134
  "remark-preset-lint-recommended": "7.0.1",
135
135
  "semver": "7.7.2",
@@ -1,4 +1,7 @@
1
1
  {
2
+ "compilerOptions": {
3
+ "rootDir": "src"
4
+ },
2
5
  "exclude": ["**/__mocks__/**/*", "**/*.test.ts", "src/testing/**/*"],
3
6
  "extends": "./tsconfig.json",
4
7
  "include": ["src/**/*"]
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "baseUrl": ".",
4
3
  "customConditions": ["@seek/<%- serviceName %>/source"],
5
4
  "lib": ["ES2024"],
6
5
  "outDir": "lib",
@@ -48,7 +48,7 @@ steps:
48
48
  GET_NPM_TOKEN: please
49
49
  plugins:
50
50
  - *docker-ecr-cache
51
- - docker-compose#v5.10.0:
51
+ - docker-compose#v5.11.0:
52
52
  environment:
53
53
  - GITHUB_API_TOKEN
54
54
  mount-buildkite-agent: true
@@ -18,6 +18,7 @@ WORKDIR /workdir
18
18
 
19
19
  COPY --from=build /workdir/lib lib
20
20
  COPY --from=build /workdir/node_modules node_modules
21
+ COPY --from=build /workdir/package.json package.json
21
22
 
22
23
  ENV NODE_ENV=production
23
24
 
@@ -22,7 +22,7 @@
22
22
  "@opentelemetry/api": "^1.9.0",
23
23
  "@opentelemetry/core": "^2.0.0",
24
24
  "@opentelemetry/exporter-trace-otlp-grpc": "^0.205.0",
25
- "@opentelemetry/instrumentation-aws-sdk": "^0.60.0",
25
+ "@opentelemetry/instrumentation-aws-sdk": "^0.61.0",
26
26
  "@opentelemetry/instrumentation-http": "^0.205.0",
27
27
  "@opentelemetry/propagator-b3": "^2.0.0",
28
28
  "@opentelemetry/sdk-node": "^0.205.0",
@@ -29,7 +29,7 @@ steps:
29
29
  GET_NPM_TOKEN: please
30
30
  plugins:
31
31
  - *docker-ecr-cache
32
- - docker-compose#v5.10.0:
32
+ - docker-compose#v5.11.0:
33
33
  environment:
34
34
  - GITHUB_API_TOKEN
35
35
  mount-buildkite-agent: true
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.13.10",
26
- "skuba": "13.0.0-subpath-imports-20251003052152"
26
+ "skuba": "13.0.0-update-conditions-20251014052300"
27
27
  },
28
28
  "packageManager": "pnpm@10.17.1",
29
29
  "engines": {
@@ -48,7 +48,7 @@ steps:
48
48
  GET_NPM_TOKEN: please
49
49
  plugins:
50
50
  - *docker-ecr-cache
51
- - docker-compose#v5.10.0:
51
+ - docker-compose#v5.11.0:
52
52
  environment:
53
53
  - GITHUB_API_TOKEN
54
54
  mount-buildkite-agent: true
@@ -18,6 +18,7 @@ WORKDIR /workdir
18
18
 
19
19
  COPY --from=build /workdir/lib lib
20
20
  COPY --from=build /workdir/node_modules node_modules
21
+ COPY --from=build /workdir/package.json package.json
21
22
 
22
23
  ENV NODE_ENV=production
23
24
 
@@ -24,7 +24,7 @@
24
24
  "@opentelemetry/api": "^1.9.0",
25
25
  "@opentelemetry/core": "^2.0.0",
26
26
  "@opentelemetry/exporter-trace-otlp-grpc": "^0.205.0",
27
- "@opentelemetry/instrumentation-aws-sdk": "^0.60.0",
27
+ "@opentelemetry/instrumentation-aws-sdk": "^0.61.0",
28
28
  "@opentelemetry/instrumentation-http": "^0.205.0",
29
29
  "@opentelemetry/propagator-b3": "^2.0.0",
30
30
  "@opentelemetry/sdk-node": "^0.205.0",