Comparing version 1.2.0 to 2.0.0
73
index.js
@@ -0,1 +1,10 @@ | ||
var path = require('path'); | ||
var endsInBabelJs = /\.babel\.[jt]s(x)$/; | ||
function ignoreNonBabelAndNodeModules(file) { | ||
return !endsInBabelJs.test(file) && | ||
path.relative(process.cwd(), file).split(path.sep).indexOf('node_modules') >= 0; | ||
} | ||
var extensions = { | ||
@@ -6,5 +15,7 @@ '.babel.js': [ | ||
register: function(hook) { | ||
// register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353 | ||
// which only captures the final extension (.babel.js -> .js) | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -15,3 +26,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -22,3 +36,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -29,3 +46,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -38,3 +58,7 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.ts' }); | ||
hook({ | ||
extensions: '.ts', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -65,3 +89,3 @@ }, | ||
'.json': null, | ||
'.json5': 'json5/lib/require', | ||
'.json5': ['json5/lib/register', 'json5/lib/require'], | ||
'.jsx': [ | ||
@@ -71,3 +95,7 @@ { | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -78,3 +106,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -85,3 +116,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -92,3 +126,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -121,3 +158,7 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.ts' }); | ||
hook({ | ||
extensions: '.ts', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -132,3 +173,7 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.tsx' }); | ||
hook({ | ||
extensions: '.tsx', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -135,0 +180,0 @@ }, |
{ | ||
"name": "interpret", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "A dictionary of file extensions and associated module loaders.", | ||
@@ -24,15 +24,15 @@ "author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)", | ||
"test": "mocha --async-only", | ||
"cover": "istanbul cover _mocha --report lcovonly", | ||
"coveralls": "npm run cover && istanbul-coveralls" | ||
"cover": "nyc --reporter=lcov --reporter=text-summary npm test", | ||
"coveralls": "nyc --reporter=text-lcov npm test | coveralls" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"coveralls": "github:phated/node-coveralls#2.x", | ||
"eslint": "^2.13.0", | ||
"eslint-config-gulp": "^3.0.1", | ||
"expect": "^1.20.2", | ||
"istanbul": "^0.4.3", | ||
"istanbul-coveralls": "^1.0.3", | ||
"mocha": "^3.5.3", | ||
"parse-node-version": "^1.0.0", | ||
"rechoir": "^0.6.2", | ||
"rechoir": "^0.7.0", | ||
"nyc": "^10.3.2", | ||
"shelljs": "0.7.5" | ||
@@ -39,0 +39,0 @@ }, |
@@ -16,2 +16,8 @@ <p align="center"> | ||
## interpret for enterprise | ||
Available as part of the Tidelift Subscription | ||
The maintainers of interpret and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-interpret?utm_source=npm-interpret&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) | ||
## API | ||
@@ -28,5 +34,7 @@ | ||
register: function(hook) { | ||
// register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353 | ||
// which only captures the final extension (.babel.js -> .js) | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -37,3 +45,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -44,3 +55,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -51,3 +65,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.js' }); | ||
hook({ | ||
extensions: '.js', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -60,3 +77,7 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.ts' }); | ||
hook({ | ||
extensions: '.ts', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -87,3 +108,3 @@ }, | ||
'.json': null, | ||
'.json5': 'json5/lib/require', | ||
'.json5': ['json5/lib/register', 'json5/lib/require'], | ||
'.jsx': [ | ||
@@ -93,3 +114,7 @@ { | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -100,3 +125,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -107,3 +135,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -114,3 +145,6 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.jsx' }); | ||
hook({ | ||
extensions: '.jsx', | ||
ignore: ignoreNonBabelAndNodeModules, | ||
}); | ||
}, | ||
@@ -143,3 +177,7 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.ts' }); | ||
hook({ | ||
extensions: '.ts', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -154,3 +192,7 @@ }, | ||
register: function(hook) { | ||
hook({ extensions: '.tsx' }); | ||
hook({ | ||
extensions: '.tsx', | ||
rootMode: 'upward-optional', | ||
ignore: [ignoreNonBabelAndNodeModules], | ||
}); | ||
}, | ||
@@ -157,0 +199,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
16910
200
227