@fluixi/compiler 1.0.0-alpha.94 → 1.0.0-alpha.96

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 (60) hide show
  1. package/LICENSE +1 -1
  2. package/dist/analyze/static-graph.cjs +1 -1
  3. package/dist/analyze/static-graph.mjs +1 -1
  4. package/dist/{babel-RJFQVFJW.mjs → babel-YG5PQAMX.mjs} +4 -4
  5. package/dist/{chunk-ZR2QHTEX.mjs → chunk-JHBI26FW.mjs} +6 -4
  6. package/dist/{chunk-DP2QDWWH.mjs → chunk-JJ4ZAZKY.mjs} +1 -1
  7. package/dist/{chunk-HCCBEJEZ.mjs → chunk-L6WBOEIO.mjs} +1 -1
  8. package/dist/{chunk-HIZU7WI2.mjs → chunk-UVH2BMMY.mjs} +1 -1
  9. package/dist/chunk-VX2OBUMB.mjs +92 -0
  10. package/dist/{chunk-E2RWTIYE.mjs → chunk-X735CULF.mjs} +4 -89
  11. package/dist/chunk-ZPEHDBCH.mjs +584 -0
  12. package/dist/codegen/backends/imperative.cjs +4 -2
  13. package/dist/codegen/backends/imperative.d.ts.map +1 -1
  14. package/dist/codegen/backends/imperative.js +9 -2
  15. package/dist/codegen/backends/imperative.mjs +4 -2
  16. package/dist/frontend/babel/build-ir-lit.cjs +4 -2
  17. package/dist/frontend/babel/build-ir-lit.mjs +4 -2
  18. package/dist/frontend/babel/build-ir.cjs +4 -2
  19. package/dist/frontend/babel/build-ir.mjs +4 -2
  20. package/dist/frontend/babel/index.cjs +5 -3
  21. package/dist/frontend/babel/index.mjs +5 -3
  22. package/dist/frontend/babel/lower-template.cjs +4 -2
  23. package/dist/frontend/babel/lower-template.mjs +4 -2
  24. package/dist/frontend/babel/plugin.cjs +4 -2
  25. package/dist/frontend/babel/plugin.mjs +4 -2
  26. package/dist/index.cjs +5 -3
  27. package/dist/index.mjs +5 -3
  28. package/dist/integrations.cjs +3330 -3269
  29. package/dist/integrations.d.ts.map +1 -1
  30. package/dist/integrations.js +19 -8
  31. package/dist/integrations.mjs +85 -40
  32. package/dist/lower/compile-template.cjs +5 -3
  33. package/dist/lower/compile-template.mjs +5 -3
  34. package/dist/lower/jsx.cjs +4 -2
  35. package/dist/lower/jsx.mjs +4 -2
  36. package/dist/lower/template.cjs +4 -2
  37. package/dist/lower/template.mjs +4 -2
  38. package/dist/resolve/builtins.cjs +1 -1
  39. package/dist/resolve/builtins.mjs +1 -1
  40. package/dist/{server-fns-JLSTKWPS.mjs → server-fns-PZEOON2D.mjs} +5 -4
  41. package/dist/{server-functions-BGY3RD4R.mjs → server-functions-JNSQMA63.mjs} +3 -3
  42. package/dist/transform/index.cjs +35 -16
  43. package/dist/transform/index.mjs +35 -16
  44. package/dist/transform/styles.cjs +31 -13
  45. package/dist/transform/styles.d.cts +27 -1
  46. package/dist/transform/styles.d.ts +27 -1
  47. package/dist/transform/styles.d.ts.map +1 -1
  48. package/dist/transform/styles.js +45 -16
  49. package/dist/transform/styles.mjs +31 -13
  50. package/dist/transform/templates.cjs +34 -15
  51. package/dist/transform/templates.mjs +34 -15
  52. package/dist/{transform-GBP6Y4UI.mjs → transform-UODP37VJ.mjs} +12 -563
  53. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  54. package/dist/vite-styles.cjs +66 -23
  55. package/dist/vite-styles.d.cts +16 -7
  56. package/dist/vite-styles.d.ts +16 -7
  57. package/dist/vite-styles.d.ts.map +1 -1
  58. package/dist/vite-styles.js +68 -25
  59. package/dist/vite-styles.mjs +78 -23
  60. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;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AAG,CAAC,CAqCvF;;;;;;;;;AAED,wBAOE"}
