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

filing-cabinet

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filing-cabinet - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

44

index.js

@@ -47,2 +47,7 @@ var path = require('path');

var result = resolver(partial, filename, directory, config, webpackConfig);
if (result && !path.extname(result)) {
result = result + ext;
}
debug('resolved path for ' + partial + ': ' + result);

@@ -63,28 +68,41 @@ return result;

/**
* @private
* @param {String} partial
* Exposed for testing
*
* @param {String} config
* @param {String} webpackConfig
* @param {String} filename
* @param {String} directory
* @param {String} config
* @return {String}
*/
function jsLookup(partial, filename, directory, config, webpackConfig) {
var type;
module.exports._getJSType = function(config, webpackConfig, filename) {
if (config) {
type = 'amd';
return 'amd';
}
if (webpackConfig) {
type = 'webpack';
return 'webpack';
}
if (!type) {
type = getModuleType.sync(filename);
}
return getModuleType.sync(filename);
};
/**
* @private
* @param {String} partial
* @param {String} filename
* @param {String} directory
* @param {String} config
* @return {String}
*/
function jsLookup(partial, filename, directory, config, webpackConfig) {
var type = module.exports._getJSType(config, webpackConfig, filename);
switch (type) {
case 'amd':
debug('using amd resolver');
return amdLookup(config, partial, filename, directory);
return amdLookup({
config: config,
partial: partial,
filename: filename,
directory: directory
});

@@ -91,0 +109,0 @@ case 'commonjs':

{
"name": "filing-cabinet",
"version": "1.1.0",
"version": "1.2.0",
"description": "Find files based on partial paths",

@@ -49,3 +49,3 @@ "main": "index.js",

"module-definition": "~2.2.2",
"module-lookup-amd": "~2.0.4",
"module-lookup-amd": "~3.0.0",
"object-assign": "~4.0.1",

@@ -52,0 +52,0 @@ "resolve": "~1.1.7",

@@ -64,6 +64,5 @@ var assert = require('assert');

it('assumes amd for es6 modules with a requirejs config', function() {
var stub = sinon.stub();
var revert = cabinet.__set__('amdLookup', stub);
var spy = sinon.spy(cabinet, '_getJSType');
cabinet({
var result = cabinet({
partial: './bar',

@@ -73,9 +72,9 @@ filename: 'js/es6/foo.js',

config: {
baseUrl: 'js/'
baseUrl: './'
}
});
assert.ok(stub.called);
revert();
assert.ok(spy.called);
assert.equal(result, 'js/es6/bar.js');
spy.restore();
});

@@ -124,3 +123,3 @@ });

assert.equal(result.length, 0);
assert.equal(result, '');
});

@@ -240,3 +239,3 @@

assert.ok(stub.called);
assert.equal(path, 'foo');
assert.equal(path, 'foo.foobar');
});

@@ -243,0 +242,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