@formatjs/intl-getcanonicallocales 2.0.3 → 2.0.5
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 +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +42 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +31 -0
- package/lib/polyfill.d.ts +2 -0
- package/lib/polyfill.d.ts.map +1 -0
- package/lib/polyfill.js +24 -0
- package/lib/should-polyfill.d.ts +2 -0
- package/lib/should-polyfill.d.ts.map +1 -0
- package/lib/should-polyfill.js +8 -0
- package/lib/src/aliases.generated.d.ts +5 -0
- package/lib/src/aliases.generated.d.ts.map +1 -0
- package/lib/src/aliases.generated.js +1137 -0
- package/lib/src/canonicalizer.d.ts +20 -0
- package/lib/src/canonicalizer.d.ts.map +1 -0
- package/lib/src/canonicalizer.js +219 -0
- package/lib/src/emitter.d.ts +4 -0
- package/lib/src/emitter.d.ts.map +1 -0
- package/lib/src/emitter.js +28 -0
- package/lib/src/likelySubtags.generated.d.ts +2 -0
- package/lib/src/likelySubtags.generated.d.ts.map +1 -0
- package/lib/src/likelySubtags.generated.js +1870 -0
- package/lib/src/parser.d.ts +10 -0
- package/lib/src/parser.d.ts.map +1 -0
- package/lib/src/parser.js +233 -0
- package/lib/src/types.d.ts +33 -0
- package/lib/src/types.d.ts.map +1 -0
- package/lib/src/types.js +1 -0
- package/package.json +2 -2
- package/polyfill.d.ts +2 -0
- package/polyfill.d.ts.map +1 -0
- package/polyfill.iife.js +3979 -0
- package/polyfill.js +26 -0
- package/should-polyfill.d.ts +2 -0
- package/should-polyfill.d.ts.map +1 -0
- package/should-polyfill.js +12 -0
- package/src/aliases.generated.d.ts +5 -0
- package/src/aliases.generated.d.ts.map +1 -0
- package/src/aliases.generated.js +1140 -0
- package/src/canonicalizer.d.ts +20 -0
- package/src/canonicalizer.d.ts.map +1 -0
- package/src/canonicalizer.js +224 -0
- package/src/emitter.d.ts +4 -0
- package/src/emitter.d.ts.map +1 -0
- package/src/emitter.js +33 -0
- package/src/likelySubtags.generated.d.ts +2 -0
- package/src/likelySubtags.generated.d.ts.map +1 -0
- package/src/likelySubtags.generated.js +1873 -0
- package/src/parser.d.ts +10 -0
- package/src/parser.d.ts.map +1 -0
- package/src/parser.js +243 -0
- package/src/types.d.ts +33 -0
- package/src/types.d.ts.map +1 -0
- package/src/types.js +2 -0
- package/BUILD +0 -116
- package/CHANGELOG.md +0 -290
- package/index.ts +0 -43
- package/polyfill.ts +0 -23
- package/scripts/aliases.ts +0 -70
- package/scripts/likely-subtags.ts +0 -20
- package/should-polyfill.ts +0 -10
- package/src/aliases.generated.ts +0 -1137
- package/src/canonicalizer.ts +0 -272
- package/src/emitter.ts +0 -39
- package/src/likelySubtags.generated.ts +0 -1870
- package/src/parser.ts +0 -259
- package/src/types.ts +0 -63
- package/tests/index.test.ts +0 -24
- package/tests/parser.test.ts +0 -204
- package/tsconfig.json +0 -5
package/polyfill.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _1 = require("./");
|
|
4
|
+
var should_polyfill_1 = require("./should-polyfill");
|
|
5
|
+
if (typeof Intl === 'undefined') {
|
|
6
|
+
if (typeof window !== 'undefined') {
|
|
7
|
+
Object.defineProperty(window, 'Intl', {
|
|
8
|
+
value: {},
|
|
9
|
+
});
|
|
10
|
+
// @ts-ignore we don't include @types/node so global isn't a thing
|
|
11
|
+
}
|
|
12
|
+
else if (typeof global !== 'undefined') {
|
|
13
|
+
// @ts-ignore we don't include @types/node so global isn't a thing
|
|
14
|
+
Object.defineProperty(global, 'Intl', {
|
|
15
|
+
value: {},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if ((0, should_polyfill_1.shouldPolyfill)()) {
|
|
20
|
+
Object.defineProperty(Intl, 'getCanonicalLocales', {
|
|
21
|
+
value: _1.getCanonicalLocales,
|
|
22
|
+
writable: true,
|
|
23
|
+
enumerable: false,
|
|
24
|
+
configurable: true,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["should-polyfill.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,YAS7B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldPolyfill = void 0;
|
|
4
|
+
function shouldPolyfill() {
|
|
5
|
+
return (typeof Intl === 'undefined' ||
|
|
6
|
+
!('getCanonicalLocales' in Intl) ||
|
|
7
|
+
// Native Intl.getCanonicalLocales is just buggy
|
|
8
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=10682
|
|
9
|
+
Intl.getCanonicalLocales('und-x-private')[0] ===
|
|
10
|
+
'x-private');
|
|
11
|
+
}
|
|
12
|
+
exports.shouldPolyfill = shouldPolyfill;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const languageAlias: Record<string, string>;
|
|
2
|
+
export declare const territoryAlias: Record<string, string>;
|
|
3
|
+
export declare const scriptAlias: Record<string, string>;
|
|
4
|
+
export declare const variantAlias: Record<string, string>;
|
|
5
|
+
//# sourceMappingURL=aliases.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliases.generated.d.ts","sourceRoot":"","sources":["aliases.generated.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqehD,CAAC;AACF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAioBjD,CAAC;AACF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAE9C,CAAC;AACF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG/C,CAAC"}
|