bare-module 2.6.3 → 2.7.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.js +14 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -218,6 +218,8 @@ const Module = module.exports = exports = class Module {
|
|
|
218
218
|
const referrer = module
|
|
219
219
|
const dirname = path.dirname(module._filename)
|
|
220
220
|
|
|
221
|
+
addon.host = Bare.Addon.host
|
|
222
|
+
|
|
221
223
|
meta.url = module._filename
|
|
222
224
|
meta.main = module._main === module
|
|
223
225
|
meta.resolve = resolve
|
|
@@ -283,6 +285,8 @@ const Module = module.exports = exports = class Module {
|
|
|
283
285
|
|
|
284
286
|
const dirname = path.dirname(module._filename)
|
|
285
287
|
|
|
288
|
+
addon.host = Bare.Addon.host
|
|
289
|
+
|
|
286
290
|
require.main = module._main
|
|
287
291
|
require.cache = self._cache
|
|
288
292
|
require.resolve = resolve
|
|
@@ -316,6 +320,10 @@ const Module = module.exports = exports = class Module {
|
|
|
316
320
|
static load (specifier, source = null, opts = {}) {
|
|
317
321
|
const self = Module
|
|
318
322
|
|
|
323
|
+
if (typeof specifier !== 'string') {
|
|
324
|
+
throw new TypeError(`Specifier must be a string. Received type ${typeof specifier} (${specifier})`)
|
|
325
|
+
}
|
|
326
|
+
|
|
319
327
|
if (!ArrayBuffer.isView(source) && typeof source !== 'string' && source !== null) {
|
|
320
328
|
opts = source
|
|
321
329
|
source = null
|
|
@@ -383,6 +391,10 @@ const Module = module.exports = exports = class Module {
|
|
|
383
391
|
static resolve (specifier, dirname = os.cwd(), opts = {}) {
|
|
384
392
|
const self = Module
|
|
385
393
|
|
|
394
|
+
if (typeof specifier !== 'string') {
|
|
395
|
+
throw new TypeError(`Specifier must be a string. Received type ${typeof specifier} (${specifier})`)
|
|
396
|
+
}
|
|
397
|
+
|
|
386
398
|
if (typeof dirname !== 'string') {
|
|
387
399
|
opts = dirname
|
|
388
400
|
dirname = os.cwd()
|
|
@@ -575,6 +587,8 @@ Module._extensions['.cjs'] = function (module, source, referrer) {
|
|
|
575
587
|
|
|
576
588
|
const dirname = path.dirname(module._filename)
|
|
577
589
|
|
|
590
|
+
addon.host = Bare.Addon.host
|
|
591
|
+
|
|
578
592
|
require.main = module._main
|
|
579
593
|
require.cache = self._cache
|
|
580
594
|
require.resolve = resolve
|