@architect/inventory 3.4.3 → 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
|
@@ -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 }) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
let { join } = require('path')
|
|
2
2
|
let { existsSync, readFileSync } = require('fs')
|
|
3
|
+
let isWin = process.platform.startsWith('win')
|
|
3
4
|
|
|
4
5
|
module.exports = function getHandler ({ config, src, build, errors }) {
|
|
5
6
|
let { handler, runtime, runtimeConfig } = config
|
|
@@ -21,7 +22,10 @@ module.exports = function getHandler ({ config, src, build, errors }) {
|
|
|
21
22
|
}
|
|
22
23
|
// Compiled to a binary
|
|
23
24
|
else if (customRuntimeType === 'compiled') {
|
|
24
|
-
|
|
25
|
+
/* istanbul ignore next */
|
|
26
|
+
let bootstrap = `bootstrap${isWin ? '.exe' : ''}`
|
|
27
|
+
handlerFile = join(build, runtimeConfig.buildSubpath || '', runtimeConfig.handlerFile || bootstrap)
|
|
28
|
+
handlerMethod = null
|
|
25
29
|
}
|
|
26
30
|
// Interpreted
|
|
27
31
|
else if (customRuntimeType === 'interpreted') {
|
|
@@ -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.
|
|
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. '
|
|
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
|
}
|