@aihu/compiler 1.3.4 → 1.3.6

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.
package/README.md CHANGED
@@ -18,6 +18,36 @@ import { migrateTemplateGrammar } from '@aihu/compiler/codemods/template-grammar
18
18
 
19
19
  <!-- END_HANDWRITTEN: prose -->
20
20
 
21
+ ### CSS providers
22
+
23
+ CSS integration is opt-in. The default plugin behavior continues to discover
24
+ `@aihu/css-engine` when it is installed. A project that uses another CSS
25
+ engine can provide its own complete stylesheet producer without importing the
26
+ legacy engine:
27
+
28
+ ```ts
29
+ import { aihuCompilerPlugin, type AihuCssProvider } from '@aihu/compiler'
30
+
31
+ const cssProvider: AihuCssProvider = ({ source, id, shadowMode, target, lightScopeId }) => {
32
+ return myCssEngine.compileAihu({ source, id, shadowMode, target, lightScopeId })
33
+ }
34
+
35
+ export default {
36
+ plugins: [aihuCompilerPlugin({ cssProvider })],
37
+ }
38
+ ```
39
+
40
+ The provider receives the source and file id plus the compiler's resolved
41
+ `shadowMode` (`'light'` or `'shadow'`), build `target`, and optional light-DOM
42
+ scope id. A non-empty result is authoritative: it must be the complete
43
+ stylesheet for that SFC, including utility rules, tokens, and authored
44
+ `@style` rules that should ship. The compiler replaces the component's shadow
45
+ stylesheet with it, or sends it through the Vite CSS pipeline for light DOM.
46
+ Return an empty string, `null`, or `undefined` to emit no provider stylesheet.
47
+
48
+ The explicit provider replaces automatic css-engine resolution for that plugin
49
+ instance, so alternate CSS engines remain independent and opt-in.
50
+
21
51
  ## Install
22
52
 
23
53
  <!-- BEGIN_AUTOGEN: install -->
@@ -29,7 +59,7 @@ npm install @aihu/compiler
29
59
  bun add @aihu/compiler
30
60
  ```
31
61
 
32
- <sub><i>Auto-generated against `@aihu/compiler@1.3.0`.</i></sub>
62
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
33
63
 
34
64
  <!-- END_AUTOGEN: install -->
35
65
 
@@ -40,12 +70,12 @@ bun add @aihu/compiler
40
70
 
41
71
  | | |
42
72
  |---|---|
43
- | **Version** | `1.3.0` |
73
+ | **Version** | `1.3.6` |
44
74
  | **Tier** | D — Compiler — Single-File Component (.aihu) → Web Component |
45
75
  | **Published files** | 4 entries |
46
76
  | **License** | MIT |
47
77
 
48
- <sub><i>Auto-generated against `@aihu/compiler@1.3.0`.</i></sub>
78
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
49
79
 
50
80
  <!-- END_AUTOGEN: stats -->
51
81
 
@@ -57,8 +87,11 @@ bun add @aihu/compiler
57
87
  | Subpath | ESM | CJS |
58
88
  |---|---|---|
59
89
  | `.` | `./dist/index.js` | `—` |
90
+ | `./codemods/macro-simplification` | `./dist/codemods/macro-simplification.js` | `—` |
91
+ | `./codemods/state-wrapper` | `./dist/codemods/state-wrapper.js` | `—` |
92
+ | `./codemods/template-grammar-v2` | `./dist/codemods/template-grammar-v2.js` | `—` |
60
93
 
61
- <sub><i>Auto-generated against `@aihu/compiler@1.3.0`.</i></sub>
94
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
62
95
 
63
96
  <!-- END_AUTOGEN: exports -->
64
97
 
@@ -70,21 +103,22 @@ bun add @aihu/compiler
70
103
  **Peer dependencies:**
71
104
 
72
105
  - `vite` — `>=5.0.0`
106
+ - `@aihu/css-engine` — `>=0.6.1`
73
107
 
74
108
  **Optional dependencies (platform-specific):**
75
109
 
76
- - `@aihu/compiler-darwin-arm64` — `1.3.0`
77
- - `@aihu/compiler-darwin-x64` — `1.3.0`
78
- - `@aihu/compiler-linux-x64-gnu` — `1.3.0`
79
- - `@aihu/compiler-linux-arm64-gnu` — `1.3.0`
80
- - `@aihu/compiler-win32-x64-msvc` — `1.3.0`
81
- - `@aihu/compiler-native-darwin-arm64` — `1.3.0`
82
- - `@aihu/compiler-native-darwin-x64` — `1.3.0`
83
- - `@aihu/compiler-native-linux-x64-gnu` — `1.3.0`
84
- - `@aihu/compiler-native-linux-arm64-gnu` — `1.3.0`
85
- - `@aihu/compiler-native-win32-x64-msvc` — `1.3.0`
110
+ - `@aihu/compiler-darwin-arm64` — `1.3.4`
111
+ - `@aihu/compiler-darwin-x64` — `1.3.4`
112
+ - `@aihu/compiler-linux-x64-gnu` — `1.3.4`
113
+ - `@aihu/compiler-linux-arm64-gnu` — `1.3.4`
114
+ - `@aihu/compiler-win32-x64-msvc` — `1.3.4`
115
+ - `@aihu/compiler-native-darwin-arm64` — `1.3.4`
116
+ - `@aihu/compiler-native-darwin-x64` — `1.3.4`
117
+ - `@aihu/compiler-native-linux-x64-gnu` — `1.3.4`
118
+ - `@aihu/compiler-native-linux-arm64-gnu` — `1.3.4`
119
+ - `@aihu/compiler-native-win32-x64-msvc` — `1.3.4`
86
120
 
87
- <sub><i>Auto-generated against `@aihu/compiler@1.3.0`.</i></sub>
121
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
88
122
 
89
123
  <!-- END_AUTOGEN: deps -->
90
124
 
@@ -98,7 +132,7 @@ bun add @aihu/compiler
98
132
  - [Macro Vocabulary spec](../../docs/superpowers/specs/2026-05-02-spec-macro-vocabulary.md)
99
133
  - [Aihu framework root](../../README.md)
100
134
 
101
- <sub><i>Auto-generated against `@aihu/compiler@1.3.0`.</i></sub>
135
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
102
136
 
103
137
  <!-- END_AUTOGEN: see-also -->
104
138
 
@@ -109,6 +143,6 @@ bun add @aihu/compiler
109
143
 
110
144
  MIT — see [LICENSE](../../LICENSE).
111
145
 
112
- <sub><i>Auto-generated against `@aihu/compiler@1.3.0`.</i></sub>
146
+ <sub><i>Auto-generated against `@aihu/compiler@1.3.6`.</i></sub>
113
147
 
114
148
  <!-- END_AUTOGEN: license -->
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { resolveCompilerBinary } from "./resolve-binary.js";
2
+
1
3
  //#region js/native.d.ts
2
4
  /**
3
5
  * @aihu/compiler native-addon loader — the in-process compile fast path.
@@ -176,6 +178,21 @@ interface VitePlugin {
176
178
  * Options for `aihuCompilerPlugin()` (Plan 3.3 — Islands).
177
179
  */
178
180
  interface AihuCompilerPluginOptions {
181
+ /**
182
+ * Optional CSS provider for the compiled SFC.
183
+ *
184
+ * When supplied, the provider is the sole source of generated component
185
+ * CSS. Its non-empty result must be the COMPLETE stylesheet for the SFC:
186
+ * include utility rules, design tokens, and any authored `@style` rules
187
+ * that should ship with the component. The compiler replaces its existing
188
+ * stylesheet body with this result (or routes it through the document CSS
189
+ * pipeline for `shadowMode: 'light'`). Returning an empty string, `null`,
190
+ * or `undefined` means that this SFC has no provider stylesheet.
191
+ *
192
+ * Without this option, the compiler preserves the legacy automatic,
193
+ * optional `@aihu/css-engine` integration.
194
+ */
195
+ cssProvider?: AihuCssProvider;
179
196
  /**
180
197
  * When `true` (default), components the compiler classified as `'static'`
181
198
  * (read from the `// @aihu:island` marker via `_parseIslandMarker()`) are
@@ -230,6 +247,30 @@ interface AihuCompilerPluginOptions {
230
247
  */
231
248
  layoutsDir?: string;
232
249
  }
