bare-module 7.0.3 → 7.1.0
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/index.d.ts +6 -0
- package/lib/loader.js +10 -13
- package/lib/module.js +4 -0
- package/package.json +1 -1
- package/prebuilds/android-arm/bare-module.bare +0 -0
- package/prebuilds/android-arm64/bare-module.bare +0 -0
- package/prebuilds/android-ia32/bare-module.bare +0 -0
- package/prebuilds/android-x64/bare-module.bare +0 -0
- package/prebuilds/darwin-arm64/bare-module.bare +0 -0
- package/prebuilds/darwin-x64/bare-module.bare +0 -0
- package/prebuilds/ios-arm64/bare-module.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-module.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-module.bare +0 -0
- package/prebuilds/linux-arm64/bare-module.bare +0 -0
- package/prebuilds/linux-x64/bare-module.bare +0 -0
- package/prebuilds/win32-arm64/bare-module.bare +0 -0
- package/prebuilds/win32-x64/bare-module.bare +0 -0
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Buffer from 'bare-buffer'
|
|
2
2
|
import URL from 'bare-url'
|
|
3
|
+
import { ResolutionsMap } from 'bare-module-resolve'
|
|
3
4
|
import { constants } from 'bare-module-traverse'
|
|
4
5
|
import Protocol from './lib/protocol'
|
|
5
6
|
import Loader from './lib/loader'
|
|
@@ -38,6 +39,11 @@ interface Module {
|
|
|
38
39
|
* [Protocols](https://github.com/holepunchto/bare-module#protocols) for usage.
|
|
39
40
|
*/
|
|
40
41
|
readonly protocol: Protocol
|
|
42
|
+
/**
|
|
43
|
+
* The resolutions map of the module graph, with keys being serialized parent URLs and values
|
|
44
|
+
* being `"imports"` maps.
|
|
45
|
+
*/
|
|
46
|
+
readonly resolutions: ResolutionsMap
|
|
41
47
|
/** The WHATWG `URL` identifier of the module. */
|
|
42
48
|
readonly url: URL
|
|
43
49
|
}
|
package/lib/loader.js
CHANGED
|
@@ -450,6 +450,7 @@ module.exports = class ModuleLoader {
|
|
|
450
450
|
engines,
|
|
451
451
|
...opts,
|
|
452
452
|
deferUnresolved: true,
|
|
453
|
+
resolutions: this._resolutions,
|
|
453
454
|
packages: this._packages,
|
|
454
455
|
prefixes: this._prefixes,
|
|
455
456
|
resolve: traverse.resolve.bare
|
|
@@ -559,6 +560,10 @@ module.exports = class ModuleLoader {
|
|
|
559
560
|
_linkBundle(bundle) {
|
|
560
561
|
this._bundles.push(bundle)
|
|
561
562
|
|
|
563
|
+
for (const href in bundle.resolutions) {
|
|
564
|
+
if (href in this._resolutions === false) this._resolutions[href] = bundle.resolutions[href]
|
|
565
|
+
}
|
|
566
|
+
|
|
562
567
|
const protocol = this._protocol.extend({
|
|
563
568
|
exists(context, url) {
|
|
564
569
|
if (bundleOwns(bundle, url)) return true
|
|
@@ -601,13 +606,7 @@ module.exports = class ModuleLoader {
|
|
|
601
606
|
}
|
|
602
607
|
})
|
|
603
608
|
|
|
604
|
-
this._linkSync(
|
|
605
|
-
this._root(new URL(bundle.main), null, {
|
|
606
|
-
imports: bundle.imports,
|
|
607
|
-
resolutions: bundle.resolutions
|
|
608
|
-
}),
|
|
609
|
-
protocol
|
|
610
|
-
)
|
|
609
|
+
this._linkSync(this._root(new URL(bundle.main), null, { imports: bundle.imports }), protocol)
|
|
611
610
|
}
|
|
612
611
|
|
|
613
612
|
_ingest(dependency) {
|
|
@@ -749,13 +748,11 @@ module.exports = class ModuleLoader {
|
|
|
749
748
|
}
|
|
750
749
|
|
|
751
750
|
_cacheResolution(parentURL, specifier, condition, url) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
if (typeof imports !== 'object' || imports === null) {
|
|
755
|
-
imports = this._resolutions[parentURL.href] = Object.create(null)
|
|
756
|
-
}
|
|
751
|
+
const imports = this._resolutions[parentURL.href]
|
|
757
752
|
|
|
758
|
-
|
|
753
|
+
// An entry is taken as every import of its module when that module is
|
|
754
|
+
// linked, so none is started for a module that isn't linked yet.
|
|
755
|
+
if (typeof imports !== 'object' || imports === null || specifier in imports) return
|
|
759
756
|
|
|
760
757
|
imports[specifier] = { [condition]: url.href }
|
|
761
758
|
}
|
package/lib/module.js
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|