@architect/inventory 3.4.3-RC.1 → 3.4.3
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.3
|
|
3
|
+
"version": "3.4.3",
|
|
4
4
|
"description": "Architect project resource enumeration utility",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@architect/asap": "~5.1.1",
|
|
25
25
|
"@architect/parser": "~6.0.2",
|
|
26
|
-
"@architect/utils": "~3.1.
|
|
27
|
-
"lambda-runtimes": "~1.1.
|
|
26
|
+
"@architect/utils": "~3.1.6",
|
|
27
|
+
"lambda-runtimes": "~1.1.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@architect/eslint-config": "~2.1.1",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"aws-sdk-mock": "~5.8.0",
|
|
33
33
|
"cross-env": "~7.0.3",
|
|
34
34
|
"dotenv": "~16.0.3",
|
|
35
|
-
"eslint": "~8.
|
|
35
|
+
"eslint": "~8.37.0",
|
|
36
36
|
"mock-fs": "~5.2.0",
|
|
37
37
|
"nyc": "~15.1.0",
|
|
38
38
|
"tap-spec": "^5.0.0",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
let { join } = require('path')
|
|
2
2
|
let { existsSync, readFileSync } = require('fs')
|
|
3
|
-
let isWin = process.platform.startsWith('win')
|
|
4
3
|
|
|
5
4
|
module.exports = function getHandler ({ config, src, build, errors }) {
|
|
6
5
|
let { handler, runtime, runtimeConfig } = config
|
|
@@ -22,10 +21,7 @@ module.exports = function getHandler ({ config, src, build, errors }) {
|
|
|
22
21
|
}
|
|
23
22
|
// Compiled to a binary
|
|
24
23
|
else if (customRuntimeType === 'compiled') {
|
|
25
|
-
|
|
26
|
-
let bootstrap = `bootstrap${isWin ? '.exe' : ''}`
|
|
27
|
-
handlerFile = join(build, runtimeConfig.buildSubpath || '', runtimeConfig.handlerFile || bootstrap)
|
|
28
|
-
handlerMethod = null
|
|
24
|
+
handlerFile = join(build, runtimeConfig.handlerFile || 'handler')
|
|
29
25
|
}
|
|
30
26
|
// Interpreted
|
|
31
27
|
else if (customRuntimeType === 'interpreted') {
|
|
@@ -45,36 +41,31 @@ let denoHandlers = [ 'mod.ts', 'mod.js' ]
|
|
|
45
41
|
function getExt ({ runtime, src, errors }) {
|
|
46
42
|
try {
|
|
47
43
|
if (runtime.startsWith('node')) {
|
|
48
|
-
if (runtime === 'nodejs12.x') {
|
|
49
|
-
return { ext: 'js', handlerModuleSystem: 'cjs' }
|
|
50
|
-
}
|
|
51
44
|
// This presumes Node.js ≥14 Lambda releases use the same CJS/ESM pattern
|
|
52
45
|
// Generally in Lambda: CJS wins, but in Architect-land we attempt to default to ESM
|
|
53
|
-
|
|
54
|
-
let { file, ext } = findHandler(nodeHandlers, src)
|
|
46
|
+
let { file, ext } = findHandler(nodeHandlers, src)
|
|
55
47
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
// Early return on extensions that imply module type
|
|
49
|
+
if (ext === 'mjs') return { file, ext, handlerModuleSystem: 'esm' }
|
|
50
|
+
if (ext === 'cjs') return { file, ext, handlerModuleSystem: 'cjs' }
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
// In the odd case that there only exists an `index` file (no ext), default to ESM and let other things blow up when it's not found
|
|
53
|
+
ext = ext || 'mjs'
|
|
54
|
+
let handlerModuleSystem = ext === 'mjs' ? 'esm' : 'cjs'
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
let pkgFile = join(src, 'package.json')
|
|
57
|
+
if (existsSync(pkgFile)) {
|
|
58
|
+
let pkg = JSON.parse(readFileSync(pkgFile))
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
/**/ if (pkg?.type === 'module') handlerModuleSystem = 'esm'
|
|
61
|
+
else if (pkg?.type === 'commonjs') handlerModuleSystem = 'cjs'
|
|
62
|
+
else if (pkg?.type) throw Error(`Invalid 'type' field: ${pkg.type}`)
|
|
63
|
+
else handlerModuleSystem = 'cjs' // Lambda's default, not ours
|
|
72
64
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
return { file, ext, handlerModuleSystem }
|
|
65
|
+
// We always get to make this a .js file, even if it's ESM!
|
|
66
|
+
ext = 'js'
|
|
77
67
|
}
|
|
68
|
+
return { file, ext, handlerModuleSystem }
|
|
78
69
|
}
|
|
79
70
|
if (runtime.startsWith('python')) return { ext: 'py' }
|
|
80
71
|
if (runtime.startsWith('ruby')) return { ext: 'rb' }
|