skuba 14.0.0-esbuild-bundle-support-20260101051138 → 14.0.0-esbuild-bundle-support-20260101065337

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.
@@ -4,5 +4,5 @@ interface EsbuildParameters extends EsbuildConfig {
4
4
  debug: boolean;
5
5
  type: string | undefined;
6
6
  }
7
- export declare const esbuild: ({ debug, type, external, minify, bundle, splitting, treeShaking, }: EsbuildParameters, args?: string[]) => Promise<void>;
7
+ export declare const esbuild: ({ debug, type, external, bundle, minify, splitting, treeShaking, }: EsbuildParameters, args?: string[]) => Promise<void>;
8
8
  export {};
@@ -32,10 +32,10 @@ const esbuild = async ({
32
32
  debug,
33
33
  type,
34
34
  external,
35
- minify = false,
36
- bundle = false,
37
- splitting = false,
38
- treeShaking = false
35
+ bundle,
36
+ minify,
37
+ splitting,
38
+ treeShaking
39
39
  }, args = process.argv.slice(2)) => {
40
40
  const log = (0, import_logging.createLogger)({ debug });
41
41
  const tscArgs = (0, import_args.parseTscArgs)(args);
@@ -58,12 +58,17 @@ const esbuild = async ({
58
58
  log.debug((0, import_util.inspect)(compilerOptions));
59
59
  const start = process.hrtime.bigint();
60
60
  const isEsm = compilerOptions.module !== import_typescript.ModuleKind.CommonJS && type === "module";
61
- const canSplit = bundle && splitting && isEsm && compilerOptions.outDir;
61
+ const canSplit = bundle && isEsm && Boolean(compilerOptions.outDir);
62
+ if (splitting && !canSplit) {
63
+ throw new Error(
64
+ "Code splitting requires bundle to be enabled, ESM output format, and outDir to be configured"
65
+ );
66
+ }
62
67
  await (0, import_esbuild.build)({
63
68
  bundle,
64
- minify: bundle ? minify : false,
65
- splitting: canSplit ? splitting : false,
66
- treeShaking: bundle ? treeShaking : false,
69
+ minify: bundle && minify,
70
+ splitting: canSplit && splitting,
71
+ treeShaking: bundle && treeShaking,
67
72
  external,
68
73
  entryPoints,
69
74
  format: !isEsm ? "cjs" : void 0,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/esbuild.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths';\nimport { type BuildOptions, build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { getCustomConditions, readTsBuildConfig, tsc } from './tsc.js';\n\nexport type EsbuildConfig = Pick<\n BuildOptions,\n 'external' | 'minify' | 'bundle' | 'splitting' | 'treeShaking'\n>;\n\ninterface EsbuildParameters extends EsbuildConfig {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n {\n debug,\n type,\n external,\n minify = false,\n bundle = false,\n splitting = false,\n treeShaking = false,\n }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n const customConditions = getCustomConditions();\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n const canSplit = bundle && splitting && isEsm && compilerOptions.outDir;\n\n await build({\n bundle,\n minify: bundle ? minify : false,\n splitting: canSplit ? splitting : false,\n treeShaking: bundle ? treeShaking : false,\n external,\n entryPoints,\n format: !isEsm ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs ||\n compilerOptions.moduleResolution === ModuleResolutionKind.Node16\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n // eslint-disable-next-line new-cap\n TsconfigPathsPlugin({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n conditions: customConditions?.length ? customConditions : undefined,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAAoC;AACpC,qBAAyC;AACzC,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAA4D;AAYrD,MAAM,UAAU,OACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAChB,GACA,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC,QAAM,uBAAmB,gCAAoB;AAE7C,MAAI,QAAQ,OAAO;AACjB,QAAI;AAAA,MACF;AAAA,IACF;AACA,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,wBAAoB,8BAAkB,MAAM,GAAG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AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { TsconfigPathsPlugin } from '@esbuild-plugins/tsconfig-paths';\nimport { type BuildOptions, build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { getCustomConditions, readTsBuildConfig, tsc } from './tsc.js';\n\nexport type EsbuildConfig = Pick<\n BuildOptions,\n 'external' | 'minify' | 'bundle' | 'splitting' | 'treeShaking'\n>;\n\ninterface EsbuildParameters extends EsbuildConfig {\n debug: boolean;\n type: string | undefined;\n}\n\nexport const esbuild = async (\n {\n debug,\n type,\n external,\n bundle,\n minify,\n splitting,\n treeShaking,\n }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n const customConditions = getCustomConditions();\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsBuildConfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n const isEsm =\n compilerOptions.module !== ModuleKind.CommonJS && type === 'module';\n\n const canSplit = bundle && isEsm && Boolean(compilerOptions.outDir);\n\n if (splitting && !canSplit) {\n throw new Error(\n 'Code splitting requires bundle to be enabled, ESM output format, and outDir to be configured',\n );\n }\n\n await build({\n bundle,\n minify: bundle && minify,\n splitting: canSplit && splitting,\n treeShaking: bundle && treeShaking,\n external,\n entryPoints,\n format: !isEsm ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs ||\n compilerOptions.moduleResolution === ModuleResolutionKind.Node16\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n // eslint-disable-next-line new-cap\n TsconfigPathsPlugin({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n conditions: customConditions?.length ? customConditions : undefined,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAAoC;AACpC,qBAAyC;AACzC,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAA4D;AAYrD,MAAM,UAAU,OACrB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GACA,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC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pB,+BAAa,gBAAgB,MAAM,EAAE,kBAAkB,IACvD;AAAA,IACJ,UAAU,QAAQ;AAAA,IAClB,YAAY,kBAAkB,SAAS,mBAAmB;AAAA,EAC5D,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,MAAI,MAAM,YAAY,IAAI,OAAO,OAAO,GAAG,CAAC,GAAG;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "14.0.0-esbuild-bundle-support-20260101051138",
3
+ "version": "14.0.0-esbuild-bundle-support-20260101065337",
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",
@@ -102,8 +102,8 @@
102
102
  "tsx": "^4.21.0",
103
103
  "typescript": "~5.9.0",
104
104
  "zod": "^4.0.0",
105
- "@skuba-lib/api": "^2.0.0-esbuild-bundle-support-20260101051138",
106
- "eslint-config-skuba": "8.0.0-esbuild-bundle-support-20260101051138"
105
+ "@skuba-lib/api": "^2.0.0-esbuild-bundle-support-20260101065337",
106
+ "eslint-config-skuba": "8.0.0-esbuild-bundle-support-20260101065337"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@changesets/cli": "2.29.8",
@@ -19,11 +19,11 @@
19
19
  "test:watch": "skuba test --watch"
20
20
  },
21
21
  "dependencies": {
22
- "skuba-dive": "4.0.0-esbuild-bundle-support-20260101051138"
22
+ "skuba-dive": "4.0.0-esbuild-bundle-support-20260101065337"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.13.10",
26
- "skuba": "14.0.0-esbuild-bundle-support-20260101051138"
26
+ "skuba": "14.0.0-esbuild-bundle-support-20260101065337"
27
27
  },
28
28
  "packageManager": "pnpm@10.26.2",
29
29
  "engines": {
@@ -24,7 +24,7 @@
24
24
  "@aws-sdk/client-sns": "^3.363.0",
25
25
  "@seek/aws-codedeploy-hooks": "^2.0.0",
26
26
  "@seek/logger": "^11.1.0",
27
- "skuba-dive": "4.0.0-esbuild-bundle-support-20260101051138",
27
+ "skuba-dive": "4.0.0-esbuild-bundle-support-20260101065337",
28
28
  "zod": "^4.0.0"
29
29
  },
30
30
  "devDependencies": {
@@ -42,7 +42,7 @@
42
42
  "datadog-lambda-js": "^12.0.0",
43
43
  "dd-trace": "^5.0.0",
44
44
  "pino-pretty": "^13.0.0",
45
- "skuba": "14.0.0-esbuild-bundle-support-20260101051138"
45
+ "skuba": "14.0.0-esbuild-bundle-support-20260101065337"
46
46
  },
47
47
  "packageManager": "pnpm@10.26.2",
48
48
  "engines": {