@architect/inventory 3.4.1 → 3.4.2

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.1",
3
+ "version": "3.4.2",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -47,8 +47,16 @@ function getExt ({ runtime, src, errors }) {
47
47
  // This presumes Node.js ≥14 Lambda releases use the same CJS/ESM pattern
48
48
  // Generally in Lambda: CJS wins, but in Architect-land we attempt to default to ESM
49
49
  else {
50
- let { file, ext = 'mjs' } = findHandler(nodeHandlers, src)
50
+ let { file, ext } = findHandler(nodeHandlers, src)
51
+
52
+ // Early return on extensions that imply module type
53
+ if (ext === 'mjs') return { file, ext, handlerModuleSystem: 'esm' }
54
+ if (ext === 'cjs') return { file, ext, handlerModuleSystem: 'cjs' }
55
+
56
+ // 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
57
+ ext = ext || 'mjs'
51
58
  let handlerModuleSystem = ext === 'mjs' ? 'esm' : 'cjs'
59
+
52
60
  let pkgFile = join(src, 'package.json')
53
61
  if (existsSync(pkgFile)) {
54
62
  let pkg = JSON.parse(readFileSync(pkgFile))