[Pkg-javascript-commits] [node-require-dir] 01/03: New upstream version 0.3.1
Thorsten Alteholz
alteholz at moszumanska.debian.org
Sat Nov 5 11:27:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-require-dir.
commit 4170a96864def03262fb87b8c19607ec204ff5c0
Author: Thorsten Alteholz <debian at alteholz.de>
Date: Sat Nov 5 12:12:01 2016 +0100
New upstream version 0.3.1
---
.travis.yml | 6 +++---
index.js | 6 ++++++
package.json | 4 +++-
test/simple.js | 10 ++++++++++
test/simple/e.ts | 1 +
test/simple/f.d.ts | 1 +
6 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 6064ca0..b9879cc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- - "0.10"
- - "0.12"
- - "iojs"
+ - "6"
+ - "5"
+ - "4"
diff --git a/index.js b/index.js
index d923b98..a4122be 100644
--- a/index.js
+++ b/index.js
@@ -103,6 +103,12 @@ module.exports = function requireDir(dir, opts) {
var path = filesMinusDirs[file];
if (path) {
+ // ignore TypeScript declaration files. They should never be
+ // `require`d
+ if (/\.d\.ts$/.test(path)) {
+ continue;
+ }
+
// if duplicates are wanted, key off the full name always, and
// also the base if it hasn't been taken yet (since this ext
// has higher priority than any that follow it). if duplicates
diff --git a/package.json b/package.json
index c0a4973..a907c93 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,14 @@
{ "name": "require-dir"
, "description": "Helper to require() directories."
-, "version": "0.3.0"
+, "version": "0.3.1"
, "author": "Aseem Kishore <aseem.kishore at gmail.com>"
, "license": "MIT"
, "dependencies": {}
, "devDependencies":
{ "coffee-script": "~1.3.3"
, "mkdirp": "^0.5.0"
+ , "ts-node": "^1.3.0"
+ , "typescript": "^1.8.0"
}
, "engines":
{ "node": "*"
diff --git a/test/simple.js b/test/simple.js
index 31e9458..7fea2c5 100644
--- a/test/simple.js
+++ b/test/simple.js
@@ -17,4 +17,14 @@ assert.deepEqual(requireDir('./simple'), {
c: 'c',
});
+// now register TypeScript and do it again:
+// note that we include typescript files but not declarations.
+require('ts-node/register');
+assert.deepEqual(requireDir('./simple'), {
+ a: 'a',
+ b: 'b',
+ c: 'c',
+ e: 'e',
+});
+
console.log('Simple tests passed.');
diff --git a/test/simple/e.ts b/test/simple/e.ts
new file mode 100644
index 0000000..bd0c424
--- /dev/null
+++ b/test/simple/e.ts
@@ -0,0 +1 @@
+export = 'e';
diff --git a/test/simple/f.d.ts b/test/simple/f.d.ts
new file mode 100644
index 0000000..e60ad98
--- /dev/null
+++ b/test/simple/f.d.ts
@@ -0,0 +1 @@
+export const foo: 'bar';
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-require-dir.git
More information about the Pkg-javascript-commits
mailing list