[Pkg-javascript-commits] [node-regjsparser] 01/02: Use sed and not a require so parser.js still works in a browser
Julien Puydt
julien.puydt at laposte.net
Sat Sep 9 14:17:03 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-regjsparser.
commit ad4f66a2a3182661bd1f8d431bbc13c090acd1da
Author: Julien Puydt <julien.puydt at laposte.net>
Date: Sat Sep 9 16:01:43 2017 +0200
Use sed and not a require so parser.js still works in a browser
---
debian/install | 3 +--
debian/patches/adapt_generate_identifier_regex.patch | 8 +++-----
debian/patches/use_own_identifier_regex.patch | 2 +-
debian/rules | 7 +++++--
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/debian/install b/debian/install
index dfd1119..33a9101 100644
--- a/debian/install
+++ b/debian/install
@@ -1,4 +1,3 @@
package.json usr/lib/nodejs/regjsparser/
-parser.js usr/lib/nodejs/regjsparser/
-identifier-regex.js usr/lib/nodejs/regjsparser/
+dist/parser.js usr/lib/nodejs/regjsparser/
bin usr/lib/nodejs/regjsparser/
diff --git a/debian/patches/adapt_generate_identifier_regex.patch b/debian/patches/adapt_generate_identifier_regex.patch
index c0cca4c..00a5b00 100644
--- a/debian/patches/adapt_generate_identifier_regex.patch
+++ b/debian/patches/adapt_generate_identifier_regex.patch
@@ -1,17 +1,15 @@
-Description: don't use a copy-pasted pregenerated regex
+Description: adapt the generator to have the data we want
Author: Julien Puydt
Forwarded: yes
--- a/tools/generate-identifier-regex.js
+++ b/tools/generate-identifier-regex.js
-@@ -45,7 +45,7 @@
+@@ -45,7 +45,5 @@
// result.NonAsciiIdentifierStart
// );
console.log(
- '// ECMAScript 5.1/Unicode v%s NonAsciiIdentifierPart:\n\n%s',
- version,
- result.NonAsciiIdentifierPart,
-+ "var main ='"
-+ +result.NonAsciiIdentifierPart
-+ +"'; module.exports = main"
++ result.NonAsciiIdentifierPart
);
diff --git a/debian/patches/use_own_identifier_regex.patch b/debian/patches/use_own_identifier_regex.patch
index d602665..a134e4e 100644
--- a/debian/patches/use_own_identifier_regex.patch
+++ b/debian/patches/use_own_identifier_regex.patch
@@ -9,7 +9,7 @@ Forwarded: no
function isIdentifierPart(ch) {
// Generated by `tools/generate-identifier-regex.js`.
- var NonAsciiIdentifierPart = new RegExp('[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5 [...]
-+ var NonAsciiIdentifierPart = new RegExp(require('./identifier-regex'));
++ var NonAsciiIdentifierPart = new RegExp('@debian-identifier-regex@');
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
diff --git a/debian/rules b/debian/rules
index 818e9b3..07a8fb1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,7 +4,10 @@
dh $@
override_dh_auto_build:
- node tools/generate-identifier-regex.js > identifier-regex.js
+ mkdir dist
+ node tools/generate-identifier-regex.js > dist/debian-identifier-regex
+ cp parser.js dist/
+ sed -i dist/parser.js -e "s/@debian-identifier-regex@/$$(cat dist/debian-identifier-regex)/g"
override_dh_auto_clean:
- rm -f identifier-regex.js
+ rm -rf dist
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-regjsparser.git
More information about the Pkg-javascript-commits
mailing list