@architect/inventory 3.4.4-RC.0 → 3.5.0-RC.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@architect/inventory",
3
- "version": "3.4.4-RC.0",
3
+ "version": "3.5.0-RC.0",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -4,7 +4,7 @@ let { is, pragmas, tidyError, validationPatterns } = require('../../lib')
4
4
  let { lambdas } = pragmas
5
5
  let nonLambdaSetters = [ 'customLambdas', 'env', 'proxy', 'runtimes', 'shared', 'static', 'views', 'tables', 'tables-indexes' ]
6
6
  let setters = [ ...lambdas, ...nonLambdaSetters ]
7
- let pluginMethods = [ 'deploy', 'hydrate', 'sandbox' ]
7
+ let pluginMethods = [ 'deploy', 'create', 'hydrate', 'sandbox' ]
8
8
  let reservedNames = [ '_methods' ]
9
9
 
10
10
  module.exports = async function getPluginModules ({ arc, inventory, errors }) {
@@ -12,18 +12,18 @@ module.exports = function setRuntimePlugins (params, project) {
12
12
  if (runtimePlugins?.length) {
13
13
  let runtimes = {
14
14
  runtimes: [],
15
+ runtimePlugins: {}, // Map runtimes to their corresponding plugins
15
16
  }
16
17
  // inventory._project is not yet built, so provide as much as we can to plugins for now
17
18
  let inv = deepFrozenCopy({ ...inventory, _project: project })
18
19
  let build
19
20
  runtimePlugins.forEach(fn => {
20
- let errType = `plugin: ${fn.plugin}, method: set.runtimes`
21
+ let errType = `plugin: ${fn._plugin}, method: set.runtimes`
21
22
  try {
22
23
  var result = fn({ arc: inv._project.arc, inventory: { inv } })
23
24
  }
24
25
  catch (err) {
25
- err.message = `Runtime plugin exception: ${errType}`
26
- + `\n` + err.message
26
+ err.message = `Runtime plugin exception: ${errType}\n` + err.message
27
27
  throw err
28
28
  }
29
29
  // Accept one or more results, then loop through them
@@ -55,13 +55,14 @@ module.exports = function setRuntimePlugins (params, project) {
55
55
  if (is.string(runtime.build)) build = runtime.build
56
56
  }
57
57
  if (type === 'transpiled' && !allRuntimes.includes(baseRuntime)) {
58
- return errors.push(`Runtime '${name}' must include a valid baseRuntime property corresponding to a valid Lambda runtime (e.g. 'nodejs16.x')`)
58
+ return errors.push(`Runtime '${name}' must include a valid baseRuntime property corresponding to a valid Lambda runtime (e.g. 'nodejs18.x')`)
59
59
  }
60
60
  runtimes.runtimes.push(name)
61
+ runtimes.runtimePlugins[name] = fn._plugin
61
62
  runtimes[name] = runtime
62
63
  })
63
64
  })
64
- return { build, runtimes }
65
+ return { build, runtimes, runtimePlugins }
65
66
  }
66
67
  return {}
67
68
  }