@formatjs/intl-supportedvaluesof 2.1.2

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/BUILD.bazel ADDED
@@ -0,0 +1,135 @@
1
+ load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
2
+ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
3
+ load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
4
+ load("@aspect_rules_js//npm:defs.bzl", "npm_package")
5
+ load("@npm//:defs.bzl", "npm_link_all_packages")
6
+ load("//packages/intl-datetimeformat:defs.bzl", "ZONES")
7
+ load("//tools:index.bzl", "generate_ide_tsconfig_json", "generate_src_file", "ts_compile")
8
+ load("//tools:vitest.bzl", "vitest")
9
+
10
+ npm_link_all_packages()
11
+
12
+ PACKAGE_NAME = "intl-supportedvaluesof"
13
+
14
+ npm_package(
15
+ name = "pkg",
16
+ srcs = [
17
+ "LICENSE.md",
18
+ "README.md",
19
+ "package.json",
20
+ ":dist",
21
+ # polyfill-library uses this
22
+ "polyfill.iife.js",
23
+ ],
24
+ package = "@formatjs/%s" % PACKAGE_NAME,
25
+ visibility = ["//visibility:public"],
26
+ )
27
+
28
+ SRCS = glob([
29
+ "src/**/*.ts",
30
+ "*.ts",
31
+ ])
32
+
33
+ SRC_DEPS = [
34
+ ":node_modules/@formatjs/ecma402-abstract",
35
+ ":node_modules/@formatjs/fast-memoize",
36
+ ]
37
+
38
+ TESTS = glob([
39
+ "tests/*.test.ts",
40
+ ])
41
+
42
+ ts_compile(
43
+ name = "dist",
44
+ srcs = [":srcs"],
45
+ deps = SRC_DEPS,
46
+ )
47
+
48
+ vitest(
49
+ name = "unit_test",
50
+ srcs = SRCS + TESTS,
51
+ deps = SRC_DEPS,
52
+ )
53
+
54
+ # Test262
55
+ # Generate tsconfig.json with correct extends path
56
+ generate_ide_tsconfig_json()
57
+
58
+ # calendars
59
+ generate_src_file(
60
+ name = "calendars",
61
+ src = "src/calendars.generated.ts",
62
+ data = [
63
+ "//:node_modules/cldr-bcp47",
64
+ ],
65
+ entry_point = "scripts/calendars.ts",
66
+ tags = ["cldr"],
67
+ )
68
+
69
+ # timezones
70
+ generate_src_file(
71
+ name = "timezones",
72
+ src = "src/timezones.generated.ts",
73
+ args = ["--zone %s" % z for z in ZONES],
74
+ data = [
75
+ ],
76
+ entry_point = "scripts/timezones.ts",
77
+ tags = ["cldr"],
78
+ )
79
+
80
+ # numbering-systems
81
+ write_source_files(
82
+ name = "numbering-systems",
83
+ files = {
84
+ "src/numbering-systems.generated.ts": "//packages/intl-numberformat:src/numbering-systems.generated.ts",
85
+ },
86
+ visibility = ["//:__pkg__"],
87
+ )
88
+
89
+ # currencies
90
+ generate_src_file(
91
+ name = "currencies",
92
+ src = "src/currencies.generated.ts",
93
+ data = [
94
+ "//:node_modules/cldr-numbers-full",
95
+ ],
96
+ entry_point = "scripts/currencies.ts",
97
+ tags = ["cldr"],
98
+ )
99
+
100
+ # collations
101
+ generate_src_file(
102
+ name = "collations",
103
+ src = "src/collations.generated.ts",
104
+ data = [
105
+ "//:node_modules/cldr-bcp47",
106
+ ],
107
+ entry_point = "scripts/collations.ts",
108
+ tags = ["cldr"],
109
+ )
110
+
111
+ # units
112
+ generate_src_file(
113
+ name = "units",
114
+ src = "src/units.generated.ts",
115
+ data = [
116
+ ":node_modules/@formatjs/ecma402-abstract",
117
+ "//:node_modules/cldr-bcp47",
118
+ ],
119
+ entry_point = "scripts/units.ts",
120
+ tags = ["cldr"],
121
+ )
122
+
123
+ esbuild(
124
+ name = "polyfill.iife",
125
+ srcs = [":srcs"],
126
+ entry_point = "polyfill.ts",
127
+ deps = [
128
+ "//:node_modules/tslib",
129
+ ] + SRC_DEPS,
130
+ )
131
+
132
+ copy_to_bin(
133
+ name = "srcs",
134
+ srcs = SRCS,
135
+ )
package/CHANGELOG.md ADDED
@@ -0,0 +1,249 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [2.1.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.1.1...@formatjs/intl-supportedvaluesof@2.1.2) (2026-01-06)
7
+
8
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
9
+
10
+ ## [2.1.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.1.0...@formatjs/intl-supportedvaluesof@2.1.1) (2026-01-02)
11
+
12
+ ### Bug Fixes
13
+
14
+ * **@formatjs/intl-datetimeformat:** add America/Coyhaique, fix [#5111](https://github.com/formatjs/formatjs/issues/5111) ([#5741](https://github.com/formatjs/formatjs/issues/5741)) ([edd2f94](https://github.com/formatjs/formatjs/commit/edd2f94ab780e82702a1017e3ca38d41bde325ed)) - by @longlho
15
+
16
+ # [2.1.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.0.5...@formatjs/intl-supportedvaluesof@2.1.0) (2025-12-26)
17
+
18
+ ### Features
19
+
20
+ * upgrade cldr to v48 ([#5678](https://github.com/formatjs/formatjs/issues/5678)) ([54ef319](https://github.com/formatjs/formatjs/commit/54ef31940172467889be64907e9fbbf567ea3f4b)) - by @longlho
21
+
22
+ ## [2.0.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.0.4...@formatjs/intl-supportedvaluesof@2.0.5) (2025-12-23)
23
+
24
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
25
+
26
+ ## [2.0.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.0.3...@formatjs/intl-supportedvaluesof@2.0.4) (2025-12-23)
27
+
28
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
29
+
30
+ ## [2.0.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.0.2...@formatjs/intl-supportedvaluesof@2.0.3) (2025-12-18)
31
+
32
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
33
+
34
+ ## [2.0.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.0.1...@formatjs/intl-supportedvaluesof@2.0.2) (2025-12-17)
35
+
36
+ ### Bug Fixes
37
+
38
+ * **@formatjs/cli-lib:** fix fs-extra imports, fix [#5569](https://github.com/formatjs/formatjs/issues/5569) ([76c8793](https://github.com/formatjs/formatjs/commit/76c8793bf8a0744ad9a7c64ab3adbe5c1434898f)) - by @longlho
39
+
40
+ ## [2.0.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@2.0.0...@formatjs/intl-supportedvaluesof@2.0.1) (2025-12-15)
41
+
42
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
43
+
44
+ ## [2.0.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.12...@formatjs/intl-supportedvaluesof@2.0.0) (2025-12-15)
45
+
46
+ ### ⚠ BREAKING CHANGES
47
+
48
+ * **@formatjs/intl-supportedvaluesof:** convert to esm (#5458)
49
+
50
+ ### Features
51
+
52
+ * **@formatjs/intl-supportedvaluesof:** convert to esm ([#5458](https://github.com/formatjs/formatjs/issues/5458)) ([04fdc7d](https://github.com/formatjs/formatjs/commit/04fdc7d5dd6b731e8de0c87c5a20d1df584cee96)) - by @longlho
53
+
54
+ ## [1.8.12](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.11...@formatjs/intl-supportedvaluesof@1.8.12) (2025-10-09)
55
+
56
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
57
+
58
+ ## [1.8.11](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.10...@formatjs/intl-supportedvaluesof@1.8.11) (2025-10-03)
59
+
60
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
61
+
62
+ ## [1.8.10](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.9...@formatjs/intl-supportedvaluesof@1.8.10) (2025-03-23)
63
+
64
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
65
+
66
+ ## [1.8.9](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.8...@formatjs/intl-supportedvaluesof@1.8.9) (2025-02-09)
67
+
68
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
69
+
70
+ ## [1.8.8](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.7...@formatjs/intl-supportedvaluesof@1.8.8) (2025-01-02)
71
+
72
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
73
+
74
+ ## [1.8.7](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.6...@formatjs/intl-supportedvaluesof@1.8.7) (2024-12-09)
75
+
76
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
77
+
78
+ ## [1.8.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.5...@formatjs/intl-supportedvaluesof@1.8.6) (2024-12-09)
79
+
80
+ ### Bug Fixes
81
+
82
+ * turn on isolatedDeclarations and specify explicit types everywhere ([4d855c2](https://github.com/formatjs/formatjs/commit/4d855c2324426633eb84c346c76a5fd1ac854780)) - by @longlho
83
+
84
+ ## [1.8.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.4...@formatjs/intl-supportedvaluesof@1.8.5) (2024-12-08)
85
+
86
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
87
+
88
+ ## [1.8.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.3...@formatjs/intl-supportedvaluesof@1.8.4) (2024-11-18)
89
+
90
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
91
+
92
+ ## [1.8.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.2...@formatjs/intl-supportedvaluesof@1.8.3) (2024-11-04)
93
+
94
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
95
+
96
+ ## [1.8.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.1...@formatjs/intl-supportedvaluesof@1.8.2) (2024-11-02)
97
+
98
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
99
+
100
+ ## [1.8.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.8.0...@formatjs/intl-supportedvaluesof@1.8.1) (2024-10-25)
101
+
102
+ ### Bug Fixes
103
+
104
+ * relax tslib req to 2 instead of 2.7 ([930c3e8](https://github.com/formatjs/formatjs/commit/930c3e8ddcc160fde7466449575455f135f78ca6)) - by @longlho
105
+
106
+ # [1.8.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.7.0...@formatjs/intl-supportedvaluesof@1.8.0) (2024-10-25)
107
+
108
+ ### Features
109
+
110
+ * upgrade cldr to v46 ([daafb44](https://github.com/formatjs/formatjs/commit/daafb449ba2fc4553f5a484b969affa1529752db)) - by @longlho
111
+
112
+ # [1.7.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.6.0...@formatjs/intl-supportedvaluesof@1.7.0) (2024-10-21)
113
+
114
+ ### Features
115
+
116
+ * upgrade cldr to v45 ([#4620](https://github.com/formatjs/formatjs/issues/4620)) ([fbb2bbf](https://github.com/formatjs/formatjs/commit/fbb2bbf6e038d5833c1f2752b805002436480948)) - by @longlho
117
+
118
+ # [1.6.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.7...@formatjs/intl-supportedvaluesof@1.6.0) (2024-10-12)
119
+
120
+ ### Features
121
+
122
+ * **@formatjs/intl-supportedvaluesof:** use memoized constructor creation for perf ([8949482](https://github.com/formatjs/formatjs/commit/89494821d7f346d7a6803fe5cc0bf987e3d34324)) - by @longlho
123
+
124
+ # [1.5.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.7...@formatjs/intl-supportedvaluesof@1.5.0) (2024-10-09)
125
+
126
+ ### Features
127
+
128
+ * **@formatjs/intl-supportedvaluesof:** use memoized constructor creation for perf ([8949482](https://github.com/formatjs/formatjs/commit/89494821d7f346d7a6803fe5cc0bf987e3d34324)) - by @longlho
129
+
130
+ ## [1.4.7](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.6...@formatjs/intl-supportedvaluesof@1.4.7) (2024-05-19)
131
+
132
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
133
+
134
+ ## [1.4.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.5...@formatjs/intl-supportedvaluesof@1.4.6) (2024-05-18)
135
+
136
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
137
+
138
+ ## [1.4.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.4...@formatjs/intl-supportedvaluesof@1.4.5) (2024-01-16)
139
+
140
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
141
+
142
+ ## [1.4.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.3...@formatjs/intl-supportedvaluesof@1.4.4) (2024-01-16)
143
+
144
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
145
+
146
+ ## [1.4.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.2...@formatjs/intl-supportedvaluesof@1.4.3) (2023-11-14)
147
+
148
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
149
+
150
+ ## [1.4.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.1...@formatjs/intl-supportedvaluesof@1.4.2) (2023-11-12)
151
+
152
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
153
+
154
+ ## [1.4.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.4.0...@formatjs/intl-supportedvaluesof@1.4.1) (2023-11-06)
155
+
156
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
157
+
158
+ # [1.4.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.3.4...@formatjs/intl-supportedvaluesof@1.4.0) (2023-10-16)
159
+
160
+ ### Features
161
+
162
+ * **@formatjs/intl-supportedvaluesof:** update CLDR to v43 ([ee6d972](https://github.com/formatjs/formatjs/commit/ee6d972365b73b6fbfc312defb05a853eb51e5f0))
163
+
164
+ ## [1.3.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.3.3...@formatjs/intl-supportedvaluesof@1.3.4) (2023-09-10)
165
+
166
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
167
+
168
+ ## [1.3.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.3.2...@formatjs/intl-supportedvaluesof@1.3.3) (2023-09-07)
169
+
170
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
171
+
172
+ ## [1.3.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.3.1...@formatjs/intl-supportedvaluesof@1.3.2) (2023-06-12)
173
+
174
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
175
+
176
+ ## [1.3.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.3.0...@formatjs/intl-supportedvaluesof@1.3.1) (2023-06-06)
177
+
178
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
179
+
180
+ # [1.3.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.2.1...@formatjs/intl-supportedvaluesof@1.3.0) (2023-05-01)
181
+
182
+ ### Features
183
+
184
+ * **@formatjs/intl-datetimeformat:** updated `tzdata` to `2023c` and fixed missing and changed TimeZone ([1b4856b](https://github.com/formatjs/formatjs/commit/1b4856b11c32c6ac99aa8795ee487c92b4d9d9c9))
185
+
186
+ ## [1.2.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.2.0...@formatjs/intl-supportedvaluesof@1.2.1) (2023-02-20)
187
+
188
+ ### Bug Fixes
189
+
190
+ * **@formatjs/intl-supportedvaluesof:** fix package.json ([67180d1](https://github.com/formatjs/formatjs/commit/67180d11f09c62005b1fd1f6b3d59f3af005a785))
191
+
192
+ # [1.2.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.10...@formatjs/intl-supportedvaluesof@1.2.0) (2023-02-20)
193
+
194
+ ### Features
195
+
196
+ * **@formatjs/intl-locale:** implement new proposal features for Intl.Locale ([#3955](https://github.com/formatjs/formatjs/issues/3955)) ([984f923](https://github.com/formatjs/formatjs/commit/984f923f298c578d7c138ca5ad9f12965d73a7d0))
197
+
198
+ ## [1.1.10](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.9...@formatjs/intl-supportedvaluesof@1.1.10) (2022-12-02)
199
+
200
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
201
+
202
+ ## [1.1.9](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.7...@formatjs/intl-supportedvaluesof@1.1.9) (2022-12-01)
203
+
204
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
205
+
206
+ ## [1.1.8](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.7...@formatjs/intl-supportedvaluesof@1.1.8) (2022-12-01)
207
+
208
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
209
+
210
+ ## [1.1.7](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.6...@formatjs/intl-supportedvaluesof@1.1.7) (2022-11-29)
211
+
212
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
213
+
214
+ ## [1.1.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.5...@formatjs/intl-supportedvaluesof@1.1.6) (2022-10-13)
215
+
216
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
217
+
218
+ ## [1.1.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.4...@formatjs/intl-supportedvaluesof@1.1.5) (2022-08-27)
219
+
220
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
221
+
222
+ ## [1.1.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.3...@formatjs/intl-supportedvaluesof@1.1.4) (2022-08-21)
223
+
224
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
225
+
226
+ ## [1.1.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.2...@formatjs/intl-supportedvaluesof@1.1.3) (2022-08-21)
227
+
228
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
229
+
230
+ ## [1.1.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.1...@formatjs/intl-supportedvaluesof@1.1.2) (2022-08-18)
231
+
232
+ **Note:** Version bump only for package @formatjs/intl-supportedvaluesof
233
+
234
+ ## [1.1.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-supportedvaluesof@1.1.0...@formatjs/intl-supportedvaluesof@1.1.1) (2022-07-16)
235
+
236
+ ### Bug Fixes
237
+
238
+ * **@formatjs/cli-lib:** introduce @formatjs/cli-lib as @formatjs/cli Node API ([7c4ebef](https://github.com/formatjs/formatjs/commit/7c4ebef00a6ac2a197b5007e328306bc8e00b445)), closes [#3625](https://github.com/formatjs/formatjs/issues/3625)
239
+
240
+ # 1.1.0 (2022-07-11)
241
+
242
+ ### Bug Fixes
243
+
244
+ * **@formatjs/intl-supportedvaluesof:** fix intl-enumerator build ([a1d95e1](https://github.com/formatjs/formatjs/commit/a1d95e13e21fddf8f13475254daf13d86dd34b6a))
245
+ * **@formatjs/intl-supportedvaluesof:** fixes intl.supportedValuesOf units ([#3699](https://github.com/formatjs/formatjs/issues/3699)) ([23c642c](https://github.com/formatjs/formatjs/commit/23c642c31996f6cbad59b374d59b5bb54d5dc6a2))
246
+
247
+ ### Features
248
+
249
+ * **@formatjs/intl-supportedvaluesof:** porting of proposal-intl-enumeration to typescript ([#3694](https://github.com/formatjs/formatjs/issues/3694)) ([8c95643](https://github.com/formatjs/formatjs/commit/8c95643ca3128f4e0d0c4cd196dd8773467f7db8))
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 FormatJS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,270 @@
1
+ # @formatjs/intl-supportedvaluesof
2
+
3
+ Polyfill for [`Intl.supportedValuesOf()`](https://tc39.es/ecma402/#sec-intl.supportedvaluesof)
4
+
5
+ [![npm Version](https://img.shields.io/npm/v/@formatjs/intl-supportedvaluesof.svg?style=flat-square)](https://www.npmjs.org/package/@formatjs/intl-supportedvaluesof)
6
+
7
+ ## ECMA-402 Spec Compliance
8
+
9
+ This package implements the ECMA-402 `Intl.supportedValuesOf()` specification:
10
+
11
+ - **Spec Section**: [8.3.2 Intl.supportedValuesOf(key)](https://tc39.es/ecma402/#sec-intl.supportedvaluesof)
12
+ - **Returns**: Supported values for internationalization keys
13
+ - **Fully spec-compliant**: No optional parameters, matches native browser behavior
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @formatjs/intl-supportedvaluesof
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### As Polyfill
24
+
25
+ Import the polyfill to make `Intl.supportedValuesOf` available globally:
26
+
27
+ ```javascript
28
+ import '@formatjs/intl-supportedvaluesof/polyfill'
29
+
30
+ // Now available on the global Intl object
31
+ const calendars = Intl.supportedValuesOf('calendar')
32
+ // ['buddhist', 'chinese', 'coptic', 'dangi', 'ethioaa', 'ethiopic', 'gregory', ...]
33
+
34
+ const currencies = Intl.supportedValuesOf('currency')
35
+ // ['AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', ...]
36
+
37
+ const timeZones = Intl.supportedValuesOf('timeZone')
38
+ // ['Africa/Abidjan', 'Africa/Accra', ..., 'Pacific/Wallis']
39
+ ```
40
+
41
+ ### Direct Import
42
+
43
+ Import the function directly without modifying the global namespace:
44
+
45
+ ```javascript
46
+ import {supportedValuesOf} from '@formatjs/intl-supportedvaluesof'
47
+
48
+ const numberingSystems = supportedValuesOf('numberingSystem')
49
+ // ['adlm', 'ahom', 'arab', 'arabext', 'bali', 'beng', 'bhks', ...]
50
+
51
+ const units = supportedValuesOf('unit')
52
+ // ['acre', 'bit', 'byte', 'celsius', 'centimeter', 'day', 'degree', ...]
53
+ ```
54
+
55
+ ## Supported Keys
56
+
57
+ The function accepts one of six string keys and returns an array of supported values:
58
+
59
+ | Key | Returns | Example Values |
60
+ | ------------------- | --------------------------------- | ------------------------------------------------------- |
61
+ | `'calendar'` | Supported calendar systems | `'gregory'`, `'islamic'`, `'buddhist'`, `'chinese'` |
62
+ | `'collation'` | Supported collation algorithms | `'emoji'`, `'eor'`, `'phonebk'`, `'search'` |
63
+ | `'currency'` | Supported ISO 4217 currency codes | `'USD'`, `'EUR'`, `'JPY'`, `'GBP'` |
64
+ | `'numberingSystem'` | Supported numbering systems | `'arab'`, `'latn'`, `'hanidec'`, `'thai'` |
65
+ | `'timeZone'` | Supported IANA time zones | `'America/New_York'`, `'Europe/London'`, `'Asia/Tokyo'` |
66
+ | `'unit'` | Supported measurement units | `'meter'`, `'celsius'`, `'liter'`, `'acre'` |
67
+
68
+ ## API
69
+
70
+ ### `supportedValuesOf(key: string): string[]`
71
+
72
+ Returns an array of supported values for the given key.
73
+
74
+ **Parameters:**
75
+
76
+ - `key` - One of: `'calendar'`, `'collation'`, `'currency'`, `'numberingSystem'`, `'timeZone'`, `'unit'`
77
+
78
+ **Returns:**
79
+
80
+ - A sorted array of unique string values
81
+
82
+ **Throws:**
83
+
84
+ - `RangeError` - If the key is not one of the supported values
85
+
86
+ **Example:**
87
+
88
+ ```javascript
89
+ import {supportedValuesOf} from '@formatjs/intl-supportedvaluesof'
90
+
91
+ // Valid usage
92
+ const calendars = supportedValuesOf('calendar')
93
+ console.log(calendars) // ['buddhist', 'chinese', 'coptic', ...]
94
+
95
+ // Invalid key throws RangeError
96
+ try {
97
+ supportedValuesOf('invalid')
98
+ } catch (e) {
99
+ console.error(e) // RangeError: Invalid key: invalid
100
+ }
101
+ ```
102
+
103
+ ## Implementation Details
104
+
105
+ This polyfill **dynamically validates** candidate values against the actual `Intl` implementation rather than maintaining static lists. This approach ensures:
106
+
107
+ - **Accuracy**: Results match what your JavaScript runtime actually supports
108
+ - **Runtime-specific**: Different engines (V8, JavaScriptCore, SpiderMonkey) may support different values
109
+ - **Up-to-date**: No need to manually update lists when new values are added to engines
110
+
111
+ ### How It Works
112
+
113
+ For each category, the implementation:
114
+
115
+ 1. **Loads candidate values** from CLDR (Unicode Common Locale Data Repository)
116
+ 2. **Tests each value** by attempting to create an appropriate `Intl` formatter with that value
117
+ 3. **Validates acceptance** by checking if the formatter actually uses the requested value
118
+ 4. **Returns filtered list** of only the values that passed validation
119
+
120
+ ### Example: Calendar Validation
121
+
122
+ ```javascript
123
+ // Implementation tests if a calendar is supported:
124
+ function isSupportedCalendar(calendar) {
125
+ try {
126
+ // Attempt to create DateTimeFormat with this calendar
127
+ const formatter = new Intl.DateTimeFormat(`en-u-ca-${calendar}`)
128
+ // Verify the calendar was actually accepted
129
+ const resolvedOptions = formatter.resolvedOptions()
130
+ return resolvedOptions.calendar === calendar
131
+ } catch {
132
+ return false
133
+ }
134
+ }
135
+ ```
136
+
137
+ This ensures that only calendars **actually supported** by your runtime are returned, not just a static list.
138
+
139
+ ## TypeScript Support
140
+
141
+ This package includes TypeScript type definitions. When using as a polyfill, the global `Intl` namespace is automatically augmented:
142
+
143
+ ```typescript
144
+ import '@formatjs/intl-supportedvaluesof/polyfill'
145
+
146
+ // TypeScript knows about Intl.supportedValuesOf
147
+ const calendars: string[] = Intl.supportedValuesOf('calendar')
148
+
149
+ // TypeScript will error on invalid keys
150
+ Intl.supportedValuesOf('invalid') // Error: Argument of type '"invalid"' is not assignable...
151
+ ```
152
+
153
+ ## Browser Support
154
+
155
+ This polyfill is only needed for older browsers that don't have native support for `Intl.supportedValuesOf()`. Native support is available in:
156
+
157
+ - Chrome 99+
158
+ - Edge 99+
159
+ - Firefox 93+
160
+ - Safari 15.4+
161
+
162
+ The polyfill requires the following `Intl` APIs to be available:
163
+
164
+ - `Intl.DateTimeFormat` (for `calendar`, `timeZone`, `numberingSystem`)
165
+ - `Intl.NumberFormat` (for `currency`, `unit`, `numberingSystem`)
166
+ - `Intl.Collator` (for `collation`)
167
+
168
+ ## Breaking Changes in v3.0
169
+
170
+ ### Removed: Non-standard `locale` parameter
171
+
172
+ **v2.x and earlier** had a non-standard optional `locale` parameter that filtered results by locale. This has been **removed** to match the ECMA-402 specification.
173
+
174
+ ```javascript
175
+ // ❌ v2.x (non-standard, no longer works)
176
+ const calendars = supportedValuesOf('calendar', 'en-US')
177
+
178
+ // ✅ v3.0 (spec-compliant)
179
+ const calendars = supportedValuesOf('calendar')
180
+ ```
181
+
182
+ The function now always returns **ALL** supported values, matching native browser behavior.
183
+
184
+ ### Migration Guide
185
+
186
+ If you need locale-specific filtering in v3.0+, implement it yourself:
187
+
188
+ ```javascript
189
+ import {supportedValuesOf} from '@formatjs/intl-supportedvaluesof'
190
+
191
+ // Get all supported calendars
192
+ const allCalendars = supportedValuesOf('calendar')
193
+
194
+ // Filter by what a specific locale actually uses/accepts
195
+ const enUSCalendars = allCalendars.filter(calendar => {
196
+ try {
197
+ const formatter = new Intl.DateTimeFormat('en-US', {calendar})
198
+ return formatter.resolvedOptions().calendar === calendar
199
+ } catch {
200
+ return false
201
+ }
202
+ })
203
+ ```
204
+
205
+ However, note that most use cases don't need locale-specific filtering, as the spec's design returns all values that **any** locale could use.
206
+
207
+ ## Examples
208
+
209
+ ### Check if a calendar is supported
210
+
211
+ ```javascript
212
+ import {supportedValuesOf} from '@formatjs/intl-supportedvaluesof'
213
+
214
+ const calendars = supportedValuesOf('calendar')
215
+
216
+ if (calendars.includes('islamic')) {
217
+ console.log('Islamic calendar is supported')
218
+ const formatter = new Intl.DateTimeFormat('en-US', {calendar: 'islamic'})
219
+ console.log(formatter.format(new Date()))
220
+ }
221
+ ```
222
+
223
+ ### Display all supported currencies
224
+
225
+ ```javascript
226
+ import {supportedValuesOf} from '@formatjs/intl-supportedvaluesof'
227
+
228
+ const currencies = supportedValuesOf('currency')
229
+
230
+ console.log(`This runtime supports ${currencies.length} currencies:`)
231
+ currencies.forEach(currency => {
232
+ const formatter = new Intl.NumberFormat('en-US', {
233
+ style: 'currency',
234
+ currency,
235
+ })
236
+ console.log(`${currency}: ${formatter.format(100)}`)
237
+ })
238
+ ```
239
+
240
+ ### Validate user input
241
+
242
+ ```javascript
243
+ import {supportedValuesOf} from '@formatjs/intl-supportedvaluesof'
244
+
245
+ function isValidTimeZone(timeZone) {
246
+ const supportedTimeZones = supportedValuesOf('timeZone')
247
+ return supportedTimeZones.includes(timeZone)
248
+ }
249
+
250
+ console.log(isValidTimeZone('America/New_York')) // true
251
+ console.log(isValidTimeZone('Invalid/TimeZone')) // false
252
+ ```
253
+
254
+ ## License
255
+
256
+ MIT
257
+
258
+ ## Related Packages
259
+
260
+ - [@formatjs/intl](https://www.npmjs.com/package/@formatjs/intl) - Complete FormatJS internationalization suite
261
+ - [@formatjs/intl-datetimeformat](https://www.npmjs.com/package/@formatjs/intl-datetimeformat) - Intl.DateTimeFormat polyfill
262
+ - [@formatjs/intl-numberformat](https://www.npmjs.com/package/@formatjs/intl-numberformat) - Intl.NumberFormat polyfill
263
+ - [@formatjs/intl-pluralrules](https://www.npmjs.com/package/@formatjs/intl-pluralrules) - Intl.PluralRules polyfill
264
+
265
+ ## Resources
266
+
267
+ - [ECMA-402 Specification](https://tc39.es/ecma402/)
268
+ - [MDN: Intl.supportedValuesOf()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf)
269
+ - [Unicode CLDR](https://cldr.unicode.org/)
270
+ - [FormatJS Documentation](https://formatjs.io/)
package/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ export type {SupportedValuesOf} from './src/index.js'
2
+ export type {Calendar} from './src/calendars.generated.js'
3
+ export type {Collation} from './src/collations.generated.js'
4
+ export type {Currency} from './src/currencies.generated.js'
5
+ export type {Timezone} from './src/timezones.generated.js'
6
+ export type {Unit} from './src/units.generated.js'
7
+
8
+ export {shouldPolyfill} from './should-polyfill.js'
9
+ export {supportedValuesOf} from './src/index.js'