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

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 (44) 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-V33QLJBF.mjs} +4 -4
  5. package/dist/{chunk-DP2QDWWH.mjs → chunk-62F2LLBM.mjs} +1 -1
  6. package/dist/{chunk-E2RWTIYE.mjs → chunk-7GNSGUHK.mjs} +4 -89
  7. package/dist/{chunk-ZR2QHTEX.mjs → chunk-B64LVPTU.mjs} +2 -2
  8. package/dist/{chunk-HCCBEJEZ.mjs → chunk-C3AK5PBV.mjs} +1 -1
  9. package/dist/{chunk-HIZU7WI2.mjs → chunk-GLFUPZ27.mjs} +1 -1
  10. package/dist/chunk-HUABRVWB.mjs +92 -0
  11. package/dist/chunk-XCWP7WJG.mjs +584 -0
  12. package/dist/frontend/babel/index.cjs +1 -1
  13. package/dist/frontend/babel/index.mjs +1 -1
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.mjs +1 -1
  16. package/dist/integrations.cjs +3328 -3269
  17. package/dist/integrations.d.ts.map +1 -1
  18. package/dist/integrations.js +19 -8
  19. package/dist/integrations.mjs +85 -40
  20. package/dist/lower/compile-template.cjs +1 -1
  21. package/dist/lower/compile-template.mjs +1 -1
  22. package/dist/resolve/builtins.cjs +1 -1
  23. package/dist/resolve/builtins.mjs +1 -1
  24. package/dist/{server-fns-JLSTKWPS.mjs → server-fns-N3SDJXA7.mjs} +5 -4
  25. package/dist/{server-functions-BGY3RD4R.mjs → server-functions-LVS66Q4R.mjs} +3 -3
  26. package/dist/transform/index.cjs +31 -14
  27. package/dist/transform/index.mjs +31 -14
  28. package/dist/transform/styles.cjs +31 -13
  29. package/dist/transform/styles.d.cts +27 -1
  30. package/dist/transform/styles.d.ts +27 -1
  31. package/dist/transform/styles.d.ts.map +1 -1
  32. package/dist/transform/styles.js +45 -16
  33. package/dist/transform/styles.mjs +31 -13
  34. package/dist/transform/templates.cjs +30 -13
  35. package/dist/transform/templates.mjs +30 -13
  36. package/dist/{transform-GBP6Y4UI.mjs → transform-P4AETYV4.mjs} +12 -563
  37. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  38. package/dist/vite-styles.cjs +66 -23
  39. package/dist/vite-styles.d.cts +16 -7
  40. package/dist/vite-styles.d.ts +16 -7
  41. package/dist/vite-styles.d.ts.map +1 -1
  42. package/dist/vite-styles.js +68 -25
  43. package/dist/vite-styles.mjs +78 -23
  44. 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;IACzB,6FAA6F;IAC7F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAE5C;;;;;;;;;OASG;IACH,KAAK,CAA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2B,CAAC,OAAO,GAAE,eAAoB,aAIpD,GAAG,MAAM,YAAY,GAAG,SAkB5C;AAqCD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAE,eAAoB,GAAG,CAAC,CAqKpE;AAsID;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,eAAoB,IACxC,MAAM,GAAG,EAAE,QAAQ,MAAM,mBAUjD;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,eAAoB;;oBAItC,MAAM,MAAM,MAAM;;;;;;;;;;;;EAK3C;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,eAAoB;;iBAIhD,GAAG;EAwBnB;AAWD,YAAY,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAqD7E;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,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.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ import {
3
+ styleIds
4
+ } from "./chunk-XCWP7WJG.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-C3AK5PBV.mjs";
11
+ import "./chunk-HUABRVWB.mjs";
8
12
  import {
9
13
  __require
10
- } from "./chunk-HIZU7WI2.mjs";
14
+ } from "./chunk-GLFUPZ27.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-V33QLJBF.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-P4AETYV4.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-P4AETYV4.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-P4AETYV4.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-LVS66Q4R.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-N3SDJXA7.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.95 | (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.95 | (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);
@@ -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.95 | (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.95 | (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.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
  import {
3
3
  MagicString
4
- } from "./chunk-E2RWTIYE.mjs";
4
+ } from "./chunk-7GNSGUHK.mjs";
5
+ import "./chunk-HUABRVWB.mjs";
5
6
  import {
6
7
  serverFnId
7
- } from "./chunk-DP2QDWWH.mjs";
8
- import "./chunk-HIZU7WI2.mjs";
8
+ } from "./chunk-62F2LLBM.mjs";
9
+ import "./chunk-GLFUPZ27.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.95 | (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-62F2LLBM.mjs";
5
+ import "./chunk-GLFUPZ27.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.95 | (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 = [];
@@ -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.95 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
2
 
3
3
  // src/transform/templates.ts
4
4
  import { parse as parse2 } from "@babel/parser";
@@ -1137,7 +1137,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
1137
1137
  const imported = literalsOf.imports.get(name);
1138
1138
  if (imported) {
1139
1139
  const nodes = options?.imported?.get(`${imported.source}#${imported.name}`);
1140
- if (nodes) return nodes.map(dropLoc);
1140
+ if (nodes) return nodes.map((n2) => keepLocIn(n2, options?.importedModules));
1141
1141
  plan.references.push({ name: imported.name, source: imported.source, ...at });
1142
1142
  plan.diagnostics.push({
1143
1143
  ...at,
@@ -1161,7 +1161,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
1161
1161
  const nodes = resolveLiteral(name, at, []);
1162
1162
  const id = hash(`${sourceName}:css:${name}`);
1163
1163
  plan.edits.push({ start: literal.start, end: literal.end, code: `({ $fxStyle: ${JSON.stringify(id)} })` });
1164
- if (nodes) plan.literals.push({ id, name, css: printStyle(nodes, options.minify) });
1164
+ if (nodes) plan.literals.push({ id, name, css: printStyle(nodes, options.minify), nodes });
1165
1165
  }
1166
1166
  const scopeOf = /* @__PURE__ */ new Map();
1167
1167
  const names = /* @__PURE__ */ new Map();
@@ -1236,7 +1236,7 @@ function collectStyles(program, sourceName, options, tags = { html: /* @__PURE__
1236
1236
  if (!plan.scopes.some((s) => s.value === id)) plan.scopes.push({ start: owner.start, end: owner.end, value: id });
1237
1237
  nodes = scopeNodes(nodes, id, (message) => plan.diagnostics.push({ ...at, message }));
1238
1238
  }
1239
- const printed = module ? printStyleWithMap(nodes, options.minify, sourceName, module) : { css: printStyle(nodes, options.minify) };
1239
+ const printed = module ? printStyleWithMap(nodes, options.minify, sourceName, module, options.importedModules) : { css: printStyle(nodes, options.minify) };
1240
1240
  plan.styles.push({ id, scoped: scoped && !shadow, component, ...printed, ...shadow ? { shadow: true } : {}, ...at });
1241
1241
  if (shadow) shadow.indexes.push(plan.styles.length - 1);
1242
1242
  };
@@ -1275,6 +1275,11 @@ function staticMember(cls, name) {
1275
1275
  (m) => m.type === "ClassProperty" && m.static && (m.key.type === "Identifier" && m.key.name === name || m.key.type === "StringLiteral" && m.key.value === name)
1276
1276
  );
1277
1277
  }
1278
+ var styleIds = {
1279
+ block: (owner, index) => `${owner}.fx-${index}.css`,
1280
+ inline: (owner, index) => `${owner}.fx-${index}.css?inline`,
1281
+ literal: (owner, name) => `${owner}.fx-literal-${name}.css?inline`
1282
+ };
1278
1283
  function finishShadowStyles(plan, code, moduleId) {
1279
1284
  const edits = [];
1280
1285
  const imports = [];
@@ -1286,7 +1291,7 @@ function finishShadowStyles(plan, code, moduleId) {
1286
1291
  return local;
1287
1292
  };
1288
1293
  for (const shadow of plan.shadowClasses.values()) {
1289
- const blocks = shadow.indexes.map((i) => importOf(`${moduleId}?fx-style&index=${i}&inline&lang.css`));
1294
+ const blocks = shadow.indexes.map((i) => importOf(styleIds.inline(moduleId, i)));
1290
1295
  let value;
1291
1296
  const prop = shadow.styles;
1292
1297
  if (prop?.value) {
@@ -1294,7 +1299,7 @@ function finishShadowStyles(plan, code, moduleId) {
1294
1299
  let text = code.slice(start, prop.value.end);
1295
1300
  const replacements = [];
1296
1301
  walkIdentifiers(prop.value, (id) => {
1297
- 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;
1302
+ 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;
1298
1303
  if (local) replacements.push({ at: id.start - start, length: id.name.length, with: local });
1299
1304
  });
1300
1305
  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);
@@ -1576,12 +1581,23 @@ function shiftLoc(node, source, start) {
1576
1581
  if (node.kind === "rule" || node.kind === "at-rule") return { ...node, loc, nodes: node.nodes.map((n2) => shiftLoc(n2, source, start)) };
1577
1582
  return { ...node, loc };
1578
1583
  }
1579
- function dropLoc(node) {
1580
- const { loc: _loc, ...rest } = node;
1581
- if (rest.kind === "rule" || rest.kind === "at-rule") return { ...rest, nodes: rest.nodes.map(dropLoc) };
1582
- return rest;
1583
- }
1584
- function printStyleWithMap(nodes, minify, sourceName, module) {
1584
+ function keepLocIn(node, modules) {
1585
+ const keep = node.loc !== void 0 && modules?.has(node.loc.source) === true;
1586
+ const { loc, ...rest } = node;
1587
+ const kept = keep ? { ...rest, loc } : rest;
1588
+ if (kept.kind === "rule" || kept.kind === "at-rule") return { ...kept, nodes: kept.nodes.map((n2) => keepLocIn(n2, modules)) };
1589
+ return kept;
1590
+ }
1591
+ function printStyleWithMap(nodes, minify, sourceName, module, others) {
1592
+ const sources = [module];
1593
+ const index = /* @__PURE__ */ new Map([[sourceName, 0]]);
1594
+ const sourceOf = (name) => {
1595
+ if (index.has(name)) return index.get(name);
1596
+ const other = others?.get(name);
1597
+ if (!other) return void 0;
1598
+ index.set(name, sources.push(other) - 1);
1599
+ return index.get(name);
1600
+ };
1585
1601
  const lines = [[]];
1586
1602
  let css = "";
1587
1603
  let column = 0;
@@ -1595,7 +1611,8 @@ function printStyleWithMap(nodes, minify, sourceName, module) {
1595
1611
  }
1596
1612
  };
1597
1613
  const mark = (loc) => {
1598
- if (loc && loc.source === sourceName) lines[lines.length - 1].push([column, 0, loc.line - 1, loc.column]);
1614
+ const at = loc ? sourceOf(loc.source) : void 0;
1615
+ if (loc && at !== void 0) lines[lines.length - 1].push([column, at, loc.line - 1, loc.column]);
1599
1616
  };
1600
1617
  const write = (node, depth) => {
1601
1618
  const pad = minify ? "" : " ".repeat(depth);
@@ -1614,7 +1631,7 @@ function printStyleWithMap(nodes, minify, sourceName, module) {
1614
1631
  }
1615
1632
  };
1616
1633
  for (const node of nodes) write(node, 0);
1617
- return { css, map: { version: 3, sources: [module.id], sourcesContent: [module.code], names: [], mappings: encode(lines) } };
1634
+ return { css, map: { version: 3, sources: sources.map((s) => s.id), sourcesContent: sources.map((s) => s.code), names: [], mappings: encode(lines) } };
1618
1635
  }
1619
1636
  function printStyle(nodes, minify = false) {
1620
1637
  const out = [];