@meekojs/meeko 0.0.3 → 0.1.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 (188) hide show
  1. package/README.md +35 -16
  2. package/dist/autoimports-ts.d.ts +26 -0
  3. package/dist/autoimports-ts.js +183 -0
  4. package/dist/autoimports-ts.js.map +1 -0
  5. package/dist/autoimports.d.ts +21 -0
  6. package/dist/autoimports.js +301 -0
  7. package/dist/autoimports.js.map +1 -0
  8. package/dist/check.js +74 -33
  9. package/dist/check.js.map +1 -0
  10. package/dist/cli.js +67 -5
  11. package/dist/cli.js.map +1 -0
  12. package/dist/compiler/events.d.ts +2 -0
  13. package/dist/compiler/events.js +6 -0
  14. package/dist/compiler/events.js.map +1 -0
  15. package/dist/compiler/import-graph.d.ts +8 -0
  16. package/dist/compiler/import-graph.js +33 -0
  17. package/dist/compiler/import-graph.js.map +1 -0
  18. package/dist/compiler/mapping.js +1 -0
  19. package/dist/compiler/mapping.js.map +1 -0
  20. package/dist/compiler/project-root.d.ts +2 -0
  21. package/dist/compiler/project-root.js +18 -0
  22. package/dist/compiler/project-root.js.map +1 -0
  23. package/dist/compiler/props.d.ts +12 -0
  24. package/dist/compiler/props.js +32 -0
  25. package/dist/compiler/props.js.map +1 -0
  26. package/dist/compiler/sfc.js +1 -0
  27. package/dist/compiler/sfc.js.map +1 -0
  28. package/dist/compiler/sourcemap.d.ts +3 -0
  29. package/dist/compiler/sourcemap.js +75 -0
  30. package/dist/compiler/sourcemap.js.map +1 -0
  31. package/dist/compiler/template.js +1 -0
  32. package/dist/compiler/template.js.map +1 -0
  33. package/dist/compiler.js +66 -17
  34. package/dist/compiler.js.map +1 -0
  35. package/dist/component-errors.d.ts +18 -0
  36. package/dist/component-errors.js +65 -0
  37. package/dist/component-errors.js.map +1 -0
  38. package/dist/devtools-ui/index.js +1 -0
  39. package/dist/devtools-ui/index.js.map +1 -0
  40. package/dist/devtools.js +3 -4
  41. package/dist/devtools.js.map +1 -0
  42. package/dist/dom.d.ts +18 -5
  43. package/dist/dom.js +295 -90
  44. package/dist/dom.js.map +1 -0
  45. package/dist/error-observer.d.ts +6 -0
  46. package/dist/error-observer.js +41 -0
  47. package/dist/error-observer.js.map +1 -0
  48. package/dist/framework/check-app.d.ts +5 -0
  49. package/dist/framework/check-app.js +214 -0
  50. package/dist/framework/check-app.js.map +1 -0
  51. package/dist/framework/check-project.d.ts +4 -0
  52. package/dist/framework/check-project.js +42 -0
  53. package/dist/framework/check-project.js.map +1 -0
  54. package/dist/framework/client.d.ts +48 -0
  55. package/dist/framework/client.js +249 -0
  56. package/dist/framework/client.js.map +1 -0
  57. package/dist/framework/clients.d.ts +82 -0
  58. package/dist/framework/clients.js +190 -0
  59. package/dist/framework/clients.js.map +1 -0
  60. package/dist/framework/config-type.d.ts +10 -0
  61. package/dist/framework/config-type.js +4 -0
  62. package/dist/framework/config-type.js.map +1 -0
  63. package/dist/framework/config.d.ts +15 -0
  64. package/dist/framework/config.js +138 -0
  65. package/dist/framework/config.js.map +1 -0
  66. package/dist/framework/contracts-generate.d.ts +8 -0
  67. package/dist/framework/contracts-generate.js +290 -0
  68. package/dist/framework/contracts-generate.js.map +1 -0
  69. package/dist/framework/generate.d.ts +7 -0
  70. package/dist/framework/generate.js +67 -0
  71. package/dist/framework/generate.js.map +1 -0
  72. package/dist/framework/init.d.ts +2 -0
  73. package/dist/framework/init.js +183 -0
  74. package/dist/framework/init.js.map +1 -0
  75. package/dist/framework/middleware.d.ts +14 -0
  76. package/dist/framework/middleware.js +16 -0
  77. package/dist/framework/middleware.js.map +1 -0
  78. package/dist/framework/modules.d.ts +22 -0
  79. package/dist/framework/modules.js +29 -0
  80. package/dist/framework/modules.js.map +1 -0
  81. package/dist/framework/page-contracts-check.d.ts +8 -0
  82. package/dist/framework/page-contracts-check.js +110 -0
  83. package/dist/framework/page-contracts-check.js.map +1 -0
  84. package/dist/framework/page-contracts-generate.d.ts +2 -0
  85. package/dist/framework/page-contracts-generate.js +94 -0
  86. package/dist/framework/page-contracts-generate.js.map +1 -0
  87. package/dist/framework/page.d.ts +64 -0
  88. package/dist/framework/page.js +44 -0
  89. package/dist/framework/page.js.map +1 -0
  90. package/dist/framework/prerender.d.ts +14 -0
  91. package/dist/framework/prerender.js +110 -0
  92. package/dist/framework/prerender.js.map +1 -0
  93. package/dist/framework/project-templates.d.ts +3 -0
  94. package/dist/framework/project-templates.js +119 -0
  95. package/dist/framework/project-templates.js.map +1 -0
  96. package/dist/framework/project.d.ts +9 -0
  97. package/dist/framework/project.js +272 -0
  98. package/dist/framework/project.js.map +1 -0
  99. package/dist/framework/router.d.ts +41 -0
  100. package/dist/framework/router.js +259 -0
  101. package/dist/framework/router.js.map +1 -0
  102. package/dist/framework/server.d.ts +65 -0
  103. package/dist/framework/server.js +239 -0
  104. package/dist/framework/server.js.map +1 -0
  105. package/dist/framework/socket-contracts-generate.d.ts +5 -0
  106. package/dist/framework/socket-contracts-generate.js +162 -0
  107. package/dist/framework/socket-contracts-generate.js.map +1 -0
  108. package/dist/framework/socket.d.ts +72 -0
  109. package/dist/framework/socket.js +252 -0
  110. package/dist/framework/socket.js.map +1 -0
  111. package/dist/framework/standard-schema-types.d.ts +7 -0
  112. package/dist/framework/standard-schema-types.js +69 -0
  113. package/dist/framework/standard-schema-types.js.map +1 -0
  114. package/dist/framework/state.d.ts +22 -0
  115. package/dist/framework/state.js +136 -0
  116. package/dist/framework/state.js.map +1 -0
  117. package/dist/framework/styles.d.ts +2 -0
  118. package/dist/framework/styles.js +6 -0
  119. package/dist/framework/styles.js.map +1 -0
  120. package/dist/framework/type-declarations.d.ts +5 -0
  121. package/dist/framework/type-declarations.js +84 -0
  122. package/dist/framework/type-declarations.js.map +1 -0
  123. package/dist/framework-server/auto-clients.d.ts +3 -0
  124. package/dist/framework-server/auto-clients.js +27 -0
  125. package/dist/framework-server/auto-clients.js.map +1 -0
  126. package/dist/framework-server/context.d.ts +21 -0
  127. package/dist/framework-server/context.js +22 -0
  128. package/dist/framework-server/context.js.map +1 -0
  129. package/dist/framework-server/contracts.d.ts +73 -0
  130. package/dist/framework-server/contracts.js +184 -0
  131. package/dist/framework-server/contracts.js.map +1 -0
  132. package/dist/framework-server/discovery.d.ts +43 -0
  133. package/dist/framework-server/discovery.js +257 -0
  134. package/dist/framework-server/discovery.js.map +1 -0
  135. package/dist/framework-server/local.d.ts +21 -0
  136. package/dist/framework-server/local.js +100 -0
  137. package/dist/framework-server/local.js.map +1 -0
  138. package/dist/framework-server/middleware.d.ts +4 -0
  139. package/dist/framework-server/middleware.js +56 -0
  140. package/dist/framework-server/middleware.js.map +1 -0
  141. package/dist/framework-server/node-upgrade.d.ts +23 -0
  142. package/dist/framework-server/node-upgrade.js +96 -0
  143. package/dist/framework-server/node-upgrade.js.map +1 -0
  144. package/dist/framework-server/node-websocket.d.ts +16 -0
  145. package/dist/framework-server/node-websocket.js +127 -0
  146. package/dist/framework-server/node-websocket.js.map +1 -0
  147. package/dist/framework-server/openapi.d.ts +17 -0
  148. package/dist/framework-server/openapi.js +118 -0
  149. package/dist/framework-server/openapi.js.map +1 -0
  150. package/dist/framework-server/session-stores.d.ts +73 -0
  151. package/dist/framework-server/session-stores.js +122 -0
  152. package/dist/framework-server/session-stores.js.map +1 -0
  153. package/dist/framework-server/sessions.d.ts +70 -0
  154. package/dist/framework-server/sessions.js +167 -0
  155. package/dist/framework-server/sessions.js.map +1 -0
  156. package/dist/framework-server/socket.d.ts +83 -0
  157. package/dist/framework-server/socket.js +196 -0
  158. package/dist/framework-server/socket.js.map +1 -0
  159. package/dist/framework-server.d.ts +23 -0
  160. package/dist/framework-server.js +13 -0
  161. package/dist/framework-server.js.map +1 -0
  162. package/dist/framework.d.ts +31 -0
  163. package/dist/framework.js +14 -0
  164. package/dist/framework.js.map +1 -0
  165. package/dist/hmr.js +75 -24
  166. package/dist/hmr.js.map +1 -0
  167. package/dist/index.d.ts +5 -3
  168. package/dist/index.js +3 -1
  169. package/dist/index.js.map +1 -0
  170. package/dist/init.js +31 -3
  171. package/dist/init.js.map +1 -0
  172. package/dist/internal.d.ts +2 -2
  173. package/dist/internal.js +3 -2
  174. package/dist/internal.js.map +1 -0
  175. package/dist/node.d.ts +16 -0
  176. package/dist/node.js +122 -0
  177. package/dist/node.js.map +1 -0
  178. package/dist/reactivity.d.ts +22 -1
  179. package/dist/reactivity.js +132 -18
  180. package/dist/reactivity.js.map +1 -0
  181. package/dist/server.js +1 -0
  182. package/dist/server.js.map +1 -0
  183. package/dist/types.d.ts +2 -0
  184. package/dist/types.js +26 -9
  185. package/dist/types.js.map +1 -0
  186. package/dist/vite.js +112 -7
  187. package/dist/vite.js.map +1 -0
  188. package/package.json +15 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SACxB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC;SACvB,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC;SACzB,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAE5T,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC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C;YACzF,kBAAkB,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;YAAS,CAAC;QACT,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;IAClF,OAAO,IAAI;SACR,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC;SAC1B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/** Escapa texto dinámico antes de insertarlo en HTML generado por SSR. */\nexport function escapeHtml(value: unknown): string {\n return String(value)\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\")\n .replaceAll('\"', \"&quot;\")\n .replaceAll(\"'\", \"&#39;\");\n}\n\nconst booleanAttributes = new Set([\"allowfullscreen\", \"async\", \"autofocus\", \"autoplay\", \"checked\", \"controls\", \"default\", \"defer\", \"disabled\", \"formnovalidate\", \"hidden\", \"inert\", \"ismap\", \"loop\", \"multiple\", \"muted\", \"nomodule\", \"novalidate\", \"open\", \"playsinline\", \"readonly\", \"required\", \"reversed\", \"selected\"]);\n\n/** Convierte un valor de atributo dinámico en su forma DOM; null lo elimina. */\nexport function attributeValue(name: string, value: unknown): string | null {\n if (booleanAttributes.has(name)) return value ? \"\" : null;\n if (value === null || value === undefined || value === false) return null;\n return String(value);\n}\n\n/** Genera un atributo HTML dinámico con escape seguro para SSR. */\nexport function renderAttribute(name: string, value: unknown): string {\n if (!/^[a-zA-Z_:][a-zA-Z0-9_:.-]*$/.test(name)) throw new TypeError(`Invalid attribute name: ${name}`);\n const resolved = attributeValue(name, value);\n return resolved === null ? \"\" : ` ${name}=\"${escapeHtml(resolved)}\"`;\n}\n\nfunction assertSerializable(value: unknown, path: string, ancestors: WeakSet<object>): void {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") return;\n if (typeof value === \"number\") {\n if (Number.isFinite(value)) return;\n throw new TypeError(`Non-finite number at ${path}`);\n }\n if (typeof value !== \"object\") throw new TypeError(`Non-serializable value at ${path}`);\n if (ancestors.has(value)) throw new TypeError(`Circular reference at ${path}`);\n const prototype: unknown = Object.getPrototypeOf(value);\n if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) {\n throw new TypeError(`Non-plain object at ${path}`);\n }\n if (Object.hasOwn(value, \"toJSON\")) throw new TypeError(`Custom toJSON at ${path}`);\n if (Array.isArray(value)) {\n for (let index = 0; index < value.length; index++) {\n if (!Object.hasOwn(value, index)) throw new TypeError(`Sparse array at ${path}[${index}]`);\n }\n }\n ancestors.add(value);\n try {\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\") throw new TypeError(`Symbol key at ${path}`);\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor?.enumerable) continue;\n if (!(\"value\" in descriptor)) throw new TypeError(`Accessor property at ${path}.${key}`);\n assertSerializable(descriptor.value, `${path}.${key}`, ancestors);\n }\n } finally {\n ancestors.delete(value);\n }\n}\n\n/** Serializa estado y props transferibles al navegador, rechazando valores ambiguos. */\nexport function serializeJson(value: unknown): string {\n assertSerializable(value, \"$\", new WeakSet());\n const json = JSON.stringify(value);\n if (json === undefined) throw new TypeError(\"Value cannot be serialized to JSON\");\n return json\n .replaceAll(\"<\", \"\\\\u003c\")\n .replaceAll(\">\", \"\\\\u003e\")\n .replaceAll(\"&\", \"\\\\u0026\")\n .replaceAll(\"\\u2028\", \"\\\\u2028\")\n .replaceAll(\"\\u2029\", \"\\\\u2029\");\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ /** Stable ownership marker for generated component declarations. */
2
+ export declare const componentTypeDeclarationMarker = "// @meeko-generated component-declaration v1";
1
3
  /** Genera declaraciones TypeScript para un componente y sus imports .meeko relativos. */
2
4
  export declare function generateTypes(source: string, filename: string): Promise<string[]>;
package/dist/types.js CHANGED
@@ -1,16 +1,23 @@
1
- import { readFile, writeFile } from "node:fs/promises";
2
- import { dirname, resolve } from "node:path";
1
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import { dirname, join, relative, resolve } from "node:path";
3
3
  import ts from "@typescript/typescript6";
4
- import { compile } from "./compiler.js";
4
+ import { compileWithAutoImports } from "./autoimports.js";
5
+ import { moduleSpecifiers, replaceModuleSpecifiers } from "./compiler/import-graph.js";
6
+ import { projectRoot } from "./compiler/project-root.js";
7
+ /** Stable ownership marker for generated component declarations. */
8
+ export const componentTypeDeclarationMarker = "// @meeko-generated component-declaration v1";
5
9
  /** Genera declaraciones TypeScript para un componente y sus imports .meeko relativos. */
6
10
  export async function generateTypes(source, filename) {
7
11
  if (!filename.endsWith(".meeko"))
8
12
  throw new TypeError("Type generation requires a .meeko input file");
13
+ const root = projectRoot(filename);
14
+ const outputRoot = join(root, ".meeko", "types");
9
15
  const declarations = new Map();
10
16
  async function collect(content, path) {
11
17
  if (declarations.has(path))
12
18
  return;
13
- const generated = compile(content, path).code;
19
+ const target = relative(root, path).split(/[\\/]/)[0] === "server" ? "server" : "client";
20
+ const generated = (await compileWithAutoImports(content, path, {}, target)).code;
14
21
  const result = ts.transpileDeclaration(generated, {
15
22
  fileName: `${path}.ts`,
16
23
  compilerOptions: { declaration: true, emitDeclarationOnly: true },
@@ -18,9 +25,10 @@ export async function generateTypes(source, filename) {
18
25
  const error = result.diagnostics?.find((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
19
26
  if (error)
20
27
  throw new Error(ts.flattenDiagnosticMessageText(error.messageText, "\n"));
21
- declarations.set(path, result.outputText);
22
- for (const match of generated.matchAll(/\b(?:from\s*|import\s*)["']([^"']+\.meeko)["']/g)) {
23
- const specifier = match[1];
28
+ declarations.set(path, `${componentTypeDeclarationMarker}\n${result.outputText}`);
29
+ for (const { value: specifier } of moduleSpecifiers(generated, path)) {
30
+ if (!specifier.endsWith(".meeko"))
31
+ continue;
24
32
  if (!specifier.startsWith("."))
25
33
  continue;
26
34
  const child = resolve(dirname(path), specifier);
@@ -30,9 +38,18 @@ export async function generateTypes(source, filename) {
30
38
  await collect(source, resolve(filename));
31
39
  const outputs = [];
32
40
  for (const [path, declaration] of declarations) {
33
- const output = path.replace(/\.meeko$/, ".d.meeko.ts");
34
- await writeFile(output, declaration, "utf8");
41
+ const output = join(outputRoot, relative(root, path)).replace(/\.meeko$/, ".d.meeko.ts");
42
+ const rewritten = replaceModuleSpecifiers(declaration, output, ({ value }) => {
43
+ if (!value.startsWith(".") || value.endsWith(".meeko"))
44
+ return value;
45
+ const original = resolve(dirname(path), value);
46
+ const target = relative(dirname(output), original).replaceAll("\\", "/");
47
+ return target.startsWith(".") ? target : `./${target}`;
48
+ });
49
+ await mkdir(dirname(output), { recursive: true });
50
+ await writeFile(output, rewritten, "utf8");
35
51
  outputs.push(output);
36
52
  }
37
53
  return outputs;
38
54
  }
55
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC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AAC,EAAE,KAAK,EAAE,EAAE,EAAE;YAC3E,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAE,OAAO,KAAK,CAAC;YACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YACzE,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport ts from \"@typescript/typescript6\";\nimport { compileWithAutoImports } from \"./autoimports.js\";\nimport { moduleSpecifiers, replaceModuleSpecifiers } from \"./compiler/import-graph.js\";\nimport { projectRoot } from \"./compiler/project-root.js\";\n\n/** Stable ownership marker for generated component declarations. */\nexport const componentTypeDeclarationMarker = \"// @meeko-generated component-declaration v1\";\n\n/** Genera declaraciones TypeScript para un componente y sus imports .meeko relativos. */\nexport async function generateTypes(source: string, filename: string): Promise<string[]> {\n if (!filename.endsWith(\".meeko\")) throw new TypeError(\"Type generation requires a .meeko input file\");\n const root = projectRoot(filename);\n const outputRoot = join(root, \".meeko\", \"types\");\n const declarations = new Map<string, string>();\n async function collect(content: string, path: string): Promise<void> {\n if (declarations.has(path)) return;\n const target = relative(root, path).split(/[\\\\/]/)[0] === \"server\" ? \"server\" : \"client\";\n const generated = (await compileWithAutoImports(content, path, {}, target)).code;\n const result = ts.transpileDeclaration(generated, {\n fileName: `${path}.ts`,\n compilerOptions: { declaration: true, emitDeclarationOnly: true },\n });\n const error = result.diagnostics?.find((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);\n if (error) throw new Error(ts.flattenDiagnosticMessageText(error.messageText, \"\\n\"));\n declarations.set(path, `${componentTypeDeclarationMarker}\\n${result.outputText}`);\n for (const { value: specifier } of moduleSpecifiers(generated, path)) {\n if (!specifier.endsWith(\".meeko\")) continue;\n if (!specifier.startsWith(\".\")) continue;\n const child = resolve(dirname(path), specifier);\n await collect(await readFile(child, \"utf8\"), child);\n }\n }\n await collect(source, resolve(filename));\n const outputs: string[] = [];\n for (const [path, declaration] of declarations) {\n const output = join(outputRoot, relative(root, path)).replace(/\\.meeko$/, \".d.meeko.ts\");\n const rewritten = replaceModuleSpecifiers(declaration, output, ({ value }) => {\n if (!value.startsWith(\".\") || value.endsWith(\".meeko\")) return value;\n const original = resolve(dirname(path), value);\n const target = relative(dirname(output), original).replaceAll(\"\\\\\", \"/\");\n return target.startsWith(\".\") ? target : `./${target}`;\n });\n await mkdir(dirname(output), { recursive: true });\n await writeFile(output, rewritten, \"utf8\");\n outputs.push(output);\n }\n return outputs;\n}\n"]}
package/dist/vite.js CHANGED
@@ -1,33 +1,105 @@
1
1
  import { createHash } from "node:crypto";
2
- import { dirname, resolve } from "node:path";
2
+ import { dirname, isAbsolute, relative, resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { normalizePath, transformWithOxc } from "vite";
5
5
  import { compile } from "./compiler.js";
6
+ import { moduleSpecifiers } from "./compiler/import-graph.js";
7
+ import { sourceMapForCompiled } from "./compiler/sourcemap.js";
8
+ import { discoverAutoImports, transformAutoImports } from "./autoimports.js";
9
+ import { transformTypeScriptAutoImports, typeScriptAutoImportMap } from "./autoimports-ts.js";
10
+ import { discoverConfiguredRoutes, loadMeekoConfig, resolveConfigSources } from "./framework/config.js";
6
11
  const stylePrefix = "\0virtual:meeko-style:";
12
+ const pageModules = new Map([
13
+ ["virtual:meeko-client-pages", "client"],
14
+ ["virtual:meeko-server-pages", "server"],
15
+ ["virtual:meeko-server-routes", "routes"],
16
+ ]);
7
17
  const runtimeDirectory = `${normalizePath(dirname(fileURLToPath(import.meta.url)))}/`;
8
18
  /** Transforma componentes .meeko para Vite, tanto en cliente como en SSR. */
9
19
  export function meeko() {
10
20
  let isDev = false;
21
+ let ssrBuild = false;
22
+ let root = "";
11
23
  const styles = new Map();
12
24
  return {
13
25
  name: "meeko:components",
14
26
  enforce: "pre",
15
27
  configResolved(config) {
16
28
  isDev = config.command === "serve";
29
+ ssrBuild = Boolean(config.build.ssr);
30
+ root = config.root;
17
31
  },
18
32
  resolveId(id) {
19
33
  if (id.startsWith("virtual:meeko-style:"))
20
34
  return `\0${id}`;
35
+ if (pageModules.has(id))
36
+ return `\0${id}`;
21
37
  return null;
22
38
  },
23
- load(id) {
39
+ async load(id) {
40
+ const kind = pageModules.get(id.slice(1));
41
+ if (kind) {
42
+ const routes = await discoverConfiguredRoutes(root);
43
+ const files = kind === "routes"
44
+ ? routes.flatMap((route) => route.sidecar ? [route.sidecar] : [])
45
+ : routes.flatMap((route) => [route.file, ...route.layouts, ...(route.error ? [route.error] : [])]);
46
+ const unique = [...new Set(files)];
47
+ const entries = unique.map((file, index) => {
48
+ const path = relative(root, file).replaceAll("\\", "/");
49
+ if (path === ".." || path.startsWith("../") || isAbsolute(path))
50
+ throw new Error(`Page outside Meeko project: ${file}`);
51
+ const specifier = `/${path}`;
52
+ return kind === "client"
53
+ ? `${JSON.stringify(specifier)}: () => import(${JSON.stringify(specifier)})`
54
+ : `${JSON.stringify(specifier)}: module${index}`;
55
+ });
56
+ const imports = kind === "client" ? "" : unique.map((file, index) => {
57
+ const path = relative(root, file).replaceAll("\\", "/");
58
+ return `import * as module${index} from ${JSON.stringify(`/${path}`)};`;
59
+ }).join("\n");
60
+ return `${imports}\nexport const modules = {${entries.join(",")}};`;
61
+ }
24
62
  if (!id.startsWith(stylePrefix) || !id.endsWith(".css"))
25
63
  return null;
26
64
  return styles.get(id) ?? null;
27
65
  },
28
- async transform(source, id) {
29
- if (!id.endsWith(".meeko"))
66
+ async transform(source, id, options) {
67
+ const serverTransform = Boolean(options?.ssr || ssrBuild);
68
+ const normalizedId = normalizePath(resolve(id));
69
+ const normalizedRoot = normalizePath(root);
70
+ const clientModule = !serverTransform && normalizedId.startsWith(`${normalizedRoot}/`);
71
+ const sources = normalizedId.startsWith(`${normalizedRoot}/`) ? await resolveConfigSources(root) : [];
72
+ const serverDirectories = sources.map((entry) => `${normalizePath(entry.root)}/server/`);
73
+ const serverOnly = (moduleId) => serverDirectories.some((directory) => moduleId.startsWith(directory));
74
+ if (clientModule && (serverOnly(normalizedId) || /\.server\.[cm]?[jt]sx?$/.test(id))) {
75
+ throw new Error(`Server-only module reached the client bundle: ${id}`);
76
+ }
77
+ if (serverTransform && normalizedId.startsWith(`${normalizedRoot}/`) && /\.client\.[cm]?[jt]sx?$/.test(id)) {
78
+ throw new Error(`Client-only module reached the server bundle: ${id}`);
79
+ }
80
+ const checkBoundary = async (code) => {
81
+ if (!clientModule)
82
+ return;
83
+ for (const { value } of moduleSpecifiers(code, id)) {
84
+ const dependency = await this.resolve(value, id, { skipSelf: true });
85
+ if (dependency && serverOnly(normalizePath(dependency.id))) {
86
+ throw new Error(`Client module ${id} imports server-only module ${value}`);
87
+ }
88
+ }
89
+ };
90
+ if (!id.endsWith(".meeko")) {
91
+ if (/\.[cm]?[jt]sx?$/.test(id) && clientModule)
92
+ await checkBoundary(source);
93
+ if (/\.[cm]?tsx?$/.test(id) && normalizedId.startsWith(`${normalizedRoot}/`)) {
94
+ const registry = await discoverAutoImports(root);
95
+ const transformed = transformTypeScriptAutoImports(source, id, root, registry, sources.map((entry) => entry.root));
96
+ if (transformed) {
97
+ await checkBoundary(transformed);
98
+ return { code: transformed, map: typeScriptAutoImportMap(source, transformed, id) };
99
+ }
100
+ }
30
101
  return null;
102
+ }
31
103
  const filename = normalizePath(resolve(id));
32
104
  const result = compile(source, filename, { hot: isDev });
33
105
  const styleId = `${stylePrefix}${createHash("sha256").update(filename).update("\0").update(result.css).digest("hex")}.css`;
@@ -35,13 +107,46 @@ export function meeko() {
35
107
  styles.set(styleId, result.css);
36
108
  const cssImport = result.css ? `\nimport ${JSON.stringify(styleId.slice(1))};` : "";
37
109
  const hotCode = isDev ? `\nif (import.meta.hot) {\n __meeko.enableHotModule(__hotId);\n import.meta.hot.accept((next) => { if (next) __meeko.replaceHotModule(__hotId, next); });\n}\n` : "";
38
- return transformWithOxc(`${result.code}${cssImport}${hotCode}`, `${filename}.ts`, { lang: "ts" });
110
+ const registry = await discoverAutoImports(root);
111
+ const code = transformAutoImports(source, filename, result.code, registry, serverTransform ? "server" : "client");
112
+ await checkBoundary(code);
113
+ const shifted = code.length - result.code.length;
114
+ const mappings = result.mappings.map((mapping) => ({
115
+ ...mapping,
116
+ generatedStart: mapping.generatedStart + shifted,
117
+ generatedEnd: mapping.generatedEnd + shifted,
118
+ }));
119
+ const generated = `${code}${cssImport}${hotCode}`;
120
+ return transformWithOxc(generated, `${filename}.ts`, { lang: "ts" }, sourceMapForCompiled(generated, source, filename, mappings));
39
121
  },
40
- handleHotUpdate({ file, server }) {
41
- if (!normalizePath(file).startsWith(runtimeDirectory))
122
+ async handleHotUpdate({ file, server }) {
123
+ const normalized = normalizePath(file);
124
+ const normalizedRoot = normalizePath(root);
125
+ const configFile = normalized.startsWith(`${normalizedRoot}/meeko.config.`);
126
+ let sourceChanged = false;
127
+ if (normalized.startsWith(`${normalizedRoot}/`) && !configFile) {
128
+ const config = await loadMeekoConfig(root);
129
+ const sources = await resolveConfigSources(root, config);
130
+ for (const source of sources) {
131
+ const prefix = `${normalizePath(source.root)}/`;
132
+ if (!normalized.startsWith(prefix))
133
+ continue;
134
+ const path = normalized.slice(prefix.length);
135
+ const registrySource = /^(?:app\/(?:components|composables|utils|stores)|shared\/(?:types|schemas|utils|constants|enums)|server\/utils)\//.test(path) ||
136
+ (config.imports?.serverDirs ?? []).some((directory) => path.startsWith(`${directory.replaceAll("\\", "/").replace(/\/$/, "")}/`));
137
+ const routesSource = /^(?:app\/(?:pages|layouts|middleware)|server\/middleware)\//.test(path);
138
+ if (registrySource || routesSource) {
139
+ sourceChanged = true;
140
+ break;
141
+ }
142
+ }
143
+ }
144
+ if (!normalized.startsWith(runtimeDirectory) && !configFile && !sourceChanged)
42
145
  return;
146
+ server.moduleGraph.invalidateAll();
43
147
  server.ws.send({ type: "full-reload" });
44
148
  return [];
45
149
  },
46
150
  };
47
151
  }
152
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,oBAAo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AAC;wBAAC,MAAM;oBAAC,CAAC;gBACtE,CAAC;YACH,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,aAAa;gBAAE,OAAO;YACtF,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;YACnC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { dirname, isAbsolute, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { normalizePath, transformWithOxc } from \"vite\";\nimport type { Plugin } from \"vite\";\nimport { compile } from \"./compiler.js\";\nimport { moduleSpecifiers } from \"./compiler/import-graph.js\";\nimport { sourceMapForCompiled } from \"./compiler/sourcemap.js\";\nimport { discoverAutoImports, transformAutoImports } from \"./autoimports.js\";\nimport { transformTypeScriptAutoImports, typeScriptAutoImportMap } from \"./autoimports-ts.js\";\nimport { discoverConfiguredRoutes, loadMeekoConfig, resolveConfigSources } from \"./framework/config.js\";\n\nconst stylePrefix = \"\\0virtual:meeko-style:\";\nconst pageModules = new Map<string, \"client\" | \"server\" | \"routes\">([\n [\"virtual:meeko-client-pages\", \"client\"],\n [\"virtual:meeko-server-pages\", \"server\"],\n [\"virtual:meeko-server-routes\", \"routes\"],\n]);\nconst runtimeDirectory = `${normalizePath(dirname(fileURLToPath(import.meta.url)))}/`;\n\n/** Transforma componentes .meeko para Vite, tanto en cliente como en SSR. */\nexport function meeko(): Plugin {\n let isDev = false;\n let ssrBuild = false;\n let root = \"\";\n const styles = new Map<string, string>();\n return {\n name: \"meeko:components\",\n enforce: \"pre\",\n configResolved(config) {\n isDev = config.command === \"serve\";\n ssrBuild = Boolean(config.build.ssr);\n root = config.root;\n },\n resolveId(id) {\n if (id.startsWith(\"virtual:meeko-style:\")) return `\\0${id}`;\n if (pageModules.has(id)) return `\\0${id}`;\n return null;\n },\n async load(id) {\n const kind = pageModules.get(id.slice(1));\n if (kind) {\n const routes = await discoverConfiguredRoutes(root);\n const files = kind === \"routes\"\n ? routes.flatMap((route) => route.sidecar ? [route.sidecar] : [])\n : routes.flatMap((route) => [route.file, ...route.layouts, ...(route.error ? [route.error] : [])]);\n const unique = [...new Set(files)];\n const entries = unique.map((file, index) => {\n const path = relative(root, file).replaceAll(\"\\\\\", \"/\");\n if (path === \"..\" || path.startsWith(\"../\") || isAbsolute(path)) throw new Error(`Page outside Meeko project: ${file}`);\n const specifier = `/${path}`;\n return kind === \"client\"\n ? `${JSON.stringify(specifier)}: () => import(${JSON.stringify(specifier)})`\n : `${JSON.stringify(specifier)}: module${index}`;\n });\n const imports = kind === \"client\" ? \"\" : unique.map((file, index) => {\n const path = relative(root, file).replaceAll(\"\\\\\", \"/\");\n return `import * as module${index} from ${JSON.stringify(`/${path}`)};`;\n }).join(\"\\n\");\n return `${imports}\\nexport const modules = {${entries.join(\",\")}};`;\n }\n if (!id.startsWith(stylePrefix) || !id.endsWith(\".css\")) return null;\n return styles.get(id) ?? null;\n },\n async transform(source, id, options) {\n const serverTransform = Boolean(options?.ssr || ssrBuild);\n const normalizedId = normalizePath(resolve(id));\n const normalizedRoot = normalizePath(root);\n const clientModule = !serverTransform && normalizedId.startsWith(`${normalizedRoot}/`);\n const sources = normalizedId.startsWith(`${normalizedRoot}/`) ? await resolveConfigSources(root) : [];\n const serverDirectories = sources.map((entry) => `${normalizePath(entry.root)}/server/`);\n const serverOnly = (moduleId: string): boolean => serverDirectories.some((directory) => moduleId.startsWith(directory));\n if (clientModule && (serverOnly(normalizedId) || /\\.server\\.[cm]?[jt]sx?$/.test(id))) {\n throw new Error(`Server-only module reached the client bundle: ${id}`);\n }\n if (serverTransform && normalizedId.startsWith(`${normalizedRoot}/`) && /\\.client\\.[cm]?[jt]sx?$/.test(id)) {\n throw new Error(`Client-only module reached the server bundle: ${id}`);\n }\n const checkBoundary = async (code: string): Promise<void> => {\n if (!clientModule) return;\n for (const { value } of moduleSpecifiers(code, id)) {\n const dependency = await this.resolve(value, id, { skipSelf: true });\n if (dependency && serverOnly(normalizePath(dependency.id))) {\n throw new Error(`Client module ${id} imports server-only module ${value}`);\n }\n }\n };\n if (!id.endsWith(\".meeko\")) {\n if (/\\.[cm]?[jt]sx?$/.test(id) && clientModule) await checkBoundary(source);\n if (/\\.[cm]?tsx?$/.test(id) && normalizedId.startsWith(`${normalizedRoot}/`)) {\n const registry = await discoverAutoImports(root);\n const transformed = transformTypeScriptAutoImports(source, id, root, registry, sources.map((entry) => entry.root));\n if (transformed) {\n await checkBoundary(transformed);\n return { code: transformed, map: typeScriptAutoImportMap(source, transformed, id) };\n }\n }\n return null;\n }\n const filename = normalizePath(resolve(id));\n const result = compile(source, filename, { hot: isDev });\n const styleId = `${stylePrefix}${createHash(\"sha256\").update(filename).update(\"\\0\").update(result.css).digest(\"hex\")}.css`;\n if (result.css) styles.set(styleId, result.css);\n const cssImport = result.css ? `\\nimport ${JSON.stringify(styleId.slice(1))};` : \"\";\n const hotCode = isDev ? `\\nif (import.meta.hot) {\\n __meeko.enableHotModule(__hotId);\\n import.meta.hot.accept((next) => { if (next) __meeko.replaceHotModule(__hotId, next); });\\n}\\n` : \"\";\n const registry = await discoverAutoImports(root);\n const code = transformAutoImports(source, filename, result.code, registry, serverTransform ? \"server\" : \"client\");\n await checkBoundary(code);\n const shifted = code.length - result.code.length;\n const mappings = result.mappings.map((mapping) => ({\n ...mapping,\n generatedStart: mapping.generatedStart + shifted,\n generatedEnd: mapping.generatedEnd + shifted,\n }));\n const generated = `${code}${cssImport}${hotCode}`;\n return transformWithOxc(generated, `${filename}.ts`, { lang: \"ts\" }, sourceMapForCompiled(generated, source, filename, mappings));\n },\n async handleHotUpdate({ file, server }) {\n const normalized = normalizePath(file);\n const normalizedRoot = normalizePath(root);\n const configFile = normalized.startsWith(`${normalizedRoot}/meeko.config.`);\n let sourceChanged = false;\n if (normalized.startsWith(`${normalizedRoot}/`) && !configFile) {\n const config = await loadMeekoConfig(root);\n const sources = await resolveConfigSources(root, config);\n for (const source of sources) {\n const prefix = `${normalizePath(source.root)}/`;\n if (!normalized.startsWith(prefix)) continue;\n const path = normalized.slice(prefix.length);\n const registrySource = /^(?:app\\/(?:components|composables|utils|stores)|shared\\/(?:types|schemas|utils|constants|enums)|server\\/utils)\\//.test(path) ||\n (config.imports?.serverDirs ?? []).some((directory) => path.startsWith(`${directory.replaceAll(\"\\\\\", \"/\").replace(/\\/$/, \"\")}/`));\n const routesSource = /^(?:app\\/(?:pages|layouts|middleware)|server\\/middleware)\\//.test(path);\n if (registrySource || routesSource) { sourceChanged = true; break; }\n }\n }\n if (!normalized.startsWith(runtimeDirectory) && !configFile && !sourceChanged) return;\n server.moduleGraph.invalidateAll();\n server.ws.send({ type: \"full-reload\" });\n return [];\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meekojs/meeko",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "packageManager": "pnpm@12.14.0",
5
5
  "description": "Typed .meeko component engine with SSR, hydration, signals, Vite, and DevTools.",
6
6
  "license": "MIT",
@@ -21,6 +21,14 @@
21
21
  "types": "./dist/vite.d.ts",
22
22
  "default": "./dist/vite.js"
23
23
  },
24
+ "./framework": {
25
+ "types": "./dist/framework.d.ts",
26
+ "default": "./dist/framework.js"
27
+ },
28
+ "./server": {
29
+ "types": "./dist/node.d.ts",
30
+ "default": "./dist/node.js"
31
+ },
24
32
  "./internal": {
25
33
  "types": "./dist/internal.d.ts",
26
34
  "default": "./dist/internal.js"
@@ -37,7 +45,7 @@
37
45
  "prepack": "tsc -p tsconfig.build.json",
38
46
  "build": "tsc -p tsconfig.build.json",
39
47
  "check": "tsc -p tsconfig.json --noEmit",
40
- "test": "pnpm run build && pnpm run example:compile && tsx --test tests/*.test.ts",
48
+ "test": "pnpm run build && pnpm run example:compile && tsx --test --test-concurrency=1 tests/*.test.ts",
41
49
  "example:compile": "node dist/cli.js compile examples/counter/Counter.meeko examples/counter/Counter.generated.ts && node dist/cli.js compile examples/attributes/Attributes.meeko examples/attributes/Attributes.generated.ts && node dist/cli.js compile examples/regions/Regions.meeko examples/regions/Regions.generated.ts && node dist/cli.js compile examples/primitives/Primitives.meeko examples/primitives/Primitives.generated.ts",
42
50
  "example:bundle": "pnpm run build && pnpm run example:compile && esbuild examples/counter/client.ts --bundle --format=esm --platform=browser --target=es2022 --outfile=examples/counter/client.bundle.js",
43
51
  "example:check": "tsc -p examples/counter/tsconfig.json --noEmit",
@@ -49,7 +57,7 @@
49
57
  "pilot:check": "pnpm run build && node dist/cli.js check examples/pilot/App.meeko && node dist/cli.js types examples/pilot/App.meeko && tsc -p examples/pilot/tsconfig.json --noEmit",
50
58
  "pilot:build": "tsx examples/pilot/build.ts",
51
59
  "pilot:serve": "node examples/pilot/.output/server/http.js",
52
- "pilot:e2e": "tsx --test tests/pilot.e2e.ts",
60
+ "pilot:e2e": "node --import tsx --test --test-force-exit tests/pilot.e2e.ts",
53
61
  "e2e": "pnpm run example:bundle && pnpm run vite:build && tsx --test tests/browser.e2e.ts",
54
62
  "benchmark:check": "pnpm run example:compile && node dist/cli.js compile benchmarks/cases/TreeLeaf.meeko benchmarks/cases/TreeLeaf.generated.ts && node dist/cli.js compile benchmarks/cases/TreeBranch.meeko benchmarks/cases/TreeBranch.generated.ts && node dist/cli.js compile benchmarks/cases/Tree.meeko benchmarks/cases/Tree.generated.ts && node dist/cli.js compile benchmarks/cases/List.meeko benchmarks/cases/List.generated.ts && node dist/cli.js compile benchmarks/cases/Navigation.meeko benchmarks/cases/Navigation.generated.ts && tsc -p tsconfig.benchmark.json --noEmit",
55
63
  "benchmark": "pnpm run build && pnpm run benchmark:check && node --expose-gc --import tsx benchmarks/run.ts",
@@ -63,7 +71,8 @@
63
71
  "parse5": "^8.0.0",
64
72
  "postcss": "^8.5.31",
65
73
  "postcss-selector-parser": "^7.1.7",
66
- "typescript": "7.0.2"
74
+ "typescript": "7.0.2",
75
+ "ws": "8.22.0"
67
76
  },
68
77
  "peerDependencies": {
69
78
  "vite": "^8.3.5"
@@ -73,9 +82,11 @@
73
82
  },
74
83
  "devDependencies": {
75
84
  "@types/node": "^24.0.0",
85
+ "@types/ws": "8.18.2",
76
86
  "esbuild": "0.28.2",
77
87
  "happy-dom": "^20.0.0",
78
88
  "playwright-core": "1.64.1",
89
+ "redis": "6.3.0",
79
90
  "tsx": "^4.20.0",
80
91
  "vite": "8.3.5",
81
92
  "vue": "3.5.44"