@formatjs/icu-messageformat-parser 1.1.2 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/no-parser.d.ts +1 -0
- package/lib/no-parser.d.ts.map +1 -1
- package/lib/no-parser.js +1 -0
- package/lib/parser.d.ts +3 -1
- package/lib/parser.d.ts.map +1 -1
- package/lib/parser.js +19 -3
- package/no-parser.d.ts +1 -0
- package/no-parser.d.ts.map +1 -1
- package/no-parser.js +2 -0
- package/package.json +3 -3
- package/parser.d.ts +3 -1
- package/parser.d.ts.map +1 -1
- package/parser.js +19 -3
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EASL,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAuBhB,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EASL,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAuBhB,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,0BAmB9D;AACD,cAAc,SAAS,CAAA"}
|
package/index.js
CHANGED
|
@@ -34,6 +34,8 @@ function parse(message, opts) {
|
|
|
34
34
|
var error = SyntaxError(error_1.ErrorKind[result.err.kind]);
|
|
35
35
|
// @ts-expect-error Assign to error object
|
|
36
36
|
error.location = result.err.location;
|
|
37
|
+
// @ts-expect-error Assign to error object
|
|
38
|
+
error.originalMessage = result.err.message;
|
|
37
39
|
throw error;
|
|
38
40
|
}
|
|
39
41
|
if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EASL,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAuBhB,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EASL,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAuBhB,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB,0BAmB9D;AACD,cAAc,SAAS,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,8 @@ export function parse(message, opts) {
|
|
|
31
31
|
var error = SyntaxError(ErrorKind[result.err.kind]);
|
|
32
32
|
// @ts-expect-error Assign to error object
|
|
33
33
|
error.location = result.err.location;
|
|
34
|
+
// @ts-expect-error Assign to error object
|
|
35
|
+
error.originalMessage = result.err.message;
|
|
34
36
|
throw error;
|
|
35
37
|
}
|
|
36
38
|
if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {
|
package/lib/no-parser.d.ts
CHANGED
package/lib/no-parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-parser.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/no-parser.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,SAIpB"}
|
|
1
|
+
{"version":3,"file":"no-parser.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/no-parser.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,SAIpB;AACD,cAAc,SAAS,CAAA"}
|
package/lib/no-parser.js
CHANGED
package/lib/parser.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class Parser {
|
|
|
48
48
|
parse(): Result<MessageFormatElement[], ParserError>;
|
|
49
49
|
private parseMessage;
|
|
50
50
|
/**
|
|
51
|
-
* A tag name must start with an ASCII lower case letter. The grammar is based on the
|
|
51
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
52
52
|
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
53
53
|
* are accepted:
|
|
54
54
|
*
|
|
@@ -62,6 +62,8 @@ export declare class Parser {
|
|
|
62
62
|
* ```
|
|
63
63
|
*
|
|
64
64
|
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
65
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
66
|
+
* since other tag-based engines like React allow it
|
|
65
67
|
*/
|
|
66
68
|
private parseTag;
|
|
67
69
|
/**
|
package/lib/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../../packages/icu-messageformat-parser/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAC,MAAM,SAAS,CAAA;AAC9C,OAAO,EAIL,oBAAoB,EAMrB,MAAM,SAAS,CAAA;AAYhB,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IAC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
|
|
2
3
|
import { ErrorKind } from './error';
|
|
3
4
|
import { SKELETON_TYPE, TYPE, } from './types';
|
|
@@ -26,7 +27,14 @@ var isSafeInteger = hasNativeIsSafeInteger
|
|
|
26
27
|
// IE11 does not support y and u.
|
|
27
28
|
var REGEX_SUPPORTS_U_AND_Y = true;
|
|
28
29
|
try {
|
|
29
|
-
RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
|
|
30
|
+
var re = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
|
|
31
|
+
/**
|
|
32
|
+
* legacy Edge or Xbox One browser
|
|
33
|
+
* Unicode flag support: supported
|
|
34
|
+
* Pattern_Syntax support: not supported
|
|
35
|
+
* See https://github.com/formatjs/formatjs/issues/2822
|
|
36
|
+
*/
|
|
37
|
+
REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';
|
|
30
38
|
}
|
|
31
39
|
catch (_) {
|
|
32
40
|
REGEX_SUPPORTS_U_AND_Y = false;
|
|
@@ -215,7 +223,7 @@ var Parser = /** @class */ (function () {
|
|
|
215
223
|
return { val: elements, err: null };
|
|
216
224
|
};
|
|
217
225
|
/**
|
|
218
|
-
* A tag name must start with an ASCII lower case letter. The grammar is based on the
|
|
226
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
219
227
|
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
220
228
|
* are accepted:
|
|
221
229
|
*
|
|
@@ -229,6 +237,8 @@ var Parser = /** @class */ (function () {
|
|
|
229
237
|
* ```
|
|
230
238
|
*
|
|
231
239
|
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
240
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
241
|
+
* since other tag-based engines like React allow it
|
|
232
242
|
*/
|
|
233
243
|
Parser.prototype.parseTag = function (nestingLevel, parentArgType) {
|
|
234
244
|
var startPosition = this.clonePosition();
|
|
@@ -953,8 +963,14 @@ var Parser = /** @class */ (function () {
|
|
|
953
963
|
return Parser;
|
|
954
964
|
}());
|
|
955
965
|
export { Parser };
|
|
966
|
+
/**
|
|
967
|
+
* This check if codepoint is alphabet (lower & uppercase)
|
|
968
|
+
* @param codepoint
|
|
969
|
+
* @returns
|
|
970
|
+
*/
|
|
956
971
|
function _isAlpha(codepoint) {
|
|
957
|
-
return codepoint >= 97 && codepoint <= 122
|
|
972
|
+
return ((codepoint >= 97 && codepoint <= 122) ||
|
|
973
|
+
(codepoint >= 65 && codepoint <= 90));
|
|
958
974
|
}
|
|
959
975
|
function _isAlphaOrSlash(codepoint) {
|
|
960
976
|
return _isAlpha(codepoint) || codepoint === 47; /* '/' */
|
package/no-parser.d.ts
CHANGED
package/no-parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-parser.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/no-parser.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,SAIpB"}
|
|
1
|
+
{"version":3,"file":"no-parser.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/no-parser.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,SAIpB;AACD,cAAc,SAAS,CAAA"}
|
package/no-parser.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parse = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
4
5
|
function parse() {
|
|
5
6
|
throw new Error("You're trying to format an uncompiled message with react-intl without parser, please import from 'react-int' instead");
|
|
6
7
|
}
|
|
7
8
|
exports.parse = parse;
|
|
9
|
+
tslib_1.__exportStar(require("./types"), exports);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/icu-messageformat-parser",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@formatjs/ecma402-abstract": "1.6.
|
|
9
|
-
"@formatjs/icu-skeleton-parser": "1.1.
|
|
8
|
+
"@formatjs/ecma402-abstract": "1.6.5",
|
|
9
|
+
"@formatjs/icu-skeleton-parser": "1.1.2",
|
|
10
10
|
"tslib": "^2.1.0"
|
|
11
11
|
}
|
|
12
12
|
}
|
package/parser.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class Parser {
|
|
|
48
48
|
parse(): Result<MessageFormatElement[], ParserError>;
|
|
49
49
|
private parseMessage;
|
|
50
50
|
/**
|
|
51
|
-
* A tag name must start with an ASCII lower case letter. The grammar is based on the
|
|
51
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
52
52
|
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
53
53
|
* are accepted:
|
|
54
54
|
*
|
|
@@ -62,6 +62,8 @@ export declare class Parser {
|
|
|
62
62
|
* ```
|
|
63
63
|
*
|
|
64
64
|
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
65
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
66
|
+
* since other tag-based engines like React allow it
|
|
65
67
|
*/
|
|
66
68
|
private parseTag;
|
|
67
69
|
/**
|
package/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../packages/icu-messageformat-parser/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAC,MAAM,SAAS,CAAA;AAC9C,OAAO,EAIL,oBAAoB,EAMrB,MAAM,SAAS,CAAA;AAYhB,MAAM,WAAW,QAAQ;IACvB,6CAA6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OAAO,CAAC,SAAS;IAMjB;;;OAGG;IACH,OAAO,CAAC,IAAI;CASb"}
|
package/parser.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.Parser = void 0;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
@@ -29,7 +30,14 @@ var isSafeInteger = hasNativeIsSafeInteger
|
|
|
29
30
|
// IE11 does not support y and u.
|
|
30
31
|
var REGEX_SUPPORTS_U_AND_Y = true;
|
|
31
32
|
try {
|
|
32
|
-
RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
|
|
33
|
+
var re = RE('([^\\p{White_Space}\\p{Pattern_Syntax}]*)', 'yu');
|
|
34
|
+
/**
|
|
35
|
+
* legacy Edge or Xbox One browser
|
|
36
|
+
* Unicode flag support: supported
|
|
37
|
+
* Pattern_Syntax support: not supported
|
|
38
|
+
* See https://github.com/formatjs/formatjs/issues/2822
|
|
39
|
+
*/
|
|
40
|
+
REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';
|
|
33
41
|
}
|
|
34
42
|
catch (_) {
|
|
35
43
|
REGEX_SUPPORTS_U_AND_Y = false;
|
|
@@ -218,7 +226,7 @@ var Parser = /** @class */ (function () {
|
|
|
218
226
|
return { val: elements, err: null };
|
|
219
227
|
};
|
|
220
228
|
/**
|
|
221
|
-
* A tag name must start with an ASCII lower case letter. The grammar is based on the
|
|
229
|
+
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
|
|
222
230
|
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
|
|
223
231
|
* are accepted:
|
|
224
232
|
*
|
|
@@ -232,6 +240,8 @@ var Parser = /** @class */ (function () {
|
|
|
232
240
|
* ```
|
|
233
241
|
*
|
|
234
242
|
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
243
|
+
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
|
|
244
|
+
* since other tag-based engines like React allow it
|
|
235
245
|
*/
|
|
236
246
|
Parser.prototype.parseTag = function (nestingLevel, parentArgType) {
|
|
237
247
|
var startPosition = this.clonePosition();
|
|
@@ -956,8 +966,14 @@ var Parser = /** @class */ (function () {
|
|
|
956
966
|
return Parser;
|
|
957
967
|
}());
|
|
958
968
|
exports.Parser = Parser;
|
|
969
|
+
/**
|
|
970
|
+
* This check if codepoint is alphabet (lower & uppercase)
|
|
971
|
+
* @param codepoint
|
|
972
|
+
* @returns
|
|
973
|
+
*/
|
|
959
974
|
function _isAlpha(codepoint) {
|
|
960
|
-
return codepoint >= 97 && codepoint <= 122
|
|
975
|
+
return ((codepoint >= 97 && codepoint <= 122) ||
|
|
976
|
+
(codepoint >= 65 && codepoint <= 90));
|
|
961
977
|
}
|
|
962
978
|
function _isAlphaOrSlash(codepoint) {
|
|
963
979
|
return _isAlpha(codepoint) || codepoint === 47; /* '/' */
|