bare-module 3.2.1 → 3.3.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/README.md +2 -0
- package/index.js +31 -11
- 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/README.md
CHANGED
package/index.js
CHANGED
|
@@ -234,7 +234,7 @@ const Module = module.exports = exports = class Module {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
static _extensions = Object.create(null)
|
|
237
|
-
static
|
|
237
|
+
static _protocol = null
|
|
238
238
|
static _cache = module.cache || Object.create(null)
|
|
239
239
|
static _modules = new Set()
|
|
240
240
|
static _conditions = ['bare', 'node']
|
|
@@ -353,9 +353,9 @@ const Module = module.exports = exports = class Module {
|
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
-
static
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
static get protocol () {
|
|
357
|
+
return this._protocol
|
|
358
|
+
}
|
|
359
359
|
|
|
360
360
|
static get cache () {
|
|
361
361
|
return this._cache
|
|
@@ -378,7 +378,7 @@ const Module = module.exports = exports = class Module {
|
|
|
378
378
|
defaultType = referrer ? referrer._defaultType : 0,
|
|
379
379
|
cache = referrer ? referrer._cache : self._cache,
|
|
380
380
|
main = referrer ? referrer._main : null,
|
|
381
|
-
protocol = referrer ? referrer._protocol : self.
|
|
381
|
+
protocol = referrer ? referrer._protocol : self._protocol,
|
|
382
382
|
imports = referrer ? referrer._imports : null,
|
|
383
383
|
resolutions = referrer ? referrer._resolutions : null,
|
|
384
384
|
builtins = referrer ? referrer._builtins : null,
|
|
@@ -435,7 +435,7 @@ const Module = module.exports = exports = class Module {
|
|
|
435
435
|
isImport = false,
|
|
436
436
|
|
|
437
437
|
referrer = null,
|
|
438
|
-
protocol = referrer ? referrer._protocol : self.
|
|
438
|
+
protocol = referrer ? referrer._protocol : self._protocol,
|
|
439
439
|
imports = referrer ? referrer._imports : null,
|
|
440
440
|
resolutions = referrer ? referrer._resolutions : null,
|
|
441
441
|
builtins = referrer ? referrer._builtins : null,
|
|
@@ -507,6 +507,11 @@ const Module = module.exports = exports = class Module {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
+
exports.Protocol = Protocol
|
|
511
|
+
exports.Bundle = Bundle
|
|
512
|
+
|
|
513
|
+
exports.constants = constants
|
|
514
|
+
|
|
510
515
|
// For Node.js compatibility
|
|
511
516
|
exports.builtinModules = []
|
|
512
517
|
|
|
@@ -534,7 +539,7 @@ const createRequire = exports.createRequire = function createRequire (parentURL,
|
|
|
534
539
|
defaultType = referrer ? referrer._defaultType : constants.types.SCRIPT,
|
|
535
540
|
cache = referrer ? referrer._cache : self._cache,
|
|
536
541
|
main = referrer ? referrer._main : null,
|
|
537
|
-
protocol = referrer ? referrer._protocol : self.
|
|
542
|
+
protocol = referrer ? referrer._protocol : self._protocol,
|
|
538
543
|
imports = referrer ? referrer._imports : null,
|
|
539
544
|
resolutions = referrer ? referrer._resolutions : null,
|
|
540
545
|
builtins = referrer ? referrer._builtins : null,
|
|
@@ -724,17 +729,32 @@ Module._extensions['.bundle'] = function (module, source, referrer) {
|
|
|
724
729
|
}
|
|
725
730
|
}
|
|
726
731
|
|
|
727
|
-
Module.
|
|
732
|
+
Module._protocol = new Protocol({
|
|
728
733
|
postresolve (url) {
|
|
729
|
-
|
|
734
|
+
switch (url.protocol) {
|
|
735
|
+
case 'file:':
|
|
736
|
+
return pathToFileURL(binding.realpath(fileURLToPath(url)))
|
|
737
|
+
default:
|
|
738
|
+
return url
|
|
739
|
+
}
|
|
730
740
|
},
|
|
731
741
|
|
|
732
742
|
exists (url) {
|
|
733
|
-
|
|
743
|
+
switch (url.protocol) {
|
|
744
|
+
case 'file:':
|
|
745
|
+
return binding.exists(fileURLToPath(url))
|
|
746
|
+
default:
|
|
747
|
+
return false
|
|
748
|
+
}
|
|
734
749
|
},
|
|
735
750
|
|
|
736
751
|
read (url) {
|
|
737
|
-
|
|
752
|
+
switch (url.protocol) {
|
|
753
|
+
case 'file:':
|
|
754
|
+
return Buffer.from(binding.read(fileURLToPath(url)))
|
|
755
|
+
default:
|
|
756
|
+
throw errors.UNKNOWN_PROTOCOL(`Cannot load module '${url.href}'`)
|
|
757
|
+
}
|
|
738
758
|
}
|
|
739
759
|
})
|
|
740
760
|
|
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
|