diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/bundler_target.ts b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/bundler_target.ts index 0d63992c38..fcd7c5e6ce 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/bundler_target.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/bundler_target.ts @@ -8,6 +8,7 @@ const versionMap = { 16: 'node16', 18: 'node18', 20: 'node20', + 22: 'node22', } as const type VersionValues = (typeof versionMap)[keyof typeof versionMap] diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_runtime.ts b/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_runtime.ts index 194320bac4..e70c7c06cf 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_runtime.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_runtime.ts @@ -25,7 +25,7 @@ export const getNodeRuntimeForV2 = (input: string | undefined): string | undefin const version = parseVersion(input) // If version was unable to be parsed or if the version is older than Node.js 18 - // we return the current default Node.js version (which was Node.js 18 while writing this). + // we return the current default Node.js version (which was Node.js 22 while writing this). // Here we do not want BB/FO to decide on the version, because they value AWS_LAMBDA_JS_RUNTIME, which // might be set to an too old version if (!version || version < minimumV2Version) { diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_version.ts b/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_version.ts index 1e3188a65c..a3dd91abbd 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_version.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/utils/node_version.ts @@ -6,7 +6,7 @@ export interface NodeVersionSupport { } // Must match the default version used in Bitballoon. -export const DEFAULT_NODE_VERSION = 18 +export const DEFAULT_NODE_VERSION = 22 export const getNodeVersion = (configVersion?: string) => parseVersion(configVersion) ?? DEFAULT_NODE_VERSION diff --git a/packages/zip-it-and-ship-it/tests/esbuild.test.ts b/packages/zip-it-and-ship-it/tests/esbuild.test.ts index eb2f0576bc..6c92eb9273 100644 --- a/packages/zip-it-and-ship-it/tests/esbuild.test.ts +++ b/packages/zip-it-and-ship-it/tests/esbuild.test.ts @@ -32,10 +32,10 @@ describe('esbuild', () => { await zipFixture('node-module-optional-catch-binding', { opts: { archiveFormat: ARCHIVE_FORMAT.NONE, - config: { '*': { nodeBundler: NODE_BUNDLER.ESBUILD, nodeVersion: '18.x' } }, + config: { '*': { nodeBundler: NODE_BUNDLER.ESBUILD, nodeVersion: '22.x' } }, }, }) - expect(build).toHaveBeenCalledWith(expect.objectContaining({ target: ['node18'] })) + expect(build).toHaveBeenCalledWith(expect.objectContaining({ target: ['node22'] })) }) }) diff --git a/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_runtime.test.ts b/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_runtime.test.ts index bb02afec1c..67b4c30e21 100644 --- a/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_runtime.test.ts +++ b/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_runtime.test.ts @@ -8,6 +8,7 @@ describe('getNodeRuntime', () => { ['nodejs16.x', 'nodejs16.x'], ['nodejs18.x', 'nodejs18.x'], ['nodejs20.x', 'nodejs20.x'], + ['nodejs22.x', 'nodejs22.x'], ['14.x', 'nodejs14.x'], ['v16.x', 'nodejs16.x'], ['18.0.0', 'nodejs18.x'], @@ -21,17 +22,17 @@ describe('getNodeRuntime', () => { describe('getNodeRuntimeForV2', () => { test.each([ - ['nodejs12.x', 'nodejs18.x'], - ['nodejs16.x', 'nodejs18.x'], + ['nodejs12.x', 'nodejs22.x'], + ['nodejs16.x', 'nodejs22.x'], ['nodejs18.x', 'nodejs18.x'], ['nodejs20.x', 'nodejs20.x'], - ['14.x', 'nodejs18.x'], - ['v16.x', 'nodejs18.x'], + ['14.x', 'nodejs22.x'], + ['v16.x', 'nodejs22.x'], ['18.0.0', 'nodejs18.x'], ['20.0.0', 'nodejs20.x'], - ['v14.2.0', 'nodejs18.x'], - ['14.1', 'nodejs18.x'], - [':shrug:', 'nodejs18.x'], + ['v14.2.0', 'nodejs22.x'], + ['14.1', 'nodejs22.x'], + [':shrug:', 'nodejs22.x'], ['99.0.0', undefined], ])('handles `%s`', (input, expected) => { expect(getNodeRuntimeForV2(input)).toBe(expected) diff --git a/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_version.test.ts b/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_version.test.ts index c4cd321c0c..37c0e1b39a 100644 --- a/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_version.test.ts +++ b/packages/zip-it-and-ship-it/tests/unit/runtimes/node/utils/node_version.test.ts @@ -13,6 +13,7 @@ describe('getNodeVersion', () => { ['nodejs16.x', 16], ['nodejs18.x', 18], ['nodejs20.x', 20], + ['nodejs22.x', 22], ['18.x', 18], ['node16', 16], ['14.1.1', 14], @@ -29,6 +30,7 @@ describe('parseVersion', () => { ['nodejs12.x', 12], ['nodejs18.x', 18], ['nodejs20.x', 20], + ['nodejs22.x', 22], ['18.x', 18], ['node14', 14], ['14.1.1', 14], diff --git a/packages/zip-it-and-ship-it/tests/v2api.test.ts b/packages/zip-it-and-ship-it/tests/v2api.test.ts index a79c6348ac..fbcf7f03fe 100644 --- a/packages/zip-it-and-ship-it/tests/v2api.test.ts +++ b/packages/zip-it-and-ship-it/tests/v2api.test.ts @@ -342,7 +342,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => { }, }) - expect(files[0].runtimeVersion).toBe('nodejs18.x') + expect(files[0].runtimeVersion).toBe('nodejs22.x') }) test('Returns Node.js 18 if invalid version is set', async () => { @@ -357,7 +357,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => { }, }) - expect(files[0].runtimeVersion).toBe('nodejs18.x') + expect(files[0].runtimeVersion).toBe('nodejs22.x') }) test('Returns no Node.js version if version is newer than 18 but not a valid runtime', async () => {