@mdn/fred 1.2.0 → 1.3.1

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 (111) hide show
  1. package/.env-dist +3 -3
  2. package/CHANGELOG.md +34 -0
  3. package/build/ssr.js +1 -0
  4. package/components/env/README.md +2 -0
  5. package/components/env/index.js +8 -2
  6. package/components/env/utils.js +16 -4
  7. package/components/outer-layout/server.js +4 -6
  8. package/components/play-runner/element.js +7 -2
  9. package/l10n/en-US.ftl +2 -2
  10. package/out/service-worker.js +1 -1
  11. package/out/service-worker.js.map +1 -1
  12. package/out/static/client/2192.047e085427f96849.js +2 -0
  13. package/out/static/client/2192.047e085427f96849.js.map +1 -0
  14. package/out/static/client/{9914.d49932c28ec56667.js → 9914.0e9589033d2579e2.js} +2 -2
  15. package/out/static/client/9914.0e9589033d2579e2.js.map +1 -0
  16. package/out/static/client/{index.0910bee955d71d1b.js → index.55048de2c0265ab9.js} +12 -12
  17. package/out/static/client/index.55048de2c0265ab9.js.map +1 -0
  18. package/out/static/client/{runtime.3216007ef48b58b9.js → runtime.aa4d3521a7a5fab7.js} +2 -2
  19. package/out/static/client/{runtime.3216007ef48b58b9.js.map → runtime.aa4d3521a7a5fab7.js.map} +1 -1
  20. package/out/static/client/stats.json +236 -236
  21. package/out/static/client/{styles-a11y-menu.87133247d94d171f.js → styles-a11y-menu.7611b4bce04dce87.js} +1 -1
  22. package/out/static/client/{styles-advertising.a820b0fbd3627483.js → styles-advertising.6ef20f7efd05a15e.js} +1 -1
  23. package/out/static/client/{styles-article-footer.6be3444c8d5eb565.js → styles-article-footer.cc0f537c8ada7c9b.js} +1 -1
  24. package/out/static/client/{styles-banner.bca362a6a4f7c302.js → styles-banner.9d03daba84c11958.js} +1 -1
  25. package/out/static/client/styles-baseline-indicator.33eb05f9a9b91b89.js +1 -0
  26. package/out/static/client/{styles-blog-index.acbed372695bc055.js → styles-blog-index.ef4c3381388cfc3c.js} +1 -1
  27. package/out/static/client/{styles-blog-post.72b868f89027427f.js → styles-blog-post.ab28b6e530a52ebd.js} +1 -1
  28. package/out/static/client/{styles-breadcrumbs-bar.0e8d97523444c0fe.js → styles-breadcrumbs-bar.a5b3dde8e4982283.js} +1 -1
  29. package/out/static/client/{styles-breadcrumbs.9160a3861a8ab53a.js → styles-breadcrumbs.5333e663949a9a4d.js} +1 -1
  30. package/out/static/client/{styles-button.9ae9af48571a4080.js → styles-button.ef5d0faf165ee6e2.js} +1 -1
  31. package/out/static/client/{styles-content-section.ec1b9dc73aceca10.js → styles-content-section.9fe8a1ad9c2259f7.js} +1 -1
  32. package/out/static/client/styles-contributor-spotlight.2a64f233a4b2f8cf.js +1 -0
  33. package/out/static/client/{styles-curriculum-about.14f748159af30620.js → styles-curriculum-about.5b5af2be7bfeb792.js} +1 -1
  34. package/out/static/client/styles-curriculum-default.56f461a14f48000f.js +1 -0
  35. package/out/static/client/styles-curriculum-landing.0b13e3b8789c8975.js +1 -0
  36. package/out/static/client/{styles-curriculum-module.7957e2e3bd0eafb5.js → styles-curriculum-module.09d969ccdd8fba0e.js} +1 -1
  37. package/out/static/client/styles-curriculum-overview.0b6ec4922ffa21cd.js +1 -0
  38. package/out/static/client/{styles-featured-articles.fe5075936dc1689d.js → styles-featured-articles.bf0dd66c721166d5.js} +1 -1
  39. package/out/static/client/{styles-footer.5a5264232af3c286.js → styles-footer.abd19f8639decb33.js} +1 -1
  40. package/out/static/client/{styles-generic-about.bd6c3ab10cbfb61b.js → styles-generic-about.8e7b0a1963a28044.js} +1 -1
  41. package/out/static/client/{styles-generic-community.01f6a7593bc9268d.js → styles-generic-community.3be0ea626cc23a91.js} +1 -1
  42. package/out/static/client/{styles-generic-content.37bf952fe2b843c3.js → styles-generic-content.fb3767c6c038360a.js} +1 -1
  43. package/out/static/client/{styles-generic-layout.d5a8393d0e416a5a.js → styles-generic-layout.a167731346d98e68.js} +1 -1
  44. package/out/static/client/{styles-generic-sidebar.b3d7d5203335b86b.js → styles-generic-sidebar.5980d2f382e31c2f.js} +1 -1
  45. package/out/static/client/{styles-generic-toc.0f2eb841500811fe.js → styles-generic-toc.e87b903f40b5ee3d.js} +1 -1
  46. package/out/static/client/styles-global.4031cdde644ed6ce.css +2 -0
  47. package/out/static/client/styles-global.4031cdde644ed6ce.css.map +1 -0
  48. package/out/static/client/{styles-global.5e83bb0f2c4c0268.js → styles-global.4640cc3400ce02f4.js} +1 -1
  49. package/out/static/client/{styles-heading-anchor.459f5d2b6ef27a35.js → styles-heading-anchor.9c108abd05c06751.js} +1 -1
  50. package/out/static/client/{styles-homepage-body.1353218dc43e8403.js → styles-homepage-body.feca200494fa3f2b.js} +1 -1
  51. package/out/static/client/styles-homepage-contributor-spotlight.03dab9ff0109526a.js +1 -0
  52. package/out/static/client/{styles-homepage-footer.a2e302b524b9cb41.js → styles-homepage-footer.84c517dc0ea370ef.js} +1 -1
  53. package/out/static/client/{styles-homepage-header.61d200f9e7261cf9.js → styles-homepage-header.deaef111dbb0c461.js} +1 -1
  54. package/out/static/client/{styles-homepage-hero.49347a14601630f9.js → styles-homepage-hero.0663c42e3542e919.js} +1 -1
  55. package/out/static/client/{styles-homepage.5659711ea0d54c03.js → styles-homepage.76dcd400ed4ef833.js} +1 -1
  56. package/out/static/client/{styles-latest-news.c935e3ecd62721be.js → styles-latest-news.fdcc5477075ebe1e.js} +1 -1
  57. package/out/static/client/{styles-left-sidebar.d250c9e1d0b8e944.js → styles-left-sidebar.30b4df297a282352.js} +1 -1
  58. package/out/static/client/{styles-logo.d710c44f8c185a20.js → styles-logo.9063fd7fb72b63d6.js} +1 -1
  59. package/out/static/client/{styles-mandala.80f6df343c206d80.js → styles-mandala.ce86c75111666a12.js} +1 -1
  60. package/out/static/client/{styles-menu.5cf6280521425c6e.js → styles-menu.69b7fa131dc4d6fa.js} +1 -1
  61. package/out/static/client/{styles-navigation.ce5485bf0d2aa72c.js → styles-navigation.135a000deb94eb19.js} +1 -1
  62. package/out/static/client/{styles-not-found.ed1a36323c6f034f.js → styles-not-found.fbeeeeb400396890.js} +1 -1
  63. package/out/static/client/styles-observatory-landing.110db07bb7544066.js +1 -0
  64. package/out/static/client/styles-observatory-results.c3442ff842cbdb45.js +1 -0
  65. package/out/static/client/{styles-page-layout.ebaba26f8be73ed6.js → styles-page-layout.9b3493593d874fb1.js} +1 -1
  66. package/out/static/client/{styles-pagination.2180f506e667ba5c.js → styles-pagination.e3e8520569a46adb.js} +1 -1
  67. package/out/static/client/{styles-playground.022236b630f29462.js → styles-playground.036c5327a7d7e6f4.js} +1 -1
  68. package/out/static/client/styles-recent-contributions.12d4e639949c9e09.js +1 -0
  69. package/out/static/client/{styles-reference-layout.bffd0e6da5605009.js → styles-reference-layout.0e24dfefa6cc72e3.js} +1 -1
  70. package/out/static/client/{styles-reference-toc.c8955d29f707494b.js → styles-reference-toc.07c68b6e6c891ede.js} +1 -1
  71. package/out/static/client/{styles-sandbox.6a001e2be84a6688.js → styles-sandbox.97d617556b73c537.js} +1 -1
  72. package/out/static/client/{styles-site-search.dda21a516b8b58c1.js → styles-site-search.2334e870616575a9.js} +1 -1
  73. package/out/static/client/{styles-translation-banner.affb41df0468f016.js → styles-translation-banner.b0a8a3eadb7853f4.js} +1 -1
  74. package/out/static/client/{styles-writer-toolbar.dc0dfffc08e850d6.js → styles-writer-toolbar.dd7af6ca4f2b9b18.js} +1 -1
  75. package/out/static/client/{styles.a184d8a933a6c3a6.js → styles.42b0721850a6a7e4.js} +2 -2
  76. package/out/static/client/{styles.a184d8a933a6c3a6.js.map → styles.42b0721850a6a7e4.js.map} +1 -1
  77. package/out/static/legacy/1539.09699829ad0a6c6a.js +27 -0
  78. package/out/static/legacy/1539.09699829ad0a6c6a.js.map +1 -0
  79. package/out/static/legacy/asset-manifest.json +8 -8
  80. package/out/static/legacy/{index.e03b3082693746b6.js → index.87ff9acaa286d7e2.js} +3 -3
  81. package/out/static/legacy/{index.e03b3082693746b6.js.map → index.87ff9acaa286d7e2.js.map} +1 -1
  82. package/out/static/legacy/{index.bde4adba6f0cf3ac.html → index.a38906846551bf19.html} +1 -1
  83. package/out/static/legacy/stats.json +20 -20
  84. package/out/static/legacy/{yari.bd680acb6063d7c4.js → yari.1754859c2c682e51.js} +3 -3
  85. package/out/static/legacy/{yari.bd680acb6063d7c4.js.map → yari.1754859c2c682e51.js.map} +1 -1
  86. package/out/static/ssr/index.js +9 -9
  87. package/out/static/ssr/index.js.map +1 -1
  88. package/out/static/ssr/stats.json +4 -4
  89. package/package.json +9 -8
  90. package/server.js +5 -5
  91. package/out/static/client/2192.6208c073539aca0c.js +0 -2
  92. package/out/static/client/2192.6208c073539aca0c.js.map +0 -1
  93. package/out/static/client/9914.d49932c28ec56667.js.map +0 -1
  94. package/out/static/client/index.0910bee955d71d1b.js.map +0 -1
  95. package/out/static/client/styles-baseline-indicator.475001c3d152eda6.js +0 -1
  96. package/out/static/client/styles-contributor-spotlight.08c74d3c426050ed.js +0 -1
  97. package/out/static/client/styles-curriculum-default.89b14c7bf3342041.js +0 -1
  98. package/out/static/client/styles-curriculum-landing.4a5fa59933fb70fd.js +0 -1
  99. package/out/static/client/styles-curriculum-overview.9614bb249432e5e3.js +0 -1
  100. package/out/static/client/styles-global.a9d314985c899197.css +0 -2
  101. package/out/static/client/styles-global.a9d314985c899197.css.map +0 -1
  102. package/out/static/client/styles-homepage-contributor-spotlight.db46ee4b1e184c36.js +0 -1
  103. package/out/static/client/styles-observatory-landing.987e00f1527a651f.js +0 -1
  104. package/out/static/client/styles-observatory-results.736e05f4bd6e1487.js +0 -1
  105. package/out/static/client/styles-recent-contributions.b5366c0daf414e8a.js +0 -1
  106. package/out/static/legacy/1539.bf50d6a606ae3f2e.js +0 -27
  107. package/out/static/legacy/1539.bf50d6a606ae3f2e.js.map +0 -1
  108. /package/out/static/client/{index.0910bee955d71d1b.js.LICENSE.txt → index.55048de2c0265ab9.js.LICENSE.txt} +0 -0
  109. /package/out/static/legacy/{1539.bf50d6a606ae3f2e.js.LICENSE.txt → 1539.09699829ad0a6c6a.js.LICENSE.txt} +0 -0
  110. /package/out/static/legacy/{index.e03b3082693746b6.js.LICENSE.txt → index.87ff9acaa286d7e2.js.LICENSE.txt} +0 -0
  111. /package/out/static/legacy/{yari.bd680acb6063d7c4.js.LICENSE.txt → yari.1754859c2c682e51.js.LICENSE.txt} +0 -0
package/.env-dist CHANGED
@@ -2,8 +2,8 @@
2
2
  CONTENT_ROOT=../content/files
3
3
  # https://github.com/mdn/translated-content
4
4
  CONTENT_TRANSLATED_ROOT=../translated-content/files
5
- # https://github.com/mdn/mdn-studio
6
- BLOG_ROOT=../mdn-studio/content/posts
5
+ # https://github.com/mdn/blog
6
+ BLOG_ROOT=../blog/content/posts
7
7
  # https://github.com/mdn/curriculum/
8
8
  CURRICULUM_ROOT=../curriculum
9
9
  # https://github.com/mdn/mdn-contributor-spotlight
@@ -29,4 +29,4 @@ RARI_URL="http://localhost:8083"
29
29
  REACT_APP_KUMA_HOST="localhost:3000"
30
30
  REACT_APP_FXA_SIGNIN_URL="/users/fxa/login/authenticate/"
31
31
  REACT_APP_FXA_SETTINGS_URL="https://accounts.stage.mozaws.net/settings/"
32
- REACT_APP_PLACEMENT_ENABLED="true"
32
+ REACT_APP_PLACEMENT_ENABLED="true"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.1](https://github.com/mdn/fred/compare/v1.3.0...v1.3.1) (2025-09-03)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **env:** remove inline script if no runtime variables are set ([#691](https://github.com/mdn/fred/issues/691)) ([771737e](https://github.com/mdn/fred/commit/771737eb0ccf60eab9af54bb011f4099af475e17))
9
+
10
+
11
+ ### Miscellaneous
12
+
13
+ * **compat-table:** Port release label fix from yari ([#687](https://github.com/mdn/fred/issues/687)) ([3391cc4](https://github.com/mdn/fred/commit/3391cc4079cf9e6fed5c5b096d361793055fa94e))
14
+ * **deps-dev:** bump the dev group with 5 updates ([#688](https://github.com/mdn/fred/issues/688)) ([bdff859](https://github.com/mdn/fred/commit/bdff8590ce1127286f9d0788ff60c5aa67afc9c8))
15
+
16
+ ## [1.3.0](https://github.com/mdn/fred/compare/v1.2.0...v1.3.0) (2025-09-01)
17
+
18
+
19
+ ### Features
20
+
21
+ * **package/bin:** add fred-ssr executable ([#678](https://github.com/mdn/fred/issues/678)) ([faa175d](https://github.com/mdn/fred/commit/faa175dbf31d5cc715bccbcb9673572e8323e340))
22
+ * **server:** allow specifiying port from env var ([#679](https://github.com/mdn/fred/issues/679)) ([eea7274](https://github.com/mdn/fred/commit/eea72742ed07d3e2230cc33c30a2f3a1fcc9b4d3))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **env:** prefix runtime var fallback only once ([eea7274](https://github.com/mdn/fred/commit/eea72742ed07d3e2230cc33c30a2f3a1fcc9b4d3))
28
+ * **server:** omit Playground server link in output ([eea7274](https://github.com/mdn/fred/commit/eea72742ed07d3e2230cc33c30a2f3a1fcc9b4d3))
29
+
30
+
31
+ ### Miscellaneous
32
+
33
+ * **deps-dev:** bump @mdn/browser-compat-data from 7.1.0 to 7.1.1 ([#677](https://github.com/mdn/fred/issues/677)) ([2a90bc2](https://github.com/mdn/fred/commit/2a90bc213785c778481299ae6fad996d3c5fe890))
34
+ * **deps-dev:** bump the dev group with 2 updates ([#660](https://github.com/mdn/fred/issues/660)) ([08c2d3d](https://github.com/mdn/fred/commit/08c2d3d465ad31dcac9f0722856822d5da8f833c))
35
+ * rename {mdn-studio => blog} ([#681](https://github.com/mdn/fred/issues/681)) ([39ab241](https://github.com/mdn/fred/commit/39ab241bf912f0f395634029d9fd11b784f28be1))
36
+
3
37
  ## [1.2.0](https://github.com/mdn/fred/compare/v1.1.1...v1.2.0) (2025-08-28)
4
38
 
5
39
 
package/build/ssr.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { readFile, writeFile } from "node:fs/promises";
2
3
 
3
4
  import { fdir } from "fdir";
@@ -26,3 +26,5 @@ Rspack will bundle **all** environment variables prefixed with `FRED_` into the
26
26
  By default, variables are baked into our bundle at build time. However, you can define variables as runtime environment variables, which can be changed when running a version of Fred built with `FRED_RUNTIME_ENV=true`.
27
27
 
28
28
  This is used in our npm package, so we can e.g. set `FRED_WRITER_MODE=true` in the `content` repo, without having to bake that into the npm package for all consumers.
29
+
30
+ Runtime environment variables fall back to their build-time values if not set, and then to the default defined in code.
@@ -1,10 +1,16 @@
1
- import { parseBool, parseString } from "./utils.js";
1
+ import { parseBool, parseInt, parseString } from "./utils.js";
2
2
 
3
3
  export const PLAYGROUND_BASE_HOST = parseString(
4
4
  "PLAYGROUND_BASE_HOST",
5
5
  "mdnplay.dev",
6
6
  );
7
- export const PLAYGROUND_LOCAL = parseBool("PLAYGROUND_LOCAL", false);
7
+ export const PLAYGROUND_LOCAL = parseBool("PLAYGROUND_LOCAL", false, {
8
+ runtime: true,
9
+ });
10
+ export const PORT = parseInt("PORT", 3000, { runtime: true });
11
+ export const PLAYGROUND_PORT = parseInt("PLAYGROUND_PORT", 3001, {
12
+ runtime: true,
13
+ });
8
14
 
9
15
  export const FXA_SIGNIN_URL = parseString(
10
16
  "FXA_SIGNIN_URL",
@@ -20,6 +20,17 @@ export function parseBool(name, fallback, options) {
20
20
  }
21
21
  }
22
22
 
23
+ /**
24
+ * @param {string} name
25
+ * @param {number} fallback
26
+ * @param {Options} [options]
27
+ */
28
+ export function parseInt(name, fallback, options) {
29
+ const stringValue = getEnv(name, options);
30
+ const numberValue = stringValue ? Number.parseInt(stringValue, 10) : fallback;
31
+ return Number.isNaN(numberValue) ? fallback : numberValue;
32
+ }
33
+
23
34
  /**
24
35
  * @param {string} name
25
36
  * @param {string} fallback
@@ -36,10 +47,11 @@ export function parseString(name, fallback, options) {
36
47
  */
37
48
  function getEnv(name, options = {}) {
38
49
  const { runtime } = { runtime: false, ...options };
39
- name = `FRED_${name}`;
50
+ const fullName = `FRED_${name}`;
40
51
  if (runtime && RUNTIME_ENV) {
41
- runtimeVariables.push(name);
42
- return process.env[name] || getEnv(name);
52
+ runtimeVariables.push(fullName);
53
+ // safely navigate if process is not defined
54
+ return globalThis.process?.env[fullName] || getEnv(name);
43
55
  }
44
- return globalThis.__MDNEnv?.[name];
56
+ return globalThis.__MDNEnv?.[fullName];
45
57
  }
@@ -69,10 +69,8 @@ export class OuterLayout extends ServerComponent {
69
69
  ? "learn"
70
70
  : undefined;
71
71
 
72
- const env = Object.fromEntries(
73
- Object.entries(process.env).filter(([key]) =>
74
- runtimeVariables.includes(key),
75
- ),
72
+ const runtimeEnvEntries = Object.entries(process.env).filter(
73
+ ([key]) => key.startsWith("FRED_") && runtimeVariables.includes(key),
76
74
  );
77
75
 
78
76
  // if you want to put some script inline, put it in entry.inline.js
@@ -93,9 +91,9 @@ export class OuterLayout extends ServerComponent {
93
91
  content="width=device-width, initial-scale=1.0"
94
92
  />
95
93
  <title>${context.pageTitle || "MDN"}</title>
96
- ${RUNTIME_ENV
94
+ ${RUNTIME_ENV && runtimeEnvEntries.length > 0
97
95
  ? unsafeHTML(`<script>process = {
98
- env: ${JSON.stringify(env)}
96
+ env: ${JSON.stringify(Object.fromEntries(runtimeEnvEntries))}
99
97
  };</script>`)
100
98
  : nothing}
101
99
  ${unsafeHTML(`<script>${inlineScript}</script>`)}
@@ -5,7 +5,12 @@ import { keyed } from "lit/directives/keyed.js";
5
5
  import { createRef, ref } from "lit/directives/ref.js";
6
6
 
7
7
  import { ThemeController } from "../color-theme/controller.js";
8
- import { PLAYGROUND_BASE_HOST, PLAYGROUND_LOCAL } from "../env/index.js";
8
+ import {
9
+ PLAYGROUND_BASE_HOST,
10
+ PLAYGROUND_LOCAL,
11
+ PLAYGROUND_PORT,
12
+ PORT,
13
+ } from "../env/index.js";
9
14
  import { compressAndBase64Encode } from "../playground/utils.js";
10
15
 
11
16
  import styles from "./element.css?lit";
@@ -101,7 +106,7 @@ export class MDNPlayRunner extends LitElement {
101
106
  const url = new URL(
102
107
  `${prefix}/runner.html`,
103
108
  PLAYGROUND_LOCAL
104
- ? location.origin.replace("3000", "3001")
109
+ ? location.origin.replace(PORT.toString(), PLAYGROUND_PORT.toString())
105
110
  : `${location.protocol}//${this._subdomain}.${PLAYGROUND_BASE_HOST}`,
106
111
  );
107
112
  // pass the uuid for postMessage isolation
package/l10n/en-US.ftl CHANGED
@@ -62,8 +62,8 @@ obs-mdn = The { -brand-name-obs } provides effective security insights, guided b
62
62
 
63
63
  compat-loading = Loading…
64
64
 
65
- compat-browser-version-date = { $browser } { $version } – Released { $date }
66
- compat-browser-version-released = Released { $date }
65
+ compat-browser-version-date = { $browser } { $version } – Release date: { $date }
66
+ compat-browser-version-released = Release date: { $date }
67
67
 
68
68
  compat-link-report-issue = Report problems with this compatibility data
69
69
  compat-link-report-issue-title = Report an issue with this compatibility data