@@ -133,13 +133,16 @@ export function createVitePlugin(options = {}) {
133
133
  return {
134
134
  name: 'vite-fluixi-jsx',
135
135
  enforce: 'pre',
136
- config() {
137
- return {
138
- esbuild: {
139
- jsx: 'automatic',
140
- jsxImportSource: options.importSource || '@fluixi/jsx',
141
- },
142
- };
136
+ // JSX the compiler leaves alone goes to Vite's own transform: Oxc in Vite 8 (Rolldown),
137
+ // esbuild before, which Vite 8 warns about.
138
+ // In dev, CSS maps are on unless the app says otherwise, so devtools show the line a
139
+ // component's rule was written on. Vite leaves them off by default; a build never has them.
140
+ config(user) {
141
+ const importSource = options.importSource || '@fluixi/jsx';
142
+ const jsx = this && this.meta?.rolldownVersion
143
+ ? { oxc: { jsx: { runtime: 'automatic', importSource } } }
144
+ : { esbuild: { jsx: 'automatic', jsxImportSource: importSource } };
145
+ return user?.css?.devSourcemap === undefined ? { ...jsx, css: { devSourcemap: true } } : jsx;
143
146
  },
144
147
  // Written once per build, and on dev-server start, rather than per transform: the
145
148
  // set of resolvable names comes from config, so nothing a file does can change it.
@@ -162,6 +165,14 @@ export function createVitePlugin(options = {}) {
162
165
  for (const [fileName, source] of componentStyles.libraryFiles())
163
166
  this.emitFile({ type: 'asset', fileName, source });
164
167
  },
168
+ // An edited component's style modules go out with its update: their ids end in `.css`, so
169
+ // Vite does not connect them to the file.
170
+ handleHotUpdate(ctx) {
171
+ if (!componentStyles.active)
172
+ return undefined;
173
+ const styles = componentStyles.hotModules(ctx.file, ctx.server.moduleGraph);
174
+ return styles.length ? [...ctx.modules, ...styles] : undefined;
175
+ },
165
176
  configureServer(server) {
166
177
  componentStyles.setServer(server);
167
178
  },
@@ -173,7 +184,7 @@ export function createVitePlugin(options = {}) {
173
184
  // that asked. Answer it here, where the rename is known.
174
185
  resolveId(id, importer) {
175
186
  if (componentStyles.isStyle(id))
176
- return componentStyles.resolveId(id);
187
+ return componentStyles.resolveId(id, importer, this);
177
188
  if (componentStyles.isLibraryImport(id, importer))
178
189
  return { id, external: true };
179
190
  const moved = RETIRED_SUBPATHS[id];
@@ -1,13 +1,17 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ import {
3
+ styleIds
4
+ } from "./chunk-ZPEHDBCH.mjs";
2
5
  import {
3
6
  INTRINSICS,
4
7
  TAG_INTRINSICS,
5
8
  builtinComponentMap,
6
9
  createComponentResolver
7
- } from "./chunk-HCCBEJEZ.mjs";
10
+ } from "./chunk-L6WBOEIO.mjs";
11
+ import "./chunk-VX2OBUMB.mjs";
8
12
  import {
9
13
  __require
10
- } from "./chunk-HIZU7WI2.mjs";
14
+ } from "./chunk-UVH2BMMY.mjs";
11
15
 
12
16
  // src/resolve/write-globals.ts
13
17
  import { mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -236,9 +240,21 @@ function warnIfUnreachable(root, target) {
236
240
  // src/vite-styles.ts
237
241
  import { existsSync, readFileSync as readFileSync2 } from "node:fs";
238
242
  import { basename as basename2, dirname as dirname2, extname, join, relative as relative2 } from "node:path";
239
- var STYLE_ID = /\?fx-style&index=(\d+)(?:&inline)?&lang\.css$/;
240
- var LITERAL_ID = /\?fx-literal=([\w$]+)&inline&lang\.css$/;
241
- var styleId = (file, index) => `${file}?fx-style&index=${index}&lang.css`;
243
+ var STYLE_ID = /\.fx-(\d+)\.css(?:\?inline)?$/;
244
+ var LITERAL_ID = /\.fx-literal-([\w$]+)\.css\?inline$/;
245
+ var SUFFIX = /\.fx-(?:\d+|literal-[\w$]+)\.css(?:\?inline)?$/;
246
+ var styleId = styleIds.block;
247
+ function firstLoc(nodes) {
248
+ for (const node of nodes) {
249
+ if (node.loc) return node.loc.source;
250
+ if ((node.kind === "rule" || node.kind === "at-rule") && node.nodes.length) {
251
+ const inner = firstLoc(node.nodes);
252
+ if (inner) return inner;
253
+ }
254
+ }
255
+ return void 0;
256
+ }
257
+ var ownerOf = (id) => id.slice(0, id.search(SUFFIX));
242
258
  var loader = (name) => `const href = new URL(${JSON.stringify(`./${name}`)}, import.meta.url).href;
243
259
  if (typeof document !== 'undefined' && !document.querySelector(\`link[data-fx-css="\${href}"]\`)) {
244
260
  const link = document.createElement('link');
@@ -256,7 +272,7 @@ function createComponentStyles(compile) {
256
272
  const emitted = /* @__PURE__ */ new Map();
257
273
  const fileOf = (id) => existsSync(id) ? id : join(root, id);
258
274
  const cache = /* @__PURE__ */ new Map();
259
- const resolveReference = async (ref, importer, ctx, seen) => {
275
+ const resolveReference = async (ref, importer, ctx, seen, modules) => {
260
276
  const resolved = await ctx.resolve?.(ref.source, importer);
261
277
  if (!resolved) return null;
262
278
  const file = resolved.id.split("?")[0];
@@ -270,16 +286,20 @@ function createComponentStyles(compile) {
270
286
  const styles = api.styles(file);
271
287
  let result = compile(code, file, styles);
272
288
  if (result?.styleReferences?.length) {
273
- const imported = await resolveAll(result.styleReferences, file, ctx, /* @__PURE__ */ new Set([...seen, file]));
274
- result = compile(code, file, { ...styles, imported });
289
+ const imported = await resolveAll(result.styleReferences, file, ctx, /* @__PURE__ */ new Set([...seen, file]), modules);
290
+ result = compile(code, file, { ...styles, imported, importedModules: modules });
275
291
  }
276
292
  const literal = result?.styleLiterals?.find((l) => l.name === ref.name);
277
- return literal ? styles.process(literal.css, file) : null;
293
+ if (!literal) return null;
294
+ const nodes = literal.nodes ?? styles.process(literal.css, file);
295
+ const named = firstLoc(nodes);
296
+ if (named) modules.set(named, { id: file, code });
297
+ return nodes;
278
298
  };
279
- const resolveAll = async (refs, importer, ctx, seen) => {
299
+ const resolveAll = async (refs, importer, ctx, seen, modules) => {
280
300
  const imported = /* @__PURE__ */ new Map();
281
301
  for (const ref of refs) {
282
- const nodes = await resolveReference(ref, importer, ctx, seen);
302
+ const nodes = await resolveReference(ref, importer, ctx, seen, modules);
283
303
  if (nodes) imported.set(`${ref.source}#${ref.name}`, nodes);
284
304
  }
285
305
  return imported;
@@ -289,8 +309,9 @@ function createComponentStyles(compile) {
289
309
  const styles = api.styles(file);
290
310
  let result = compile(code, file, styles);
291
311
  if (result?.styleReferences?.length) {
292
- const imported = await resolveAll(result.styleReferences, id, ctx, /* @__PURE__ */ new Set([file]));
293
- result = compile(code, file, { ...styles, imported });
312
+ const modules = /* @__PURE__ */ new Map();
313
+ const imported = await resolveAll(result.styleReferences, id, ctx, /* @__PURE__ */ new Set([file]), modules);
314
+ result = compile(code, file, { ...styles, imported, importedModules: modules });
294
315
  }
295
316
  const css = (result?.styles ?? []).map((s) => s.css);
296
317
  const maps = (result?.styles ?? []).map((s) => s.map ?? null);
@@ -300,7 +321,7 @@ function createComponentStyles(compile) {
300
321
  if (server && before) {
301
322
  for (let i = 0; i < css.length; i++) {
302
323
  if (before.css[i] === css[i]) continue;
303
- const mod = server.moduleGraph.getModuleById(styleId(id, i));
324
+ const mod = server.moduleGraph.getModuleById(styleId(file, i));
304
325
  if (mod) void server.reloadModule(mod);
305
326
  }
306
327
  }
@@ -318,7 +339,7 @@ function createComponentStyles(compile) {
318
339
  import ${JSON.stringify(`./${name}`)};` };
319
340
  }
320
341
  const imports = page.map((i) => `
321
- import ${JSON.stringify(styleId(id, i))};`).join("");
342
+ import ${JSON.stringify(styleId(file, i))};`).join("");
322
343
  return { ...result, code: result.code + imports };
323
344
  };
324
345
  return {
@@ -351,14 +372,30 @@ import ${JSON.stringify(styleId(id, i))};`).join("");
351
372
  return STYLE_ID.test(id) || LITERAL_ID.test(id);
352
373
  },
353
374
  /**
354
- * A style request as the module id Vite should keep: the file's absolute path and the
355
- * query. Vite invalidates a module when the file its id names changes, so a root-relative id
356
- * (`/src/card.tsx?fx-style…`, which is how a request arrives before the component's imports
357
- * were analysed) was never invalidated, and an edited block kept its old CSS until restart.
375
+ * A style request as the module id Vite keeps: its owner's absolute path, then the suffix.
376
+ * One id per block however it was asked for (`/src/card.tsx.fx-0.css` from a page, the
377
+ * absolute path from the component), or the reload after an edit misses the copy in use.
378
+ * A css`` value imported from another module names that module relatively, as written.
358
379
  */
359
- resolveId(id) {
360
- const at = id.indexOf("?");
361
- return fileOf(id.slice(0, at)) + id.slice(at);
380
+ async resolveId(id, importer, ctx) {
381
+ const at = id.search(SUFFIX);
382
+ const owner = id.slice(0, at);
383
+ if (!owner.startsWith(".")) return fileOf(owner) + id.slice(at);
384
+ const resolved = importer ? await ctx.resolve?.(owner, importer) : null;
385
+ return resolved ? resolved.id.split("?")[0] + id.slice(at) : null;
386
+ },
387
+ /**
388
+ * The style modules of a changed file, for the update Vite sends. Their ids do not name the
389
+ * file (they end in `.css`), so Vite would not find them itself.
390
+ */
391
+ hotModules(file, graph) {
392
+ const entry = cache.get(file);
393
+ if (!entry) return [];
394
+ const paths = [
395
+ ...entry.css.map((_, i) => styleId(file, i)),
396
+ ...[...entry.literals.keys()].map((name) => styleIds.literal(file, name).replace(/\?inline$/, ""))
397
+ ];
398
+ return paths.flatMap((path) => [...graph.getModulesByFile(path) ?? []]);
362
399
  },
363
400
  compile: run,
364
401
  /**
@@ -369,7 +406,7 @@ import ${JSON.stringify(styleId(id, i))};`).join("");
369
406
  const match = STYLE_ID.exec(id);
370
407
  const literal = LITERAL_ID.exec(id);
371
408
  if (!match && !literal || !api) return null;
372
- const file = id.slice(0, id.indexOf("?"));
409
+ const file = ownerOf(id);
373
410
  let source;
374
411
  try {
375
412
  source = readFileSync2(fileOf(file), "utf8");
@@ -381,10 +418,10 @@ import ${JSON.stringify(styleId(id, i))};`).join("");
381
418
  if (literal) {
382
419
  const css = entry?.literals.get(literal[1]);
383
420
  if (css === void 0) throw new Error(`[fluixi] ${literal[1]} in ${file} is not a css\`\` value, so it cannot be a shadow root's styles.`);
384
- return { code: css, map: null };
421
+ return { code: css, map: null, moduleType: "css" };
385
422
  }
386
423
  const index = Number(match[1]);
387
- return { code: entry?.css[index] ?? "", map: entry?.maps[index] ?? null };
424
+ return { code: entry?.css[index] ?? "", map: entry?.maps[index] ?? null, moduleType: "css" };
388
425
  }
389
426
  };
390
427
  }
@@ -395,7 +432,7 @@ import { dirname as dirname3, join as _join, resolve as resolvePath2 } from "nod
395
432
  async function createBabelPlugin(options = {}) {
396
433
  let pluginModule = null;
397
434
  try {
398
- pluginModule = await import("./babel-RJFQVFJW.mjs");
435
+ pluginModule = await import("./babel-YG5PQAMX.mjs");
399
436
  } catch (e) {
400
437
  console.warn("Could not load the babel front-end:", e);
401
438
  }
@@ -464,13 +501,14 @@ function createVitePlugin(options = {}) {
464
501
  return {
465
502
  name: "vite-fluixi-jsx",
466
503
  enforce: "pre",
467
- config() {
468
- return {
469
- esbuild: {
470
- jsx: "automatic",
471
- jsxImportSource: options.importSource || "@fluixi/jsx"
472
- }
473
- };
504
+ // JSX the compiler leaves alone goes to Vite's own transform: Oxc in Vite 8 (Rolldown),
505
+ // esbuild before, which Vite 8 warns about.
506
+ // In dev, CSS maps are on unless the app says otherwise, so devtools show the line a
507
+ // component's rule was written on. Vite leaves them off by default; a build never has them.
508
+ config(user) {
509
+ const importSource = options.importSource || "@fluixi/jsx";
510
+ const jsx = this && this.meta?.rolldownVersion ? { oxc: { jsx: { runtime: "automatic", importSource } } } : { esbuild: { jsx: "automatic", jsxImportSource: importSource } };
511
+ return user?.css?.devSourcemap === void 0 ? { ...jsx, css: { devSourcemap: true } } : jsx;
474
512
  },
475
513
  // Written once per build, and on dev-server start, rather than per transform: the
476
514
  // set of resolvable names comes from config, so nothing a file does can change it.
@@ -483,11 +521,18 @@ function createVitePlugin(options = {}) {
483
521
  const entry = config?.command === "build" && config.build?.lib ? config.build.lib.entry : void 0;
484
522
  const first = typeof entry === "string" ? entry : Array.isArray(entry) ? entry[0] : entry && typeof entry === "object" ? Object.values(entry)[0] : void 0;
485
523
  if (typeof first === "string") componentStyles.setLibrary(dirname3(resolvePath2(config.root ?? process.cwd(), first)));
486
- if (componentStyles.active) ({ transformTemplates } = await import("./transform-GBP6Y4UI.mjs"));
524
+ if (componentStyles.active) ({ transformTemplates } = await import("./transform-UODP37VJ.mjs"));
487
525
  },
488
526
  generateBundle() {
489
527
  for (const [fileName, source] of componentStyles.libraryFiles()) this.emitFile({ type: "asset", fileName, source });
490
528
  },
529
+ // An edited component's style modules go out with its update: their ids end in `.css`, so
530
+ // Vite does not connect them to the file.
531
+ handleHotUpdate(ctx) {
532
+ if (!componentStyles.active) return void 0;
533
+ const styles = componentStyles.hotModules(ctx.file, ctx.server.moduleGraph);
534
+ return styles.length ? [...ctx.modules, ...styles] : void 0;
535
+ },
491
536
  configureServer(server) {
492
537
  componentStyles.setServer(server);
493
538
  },
@@ -498,7 +543,7 @@ function createVitePlugin(options = {}) {
498
543
  // `Missing "./x" specifier`, which names neither the replacement nor the file
499
544
  // that asked. Answer it here, where the rename is known.
500
545
  resolveId(id, importer) {
501
- if (componentStyles.isStyle(id)) return componentStyles.resolveId(id);
546
+ if (componentStyles.isStyle(id)) return componentStyles.resolveId(id, importer, this);
502
547
  if (componentStyles.isLibraryImport(id, importer)) return { id, external: true };
503
548
  const moved = RETIRED_SUBPATHS[id];
504
549
  if (!moved) return null;
@@ -594,7 +639,7 @@ function transformOptions(options, id) {
594
639
  }
595
640
  async function rewriteProps(code, id, options) {
596
641
  if (options.propsDestructure === false) return code;
597
- const { transformProps } = await import("./transform-GBP6Y4UI.mjs");
642
+ const { transformProps } = await import("./transform-UODP37VJ.mjs");
598
643
  const result = transformProps(code, id);
599
644
  reportDiagnostics({ propsDiagnostics: result.diagnostics }, id);
600
645
  return result.rewritten > 0 ? result.code : code;
@@ -618,7 +663,7 @@ function reportDiagnostics(result, id) {
618
663
  }
619
664
  async function compileModule(code, id, options) {
620
665
  if (!options.babel) {
621
- const { transformTemplates } = await import("./transform-GBP6Y4UI.mjs");
666
+ const { transformTemplates } = await import("./transform-UODP37VJ.mjs");
622
667
  const result2 = transformTemplates(code, id, transformOptions(options, id));
623
668
  reportDiagnostics(result2, id);
624
669
  return result2;
@@ -737,10 +782,10 @@ export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
737
782
  if (!code.includes("use server")) return null;
738
783
  const args = { ssr: !!opts?.ssr, filename: id, root };
739
784
  if (options.babel) {
740
- const { transformServerFunctions } = await import("./server-functions-BGY3RD4R.mjs");
785
+ const { transformServerFunctions } = await import("./server-functions-JNSQMA63.mjs");
741
786
  return transformServerFunctions(code, args);
742
787
  }
743
- const { transformServerFns } = await import("./server-fns-JLSTKWPS.mjs");
788
+ const { transformServerFns } = await import("./server-fns-PZEOON2D.mjs");
744
789
  return transformServerFns(code, args);
745
790
  }
746
791
  };
@@ -1,4 +1,4 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -790,14 +790,16 @@ function emitNode(node, used, templates) {
790
790
  for (const child of node.children) {
791
791
  used.add("insert");
792
792
  const childCode = emitNode(child, used, templates);
793
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
794
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
793
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
794
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
795
795
  }
796
796
  parts.push(`return ${el};`);
797
797
  return `(() => { ${parts.join(" ")} })()`;
798
798
  }
799
799
  }
800
800
  }
801
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
802
+ var isLiteralCode = (code) => LITERAL.test(code);
801
803
  function inlineTemplates(code, templates) {
802
804
  if (!templates || templates.length === 0) return code;
803
805
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));
@@ -1,4 +1,4 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
 
3
3
  // ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
4
4
  var comma = ",".charCodeAt(0);
@@ -776,14 +776,16 @@ function emitNode(node, used, templates) {
776
776
  for (const child of node.children) {
777
777
  used.add("insert");
778
778
  const childCode = emitNode(child, used, templates);
779
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
780
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
779
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
780
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
781
781
  }
782
782
  parts.push(`return ${el};`);
783
783
  return `(() => { ${parts.join(" ")} })()`;
784
784
  }
785
785
  }
786
786
  }
787
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
788
+ var isLiteralCode = (code) => LITERAL.test(code);
787
789
  function inlineTemplates(code, templates) {
788
790
  if (!templates || templates.length === 0) return code;
789
791
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));
@@ -736,14 +736,16 @@ function emitNode(node, used, templates) {
736
736
  for (const child of node.children) {
737
737
  used.add("insert");
738
738
  const childCode = emitNode(child, used, templates);
739
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
740
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
739
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
740
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
741
741
  }
742
742
  parts.push(`return ${el};`);
743
743
  return `(() => { ${parts.join(" ")} })()`;
744
744
  }
745
745
  }
746
746
  }
