@formatjs/intl-locale 5.3.7 → 5.3.9

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/polyfill.iife.js CHANGED
@@ -140,6 +140,23 @@ const strategies = {
140
140
  };
141
141
  //#endregion
142
142
  //#region packages/ecma402-abstract/utils.js
143
+ function defineProperty(target, name, { value }) {
144
+ Object.defineProperty(target, name, {
145
+ configurable: true,
146
+ enumerable: false,
147
+ writable: true,
148
+ value
149
+ });
150
+ }
151
+ function ensureIntl() {
152
+ if (typeof Intl === "undefined") Object.defineProperty(globalThis, "Intl", {
153
+ configurable: true,
154
+ enumerable: false,
155
+ writable: true,
156
+ value: {}
157
+ });
158
+ return Intl;
159
+ }
143
160
  /**
144
161
  * 7.3.5 CreateDataProperty
145
162
  * @param target
@@ -159,7 +176,6 @@ function invariant(condition, message, Err = Error) {
159
176
  }
160
177
  memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
161
178
  memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
162
- memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
163
179
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
164
180
  //#endregion
165
181
  //#region node_modules/.aspect_rules_js/@formatjs+intl-supportedvaluesof@0.0.0/node_modules/@formatjs/intl-supportedvaluesof/index.js
@@ -258,7 +274,6 @@ function getSupportedCollations() {
258
274
  }
259
275
  const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
260
276
  memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
261
- memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
262
277
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
263
278
  const currencies = [
264
279
  "ADP",
@@ -9824,16 +9839,12 @@ function hasIncompleteLocaleInfo() {
9824
9839
  }
9825
9840
  }
9826
9841
  function shouldPolyfill() {
9827
- return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
9842
+ return typeof Intl === "undefined" || !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
9828
9843
  }
9829
9844
  //#endregion
9830
9845
  //#region packages/intl-locale/polyfill.ts
9831
- if (shouldPolyfill()) Object.defineProperty(Intl, "Locale", {
9832
- value: Locale,
9833
- writable: true,
9834
- enumerable: false,
9835
- configurable: true
9836
- });
9846
+ const intl = ensureIntl();
9847
+ if (shouldPolyfill()) defineProperty(intl, "Locale", { value: Locale });
9837
9848
  //#endregion
9838
9849
 
9839
9850
  //# sourceMappingURL=polyfill.iife.js.map
package/polyfill.js CHANGED
@@ -136,6 +136,23 @@ const strategies = {
136
136
  };
137
137
  //#endregion
138
138
  //#region packages/ecma402-abstract/utils.js
139
+ function defineProperty(target, name, { value }) {
140
+ Object.defineProperty(target, name, {
141
+ configurable: true,
142
+ enumerable: false,
143
+ writable: true,
144
+ value
145
+ });
146
+ }
147
+ function ensureIntl() {
148
+ if (typeof Intl === "undefined") Object.defineProperty(globalThis, "Intl", {
149
+ configurable: true,
150
+ enumerable: false,
151
+ writable: true,
152
+ value: {}
153
+ });
154
+ return Intl;
155
+ }
139
156
  /**
140
157
  * 7.3.5 CreateDataProperty
141
158
  * @param target
@@ -155,7 +172,6 @@ function invariant(condition, message, Err = Error) {
155
172
  }
156
173
  memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
157
174
  memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
158
- memoize((...args) => new Intl.Locale(...args), { strategy: strategies.variadic });
159
175
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
160
176
  //#endregion
161
177
  //#region node_modules/.aspect_rules_js/@formatjs_generated+cldr.locale@0.0.0/node_modules/@formatjs_generated/cldr.locale/character-orders.js
@@ -4706,16 +4722,12 @@ function hasIncompleteLocaleInfo() {
4706
4722
  }
4707
4723
  }
4708
4724
  function shouldPolyfill() {
4709
- return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
4725
+ return typeof Intl === "undefined" || !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
4710
4726
  }
4711
4727
  //#endregion
4712
4728
  //#region packages/intl-locale/polyfill.ts
4713
- if (shouldPolyfill()) Object.defineProperty(Intl, "Locale", {
4714
- value: Locale,
4715
- writable: true,
4716
- enumerable: false,
4717
- configurable: true
4718
- });
4729
+ const intl = ensureIntl();
4730
+ if (shouldPolyfill()) defineProperty(intl, "Locale", { value: Locale });
4719
4731
  //#endregion
4720
4732
 
4721
4733
  //# sourceMappingURL=polyfill.js.map