250
+ /**
251
+ * Context passed to an explicit CSS provider for each compiled SFC.
252
+ *
253
+ * `shadowMode` and `target` are resolved compiler values, including their
254
+ * runtime defaults. A provider can therefore choose a light-DOM stylesheet
255
+ * strategy or emit target-specific CSS without parsing compiler markers.
256
+ */
257
+ interface AihuCssProviderContext {
258
+ source: string;
259
+ id: string;
260
+ shadowMode: 'light' | 'shadow';
261
+ target: 'client' | 'server' | 'universal';
262
+ lightScopeId?: string;
263
+ }
264
+ /**
265
+ * Explicit CSS provider contract for `aihuCompilerPlugin`.
266
+ *
267
+ * A non-empty return value is authoritative and must be a complete stylesheet
268
+ * for the SFC, including any authored styles the provider wants to preserve.
269
+ * It may be synchronous or asynchronous. Empty/absent results skip CSS
270
+ * folding for that SFC. The provider is an opt-in replacement for the
271
+ * automatic `@aihu/css-engine` fallback, not an additional stylesheet layer.
272
+ */
273
+ type AihuCssProvider = (context: AihuCssProviderContext) => string | null | undefined | Promise<string | null | undefined>;
233
274
  /**
234
275
  * Inject `shadowMode: '...'` (and, for light mode, `lightScopeId: '...'` in
235
276
  * the SAME options object) into the third argument of the emitted
@@ -613,7 +654,7 @@ declare function transform(source: string, id: string, options?: {
613
654
  /**
614
655
  * Fold css-engine utility CSS into the SERVER target's `__aihu_css__` export.
615
656
  *
616
- * The shadow-DOM sibling of `_foldCssEngineStyles`. That one rewrites the
657
+ * The shadow-DOM sibling of `_foldCssStyles`. That one rewrites the
617
658
  * client's `__style__.replaceSync(...)`; the server target has no `__style__`
618
659
  * (`CSSStyleSheet` is a DOM dependency and the Rust codegen elides it), it has
619
660
  * `export const __aihu_css__` — the string `__aihu_schild` inlines as `<style>`
@@ -629,15 +670,15 @@ declare function transform(source: string, id: string, options?: {
629
670
  * never wired to it.)
630
671
  *
631
672
  * REPLACES rather than appends, for the same reason shape 1 above does: the
632
- * css-engine output already contains the authored `@style` rules, so appending
673
+ * Provider output already contains the authored `@style` rules, so appending
633
674
  * would duplicate them.
634
675
  *
635
676
  * Light-DOM components never reach this — their utilities go through the global
636
- * cascade via `_foldCssEngineStylesGlobal`, and their prerendered markup is
677
+ * cascade via `_foldCssStylesGlobal`, and their prerendered markup is
637
678
  * covered by the app stylesheet's `@scope([data-a=…])` blocks.
638
679
  */
639
680
  declare function _foldSsrCssExport(compiledCode: string, css: string): string;
640
- declare function _foldCssEngineStyles(compiledCode: string, css: string): string;
681
+ declare function _foldCssStyles(compiledCode: string, css: string): string;
641
682
  /**
642
683
  * Virtual-module prefix used by the `shadowMode === 'light'` branch to route
643
684
  * per-SFC utility CSS through Vite's built-in CSS pipeline. The plugin
@@ -696,10 +737,14 @@ declare function _lightScopeId(id: string): string;
696
737
  *
697
738
  * @internal
698
739
  */
699
- declare function _foldCssEngineStylesGlobal(compiledCode: string, css: string, id: string): {
740
+ declare function _foldCssStylesGlobal(compiledCode: string, css: string, id: string): {
700
741
  code: string;
701
742
  virtualId: string;
702
743
  } | null;
744
+ /** @deprecated Use `_foldCssStyles`; retained for internal consumers during the seam rollout. */
745
+ declare const _foldCssEngineStyles: typeof _foldCssStyles;
746
+ /** @deprecated Use `_foldCssStylesGlobal`; retained for internal consumers during the seam rollout. */
747
+ declare const _foldCssEngineStylesGlobal: typeof _foldCssStylesGlobal;
703
748
  /** Top-level AST export — one per .aihu SFC. */
704
749
  interface SfcAst {
705
750
  /** Resolved custom-element tag name (meta.name → route.name → file stem). */
@@ -896,5 +941,5 @@ declare function compileRouteMeta(source: string, id?: string): RouteMeta | null
896
941
  declare function _injectAutoWiring(code: string): string;
897
942
  declare function aihuCompilerPlugin(options?: AihuCompilerPluginOptions): VitePlugin;
898
943
  //#endregion
899
- export { AihuCompilerPluginOptions, type CompileEnvelope, type CompileEnvelopeOptions, RouteMeta, SfcAst, SfcAttr, SfcMacroValue, SfcMeta, SfcNode, SfcStyleBlock, StripTypesResult, VIRTUAL_UTILITY_PREFIX, ViteStripApi, _MEMO_MAX_ENTRIES, _buildDeferredHydration, _buildStaticIsland, _clearTransformMemo, _compileViaBackend, _deriveChildTags, _errMessage, _foldCssEngineStyles, _foldCssEngineStylesGlobal, _foldSsrCssExport, _formatExtractCensus, _getCompilerNativeStateKind, _globalizeAuthoredStyle, _hashIdForUtilityCss, _injectAutoWiring, _injectLightScopeId, _injectShadowMode, _isLayoutFile, _isViteMissing, _layoutTag, _lightScopeId, _parseComponentTagsMarker, _parseExtractMarker, _parseIslandMarker, _passivizeOutlet, _resetCompileBackend, _resetCompilerNative, _resolveCompileBackend, _stripFailure, _stripTypes, _transformMemoStats, aihuCompilerPlugin, compileRouteMeta, compileSidecar, compileToAst, kebabComponentTag, loadCompilerNative, transform };
944
+ export { AihuCompilerPluginOptions, AihuCssProvider, AihuCssProviderContext, type CompileEnvelope, type CompileEnvelopeOptions, RouteMeta, SfcAst, SfcAttr, SfcMacroValue, SfcMeta, SfcNode, SfcStyleBlock, StripTypesResult, VIRTUAL_UTILITY_PREFIX, ViteStripApi, _MEMO_MAX_ENTRIES, _buildDeferredHydration, _buildStaticIsland, _clearTransformMemo, _compileViaBackend, _deriveChildTags, _errMessage, _foldCssEngineStyles, _foldCssEngineStylesGlobal, _foldCssStyles, _foldCssStylesGlobal, _foldSsrCssExport, _formatExtractCensus, _getCompilerNativeStateKind, _globalizeAuthoredStyle, _hashIdForUtilityCss, _injectAutoWiring, _injectLightScopeId, _injectShadowMode, _isLayoutFile, _isViteMissing, _layoutTag, _lightScopeId, _parseComponentTagsMarker, _parseExtractMarker, _parseIslandMarker, _passivizeOutlet, _resetCompileBackend, _resetCompilerNative, _resolveCompileBackend, _stripFailure, _stripTypes, _transformMemoStats, aihuCompilerPlugin, compileRouteMeta, compileSidecar, compileToAst, kebabComponentTag, loadCompilerNative, resolveCompilerBinary, transform };
900
945
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../js/native.ts","../js/envelope.ts","../js/transform-memo.ts","../js/index.ts"],"mappings":";;AAiCA;AAAoC;AAAA;AAAA;AAClC;AAAgB;AAAgB;AAOhC;AAAe;AAAA;AAiEjB;AAAgC;AAAA;AAAA;AAAA;AAEhC;AAA+B;AAAA;AAGlB;AAEC;AAaqB;AAAK;AAAA;AAhBlC;UA7EW,mBAAA;EACf,eAAA,CAAgB,MAAA,UAAgB,WAAA;EA8E5B;AACA;AAAQ;AAUR;AAEA;AACA;EArFJ,eAAA;AAAA;AA0IuD;AAAA;AA0GzD;AAA2C;AAAA;AAAuB;AAAA;AAKlE;AAAoC;AAAA;AAAA;AAAA;;;;AA/GqB,KAzE7C,oBAAA;AAAA,KAEA,mBAAA;EAEN,IAAA;EACA,KAAA,EAAO,mBAAA;EACP,SAAA;EACA,MAAA,EAAQ,oBAAA;EC3DH;AAAiB;AAAa;AACvC;AACA;AACA;AAAW;AAAA;AAIb;ED8DM,cAAA;AAAA;EAEA,IAAA;AAAA;EACA,IAAA;EAAqB,KAAA,GAAQ,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AAA;;;;;;;;;EAS5B,IAAA;IAAS,IAAA;IAAe,OAAA;EAAA;AAAA;;;;;;;;;;;;;iBAeV,gBAAA,CAAiB,MAAA,UAAgB,EAAA,YAAc,SAAS;;;;;;;;iBAgCxD,iBAAA,CAAkB,IAAY;AAAA,iBAoR9B,kBAAA,CAAmB,OAAA,GAAU,yBAAA,GAA4B,UAAU"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import{resolveCompilerBinary as e}from"./resolve-binary.js";import{execFileSync as t}from"node:child_process";import{createRequire as n}from"node:module";import{basename as r,dirname as i,join as a,resolve as o}from"node:path";import{fileURLToPath as s,pathToFileURL as c}from"node:url";import{existsSync as l,readFileSync as u,statSync as d}from"node:fs";import{createHash as f}from"node:crypto";const p=i(s(import.meta.url));function m(){if(typeof process>`u`||!process.platform||!process.arch)return null;switch(`${process.platform}-${process.arch}`){case`darwin-arm64`:return{platformId:`darwin-arm64`,packageName:`@aihu/compiler-native-darwin-arm64`,nodeFile:`aihu-compiler-native.darwin-arm64.node`};case`darwin-x64`:return{platformId:`darwin-x64`,packageName:`@aihu/compiler-native-darwin-x64`,nodeFile:`aihu-compiler-native.darwin-x64.node`};case`linux-x64`:return{platformId:`linux-x64-gnu`,packageName:`@aihu/compiler-native-linux-x64-gnu`,nodeFile:`aihu-compiler-native.linux-x64-gnu.node`};case`linux-arm64`:return{platformId:`linux-arm64-gnu`,packageName:`@aihu/compiler-native-linux-arm64-gnu`,nodeFile:`aihu-compiler-native.linux-arm64-gnu.node`};case`win32-x64`:return{platformId:`win32-x64-msvc`,packageName:`@aihu/compiler-native-win32-x64-msvc`,nodeFile:`aihu-compiler-native.win32-x64-msvc.node`};default:return null}}let h=null,g=!1;function _(e){try{let t=a(i(e),`package.json`);if(!l(t))return null;let n=JSON.parse(u(t,`utf8`));return typeof n.name!=`string`||!n.name.startsWith(`@aihu/compiler-native-`)?null:typeof n.version==`string`?n.version:null}catch{return null}}function v(){return m()}function y(e){return typeof e==`object`&&!!e&&typeof e.compileEnvelope==`function`}function b(){if(h!==null)return h;if(typeof process<`u`&&process.env?.AIHU_COMPILER_NATIVE===`0`)return h={kind:`disabled`},h;let e=n(import.meta.url),t=process.env?.AIHU_COMPILER_NATIVE_ADDON;if(t){let n;try{n=e(t)}catch(e){throw Error(`[@aihu/compiler] AIHU_COMPILER_NATIVE_ADDON is set to '${t}', which failed to load: ${e.message}`)}if(!y(n))throw Error(`[@aihu/compiler] AIHU_COMPILER_NATIVE_ADDON module at '${t}' does not export compileEnvelope()`);return h={kind:`loaded`,addon:n,addonPath:t,origin:`override`,packageVersion:_(t)},h}let r=m();if(r===null)return h={kind:`unavailable`},h;let i=null;try{i=e.resolve(r.packageName)}catch{}let a=[o(p,`../src-native/aihu-compiler-native.node`),o(p,`../src-native/target/release/aihu-compiler-native.node`)],s=i?[i]:a.filter(e=>l(e)),c=i?`package`:`dev-build`;for(let t of s)try{let n=e(t);if(y(n))return h={kind:`loaded`,addon:n,addonPath:t,origin:c,packageVersion:_(t)},h;throw Error(`module at ${t} does not export compileEnvelope()`)}catch(e){return g||(g=!0,console.warn(`[@aihu/compiler] native addon found but failed to load; falling back to the aihu-compile spawn path (identical output, slower).
2
- Candidate: ${t}\n Error: ${e.message}\n Reinstall @aihu/compiler (or rebuild: cargo build --release --manifest-path packages/compiler/src-native/Cargo.toml), or set AIHU_COMPILER_NATIVE=0 to silence this warning.`)),h={kind:`unavailable`,error:e},h}return h={kind:`unavailable`},h}function x(){return b().kind}function S(){h=null,g=!1}const C=67108864;function w(e=0){let t=Math.ceil(e/1024)*2,n=process.env.AIHU_COMPILE_TIMEOUT_MS;if(n!==void 0&&n!==``){let e=Number(n);if(Number.isFinite(e)&&e>0)return Math.max(e,t)}return Math.max(12e4,t)}function T(e=0){return{timeout:w(e),maxBuffer:C,killSignal:`SIGKILL`}}function E(e,t,n,r,i){let a=e,o=` binary: ${t}\n args: ${n.length>0?n.join(` `):`(none)`}\n stdin: ${r} bytes\n elapsed: ${i} ms`;if(a.code===`ETIMEDOUT`){let e=w(r);return Error(`[@aihu/compiler] aihu-compile TIMED OUT after ${e} ms and the child was killed.\n\n${o}\n\n This is the known spawn stall, not a slow compile: the compiler normally\n finishes in single-digit milliseconds. The child parks in read() waiting for\n an EOF on stdin that the parent's spawnSync loop never delivers, so without\n this timeout the build would hang at 0% CPU indefinitely (two such children\n were once found still running after 2.5 days).\n\n What to do next:\n - Re-run the build. The stall is intermittent and load-dependent; a retry\n normally succeeds.\n - If it reproduces every time, check the binary directly: ${t} --help\n and rebuild it: cargo build --release -p aihu-compiler\n - If a payload genuinely needs longer than ${e} ms, raise the bound with\n AIHU_COMPILE_TIMEOUT_MS=<milliseconds>. Do not remove it.`)}return a.code===`ENOBUFS`?Error(`[@aihu/compiler] aihu-compile produced more than the ${C} byte\n stdout/stderr limit and the child was killed.\n\n${o}\n\n An emit this large almost certainly means the input is wrong rather than a\n real component. Check what is being passed in before raising the cap.`):null}const ee=i(s(import.meta.url));let D=null;function te(){let e=v();if(e===null)return null;try{let t=JSON.parse(u(o(ee,`../package.json`),`utf8`)).optionalDependencies?.[e.packageName];return typeof t==`string`?t:null}catch{return null}}function ne(e){let t=te();if(t===null)return{ok:!0};if(typeof e.addon.compilerVersion!=`function`)return{ok:!1,reason:`missing-method`,actual:`<no compilerVersion()>`,expected:t};let n;try{n=String(e.addon.compilerVersion())}catch(e){return{ok:!1,reason:`missing-method`,actual:`<compilerVersion() threw: ${e.message}>`,expected:t}}return e.packageVersion===null||e.packageVersion===t?{ok:!0}:{ok:!1,reason:`version-mismatch`,actual:`${e.packageVersion} (reports: ${n})`,expected:t}}function re(e,t){return`[@aihu/compiler] native addon version mismatch — ${t.reason===`missing-method`?`the addon does not implement compilerVersion(), so it predates this handshake`:`the installed addon is not the build this source requires`}.\n Required (packages/compiler/package.json pin): ${t.expected}\n Loaded addon: ${t.actual}\n Addon path: ${e.addonPath}\n Cause: the addon is a PUBLISHED artifact, so a branch that changes Rust\n is stale by construction — the pinned version is not on npm yet and\n \`bun install\` cannot fix it. Using it would silently compile with\n pre-change codegen.`}function O(){if(D!==null)return D;let e=typeof process<`u`?process.env:void 0;if(e?.AIHU_COMPILER_NATIVE===`0`||e?.AIHU_COMPILE_BIN)return D={kind:`spawn`},D;let t=b();if(t.kind!==`loaded`)return D={kind:`spawn`},D;let n=ne(t);if(!n.ok){if(t.origin===`override`)throw Error(`${re(t,n)}\n AIHU_COMPILER_NATIVE_ADDON pinned this addon explicitly, so this fails\n rather than falling back. Unset it (the CLI spawn path is byte-identical),\n set AIHU_COMPILER_NATIVE=0, or rebuild:\n bun packages/compiler/scripts/build-native.ts`);return console.warn(`${re(t,n)}\n Falling back to the aihu-compile spawn path (built from source,\n byte-identical output, slower). Set AIHU_COMPILER_NATIVE=0 to silence\n this, or build the addon from source:\n bun packages/compiler/scripts/build-native.ts`),D={kind:`spawn`},D}return D={kind:`native`,compileEnvelope:t.addon.compileEnvelope.bind(t.addon),stampPath:t.addonPath},D}function ie(){D=null}function k(){let e=O();return e.kind===`native`?e.stampPath:A()}function A(){return process.env.AIHU_COMPILE_BIN??e()}function ae(e){let t=e.trim();if(t.startsWith(`{`))try{let e=JSON.parse(t);if(typeof e==`object`&&e&&e.envelope===1)return{kind:`envelope`,envelope:e}}catch{}return{kind:`legacy`,output:e}}function j(e,n,r){let i=O(),a=JSON.stringify(r);if(i.kind===`native`)return{kind:`envelope`,envelope:JSON.parse(i.compileEnvelope(e,a))};let o=A(),s=[...n,`--envelope`,a],c=Date.now(),l;try{l=t(o,s,{input:e,encoding:`utf8`,...T(e.length)})}catch(t){throw E(t,o,s,e.length,Date.now()-c)??t}return ae(l)}const oe=1024,M=new Map;let N=0,P=0,F=0;function se(e){try{let t=d(e);return`${e}:${t.mtimeMs}:${t.size}`}catch{return e}}function I(e,t,n,r,i){return f(`sha256`).update(e).update(`\0`).update(n).update(`\0`).update(r).update(`\0`).update(se(i)).update(`\0`).update(t).digest(`hex`)}function L(e,t,n,r,i,a){let o=I(e,t,n,r,i),s=M.get(o);if(s!==void 0)return N++,s;let c=a();if(P++,M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}return M.set(o,c),c}function R(e,t,n,r,i,a){let o=I(e,t,n,r,i);if(!M.has(o)){if(M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}M.set(o,a),F++}}function ce(){M.clear(),N=0,P=0,F=0}function le(){return{size:M.size,hits:N,misses:P,seeds:F}}function z(){return process.env.AIHU_COMPILE_BIN??e()}function ue(e,t){let n=[{kind:`code`,brace:0}],r=0;for(let i=t;i<e.length;i++){let t=n[n.length-1];if(t===void 0)return-1;let a=e[i];if(t.kind===`tpl`){a===`\\`?i++:a==="`"?n.pop():a===`$`&&e[i+1]===`{`&&(n.push({kind:`code`,brace:0}),i++);continue}if(a===`'`||a===`"`)for(i++;i<e.length&&e[i]!==a;)e[i]===`\\`&&i++,i++;else if(a==="`")n.push({kind:`tpl`});else if(a===`/`&&e[i+1]===`/`)for(;i<e.length&&e[i]!==`
3
- `;)i++;else if(a===`/`&&e[i+1]===`*`){for(i+=2;i<e.length&&(e[i]!==`*`||e[i+1]!==`/`);)i++;i++}else if(a===`(`)r++;else if(a===`)`){if(r--,r===0)return i}else a===`{`?t.brace++:a===`}`&&(t.brace===0&&n.length>1?n.pop():t.brace--)}return-1}function B(e,t,n){let r=/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.exec(e);if(r==null)return e;let i=ue(e,r.index+r[0].length-1);if(i===-1)return e;let a=`shadowMode: '${t}'${n?`, lightScopeId: '${n}'`:``}`,o=e.slice(i+1);if(/^\s*\)/.test(o))return`${e.slice(0,i+1)}, { ${a} }${o}`;let s=/^\s*,\s*\{/.exec(o);if(s&&!/^\s*,\s*\{[^}]*\bshadowMode\b/.test(o)){let t=i+1+s[0].length;return`${e.slice(0,t)} ${a},${e.slice(t)}`}return e}function V(e,t){return e.replace(`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = undefined`,`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = '${t}'`)}function H(e){return e.replace(/\(ctx\.host as ShadowRoot\)\.adoptedStyleSheets\s*=\s*\[__style__\];?/,`if (!document.adoptedStyleSheets.includes(__style__)) document.adoptedStyleSheets = [...document.adoptedStyleSheets, __style__];`)}function U(e){return/^\/\/ @aihu:island (static|interactive)$/m.exec(e)?.[1]===`static`?`static`:`interactive`}function W(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;let t=e?.message;return typeof t==`string`?t:String(e)}function G(e){let t=W(e),n=e?.code;return n===`ERR_MODULE_NOT_FOUND`||n===`MODULE_NOT_FOUND`||/cannot find (module|package)/i.test(t)?/['"`]vite['"`]/.test(t):!1}function K(e,t,n,r,i){return`[@aihu/compiler] TypeScript strip failed for ${t} — vite ${n} \`${e}\` (${r?`server`:`client`} environment) threw. Returning the un-stripped TypeScript would corrupt the build silently and resurface as an unrelated bundler PARSE_ERROR on this file, so it fails here instead. Underlying error: ${W(i)}`}async function q(e,t,n,r){let i=e.version??`unknown`;if(typeof e.transformWithOxc==`function`)try{return{code:(await e.transformWithOxc(t,`component.ts`,{lang:`ts`,sourcemap:!1})).code,map:null}}catch(e){throw Error(K(`transformWithOxc`,n,i,r,e),{cause:e})}if(typeof e.transformWithEsbuild==`function`)try{return{code:(await e.transformWithEsbuild(t,`component.ts`,{target:`esnext`,sourcemap:!1})).code,map:null}}catch(e){throw Error(K(`transformWithEsbuild`,n,i,r,e),{cause:e})}return{code:t,moduleType:`ts`,map:null}}function J(e){let t=/^\/\/ @aihu:component-tags (.+)$/m.exec(e);return t===null?[]:t[1].split(`,`)}function Y(e){return[...new Set(Array.from(e.matchAll(/__aihu_schild\('([^']+)'/g),e=>e[1]))].sort()}function de(e){let t=/^\/\/ @aihu:extract read=(\S+) call=(\S+)$/m.exec(e);return t?{read:t[1],call:t[2]}:null}function fe(e){if(e.size===0)return[];let t=new Map,n=new Map;for(let{read:r,call:i}of e.values())t.set(r,(t.get(r)??0)+1),n.set(i,(n.get(i)??0)+1);let r=[`[aihu] extract census — ${e.size} surface(s)`];for(let[e,n]of[...t.entries()].sort())r.push(` read=${e}: ${n}`);for(let[e,t]of[...n.entries()].sort())r.push(` call=${e}: ${t}`);return r}function pe(e){let t=/defineElement\(\s*['"]([^'"]+)['"]/m.exec(e);return t?t[1]??null:null}function me(e){let t=/defineComponent\(\s*\{/.exec(e);if(t===null)return!1;let n=/\bbase\s*:/g;return n.lastIndex=t.index+t[0].length,n.test(e)}function he(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return e.slice(0,t)}function ge(e,t){let n=he(t.replace(/\\/g,`/`).replace(/^\.?\//,``));return n?e.replace(/\\/g,`/`).includes(`/${n}/`):!1}function _e(e){return`aihu-layout-${e.toLowerCase()}`}function ve(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);if(n>0&&r>=`A`&&r<=`Z`){let r=e.charAt(n-1),i=e.charAt(n+1);(r>=`a`&&r<=`z`||r>=`0`&&r<=`9`||r>=`A`&&r<=`Z`&&i>=`a`&&i<=`z`)&&(t+=`-`)}t+=r.toLowerCase()}return t}function ye(e){let t=e.indexOf(`const createOutletBoundary = () => {`);if(t===-1)return e;let n=/return host;[^\S\n]*\n\};/g;n.lastIndex=t+36;let r=n.exec(e);return r===null?e:e.slice(0,t)+`const createOutletBoundary = () => branch('div', { 'data-aihu-outlet': '' }, []);`+e.slice(r.index+r[0].length)}function be(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hmrReplace`)||n.push(`_hmrReplace`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}).replace(/\bdefineComponent\(/,`defineComponent(__aihu_setup__ = `),r=`
2
+ Candidate: ${t}\n Error: ${e.message}\n Reinstall @aihu/compiler (or rebuild: cargo build --release --manifest-path packages/compiler/src-native/Cargo.toml), or set AIHU_COMPILER_NATIVE=0 to silence this warning.`)),h={kind:`unavailable`,error:e},h}return h={kind:`unavailable`},h}function x(){return b().kind}function S(){h=null,g=!1}const C=67108864;function w(e=0){let t=Math.ceil(e/1024)*2,n=process.env.AIHU_COMPILE_TIMEOUT_MS;if(n!==void 0&&n!==``){let e=Number(n);if(Number.isFinite(e)&&e>0)return Math.max(e,t)}return Math.max(12e4,t)}function T(e=0){return{timeout:w(e),maxBuffer:C,killSignal:`SIGKILL`}}function E(e,t,n,r,i){let a=e,o=` binary: ${t}\n args: ${n.length>0?n.join(` `):`(none)`}\n stdin: ${r} bytes\n elapsed: ${i} ms`;if(a.code===`ETIMEDOUT`){let e=w(r);return Error(`[@aihu/compiler] aihu-compile TIMED OUT after ${e} ms and the child was killed.\n\n${o}\n\n This is the known spawn stall, not a slow compile: the compiler normally\n finishes in single-digit milliseconds. The child parks in read() waiting for\n an EOF on stdin that the parent's spawnSync loop never delivers, so without\n this timeout the build would hang at 0% CPU indefinitely (two such children\n were once found still running after 2.5 days).\n\n What to do next:\n - Re-run the build. The stall is intermittent and load-dependent; a retry\n normally succeeds.\n - If it reproduces every time, check the binary directly: ${t} --help\n and rebuild it: cargo build --release -p aihu-compiler\n - If a payload genuinely needs longer than ${e} ms, raise the bound with\n AIHU_COMPILE_TIMEOUT_MS=<milliseconds>. Do not remove it.`)}return a.code===`ENOBUFS`?Error(`[@aihu/compiler] aihu-compile produced more than the ${C} byte\n stdout/stderr limit and the child was killed.\n\n${o}\n\n An emit this large almost certainly means the input is wrong rather than a\n real component. Check what is being passed in before raising the cap.`):null}const ee=i(s(import.meta.url));let D=null;function te(){let e=v();if(e===null)return null;try{let t=JSON.parse(u(o(ee,`../package.json`),`utf8`)).optionalDependencies?.[e.packageName];return typeof t==`string`?t:null}catch{return null}}function ne(e){let t=te();if(t===null)return{ok:!0};if(typeof e.addon.compilerVersion!=`function`)return{ok:!1,reason:`missing-method`,actual:`<no compilerVersion()>`,expected:t};let n;try{n=String(e.addon.compilerVersion())}catch(e){return{ok:!1,reason:`missing-method`,actual:`<compilerVersion() threw: ${e.message}>`,expected:t}}return e.packageVersion===null||e.packageVersion===t?{ok:!0}:{ok:!1,reason:`version-mismatch`,actual:`${e.packageVersion} (reports: ${n})`,expected:t}}function re(e,t){return`[@aihu/compiler] native addon version mismatch — ${t.reason===`missing-method`?`the addon does not implement compilerVersion(), so it predates this handshake`:`the installed addon is not the build this source requires`}.\n Required (packages/compiler/package.json pin): ${t.expected}\n Loaded addon: ${t.actual}\n Addon path: ${e.addonPath}\n Cause: the addon is a PUBLISHED artifact, so a branch that changes Rust\n is stale by construction — the pinned version is not on npm yet and\n \`bun install\` cannot fix it. Using it would silently compile with\n pre-change codegen.`}function O(){if(D!==null)return D;let e=typeof process<`u`?process.env:void 0;if(e?.AIHU_COMPILER_NATIVE===`0`||e?.AIHU_COMPILE_BIN)return D={kind:`spawn`},D;let t=b();if(t.kind!==`loaded`)return D={kind:`spawn`},D;let n=ne(t);if(!n.ok){if(t.origin===`override`)throw Error(`${re(t,n)}\n AIHU_COMPILER_NATIVE_ADDON pinned this addon explicitly, so this fails\n rather than falling back. Unset it (the CLI spawn path is byte-identical),\n set AIHU_COMPILER_NATIVE=0, or rebuild:\n bun packages/compiler/scripts/build-native.ts`);return console.warn(`${re(t,n)}\n Falling back to the aihu-compile spawn path (built from source,\n byte-identical output, slower). Set AIHU_COMPILER_NATIVE=0 to silence\n this, or build the addon from source:\n bun packages/compiler/scripts/build-native.ts`),D={kind:`spawn`},D}return D={kind:`native`,compileEnvelope:t.addon.compileEnvelope.bind(t.addon),stampPath:t.addonPath},D}function ie(){D=null}function k(){let e=O();return e.kind===`native`?e.stampPath:A()}function A(){return process.env.AIHU_COMPILE_BIN??e()}function ae(e){let t=e.trim();if(t.startsWith(`{`))try{let e=JSON.parse(t);if(typeof e==`object`&&e&&e.envelope===1)return{kind:`envelope`,envelope:e}}catch{}return{kind:`legacy`,output:e}}function j(e,n,r){let i=O(),a=JSON.stringify(r);if(i.kind===`native`)return{kind:`envelope`,envelope:JSON.parse(i.compileEnvelope(e,a))};let o=A(),s=[...n,`--envelope`,a],c=Date.now(),l;try{l=t(o,s,{input:e,encoding:`utf8`,...T(e.length)})}catch(t){throw E(t,o,s,e.length,Date.now()-c)??t}return ae(l)}const oe=1024,M=new Map;let N=0,P=0,F=0;function se(e){try{let t=d(e);return`${e}:${t.mtimeMs}:${t.size}`}catch{return e}}function ce(e,t,n,r,i){return f(`sha256`).update(e).update(`\0`).update(n).update(`\0`).update(r).update(`\0`).update(se(i)).update(`\0`).update(t).digest(`hex`)}function I(e,t,n,r,i,a){let o=ce(e,t,n,r,i),s=M.get(o);if(s!==void 0)return N++,s;let c=a();if(P++,M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}return M.set(o,c),c}function L(e,t,n,r,i,a){let o=ce(e,t,n,r,i);if(!M.has(o)){if(M.size>=1024){let e=M.keys().next().value;e!==void 0&&M.delete(e)}M.set(o,a),F++}}function le(){M.clear(),N=0,P=0,F=0}function ue(){return{size:M.size,hits:N,misses:P,seeds:F}}function R(){return process.env.AIHU_COMPILE_BIN??e()}function de(e,t){let n=[{kind:`code`,brace:0}],r=0;for(let i=t;i<e.length;i++){let t=n[n.length-1];if(t===void 0)return-1;let a=e[i];if(t.kind===`tpl`){a===`\\`?i++:a==="`"?n.pop():a===`$`&&e[i+1]===`{`&&(n.push({kind:`code`,brace:0}),i++);continue}if(a===`'`||a===`"`)for(i++;i<e.length&&e[i]!==a;)e[i]===`\\`&&i++,i++;else if(a==="`")n.push({kind:`tpl`});else if(a===`/`&&e[i+1]===`/`)for(;i<e.length&&e[i]!==`
3
+ `;)i++;else if(a===`/`&&e[i+1]===`*`){for(i+=2;i<e.length&&(e[i]!==`*`||e[i+1]!==`/`);)i++;i++}else if(a===`(`)r++;else if(a===`)`){if(r--,r===0)return i}else a===`{`?t.brace++:a===`}`&&(t.brace===0&&n.length>1?n.pop():t.brace--)}return-1}function z(e,t,n){let r=/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.exec(e);if(r==null)return e;let i=de(e,r.index+r[0].length-1);if(i===-1)return e;let a=`shadowMode: '${t}'${n?`, lightScopeId: '${n}'`:``}`,o=e.slice(i+1);if(/^\s*\)/.test(o))return`${e.slice(0,i+1)}, { ${a} }${o}`;let s=/^\s*,\s*\{/.exec(o);if(s&&!/^\s*,\s*\{[^}]*\bshadowMode\b/.test(o)){let t=i+1+s[0].length;return`${e.slice(0,t)} ${a},${e.slice(t)}`}return e}function B(e,t){return e.replace(`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = undefined`,`const __AIHU_LIGHT_SCOPE_ID__: string | undefined = '${t}'`)}function V(e){return e.replace(/\(ctx\.host as ShadowRoot\)\.adoptedStyleSheets\s*=\s*\[__style__\];?/,`if (!document.adoptedStyleSheets.includes(__style__)) document.adoptedStyleSheets = [...document.adoptedStyleSheets, __style__];`)}function H(e){return/^\/\/ @aihu:island (static|interactive)$/m.exec(e)?.[1]===`static`?`static`:`interactive`}function U(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;let t=e?.message;return typeof t==`string`?t:String(e)}function W(e){let t=U(e),n=e?.code;return n===`ERR_MODULE_NOT_FOUND`||n===`MODULE_NOT_FOUND`||/cannot find (module|package)/i.test(t)?/['"`]vite['"`]/.test(t):!1}function G(e,t,n,r,i){return`[@aihu/compiler] TypeScript strip failed for ${t} — vite ${n} \`${e}\` (${r?`server`:`client`} environment) threw. Returning the un-stripped TypeScript would corrupt the build silently and resurface as an unrelated bundler PARSE_ERROR on this file, so it fails here instead. Underlying error: ${U(i)}`}async function K(e,t,n,r){let i=e.version??`unknown`;if(typeof e.transformWithOxc==`function`)try{return{code:(await e.transformWithOxc(t,`component.ts`,{lang:`ts`,sourcemap:!1})).code,map:null}}catch(e){throw Error(G(`transformWithOxc`,n,i,r,e),{cause:e})}if(typeof e.transformWithEsbuild==`function`)try{return{code:(await e.transformWithEsbuild(t,`component.ts`,{target:`esnext`,sourcemap:!1})).code,map:null}}catch(e){throw Error(G(`transformWithEsbuild`,n,i,r,e),{cause:e})}return{code:t,moduleType:`ts`,map:null}}function q(e){let t=/^\/\/ @aihu:component-tags (.+)$/m.exec(e);return t===null?[]:t[1].split(`,`)}function J(e){return[...new Set(Array.from(e.matchAll(/__aihu_schild\('([^']+)'/g),e=>e[1]))].sort()}function fe(e){let t=/^\/\/ @aihu:extract read=(\S+) call=(\S+)$/m.exec(e);return t?{read:t[1],call:t[2]}:null}function pe(e){if(e.size===0)return[];let t=new Map,n=new Map;for(let{read:r,call:i}of e.values())t.set(r,(t.get(r)??0)+1),n.set(i,(n.get(i)??0)+1);let r=[`[aihu] extract census — ${e.size} surface(s)`];for(let[e,n]of[...t.entries()].sort())r.push(` read=${e}: ${n}`);for(let[e,t]of[...n.entries()].sort())r.push(` call=${e}: ${t}`);return r}function me(e){let t=/defineElement\(\s*['"]([^'"]+)['"]/m.exec(e);return t?t[1]??null:null}function he(e){let t=/defineComponent\(\s*\{/.exec(e);if(t===null)return!1;let n=/\bbase\s*:/g;return n.lastIndex=t.index+t[0].length,n.test(e)}function ge(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return e.slice(0,t)}function _e(e,t){let n=ge(t.replace(/\\/g,`/`).replace(/^\.?\//,``));return n?e.replace(/\\/g,`/`).includes(`/${n}/`):!1}function ve(e){return`aihu-layout-${e.toLowerCase()}`}function ye(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);if(n>0&&r>=`A`&&r<=`Z`){let r=e.charAt(n-1),i=e.charAt(n+1);(r>=`a`&&r<=`z`||r>=`0`&&r<=`9`||r>=`A`&&r<=`Z`&&i>=`a`&&i<=`z`)&&(t+=`-`)}t+=r.toLowerCase()}return t}function be(e){let t=e.indexOf(`const createOutletBoundary = () => {`);if(t===-1)return e;let n=/return host;[^\S\n]*\n\};/g;n.lastIndex=t+36;let r=n.exec(e);return r===null?e:e.slice(0,t)+`const createOutletBoundary = () => branch('div', { 'data-aihu-outlet': '' }, []);`+e.slice(r.index+r[0].length)}function xe(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hmrReplace`)||n.push(`_hmrReplace`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}).replace(/\bdefineComponent\(/,`defineComponent(__aihu_setup__ = `),r=`
4
4
  export { __aihu_setup__ as default }
5
5
 
6
6
  if (typeof __DEV__ !== 'undefined' && __DEV__ && import.meta.hot) {
@@ -15,7 +15,7 @@ if (typeof __DEV__ !== 'undefined' && __DEV__ && import.meta.hot) {
15
15
  })
16
16
  }
17
17
  `;return`let __aihu_setup__: ((ctx: any) => any) | undefined
18
- `+n+r}function xe(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hydrateOnVisible`)||n.push(`_hydrateOnVisible`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}),r=n.replace(/defineElement\(\s*('[^']+'|"[^"]+")\s*,\s*defineComponent\(/,(e,t)=>`defineElement(${t}, __aihu_wrap_defer__(defineComponent(`);if(r===n)return e;let i=r.replace(/\)\s*\)\s*\nexport\s/,`)))
18
+ `+n+r}function Se(e,t){let n=e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_hydrateOnVisible`)||n.push(`_hydrateOnVisible`),`import { ${n.join(`, `)} } from '@aihu/runtime'`}),r=n.replace(/defineElement\(\s*('[^']+'|"[^"]+")\s*,\s*defineComponent\(/,(e,t)=>`defineElement(${t}, __aihu_wrap_defer__(defineComponent(`);if(r===n)return e;let i=r.replace(/\)\s*\)\s*\nexport\s/,`)))
19
19
  export `);return i===r&&(i=r.replace(/\)\s*\)\s*$/,`)))
20
20
  `)),i===r?e:`
21
21
  // Plan 3.3 (Islands) — defer attribute support. Wraps the constructor
@@ -34,13 +34,13 @@ function __aihu_wrap_defer__<T extends typeof HTMLElement>(Ctor: T): T {
34
34
  }
35
35
  return Ctor
36
36
  }
37
- `+i}function Se(e,t){if(!/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.test(e))return e;let n=e.replace(/^[^\S\r\n]*import\s*\{[^{}]*\}\s*from\s*'@aihu\/runtime'(?:\s*;)?\s*$/m,``).replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}),r=/\)\s*\)\s*$/,i=/\),\s*\{\s*shadowMode:\s*'shadow'\s*\}\)\s*$/,a=r.test(n)?r:i.test(n)?i:null;if(a===null)return e;let o=JSON.stringify(t);return`// AIHU_STATIC_ISLAND — zero @aihu/runtime references\n${n.replace(/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/,`customElements.define(${o}, class extends HTMLElement {\n connectedCallback() {\n const root = this.attachShadow({ mode: 'open' })\n const __aihu_setup__ = (`).replace(a,`)
37
+ `+i}function Ce(e,t){if(!/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/.test(e))return e;let n=e.replace(/^[^\S\r\n]*import\s*\{[^{}]*\}\s*from\s*'@aihu\/runtime'(?:\s*;)?\s*$/m,``).replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}),r=/\)\s*\)\s*$/,i=/\),\s*\{\s*shadowMode:\s*'shadow'\s*\}\)\s*$/,a=r.test(n)?r:i.test(n)?i:null;if(a===null)return e;let o=JSON.stringify(t);return`// AIHU_STATIC_ISLAND — zero @aihu/runtime references\n${n.replace(/defineElement\(\s*['"][^'"]+['"]\s*,\s*defineComponent\(/,`customElements.define(${o}, class extends HTMLElement {\n connectedCallback() {\n const root = this.attachShadow({ mode: 'open' })\n const __aihu_setup__ = (`).replace(a,`)
38
38
  mount(__aihu_setup__({ host: root, element: this }), root)
39
39
  }
40
40
  })
41
- `)}`}function Ce(e,n,i){let a=r(n,`.aihu`),o=ve(a),s=/^[A-Z]/.test(a)&&!o.includes(`-`)?a:o,c=[`--stdin`,`--tag`,i?.tag??s,`--path`,n];if(i?.sidecarOut&&c.push(`--sidecar-out`,i.sidecarOut),i?.target&&c.push(`--target`,i.target),i?.strictTemplates&&c.push(`--strict-templates`),i?.sidecarOut){let n=z(),r=Date.now();try{return{code:t(n,c,{input:e,encoding:`utf8`,...T(e.length)}),map:null}}catch(t){throw E(t,n,c,e.length,Date.now()-r)??t}}let l=k(),u=i?.target??`universal`,d=i?.tag===void 0;return{code:L(`transform`,e,n,`target=${i?.target??``}|tag=${i?.tag??``}|strict=${i?.strictTemplates===!0}`,l,()=>{let t=j(e,c,{tag:i?.tag??s,path:n,targets:[u],emits:d?[`js`,`ast`,`route`]:[`js`],...i?.strictTemplates?{strictTemplates:!0}:{}});if(t.kind===`legacy`)return t.output;let r=t.envelope;d&&(r.astJson!==void 0&&R(`ast`,e,n,``,l,r.astJson),R(`route`,e,n,``,l,r.routeJson??`null`));let a=r.targets[u]?.js;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing js for target '${u}'`);return a}),map:null}}function we(e){return e.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Te(e,t,n,r){let i=e.indexOf(t);if(i===-1)return null;let a=i+t.length,o=e.indexOf(n,a);return o===-1?null:e.slice(0,a)+r+e.slice(o)}function Ee(e,t){if(!t.trim())return e;let n=we(t),r=Te(e,"export const __aihu_css__ = `","`",n);return r===null?`${e}\nexport const __aihu_css__ = \`${n}\`\n`:r}function X(e,t){if(!t.trim())return e;let n=we(t),r=Te(e,"__style__.replaceSync(`","`);",n);if(r!==null)return r;let i=/defineComponent\(\s*\((__?[A-Za-z0-9_]+)\)\s*=>\s*\{/,a=i.exec(e);if(a==null)return e;let o=a[1]===`_ctx`?`ctx`:a[1],s=e.split(`
41
+ `)}`}function we(e,n,i){let a=r(n,`.aihu`),o=ye(a),s=/^[A-Z]/.test(a)&&!o.includes(`-`)?a:o,c=[`--stdin`,`--tag`,i?.tag??s,`--path`,n];if(i?.sidecarOut&&c.push(`--sidecar-out`,i.sidecarOut),i?.target&&c.push(`--target`,i.target),i?.strictTemplates&&c.push(`--strict-templates`),i?.sidecarOut){let n=R(),r=Date.now();try{return{code:t(n,c,{input:e,encoding:`utf8`,...T(e.length)}),map:null}}catch(t){throw E(t,n,c,e.length,Date.now()-r)??t}}let l=k(),u=i?.target??`universal`,d=i?.tag===void 0;return{code:I(`transform`,e,n,`target=${i?.target??``}|tag=${i?.tag??``}|strict=${i?.strictTemplates===!0}`,l,()=>{let t=j(e,c,{tag:i?.tag??s,path:n,targets:[u],emits:d?[`js`,`ast`,`route`]:[`js`],...i?.strictTemplates?{strictTemplates:!0}:{}});if(t.kind===`legacy`)return t.output;let r=t.envelope;d&&(r.astJson!==void 0&&L(`ast`,e,n,``,l,r.astJson),L(`route`,e,n,``,l,r.routeJson??`null`));let a=r.targets[u]?.js;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing js for target '${u}'`);return a}),map:null}}function Te(e){return e.replace(/\\/g,`\\\\`).replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function Ee(e,t,n,r){let i=e.indexOf(t);if(i===-1)return null;let a=i+t.length,o=e.indexOf(n,a);return o===-1?null:e.slice(0,a)+r+e.slice(o)}function De(e,t){if(!t.trim())return e;let n=Te(t),r=Ee(e,"export const __aihu_css__ = `","`",n);return r===null?`${e}\nexport const __aihu_css__ = \`${n}\`\n`:r}function Y(e,t){if(!t.trim())return e;let n=Te(t),r=Ee(e,"__style__.replaceSync(`","`);",n);if(r!==null)return r;let i=/defineComponent\(\s*\((__?[A-Za-z0-9_]+)\)\s*=>\s*\{/,a=i.exec(e);if(a==null)return e;let o=a[1]===`_ctx`?`ctx`:a[1],s=e.split(`
42
42
  `),c=-1;for(let e=s.length-1;e>=0;e--){let t=(s[e]??``).trim();if(t.startsWith(`import `)||t.startsWith(`import{`)){c=e;break}}let l=`const __style__ = new CSSStyleSheet();\n__style__.replaceSync(\`${n}\`);`;c===-1?s.unshift(l):s.splice(c+1,0,l);let u=s.join(`
43
- `);return u=u.replace(i,`defineComponent((${o}) => {\n (${o}.host as ShadowRoot).adoptedStyleSheets = [__style__];`),u}const De=`\0virtual:aihu-utility/`;function Oe(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t}function ke(e){return Oe(e).toString(36)}function Ae(e){return Oe(e).toString(16).padStart(8,`0`)}function je(e,t,n){if(!t.trim())return null;let r=ke(n),i=`${De}${r}.css`;return{code:`import ${JSON.stringify(i)};\n`+e,virtualId:i}}function Me(e,n,i){let a=[`--stdin`,`--tag`,n?r(n,`.aihu`):`Component`,`--sidecar-stdout`];n&&a.push(`--path`,n),i?.strictTemplates&&a.push(`--strict-templates`),i?.target&&a.push(`--target`,i.target);let o=z(),s=Date.now();try{return t(o,a,{input:e,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`],...T(e.length)})}catch(t){throw E(t,o,a,e.length,Date.now()-s)??t}}function Ne(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--ast-json`];t&&i.push(`--path`,t);let a=k(),o=L(`ast`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`ast`]});if(r.kind===`legacy`)return r.output;let a=r.envelope.astJson;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing astJson`);return a});return JSON.parse(o)}function Pe(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--route-json`];t&&i.push(`--path`,t);let a=k(),o=L(`route`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`route`]});return r.kind===`legacy`?r.output:r.envelope.routeJson??`null`}).trim();return o===``||o===`null`?null:JSON.parse(o)}function Z(e){let t;t=e.includes(`from '@aihu/arbor'`)?e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}):`import { mount } from '@aihu/arbor'\n${e}`,/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)?t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/signals'/,(e,t)=>{if(e.startsWith(`import type`))return e;let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`signal`)||n.push(`signal`),`import { ${n.join(`, `)} } from '@aihu/signals'`}):/^[^\S\n]*import\b[^\n]*from[^\S\n]*'@aihu\/signals'/m.test(t)?/import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)&&!t.match(/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/)&&(t=t.replace(/(import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals')/,(e,t)=>`${t}\nimport { signal } from '@aihu/signals'`)):t=t.replace(/import\s*\{[^{}]*\}\s*from\s*'@aihu\/arbor'/,e=>`${e}\nimport { signal } from '@aihu/signals'`),t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_setMount`)||n.push(`_setMount`),n.includes(`_setSignal`)||n.push(`_setSignal`),`import { ${n.join(`, `)} } from '@aihu/runtime'`});let n=t.split(`
43
+ `);return u=u.replace(i,`defineComponent((${o}) => {\n (${o}.host as ShadowRoot).adoptedStyleSheets = [__style__];`),u}const Oe=`\0virtual:aihu-utility/`;function ke(e){let t=5381;for(let n=0;n<e.length;n++)t=(t*33^e.charCodeAt(n))>>>0;return t}function Ae(e){return ke(e).toString(36)}function je(e){return ke(e).toString(16).padStart(8,`0`)}function X(e,t,n){if(!t.trim())return null;let r=Ae(n),i=`${Oe}${r}.css`;return{code:`import ${JSON.stringify(i)};\n`+e,virtualId:i}}const Me=Y,Ne=X;function Pe(e,n,i){let a=[`--stdin`,`--tag`,n?r(n,`.aihu`):`Component`,`--sidecar-stdout`];n&&a.push(`--path`,n),i?.strictTemplates&&a.push(`--strict-templates`),i?.target&&a.push(`--target`,i.target);let o=R(),s=Date.now();try{return t(o,a,{input:e,encoding:`utf8`,stdio:[`pipe`,`pipe`,`pipe`],...T(e.length)})}catch(t){throw E(t,o,a,e.length,Date.now()-s)??t}}function Fe(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--ast-json`];t&&i.push(`--path`,t);let a=k(),o=I(`ast`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`ast`]});if(r.kind===`legacy`)return r.output;let a=r.envelope.astJson;if(a===void 0)throw Error(`[@aihu/compiler] envelope reply missing astJson`);return a});return JSON.parse(o)}function Ie(e,t){let n=t?r(t,`.aihu`):`Component`,i=[`--stdin`,`--tag`,n,`--route-json`];t&&i.push(`--path`,t);let a=k(),o=I(`route`,e,t??``,``,a,()=>{let r=j(e,i,{tag:n,...t?{path:t}:{},emits:[`route`]});return r.kind===`legacy`?r.output:r.envelope.routeJson??`null`}).trim();return o===``||o===`null`?null:JSON.parse(o)}function Z(e){let t;t=e.includes(`from '@aihu/arbor'`)?e.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/arbor'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`mount`)||n.push(`mount`),`import { ${n.join(`, `)} } from '@aihu/arbor'`}):`import { mount } from '@aihu/arbor'\n${e}`,/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)?t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/signals'/,(e,t)=>{if(e.startsWith(`import type`))return e;let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`signal`)||n.push(`signal`),`import { ${n.join(`, `)} } from '@aihu/signals'`}):/^[^\S\n]*import\b[^\n]*from[^\S\n]*'@aihu\/signals'/m.test(t)?/import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/.test(t)&&!t.match(/import\s+\{[^{}]*\}\s+from\s+'@aihu\/signals'/)&&(t=t.replace(/(import\s+type\s+\{[^{}]*\}\s+from\s+'@aihu\/signals')/,(e,t)=>`${t}\nimport { signal } from '@aihu/signals'`)):t=t.replace(/import\s*\{[^{}]*\}\s*from\s*'@aihu\/arbor'/,e=>`${e}\nimport { signal } from '@aihu/signals'`),t=t.replace(/import\s*\{([^{}]*)\}\s*from\s*'@aihu\/runtime'/,(e,t)=>{let n=t.split(`,`).map(e=>e.trim()).filter(Boolean);return n.includes(`_setMount`)||n.push(`_setMount`),n.includes(`_setSignal`)||n.push(`_setSignal`),`import { ${n.join(`, `)} } from '@aihu/runtime'`});let n=t.split(`
44
44
  `),r=-1;for(let e=n.length-1;e>=0;e--){let t=(n[e]??``).trim();if(t.startsWith(`import `)||t.startsWith(`import{`)){r=e;break}}return r!==-1&&(n.splice(r+1,0,`_setMount(mount)`,`_setSignal(signal)`,``),t=n.join(`
45
- `)),t}let Q,Fe=!1;const $=`@aihu/css-engine`;async function Ie(){try{return await import($)}catch{try{let e=n(a(process.cwd(),`package.json`)).resolve($);return await import(c(e).href)}catch{return null}}}async function Le(e,t,n){if(Q===null)return``;if(process.env.AIHU_COMPILE_BIN==null)try{process.env.AIHU_COMPILE_BIN=z()}catch{}if(Q===void 0&&(Q=await Ie(),Q===null))return``;try{return Q.compileSfc(e,t,n)}catch(e){if(!Fe){Fe=!0;let t=e instanceof Error?e.message:String(e);console.warn(`[@aihu/compiler] @aihu/css-engine is installed but compileSfc() failed; utility classes will not emit. Original error: ${t}\nHint: ensure the native css-core binary is installed (install/upgrade @aihu/css-engine + its per-platform optional dep, or run \`cargo build --release -p aihu-css-core\` in a dev clone).`)}return``}}function Re(e){let t=e?.islands!==!1,n=e?.shadowMode,i=e?.target,a=e?.layoutsDir??`src/layouts`,o=new Map,s=new Map;return{name:`aihu-compiler`,enforce:`pre`,buildEnd(){for(let e of fe(s))console.info(e)},resolveId(e){return e.startsWith(`\0virtual:aihu-utility/`)?e:null},load(e){return e.startsWith(`\0virtual:aihu-utility/`)?o.get(e)??null:null},transform(e,c){let l=c.split(`?`)[0];if(!l.endsWith(`.aihu`))return;let u=this?.environment?.config?.consumer===`server`,d=i??(u?`server`:void 0);return(async()=>{let i=ge(l,a),c=i?_e(r(l,`.aihu`)):void 0,f={...d?{target:d}:{},...c?{tag:c}:{}},p=Ce(e,l,f),m=de(p.code);m&&s.set(l,m);let h=/^\/\/ @aihu:shadow (light|shadow)\b/m.exec(p.code)?.[1],g=/^\/\/ @aihu:shadow-default (light|shadow)\b/m.exec(p.code)?.[1]??(i?`light`:void 0),_=h??n??g,v=_===`light`?Ae(l):void 0,y=_==null?p.code:B(p.code,_,v);v&&(y=V(y,v)),_===`light`&&(y=H(y)),i&&(y=ye(y));let b=await Le(e,l,v);if(b){if(_===`light`){let e=je(y,b,l);e&&(o.set(e.virtualId,b),y=e.code)}else y=X(y,b),u&&(y=Ee(y,b))}let x=pe(y),S,C=me(y);if(u){S=y,v&&(S+=`\nexport const __aihu_light_scope__ = '${v}'\n`),x!==null&&(S+=`\nexport const __aihu_tag__ = '${x}'\n`),_!=null&&(S+=`\nexport const __aihu_shadow__ = '${_}'\n`);let e=Y(S);e.length>0&&(S+=`\nexport const __aihu_child_tags__ = ${JSON.stringify(e)}\n`);let t=J(y);t.length>0&&(S+=`\nexport const __aihu_referenced_tags__ = ${JSON.stringify(t)}\n`)}else t&&x!==null&&!C&&_!==`light`&&U(y)===`static`?S=Se(y,x):x===null?(S=y,S=Z(S)):(S=be(y,x),S=xe(S,x),S=Z(S));let w;try{w=await import(`vite`)}catch(e){if(G(e))return{code:S,map:null};throw Error(`[@aihu/compiler] Could not load \`vite\` to strip TypeScript from ${l}. Vite appears to be installed but failed to load, so this is NOT the "running outside Vite" case and the TypeScript must not be handed back un-stripped. Underlying error: ${W(e)}`,{cause:e})}return await q(w,S,l,u)})()}}}export{De as VIRTUAL_UTILITY_PREFIX,oe as _MEMO_MAX_ENTRIES,xe as _buildDeferredHydration,Se as _buildStaticIsland,ce as _clearTransformMemo,j as _compileViaBackend,Y as _deriveChildTags,W as _errMessage,X as _foldCssEngineStyles,je as _foldCssEngineStylesGlobal,Ee as _foldSsrCssExport,fe as _formatExtractCensus,x as _getCompilerNativeStateKind,H as _globalizeAuthoredStyle,ke as _hashIdForUtilityCss,Z as _injectAutoWiring,V as _injectLightScopeId,B as _injectShadowMode,ge as _isLayoutFile,G as _isViteMissing,_e as _layoutTag,Ae as _lightScopeId,J as _parseComponentTagsMarker,de as _parseExtractMarker,U as _parseIslandMarker,ye as _passivizeOutlet,ie as _resetCompileBackend,S as _resetCompilerNative,O as _resolveCompileBackend,K as _stripFailure,q as _stripTypes,le as _transformMemoStats,Re as aihuCompilerPlugin,Pe as compileRouteMeta,Me as compileSidecar,Ne as compileToAst,ve as kebabComponentTag,b as loadCompilerNative,Ce as transform};
45
+ `)),t}let Q,Le=!1;const $=`@aihu/css-engine`;async function Re(){try{return await import($)}catch{try{let e=n(a(process.cwd(),`package.json`)).resolve($);return await import(c(e).href)}catch{return null}}}async function ze(e,t,n){if(Q===null)return``;if(process.env.AIHU_COMPILE_BIN==null)try{process.env.AIHU_COMPILE_BIN=R()}catch{}if(Q===void 0&&(Q=await Re(),Q===null))return``;try{return Q.compileSfc(e,t,n)}catch(e){if(!Le){Le=!0;let t=e instanceof Error?e.message:String(e);console.warn(`[@aihu/compiler] @aihu/css-engine is installed but compileSfc() failed; utility classes will not emit. Original error: ${t}\nHint: ensure the native css-core binary is installed (install/upgrade @aihu/css-engine + its per-platform optional dep, or run \`cargo build --release -p aihu-css-core\` in a dev clone).`)}return``}}async function Be(e,t){return e===void 0?ze(t.source,t.id,t.lightScopeId):await e(t)??``}function Ve(e){let t=e?.islands!==!1,n=e?.shadowMode,i=e?.cssProvider,a=e?.target,o=e?.layoutsDir??`src/layouts`,s=new Map,c=new Map;return{name:`aihu-compiler`,enforce:`pre`,buildEnd(){for(let e of pe(c))console.info(e)},resolveId(e){return e.startsWith(`\0virtual:aihu-utility/`)?e:null},load(e){return e.startsWith(`\0virtual:aihu-utility/`)?s.get(e)??null:null},transform(e,l){let u=l.split(`?`)[0];if(!u.endsWith(`.aihu`))return;let d=this?.environment?.config?.consumer===`server`,f=a??(d?`server`:void 0);return(async()=>{let a=_e(u,o),l=a?ve(r(u,`.aihu`)):void 0,p={...f?{target:f}:{},...l?{tag:l}:{}},m=we(e,u,p),h=fe(m.code);h&&c.set(u,h);let g=/^\/\/ @aihu:shadow (light|shadow)\b/m.exec(m.code)?.[1],_=/^\/\/ @aihu:shadow-default (light|shadow)\b/m.exec(m.code)?.[1]??(a?`light`:void 0),v=g??n??_,y=v??`shadow`,b=v===`light`?je(u):void 0,x=v==null?m.code:z(m.code,v,b);b&&(x=B(x,b)),v===`light`&&(x=V(x)),a&&(x=be(x));let S=await Be(i,{source:e,id:u,shadowMode:y,target:f??`universal`,...b?{lightScopeId:b}:{}});if(S){if(v===`light`){let e=X(x,S,u);e&&(s.set(e.virtualId,S),x=e.code)}else x=Y(x,S),d&&(x=De(x,S))}let C=me(x),w,T=he(x);if(d){w=x,b&&(w+=`\nexport const __aihu_light_scope__ = '${b}'\n`),C!==null&&(w+=`\nexport const __aihu_tag__ = '${C}'\n`),v!=null&&(w+=`\nexport const __aihu_shadow__ = '${v}'\n`);let e=J(w);e.length>0&&(w+=`\nexport const __aihu_child_tags__ = ${JSON.stringify(e)}\n`);let t=q(x);t.length>0&&(w+=`\nexport const __aihu_referenced_tags__ = ${JSON.stringify(t)}\n`)}else t&&C!==null&&!T&&v!==`light`&&H(x)===`static`?w=Ce(x,C):C===null?(w=x,w=Z(w)):(w=xe(x,C),w=Se(w,C),w=Z(w));let E;try{E=await import(`vite`)}catch(e){if(W(e))return{code:w,map:null};throw Error(`[@aihu/compiler] Could not load \`vite\` to strip TypeScript from ${u}. Vite appears to be installed but failed to load, so this is NOT the "running outside Vite" case and the TypeScript must not be handed back un-stripped. Underlying error: ${U(e)}`,{cause:e})}return await K(E,w,u,d)})()}}}export{Oe as VIRTUAL_UTILITY_PREFIX,oe as _MEMO_MAX_ENTRIES,Se as _buildDeferredHydration,Ce as _buildStaticIsland,le as _clearTransformMemo,j as _compileViaBackend,J as _deriveChildTags,U as _errMessage,Me as _foldCssEngineStyles,Ne as _foldCssEngineStylesGlobal,Y as _foldCssStyles,X as _foldCssStylesGlobal,De as _foldSsrCssExport,pe as _formatExtractCensus,x as _getCompilerNativeStateKind,V as _globalizeAuthoredStyle,Ae as _hashIdForUtilityCss,Z as _injectAutoWiring,B as _injectLightScopeId,z as _injectShadowMode,_e as _isLayoutFile,W as _isViteMissing,ve as _layoutTag,je as _lightScopeId,q as _parseComponentTagsMarker,fe as _parseExtractMarker,H as _parseIslandMarker,be as _passivizeOutlet,ie as _resetCompileBackend,S as _resetCompilerNative,O as _resolveCompileBackend,G as _stripFailure,K as _stripTypes,ue as _transformMemoStats,Ve as aihuCompilerPlugin,Ie as compileRouteMeta,Pe as compileSidecar,Fe as compileToAst,ye as kebabComponentTag,b as loadCompilerNative,e as resolveCompilerBinary,we as transform};
46
46
  //# sourceMappingURL=index.js.map