@formatjs/intl-getcanonicallocales 1.9.2 → 2.0.3

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.
Files changed (74) hide show
  1. package/BUILD +116 -0
  2. package/CHANGELOG.md +290 -0
  3. package/LICENSE.md +0 -0
  4. package/README.md +0 -0
  5. package/index.ts +43 -0
  6. package/package.json +3 -3
  7. package/polyfill.ts +23 -0
  8. package/scripts/aliases.ts +70 -0
  9. package/scripts/likely-subtags.ts +20 -0
  10. package/should-polyfill.ts +10 -0
  11. package/src/aliases.generated.ts +1137 -0
  12. package/src/canonicalizer.ts +272 -0
  13. package/src/emitter.ts +39 -0
  14. package/src/likelySubtags.generated.ts +1870 -0
  15. package/src/parser.ts +259 -0
  16. package/src/types.ts +63 -0
  17. package/tests/index.test.ts +24 -0
  18. package/tests/parser.test.ts +204 -0
  19. package/tsconfig.json +5 -0
  20. package/index.d.ts +0 -6
  21. package/index.d.ts.map +0 -1
  22. package/index.js +0 -42
  23. package/lib/index.d.ts +0 -6
  24. package/lib/index.d.ts.map +0 -1
  25. package/lib/index.js +0 -31
  26. package/lib/polyfill.d.ts +0 -2
  27. package/lib/polyfill.d.ts.map +0 -1
  28. package/lib/polyfill.js +0 -24
  29. package/lib/should-polyfill.d.ts +0 -2
  30. package/lib/should-polyfill.d.ts.map +0 -1
  31. package/lib/should-polyfill.js +0 -8
  32. package/lib/src/aliases.generated.d.ts +0 -5
  33. package/lib/src/aliases.generated.d.ts.map +0 -1
  34. package/lib/src/aliases.generated.js +0 -1137
  35. package/lib/src/canonicalizer.d.ts +0 -20
  36. package/lib/src/canonicalizer.d.ts.map +0 -1
  37. package/lib/src/canonicalizer.js +0 -219
  38. package/lib/src/emitter.d.ts +0 -4
  39. package/lib/src/emitter.d.ts.map +0 -1
  40. package/lib/src/emitter.js +0 -28
  41. package/lib/src/likelySubtags.generated.d.ts +0 -2
  42. package/lib/src/likelySubtags.generated.d.ts.map +0 -1
  43. package/lib/src/likelySubtags.generated.js +0 -1870
  44. package/lib/src/parser.d.ts +0 -10
  45. package/lib/src/parser.d.ts.map +0 -1
  46. package/lib/src/parser.js +0 -233
  47. package/lib/src/types.d.ts +0 -33
  48. package/lib/src/types.d.ts.map +0 -1
  49. package/lib/src/types.js +0 -1
  50. package/polyfill.d.ts +0 -2
  51. package/polyfill.d.ts.map +0 -1
  52. package/polyfill.iife.js +0 -3526
  53. package/polyfill.js +0 -26
  54. package/should-polyfill.d.ts +0 -2
  55. package/should-polyfill.d.ts.map +0 -1
  56. package/should-polyfill.js +0 -12
  57. package/src/aliases.generated.d.ts +0 -5
  58. package/src/aliases.generated.d.ts.map +0 -1
  59. package/src/aliases.generated.js +0 -1140
  60. package/src/canonicalizer.d.ts +0 -20
  61. package/src/canonicalizer.d.ts.map +0 -1
  62. package/src/canonicalizer.js +0 -224
  63. package/src/emitter.d.ts +0 -4
  64. package/src/emitter.d.ts.map +0 -1
  65. package/src/emitter.js +0 -33
  66. package/src/likelySubtags.generated.d.ts +0 -2
  67. package/src/likelySubtags.generated.d.ts.map +0 -1
  68. package/src/likelySubtags.generated.js +0 -1873
  69. package/src/parser.d.ts +0 -10
  70. package/src/parser.d.ts.map +0 -1
  71. package/src/parser.js +0 -243
  72. package/src/types.d.ts +0 -33
  73. package/src/types.d.ts.map +0 -1
  74. package/src/types.js +0 -2
package/polyfill.js DELETED
@@ -1,26 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- export declare function shouldPolyfill(): boolean;
2
- //# sourceMappingURL=should-polyfill.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"should-polyfill.d.ts","sourceRoot":"","sources":["../../../../../packages/intl-getcanonicallocales/should-polyfill.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,YAS7B"}
@@ -1,12 +0,0 @@
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;
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"aliases.generated.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-getcanonicallocales/src/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"}