747
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
748
+ var isLiteralCode = (code) => LITERAL.test(code);
747
749
  function inlineTemplates(code, templates) {
748
750
  if (!templates || templates.length === 0) return code;
749
751
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));
@@ -709,14 +709,16 @@ function emitNode(node, used, templates) {
709
709
  for (const child of node.children) {
710
710
  used.add("insert");
711
711
  const childCode = emitNode(child, used, templates);
712
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
713
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
712
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
713
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
714
714
  }
715
715
  parts.push(`return ${el};`);
716
716
  return `(() => { ${parts.join(" ")} })()`;
717
717
  }
718
718
  }
719
719
  }
720
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
721
+ var isLiteralCode = (code) => LITERAL.test(code);
720
722
  function inlineTemplates(code, templates) {
721
723
  if (!templates || templates.length === 0) return code;
722
724
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));
@@ -585,14 +585,16 @@ function emitNode(node, used, templates) {
585
585
  for (const child of node.children) {
586
586
  used.add("insert");
587
587
  const childCode = emitNode(child, used, templates);
588
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
589
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
588
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
589
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
590
590
  }
591
591
  parts.push(`return ${el};`);
592
592
  return `(() => { ${parts.join(" ")} })()`;
593
593
  }
594
594
  }
595
595
  }
