@reykjavik/webtools 0.1.13 → 0.1.14

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.1.14
8
+
9
+ _2024-03-06_
10
+
11
+ - fix: Remove unneccessary `@__PURE__` pragma
12
+ - fix: List `fixIcelandicLocale.js` in `pkg.sideEffects`
13
+
7
14
  ## 0.1.13
8
15
 
9
16
  _2024-03-06_
@@ -1,3 +1,21 @@
1
+ /*
2
+ TODO: Also attempt to patch these Classes:
3
+
4
+ - `Intl.Collator`
5
+ Same kind of magic as `String.prototype.localeCompare`
6
+
7
+ - `Intl.NumberFormat`
8
+ Only support default plain-number and percent formatting,
9
+ not currency or unit — UNLESS we do some string-replacement hackery,
10
+ and then we may need to handle the possibility of locales arrays
11
+ already containing Danish ahead of "is".
12
+
13
+ - `Intl.DateTimeFormat`
14
+ Possible with some mad-scientist string-replacement hackery and
15
+ the `locales` array detection magic, as mentioned above.
16
+
17
+ Mantra: Partial Icelandic suppoort is better than no Icelandic support.
18
+ */
1
19
  const locAliases = {
2
20
  // Danish is good enough substitution for Icelandic
3
21
  is: 'da',
@@ -8,7 +26,7 @@ const mapLocales = (locales) => {
8
26
  return locales.map((loc) => locAliases[loc.toLowerCase()] || loc);
9
27
  };
10
28
  // ---------------------------------------------------------------------------
11
- if ( /*#__PURE__*/'ö'.localeCompare('p', 'is') < 0) {
29
+ if ('ö'.localeCompare('p', 'is') < 0) {
12
30
  const _localeCompare = String.prototype.localeCompare;
13
31
  /**
14
32
  * Polyfill for String.prototype.localeCompare for the 'is' locale
@@ -1,4 +1,22 @@
1
1
  "use strict";
2
+ /*
3
+ TODO: Also attempt to patch these Classes:
4
+
5
+ - `Intl.Collator`
6
+ Same kind of magic as `String.prototype.localeCompare`
7
+
8
+ - `Intl.NumberFormat`
9
+ Only support default plain-number and percent formatting,
10
+ not currency or unit — UNLESS we do some string-replacement hackery,
11
+ and then we may need to handle the possibility of locales arrays
12
+ already containing Danish ahead of "is".
13
+
14
+ - `Intl.DateTimeFormat`
15
+ Possible with some mad-scientist string-replacement hackery and
16
+ the `locales` array detection magic, as mentioned above.
17
+
18
+ Mantra: Partial Icelandic suppoort is better than no Icelandic support.
19
+ */
2
20
  const locAliases = {
3
21
  // Danish is good enough substitution for Icelandic
4
22
  is: 'da',
@@ -9,7 +27,7 @@ const mapLocales = (locales) => {
9
27
  return locales.map((loc) => locAliases[loc.toLowerCase()] || loc);
10
28
  };
11
29
  // ---------------------------------------------------------------------------
12
- if ( /*#__PURE__*/'ö'.localeCompare('p', 'is') < 0) {
30
+ if ('ö'.localeCompare('p', 'is') < 0) {
13
31
  const _localeCompare = String.prototype.localeCompare;
14
32
  /**
15
33
  * Polyfill for String.prototype.localeCompare for the 'is' locale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reykjavik/webtools",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Misc. JS/TS helpers used by Reykjavík City's web dev teams.",
5
5
  "main": "index.js",
6
6
  "repository": "ssh://git@github.com:reykjavikcity/webtools.git",
@@ -36,7 +36,9 @@
36
36
  "engines": {
37
37
  "node": ">=16"
38
38
  },
39
- "sideEffects": false,
39
+ "sideEffects": [
40
+ "**/fixIcelandicLocale.js"
41
+ ],
40
42
  "exports": {
41
43
  ".": {
42
44
  "import": "./esm/index.js",