bare-module-traverse 2.7.1 → 2.7.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/README.md +6 -3
- package/index.d.ts +5 -0
- package/index.js +7 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ next.value = {
|
|
|
120
120
|
|
|
121
121
|
**Dependency node**
|
|
122
122
|
|
|
123
|
-
A fully resolved node of the module graph and the traversal's output. This is what the iterable forms yield to the caller.
|
|
123
|
+
A fully resolved node of the module graph and the traversal's output. This is what the iterable forms yield to the caller. A module imported under several `host` or `wasi` attributes is walked once for each, so the same URL may be yielded more than once.
|
|
124
124
|
|
|
125
125
|
```js
|
|
126
126
|
next.value = {
|
|
@@ -141,7 +141,10 @@ next.value = {
|
|
|
141
141
|
exports: [
|
|
142
142
|
// See https://github.com/holepunchto/bare-module-lexer#api
|
|
143
143
|
]
|
|
144
|
-
}
|
|
144
|
+
},
|
|
145
|
+
// The URL of the WASI provider of a WebAssembly addon, if its importer
|
|
146
|
+
// named one with the `wasi` attribute.
|
|
147
|
+
wasi: 'string'
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
150
|
```
|
|
@@ -206,7 +209,7 @@ function drive(generator) {
|
|
|
206
209
|
}
|
|
207
210
|
|
|
208
211
|
while (queue.length > 0 || deferred.length > 0) {
|
|
209
|
-
drive(queue.length > 0 ? queue.
|
|
212
|
+
drive(queue.length > 0 ? queue.shift() : deferred.shift())
|
|
210
213
|
}
|
|
211
214
|
```
|
|
212
215
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -203,6 +203,7 @@ exports.module = function* (url, source, attributes, artifacts, visited, opts =
|
|
|
203
203
|
if (opts.contexts === undefined) opts = { ...opts, contexts: new Map() }
|
|
204
204
|
if (opts.addonContexts === undefined) opts = { ...opts, addonContexts: new Map() }
|
|
205
205
|
if (opts.resolvedImports === undefined) opts = { ...opts, resolvedImports: new Map() }
|
|
206
|
+
if (opts.lexers === undefined) opts = { ...opts, lexers: new Map() }
|
|
206
207
|
|
|
207
208
|
// The host and WASI attributes set the context that the addons of the module
|
|
208
209
|
// and everything it imports load in. A graph is walked again for each context
|
|
@@ -338,6 +339,8 @@ exports.module = function* (url, source, attributes, artifacts, visited, opts =
|
|
|
338
339
|
...opts,
|
|
339
340
|
importType: 0
|
|
340
341
|
})
|
|
342
|
+
|
|
343
|
+
opts.lexers.set(url.href, lexer)
|
|
341
344
|
} else if (type === constants.ADDON && artifacts !== null) {
|
|
342
345
|
yield* exports.addons(url, artifacts, visited, opts)
|
|
343
346
|
}
|
|
@@ -425,11 +428,13 @@ exports.preresolved = function* (
|
|
|
425
428
|
|
|
426
429
|
const parentURL = url
|
|
427
430
|
|
|
431
|
+
const { lexers = null } = opts
|
|
432
|
+
|
|
428
433
|
// The resolutions map leaves out the import attributes, so they are read
|
|
429
|
-
// from the source instead.
|
|
434
|
+
// from the source instead, unless another context already lexed it.
|
|
430
435
|
const lexed =
|
|
431
436
|
opts.asset !== true && isJavaScript(moduleType(url, attributes, null, opts))
|
|
432
|
-
? lex(source)
|
|
437
|
+
? (lexers !== null && lexers.get(url.href)) || lex(source)
|
|
433
438
|
: null
|
|
434
439
|
|
|
435
440
|
let info = null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bare-module-traverse",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "Low-level module graph traversal for Bare",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/holepunchto/bare-module-traverse#readme",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"bare-addon-resolve": "^1.
|
|
57
|
+
"bare-addon-resolve": "^1.11.0",
|
|
58
58
|
"bare-bundle": "^1.11.0",
|
|
59
59
|
"bare-mime": "^1.0.0",
|
|
60
60
|
"bare-module-lexer": "^1.6.0",
|