@architect/inventory 3.6.3 → 3.6.5

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.6.3",
3
+ "version": "3.6.5",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@architect/asap": "~6.0.3",
24
+ "@architect/asap": "~6.0.4",
25
25
  "@architect/parser": "~6.0.3",
26
26
  "@architect/utils": "~3.1.9",
27
27
  "lambda-runtimes": "~1.1.6"
@@ -32,8 +32,9 @@
32
32
  "aws-sdk-mock": "~5.8.0",
33
33
  "cross-env": "~7.0.3",
34
34
  "dotenv": "~16.3.1",
35
- "eslint": "~8.54.0",
35
+ "eslint": "~8.55.0",
36
36
  "mock-fs": "~5.2.0",
37
+ "mock-tmp": "~0.0.2",
37
38
  "nyc": "~15.1.0",
38
39
  "tap-arc": "^1.2.2",
39
40
  "tape": "^5.7.2"
@@ -52,8 +52,8 @@ module.exports = function configureShared ({ arc, pragmas, inventory, errors })
52
52
  }
53
53
  else if (foundPluginSrc) {
54
54
  if (!required) {
55
- if (!is.exists(shared.src)) shared.src = src
56
- if (!is.exists(shared.src)) return null
55
+ if (!is.exists(shared.src) && !is.exists(join(cwd, shared.src))) shared.src = src
56
+ if (!is.exists(shared.src) && !is.exists(join(cwd, shared.src))) return null
57
57
  }
58
58
  validate.shared(shared.src, cwd, errors, required)
59
59
  }
@@ -66,6 +66,12 @@ module.exports = function sortHTTP (http) {
66
66
  .sort((a, b) => {
67
67
  if (!a.depth && b.depth === 1 && b.trailingCapture) return -1
68
68
  if (a.depth - b.depth < 0) return
69
+ if (a.depth === b.depth &&
70
+ a.trailingCapture && b.trailingCapture) {
71
+ if (a.trailingCapture === b.trailingCapture) return
72
+ if (a.trailingCapture === 'param' && b.trailingCapture === 'catchall') return -1
73
+ return 1
74
+ }
69
75
  if (a.trailingCapture) return 1
70
76
  if (b.trailingCapture) return -1
71
77
  })
@@ -56,8 +56,8 @@ module.exports = function configureViews ({ arc, pragmas, inventory, errors }) {
56
56
  }
57
57
  else if (foundPluginSrc) {
58
58
  if (!required) {
59
- if (!is.exists(views.src)) views.src = src
60
- if (!is.exists(views.src)) return null
59
+ if (!is.exists(views.src) && !is.exists(join(cwd, views.src))) views.src = src
60
+ if (!is.exists(views.src) && !is.exists(join(cwd, views.src))) return null
61
61
  }
62
62
  validate.shared(views.src, cwd, errors, required)
63
63
  }
@@ -4,11 +4,11 @@ let read = require('../../../read')
4
4
  let validate = require('../validate')
5
5
  let { is, validationPatterns: valid } = require('../../../lib')
6
6
  let { parse } = require('./dotenv')
7
- let { homedir } = require('os')
7
+ let os = require('os')
8
8
 
9
9
  module.exports = function getPrefs ({ scope, inventory, errors }) {
10
10
  let cwd = scope === 'global'
11
- ? homedir()
11
+ ? os.homedir()
12
12
  : inventory._project.cwd
13
13
 
14
14
  let envFilepath = join(cwd, '.env')
@@ -1,23 +1,26 @@
1
1
  let { join } = require('path')
2
2
  let { existsSync } = require('fs')
3
3
 
4
- module.exports = function asapSrc () {
4
+ module.exports = function asapSrc (params = {}) {
5
+ let { _testing } = params
6
+ let dirname = _testing ? _testing : __dirname
5
7
  // Inventory running as an arc/arc dependency (most common use case)
6
8
  let src = join(process.cwd(), 'node_modules', '@architect', 'asap', 'src')
7
9
  if (existsSync(src)) return src
8
10
 
9
11
  // Inventory running in arc/arc as a global install
10
- let global = join(__dirname, '..', '..', '..', 'asap', 'src')
12
+ let global = join(dirname, '..', '..', '..', 'asap', 'src')
11
13
  if (existsSync(global)) return global
12
14
 
13
15
  // Inventory running from a local (symlink) context (usually testing/dev)
14
- let local = join(__dirname, '..', '..', 'node_modules', '@architect', 'asap', 'src')
16
+ let local = join(dirname, '..', '..', 'node_modules', '@architect', 'asap', 'src')
15
17
  if (existsSync(local)) return local
16
18
 
17
19
  try {
18
20
  return require.resolve('@architect/asap')
19
21
  }
20
- catch (err) {
22
+ catch {
23
+ /* istanbul ignore next */
21
24
  throw Error('Cannot find ASAP module!')
22
25
  }
23
26
  }
@@ -39,5 +39,4 @@ module.exports = function finalValidation (params, inventory) {
39
39
  if (errors.length) {
40
40
  return errorFmt({ type: 'file path', errors })
41
41
  }
42
-
43
42
  }