Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

moog-require

Package Overview
Dependencies
Maintainers
12
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moog-require - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

30

index.js

@@ -18,2 +18,4 @@ var async = require('async');

self.bundled = {};
self.improvements = {};

@@ -43,2 +45,4 @@ if (self.options.bundles) {

var result;
// For the define-many-at-once case let the base class do the work

@@ -51,2 +55,3 @@ if (typeof(type) === 'object') {

var npmDefinition;
var originalType;

@@ -77,7 +82,11 @@ var projectLevelFolder = self.options.localModules + '/' + type;

if (npmDefinition.improve) {
// Remember which types were actually improvements of other types for
// the benefit of applications that would otherwise instantiate them all
self.improvements[type] = true;
// Improve an existing type with an implicit subclass,
// rather than defining one under a new name
originalType = type;
type = npmDefinition.improve;
// If necessary, start by autoloading the original type
if (!self.isDefined(type)) {
if (!self.isDefined(type, { autoload: false })) {
self.define(type);

@@ -115,5 +124,16 @@ }

if (npmDefinition) {
superDefine(type, npmDefinition);
result = superDefine(type, npmDefinition);
if (npmDefinition.improve) {
// Restore the name of the improving module as otherwise our asset chains have
// multiple references to my-foo which is ambiguous
result.__meta.name = originalType;
}
}
return superDefine(type, definition);
result = superDefine(type, definition);
if (npmDefinition && npmDefinition.improve) {
// Restore the name of the improving module as otherwise our asset chains have
// multiple references to my-foo which is ambiguous
result.__meta.name = 'my-' + originalType;
}
return result;
};

@@ -134,2 +154,6 @@

}
self.isImprovement = function(name) {
return _.has(self.improvements, name);
};

@@ -136,0 +160,0 @@ return self;

2

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

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

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

synth.define({
'scary-monsters`: { ... configuration ... }
'scary-monsters': { ... configuration ... }
});

@@ -250,3 +250,3 @@

synth.define({
'scary-monsters`: { ... configuration ... }
'scary-monsters': { ... configuration ... }
});

@@ -342,2 +342,4 @@

0.4.0: added `isImprovement` method which returns true if a type name turned out to be an improvement of another type via the `improve` keyword. This is useful when you wish to instantiate all of the types except for those that are just improvements of others.
0.3.0: introduced the `replace` and `improve` options, which allow an npm module to substitute itself for another moog type completely, or enhance it via implicit subclassing. This is useful when releasing a drop-in replacement for a well-known module.

@@ -344,0 +346,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc