moog-require
Advanced tools
Comparing version 1.1.0 to 1.1.1
15
index.js
@@ -7,2 +7,4 @@ var async = require('async'); | ||
var glob = require('glob'); | ||
var importFresh = require('import-fresh'); | ||
var resolveFrom = require('resolve-from'); | ||
@@ -28,3 +30,3 @@ module.exports = function(options) { | ||
} | ||
var bundle = require(bundlePath); | ||
var bundle = importFresh(bundlePath); | ||
if (!bundle.moogBundle) { | ||
@@ -66,3 +68,3 @@ throw 'The configured bundle ' + bundleName + ' does not export a moogBundle property.'; | ||
if (fs.existsSync(projectLevelPath)) { | ||
projectLevelDefinition = self.root.require(projectLevelPath); | ||
projectLevelDefinition = importFresh(resolveFrom(path.dirname(self.root.filename), projectLevelPath)); | ||
} | ||
@@ -79,5 +81,3 @@ | ||
if (npmPath) { | ||
// Make a shallow clone so we can be part of multiple chains | ||
// in multiple moog objects without leakage | ||
npmDefinition = _.clone(require(npmPath)); | ||
npmDefinition = importFresh(npmPath); | ||
npmDefinition.__meta = { | ||
@@ -118,5 +118,4 @@ npm: true, | ||
// Make a shallow clone so we can be part of multiple chains | ||
// in multiple moog objects without leakage | ||
projectLevelDefinition = _.clone(projectLevelDefinition || {}); | ||
projectLevelDefinition = projectLevelDefinition || {}; | ||
projectLevelDefinition.__meta = { | ||
@@ -123,0 +122,0 @@ dirname: path.dirname(projectLevelPath), |
{ | ||
"name": "moog-require", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "moog-require extends moog with support for type definitions in local files and npm modules.", | ||
@@ -9,5 +9,7 @@ "main": "index.js", | ||
"glob": "^7.1.3", | ||
"import-fresh": "^3.0.0", | ||
"lodash": "^4.0.0", | ||
"moog": "^1.0.0", | ||
"resolve": "^1.7.1" | ||
"resolve": "^1.7.1", | ||
"resolve-from": "^4.0.0" | ||
}, | ||
@@ -14,0 +16,0 @@ "devDependencies": { |
@@ -351,2 +351,8 @@ [![Build Status](https://travis-ci.org/punkave/moog-require.svg?branch=master)](https://travis-ci.org/punkave/moog-require) | ||
1.1.1: use `importFresh` to avoid bugs when two instances of `moog-require` are | ||
loading the same module definitions. Previously if modules created by | ||
the two instances later modified sub-properties of `options`, they would | ||
inadvertently share values. This fix is critical for both `apostrophe-monitor` | ||
and `apostrophe-multisite`. | ||
1.1.0: support for the `nestedModuleSubdirs` option. | ||
@@ -353,0 +359,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
48559
373
1
7
1013
+ Addedimport-fresh@^3.0.0
+ Addedresolve-from@^4.0.0
+ Addedcallsites@3.1.0(transitive)
+ Addedimport-fresh@3.3.0(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedresolve-from@4.0.0(transitive)