@formatjs/intl-locale 5.3.6 → 5.3.8

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
@@ -9824,16 +9841,12 @@ function hasIncompleteLocaleInfo() {
9824
9841
  }
9825
9842
  }
9826
9843
  function shouldPolyfill() {
9827
- return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
9844
+ return typeof Intl === "undefined" || !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
9828
9845
  }
9829
9846
  //#endregion
9830
9847
  //#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
- });
9848
+ const intl = ensureIntl();
9849
+ if (shouldPolyfill()) defineProperty(intl, "Locale", { value: Locale });
9837
9850
  //#endregion
9838
9851
 
9839
9852
  //# 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
@@ -4706,16 +4723,12 @@ function hasIncompleteLocaleInfo() {
4706
4723
  }
4707
4724
  }
4708
4725
  function shouldPolyfill() {
4709
- return !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
4726
+ return typeof Intl === "undefined" || !("Locale" in Intl) || hasIntlGetCanonicalLocalesBug() || hasIncompleteLocaleInfo() || !hasVariantsProperty();
4710
4727
  }
4711
4728
  //#endregion
4712
4729
  //#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
- });
4730
+ const intl = ensureIntl();
4731
+ if (shouldPolyfill()) defineProperty(intl, "Locale", { value: Locale });
4719
4732
  //#endregion
4720
4733
 
4721
4734
  //# sourceMappingURL=polyfill.js.map