i18next-scanner
Advanced tools
Comparing version 1.8.0 to 1.9.0
@@ -278,3 +278,3 @@ 'use strict'; | ||
}).value().join('|').replace(/\./g, '\\.'); | ||
var pattern = '(?:(?:^[\\s]*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\.)*"|\'(?:[^\'\\\\]|\\\\.)*\')\\s*[\\,\\)]'; | ||
var pattern = '(?:(?:^\\s*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\(?:.|$))*"|\'(?:[^\'\\\\]|\\\\(?:.|$))*\')\\s*[,)]'; | ||
var re = new RegExp(pattern, 'gim'); | ||
@@ -295,2 +295,5 @@ | ||
// restore multiline strings | ||
key = key.replace(/(\\\n|\\\r\n)/g, ''); | ||
// JavaScript character escape sequences | ||
@@ -297,0 +300,0 @@ // https://mathiasbynens.be/notes/javascript-escapes |
{ | ||
"name": "i18next-scanner", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Scan your code, extract translation keys/values, and merge them into i18n resource files.", | ||
@@ -18,3 +18,3 @@ "homepage": "https://github.com/i18next/i18next-scanner", | ||
"build": "babel ./src --out-dir ./lib", | ||
"test": "tap test/*.js --coverage --nyc-arg=--require --nyc-arg=babel-register --nyc-arg=--require --nyc-arg=babel-polyfill", | ||
"test": "tap test/*.js --node-arg=--require --node-arg=babel-register --node-arg=--require --node-arg=babel-polyfill", | ||
"lint": "eslint ./src", | ||
@@ -21,0 +21,0 @@ "lint:fix": "eslint --fix ./src", |
@@ -239,3 +239,3 @@ /* eslint no-console: 0 */ | ||
.replace(/\./g, '\\.'); | ||
const pattern = '(?:(?:^[\\s]*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\.)*"|\'(?:[^\'\\\\]|\\\\.)*\')\\s*[\\,\\)]'; | ||
const pattern = '(?:(?:^\\s*)|[^a-zA-Z0-9_])(?:' + matchPattern + ')\\(("(?:[^"\\\\]|\\\\(?:.|$))*"|\'(?:[^\'\\\\]|\\\\(?:.|$))*\')\\s*[,)]'; | ||
const re = new RegExp(pattern, 'gim'); | ||
@@ -256,2 +256,5 @@ | ||
// restore multiline strings | ||
key = key.replace(/(\\\n|\\\r\n)/g, ''); | ||
// JavaScript character escape sequences | ||
@@ -258,0 +261,0 @@ // https://mathiasbynens.be/notes/javascript-escapes |
@@ -312,2 +312,36 @@ import fs from 'fs'; | ||
test('Multiline (Line Endings: LF)', (t) => { | ||
const parser = new Parser({ | ||
nsSeparator: false, | ||
}); | ||
const content = fs.readFileSync(path.resolve(__dirname, 'fixtures/multiline-unix.js'), 'utf-8'); | ||
parser.parseFuncFromString(content); | ||
t.same(parser.get(), { | ||
en: { | ||
translation: { | ||
"this is a multiline string": "", | ||
"this is another multiline string": "" | ||
} | ||
} | ||
}); | ||
t.end(); | ||
}); | ||
test('Multiline (Line Endings: CRLF)', (t) => { | ||
const parser = new Parser({ | ||
nsSeparator: false, | ||
}); | ||
const content = fs.readFileSync(path.resolve(__dirname, 'fixtures/multiline-dos.js'), 'utf-8'); | ||
parser.parseFuncFromString(content); | ||
t.same(parser.get(), { | ||
en: { | ||
translation: { | ||
"this is a multiline string": "", | ||
"this is another multiline string": "" | ||
} | ||
} | ||
}); | ||
t.end(); | ||
}); | ||
test('Plural', (t) => { | ||
@@ -314,0 +348,0 @@ const parser = new Parser(); |
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
118184
39
2366