@stati/core 1.29.2 → 2.0.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 (104) hide show
  1. package/README.md +10 -13
  2. package/dist/config/loader.d.ts +9 -0
  3. package/dist/config/loader.d.ts.map +1 -1
  4. package/dist/config/loader.js +77 -1
  5. package/dist/core/build.d.ts.map +1 -1
  6. package/dist/core/build.js +39 -29
  7. package/dist/core/content.d.ts.map +1 -1
  8. package/dist/core/content.js +9 -7
  9. package/dist/core/dev.d.ts.map +1 -1
  10. package/dist/core/dev.js +156 -197
  11. package/dist/core/eta-plugin.d.ts +60 -0
  12. package/dist/core/eta-plugin.d.ts.map +1 -0
  13. package/dist/core/eta-plugin.js +143 -0
  14. package/dist/core/isg/builder.d.ts +37 -19
  15. package/dist/core/isg/builder.d.ts.map +1 -1
  16. package/dist/core/isg/builder.js +70 -153
  17. package/dist/core/isg/deps.d.ts +8 -70
  18. package/dist/core/isg/deps.d.ts.map +1 -1
  19. package/dist/core/isg/deps.js +10 -401
  20. package/dist/core/isg/hash.d.ts.map +1 -1
  21. package/dist/core/isg/hash.js +2 -1
  22. package/dist/core/isg/index.d.ts +2 -2
  23. package/dist/core/isg/index.d.ts.map +1 -1
  24. package/dist/core/isg/index.js +3 -3
  25. package/dist/core/isg/manifest.d.ts.map +1 -1
  26. package/dist/core/isg/manifest.js +6 -1
  27. package/dist/core/markdown.d.ts +1 -1
  28. package/dist/core/markdown.d.ts.map +1 -1
  29. package/dist/core/markdown.js +3 -2
  30. package/dist/core/template-index.d.ts +209 -0
  31. package/dist/core/template-index.d.ts.map +1 -0
  32. package/dist/core/template-index.js +484 -0
  33. package/dist/core/template-render.d.ts +137 -0
  34. package/dist/core/template-render.d.ts.map +1 -0
  35. package/dist/core/template-render.js +444 -0
  36. package/dist/core/templates.d.ts +29 -11
  37. package/dist/core/templates.d.ts.map +1 -1
  38. package/dist/core/templates.js +115 -196
  39. package/dist/core/utils/context-validation.utils.d.ts +10 -6
  40. package/dist/core/utils/context-validation.utils.d.ts.map +1 -1
  41. package/dist/core/utils/context-validation.utils.js +39 -16
  42. package/dist/core/utils/date.utils.d.ts +1 -1
  43. package/dist/core/utils/date.utils.js +1 -1
  44. package/dist/core/utils/dev-css-watcher.utils.d.ts.map +1 -1
  45. package/dist/core/utils/dev-css-watcher.utils.js +3 -2
  46. package/dist/core/utils/error-overlay.utils.d.ts.map +1 -1
  47. package/dist/core/utils/error-overlay.utils.js +7 -45
  48. package/dist/core/utils/front-matter.utils.d.ts +50 -0
  49. package/dist/core/utils/front-matter.utils.d.ts.map +1 -0
  50. package/dist/core/utils/front-matter.utils.js +157 -0
  51. package/dist/core/utils/index.d.ts +4 -5
  52. package/dist/core/utils/index.d.ts.map +1 -1
  53. package/dist/core/utils/index.js +5 -7
  54. package/dist/core/utils/paths.utils.d.ts +3 -3
  55. package/dist/core/utils/paths.utils.js +6 -6
  56. package/dist/core/utils/tailwind-inventory.utils.d.ts +2 -2
  57. package/dist/core/utils/tailwind-inventory.utils.d.ts.map +1 -1
  58. package/dist/core/utils/tailwind-inventory.utils.js +15 -6
  59. package/dist/core/utils/template-discovery.utils.d.ts +3 -14
  60. package/dist/core/utils/template-discovery.utils.d.ts.map +1 -1
  61. package/dist/core/utils/template-discovery.utils.js +2 -62
  62. package/dist/core/utils/template-errors.utils.d.ts +14 -1
  63. package/dist/core/utils/template-errors.utils.d.ts.map +1 -1
  64. package/dist/core/utils/template-errors.utils.js +45 -4
  65. package/dist/core/utils/theme.utils.d.ts +17 -0
  66. package/dist/core/utils/theme.utils.d.ts.map +1 -0
  67. package/dist/core/utils/theme.utils.js +59 -0
  68. package/dist/images/index.d.ts +1 -2
  69. package/dist/images/index.d.ts.map +1 -1
  70. package/dist/images/index.js +0 -1
  71. package/dist/images/markdown-rule.d.ts +1 -2
  72. package/dist/images/markdown-rule.d.ts.map +1 -1
  73. package/dist/images/og.d.ts +2 -15
  74. package/dist/images/og.d.ts.map +1 -1
  75. package/dist/images/og.js +4 -47
  76. package/dist/images/runtime.d.ts +24 -5
  77. package/dist/images/runtime.d.ts.map +1 -1
  78. package/dist/images/runtime.js +14 -12
  79. package/dist/index.d.ts +2 -1
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/metrics/noop.d.ts.map +1 -1
  82. package/dist/metrics/noop.js +4 -1
  83. package/dist/metrics/recorder.d.ts.map +1 -1
  84. package/dist/metrics/recorder.js +11 -8
  85. package/dist/metrics/types.d.ts +31 -5
  86. package/dist/metrics/types.d.ts.map +1 -1
  87. package/dist/metrics/utils/html-report.utils.d.ts +2 -1
  88. package/dist/metrics/utils/html-report.utils.d.ts.map +1 -1
  89. package/dist/metrics/utils/html-report.utils.js +1115 -1136
  90. package/dist/types/config.d.ts +18 -6
  91. package/dist/types/config.d.ts.map +1 -1
  92. package/dist/types/content.d.ts +83 -16
  93. package/dist/types/content.d.ts.map +1 -1
  94. package/dist/types/index.d.ts +4 -3
  95. package/dist/types/index.d.ts.map +1 -1
  96. package/dist/types/isg.d.ts +48 -2
  97. package/dist/types/isg.d.ts.map +1 -1
  98. package/package.json +6 -6
  99. package/dist/core/utils/callable-partials.utils.d.ts +0 -60
  100. package/dist/core/utils/callable-partials.utils.d.ts.map +0 -1
  101. package/dist/core/utils/callable-partials.utils.js +0 -127
  102. package/dist/core/utils/partial-validation.utils.d.ts +0 -9
  103. package/dist/core/utils/partial-validation.utils.d.ts.map +0 -1
  104. package/dist/core/utils/partial-validation.utils.js +0 -107
