@mdn/fred 1.6.2 → 1.7.0

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 (65) hide show
  1. package/.env-dist +4 -0
  2. package/CHANGELOG.md +25 -0
  3. package/build/eslint-fred.js +6 -4
  4. package/build/plugins/generate-element-map.js +3 -2
  5. package/build/utils.js +0 -23
  6. package/components/curriculum/module.css +1 -0
  7. package/components/curriculum-module/server.css +1 -0
  8. package/components/env/index.js +3 -0
  9. package/components/footer/server.js +1 -1
  10. package/components/live-sample-result/element.js +1 -0
  11. package/components/menu/base.css +2 -1
  12. package/components/menu/constants.js +443 -147
  13. package/components/menu/missing-docs.json +140 -0
  14. package/components/menu/server.js +78 -657
  15. package/components/menu/types.d.ts +50 -0
  16. package/components/menu/update-missing-docs.js +66 -0
  17. package/components/outer-layout/utils.js +2 -2
  18. package/components/play-runner/element.js +14 -6
  19. package/entry.client.js +1 -0
  20. package/hooks/ga-init.js +31 -0
  21. package/hooks/glean-init.js +2 -6
  22. package/l10n/fr.ftl +145 -1
  23. package/out/service-worker.js +1 -1
  24. package/out/service-worker.js.map +1 -1
  25. package/out/static/client/{6480.09f744cd2fb69ed8.js → 6480.c839ead24f125a7e.js} +3 -2
  26. package/out/static/client/{6480.09f744cd2fb69ed8.js.map → 6480.c839ead24f125a7e.js.map} +1 -1
  27. package/out/static/client/9914.021220acc0d3e777.js +11 -0
  28. package/out/static/client/9914.021220acc0d3e777.js.map +1 -0
  29. package/out/static/client/index.0f1f5c05b3c9458b.js +412 -0
  30. package/out/static/client/index.0f1f5c05b3c9458b.js.map +1 -0
  31. package/out/static/client/{runtime.b178b9749f31202a.js → runtime.f3c0cd5b45c6e874.js} +2 -2
  32. package/out/static/client/{runtime.b178b9749f31202a.js.map → runtime.f3c0cd5b45c6e874.js.map} +1 -1
  33. package/out/static/client/stats.json +116 -116
  34. package/out/static/client/styles-curriculum-landing.cbaf6ff367369a26.css.map +1 -1
  35. package/out/static/client/styles-curriculum-module.c7ec78d3e724cf64.css.map +1 -1
  36. package/out/static/client/{styles-global.fb7afecd89ca2dff.js → styles-global.52fa98f0e9ec0040.js} +1 -1
  37. package/out/static/client/{styles-global.684fd2c5254c94b8.css → styles-global.75b8c75561733419.css} +2 -2
  38. package/out/static/client/{styles-global.684fd2c5254c94b8.css.map → styles-global.75b8c75561733419.css.map} +1 -1
  39. package/out/static/client/styles-menu.c41c14be9597dcd9.css +2 -0
  40. package/out/static/client/styles-menu.c41c14be9597dcd9.css.map +1 -0
  41. package/out/static/legacy/asset-manifest.json +5 -5
  42. package/out/static/legacy/{index.ad3600b01e18974e.html → index.4d5b9af908771553.html} +1 -1
  43. package/out/static/legacy/{index.5592b02d966df8ba.js → index.e275f57e34e5ad42.js} +3 -3
  44. package/out/static/legacy/{index.5592b02d966df8ba.js.map → index.e275f57e34e5ad42.js.map} +1 -1
  45. package/out/static/legacy/stats.json +10 -10
  46. package/out/static/legacy/{yari.8ce0be252d1ae155.js → yari.28c752c4002c881d.js} +3 -3
  47. package/out/static/legacy/{yari.8ce0be252d1ae155.js.map → yari.28c752c4002c881d.js.map} +1 -1
  48. package/out/static/ssr/index.js +306 -580
  49. package/out/static/ssr/index.js.map +1 -1
  50. package/out/static/ssr/stats.json +4 -4
  51. package/package.json +9 -9
  52. package/utils/dnt-helper.js +59 -0
  53. package/utils/name-transformation.js +40 -0
  54. package/utils/telemetry-opt-out.js +12 -0
  55. package/components/menu/check-missing-docs.js +0 -44
  56. package/out/static/client/9914.251fe19f0038e97b.js +0 -11
  57. package/out/static/client/9914.251fe19f0038e97b.js.map +0 -1
  58. package/out/static/client/index.26176fe4ab13dce5.js +0 -268
  59. package/out/static/client/index.26176fe4ab13dce5.js.map +0 -1
  60. package/out/static/client/styles-menu.5193bf2642ae7d64.css +0 -2
  61. package/out/static/client/styles-menu.5193bf2642ae7d64.css.map +0 -1
  62. /package/out/static/client/{6480.09f744cd2fb69ed8.js.LICENSE.txt → 6480.c839ead24f125a7e.js.LICENSE.txt} +0 -0
  63. /package/out/static/client/{index.26176fe4ab13dce5.js.LICENSE.txt → index.0f1f5c05b3c9458b.js.LICENSE.txt} +0 -0
  64. /package/out/static/legacy/{index.5592b02d966df8ba.js.LICENSE.txt → index.e275f57e34e5ad42.js.LICENSE.txt} +0 -0
  65. /package/out/static/legacy/{yari.8ce0be252d1ae155.js.LICENSE.txt → yari.28c752c4002c881d.js.LICENSE.txt} +0 -0
