bare-module 7.3.0 → 7.4.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 +7 -2
- package/index.js +7 -2
- 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,4 +1,5 @@
|
|
|
1
1
|
import Buffer from 'bare-buffer'
|
|
2
|
+
import Bundle from 'bare-bundle'
|
|
2
3
|
import URL from 'bare-url'
|
|
3
4
|
import { ResolutionsMap } from 'bare-module-resolve'
|
|
4
5
|
import { constants } from 'bare-module-traverse'
|
|
@@ -151,7 +152,7 @@ declare namespace Module {
|
|
|
151
152
|
export function load(url: URL, opts: LoadOptions): Promise<Module>
|
|
152
153
|
export function load(
|
|
153
154
|
url: URL,
|
|
154
|
-
source?: Buffer | string | null,
|
|
155
|
+
source?: Buffer | Bundle | string | null,
|
|
155
156
|
opts?: LoadOptions
|
|
156
157
|
): Promise<Module>
|
|
157
158
|
|
|
@@ -169,7 +170,11 @@ declare namespace Module {
|
|
|
169
170
|
* the requested `type`.
|
|
170
171
|
*/
|
|
171
172
|
export function loadSync(url: URL, opts: LoadOptions): Module
|
|
172
|
-
export function loadSync(
|
|
173
|
+
export function loadSync(
|
|
174
|
+
url: URL,
|
|
175
|
+
source?: Buffer | Bundle | string | null,
|
|
176
|
+
opts?: LoadOptions
|
|
177
|
+
): Module
|
|
173
178
|
|
|
174
179
|
/**
|
|
175
180
|
* Resolve the module `specifier` relative to the `parentURL`. `specifier` is a string and
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { isURL, pathToFileURL } = require('bare-url')
|
|
2
|
+
const Bundle = require('bare-bundle')
|
|
2
3
|
const { constants } = require('bare-module-traverse')
|
|
3
4
|
const Module = require('./lib/module')
|
|
4
5
|
const ModuleProtocol = require('./lib/protocol')
|
|
@@ -15,7 +16,7 @@ exports.constants = constants
|
|
|
15
16
|
exports.load = async function load(url, source = null, opts = {}) {
|
|
16
17
|
if (typeof url === 'string') url = new URL(url)
|
|
17
18
|
|
|
18
|
-
if (source !== null &&
|
|
19
|
+
if (source !== null && !isSource(source)) {
|
|
19
20
|
opts = source
|
|
20
21
|
source = null
|
|
21
22
|
}
|
|
@@ -32,7 +33,7 @@ exports.load = async function load(url, source = null, opts = {}) {
|
|
|
32
33
|
exports.loadSync = function loadSync(url, source = null, opts = {}) {
|
|
33
34
|
if (typeof url === 'string') url = new URL(url)
|
|
34
35
|
|
|
35
|
-
if (source !== null &&
|
|
36
|
+
if (source !== null && !isSource(source)) {
|
|
36
37
|
opts = source
|
|
37
38
|
source = null
|
|
38
39
|
}
|
|
@@ -102,6 +103,10 @@ function assertURL(url, name) {
|
|
|
102
103
|
throw new TypeError(`${name} must be a URL. Received type ${typeof url} (${url})`)
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
function isSource(value) {
|
|
107
|
+
return typeof value === 'string' || ArrayBuffer.isView(value) || Bundle.isBundle(value)
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
function optionsFor(opts) {
|
|
106
111
|
if (opts === undefined || opts === null) return {}
|
|
107
112
|
|
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
|