bare-module 4.6.1 → 4.6.3

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 CHANGED
@@ -32,6 +32,8 @@ const Module = module.exports = exports = class Module {
32
32
  this._names = null
33
33
  this._handle = null
34
34
 
35
+ Object.preventExtensions(this)
36
+
35
37
  Module._modules.add(this)
36
38
  }
37
39
 
@@ -247,11 +249,7 @@ const Module = module.exports = exports = class Module {
247
249
  const referrer = this._cache[referrerHref] || null
248
250
 
249
251
  if (referrer === null) {
250
- let msg = `Cannot find referrer for module '${href}'`
251
-
252
- if (referrerHref) msg += ` imported from '${referrerHref}'`
253
-
254
- throw errors.MODULE_NOT_FOUND(msg)
252
+ throw errors.MODULE_NOT_FOUND(`Cannot find referrer for module '${href}' imported from '${referrerHref}'`)
255
253
  }
256
254
 
257
255
  const url = this.resolve(href, referrer._url, { isImport: true, referrer, attributes })
@@ -467,11 +465,7 @@ const Module = module.exports = exports = class Module {
467
465
  }
468
466
  }
469
467
 
470
- let msg = `Cannot find module '${specifier}'`
471
-
472
- if (referrer) msg += ` imported from '${parentURL.href}'`
473
-
474
- throw errors.MODULE_NOT_FOUND(msg)
468
+ throw errors.MODULE_NOT_FOUND(`Cannot find module '${specifier}' imported from '${parentURL.href}'`)
475
469
 
476
470
  function readPackage (packageURL) {
477
471
  if (protocol.exists(packageURL)) {
@@ -513,11 +507,7 @@ const Module = module.exports = exports = class Module {
513
507
  }
514
508
  }
515
509
 
516
- let msg = `Cannot find asset '${specifier}'`
517
-
518
- if (referrer) msg += ` imported from '${parentURL.href}'`
519
-
520
- throw errors.ASSET_NOT_FOUND(msg)
510
+ throw errors.ASSET_NOT_FOUND(`Cannot find asset '${specifier}' imported from '${parentURL.href}'`)
521
511
 
522
512
  function readPackage (packageURL) {
523
513
  if (protocol.exists(packageURL)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-module",
3
- "version": "4.6.1",
3
+ "version": "4.6.3",
4
4
  "description": "Module support for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [