mnfst 0.5.130 → 0.5.132

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.
@@ -27,19 +27,38 @@ async function ensureManifest() {
27
27
  }
28
28
  }
29
29
 
30
- // Helper to interpolate environment variables
30
+ // Interpolate ${VAR} placeholders in a string against window.env. Only
31
+ // PUBLIC_-prefixed vars reach window.env (the mnfst-run dev server filters
32
+ // .env by that prefix to keep server-side secrets like MANIFEST_API_KEY out
33
+ // of the browser). Misses warn once per name so a missing var doesn't fail
34
+ // silently downstream as an empty URL / endpoint.
35
+ const _warnedMissingEnv = new Set();
31
36
  function interpolateEnvVars(str) {
32
37
  if (typeof str !== 'string') return str;
33
38
  return str.replace(/\$\{([^}]+)\}/g, (match, varName) => {
34
- // Check for environment variables (in browser, these would be set by build process)
35
39
  if (typeof process !== 'undefined' && process.env && process.env[varName]) {
36
40
  return process.env[varName];
37
41
  }
38
- // Check for window.env (common pattern for client-side env vars)
39
42
  if (typeof window !== 'undefined' && window.env && window.env[varName]) {
40
43
  return window.env[varName];
41
44
  }
42
- // Return original if not found
45
+ if (!_warnedMissingEnv.has(varName)) {
46
+ _warnedMissingEnv.add(varName);
47
+ if (!varName.startsWith('PUBLIC_')) {
48
+ console.warn(
49
+ `[Manifest Data] data source references \${${varName}}, but only ` +
50
+ `PUBLIC_-prefixed env vars are injected into window.env by mnfst-run. ` +
51
+ `Rename to PUBLIC_${varName}, hardcode the value, or supply it via ` +
52
+ `<script>window.env = {…}</script>. Leaving placeholder literal.`
53
+ );
54
+ } else {
55
+ console.warn(
56
+ `[Manifest Data] data source references \${${varName}}, but it is not ` +
57
+ `present in window.env. Add ${varName}=… to .env (read by mnfst-run) ` +
58
+ `or set it via <script>window.env = {…}</script>. Leaving placeholder literal.`
59
+ );
60
+ }
61
+ }
43
62
  return match;
44
63
  });
45
64
  }
@@ -7,7 +7,7 @@
7
7
  "manifest.color.js": "sha384-6Rv3LxyTcZNjrhtayQfqRdCx0uSZ4BiEbgEI98I62eTvp8Aw7LBIoNJ0Je1oktwL",
8
8
  "manifest.colorpicker.js": "sha384-Wqz0ZIbeIi7KarqqqSLsQk+7E/fMaKhb32hrq5/eWzX1yjqMrpPZKH8y+jZ3mfg+",
9
9
  "manifest.components.js": "sha384-73CB1A+LAGfNexkd7aT69APFSHMzix8irse9uzOkYehHHio4px3oR8JHJeaMH+jI",
10
- "manifest.data.js": "sha384-PZiaRsDV4nnRGvmT8y2jEZV+BolcEZGJXbMJU75YqWGXI8b3y/L93zhhllovf4Go",
10
+ "manifest.data.js": "sha384-QboSuKhQfNy6Z1iBLho+92jqAnJyEj7u3FFTiH6McSgErKKCiJwlApMjSFCwYWL4",
11
11
  "manifest.datepicker.js": "sha384-NEb/H4vuR3CFtRcodHsm3jJjrcYW2JMpDlQKlgwTrzpMMTcDkFKYXzAYJD0gZ7Ov",
12
12
  "manifest.dropdowns.js": "sha384-9vRdtkgheqvl/2PEaAFJhQ/NCqrRO8NFOjCBNKSu1CDA+RXkIbUNBIZRST96asLe",
13
13
  "manifest.export.js": "sha384-RsTGzsPCBw3yO4+TdAGd4F+o3FnzUNlqnMBqtnn/kUfv7axpzRdPc2AnsExV/93c",
@@ -25,6 +25,6 @@
25
25
  "manifest.toasts.js": "sha384-ytd5rDbax/Ou9z23uedFXPZbxDPsk2E/pxCTq4WLvfv+os1qTI6kELp0kPp07g24",
26
26
  "manifest.tooltips.js": "sha384-GaBa+oORH0y6LC0NyLy+RjAyh1pRglud0U5oZKZAQEaYSsrm/G0ir+RUNSnW0Geb",
27
27
  "manifest.url.parameters.js": "sha384-FIufiClqDx1rJpU/QUc9z/D43qClQ6Qm8rBahipbJl9BDHUvhrOsUDegmTWW7Tuf",
28
- "manifest.utilities.js": "sha384-o6LAk/jJGclXUpC6nzReSRCaAVxaMrgAMhCNYCLz/H4HNdITpmmWk25Fzag4GSHI",
29
- "manifest.js": "sha384-LosPV9wWLItaJan0+SjFzLGe3W2kVRORdy+gpr6YkQ7AKJkasmtAf6rbbvk3G37O"
28
+ "manifest.utilities.js": "sha384-Hl2tlhHgIJLEr3CFiEq79nlWCgx6nSVJCyThPCZi3wOFBLv/KXm/VrIZ0vRZqBi7",
29
+ "manifest.js": "sha384-vc0GN2LMS0zDdT2Oj4a7NwyR498zKDgyiLiBl4VjDFJB+XDMcrdBRBBY5yn7ixXK"
30
30
  }
package/lib/manifest.js CHANGED
@@ -586,14 +586,38 @@
586
586
  // the loader rather than borrowed from the data plugin because the
587
587
  // data plugin's script may not have finished executing yet at the
588
588
  // point we cache the manifest. window.env is populated by either
589
- // the mnfst-run dev server (which reads .env at startup) or a
590
- // developer-supplied <script>window.env = {…}</script> block.
589
+ // the mnfst-run dev server (which reads PUBLIC_-prefixed vars from
590
+ // .env at startup) or a developer-supplied
591
+ // <script>window.env = {…}</script> block.
592
+ //
593
+ // Misses are warned, not silently dropped: a missing var almost
594
+ // always means the dev forgot the PUBLIC_ prefix or hasn't set the
595
+ // var at all, and an empty substitution downstream (e.g. an empty
596
+ // API URL) tends to fail far from the cause.
597
+ const warnedMissingEnv = new Set();
591
598
  const interpolateManifestEnv = (obj) => {
592
599
  if (obj === null || typeof obj !== 'object') return;
593
600
  const subst = (str) => str.replace(/\$\{([^}]+)\}/g, (m, name) => {
594
601
  if (typeof window !== 'undefined' && window.env && window.env[name] !== undefined) {
595
602
  return window.env[name];
596
603
  }
604
+ if (!warnedMissingEnv.has(name)) {
605
+ warnedMissingEnv.add(name);
606
+ if (!name.startsWith('PUBLIC_')) {
607
+ console.warn(
608
+ `[Manifest] manifest.json references \${${name}}, but only PUBLIC_-prefixed ` +
609
+ `env vars are injected into window.env by mnfst-run. Rename to ` +
610
+ `PUBLIC_${name}, hardcode the value, or supply it via ` +
611
+ `<script>window.env = {…}</script>. Leaving placeholder literal.`
612
+ );
613
+ } else {
614
+ console.warn(
615
+ `[Manifest] manifest.json references \${${name}}, but it is not present ` +
616
+ `in window.env. Add ${name}=… to .env (read by mnfst-run) or ` +
617
+ `set it via <script>window.env = {…}</script>. Leaving placeholder literal.`
618
+ );
619
+ }
620
+ }
597
621
  return m;
598
622
  });
599
623
  const walk = (o) => {
@@ -3525,6 +3525,37 @@ function detectOS() {
3525
3525
  }
3526
3526
  detectOS();
3527
3527
 
3528
+ // Register the device/OS variants with Tailwind too. The Manifest compiler
3529
+ // applies these variants to its own theme-derived/semantic utilities, but
3530
+ // standard Tailwind utilities (px-4, flex, …) are emitted by Tailwind's own
3531
+ // engine, which only knows its built-in variants. A `<style type="text/tailwindcss">`
3532
+ // carrying @custom-variant definitions teaches Tailwind the same variants, so
3533
+ // touch:px-4 / mac:flex / cursor:gap-2 resolve like sm:/hover:. Tailwind's
3534
+ // browser build reprocesses when this style is added, so load order is moot.
3535
+ function injectTailwindVariants() {
3536
+ try {
3537
+ if (document.getElementById('manifest-tailwind-variants')) return;
3538
+ const style = document.createElement('style');
3539
+ style.id = 'manifest-tailwind-variants';
3540
+ style.setAttribute('type', 'text/tailwindcss');
3541
+ style.textContent = [
3542
+ '@custom-variant touch (@media (pointer: coarse));',
3543
+ '@custom-variant cursor (@media (pointer: fine) and (hover: hover));',
3544
+ '@custom-variant pointer (@media (any-pointer: fine));',
3545
+ '@custom-variant mac (&:where([data-os="macos"] *));',
3546
+ '@custom-variant windows (&:where([data-os="windows"] *));',
3547
+ '@custom-variant linux (&:where([data-os="linux"] *));',
3548
+ '@custom-variant ios (&:where([data-os="ios"] *));',
3549
+ '@custom-variant android (&:where([data-os="android"] *));',
3550
+ '@custom-variant apple (&:where([data-os="macos"] *, [data-os="ios"] *));'
3551
+ ].join('\n');
3552
+ (document.head || document.documentElement).appendChild(style);
3553
+ } catch (e) {
3554
+ // Non-fatal: Tailwind-utility variants simply won't be available.
3555
+ }
3556
+ }
3557
+ injectTailwindVariants();
3558
+
3528
3559
  // Initialize immediately without waiting for DOMContentLoaded
3529
3560
  const compiler = new TailwindCompiler();
3530
3561
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.130",
3
+ "version": "0.5.132",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",