596
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
597
+ var isLiteralCode = (code) => LITERAL.test(code);
596
598
  function inlineTemplates(code, templates) {
597
599
  if (!templates || templates.length === 0) return code;
598
600
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));
@@ -563,14 +563,16 @@ function emitNode(node, used, templates) {
563
563
  for (const child of node.children) {
564
564
  used.add("insert");
565
565
  const childCode = emitNode(child, used, templates);
566
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
567
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
566
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
567
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
568
568
  }
569
569
  parts.push(`return ${el};`);
570
570
  return `(() => { ${parts.join(" ")} })()`;
571
571
  }
572
572
  }
573
573
  }
574
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
575
+ var isLiteralCode = (code) => LITERAL.test(code);
574
576
  function inlineTemplates(code, templates) {
575
577
  if (!templates || templates.length === 0) return code;
576
578
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));
@@ -1,4 +1,4 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,4 +1,4 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
 
3
3
  // src/resolve/builtins.ts
4
4
  var DOM_CONTROL_FLOW = [
@@ -1,11 +1,12 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  import {
3
3
  MagicString
4
- } from "./chunk-E2RWTIYE.mjs";
4
+ } from "./chunk-X735CULF.mjs";
5
+ import "./chunk-VX2OBUMB.mjs";
5
6
  import {
6
7
  serverFnId
7
- } from "./chunk-DP2QDWWH.mjs";
8
- import "./chunk-HIZU7WI2.mjs";
8
+ } from "./chunk-JJ4ZAZKY.mjs";
9
+ import "./chunk-UVH2BMMY.mjs";
9
10
 
10
11
  // src/transform/server-fns.ts
11
12
  import { parse } from "@babel/parser";
@@ -1,8 +1,8 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  import {
3
3
  serverFnId
4
- } from "./chunk-DP2QDWWH.mjs";
5
- import "./chunk-HIZU7WI2.mjs";
4
+ } from "./chunk-JJ4ZAZKY.mjs";
5
+ import "./chunk-UVH2BMMY.mjs";
6
6
 
7
7
  // src/frontend/babel/server-functions.ts
8
8
  import { transformSync } from "@babel/core";
@@ -1,4 +1,4 @@
1
- /*! @fluixi/compiler v1.0.0-alpha.94 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
1
+ /*! @fluixi/compiler v1.0.0-alpha.96 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -101,7 +101,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
101
101
  const imported = literalsOf.imports.get(name);
102
102
  if (imported) {
103
103
  const nodes = options?.imported?.get(`${imported.source}#${imported.name}`);
104
- if (nodes) return nodes.map(dropLoc);
104
+ if (nodes) return nodes.map((n) => keepLocIn(n, options?.importedModules));
105
105
  plan.references.push({ name: imported.name, source: imported.source, ...at });
106
106
  plan.diagnostics.push({
107
107
  ...at,
@@ -125,7 +125,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
125
125
  const nodes = resolveLiteral(name, at, []);
126
126
  const id = hash(`${sourceName}:css:${name}`);
127
127
  plan.edits.push({ start: literal.start, end: literal.end, code: `({ $fxStyle: ${JSON.stringify(id)} })` });
128
- if (nodes) plan.literals.push({ id, name, css: printStyle(nodes, options.minify) });
128
+ if (nodes) plan.literals.push({ id, name, css: printStyle(nodes, options.minify), nodes });
129
129
  }
130
130
  const scopeOf = /* @__PURE__ */ new Map();
