@emberkit/core 0.2.0 → 0.2.3

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 (149) hide show
  1. package/LICENSE +199 -0
  2. package/dist/boundaries/error-boundary.d.ts +29 -0
  3. package/dist/boundaries/error-boundary.d.ts.map +1 -0
  4. package/dist/boundaries/errors.d.ts +39 -0
  5. package/dist/boundaries/errors.d.ts.map +1 -0
  6. package/dist/boundaries/index.d.ts +5 -0
  7. package/dist/boundaries/index.d.ts.map +1 -0
  8. package/dist/boundaries/loading-boundary.d.ts +42 -0
  9. package/dist/boundaries/loading-boundary.d.ts.map +1 -0
  10. package/dist/cache/index.d.ts +60 -0
  11. package/dist/cache/index.d.ts.map +1 -0
  12. package/dist/cache/index.js +24 -22
  13. package/dist/compiler/compiler.d.ts +6 -0
  14. package/dist/compiler/compiler.d.ts.map +1 -0
  15. package/dist/compiler/helpers/attributes.d.ts +4 -0
  16. package/dist/compiler/helpers/attributes.d.ts.map +1 -0
  17. package/dist/compiler/helpers/utils.d.ts +10 -0
  18. package/dist/compiler/helpers/utils.d.ts.map +1 -0
  19. package/dist/compiler/index.d.ts +5 -0
  20. package/dist/compiler/index.d.ts.map +1 -0
  21. package/dist/compiler/types.d.ts +40 -0
  22. package/dist/compiler/types.d.ts.map +1 -0
  23. package/dist/context/index.d.ts +34 -0
  24. package/dist/context/index.d.ts.map +1 -0
  25. package/dist/context/types.d.ts +10 -0
  26. package/dist/context/types.d.ts.map +1 -0
  27. package/dist/dev-server/index.d.ts +30 -0
  28. package/dist/dev-server/index.d.ts.map +1 -0
  29. package/dist/dev-server/index.js +27 -27
  30. package/dist/forms/index.d.ts +58 -0
  31. package/dist/forms/index.d.ts.map +1 -0
  32. package/dist/forms/index.js +1 -1
  33. package/dist/forms/mutations.d.ts +48 -0
  34. package/dist/forms/mutations.d.ts.map +1 -0
  35. package/dist/forms/mutations.js +4 -1
  36. package/dist/hmr/client.d.ts +18 -0
  37. package/dist/hmr/client.d.ts.map +1 -0
  38. package/dist/hmr/client.js +1 -1
  39. package/dist/hmr/index.d.ts +3 -0
  40. package/dist/hmr/index.d.ts.map +1 -0
  41. package/dist/hmr/types.d.ts +42 -0
  42. package/dist/hmr/types.d.ts.map +1 -0
  43. package/dist/hmr/types.js +7 -7
  44. package/dist/hydration/helpers/analyzer.d.ts +9 -0
  45. package/dist/hydration/helpers/analyzer.d.ts.map +1 -0
  46. package/dist/hydration/helpers/hydration.d.ts +19 -0
  47. package/dist/hydration/helpers/hydration.d.ts.map +1 -0
  48. package/dist/hydration/helpers/hydration.js +1 -1
  49. package/dist/hydration/index.d.ts +4 -0
  50. package/dist/hydration/index.d.ts.map +1 -0
  51. package/dist/hydration/types.d.ts +27 -0
  52. package/dist/hydration/types.d.ts.map +1 -0
  53. package/dist/hydration/types.js +32 -8
  54. package/dist/image/index.d.ts +9 -0
  55. package/dist/image/index.d.ts.map +1 -0
  56. package/dist/image/index.js +1 -1
  57. package/dist/image/processor.d.ts +57 -0
  58. package/dist/image/processor.d.ts.map +1 -0
  59. package/dist/image/processor.js +20 -15
  60. package/dist/index.d.ts +20 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +2 -2
  63. package/dist/jsx-dev-runtime.d.ts +11 -0
  64. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  65. package/dist/jsx-runtime.d.ts +11 -0
  66. package/dist/jsx-runtime.d.ts.map +1 -0
  67. package/dist/loader/helpers/loader.d.ts +6 -0
  68. package/dist/loader/helpers/loader.d.ts.map +1 -0
  69. package/dist/loader/index.d.ts +3 -0
  70. package/dist/loader/index.d.ts.map +1 -0
  71. package/dist/loader/types.d.ts +34 -0
  72. package/dist/loader/types.d.ts.map +1 -0
  73. package/dist/markdown/index.d.ts +77 -0
  74. package/dist/markdown/index.d.ts.map +1 -0
  75. package/dist/markdown/index.js +178 -172
  76. package/dist/mdx/index.d.ts +43 -0
  77. package/dist/mdx/index.d.ts.map +1 -0
  78. package/dist/mdx/index.js +46 -40
  79. package/dist/mdx/loader.d.ts +3 -0
  80. package/dist/mdx/loader.d.ts.map +1 -0
  81. package/dist/meta/head-registry.d.ts +5 -0
  82. package/dist/meta/head-registry.d.ts.map +1 -0
  83. package/dist/meta/head.d.ts +29 -0
  84. package/dist/meta/head.d.ts.map +1 -0
  85. package/dist/meta/index.d.ts +91 -0
  86. package/dist/meta/index.d.ts.map +1 -0
  87. package/dist/meta/index.js +16 -16
  88. package/dist/navigation/helpers/navigation.d.ts +15 -0
  89. package/dist/navigation/helpers/navigation.d.ts.map +1 -0
  90. package/dist/navigation/helpers/navigation.js +4 -4
  91. package/dist/navigation/helpers/useNavigate.d.ts +6 -0
  92. package/dist/navigation/helpers/useNavigate.d.ts.map +1 -0
  93. package/dist/navigation/index.d.ts +5 -0
  94. package/dist/navigation/index.d.ts.map +1 -0
  95. package/dist/navigation/types.d.ts +24 -0
  96. package/dist/navigation/types.d.ts.map +1 -0
  97. package/dist/navigation/types.js +1 -2
  98. package/dist/plugin/index.d.ts +73 -0
  99. package/dist/plugin/index.d.ts.map +1 -0
  100. package/dist/plugin/index.js +4 -4
  101. package/dist/router/helpers/path.d.ts +15 -0
  102. package/dist/router/helpers/path.d.ts.map +1 -0
  103. package/dist/router/helpers/route.d.ts +6 -0
  104. package/dist/router/helpers/route.d.ts.map +1 -0
  105. package/dist/router/helpers/route.js +10 -3
  106. package/dist/router/index.d.ts +35 -0
  107. package/dist/router/index.d.ts.map +1 -0
  108. package/dist/router/types.d.ts +30 -0
  109. package/dist/router/types.d.ts.map +1 -0
  110. package/dist/router/types.js +1 -3
  111. package/dist/runtime/helpers/element.d.ts +7 -0
  112. package/dist/runtime/helpers/element.d.ts.map +1 -0
  113. package/dist/runtime/helpers/render.d.ts +8 -0
  114. package/dist/runtime/helpers/render.d.ts.map +1 -0
  115. package/dist/runtime/helpers/render.js +37 -8
  116. package/dist/runtime/index.d.ts +16 -0
  117. package/dist/runtime/index.d.ts.map +1 -0
  118. package/dist/runtime/index.js +63 -7
  119. package/dist/runtime/types.d.ts +65 -0
  120. package/dist/runtime/types.d.ts.map +1 -0
  121. package/dist/signals/helpers/core.d.ts +11 -0
  122. package/dist/signals/helpers/core.d.ts.map +1 -0
  123. package/dist/signals/helpers/core.js +34 -12
  124. package/dist/signals/helpers/utils.d.ts +7 -0
  125. package/dist/signals/helpers/utils.d.ts.map +1 -0
  126. package/dist/signals/index.d.ts +4 -0
  127. package/dist/signals/index.d.ts.map +1 -0
  128. package/dist/signals/types.d.ts +23 -0
  129. package/dist/signals/types.d.ts.map +1 -0
  130. package/dist/ssg/index.d.ts +38 -0
  131. package/dist/ssg/index.d.ts.map +1 -0
  132. package/dist/ssg/index.js +8 -15
  133. package/dist/ssr/helpers/render-html.d.ts +16 -0
  134. package/dist/ssr/helpers/render-html.d.ts.map +1 -0
  135. package/dist/ssr/helpers/render-html.js +3 -2
  136. package/dist/ssr/helpers/ssr.d.ts +14 -0
  137. package/dist/ssr/helpers/ssr.d.ts.map +1 -0
  138. package/dist/ssr/helpers/ssr.js +3 -1
  139. package/dist/ssr/index.d.ts +4 -0
  140. package/dist/ssr/index.d.ts.map +1 -0
  141. package/dist/ssr/types.d.ts +29 -0
  142. package/dist/ssr/types.d.ts.map +1 -0
  143. package/dist/vite-plugin/index.d.ts +5 -0
  144. package/dist/vite-plugin/index.d.ts.map +1 -0
  145. package/dist/vite-plugin/index.js +207 -28
  146. package/dist/vite-plugin/types.d.ts +44 -0
  147. package/dist/vite-plugin/types.d.ts.map +1 -0
  148. package/dist/vite-plugin/types.js +4 -0
  149. package/package.json +12 -10
