bare-module-traverse 1.2.4 → 1.2.6
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/README.md +1 -1
- package/index.js +3 -3
- package/lib/resolve/bare.js +3 -2
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ for await (const dependency of traverse(new URL('file:///directory/file.js'), re
|
|
|
48
48
|
|
|
49
49
|
#### `const dependencies = traverse(url[, options], readModule[, listPrefix])`
|
|
50
50
|
|
|
51
|
-
Traverse the module graph rooted at `url`, which must be a WHATWG `URL` instance. `readModule` is called with a `URL` instance for every module to be read and must either return the module source, if it exists, or `null`. `listPrefix` is called with a `URL` instance of every prefix to be listed and must
|
|
51
|
+
Traverse the module graph rooted at `url`, which must be a WHATWG `URL` instance. `readModule` is called with a `URL` instance for every module to be read and must either return the module source, if it exists, or `null`. `listPrefix` is called with a `URL` instance of every prefix to be listed and must yield `URL` instances that have the specified `URL` as a prefix. If not provided, prefixes won't be traversed. If `readModule` returns a promise or `listPrefix` returns a promise generator, synchronous iteration is not supported.
|
|
52
52
|
|
|
53
53
|
Options include:
|
|
54
54
|
|
package/index.js
CHANGED
|
@@ -88,9 +88,7 @@ module.exports = exports = function traverse (entry, opts, readModule, listPrefi
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function defaultListPrefix () {
|
|
92
|
-
return []
|
|
93
|
-
}
|
|
91
|
+
function * defaultListPrefix () {}
|
|
94
92
|
|
|
95
93
|
function addURL (array, url) {
|
|
96
94
|
let lo = 0
|
|
@@ -164,6 +162,8 @@ exports.module = function * (url, source, artifacts, visited, opts = {}) {
|
|
|
164
162
|
imports['#package'] = packageURL.href
|
|
165
163
|
|
|
166
164
|
yield { children: exports.package(packageURL, source, artifacts, visited, opts) }
|
|
165
|
+
|
|
166
|
+
break
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
package/lib/resolve/bare.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = function (entry, parentURL, opts = {}) {
|
|
|
5
5
|
const runtime = require('#runtime')
|
|
6
6
|
|
|
7
7
|
const {
|
|
8
|
+
linked = false,
|
|
8
9
|
platform = runtime.platform,
|
|
9
10
|
arch = runtime.arch,
|
|
10
11
|
simulator = false,
|
|
@@ -17,10 +18,10 @@ module.exports = function (entry, parentURL, opts = {}) {
|
|
|
17
18
|
if (simulator) conditions = [...conditions, 'simulator']
|
|
18
19
|
|
|
19
20
|
if (entry.type & lex.constants.ADDON) {
|
|
20
|
-
extensions = ['.bare', '.node']
|
|
21
|
+
extensions = linked ? [] : ['.bare', '.node']
|
|
21
22
|
conditions = ['addon', ...conditions]
|
|
22
23
|
|
|
23
|
-
return resolve.addon(entry.specifier || '.', parentURL, { extensions, conditions, host, ...opts })
|
|
24
|
+
return resolve.addon(entry.specifier || '.', parentURL, { extensions, conditions, host, linked, ...opts })
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
if (entry.type & lex.constants.ASSET) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-module-traverse",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Low-level module graph traversal for Bare",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"test": "
|
|
24
|
+
"test": "npm run lint && npm run test:bare && npm run test:node",
|
|
25
|
+
"test:bare": "bare test.js",
|
|
26
|
+
"test:node": "node test.js",
|
|
27
|
+
"lint": "standard"
|
|
25
28
|
},
|
|
26
29
|
"repository": {
|
|
27
30
|
"type": "git",
|