@@ -1,107 +0,0 @@
1
- import { isProduction } from '../../env.js';
2
- import { isPassthroughProperty } from './context-validation.utils.js';
3
- import { findSimilarNames } from './similarity.utils.js';
4
- /**
5
- * Creates inline error overlay HTML for missing partials
6
- */
7
- function createInlineErrorOverlay(partialName, suggestions) {
8
- const suggestionText = suggestions.length > 0
9
- ? `Did you mean: ${suggestions.map((s) => `"${s}"`).join(', ')}?`
10
- : 'No similar partials found';
11
- // Inline styles only: this toast is injected into the user's own page, so it
12
- // carries the Stati dark slate palette rather than relying on page styles.
13
- return `
14
- <!-- Stati Development Error Overlay -->
15
- <div role="alert" style="
16
- position: fixed;
17
- top: 16px;
18
- right: 16px;
19
- z-index: 2147483647;
20
- box-sizing: border-box;
21
- width: min(24rem, calc(100vw - 32px));
22
- margin: 0;
23
- padding: 14px 16px;
24
- background: #0f172a;
25
- color: #f1f5f9;
26
- border: 1px solid #475569;
27
- border-radius: 8px;
28
- font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
29
- font-size: 14px;
30
- font-weight: 400;
31
- line-height: 1.5;
32
- text-align: left;
33
- ">
34
- <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #f87171;">
35
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="flex: none;"><path d="M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/></svg>
36
- Template Error
37
- </div>
38
- <div style="font-weight: 600; overflow-wrap: anywhere;">
39
- Partial "${partialName}" not found
40
- </div>
41
- <div style="margin-top: 2px; font-size: 13px; color: #94a3b8; overflow-wrap: anywhere;">
42
- ${suggestionText}
43
- </div>
44
- <div style="margin-top: 12px; padding-top: 10px; border-top: 1px solid #1e293b; font-size: 12px; color: #8391a7;">
45
- Fix the partial name in your template to dismiss this error
46
- </div>
47
- </div>
48
- <!-- End Stati Error Overlay -->`;
49
- }
50
- /**
51
- * Creates a development-mode Proxy for the partials object that throws errors
52
- * when accessing non-existent partials instead of returning undefined.
53
- *
54
- * Supports both string partials and CallablePartial.
55
- */
56
- export function createValidatingPartialsProxy(partials) {
57
- // In production, return partials as-is
58
- // Only skip validation if explicitly set to production
59
- if (isProduction()) {
60
- return partials;
61
- }
62
- // If there are no partials, return the empty object as-is
63
- // This avoids proxy-related issues during test serialization
64
- if (Object.keys(partials).length === 0) {
65
- return partials;
66
- }
67
- return new Proxy(partials, {
68
- get(target, prop, receiver) {
69
- const propName = String(prop);
70
- // Return existing partials, and let symbols, prototype methods, and
71
- // serializer/test-tooling probes resolve normally
72
- if (propName in target || isPassthroughProperty(prop)) {
73
- return Reflect.get(target, prop, receiver);
74
- }
75
- // Property doesn't exist - return error overlay HTML instead of throwing
76
- const availablePartials = Object.keys(target);
77
- const suggestions = findSimilarNames(propName, availablePartials);
78
- // In development, render an inline error overlay
79
- const errorHtml = createInlineErrorOverlay(propName, suggestions);
80
- // Check if we're dealing with CallablePartials by testing a known partial
81
- const samplePartial = Object.values(target)[0];
82
- const isCallable = typeof samplePartial === 'function';
83
- if (isCallable) {
84
- // For CallablePartial, return a function that returns the error HTML
85
- // This prevents "string is not a function" errors when templates call missing partials
86
- // Accept any arguments to handle props being passed
87
- const errorFunction = (..._args) => errorHtml;
88
- errorFunction.toString = () => errorHtml;
89
- errorFunction.valueOf = () => errorHtml;
90
- return errorFunction;
91
- }
92
- else {
93
- // For string partials, return the error HTML directly
94
- return errorHtml;
95
- }
96
- },
97
- has(target, prop) {
98
- return prop in target;
99
- },
100
- ownKeys(target) {
101
- return Reflect.ownKeys(target);
102
- },
103
- getOwnPropertyDescriptor(target, prop) {
104
- return Reflect.getOwnPropertyDescriptor(target, prop);
105
- },
106
- });
107
- }