@@ -1,9 +1,10 @@
1
1
  import { DEFAULT_CONFIG } from './types.js';
2
- import { readdirSync, statSync } from 'node:fs';
2
+ import { readdirSync, statSync, existsSync } from 'node:fs';
3
3
  import { join, relative, dirname, resolve } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { compile } from '@mdx-js/mdx';
6
6
  import remarkGfm from 'remark-gfm';
7
+ import { compression } from 'vite-plugin-compression2';
7
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
9
  const VIRTUAL_EMBERKIT_CONFIG = 'virtual:emberkit-config';
9
10
  const VIRTUAL_EMBERKIT_ROUTES = 'virtual:emberkit-routes';
@@ -23,11 +24,20 @@ export function emberkitVitePlugin(userOptions = {}) {
23
24
  config() {
24
25
  const pkgRoot = resolve(__dirname, '..', '..');
25
26
  const srcDir = join(pkgRoot, 'src');
27
+ const plugins = [];
28
+ if (options.compression?.gzip) {
29
+ plugins.push(compression({ algorithm: 'gzip' }));
30
+ }
31
+ if (options.compression?.brotli) {
32
+ plugins.push(compression({ algorithm: 'brotliCompress' }));
33
+ }
34
+ const isWorkspace = existsSync(join(pkgRoot, 'src', 'index.ts'));
26
35
  return {
36
+ plugins,
27
37
  resolve: {
28
- alias: {
38
+ alias: isWorkspace ? {
29
39
  '@emberkit/core': srcDir,
30
- },
40
+ } : {},
31
41
  },
32
42
  esbuild: {
33
43
  jsxImportSource: '@emberkit/core',
@@ -144,7 +154,7 @@ async function transformMDX(code, id) {
144
154
  }
145
155
  // Extract code blocks before MDX compilation to preserve syntax
146
156
  const codeBlocks = [];
147
- let processedContent = content.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, blockCode) => {
157
+ const processedContent = content.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, blockCode) => {
148
158
  const html = renderCodeBlock(lang, blockCode);
149
159
  codeBlocks.push({ html, index: codeBlocks.length });
150
160
  return `<CodeBlock_${codeBlocks.length - 1} />`;
@@ -188,7 +198,7 @@ async function transformMDX(code, id) {
188
198
  const componentsOverride = codeBlocks.length > 0
189
199
  ? `
190
200
  const _codeBlockComponents = {
191
- ${codeBlocks.map(b => `CodeBlock_${b.index}`).join(', ')}
201
+ ${codeBlocks.map((b) => `CodeBlock_${b.index}`).join(', ')}
192
202
  };
193
203
  `
194
204
  : '';
@@ -227,7 +237,7 @@ function _GfmSup(props) {
227
237
  export default function MDXComponent(props) {
228
238
  const components = {
229
239
  ...(props.components || {}),
230
- ${codeBlocks.map(b => `CodeBlock_${b.index}`).join(', ')}
240
+ ${codeBlocks.map((b) => `CodeBlock_${b.index}`).join(', ')}
231
241
  };
232
242
 
233
243
  return createElement('div', {
@@ -265,7 +275,10 @@ function parseFrontmatter(content) {
265
275
  else if (!isNaN(Number(value)))
266
276
  value = Number(value);
267
277
  else if (typeof value === 'string' && value.startsWith('[')) {
268
- value = value.replace(/[\[\]]/g, '').split(',').map((s) => s.trim());
278
+ value = value
279
+ .replace(/[\[\]]/g, '')
280
+ .split(',')
281
+ .map((s) => s.trim());
269
282
  }
270
283
  result[key] = value;
271
284
  }
@@ -300,7 +313,12 @@ function processHeadings(html) {
300
313
  }
301
314
  function renderCodeBlock(lang, code) {
302
315
  let highlighted = code.trim();
303
- if (lang === 'ts' || lang === 'tsx' || lang === 'js' || lang === 'jsx' || lang === 'typescript' || lang === 'javascript') {
316
+ if (lang === 'ts' ||
317
+ lang === 'tsx' ||
318
+ lang === 'js' ||
319
+ lang === 'jsx' ||
320
+ lang === 'typescript' ||
321
+ lang === 'javascript') {
304
322
  highlighted = highlightTS(highlighted);
305
323
  }
306
324
  else if (lang === 'bash' || lang === 'sh' || lang === 'shell') {
@@ -316,19 +334,109 @@ function renderCodeBlock(lang, code) {
316
334
  return `<pre${langAttr}><button class="copy-btn" onclick="(async()=>{await navigator.clipboard.writeText(this.closest('pre').querySelector('code').textContent);this.textContent='Copied!';setTimeout(()=>this.textContent='Copy',1500)})()"><svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg> Copy</button><code class="language-${lang}">${highlighted}</code></pre>`;
317
335
  }
318
336
  function escapeHtml(text) {
319
- return text
320
- .replace(/&/g, '&amp;')
321
- .replace(/</g, '&lt;')
322
- .replace(/>/g, '&gt;');
337
+ return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
323
338
  }
324
339
  function highlightTS(code) {
325
340
  const tokens = [];
326
341
  let remaining = code;
327
- const controlFlow = new Set(['if', 'else', 'for', 'while', 'do', 'switch', 'case', 'break', 'continue', 'return', 'throw', 'try', 'catch', 'finally']);
328
- const declarations = new Set(['import', 'export', 'from', 'const', 'let', 'var', 'function', 'class', 'extends', 'super', 'enum', 'type', 'interface', 'module', 'namespace', 'declare', 'new', 'delete', 'typeof', 'instanceof', 'in', 'of', 'default', 'as', 'satisfies', 'keyof', 'infer', 'is', 'asserts', 'abstract', 'implements']);
329
- const modifiers = new Set(['readonly', 'public', 'private', 'protected', 'static', 'abstract', 'async', 'override']);
342
+ const controlFlow = new Set([
343
+ 'if',
344
+ 'else',
345
+ 'for',
346
+ 'while',
347
+ 'do',
348
+ 'switch',
349
+ 'case',
350
+ 'break',
351
+ 'continue',
352
+ 'return',
353
+ 'throw',
354
+ 'try',
355
+ 'catch',
356
+ 'finally',
357
+ ]);
358
+ const declarations = new Set([
359
+ 'import',
360
+ 'export',
361
+ 'from',
362
+ 'const',
363
+ 'let',
364
+ 'var',
365
+ 'function',
366
+ 'class',
367
+ 'extends',
368
+ 'super',
369
+ 'enum',
370
+ 'type',
371
+ 'interface',
372
+ 'module',
373
+ 'namespace',
374
+ 'declare',
375
+ 'new',
376
+ 'delete',
377
+ 'typeof',
378
+ 'instanceof',
379
+ 'in',
380
+ 'of',
381
+ 'default',
382
+ 'as',
383
+ 'satisfies',
384
+ 'keyof',
385
+ 'infer',
386
+ 'is',
387
+ 'asserts',
388
+ 'abstract',
389
+ 'implements',
390
+ ]);
391
+ const modifiers = new Set([
392
+ 'readonly',
393
+ 'public',
394
+ 'private',
395
+ 'protected',
396
+ 'static',
397
+ 'abstract',
398
+ 'async',
399
+ 'override',
400
+ ]);
330
401
  const literals = new Set(['true', 'false', 'null', 'undefined', 'this']);
331
- const builtins = new Set(['console', 'document', 'window', 'Math', 'JSON', 'Array', 'Object', 'String', 'Number', 'Boolean', 'Promise', 'Map', 'Set', 'RegExp', 'Date', 'Error', 'Symbol', 'Record', 'Partial', 'Required', 'Pick', 'Omit', 'Exclude', 'Extract', 'ReturnType', 'Parameters', 'JSX', 'FC', 'Props', 'State', 'Effect', 'Memo', 'Signal', 'Ref', 'Context', 'React']);
402
+ const builtins = new Set([
403
+ 'console',
404
+ 'document',
405
+ 'window',
406
+ 'Math',
407
+ 'JSON',
408
+ 'Array',
409
+ 'Object',
410
+ 'String',
411
+ 'Number',
412
+ 'Boolean',
413
+ 'Promise',
414
+ 'Map',
415
+ 'Set',
416
+ 'RegExp',
417
+ 'Date',
418
+ 'Error',
419
+ 'Symbol',
420
+ 'Record',
421
+ 'Partial',
422
+ 'Required',
423
+ 'Pick',
424
+ 'Omit',
425
+ 'Exclude',
426
+ 'Extract',
427
+ 'ReturnType',
428
+ 'Parameters',
429
+ 'JSX',
430
+ 'FC',
431
+ 'Props',
432
+ 'State',
433
+ 'Effect',
434
+ 'Memo',
435
+ 'Signal',
436
+ 'Ref',
437
+ 'Context',
438
+ 'React',
439
+ ]);
332
440
  while (remaining.length > 0) {
333
441
  let m;
334
442
  // Multi-line comment
@@ -419,7 +527,33 @@ function highlightTS(code) {
419
527
  }
420
528
  // JSX prop name (word followed by =)
421
529
  m = remaining.match(/^([a-zA-Z_][\w.]*)\s*(?==)/);
422
- if (m && !['if', 'else', 'for', 'while', 'switch', 'case', 'return', 'import', 'export', 'from', 'const', 'let', 'var', 'function', 'class', 'new', 'typeof', 'instanceof', 'void', 'null', 'undefined', 'true', 'false', 'this'].includes(m[1])) {
530
+ if (m &&
531
+ ![
532
+ 'if',
533
+ 'else',
534
+ 'for',
535
+ 'while',
536
+ 'switch',
537
+ 'case',
538
+ 'return',
539
+ 'import',
540
+ 'export',
541
+ 'from',
542
+ 'const',
543
+ 'let',
544
+ 'var',
545
+ 'function',
546
+ 'class',
547
+ 'new',
548
+ 'typeof',
549
+ 'instanceof',
550
+ 'void',
551
+ 'null',
552
+ 'undefined',
553
+ 'true',
554
+ 'false',
555
+ 'this',
556
+ ].includes(m[1])) {
423
557
  tokens.push(`<span class="attr">${escapeHtml(m[1])}</span>`);
424
558
  remaining = remaining.slice(m[1].length);
425
559
  continue;
@@ -502,7 +636,8 @@ function highlightInlineExpr(code) {
502
636
  }
503
637
  function highlightBash(code) {
504
638
  const lines = code.split('\n');
505
- return lines.map(line => {
639
+ return lines
640
+ .map((line) => {
506
641
  const trimmed = line.trimStart();
507
642
  // Comment
508
643
  if (trimmed.startsWith('#')) {
@@ -537,7 +672,35 @@ function highlightBash(code) {
537
672
  // Word (potential command)
538
673
  m = remaining.match(/^([a-zA-Z][\w-]*)/);
539
674
  if (m) {
540
- const cmds = new Set(['sudo', 'cd', 'mkdir', 'rm', 'cp', 'mv', 'ls', 'cat', 'echo', 'npm', 'pnpm', 'yarn', 'git', 'curl', 'chmod', 'export', 'source', 'node', 'npx', 'bun', 'deno', 'grep', 'awk', 'sed', 'find', 'docker', 'kubectl']);
675
+ const cmds = new Set([
676
+ 'sudo',
677
+ 'cd',
678
+ 'mkdir',
679
+ 'rm',
680
+ 'cp',
681
+ 'mv',
682
+ 'ls',
683
+ 'cat',
684
+ 'echo',
685
+ 'npm',
686
+ 'pnpm',
687
+ 'yarn',
688
+ 'git',
689
+ 'curl',
690
+ 'chmod',
691
+ 'export',
692
+ 'source',
693
+ 'node',
694
+ 'npx',
695
+ 'bun',
696
+ 'deno',
697
+ 'grep',
698
+ 'awk',
699
+ 'sed',
700
+ 'find',
701
+ 'docker',
702
+ 'kubectl',
703
+ ]);
541
704
  tokens.push(cmds.has(m[1]) ? `<span class="kw">${m[1]}</span>` : m[1]);
542
705
  remaining = remaining.slice(m[1].length);
543
706
  continue;
@@ -547,7 +710,8 @@ function highlightBash(code) {
547
710
  remaining = remaining.slice(1);
548
711
  }
549
712
  return tokens.join('');
550
- }).join('\n');
713
+ })
714
+ .join('\n');
551
715
  }
552
716
  function highlightJSON(code) {
553
717
  let result = escapeHtml(code);
@@ -568,10 +732,14 @@ function processTables(html) {
568
732
  while (i < lines.length) {
569
733
  // Check if this line and the next look like a table
570
734
  if (i + 1 < lines.length &&
571
- lines[i].trim().startsWith('|') && lines[i].trim().endsWith('|') &&
735
+ lines[i].trim().startsWith('|') &&
736
+ lines[i].trim().endsWith('|') &&
572
737
  lines[i + 1].trim().match(/^\|[\s\-:|]+\|$/)) {
573
738
  // Parse header row
574
- const headerCells = lines[i].trim().split('|').filter(c => c.trim() !== '');
739
+ const headerCells = lines[i]
740
+ .trim()
741
+ .split('|')
742
+ .filter((c) => c.trim() !== '');
575
743
  result.push('<table>');
576
744
  result.push('<thead><tr>');
577
745
  for (const cell of headerCells) {
@@ -583,7 +751,10 @@ function processTables(html) {
583
751
  i += 2;
584
752
  // Parse data rows
585
753
  while (i < lines.length && lines[i].trim().startsWith('|') && lines[i].trim().endsWith('|')) {
586
- const cells = lines[i].trim().split('|').filter(c => c.trim() !== '');
754
+ const cells = lines[i]
755
+ .trim()
756
+ .split('|')
757
+ .filter((c) => c.trim() !== '');
587
758
  result.push('<tr>');
588
759
  for (const cell of cells) {
589
760
  result.push(`<td>${cell.trim()}</td>`);
@@ -690,7 +861,8 @@ function processEmphasis(html) {
690
861
  function processParagraphs(html, breaks) {
691
862
  // Split on pre blocks to avoid processing code content
692
863
  const parts = html.split(/(<pre[\s\S]*?<\/pre>)/);
693
- return parts.map((part) => {
864
+ return parts
865
+ .map((part) => {
694
866
  // Don't process content inside pre tags
695
867
  if (part.startsWith('<pre'))
696
868
  return part;
@@ -700,8 +872,12 @@ function processParagraphs(html, breaks) {
700
872
  p = p.trim();
701
873
  if (!p)
702
874
  return '';
703
- if (p.startsWith('<h') || p.startsWith('<ul') || p.startsWith('<ol') ||
704
- p.startsWith('<pre') || p.startsWith('<blockquote') || p.startsWith('<table') ||
875
+ if (p.startsWith('<h') ||
876
+ p.startsWith('<ul') ||
877
+ p.startsWith('<ol') ||
878
+ p.startsWith('<pre') ||
879
+ p.startsWith('<blockquote') ||
880
+ p.startsWith('<table') ||
705
881
  p.startsWith('<hr')) {
706
882
  return p;
707
883
  }
@@ -709,7 +885,8 @@ function processParagraphs(html, breaks) {
709
885
  return `<p>${p}</p>`;
710
886
  })
711
887
  .join('\n');
712
- }).join('');
888
+ })
889
+ .join('');
713
890
  }
714
891
  function scanRouteFiles(dir) {
715
892
  const files = [];
@@ -746,7 +923,9 @@ function generateRoutesCode(files, routeDir) {
746
923
  const ext = file.split('.').pop() ?? '';
747
924
  const isMarkdown = ext === 'md' || ext === 'mdx';
748
925
  // Skip special files
749
- if (relativePath.includes('_layout') || relativePath.includes('_error') || relativePath.includes('_loading')) {
926
+ if (relativePath.includes('_layout') ||
927
+ relativePath.includes('_error') ||
928
+ relativePath.includes('_loading')) {
750
929
  continue;
751
930
  }
752
931
  // Skip API routes
@@ -0,0 +1,44 @@
1
+ import type { Plugin } from 'vite';
2
+ export type EmberKitMode = 'static' | 'ssr' | 'spa' | 'hybrid';
3
+ export interface EmberKitPluginOptions {
4
+ mode?: EmberKitMode;
5
+ routeDir?: string;
6
+ outputDir?: string;
7
+ jsx?: 'automatic' | 'classic';
8
+ markdown?: Partial<MarkdownConfig>;
9
+ mdx?: MDXConfig;
10
+ compression?: {
11
+ gzip?: boolean;
12
+ brotli?: boolean;
13
+ };
14
+ }
15
+ export interface MarkdownConfig {
16
+ gfm: boolean;
17
+ breaks: boolean;
18
+ html: boolean;
19
+ tables: boolean;
20
+ }
21
+ export interface MDXConfig {
22
+ components?: Record<string, string>;
23
+ scope?: Record<string, unknown>;
24
+ }
25
+ export type EmberKitPlugin = (options?: EmberKitPluginOptions) => Plugin;
26
+ export declare const DEFAULT_CONFIG: {
27
+ readonly mode: "hybrid";
28
+ readonly routeDir: "src/routes";
29
+ readonly outputDir: "dist";
30
+ readonly jsx: "automatic";
31
+ readonly markdown: {
32
+ readonly gfm: true;
33
+ readonly breaks: false;
34
+ readonly html: true;
35
+ readonly tables: true;
36
+ };
37
+ readonly mdx: {};
38
+ readonly compression: {
39
+ readonly gzip: true;
40
+ readonly brotli: true;
41
+ };
42
+ };
43
+ export type ResolvedConfig = typeof DEFAULT_CONFIG & EmberKitPluginOptions;
44
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vite-plugin/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACnC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE;QACZ,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,EAAE,qBAAqB,KAAK,MAAM,CAAC;AAEzE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;CAgBjB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,GAAG,qBAAqB,CAAC"}
@@ -10,4 +10,8 @@ export const DEFAULT_CONFIG = {
10
10
  tables: true,
11
11
  },
12
12
  mdx: {},
13
+ compression: {
14
+ gzip: true,
15
+ brotli: true,
16
+ },
13
17
  };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@emberkit/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
+ "private": false,
5
6
  "description": "Lightweight TypeScript-first JSX framework core",
6
7
  "license": "Apache-2.0",
7
8
  "repository": {
@@ -45,14 +46,6 @@
45
46
  "types": "./dist/jsx-dev-runtime.d.ts"
46
47
  }
47
48
  },
48
- "scripts": {
49
- "build": "tsc --build",
50
- "dev": "tsc --build --watch",
51
- "lint": "eslint src --ext .ts,.tsx",
52
- "format": "prettier --write \"src/**/*.{ts,tsx}\"",
53
- "test": "vitest",
54
- "typecheck": "tsc --noEmit"
55
- },
56
49
  "dependencies": {
57
50
  "@mdx-js/mdx": "^3.1.1",
58
51
  "remark-gfm": "^4.0.0",
@@ -66,6 +59,15 @@
66
59
  "eslint-plugin-perfectionist": "^5.9.0",
67
60
  "jsdom": "^29.1.1",
68
61
  "typescript-eslint": "^8.59.3",
62
+ "vite-plugin-compression2": "^2.5.3",
69
63
  "vitest": "^3.0.0"
64
+ },
65
+ "scripts": {
66
+ "build": "tsc --build",
67
+ "dev": "tsc --build --watch",
68
+ "lint": "eslint src --ext .ts,.tsx",
69
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
70
+ "test": "vitest",
71
+ "typecheck": "tsc --noEmit"
70
72
  }
71
- }
73
+ }