131
131
  const names = /* @__PURE__ */ new Map();
@@ -200,7 +200,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
200
200
  if (!plan.scopes.some((s) => s.value === id)) plan.scopes.push({ start: owner.start, end: owner.end, value: id });
201
201
  nodes = scopeNodes(nodes, id, (message) => plan.diagnostics.push({ ...at, message }));
202
202
  }
203
- const printed = module2 ? printStyleWithMap(nodes, options.minify, sourceName, module2) : { css: printStyle(nodes, options.minify) };
203
+ const printed = module2 ? printStyleWithMap(nodes, options.minify, sourceName, module2, options.importedModules) : { css: printStyle(nodes, options.minify) };
204
204
  plan.styles.push({ id, scoped: scoped && !shadow, component, ...printed, ...shadow ? { shadow: true } : {}, ...at });
205
205
  if (shadow) shadow.indexes.push(plan.styles.length - 1);
206
206
  };
@@ -239,6 +239,11 @@ function staticMember(cls, name) {
239
239
  (m) => m.type === "ClassProperty" && m.static && (m.key.type === "Identifier" && m.key.name === name || m.key.type === "StringLiteral" && m.key.value === name)
240
240
  );
241
241
  }
242
+ var styleIds = {
243
+ block: (owner, index) => `${owner}.fx-${index}.css`,
244
+ inline: (owner, index) => `${owner}.fx-${index}.css?inline`,
245
+ literal: (owner, name) => `${owner}.fx-literal-${name}.css?inline`
246
+ };
242
247
  function finishShadowStyles(plan, code, moduleId) {
243
248
  const edits = [];
244
249
  const imports = [];
@@ -250,7 +255,7 @@ function finishShadowStyles(plan, code, moduleId) {
250
255
  return local;
251
256
  };
252
257
  for (const shadow of plan.shadowClasses.values()) {
253
- const blocks = shadow.indexes.map((i) => importOf(`${moduleId}?fx-style&index=${i}&inline&lang.css`));
258
+ const blocks = shadow.indexes.map((i) => importOf(styleIds.inline(moduleId, i)));
254
259
  let value;
255
260
  const prop = shadow.styles;
256
261
  if (prop?.value) {
@@ -258,7 +263,7 @@ function finishShadowStyles(plan, code, moduleId) {
258
263
  let text = code.slice(start, prop.value.end);
259
264
  const replacements = [];
260
265
  walkIdentifiers(prop.value, (id) => {
261
- const local = plan.names?.literals.has(id.name) ? importOf(`${moduleId}?fx-literal=${id.name}&inline&lang.css`) : plan.names?.imports.has(id.name) && !/\.css(\?|$)/.test(plan.names.imports.get(id.name).source) ? importOf(`${plan.names.imports.get(id.name).source}?fx-literal=${plan.names.imports.get(id.name).name}&inline&lang.css`) : void 0;
266
+ const local = plan.names?.literals.has(id.name) ? importOf(styleIds.literal(moduleId, id.name)) : plan.names?.imports.has(id.name) && !/\.css(\?|$)/.test(plan.names.imports.get(id.name).source) ? importOf(styleIds.literal(plan.names.imports.get(id.name).source, plan.names.imports.get(id.name).name)) : void 0;
262
267
  if (local) replacements.push({ at: id.start - start, length: id.name.length, with: local });
263
268
  });
264
269
  for (const r of replacements.sort((a, b) => b.at - a.at)) text = text.slice(0, r.at) + r.with + text.slice(r.at + r.length);
@@ -540,12 +545,23 @@ function shiftLoc(node, source, start) {
540
545
  if (node.kind === "rule" || node.kind === "at-rule") return { ...node, loc, nodes: node.nodes.map((n) => shiftLoc(n, source, start)) };
541
546
  return { ...node, loc };
542
547
  }
543
- function dropLoc(node) {
544
- const { loc: _loc, ...rest } = node;
545
- if (rest.kind === "rule" || rest.kind === "at-rule") return { ...rest, nodes: rest.nodes.map(dropLoc) };
546
- return rest;
547
- }
548
- function printStyleWithMap(nodes, minify, sourceName, module2) {
548
+ function keepLocIn(node, modules) {
549
+ const keep = node.loc !== void 0 && modules?.has(node.loc.source) === true;
550
+ const { loc, ...rest } = node;
551
+ const kept = keep ? { ...rest, loc } : rest;
552
+ if (kept.kind === "rule" || kept.kind === "at-rule") return { ...kept, nodes: kept.nodes.map((n) => keepLocIn(n, modules)) };
553
+ return kept;
554
+ }
555
+ function printStyleWithMap(nodes, minify, sourceName, module2, others) {
556
+ const sources = [module2];
557
+ const index = /* @__PURE__ */ new Map([[sourceName, 0]]);
558
+ const sourceOf = (name) => {
559
+ if (index.has(name)) return index.get(name);
560
+ const other = others?.get(name);
561
+ if (!other) return void 0;
562
+ index.set(name, sources.push(other) - 1);
563
+ return index.get(name);
564
+ };
549
565
  const lines = [[]];
550
566
  let css = "";
551
567
  let column = 0;
@@ -559,7 +575,8 @@ function printStyleWithMap(nodes, minify, sourceName, module2) {
559
575
  }
560
576
  };
561
577
  const mark = (loc) => {
562
- if (loc && loc.source === sourceName) lines[lines.length - 1].push([column, 0, loc.line - 1, loc.column]);
578
+ const at = loc ? sourceOf(loc.source) : void 0;
579
+ if (loc && at !== void 0) lines[lines.length - 1].push([column, at, loc.line - 1, loc.column]);
563
580
  };
564
581
  const write = (node, depth) => {
565
582
  const pad = minify ? "" : " ".repeat(depth);
@@ -578,7 +595,7 @@ function printStyleWithMap(nodes, minify, sourceName, module2) {
578
595
  }
579
596
  };
580
597
  for (const node of nodes) write(node, 0);
581
- return { css, map: { version: 3, sources: [module2.id], sourcesContent: [module2.code], names: [], mappings: (0, import_sourcemap_codec.encode)(lines) } };
598
+ return { css, map: { version: 3, sources: sources.map((s) => s.id), sourcesContent: sources.map((s) => s.code), names: [], mappings: (0, import_sourcemap_codec.encode)(lines) } };
582
599
  }
583
600
  function printStyle(nodes, minify = false) {
584
601
  const out = [];
@@ -1706,14 +1723,16 @@ function emitNode(node, used, templates) {
1706
1723
  for (const child of node.children) {
1707
1724
  used.add("insert");
1708
1725
  const childCode = emitNode(child, used, templates);
1709
- const isFn = child.kind === "expr" && child.reactive || child.kind === "component" || child.kind === "control";
1710
- parts.push(isFn ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
1726
+ const anchored = child.kind === "expr" && (child.reactive || !isLiteralCode(child.code)) || child.kind === "component" || child.kind === "control";
1727
+ parts.push(anchored ? `insert(${el}, ${childCode}, null);` : `insert(${el}, ${childCode});`);
1711
1728
  }
1712
1729
  parts.push(`return ${el};`);
1713
1730
  return `(() => { ${parts.join(" ")} })()`;
1714
1731
  }
1715
1732
  }
1716
1733
  }
1734
+ var LITERAL = /^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/;
1735
+ var isLiteralCode = (code) => LITERAL.test(code);
1717
1736
  function inlineTemplates(code, templates) {
1718
1737
  if (!templates || templates.length === 0) return code;
1719
1738
  const byId = new Map(templates.map((t) => [t.id, JSON.stringify(t.html)]));