[Pkg-javascript-commits] [node-es6-module-transpiler] 01/05: Add patch for better module detection

Julien Puydt julien.puydt at laposte.net
Fri Jul 7 04:37:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-es6-module-transpiler.

commit dfb30ca11ee9c7bed3257c19101ac1d1e27434c8
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Wed Jul 5 17:45:55 2017 +0200

    Add patch for better module detection
---
 debian/changelog                         |  6 ++++++
 debian/patches/detect_module_index.patch | 19 +++++++++++++++++++
 debian/patches/series                    |  1 +
 lib/file_resolver.js                     |  6 ++++++
 4 files changed, 32 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index b1a7bea..8cd737c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-es6-module-transpiler (0.10.0-2) UNRELEASED; urgency=medium
+
+  * Add a patch for better module detection.
+
+ -- Julien Puydt <julien.puydt at laposte.net>  Wed, 05 Jul 2017 17:45:09 +0200
+
 node-es6-module-transpiler (0.10.0-1) unstable; urgency=low
 
   * Initial release (Closes: #802443)
diff --git a/debian/patches/detect_module_index.patch b/debian/patches/detect_module_index.patch
new file mode 100644
index 0000000..dd190de
--- /dev/null
+++ b/debian/patches/detect_module_index.patch
@@ -0,0 +1,19 @@
+Description: make imports work when the module is a module/index.js
+Author: Julien Puydt
+Forwarded: yes
+
+--- a/lib/file_resolver.js
++++ b/lib/file_resolver.js
+@@ -67,6 +67,12 @@
+   for (var i = 0, length = paths.length; i < length; i++) {
+     var includePath = paths[i];
+     var resolved = Path.resolve(includePath, importedPath);
++
++    var index = Path.join(resolved, 'index.js')
++    if (fs.existsSync(index)) {
++      return index;
++    }
++
+     if (!~resolved.lastIndexOf('.')) {
+       resolved += '.js';
+     }
diff --git a/debian/patches/series b/debian/patches/series
index 06ba3f3..043097d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
+detect_module_index.patch
 0001-On-Debian-systems-use-nodejs.patch
 0002-Workaround-for-upstream-issue-199.patch
diff --git a/lib/file_resolver.js b/lib/file_resolver.js
index d2b697d..7a83989 100644
--- a/lib/file_resolver.js
+++ b/lib/file_resolver.js
@@ -67,6 +67,12 @@ FileResolver.prototype.resolvePath = function(importedPath, fromModule) {
   for (var i = 0, length = paths.length; i < length; i++) {
     var includePath = paths[i];
     var resolved = Path.resolve(includePath, importedPath);
+
+    var index = Path.join(resolved, 'index.js')
+    if (fs.existsSync(index)) {
+      return index;
+    }
+
     if (!~resolved.lastIndexOf('.')) {
       resolved += '.js';
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-es6-module-transpiler.git



More information about the Pkg-javascript-commits mailing list