package/.env-dist CHANGED
@@ -25,6 +25,10 @@ RARI_URL="http://localhost:8083"
25
25
  # FRED_GLEAN_ENABLED=true
26
26
  # FRED_GLEAN_DEBUG=true
27
27
 
28
+ # uncomment to enable Google Analytics 4
29
+ # FRED_GA_ENABLED=true
30
+ # FRED_GA_MEASUREMENT_ID=G-XXXXXXXXXX
31
+
28
32
  # legacy react-specific environment variables
29
33
  REACT_APP_KUMA_HOST="localhost:3000"
30
34
  REACT_APP_FXA_SIGNIN_URL="/users/fxa/login/authenticate/"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.0](https://github.com/mdn/fred/compare/v1.6.2...v1.7.0) (2025-10-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * **menu:** convert content to data + manage missing with script ([#861](https://github.com/mdn/fred/issues/861)) ([e9be891](https://github.com/mdn/fred/commit/e9be891e1972ebecd4160e6e6b9f6e34aa491616))
9
+ * **telemetry:** port Google Analytics ([#905](https://github.com/mdn/fred/issues/905)) ([e88d977](https://github.com/mdn/fred/commit/e88d977effe722f5619aebd9cdac64e796ceb530))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **live-sample-result:** use code hash as subdomain ([#922](https://github.com/mdn/fred/issues/922)) ([db48f7b](https://github.com/mdn/fred/commit/db48f7b8f9a858a2c85b6ea3727d9e6468374b49))
15
+ * **windows:** remove fdir from ssr bundle ([#926](https://github.com/mdn/fred/issues/926)) ([f724bff](https://github.com/mdn/fred/commit/f724bff89278402e958da1a7a90e5d4a5e2dcb6b))
16
+
17
+
18
+ ### Miscellaneous
19
+
20
+ * **deps-dev:** bump @mdn/browser-compat-data from 7.1.12 to 7.1.13 ([#916](https://github.com/mdn/fred/issues/916)) ([81b9966](https://github.com/mdn/fred/commit/81b99662edbdd0abb1da8641a6491d7010a3adf0))
21
+ * **deps-dev:** bump @mdn/browser-compat-data from 7.1.13 to 7.1.14 ([#938](https://github.com/mdn/fred/issues/938)) ([411240f](https://github.com/mdn/fred/commit/411240f96714cf6c5404645cdc913e637ed72809))
22
+ * **deps-dev:** bump the dev group across 1 directory with 6 updates ([#943](https://github.com/mdn/fred/issues/943)) ([2911855](https://github.com/mdn/fred/commit/29118556f9d618fa41c860de781d54064a03d34e))
23
+ * **deps:** bump @mdn/rari from 0.1.52 to 0.1.53 ([#932](https://github.com/mdn/fred/issues/932)) ([42d79e4](https://github.com/mdn/fred/commit/42d79e42187698697d080d2d5d7de721e96220e8))
24
+ * **l10n:** update french localization strings for various features ([#767](https://github.com/mdn/fred/issues/767)) ([be247ea](https://github.com/mdn/fred/commit/be247eafcbf5dc48dc300919c8bd5be6fac846d5))
25
+ * **menu:** adjust case of "CSS values and units" links ([#910](https://github.com/mdn/fred/issues/910)) ([236a727](https://github.com/mdn/fred/commit/236a7275dcaf3e98a657674f72b8628743774338))
26
+ * update ill cased links ([236a727](https://github.com/mdn/fred/commit/236a7275dcaf3e98a657674f72b8628743774338))
27
+
3
28
  ## [1.6.2](https://github.com/mdn/fred/compare/v1.6.1...v1.6.2) (2025-10-13)
4
29
 
5
30
 
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
 
3
- import { toCamelCase } from "./utils.js";
3
+ import { camelToKebabCase } from "../utils/name-transformation.js";
4
4
 
5
5
  /** @type {import("eslint").ESLint.Plugin} */
6
6
  export default {
@@ -26,7 +26,9 @@ export default {
26
26
  });
27
27
  }
28
28
 
29
- const expectedDir = toCamelCase(className.replace(/^MDN/, ""));
29
+ const expectedDir = camelToKebabCase(
30
+ className.replace(/^MDN/, ""),
31
+ );
30
32
  const expectedPath = path.join(
31
33
  "components",
32
34
  expectedDir,
@@ -57,7 +59,7 @@ export default {
57
59
  const [className, superClassName] = getClassNames(node);
58
60
 
59
61
  if (superClassName === "ServerComponent") {
60
- const expectedDir = toCamelCase(className);
62
+ const expectedDir = camelToKebabCase(className);
61
63
  const expectedPath = path.join(
62
64
  "components",
63
65
  expectedDir,
@@ -95,7 +97,7 @@ export default {
95
97
  });
96
98
  }
97
99
 
98
- const expectedDir = toCamelCase(
100
+ const expectedDir = camelToKebabCase(
99
101
  className.replace(/Sandbox$/, ""),
100
102
  );
101
103
  const expectedPath = path.join(
@@ -1,7 +1,8 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
3
 
4
- import { crawl, toPascalCase } from "../utils.js";
4
+ import { kebabToPascalCase } from "../../utils/name-transformation.js";
5
+ import { crawl } from "../utils.js";
5
6
 
6
7
  /**
7
8
  * @import { Compiler } from "@rspack/core"
@@ -26,7 +27,7 @@ export class GenerateElementMapPlugin {
26
27
  path.relative(compiler.context, filePath).replaceAll("\\", "/");
27
28
  const folderName = relPath.split("/").at(-2);
28
29
  const tagName = `mdn-${folderName}`;
29
- const className = toPascalCase(tagName);
30
+ const className = kebabToPascalCase(tagName);
30
31
  return `"${tagName}": import("${relPath}").${className};`;
31
32
  });
32
33
 
package/build/utils.js CHANGED
@@ -1,28 +1,5 @@
1
1
  import { fdir } from "fdir";
2
2
 
3
- const ACRONYMS = new Set(["MDN", "IX"]);
4
-
5
- /** @param {string} name */
6
- export function toPascalCase(name) {
7
- return name
8
- .split("-")
9
- .map((word) => {
10
- if (ACRONYMS.has(word.toUpperCase())) {
11
- return word.toUpperCase();
12
- }
13
- return word.charAt(0).toUpperCase() + word.slice(1);
14
- })
15
- .join("");
16
- }
17
-
18
- /** @param {string} name */
19
- export function toCamelCase(name) {
20
- return name
21
- .replaceAll(/([a-z0-9])([A-Z])/g, "$1-$2")
22
- .replaceAll(/([A-Z])([A-Z][a-z])/g, "$1-$2")
23
- .toLowerCase();
24
- }
25
-
26
3
  /**
27
4
  * @param {string} root
28
5
  * @param {(path: string, isDirectory: boolean) => boolean} filter
@@ -93,6 +93,7 @@
93
93
 
94
94
  background: var(--curriculum-bg-color);
95
95
  border-radius: 1em;
96
+
96
97
  text-rendering: optimizelegibility;
97
98
  }
98
99
  }
@@ -111,6 +111,7 @@
111
111
 
112
112
  background: var(--curriculum-bg-color);
113
113
  border-radius: 1em;
114
+
114
115
  text-rendering: optimizelegibility;
115
116
  }
116
117
  }
@@ -21,6 +21,9 @@ export const FXA_SIGNOUT_URL = parseString(
21
21
  "/users/fxa/login/logout/",
22
22
  );
23
23
 
24
+ export const GA_ENABLED = parseBool("GA_ENABLED", false);
25
+ export const GA_MEASUREMENT_ID = parseString("GA_MEASUREMENT_ID", "");
26
+
24
27
  /** Set to non-prod default, because we don't want glean to run without explicitly enabling. */
25
28
  export const GLEAN_ENABLED = parseBool("GLEAN_ENABLED", false);
26
29
  /** Set to non-prod default, because we don't want glean to run without explicitly enabling. */
@@ -129,7 +129,7 @@ const mozillaLinks = (context) => [
129
129
  external: true,
130
130
  },
131
131
  {
132
- text: context.l10n`Cookies`,
132
+ text: context.l10n`Telemetry Settings`,
133
133
  href: "https://www.mozilla.org/en-US/privacy/websites/data-preferences/",
134
134
  external: true,
135
135
  },
@@ -113,6 +113,7 @@ export class MDNLiveSampleResult extends L10nMixin(LitElement) {
113
113
  ...new Set(["allow-modals", ...(this.sandbox?.split(" ") || [])]),
114
114
  ].join(" ")}
115
115
  .srcPrefix=${this.srcPrefix}
116
+ permalink
116
117
  style=${styleMap({
117
118
  height: this.height
118
119
  ? `${this.height}${/[0-9]$/.test(this.height) ? "px" : ""}`
@@ -158,7 +158,6 @@
158
158
 
159
159
  .menu__panel-icon {
160
160
  display: inline-flex;
161
- column-gap: 0.5rem;
162
161
  align-items: center;
163
162
 
164
163
  &::before {
@@ -167,6 +166,8 @@
167
166
  width: 1.25rem;
168
167
  height: 1.25rem;
169
168
 
169
+ margin-inline-end: 0.5rem;
170
+
170
171
  content: "";
171
172
 
172
173
  background-color: currentcolor;