Skip to content

Commit

Permalink
Fix default export handling in Node.js 22, update Lambda runtimes
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Jan 17, 2025
1 parent 74e1eb6 commit 75b0c29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@architect/utils": "~4.0.6",
"@aws-lite/client": "^0.21.1",
"@aws-lite/ssm": "^0.2.3",
"lambda-runtimes": "~2.0.2"
"lambda-runtimes": "~2.0.5"
},
"devDependencies": {
"@architect/eslint-config": "~3.0.0",
Expand Down
6 changes: 6 additions & 0 deletions src/config/pragmas/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = async function getPluginModules ({ arc, inventory, errors }) {
if (arc?.plugins?.length) tagPlugins(arc.plugins, 'plugin')
if (arc?.macros?.length) tagPlugins(arc.macros, 'macro')

let { node } = process.versions
let nodeVer = Number(node.split('.')[0])

for (let pluginItem of pluginItems) {
let { plugin, type } = pluginItem
let name
Expand Down Expand Up @@ -52,6 +55,9 @@ module.exports = async function getPluginModules ({ arc, inventory, errors }) {
if (type === 'plugin') {
try {
plugins[name] = require(pluginPath)
if (nodeVer >= 22 && plugins[name].default) {
plugins[name] = plugins[name].default
}
}
catch (err) {
if (hasEsmError(err)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('Friendly runtime names (aka aliases)', t => {
t.equal(config.runtimeAlias, 'java', `Alias returned lowcase as runtimeAlias: ${config.runtimeAlias}`)

config = getRuntimes({ config: c('.net'), inventory })
t.match(config.runtime, /dotnet7/, `Alias mapped to valid AWS .NET string: ${config.runtime}`)
t.match(config.runtime, /dotnet8/, `Alias mapped to valid AWS .NET string: ${config.runtime}`)
t.equal(config.runtimeAlias, '.net', `Alias returned lowcase as runtimeAlias: ${config.runtimeAlias}`)

config = getRuntimes({ config: c('custom'), inventory })
Expand Down Expand Up @@ -64,7 +64,7 @@ test('Exact runtime names', t => {
t.equal(config.runtime, name, `Returned correct runtime string: ${name}`)
t.notOk(config.runtimeAlias, 'Did not get runtimeAlias')

name = 'dotnet6'
name = 'dotnet8'
config = getRuntimes({ config: c(name), inventory })
t.equal(config.runtime, name, `Returned correct runtime string: ${name}`)
t.notOk(config.runtimeAlias, 'Did not get runtimeAlias')
Expand Down

0 comments on commit 75b0c29

Please sign in to comment.