diff -Nru node-jsesc-2.5.2/debian/changelog node-jsesc-3.0.1/debian/changelog --- node-jsesc-2.5.2/debian/changelog 2018-11-13 20:46:38.000000000 +0000 +++ node-jsesc-3.0.1/debian/changelog 2020-05-29 08:33:54.000000000 +0000 @@ -1,14 +1,37 @@ +node-jsesc (3.0.1-1ubuntu1) groovy; urgency=medium + + * Increase test timeout to fix arm* slowliness + + -- Gianfranco Costamagna Fri, 29 May 2020 10:33:54 +0200 + +node-jsesc (3.0.1-1) unstable; urgency=medium + + [ Debian Janitor ] + * Trim trailing whitespace. + * Bump debhelper from old 11 to 12. + * Set debhelper-compat version in Build-Depends. + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + + [ Julien Puydt ] + * New upstream release. + * Bump std-vers to 4.5.0. + * Run upstream test suite. + * Install in /usr/share/nodejs and not /usr/lib/nodejs. + + -- Julien Puydt Sun, 12 Apr 2020 08:45:28 +0200 + node-jsesc (2.5.2-1) unstable; urgency=medium * New upstream release. * Refresh packaging: - Drop now-useless patch. - - Use my debian.org mail address. - - Bump dh compat to 11. - - Bump std-ver to 4.2.1. + - Use my debian.org mail address. + - Bump dh compat to 11. + - Bump std-ver to 4.2.1. - Refresh d/copyright (dates, use https). - - Move to section javascript. - - Point Vcs-* fields to salsa. + - Move to section javascript. + - Point Vcs-* fields to salsa. -- Julien Puydt Tue, 13 Nov 2018 21:46:38 +0100 diff -Nru node-jsesc-2.5.2/debian/compat node-jsesc-3.0.1/debian/compat --- node-jsesc-2.5.2/debian/compat 2018-11-13 20:46:38.000000000 +0000 +++ node-jsesc-3.0.1/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru node-jsesc-2.5.2/debian/control node-jsesc-3.0.1/debian/control --- node-jsesc-2.5.2/debian/control 2018-11-13 20:46:38.000000000 +0000 +++ node-jsesc-3.0.1/debian/control 2020-04-12 06:45:28.000000000 +0000 @@ -3,8 +3,8 @@ Priority: optional Maintainer: Debian Javascript Maintainers Uploaders: Julien Puydt -Build-Depends: debhelper (>= 11), nodejs -Standards-Version: 4.2.1 +Build-Depends: debhelper-compat (= 12), nodejs, mocha +Standards-Version: 4.5.0 Homepage: http://mths.be/jsesc Vcs-Git: https://salsa.debian.org/js-team/node-jsesc.git Vcs-Browser: https://salsa.debian.org/js-team/node-jsesc diff -Nru node-jsesc-2.5.2/debian/install node-jsesc-3.0.1/debian/install --- node-jsesc-2.5.2/debian/install 2018-11-13 20:46:38.000000000 +0000 +++ node-jsesc-3.0.1/debian/install 2020-04-12 06:45:28.000000000 +0000 @@ -1,3 +1,3 @@ -package.json usr/lib/nodejs/jsesc/ -bin usr/lib/nodejs/jsesc/ -jsesc.js usr/lib/nodejs/jsesc/ +package.json usr/share/nodejs/jsesc/ +bin usr/share/nodejs/jsesc/ +jsesc.js usr/share/nodejs/jsesc/ diff -Nru node-jsesc-2.5.2/debian/tests/control node-jsesc-3.0.1/debian/tests/control --- node-jsesc-2.5.2/debian/tests/control 2018-11-13 20:46:38.000000000 +0000 +++ node-jsesc-3.0.1/debian/tests/control 2020-04-12 06:45:28.000000000 +0000 @@ -1,2 +1,5 @@ Tests: require -Depends: node-jsesc +Depends: @ + +Tests: upstreamtestsuite +Depends: @, mocha diff -Nru node-jsesc-2.5.2/debian/tests/upstreamtestsuite node-jsesc-3.0.1/debian/tests/upstreamtestsuite --- node-jsesc-2.5.2/debian/tests/upstreamtestsuite 1970-01-01 00:00:00.000000000 +0000 +++ node-jsesc-3.0.1/debian/tests/upstreamtestsuite 2020-05-29 08:33:42.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +sed tests/tests.js -e "s|'../jsesc.js'|'jsesc'|g" > tests.js +mocha tests.js --timeout 40000 diff -Nru node-jsesc-2.5.2/debian/upstream/metadata node-jsesc-3.0.1/debian/upstream/metadata --- node-jsesc-2.5.2/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ node-jsesc-3.0.1/debian/upstream/metadata 2020-04-12 06:45:28.000000000 +0000 @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/mathiasbynens/jsesc/issues +Bug-Submit: https://github.com/mathiasbynens/jsesc/issues/new +Repository: https://github.com/mathiasbynens/jsesc.git +Repository-Browse: https://github.com/mathiasbynens/jsesc diff -Nru node-jsesc-2.5.2/jsesc.js node-jsesc-3.0.1/jsesc.js --- node-jsesc-2.5.2/jsesc.js 2018-11-08 21:50:15.000000000 +0000 +++ node-jsesc-3.0.1/jsesc.js 2020-04-09 19:21:24.000000000 +0000 @@ -28,6 +28,16 @@ } }; +const fourHexEscape = (hex) => { + return '\\u' + ('0000' + hex).slice(-4); +} + +const hexadecimal = (code, lowercase) => { + let hexadecimal = code.toString(16); + if (lowercase) return hexadecimal; + return hexadecimal.toUpperCase(); +}; + const toString = object.toString; const isArray = Array.isArray; const isBuffer = Buffer.isBuffer; @@ -57,8 +67,6 @@ // https://mathiasbynens.be/notes/javascript-escapes#single const singleEscapes = { - '"': '\\"', - '\'': '\\\'', '\\': '\\\\', '\b': '\\b', '\f': '\\f', @@ -68,10 +76,13 @@ // `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'. // '\v': '\\x0B' }; -const regexSingleEscape = /["'\\\b\f\n\r\t]/; +const regexSingleEscape = /[\\\b\f\n\r\t]/; const regexDigit = /[0-9]/; -const regexWhitelist = /[ !#-&\(-\[\]-_a-~]/; +const regexWhitespace = /[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/; + +const escapeEverythingRegex = /([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g; +const escapeNonAsciiRegex = /([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g; const jsesc = (argument, options) => { const increaseIndentation = () => { @@ -234,96 +245,72 @@ } } - const string = argument; - // Loop over each code unit in the string and escape it - let index = -1; - const length = string.length; - result = ''; - while (++index < length) { - const character = string.charAt(index); - if (options.es6) { - const first = string.charCodeAt(index); - if ( // check if it’s the start of a surrogate pair - first >= 0xD800 && first <= 0xDBFF && // high surrogate - length > index + 1 // there is a next code unit - ) { - const second = string.charCodeAt(index + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - const codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - let hexadecimal = codePoint.toString(16); - if (!lowercaseHex) { - hexadecimal = hexadecimal.toUpperCase(); - } - result += '\\u{' + hexadecimal + '}'; - ++index; - continue; - } + const regex = options.escapeEverything ? escapeEverythingRegex : escapeNonAsciiRegex; + result = argument.replace(regex, (char, pair, lone, quoteChar, index, string) => { + if (pair) { + if (options.minimal) return pair; + const first = pair.charCodeAt(0); + const second = pair.charCodeAt(1); + if (options.es6) { + // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae + const codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + const hex = hexadecimal(codePoint, lowercaseHex); + return '\\u{' + hex + '}'; } + return fourHexEscape(hexadecimal(first, lowercaseHex)) + fourHexEscape(hexadecimal(second, lowercaseHex)); } - if (!options.escapeEverything) { - if (regexWhitelist.test(character)) { - // It’s a printable ASCII character that is not `"`, `'` or `\`, - // so don’t escape it. - result += character; - continue; - } - if (character == '"') { - result += quote == character ? '\\"' : character; - continue; - } - if (character == '`') { - result += quote == character ? '\\`' : character; - continue; - } - if (character == '\'') { - result += quote == character ? '\\\'' : character; - continue; - } + + if (lone) { + return fourHexEscape(hexadecimal(lone.charCodeAt(0), lowercaseHex)); } + if ( - character == '\0' && + char == '\0' && !json && !regexDigit.test(string.charAt(index + 1)) ) { - result += '\\0'; - continue; + return '\\0'; + } + + if (quoteChar) { + if (quoteChar == quote || options.escapeEverything) { + return '\\' + quoteChar; + } + return quoteChar; } - if (regexSingleEscape.test(character)) { + + if (regexSingleEscape.test(char)) { // no need for a `hasOwnProperty` check here - result += singleEscapes[character]; - continue; + return singleEscapes[char]; } - const charCode = character.charCodeAt(0); - if (options.minimal && charCode != 0x2028 && charCode != 0x2029) { - result += character; - continue; - } - let hexadecimal = charCode.toString(16); - if (!lowercaseHex) { - hexadecimal = hexadecimal.toUpperCase(); - } - const longhand = hexadecimal.length > 2 || json; - const escaped = '\\' + (longhand ? 'u' : 'x') + - ('0000' + hexadecimal).slice(longhand ? -4 : -2); - result += escaped; - continue; - } - if (options.wrap) { - result = quote + result + quote; - } + + if (options.minimal && !regexWhitespace.test(char)) { + return char; + } + + const hex = hexadecimal(char.charCodeAt(0), lowercaseHex); + if (json || hex.length > 2) { + return fourHexEscape(hex); + } + + return '\\x' + ('00' + hex).slice(-2); + }); + if (quote == '`') { - result = result.replace(/\$\{/g, '\\\$\{'); + result = result.replace(/\$\{/g, '\\${'); } if (options.isScriptContext) { // https://mathiasbynens.be/notes/etago - return result + result = result .replace(/<\/(script|style)/gi, '<\\/$1') .replace(/