bare-module 3.1.10 → 3.1.11

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.
Files changed (2) hide show
  1. package/index.js +23 -23
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -373,33 +373,33 @@ const Module = module.exports = exports = class Module {
373
373
 
374
374
  const module = cache[url.href] = new Module(url)
375
375
 
376
- switch (url.protocol) {
377
- case 'builtin:':
378
- module._exports = builtins[url.pathname]
379
- break
376
+ try {
377
+ switch (url.protocol) {
378
+ case 'builtin:':
379
+ module._exports = builtins[url.pathname]
380
+ break
380
381
 
381
- default: {
382
- module._defaultType = defaultType
383
- module._cache = cache
384
- module._main = main || module
385
- module._protocol = protocol
386
- module._imports = imports
387
- module._resolutions = resolutions
388
- module._builtins = builtins
389
- module._conditions = conditions
390
-
391
- let extension = self._extensionFor(type) || path.extname(url.pathname)
392
-
393
- if (extension in self._extensions === false) {
394
- if (defaultType) extension = self._extensionFor(defaultType) || '.js'
395
- else extension = '.js'
396
- }
382
+ default: {
383
+ module._defaultType = defaultType
384
+ module._cache = cache
385
+ module._main = main || module
386
+ module._protocol = protocol
387
+ module._imports = imports
388
+ module._resolutions = resolutions
389
+ module._builtins = builtins
390
+ module._conditions = conditions
391
+
392
+ let extension = self._extensionFor(type) || path.extname(url.pathname)
393
+
394
+ if (extension in self._extensions === false) {
395
+ if (defaultType) extension = self._extensionFor(defaultType) || '.js'
396
+ else extension = '.js'
397
+ }
397
398
 
398
- self._extensions[extension](module, source, referrer)
399
+ self._extensions[extension](module, source, referrer)
400
+ }
399
401
  }
400
- }
401
402
 
402
- try {
403
403
  return module._transform(isImport, isDynamicImport)
404
404
  } catch (err) {
405
405
  delete cache[url.href]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [