mnfst 0.5.99 → 0.5.101

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.
@@ -11,7 +11,7 @@
11
11
  "manifest.export.js": "sha384-qvdGz1TiGEDOeWJ5os1z03RURdKX+ezZEQ1KyV+9iC7X0esLK83mtY87t4MQv45t",
12
12
  "manifest.icons.js": "sha384-uOkboYrovjCpl22eey3Jaxpey+pOnot5NDnRRumcRxiR7IOVaRh1i20gYnWXR5dW",
13
13
  "manifest.localization.js": "sha384-M40EWrbWs2MoJvUiYVQaPxPiOzMYBn/ywuMR02rvoSXG77eIHT/aRoYub9r6+jC+",
14
- "manifest.markdown.js": "sha384-3LgPiHrftPqAIJGhxi87C0TtfJXbsH0Qj4JmfmYgV4y5UjSx7nVSP+ppsRUWT0Xs",
14
+ "manifest.markdown.js": "sha384-H/Zg0ANrfokWWLR0js9zKd6yasP62sG+aga5r5WnmTd+LPMb93H97JlS8OQV7Ox9",
15
15
  "manifest.resize.js": "sha384-Ak5gf44ERfh9pOSAD1qZzJSysslpwBCkevIlz7R3dszTUyzUKGKGF4pn5arOtgG0",
16
16
  "manifest.router.js": "sha384-n6xmIfWnYzd/0kkVTFuHhFzHuxiDgZ1Lg1W0yB6/w3Myw5pQ6PgE6SJBHfVsO7/D",
17
17
  "manifest.slides.js": "sha384-3uRTkyK9XPLmnxI2+igZlpi4EyPlU/7IHj5j3BZJJ2KN455vXyk99fiXV3feO/XY",
@@ -22,5 +22,5 @@
22
22
  "manifest.tooltips.js": "sha384-Hhip5ZN66xhDw3m0XBrKLKLpcVRz3Z9RszPKqo6xvFF0mrUgQBVZ+mZjZsXgOOjS",
23
23
  "manifest.url.parameters.js": "sha384-FIufiClqDx1rJpU/QUc9z/D43qClQ6Qm8rBahipbJl9BDHUvhrOsUDegmTWW7Tuf",
24
24
  "manifest.utilities.js": "sha384-x07Pfi4UxK9tbdcOZgZ5jkveseT1xBUTFtO08ORcokCH64FHsUceoiAICAsRJMle",
25
- "manifest.js": "sha384-CUFN8gbtQW6+fnxiBnx0nPw6kKDA21+He0KFoDE9FabfJPR4lKRXaT2PWpOOKUS+"
25
+ "manifest.js": "sha384-AaKRNJvva7ik7bhCXdE5Ic/PYL4mbxJv2hStF+xNaZfBfSiETMuVPtRlPVjgury3"
26
26
  }
package/lib/manifest.js CHANGED
@@ -491,6 +491,41 @@
491
491
  ];
492
492
  const manifestUrl = (document.querySelector('link[rel="manifest"]')?.getAttribute('href')) || '/manifest.json';
493
493
 
494
+ // Substitute ${VAR} placeholders against window.env in every string
495
+ // value of the parsed manifest, in place. Called once before the
496
+ // manifest is cached on window so every downstream consumer
497
+ // (auth, data, components, etc.) sees resolved values. Inlined in
498
+ // the loader rather than borrowed from the data plugin because the
499
+ // data plugin's script may not have finished executing yet at the
500
+ // point we cache the manifest. window.env is populated by either
501
+ // the mnfst-run dev server (which reads .env at startup) or a
502
+ // developer-supplied <script>window.env = {…}</script> block.
503
+ const interpolateManifestEnv = (obj) => {
504
+ if (obj === null || typeof obj !== 'object') return;
505
+ const subst = (str) => str.replace(/\$\{([^}]+)\}/g, (m, name) => {
506
+ if (typeof window !== 'undefined' && window.env && window.env[name] !== undefined) {
507
+ return window.env[name];
508
+ }
509
+ return m;
510
+ });
511
+ const walk = (o) => {
512
+ if (Array.isArray(o)) {
513
+ for (let i = 0; i < o.length; i++) {
514
+ const v = o[i];
515
+ if (typeof v === 'string') o[i] = subst(v);
516
+ else if (v && typeof v === 'object') walk(v);
517
+ }
518
+ } else {
519
+ for (const k of Object.keys(o)) {
520
+ const v = o[k];
521
+ if (typeof v === 'string') o[k] = subst(v);
522
+ else if (v && typeof v === 'object') walk(v);
523
+ }
524
+ }
525
+ };
526
+ walk(obj);
527
+ };
528
+
494
529
  const loadPlugins = async () => {
495
530
  let manifest = null;
496
531
  let pluginsToLoad = config.plugins;
@@ -521,6 +556,12 @@
521
556
  manifest = await manifestPromise;
522
557
  }
523
558
  if (manifest && typeof window !== 'undefined') {
559
+ // Resolve ${VAR} placeholders once, here, before any
560
+ // downstream plugin reads the cached manifest. Plugins like
561
+ // appwrite-auth read window.__manifestLoaded directly and
562
+ // would otherwise see literal `${APPWRITE_DEV_KEY}` strings
563
+ // even when window.env is populated.
564
+ interpolateManifestEnv(manifest);
524
565
  window.__manifestLoaded = manifest;
525
566
  if (window.ManifestComponentsRegistry) {
526
567
  window.ManifestComponentsRegistry.manifest = manifest;
@@ -346,8 +346,16 @@ function applyInlineCodeAttributes(html) {
346
346
  // Be conservative: only rewrite when the brace block immediately follows
347
347
  // a `<code>` close tag (no whitespace), so prose like "foo `bar` {note}" is
348
348
  // untouched.
349
+ //
350
+ // Body capture is `[^<]*` (not `[\s\S]*?`) so the match can't span across
351
+ // intermediate `<` characters — without this guard, an unmatched
352
+ // `<code>foo</code>` followed later by `<code>bar</code>{copy}` would be
353
+ // captured as ONE big match with body = "foo</code><…><code>bar". That
354
+ // bug surfaces noticeably in tables, where multiple codespans per row mix
355
+ // marked and unmarked instances. Marked HTML-escapes any literal `<` in
356
+ // codespan content to `&lt;`, so the restriction is safe.
349
357
  return html.replace(
350
- /<code>([\s\S]*?)<\/code>\{([^}\n]+)\}/g,
358
+ /<code>([^<]*)<\/code>\{([^}\n]+)\}/g,
351
359
  (_, body, attrString) => {
352
360
  const tokens = attrString.trim().split(/\s+/).filter(Boolean);
353
361
  let language = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.99",
3
+ "version": "0.5.101",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",