Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

moog-require

Package Overview
Dependencies
28
Maintainers
12
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

test/node_modules/@test/test/index.js

12

index.js

@@ -44,2 +44,7 @@ var async = require('async');

var superDefine = self.define;
if (options.nestedModuleSubdirs) {
self._globCache = {};
}
self.define = function(type, definition, extending) {

@@ -60,3 +65,8 @@

if (options.nestedModuleSubdirs) {
var matches = glob.sync(self.options.localModules + '/**/' + type + '/index.js');
var globOptions = {
cache: self._globCache
};
var matches = glob.sync(self.options.localModules + '/**/' + type + '/index.js', globOptions);
if (matches.length > 1) {

@@ -63,0 +73,0 @@ throw new Error('The module ' + type + ' appears in multiple locations:\n' + matches.join('\n'));

2

package.json
{
"name": "moog-require",
"version": "2.1.0",
"version": "2.2.0",
"description": "moog-require extends moog with support for type definitions in local files and npm modules.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -351,2 +351,4 @@ [![Build Status](https://travis-ci.org/punkave/moog-require.svg?branch=master)](https://travis-ci.org/punkave/moog-require)

2.2.0: implemented glob cache to avoid repeated filesystem operations when `nestedModuleDirs` is in use.
2.1.0: use `originalToMy` method of moog 2.1.0 to ensure npm namespaces behave sensibly in class names.

@@ -353,0 +355,0 @@

module.exports = {
moogBundle: {
modules: ['bundleModuleOne', 'bundleModuleTwo'],
modules: [ 'bundleModuleOne', 'bundleModuleTwo', '@scoped/bundleModule' ],
directory: 'localModules'
}
};

@@ -555,2 +555,20 @@ const assert = require('assert');

describe('scoped bundles', function() {
it('should expose npm-style scoped modules via a bundle', async function() {
let synth = require('../index.js')({
localModules: __dirname + '/project_modules',
root: module,
bundles: [ 'testBundle' ]
});
synth.define({
'@scoped/bundleModule': { }
});
const modules = await createAll(synth, {}, {});
assert(modules['@scoped/bundleModule']);
assert(modules['@scoped/bundleModule'].scopedBundledModulesWork);
});
});
describe('metadata', function() {

@@ -649,2 +667,25 @@ it('should expose correct dirname metadata for npm, project level, and explicitly defined classes in the chain', async function() {

describe('scoped npm modules', function() {
it('should instantiate a scoped module from npm', async function() {
let synth = require('../index.js')({
localModules: __dirname + '/project_modules',
nestedModuleSubdirs: true,
root: module
});
synth.define({
'@test/test': {
construct: function(self, options) {
self.localWorked = true;
}
}
}
);
let instance = await synth.create('@test/test', {});
assert(instance);
assert(instance.localWorked);
assert(instance.npmWorked);
});
});
describe('nestedModuleSubdirs option', function() {

@@ -676,2 +717,13 @@ it('should load a module from a regular folder without the nesting feature enabled', async function() {

});
it('should create a glob cache for nested modules', async function() {
let synth = require('../index.js')({
localModules: __dirname + '/project_modules',
nestedModuleSubdirs: true,
root: module
});
assert(Object.keys(synth._globCache).length === 0);
synth.define('nestedModule');
assert(Object.keys(synth._globCache).length > 0);
});
});

@@ -678,0 +730,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc