gemi 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gemi.js +1456 -5
- package/dist/bin/gemi.js.map +9 -5
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +1 -1
- package/dist/{chunk-msz8rngs.js → chunk-004bcmsa.js} +2 -2
- package/dist/chunk-004bcmsa.js.map +10 -0
- package/dist/chunk-07t0dmdg.js +4 -0
- package/dist/{chunk-faa987e4.js.map → chunk-07t0dmdg.js.map} +2 -2
- package/dist/{chunk-cg53h5ht.js → chunk-0weeq0ke.js} +2 -2
- package/dist/{chunk-cg53h5ht.js.map → chunk-0weeq0ke.js.map} +1 -1
- package/dist/chunk-113khwbw.js +5 -0
- package/dist/{chunk-2qn472j4.js.map → chunk-113khwbw.js.map} +1 -1
- package/dist/{chunk-tmk4zfz9.js → chunk-1sh6kqjn.js} +3 -3
- package/dist/{chunk-tmk4zfz9.js.map → chunk-1sh6kqjn.js.map} +1 -1
- package/dist/{chunk-2gw6cyyj.js → chunk-1snh7yc4.js} +2 -2
- package/dist/{chunk-2gw6cyyj.js.map → chunk-1snh7yc4.js.map} +1 -1
- package/dist/chunk-26r8dcxd.js +6 -0
- package/dist/{chunk-ffre1z8s.js.map → chunk-26r8dcxd.js.map} +2 -2
- package/dist/{chunk-ebcgdv00.js → chunk-2pt6kyn9.js} +3 -3
- package/dist/{chunk-ebcgdv00.js.map → chunk-2pt6kyn9.js.map} +1 -1
- package/dist/{chunk-1pqfmw5h.js → chunk-2zmz3pjk.js} +3 -3
- package/dist/{chunk-1pqfmw5h.js.map → chunk-2zmz3pjk.js.map} +1 -1
- package/dist/{chunk-zhsaz9cr.js → chunk-3bw1jk21.js} +1 -1
- package/dist/chunk-4qkzdyj7.js +4 -0
- package/dist/{chunk-0h3jr9d9.js.map → chunk-4qkzdyj7.js.map} +1 -1
- package/dist/{chunk-d1ahbza9.js → chunk-50vm7x98.js} +3 -3
- package/dist/{chunk-d1ahbza9.js.map → chunk-50vm7x98.js.map} +1 -1
- package/dist/{chunk-qyaqg07q.js → chunk-6j1z2cqt.js} +2 -2
- package/dist/{chunk-qyaqg07q.js.map → chunk-6j1z2cqt.js.map} +1 -1
- package/dist/chunk-6rhebm18.js +5 -0
- package/dist/chunk-6rhebm18.js.map +10 -0
- package/dist/{chunk-rq770c71.js → chunk-71m47kad.js} +2 -2
- package/dist/{chunk-rq770c71.js.map → chunk-71m47kad.js.map} +1 -1
- package/dist/{chunk-0h3jr9d9.js → chunk-7f5ad759.js} +2 -2
- package/dist/{chunk-4e61qbp4.js.map → chunk-7f5ad759.js.map} +1 -1
- package/dist/chunk-85av4ncy.js +4 -0
- package/dist/{chunk-3d3nmr5g.js.map → chunk-85av4ncy.js.map} +2 -2
- package/dist/{chunk-23g7qdpg.js → chunk-9taz1h3t.js} +3 -3
- package/dist/{chunk-23g7qdpg.js.map → chunk-9taz1h3t.js.map} +1 -1
- package/dist/{chunk-ppt296ye.js → chunk-agabw2w1.js} +2 -2
- package/dist/{chunk-ppt296ye.js.map → chunk-agabw2w1.js.map} +1 -1
- package/dist/{chunk-092pj2j2.js → chunk-bb3zvxsf.js} +3 -3
- package/dist/{chunk-092pj2j2.js.map → chunk-bb3zvxsf.js.map} +1 -1
- package/dist/{chunk-h7jv3ame.js → chunk-br8ten26.js} +2 -2
- package/dist/{chunk-h7jv3ame.js.map → chunk-br8ten26.js.map} +1 -1
- package/dist/{chunk-4e61qbp4.js → chunk-bzhtymvv.js} +2 -2
- package/dist/{chunk-8p6rqegw.js.map → chunk-bzhtymvv.js.map} +1 -1
- package/dist/{chunk-68w225rv.js → chunk-c0wcsmpj.js} +2 -2
- package/dist/{chunk-68w225rv.js.map → chunk-c0wcsmpj.js.map} +1 -1
- package/dist/{chunk-xsmt86n3.js → chunk-c22vcxty.js} +2 -2
- package/dist/{chunk-xsmt86n3.js.map → chunk-c22vcxty.js.map} +1 -1
- package/dist/{chunk-07jtzbf0.js → chunk-c2pv3ah8.js} +2 -2
- package/dist/{chunk-07jtzbf0.js.map → chunk-c2pv3ah8.js.map} +2 -2
- package/dist/{chunk-q09mmr05.js → chunk-cz3szqhq.js} +2 -2
- package/dist/{chunk-q09mmr05.js.map → chunk-cz3szqhq.js.map} +1 -1
- package/dist/{chunk-69w4egkg.js → chunk-dwx2y7br.js} +4 -4
- package/dist/{chunk-69w4egkg.js.map → chunk-dwx2y7br.js.map} +1 -1
- package/dist/{chunk-2sfz64xh.js → chunk-dxw8k6f1.js} +2 -2
- package/dist/{chunk-2sfz64xh.js.map → chunk-dxw8k6f1.js.map} +1 -1
- package/dist/chunk-e3mggavt.js +5 -0
- package/dist/chunk-e3mggavt.js.map +11 -0
- package/dist/{chunk-j1knf8gv.js → chunk-efsk1wy0.js} +3 -3
- package/dist/{chunk-j1knf8gv.js.map → chunk-efsk1wy0.js.map} +1 -1
- package/dist/{chunk-t4n25km9.js → chunk-f13f68c0.js} +2 -2
- package/dist/{chunk-t4n25km9.js.map → chunk-f13f68c0.js.map} +1 -1
- package/dist/{chunk-vv72kw74.js → chunk-f418jh9k.js} +2 -2
- package/dist/{chunk-vv72kw74.js.map → chunk-f418jh9k.js.map} +1 -1
- package/dist/chunk-f4e7fh95.js +17 -0
- package/dist/chunk-f4e7fh95.js.map +14 -0
- package/dist/{chunk-ewgv1j8q.js → chunk-fcqc3e3r.js} +2 -2
- package/dist/{chunk-ewgv1j8q.js.map → chunk-fcqc3e3r.js.map} +1 -1
- package/dist/{chunk-3y9nf09k.js → chunk-g5tj10p8.js} +2 -2
- package/dist/{chunk-3y9nf09k.js.map → chunk-g5tj10p8.js.map} +1 -1
- package/dist/chunk-gn9zjgep.js +5 -0
- package/dist/chunk-gn9zjgep.js.map +10 -0
- package/dist/{chunk-5s45prj5.js → chunk-h7mcwfg5.js} +4 -4
- package/dist/{chunk-5s45prj5.js.map → chunk-h7mcwfg5.js.map} +1 -1
- package/dist/chunk-hk067634.js +4 -0
- package/dist/{chunk-vnjvd82s.js.map → chunk-hk067634.js.map} +2 -2
- package/dist/{chunk-qx6sahe0.js → chunk-hrrmxreg.js} +2 -2
- package/dist/{chunk-qx6sahe0.js.map → chunk-hrrmxreg.js.map} +1 -1
- package/dist/{chunk-p22rkf1g.js → chunk-jb022m7n.js} +2 -2
- package/dist/{chunk-p22rkf1g.js.map → chunk-jb022m7n.js.map} +1 -1
- package/dist/chunk-jb2nst6v.js +4 -0
- package/dist/{chunk-6scjrbw7.js.map → chunk-jb2nst6v.js.map} +2 -2
- package/dist/{chunk-kxzwem3g.js → chunk-jdgvdddd.js} +2 -2
- package/dist/{chunk-kxzwem3g.js.map → chunk-jdgvdddd.js.map} +1 -1
- package/dist/{chunk-2yth3kk2.js → chunk-jp4pf3yt.js} +4 -4
- package/dist/{chunk-2yth3kk2.js.map → chunk-jp4pf3yt.js.map} +1 -1
- package/dist/chunk-k14dmqwh.js +5 -0
- package/dist/{chunk-92793zh4.js.map → chunk-k14dmqwh.js.map} +4 -3
- package/dist/{chunk-tkv6cw94.js → chunk-k8endm5j.js} +3 -3
- package/dist/{chunk-tkv6cw94.js.map → chunk-k8endm5j.js.map} +1 -1
- package/dist/chunk-kkkqyvwv.js +81 -0
- package/dist/{chunk-ear03axe.js.map → chunk-kkkqyvwv.js.map} +7 -5
- package/dist/{chunk-cmq5t8p9.js → chunk-kv2ep453.js} +3 -3
- package/dist/{chunk-cmq5t8p9.js.map → chunk-kv2ep453.js.map} +1 -1
- package/dist/{chunk-z4q1ty6w.js → chunk-kz39hphm.js} +3 -3
- package/dist/{chunk-z4q1ty6w.js.map → chunk-kz39hphm.js.map} +1 -1
- package/dist/{chunk-kaxvw75w.js → chunk-ms8qd7da.js} +3 -3
- package/dist/{chunk-kaxvw75w.js.map → chunk-ms8qd7da.js.map} +1 -1
- package/dist/{chunk-ttzkn1qd.js → chunk-n1tkn8gv.js} +2 -2
- package/dist/{chunk-ttzkn1qd.js.map → chunk-n1tkn8gv.js.map} +1 -1
- package/dist/chunk-nncwsdzz.js +5 -0
- package/dist/chunk-nncwsdzz.js.map +10 -0
- package/dist/{chunk-7s1g3v1y.js → chunk-pgjk5ft3.js} +3 -3
- package/dist/{chunk-7s1g3v1y.js.map → chunk-pgjk5ft3.js.map} +1 -1
- package/dist/{chunk-tztqkat2.js → chunk-r06rxn19.js} +2 -2
- package/dist/{chunk-tztqkat2.js.map → chunk-r06rxn19.js.map} +1 -1
- package/dist/chunk-r9z5rrk0.js +4 -0
- package/dist/{chunk-1ab1ptq5.js.map → chunk-r9z5rrk0.js.map} +2 -2
- package/dist/{chunk-h5g05qwb.js → chunk-s6e7cvek.js} +2 -2
- package/dist/{chunk-h5g05qwb.js.map → chunk-s6e7cvek.js.map} +1 -1
- package/dist/{chunk-qjnv2rkh.js → chunk-sqp7kn7h.js} +3 -3
- package/dist/{chunk-qjnv2rkh.js.map → chunk-sqp7kn7h.js.map} +1 -1
- package/dist/{chunk-mt2755rs.js → chunk-w6gb9gc5.js} +3 -3
- package/dist/{chunk-mt2755rs.js.map → chunk-w6gb9gc5.js.map} +1 -1
- package/dist/{chunk-ha7n1c94.js → chunk-xxw0gz4q.js} +2 -2
- package/dist/{chunk-ha7n1c94.js.map → chunk-xxw0gz4q.js.map} +1 -1
- package/dist/chunk-ywr2vd5r.js +5 -0
- package/dist/{chunk-9279y4af.js.map → chunk-ywr2vd5r.js.map} +2 -2
- package/dist/{chunk-fbp5vapa.js → chunk-zckj6bs6.js} +3 -3
- package/dist/{chunk-fbp5vapa.js.map → chunk-zckj6bs6.js.map} +2 -2
- package/dist/chunks/{ThemeProvider-CTX9LOFC.js → ThemeProvider-Bk1eZymb.js} +186 -3
- package/dist/chunks/ThemeProvider-Bk1eZymb.js.map +1 -0
- package/dist/client/ComponentContext.d.ts.map +1 -1
- package/dist/client/DictionarySinkContext.d.ts +10 -0
- package/dist/client/DictionarySinkContext.d.ts.map +1 -0
- package/dist/client/createRoot.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +187 -8
- package/dist/client/index.js.map +1 -1
- package/dist/client/useDictionary.d.ts +34 -0
- package/dist/client/useDictionary.d.ts.map +1 -0
- package/dist/client/useDictionary.test-d.d.ts +2 -0
- package/dist/client/useDictionary.test-d.d.ts.map +1 -0
- package/dist/client/useTranslator.d.ts +8 -0
- package/dist/client/useTranslator.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Lang.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/Dictionary.d.ts +7 -0
- package/dist/i18n/Dictionary.d.ts.map +1 -1
- package/dist/i18n/Translator.d.ts +12 -0
- package/dist/i18n/Translator.d.ts.map +1 -1
- package/dist/i18n/config.d.ts +6 -0
- package/dist/i18n/config.d.ts.map +1 -1
- package/dist/i18n/defineDictionary.d.ts +65 -0
- package/dist/i18n/defineDictionary.d.ts.map +1 -0
- package/dist/i18n/dictionaryRegistry.d.ts +85 -0
- package/dist/i18n/dictionaryRegistry.d.ts.map +1 -0
- package/dist/i18n/dictionaryRuntime.d.ts +16 -0
- package/dist/i18n/dictionaryRuntime.d.ts.map +1 -0
- package/dist/i18n/dictionaryRuntime.js +4 -0
- package/dist/i18n/dictionaryRuntime.js.map +9 -0
- package/dist/i18n/dictionaryShape.d.ts +66 -0
- package/dist/i18n/dictionaryShape.d.ts.map +1 -0
- package/dist/i18n/dictionarySink.d.ts +31 -0
- package/dist/i18n/dictionarySink.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +5 -4
- package/dist/i18n/translate.d.ts +21 -0
- package/dist/i18n/translate.d.ts.map +1 -0
- package/dist/internal/gemiExternals.d.ts +1 -1
- package/dist/internal/gemiExternals.d.ts.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +4 -4
- package/dist/services/index.js.map +2 -2
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/streamQueryInjection.d.ts +9 -1
- package/dist/services/router/streamQueryInjection.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/vite/__vite-browser-external-S5EYS4bz.mjs +7 -0
- package/dist/vite/api_vite-DSBC5Nzy.mjs +5 -0
- package/dist/vite/browser-DFEUWTkA.mjs +6086 -0
- package/dist/vite/build-C0lmnz6d.mjs +5326 -0
- package/dist/vite/index.mjs +1349 -1
- package/dist/vite/lib-TT6NqN6b.mjs +363 -0
- package/dist/vite/lib-U4DF62jt.mjs +48846 -0
- package/dist/vite/main-Drp2rSLR.mjs +2123 -0
- package/dist/vite/node-BgyIm-M7.mjs +17799 -0
- package/dist/vite/node-yGkKTK1d.mjs +789 -0
- package/dist/vite/postcss-hCXrlC4m.mjs +3515 -0
- package/dist/vite/postcss-import-rYEe0OKc.mjs +448 -0
- package/dist/vite/prompt--dNycKSZ-BmZ8jzP_.mjs +889 -0
- package/dist/vite/rolldown-runtime-B4lejLz5.mjs +37 -0
- package/package.json +3 -1
- package/dist/chunk-1ab1ptq5.js +0 -4
- package/dist/chunk-2qn472j4.js +0 -5
- package/dist/chunk-3d3nmr5g.js +0 -4
- package/dist/chunk-6scjrbw7.js +0 -4
- package/dist/chunk-88pq4gmf.js +0 -5
- package/dist/chunk-88pq4gmf.js.map +0 -10
- package/dist/chunk-8p6rqegw.js +0 -4
- package/dist/chunk-92793zh4.js +0 -5
- package/dist/chunk-9279y4af.js +0 -5
- package/dist/chunk-bq4w14a6.js +0 -5
- package/dist/chunk-bq4w14a6.js.map +0 -10
- package/dist/chunk-ear03axe.js +0 -81
- package/dist/chunk-faa987e4.js +0 -4
- package/dist/chunk-ffre1z8s.js +0 -6
- package/dist/chunk-msz8rngs.js.map +0 -10
- package/dist/chunk-vnjvd82s.js +0 -4
- package/dist/chunk-xw44bwnh.js +0 -5
- package/dist/chunk-xw44bwnh.js.map +0 -11
- package/dist/chunk-y4djde42.js +0 -5
- package/dist/chunk-y4djde42.js.map +0 -11
- package/dist/chunks/ThemeProvider-CTX9LOFC.js.map +0 -1
- /package/dist/{chunk-zhsaz9cr.js.map → chunk-3bw1jk21.js.map} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../internal/gemiExternals.ts", "../../../node_modules/.bun/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs", "../../../node_modules/.bun/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs", "../vite/dictionaryPlugin.ts", "../vite/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"// Single source of truth for keeping `gemi` external to the SSR view graph.\n//\n// `gemi` is a linked package, so a bundler will otherwise compile its own copy\n// of gemi's module-level singletons (`RouteStateContext`, `I18nContext`, the\n// `useLocale`/`useRouteData` hooks, ...) into the view chunks — a *different*\n// instance than the running server's `Root` provider, so `useRouteData()` reads\n// the empty default and SSR crashes on `i18n.currentLocale`. Externalizing makes\n// view imports of `gemi/*` resolve to the one Bun-loaded instance.\n//\n// Two consumers, two forms:\n// - dev (`server/httpDev.ts`): Vite's `ssr.external` matches EXACT specifiers\n// only (subpaths are not covered by the bare name, regexes are ignored), so\n// it needs the enumerated list below. When you add a `gemi/*` export that a\n// view may import, add it here too or dev SSR will silently bundle a copy.\n// - build (`vite/index.ts`): rollup's `external` is a subpath-aware predicate,\n// so it uses `isGemiExternal` and needs no maintenance for new subpaths.\n\n// Every `gemi` entrypoint a view module may import. Keep in sync with the\n// view-facing `exports` in package.json (build/server-only subpaths like\n// `vite`, `server`, `bun/*`, and `config` are intentionally omitted — views\n// never import them).\nexport const GEMI_EXTERNAL_SPECIFIERS = [\n \"gemi\",\n \"gemi/client\",\n \"gemi/http\",\n \"gemi/app\",\n \"gemi/facades\",\n \"gemi/email\",\n \"gemi/kernel\",\n \"gemi/services\",\n \"gemi/broadcasting\",\n \"gemi/i18n\",\n // Not optional: `defineDictionary` handles register themselves in a\n // module-level registry that the view router preloads and snapshots through.\n // A bundled second copy would give SSR two registries and empty payloads.\n \"gemi/dictionary\",\n] as const;\n\n// Predicate form for rollup's `external`: covers `gemi` and every `gemi/*`\n// subpath.\nexport function isGemiExternal(id: string): boolean {\n return id === \"gemi\" || id.startsWith(\"gemi/\");\n}\n",
|
|
6
|
+
"// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n",
|
|
7
|
+
"import { encode } from '@jridgewell/sourcemap-codec';\n\nclass BitSet {\n\tconstructor(arg) {\n\t\tthis.bits = arg instanceof BitSet ? arg.bits.slice() : [];\n\t}\n\n\tadd(n) {\n\t\tthis.bits[n >> 5] |= 1 << (n & 31);\n\t}\n\n\thas(n) {\n\t\treturn !!(this.bits[n >> 5] & (1 << (n & 31)));\n\t}\n}\n\nclass Chunk {\n\tconstructor(start, end, content) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.original = content;\n\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\n\t\tthis.content = content;\n\t\tthis.storeName = false;\n\t\tthis.edited = false;\n\n\t\t{\n\t\t\tthis.previous = null;\n\t\t\tthis.next = null;\n\t\t}\n\t}\n\n\tappendLeft(content) {\n\t\tthis.outro += content;\n\t}\n\n\tappendRight(content) {\n\t\tthis.intro = this.intro + content;\n\t}\n\n\tclone() {\n\t\tconst chunk = new Chunk(this.start, this.end, this.original);\n\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\n\t\treturn chunk;\n\t}\n\n\tcontains(index) {\n\t\treturn this.start < index && index < this.end;\n\t}\n\n\teachNext(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.next;\n\t\t}\n\t}\n\n\teachPrevious(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t}\n\n\tedit(content, storeName, contentOnly) {\n\t\tthis.content = content;\n\t\tif (!contentOnly) {\n\t\t\tthis.intro = '';\n\t\t\tthis.outro = '';\n\t\t}\n\t\tthis.storeName = storeName;\n\n\t\tthis.edited = true;\n\n\t\treturn this;\n\t}\n\n\tprependLeft(content) {\n\t\tthis.outro = content + this.outro;\n\t}\n\n\tprependRight(content) {\n\t\tthis.intro = content + this.intro;\n\t}\n\n\treset() {\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\t\tif (this.edited) {\n\t\t\tthis.content = this.original;\n\t\t\tthis.storeName = false;\n\t\t\tthis.edited = false;\n\t\t}\n\t}\n\n\tsplit(index) {\n\t\tconst sliceIndex = index - this.start;\n\n\t\tconst originalBefore = this.original.slice(0, sliceIndex);\n\t\tconst originalAfter = this.original.slice(sliceIndex);\n\n\t\tthis.original = originalBefore;\n\n\t\tconst newChunk = new Chunk(index, this.end, originalAfter);\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = '';\n\n\t\tthis.end = index;\n\n\t\tif (this.edited) {\n\t\t\t// after split we should save the edit content record into the correct chunk\n\t\t\t// to make sure sourcemap correct\n\t\t\t// For example:\n\t\t\t// ' test'.trim()\n\t\t\t// split -> ' ' + 'test'\n\t\t\t// ✔️ edit -> '' + 'test'\n\t\t\t// ✖️ edit -> 'test' + ''\n\t\t\t// TODO is this block necessary?...\n\t\t\tnewChunk.edit('', false);\n\t\t\tthis.content = '';\n\t\t} else {\n\t\t\tthis.content = originalBefore;\n\t\t}\n\n\t\tnewChunk.next = this.next;\n\t\tif (newChunk.next) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\n\t\treturn newChunk;\n\t}\n\n\ttoString() {\n\t\treturn this.intro + this.content + this.outro;\n\t}\n\n\ttrimEnd(rx) {\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tthis.split(this.start + trimmed.length).edit('', undefined, true);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tthis.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\tif (this.intro.length) return true;\n\t\t}\n\t}\n\n\ttrimStart(rx) {\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tconst newChunk = this.split(this.end - trimmed.length);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tnewChunk.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t\tthis.edit('', undefined, true);\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.outro = this.outro.replace(rx, '');\n\t\t\tif (this.outro.length) return true;\n\t\t}\n\t}\n}\n\nfunction getBtoa() {\n\tif (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {\n\t\treturn (str) => globalThis.btoa(unescape(encodeURIComponent(str)));\n\t} else if (typeof Buffer === 'function') {\n\t\treturn (str) => Buffer.from(str, 'utf-8').toString('base64');\n\t} else {\n\t\treturn () => {\n\t\t\tthrow new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');\n\t\t};\n\t}\n}\n\nconst btoa = /*#__PURE__*/ getBtoa();\n\nclass SourceMap {\n\tconstructor(properties) {\n\t\tthis.version = 3;\n\t\tthis.file = properties.file;\n\t\tthis.sources = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names = properties.names;\n\t\tthis.mappings = encode(properties.mappings);\n\t\tif (typeof properties.x_google_ignoreList !== 'undefined') {\n\t\t\tthis.x_google_ignoreList = properties.x_google_ignoreList;\n\t\t}\n\t\tif (typeof properties.debugId !== 'undefined') {\n\t\t\tthis.debugId = properties.debugId;\n\t\t}\n\t}\n\n\ttoString() {\n\t\treturn JSON.stringify(this);\n\t}\n\n\ttoUrl() {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());\n\t}\n}\n\nfunction guessIndent(code) {\n\tconst lines = code.split('\\n');\n\n\tconst tabbed = lines.filter((line) => /^\\t+/.test(line));\n\tconst spaced = lines.filter((line) => /^ {2,}/.test(line));\n\n\tif (tabbed.length === 0 && spaced.length === 0) {\n\t\treturn null;\n\t}\n\n\t// More lines tabbed than spaced? Assume tabs, and\n\t// default to tabs in the case of a tie (or nothing\n\t// to go on)\n\tif (tabbed.length >= spaced.length) {\n\t\treturn '\\t';\n\t}\n\n\t// Otherwise, we need to guess the multiple\n\tconst min = spaced.reduce((previous, current) => {\n\t\tconst numSpaces = /^ +/.exec(current)[0].length;\n\t\treturn Math.min(numSpaces, previous);\n\t}, Infinity);\n\n\treturn new Array(min + 1).join(' ');\n}\n\nfunction getRelativePath(from, to) {\n\tconst fromParts = from.split(/[/\\\\]/);\n\tconst toParts = to.split(/[/\\\\]/);\n\n\tfromParts.pop(); // get dirname\n\n\twhile (fromParts[0] === toParts[0]) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\n\tif (fromParts.length) {\n\t\tlet i = fromParts.length;\n\t\twhile (i--) fromParts[i] = '..';\n\t}\n\n\treturn fromParts.concat(toParts).join('/');\n}\n\nconst toString = Object.prototype.toString;\n\nfunction isObject(thing) {\n\treturn toString.call(thing) === '[object Object]';\n}\n\nfunction getLocator(source) {\n\tconst originalLines = source.split('\\n');\n\tconst lineOffsets = [];\n\n\tfor (let i = 0, pos = 0; i < originalLines.length; i++) {\n\t\tlineOffsets.push(pos);\n\t\tpos += originalLines[i].length + 1;\n\t}\n\n\treturn function locate(index) {\n\t\tlet i = 0;\n\t\tlet j = lineOffsets.length;\n\t\twhile (i < j) {\n\t\t\tconst m = (i + j) >> 1;\n\t\t\tif (index < lineOffsets[m]) {\n\t\t\t\tj = m;\n\t\t\t} else {\n\t\t\t\ti = m + 1;\n\t\t\t}\n\t\t}\n\t\tconst line = i - 1;\n\t\tconst column = index - lineOffsets[line];\n\t\treturn { line, column };\n\t};\n}\n\nconst wordRegex = /\\w/;\n\nclass Mappings {\n\tconstructor(hires) {\n\t\tthis.hires = hires;\n\t\tthis.generatedCodeLine = 0;\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.raw = [];\n\t\tthis.rawSegments = this.raw[this.generatedCodeLine] = [];\n\t\tthis.pending = null;\n\t}\n\n\taddEdit(sourceIndex, content, loc, nameIndex) {\n\t\tif (content.length) {\n\t\t\tconst contentLengthMinusOne = content.length - 1;\n\t\t\tlet contentLineEnd = content.indexOf('\\n', 0);\n\t\t\tlet previousContentLineEnd = -1;\n\t\t\t// Loop through each line in the content and add a segment, but stop if the last line is empty,\n\t\t\t// else code afterwards would fill one line too many\n\t\t\twhile (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\t\tif (nameIndex >= 0) {\n\t\t\t\t\tsegment.push(nameIndex);\n\t\t\t\t}\n\t\t\t\tthis.rawSegments.push(segment);\n\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\n\t\t\t\tpreviousContentLineEnd = contentLineEnd;\n\t\t\t\tcontentLineEnd = content.indexOf('\\n', contentLineEnd + 1);\n\t\t\t}\n\n\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\tif (nameIndex >= 0) {\n\t\t\t\tsegment.push(nameIndex);\n\t\t\t}\n\t\t\tthis.rawSegments.push(segment);\n\n\t\t\tthis.advance(content.slice(previousContentLineEnd + 1));\n\t\t} else if (this.pending) {\n\t\t\tthis.rawSegments.push(this.pending);\n\t\t\tthis.advance(content);\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\taddUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {\n\t\tlet originalCharIndex = chunk.start;\n\t\tlet first = true;\n\t\t// when iterating each char, check if it's in a word boundary\n\t\tlet charInHiresBoundary = false;\n\n\t\twhile (originalCharIndex < chunk.end) {\n\t\t\tif (original[originalCharIndex] === '\\n') {\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\t\t\t\tfirst = true;\n\t\t\t\tcharInHiresBoundary = false;\n\t\t\t} else {\n\t\t\t\tif (this.hires || first || sourcemapLocations.has(originalCharIndex)) {\n\t\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\n\t\t\t\t\tif (this.hires === 'boundary') {\n\t\t\t\t\t\t// in hires \"boundary\", group segments per word boundary than per char\n\t\t\t\t\t\tif (wordRegex.test(original[originalCharIndex])) {\n\t\t\t\t\t\t\t// for first char in the boundary found, start the boundary by pushing a segment\n\t\t\t\t\t\t\tif (!charInHiresBoundary) {\n\t\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\t\tcharInHiresBoundary = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// for non-word char, end the boundary by pushing a segment\n\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tloc.column += 1;\n\t\t\t\tthis.generatedCodeColumn += 1;\n\t\t\t\tfirst = false;\n\t\t\t}\n\n\t\t\toriginalCharIndex += 1;\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\tadvance(str) {\n\t\tif (!str) return;\n\n\t\tconst lines = str.split('\\n');\n\n\t\tif (lines.length > 1) {\n\t\t\tfor (let i = 0; i < lines.length - 1; i++) {\n\t\t\t\tthis.generatedCodeLine++;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t}\n\t\t\tthis.generatedCodeColumn = 0;\n\t\t}\n\n\t\tthis.generatedCodeColumn += lines[lines.length - 1].length;\n\t}\n}\n\nconst n = '\\n';\n\nconst warned = {\n\tinsertLeft: false,\n\tinsertRight: false,\n\tstoreName: false,\n};\n\nclass MagicString {\n\tconstructor(string, options = {}) {\n\t\tconst chunk = new Chunk(0, string.length, string);\n\n\t\tObject.defineProperties(this, {\n\t\t\toriginal: { writable: true, value: string },\n\t\t\toutro: { writable: true, value: '' },\n\t\t\tintro: { writable: true, value: '' },\n\t\t\tfirstChunk: { writable: true, value: chunk },\n\t\t\tlastChunk: { writable: true, value: chunk },\n\t\t\tlastSearchedChunk: { writable: true, value: chunk },\n\t\t\tbyStart: { writable: true, value: {} },\n\t\t\tbyEnd: { writable: true, value: {} },\n\t\t\tfilename: { writable: true, value: options.filename },\n\t\t\tindentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n\t\t\tsourcemapLocations: { writable: true, value: new BitSet() },\n\t\t\tstoredNames: { writable: true, value: {} },\n\t\t\tindentStr: { writable: true, value: undefined },\n\t\t\tignoreList: { writable: true, value: options.ignoreList },\n\t\t\toffset: { writable: true, value: options.offset || 0 },\n\t\t});\n\n\t\tthis.byStart[0] = chunk;\n\t\tthis.byEnd[string.length] = chunk;\n\t}\n\n\taddSourcemapLocation(char) {\n\t\tthis.sourcemapLocations.add(char);\n\t}\n\n\tappend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.outro += content;\n\t\treturn this;\n\t}\n\n\tappendLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendLeft(content);\n\t\t} else {\n\t\t\tthis.intro += content;\n\t\t}\n\t\treturn this;\n\t}\n\n\tappendRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendRight(content);\n\t\t} else {\n\t\t\tthis.outro += content;\n\t\t}\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });\n\n\t\tlet originalChunk = this.firstChunk;\n\t\tlet clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());\n\n\t\twhile (originalChunk) {\n\t\t\tcloned.byStart[clonedChunk.start] = clonedChunk;\n\t\t\tcloned.byEnd[clonedChunk.end] = clonedChunk;\n\n\t\t\tconst nextOriginalChunk = originalChunk.next;\n\t\t\tconst nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\n\t\t\tif (nextClonedChunk) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\n\t\tcloned.lastChunk = clonedChunk;\n\n\t\tif (this.indentExclusionRanges) {\n\t\t\tcloned.indentExclusionRanges = this.indentExclusionRanges.slice();\n\t\t}\n\n\t\tcloned.sourcemapLocations = new BitSet(this.sourcemapLocations);\n\n\t\tcloned.intro = this.intro;\n\t\tcloned.outro = this.outro;\n\n\t\treturn cloned;\n\t}\n\n\tgenerateDecodedMap(options) {\n\t\toptions = options || {};\n\n\t\tconst sourceIndex = 0;\n\t\tconst names = Object.keys(this.storedNames);\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tconst locate = getLocator(this.original);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.firstChunk.eachNext((chunk) => {\n\t\t\tconst loc = locate(chunk.start);\n\n\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tmappings.addEdit(\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tchunk.content,\n\t\t\t\t\tloc,\n\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);\n\t\t\t}\n\n\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t});\n\n\t\tif (this.outro) {\n\t\t\tmappings.advance(this.outro);\n\t\t}\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: [\n\t\t\t\toptions.source ? getRelativePath(options.file || '', options.source) : options.file || '',\n\t\t\t],\n\t\t\tsourcesContent: options.includeContent ? [this.original] : undefined,\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\t_ensureindentStr() {\n\t\tif (this.indentStr === undefined) {\n\t\t\tthis.indentStr = guessIndent(this.original);\n\t\t}\n\t}\n\n\t_getRawIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr;\n\t}\n\n\tgetIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr === null ? '\\t' : this.indentStr;\n\t}\n\n\tindent(indentStr, options) {\n\t\tconst pattern = /^[^\\r\\n]/gm;\n\n\t\tif (isObject(indentStr)) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = undefined;\n\t\t}\n\n\t\tif (indentStr === undefined) {\n\t\t\tthis._ensureindentStr();\n\t\t\tindentStr = this.indentStr || '\\t';\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\toptions = options || {};\n\n\t\t// Process exclusion ranges\n\t\tconst isExcluded = {};\n\n\t\tif (options.exclude) {\n\t\t\tconst exclusions =\n\t\t\t\ttypeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;\n\t\t\texclusions.forEach((exclusion) => {\n\t\t\t\tfor (let i = exclusion[0]; i < exclusion[1]; i += 1) {\n\t\t\t\t\tisExcluded[i] = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet shouldIndentNextCharacter = options.indentStart !== false;\n\t\tconst replacer = (match) => {\n\t\t\tif (shouldIndentNextCharacter) return `${indentStr}${match}`;\n\t\t\tshouldIndentNextCharacter = true;\n\t\t\treturn match;\n\t\t};\n\n\t\tthis.intro = this.intro.replace(pattern, replacer);\n\n\t\tlet charIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\n\t\twhile (chunk) {\n\t\t\tconst end = chunk.end;\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\tchunk.content = chunk.content.replace(pattern, replacer);\n\n\t\t\t\t\tif (chunk.content.length) {\n\t\t\t\t\t\tshouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\\n';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\t\tconst char = this.original[charIndex];\n\n\t\t\t\t\t\tif (char === '\\n') {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\t} else if (char !== '\\r' && shouldIndentNextCharacter) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = false;\n\n\t\t\t\t\t\t\tif (charIndex === chunk.start) {\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._splitChunk(chunk, charIndex);\n\t\t\t\t\t\t\t\tchunk = chunk.next;\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tthis.outro = this.outro.replace(pattern, replacer);\n\n\t\treturn this;\n\t}\n\n\tinsert() {\n\t\tthrow new Error(\n\t\t\t'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',\n\t\t);\n\t}\n\n\tinsertLeft(index, content) {\n\t\tif (!warned.insertLeft) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',\n\t\t\t);\n\t\t\twarned.insertLeft = true;\n\t\t}\n\n\t\treturn this.appendLeft(index, content);\n\t}\n\n\tinsertRight(index, content) {\n\t\tif (!warned.insertRight) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',\n\t\t\t);\n\t\t\twarned.insertRight = true;\n\t\t}\n\n\t\treturn this.prependRight(index, content);\n\t}\n\n\tmove(start, end, index) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tindex = index + this.offset;\n\n\t\tif (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tthis._split(index);\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tconst oldLeft = first.previous;\n\t\tconst oldRight = last.next;\n\n\t\tconst newRight = this.byStart[index];\n\t\tif (!newRight && last === this.lastChunk) return this;\n\t\tconst newLeft = newRight ? newRight.previous : this.lastChunk;\n\n\t\tif (oldLeft) oldLeft.next = oldRight;\n\t\tif (oldRight) oldRight.previous = oldLeft;\n\n\t\tif (newLeft) newLeft.next = first;\n\t\tif (newRight) newRight.previous = last;\n\n\t\tif (!first.previous) this.firstChunk = last.next;\n\t\tif (!last.next) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight || null;\n\n\t\tif (!newLeft) this.firstChunk = first;\n\t\tif (!newRight) this.lastChunk = last;\n\t\treturn this;\n\t}\n\n\toverwrite(start, end, content, options) {\n\t\toptions = options || {};\n\t\treturn this.update(start, end, content, { ...options, overwrite: !options.contentOnly });\n\t}\n\n\tupdate(start, end, content, options) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('replacement content must be a string');\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (end > this.original.length) throw new Error('end is out of bounds');\n\t\tif (start === end)\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',\n\t\t\t);\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tif (options === true) {\n\t\t\tif (!warned.storeName) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',\n\t\t\t\t);\n\t\t\t\twarned.storeName = true;\n\t\t\t}\n\n\t\t\toptions = { storeName: true };\n\t\t}\n\t\tconst storeName = options !== undefined ? options.storeName : false;\n\t\tconst overwrite = options !== undefined ? options.overwrite : false;\n\n\t\tif (storeName) {\n\t\t\tconst original = this.original.slice(start, end);\n\t\t\tObject.defineProperty(this.storedNames, original, {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tif (first) {\n\t\t\tlet chunk = first;\n\t\t\twhile (chunk !== last) {\n\t\t\t\tif (chunk.next !== this.byStart[chunk.end]) {\n\t\t\t\t\tthrow new Error('Cannot overwrite across a split point');\n\t\t\t\t}\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.edit('', false);\n\t\t\t}\n\n\t\t\tfirst.edit(content, storeName, !overwrite);\n\t\t} else {\n\t\t\t// must be inserting at the end\n\t\t\tconst newChunk = new Chunk(start, end, '').edit(content, storeName);\n\n\t\t\t// TODO last chunk in the array may not be the last chunk, if it's moved...\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\t\treturn this;\n\t}\n\n\tprepend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t}\n\n\tprependLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependLeft(content);\n\t\t} else {\n\t\t\tthis.intro = content + this.intro;\n\t\t}\n\t\treturn this;\n\t}\n\n\tprependRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependRight(content);\n\t\t} else {\n\t\t\tthis.outro = content + this.outro;\n\t\t}\n\t\treturn this;\n\t}\n\n\tremove(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.intro = '';\n\t\t\tchunk.outro = '';\n\t\t\tchunk.edit('');\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\t\treturn this;\n\t}\n\n\treset(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.reset();\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\t\treturn this;\n\t}\n\n\tlastChar() {\n\t\tif (this.outro.length) return this.outro[this.outro.length - 1];\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];\n\t\t\tif (chunk.content.length) return chunk.content[chunk.content.length - 1];\n\t\t\tif (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];\n\t\t} while ((chunk = chunk.previous));\n\t\tif (this.intro.length) return this.intro[this.intro.length - 1];\n\t\treturn '';\n\t}\n\n\tlastLine() {\n\t\tlet lineIndex = this.outro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.outro.substr(lineIndex + 1);\n\t\tlet lineStr = this.outro;\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length > 0) {\n\t\t\t\tlineIndex = chunk.outro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.outro + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.content.length > 0) {\n\t\t\t\tlineIndex = chunk.content.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.content + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.intro.length > 0) {\n\t\t\t\tlineIndex = chunk.intro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.intro + lineStr;\n\t\t\t}\n\t\t} while ((chunk = chunk.previous));\n\t\tlineIndex = this.intro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;\n\t\treturn this.intro + lineStr;\n\t}\n\n\tslice(start = 0, end = this.original.length - this.offset) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tlet result = '';\n\n\t\t// find start chunk\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk && (chunk.start > start || chunk.end <= start)) {\n\t\t\t// found end chunk before start\n\t\t\tif (chunk.start < end && chunk.end >= end) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tif (chunk && chunk.edited && chunk.start !== start)\n\t\t\tthrow new Error(`Cannot use replaced character ${start} as slice start anchor.`);\n\n\t\tconst startChunk = chunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro && (startChunk !== chunk || chunk.start === start)) {\n\t\t\t\tresult += chunk.intro;\n\t\t\t}\n\n\t\t\tconst containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif (containsEnd && chunk.edited && chunk.end !== end)\n\t\t\t\tthrow new Error(`Cannot use replaced character ${end} as slice end anchor.`);\n\n\t\t\tconst sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tconst sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\n\t\t\tresult += chunk.content.slice(sliceStart, sliceEnd);\n\n\t\t\tif (chunk.outro && (!containsEnd || chunk.end === end)) {\n\t\t\t\tresult += chunk.outro;\n\t\t\t}\n\n\t\t\tif (containsEnd) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// TODO deprecate this? not really very useful\n\tsnip(start, end) {\n\t\tconst clone = this.clone();\n\t\tclone.remove(0, start);\n\t\tclone.remove(end, clone.original.length);\n\n\t\treturn clone;\n\t}\n\n\t_split(index) {\n\t\tif (this.byStart[index] || this.byEnd[index]) return;\n\n\t\tlet chunk = this.lastSearchedChunk;\n\t\tlet previousChunk = chunk;\n\t\tconst searchForward = index > chunk.end;\n\n\t\twhile (chunk) {\n\t\t\tif (chunk.contains(index)) return this._splitChunk(chunk, index);\n\n\t\t\tchunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];\n\n\t\t\t// Prevent infinite loop (e.g. via empty chunks, where start === end)\n\t\t\tif (chunk === previousChunk) return;\n\n\t\t\tpreviousChunk = chunk;\n\t\t}\n\t}\n\n\t_splitChunk(chunk, index) {\n\t\tif (chunk.edited && chunk.content.length) {\n\t\t\t// zero-length edited chunks are a special case (overlapping replacements)\n\t\t\tconst loc = getLocator(this.original)(index);\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`,\n\t\t\t);\n\t\t}\n\n\t\tconst newChunk = chunk.split(index);\n\n\t\tthis.byEnd[index] = chunk;\n\t\tthis.byStart[index] = newChunk;\n\t\tthis.byEnd[newChunk.end] = newChunk;\n\n\t\tif (chunk === this.lastChunk) this.lastChunk = newChunk;\n\n\t\tthis.lastSearchedChunk = chunk;\n\t\treturn true;\n\t}\n\n\ttoString() {\n\t\tlet str = this.intro;\n\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn str + this.outro;\n\t}\n\n\tisEmpty() {\n\t\tlet chunk = this.firstChunk;\n\t\tdo {\n\t\t\tif (\n\t\t\t\t(chunk.intro.length && chunk.intro.trim()) ||\n\t\t\t\t(chunk.content.length && chunk.content.trim()) ||\n\t\t\t\t(chunk.outro.length && chunk.outro.trim())\n\t\t\t)\n\t\t\t\treturn false;\n\t\t} while ((chunk = chunk.next));\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\tlet chunk = this.firstChunk;\n\t\tlet length = 0;\n\t\tdo {\n\t\t\tlength += chunk.intro.length + chunk.content.length + chunk.outro.length;\n\t\t} while ((chunk = chunk.next));\n\t\treturn length;\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimEndAborted(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tlet chunk = this.lastChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimEnd(rx);\n\n\t\t\t// if chunk was trimmed, we have a new lastChunk\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (this.lastChunk === chunk) {\n\t\t\t\t\tthis.lastChunk = chunk.next;\n\t\t\t\t}\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.previous;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimEnd(charType) {\n\t\tthis.trimEndAborted(charType);\n\t\treturn this;\n\t}\n\ttrimStartAborted(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tlet chunk = this.firstChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimStart(rx);\n\n\t\t\tif (chunk.end !== end) {\n\t\t\t\t// special case...\n\t\t\t\tif (chunk === this.lastChunk) this.lastChunk = chunk.next;\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.next;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimStart(charType) {\n\t\tthis.trimStartAborted(charType);\n\t\treturn this;\n\t}\n\n\thasChanged() {\n\t\treturn this.original !== this.toString();\n\t}\n\n\t_replaceRegexp(searchValue, replacement) {\n\t\tfunction getReplacement(match, str) {\n\t\t\tif (typeof replacement === 'string') {\n\t\t\t\treturn replacement.replace(/\\$(\\$|&|\\d+)/g, (_, i) => {\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n\t\t\t\t\tif (i === '$') return '$';\n\t\t\t\t\tif (i === '&') return match[0];\n\t\t\t\t\tconst num = +i;\n\t\t\t\t\tif (num < match.length) return match[+i];\n\t\t\t\t\treturn `$${i}`;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn replacement(...match, match.index, str, match.groups);\n\t\t\t}\n\t\t}\n\t\tfunction matchAll(re, str) {\n\t\t\tlet match;\n\t\t\tconst matches = [];\n\t\t\twhile ((match = re.exec(str))) {\n\t\t\t\tmatches.push(match);\n\t\t\t}\n\t\t\treturn matches;\n\t\t}\n\t\tif (searchValue.global) {\n\t\t\tconst matches = matchAll(searchValue, this.original);\n\t\t\tmatches.forEach((match) => {\n\t\t\t\tif (match.index != null) {\n\t\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tconst match = this.original.match(searchValue);\n\t\t\tif (match && match.index != null) {\n\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t_replaceString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst index = original.indexOf(string);\n\n\t\tif (index !== -1) {\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\treplacement = replacement(string, index, original);\n\t\t\t}\n\t\t\tif (string !== replacement) {\n\t\t\t\tthis.overwrite(index, index + string.length, replacement);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplace(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceString(searchValue, replacement);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n\n\t_replaceAllString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst stringLength = string.length;\n\t\tfor (\n\t\t\tlet index = original.indexOf(string);\n\t\t\tindex !== -1;\n\t\t\tindex = original.indexOf(string, index + stringLength)\n\t\t) {\n\t\t\tconst previous = original.slice(index, index + stringLength);\n\t\t\tlet _replacement = replacement;\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\t_replacement = replacement(previous, index, original);\n\t\t\t}\n\t\t\tif (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplaceAll(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceAllString(searchValue, replacement);\n\t\t}\n\n\t\tif (!searchValue.global) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'MagicString.prototype.replaceAll called with a non-global RegExp argument',\n\t\t\t);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n}\n\nconst hasOwnProp = Object.prototype.hasOwnProperty;\n\nclass Bundle {\n\tconstructor(options = {}) {\n\t\tthis.intro = options.intro || '';\n\t\tthis.separator = options.separator !== undefined ? options.separator : '\\n';\n\t\tthis.sources = [];\n\t\tthis.uniqueSources = [];\n\t\tthis.uniqueSourceIndexByFilename = {};\n\t}\n\n\taddSource(source) {\n\t\tif (source instanceof MagicString) {\n\t\t\treturn this.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tfilename: source.filename,\n\t\t\t\tseparator: this.separator,\n\t\t\t});\n\t\t}\n\n\t\tif (!isObject(source) || !source.content) {\n\t\t\tthrow new Error(\n\t\t\t\t'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',\n\t\t\t);\n\t\t}\n\n\t\t['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => {\n\t\t\tif (!hasOwnProp.call(source, option)) source[option] = source.content[option];\n\t\t});\n\n\t\tif (source.separator === undefined) {\n\t\t\t// TODO there's a bunch of this sort of thing, needs cleaning up\n\t\t\tsource.separator = this.separator;\n\t\t}\n\n\t\tif (source.filename) {\n\t\t\tif (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({ filename: source.filename, content: source.content.original });\n\t\t\t} else {\n\t\t\t\tconst uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];\n\t\t\t\tif (source.content.original !== uniqueSource.content) {\n\t\t\t\t\tthrow new Error(`Illegal source: same filename (${source.filename}), different contents`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sources.push(source);\n\t\treturn this;\n\t}\n\n\tappend(str, options) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString(str),\n\t\t\tseparator: (options && options.separator) || '',\n\t\t});\n\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator,\n\t\t});\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tseparator: source.separator,\n\t\t\t});\n\t\t});\n\n\t\treturn bundle;\n\t}\n\n\tgenerateDecodedMap(options = {}) {\n\t\tconst names = [];\n\t\tlet x_google_ignoreList = undefined;\n\t\tthis.sources.forEach((source) => {\n\t\t\tObject.keys(source.content.storedNames).forEach((name) => {\n\t\t\t\tif (!~names.indexOf(name)) names.push(name);\n\t\t\t});\n\t\t});\n\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tif (i > 0) {\n\t\t\t\tmappings.advance(this.separator);\n\t\t\t}\n\n\t\t\tconst sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;\n\t\t\tconst magicString = source.content;\n\t\t\tconst locate = getLocator(magicString.original);\n\n\t\t\tif (magicString.intro) {\n\t\t\t\tmappings.advance(magicString.intro);\n\t\t\t}\n\n\t\t\tmagicString.firstChunk.eachNext((chunk) => {\n\t\t\t\tconst loc = locate(chunk.start);\n\n\t\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\t\tif (source.filename) {\n\t\t\t\t\tif (chunk.edited) {\n\t\t\t\t\t\tmappings.addEdit(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk.content,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmappings.addUneditedChunk(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk,\n\t\t\t\t\t\t\tmagicString.original,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tmagicString.sourcemapLocations,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmappings.advance(chunk.content);\n\t\t\t\t}\n\n\t\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t\t});\n\n\t\t\tif (magicString.outro) {\n\t\t\t\tmappings.advance(magicString.outro);\n\t\t\t}\n\n\t\t\tif (source.ignoreList && sourceIndex !== -1) {\n\t\t\t\tif (x_google_ignoreList === undefined) {\n\t\t\t\t\tx_google_ignoreList = [];\n\t\t\t\t}\n\t\t\t\tx_google_ignoreList.push(sourceIndex);\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.file ? getRelativePath(options.file, source.filename) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.includeContent ? source.content : null;\n\t\t\t}),\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\tgetIndentString() {\n\t\tconst indentStringCounts = {};\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tconst indentStr = source.content._getRawIndentString();\n\n\t\t\tif (indentStr === null) return;\n\n\t\t\tif (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;\n\t\t\tindentStringCounts[indentStr] += 1;\n\t\t});\n\n\t\treturn (\n\t\t\tObject.keys(indentStringCounts).sort((a, b) => {\n\t\t\t\treturn indentStringCounts[a] - indentStringCounts[b];\n\t\t\t})[0] || '\\t'\n\t\t);\n\t}\n\n\tindent(indentStr) {\n\t\tif (!arguments.length) {\n\t\t\tindentStr = this.getIndentString();\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\tlet trailingNewline = !this.intro || this.intro.slice(-1) === '\\n';\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\tconst indentStart = trailingNewline || (i > 0 && /\\r?\\n$/.test(separator));\n\n\t\t\tsource.content.indent(indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart, //: trailingNewline || /\\r?\\n$/.test( separator ) //true///\\r?\\n/.test( separator )\n\t\t\t});\n\n\t\t\ttrailingNewline = source.content.lastChar() === '\\n';\n\t\t});\n\n\t\tif (this.intro) {\n\t\t\tthis.intro =\n\t\t\t\tindentStr +\n\t\t\t\tthis.intro.replace(/^[^\\n]/gm, (match, index) => {\n\t\t\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprepend(str) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t}\n\n\ttoString() {\n\t\tconst body = this.sources\n\t\t\t.map((source, i) => {\n\t\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\t\tconst str = (i > 0 ? separator : '') + source.content.toString();\n\n\t\t\t\treturn str;\n\t\t\t})\n\t\t\t.join('');\n\n\t\treturn this.intro + body;\n\t}\n\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tif (this.sources.some((source) => !source.content.isEmpty())) return false;\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\treturn this.sources.reduce(\n\t\t\t(length, source) => length + source.content.length(),\n\t\t\tthis.intro.length,\n\t\t);\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimStart(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\t\tthis.intro = this.intro.replace(rx, '');\n\n\t\tif (!this.intro) {\n\t\t\tlet source;\n\t\t\tlet i = 0;\n\n\t\t\tdo {\n\t\t\t\tsource = this.sources[i++];\n\t\t\t\tif (!source) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (!source.content.trimStartAborted(charType));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\ttrimEnd(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tlet source;\n\t\tlet i = this.sources.length - 1;\n\n\t\tdo {\n\t\t\tsource = this.sources[i--];\n\t\t\tif (!source) {\n\t\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (!source.content.trimEndAborted(charType));\n\n\t\treturn this;\n\t}\n}\n\nexport { Bundle, SourceMap, MagicString as default };\n//# sourceMappingURL=magic-string.es.mjs.map\n",
|
|
8
|
+
"import MagicString from \"magic-string\";\nimport { parseAstAsync, type Plugin } from \"vite\";\nimport {\n dictionaryId,\n dictionaryLocales,\n findSourceDisagreement,\n localeStrings,\n type DictionaryTranslations,\n} from \"../i18n/dictionaryShape\";\n\n/**\n * Splits `defineDictionary({...})` literals into one chunk per locale.\n *\n * Authoring keeps every locale in one file next to the component. This rewrites\n * the call so the strings themselves leave the module entirely:\n *\n * const dict = defineDictionary({ title: { \"en-US\": \"Hi\", \"tr-TR\": \"Selam\" } })\n *\n * becomes\n *\n * const dict = __gemi_dict__(\"d_1a2b3c4d5e6f7081\", {\n * \"en-US\": () => import(\"virtual:gemi-dict/<src>/d_.../en-US\"),\n * \"tr-TR\": () => import(\"virtual:gemi-dict/<src>/d_.../tr-TR\"),\n * })\n *\n * An explicit map rather than a template-literal `import()`: the bundler sees\n * static specifiers, so it emits a real chunk per locale and module-preload\n * hints keep working. A page then downloads only the locale it renders in.\n *\n * This is purely an optimization. `defineDictionary` untransformed holds every\n * locale and answers synchronously, which is what keeps `bun test` and server\n * code that never meets the bundler working with no special casing.\n */\n\nconst VIRTUAL_PREFIX = \"virtual:gemi-dict/\";\nconst RESOLVED_PREFIX = \"\\0virtual:gemi-dict/\";\n\n/** Entrypoints that may export `defineDictionary`. */\nconst DICTIONARY_SOURCES = new Set([\"gemi/dictionary\", \"gemi/client\", \"gemi/i18n\"]);\n\n/** Where the rewritten call reads `__gemi_dict__` from.\n *\n * `gemi/dictionary` is a deliberately tiny entrypoint holding only the registry\n * and the handle factory: it is in `GEMI_EXTERNAL_SPECIFIERS`, so under SSR it\n * resolves to the server's own instance and the registry the view router\n * preloads through is the same one the views register into. Pointing this at a\n * bundled copy instead would give the server two registries.\n */\nconst RUNTIME_SOURCE = \"gemi/dictionary\";\n\ninterface Extracted {\n /** The runtime id — a content hash, identical to what `defineDictionary`\n * computes for the same literal, which is what lets the SSR payload seed the\n * client registry. */\n id: string;\n locales: string[];\n translations: DictionaryTranslations;\n}\n\nexport function gemiDictionaryPlugin(): Plugin {\n // virtual key -> extracted dictionary, populated by `transform` and read by\n // `load`. Keyed by the virtual key rather than the runtime id because the key\n // also carries the source module, which is what lets a cold `load` recover.\n //\n // Ordering holds in every mode: a bundler resolves a module's imports only\n // after transforming it, and the virtual specifiers do not exist until this\n // transform writes them. Vite keeps one plugin instance for the life of the\n // dev server (gemi reuses a single Vite instance across `bun --hot` reloads),\n // so the map outlives individual requests.\n const extracted = new Map<string, Extracted>();\n\n return {\n name: \"gemi-plugin-dictionary\",\n // After TS and JSX have been stripped: `parseAstAsync` is a JavaScript\n // parser, so this must not run `pre`.\n enforce: \"post\",\n\n resolveId(id) {\n if (id.startsWith(VIRTUAL_PREFIX)) {\n return `\\0${id}`;\n }\n return null;\n },\n\n async load(id) {\n if (!id.startsWith(RESOLVED_PREFIX)) {\n return null;\n }\n\n const rest = id.slice(RESOLVED_PREFIX.length);\n const slash = rest.lastIndexOf(\"/\");\n const virtualKey = rest.slice(0, slash);\n const locale = rest.slice(slash + 1);\n\n let entry = extracted.get(virtualKey);\n if (!entry) {\n // The parent module was transformed by an earlier process (a warm\n // on-disk cache) so this map never saw it. Force the parent back\n // through the pipeline, which repopulates the entry.\n const sourceId = decodeSourceId(virtualKey);\n if (sourceId) {\n try {\n await this.load({ id: sourceId });\n } catch {\n // Fall through to the error below, which says something useful.\n }\n entry = extracted.get(virtualKey);\n }\n }\n\n if (!entry) {\n this.error(\n `No dictionary registered for \"${virtualKey}\". If this persists, restart the dev server.`,\n );\n return null;\n }\n\n const strings = localeStrings(entry.translations, locale, entry.locales);\n return `export default ${JSON.stringify(strings)};\\n`;\n },\n\n async transform(code, id) {\n // Cheap gate — most modules never mention it.\n if (!code.includes(\"defineDictionary\")) {\n return null;\n }\n if (id.startsWith(\"\\0\") || id.includes(\"/node_modules/\")) {\n return null;\n }\n\n const ast = await parseAstAsync(code);\n\n const localNames = new Set<string>();\n for (const node of ast.body as any[]) {\n if (node.type !== \"ImportDeclaration\") continue;\n if (!DICTIONARY_SOURCES.has(node.source?.value)) continue;\n for (const spec of node.specifiers ?? []) {\n if (\n spec.type === \"ImportSpecifier\" &&\n spec.imported?.name === \"defineDictionary\"\n ) {\n localNames.add(spec.local.name);\n }\n }\n }\n const calls: any[] = [];\n let unresolved = 0;\n walk(ast, (node) => {\n if (node.type !== \"CallExpression\") return;\n const callee = node.callee;\n if (callee?.type === \"Identifier\" && localNames.has(callee.name)) {\n calls.push(node);\n return;\n }\n // A call that *looks* like one and did not resolve to a tracked import:\n // a namespace import (`gemi.defineDictionary(...)`), a re-export through\n // an app-local barrel, or a linked workspace package whose id this\n // skipped. Silently leaving those inline is the fail-open path\n // `readObjectLiteral` refuses to take — every locale would ship to every\n // visitor with no build signal that splitting had stopped applying.\n const name =\n callee?.type === \"Identifier\"\n ? callee.name\n : callee?.type === \"MemberExpression\" && !callee.computed\n ? callee.property?.name\n : undefined;\n if (name === \"defineDictionary\") {\n unresolved++;\n }\n });\n\n // An app is free to have a `defineDictionary` of its own; warning about\n // that would be noise, and noise is how a real warning gets ignored.\n if (unresolved > 0 && declaresOwn(ast, \"defineDictionary\")) {\n unresolved = 0;\n }\n\n if (unresolved > 0) {\n this.warn(\n `${id}: ${unresolved} defineDictionary() call(s) could not be traced to an import of \"gemi/dictionary\", \"gemi/client\" or \"gemi/i18n\", so their locales were left inline and will all ship to the browser. Import defineDictionary directly by name rather than through a namespace import or a local re-export.`,\n );\n }\n\n if (calls.length === 0) {\n return null;\n }\n\n const s = new MagicString(code);\n let rewrote = false;\n\n for (const call of calls) {\n if (call.arguments?.length < 1 || call.arguments?.length > 2) {\n this.error({\n message: `defineDictionary() takes an object literal and an optional options object.`,\n pos: call.start,\n });\n }\n\n const translations = readObjectLiteral(call.arguments[0], (message) =>\n this.error({ message, pos: call.arguments[0]?.start ?? call.start }),\n );\n\n // Read here as well as at runtime, because it decides the fallback\n // order baked into each per-locale chunk. If the two disagreed, a\n // bundled dictionary would fall back differently from the same literal\n // read directly by a controller.\n const sourceLocale = readSourceLocale(call.arguments[1], (message) =>\n this.error({ message, pos: call.arguments[1]?.start ?? call.start }),\n );\n\n const runtimeId = dictionaryId(translations);\n const virtualKey = `${Buffer.from(id).toString(\"base64url\")}/${runtimeId}`;\n const locales = dictionaryLocales(translations, sourceLocale);\n\n if (locales.length === 0) {\n this.error({\n message: `defineDictionary() declares no locales — every key needs at least one \"<locale>\": \"<string>\" entry.`,\n pos: call.start,\n });\n }\n\n // Refused rather than guessed. Without `sourceLocale` the fallback\n // language is whichever locale is seen first while reading the literal,\n // which is stable only while every key carries it. Once one does not,\n // adding a key at the top re-points every other key's fallback — a\n // dictionary-wide change in what language a reader sees, from a diff\n // that added one line, with nothing to notice it. Same reasoning as\n // `readObjectLiteral` below: the alternative to failing here is failing\n // silently in production.\n if (!sourceLocale) {\n const clash = findSourceDisagreement(translations);\n if (clash) {\n this.error({\n message:\n `defineDictionary() cannot infer a source language. Key \"${clash.againstKey}\" lists \"${clash.againstFirst}\" first ` +\n `but \"${clash.key}\" lists \"${clash.first}\" first, so the locale every key falls back to depends on the order ` +\n `they are written in — moving one key would change what language a reader sees. ` +\n `Pass { sourceLocale: \"<locale>\" } as the second argument to pin it.`,\n pos: call.start,\n });\n }\n }\n\n extracted.set(virtualKey, { id: runtimeId, locales, translations });\n\n const loaders = locales\n .map(\n (locale) =>\n `${JSON.stringify(locale)}:()=>import(${JSON.stringify(\n `${VIRTUAL_PREFIX}${virtualKey}/${locale}`,\n )})`,\n )\n .join(\",\");\n\n s.overwrite(\n call.start,\n call.end,\n `__gemi_dict__(${JSON.stringify(runtimeId)},{${loaders}})`,\n );\n rewrote = true;\n }\n\n if (!rewrote) {\n return null;\n }\n\n // Appended, not prepended: an `import` declaration is hoisted wherever it\n // sits, and keeping it off the top leaves every original line where it\n // was for the sourcemap.\n s.append(\n `\\nimport { __gemi_dict__ } from ${JSON.stringify(RUNTIME_SOURCE)};\\n`,\n );\n\n return { code: s.toString(), map: s.generateMap({ hires: true }) };\n },\n };\n}\n\n/**\n * The virtual key carries the source module alongside the content hash, so a\n * cold `load` can find its way back to the module that declared it.\n */\nfunction decodeSourceId(virtualKey: string): string | null {\n const slash = virtualKey.indexOf(\"/\");\n if (slash === -1) return null;\n try {\n return Buffer.from(virtualKey.slice(0, slash), \"base64url\").toString(\n \"utf8\",\n );\n } catch {\n return null;\n }\n}\n\n/**\n * A dictionary has to be readable at build time, so the literal must be fully\n * static. Anything else fails the build with the offending key named — a silent\n * fallback to \"leave this one un-split\" would ship every locale to the browser\n * and nobody would notice.\n */\nfunction readObjectLiteral(\n node: any,\n fail: (message: string) => never,\n): DictionaryTranslations {\n if (node?.type !== \"ObjectExpression\") {\n fail(\n `defineDictionary() needs an inline object literal — it is read at build time, so a variable or spread cannot be resolved.`,\n );\n }\n\n const out: DictionaryTranslations = {};\n for (const prop of node.properties) {\n const key = propertyName(prop);\n if (key === null) {\n fail(\n `defineDictionary() keys must be plain string keys — computed keys and spreads cannot be read at build time.`,\n );\n }\n if (prop.value?.type !== \"ObjectExpression\") {\n fail(\n `defineDictionary() entry \"${key}\" must be an object of \"<locale>\": \"<string>\" pairs.`,\n );\n }\n\n const byLocale: Record<string, string> = {};\n for (const localeProp of prop.value.properties) {\n const locale = propertyName(localeProp);\n if (locale === null) {\n fail(\n `defineDictionary() entry \"${key}\" has a locale key that cannot be read at build time.`,\n );\n }\n const value = localeProp.value;\n if (value?.type !== \"Literal\" || typeof value.value !== \"string\") {\n fail(\n `defineDictionary() entry \"${key}\" locale \"${locale}\" must be a string literal. Use {{param}} interpolation instead of a template literal or a function.`,\n );\n }\n byLocale[locale] = value.value;\n }\n out[key] = byLocale;\n }\n return out;\n}\n\n/** The `sourceLocale` from `defineDictionary`'s optional options argument. */\nfunction readSourceLocale(\n node: any,\n fail: (message: string) => never,\n): string | undefined {\n if (node === undefined) {\n return undefined;\n }\n if (node.type !== \"ObjectExpression\") {\n fail(\n `defineDictionary() options must be an inline object literal — it is read at build time.`,\n );\n }\n for (const prop of node.properties) {\n if (propertyName(prop) !== \"sourceLocale\") continue;\n const value = prop.value;\n if (value?.type !== \"Literal\" || typeof value.value !== \"string\") {\n fail(`defineDictionary() sourceLocale must be a string literal.`);\n }\n return value.value;\n }\n return undefined;\n}\n\n/** Whether the module declares `name` itself, rather than importing it. */\nfunction declaresOwn(ast: any, name: string): boolean {\n let found = false;\n walk(ast, (node) => {\n if (found) return;\n if (node.type === \"FunctionDeclaration\" && node.id?.name === name) {\n found = true;\n }\n if (node.type === \"VariableDeclarator\" && node.id?.name === name) {\n found = true;\n }\n });\n return found;\n}\n\nfunction propertyName(prop: any): string | null {\n if (prop?.type !== \"Property\" || prop.computed) return null;\n if (prop.key?.type === \"Identifier\") return prop.key.name;\n if (prop.key?.type === \"Literal\" && typeof prop.key.value === \"string\") {\n return prop.key.value;\n }\n return null;\n}\n\n/** Minimal ESTree walk — enough to find call expressions, no extra dependency. */\nfunction walk(node: any, visit: (node: any) => void) {\n if (node === null || typeof node !== \"object\") return;\n if (Array.isArray(node)) {\n for (const child of node) walk(child, visit);\n return;\n }\n if (typeof node.type === \"string\") {\n visit(node);\n }\n for (const key of Object.keys(node)) {\n if (key === \"parent\") continue;\n const value = (node as any)[key];\n if (value && typeof value === \"object\") {\n walk(value, visit);\n }\n }\n}\n",
|
|
9
|
+
"import type { PluginOption } from \"vite\";\nimport { loadGemiConfig } from \"../config/load\";\nimport { isGemiExternal } from \"../internal/gemiExternals\";\nimport { gemiDictionaryPlugin } from \"./dictionaryPlugin\";\n\n// Async so it can load `gemi.config.ts` before returning the plugin list. Both\n// consumers run under Bun (the CLI's `build()` and dev's `createServer`, spawned\n// via `bun`), so the config's TypeScript imports directly. Vite accepts a\n// `Promise<PluginOption[]>` as an entry in its `plugins` array, so gemi passes\n// `plugins: [gemi()]` itself — the app's own Vite plugins (e.g. React) come from\n// `gemi.config.ts` and are appended below, so there is no `vite.config.mjs`.\nconst gemi = async (): Promise<PluginOption[]> => {\n const userConfig = await loadGemiConfig(process.cwd());\n const { plugins: userVitePlugins = [], ...userViteConfig } =\n userConfig.vite ?? {};\n\n return [\n {\n name: \"gemi-plugin-config\",\n enforce: \"pre\",\n config: async (_config, env) => {\n const appPath = `${process.cwd()}/app`;\n return {\n assetsInclude: [\"/public\"],\n build: {\n manifest: true,\n ssrEmitAssets: true,\n // Emit source maps for both the client and SSR view builds so\n // browser devtools and server stack traces map back to app source.\n sourcemap: true,\n rollupOptions: {\n input: Array.from(JSON.parse(process.env.GEMI_INPUT ?? \"[]\")),\n // Each view is a build entry, but the app never imports them\n // statically — the client router pulls them in via `import.meta.glob`\n // (a runtime dynamic import). Rolldown's default entry-signature\n // handling therefore sees a view's `export default` as unused and\n // tree-shakes it. For a plain view the component is hoisted into the\n // shared bundle so it still renders, but a view with a module-scope\n // `lazy(() => import(...))` keeps its own chunk alive as a side\n // effect while the \"unused\" default export is dropped — leaving a\n // hollow chunk whose default is `undefined`. Hydration then renders\n // `<undefined/>` → React #306 and the whole page unmounts to blank.\n // `\"strict\"` forces every entry to preserve its exact exports (a\n // facade chunk is emitted if needed), so every view keeps its\n // default regardless of how the router loads it.\n preserveEntrySignatures: \"strict\",\n // For the SSR build, externalize `gemi` (a linked package) and all\n // its subpaths. Otherwise the bundler compiles its own copy of\n // gemi's module-level singletons (`RouteStateContext`,\n // `I18nContext`, the `useLocale`/`useRouteData` hooks, ...) into a\n // shared chunk — a *different* instance than the running server's\n // `Root` provider — so `useRouteData()` reads the empty default and\n // SSR crashes on `i18n.currentLocale`. Externalizing makes the\n // built view chunks `import ... from \"gemi/*\"` at runtime, resolving\n // to the one instance shared with the renderer. (Vite 8's\n // `ssr.external` does not externalize for the build, so this is done\n // at the rollup level.) Mirrors `server/httpDev.ts`'s dev config\n // via the shared `internal/gemiExternals` source of truth.\n ...(env.isSsrBuild ? { external: isGemiExternal } : {}),\n },\n },\n resolve: {\n alias: {\n \"@/app\": appPath,\n },\n },\n };\n },\n },\n // The app's `gemi.config.ts` `vite` config (minus `plugins`, which are\n // appended below) as its own `config` hook. Vite deep-merges every plugin's\n // `config` result, so the app config layers cleanly on top of gemi's base\n // without a manual merge (and without pulling `vite`'s `mergeConfig` into\n // this bundle).\n {\n name: \"gemi-plugin-user-config\",\n config: () => userViteConfig,\n },\n {\n name: \"gemi-plugin-hot-reload\",\n handleHotUpdate({ server, modules }) {\n if (modules?.[0]?.id?.includes(\"/app/http/\")) {\n // server.ws.send({\n // type: \"custom\",\n // event: \"http-reload\",\n // data: {\n // id: modules[0].id,\n // },\n // });\n\n return [];\n }\n },\n },\n // App-provided Vite plugins run after gemi's own.\n ...userVitePlugins,\n // Last, and `enforce: \"post\"` on top of that: it parses JavaScript, so TS\n // and JSX have to be gone by the time it sees a module.\n gemiDictionaryPlugin(),\n ];\n};\n\nexport default gemi;\n"
|
|
10
|
+
],
|
|
11
|
+
"mappings": ";2GAqBO,FAAM,GAA2B,CACtC,OACA,cACA,YACA,WACA,eACA,aACA,cACA,gBACA,oBACA,YAIA,iBACF,EAIO,SAAS,CAAc,CAAC,EAAqB,CAClD,OAAO,IAAO,QAAU,EAAG,WAAW,OAAO,ECxC/C,IAAI,EAAQ,GACR,EAAY,GACZ,EAAQ,mEACR,EAAY,IAAI,WAAW,EAAE,EAC7B,EAAY,IAAI,WAAW,GAAG,EAClC,QAAS,EAAI,EAAG,EAAI,EAAM,OAAQ,IAAK,CACrC,IAAM,EAAI,EAAM,WAAW,CAAC,EAC5B,EAAU,GAAK,EACf,EAAU,GAAK,EAmBjB,SAAS,CAAa,CAAC,EAAS,EAAK,EAAU,CAC7C,IAAI,EAAQ,EAAM,EAClB,EAAQ,EAAQ,EAAI,CAAC,GAAS,EAAI,EAAI,GAAS,EAC/C,EAAG,CACD,IAAI,EAAU,EAAQ,GAEtB,GADA,KAAW,EACP,EAAQ,EAAG,GAAW,GAC1B,EAAQ,MAAM,EAAU,EAAQ,QACzB,EAAQ,GACjB,OAAO,EAQT,IAAI,EAAY,MACZ,EAAK,OAAO,YAAgB,IAA8B,IAAI,YAAgB,OAAO,OAAW,IAAc,CAChH,MAAM,CAAC,EAAK,CAEV,OADY,OAAO,KAAK,EAAI,OAAQ,EAAI,WAAY,EAAI,UAAU,EACvD,SAAS,EAEx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AO,CACL,SAAU,GACV,cAAe,GAGf,UAAW,GACX,cAAe,CACb,MAAO,MAAM,KAAK,KAAK,MAAM,QAAQ,IAAI,YAAc,IAAI,CAAC,EAc5D,wBAAyB,YAarB,EAAI,WAAa,CAAE,SAAU,CAAe,EAAI,CAAC,CACvD,CACF,EACA,QAAS,CACP,MAAO,CACL,QAAS,CACX,CACF,CACF,EAEJ,EAMA,CACE,KAAM,0BACN,OAAQ,IAAM,CAChB,EACA,CACE,KAAM,yBACN,eAAe,EAAG,SAAQ,WAAW,CACnC,GAAI,IAAU,IAAI,IAAI,SAAS,YAAY,EASzC,MAAO,CAAC,EAGd,EAEA,GAAG,EAGH,EAAqB,CACvB,GAGa",
|
|
12
|
+
"debugId": "33BA1C41A141A92F64756E2164756E21",
|
|
13
|
+
"names": []
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
class B{kernel;onException;constructor(x){this.kernel=new x.kernel,this.kernel.boot.call(this.kernel),this.onException=x.onException??((A)=>{console.error("Unhandled exception in App:",A)})}async waitForBoot(){await this.kernel.waitForBoot()}getComponentTree(){return this.kernel.viewRoutes().componentTree}getFlatComponentTree(){return this.kernel.viewRoutes().flatComponentTree}getRouteManifest(){return this.kernel.viewRoutes().routeManifest}async fetch(x){let A=new URL(x.url);return this.kernel.run.call(this.kernel,async()=>{if(A.pathname.startsWith("/api"))return await this.kernel.apiRoutes().handleApiRequest(x);return await this.kernel.viewRoutes().handleViewRequest(x)})}websocket={message:(x,A)=>{this.kernel.run.bind(this.kernel)(()=>{let z=this.kernel.broadcast();z.run(x.data.headers,()=>{z.handleMessage(x,A)})})},open:(x)=>{},close:(x)=>{console.log("closed ws"),x.terminate()}};onPublish(x){this.kernel.run.bind(this.kernel)(()=>{this.kernel.broadcast().onPublish(x)})}dispatchJob(x,A){return this.kernel.run.bind(this.kernel)(()=>{return this.kernel.queue().dispatchJob(x,A)})}destroy(){this.kernel.destroy()}clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}}export{B as
|
|
2
|
+
class B{kernel;onException;constructor(x){this.kernel=new x.kernel,this.kernel.boot.call(this.kernel),this.onException=x.onException??((A)=>{console.error("Unhandled exception in App:",A)})}async waitForBoot(){await this.kernel.waitForBoot()}getComponentTree(){return this.kernel.viewRoutes().componentTree}getFlatComponentTree(){return this.kernel.viewRoutes().flatComponentTree}getRouteManifest(){return this.kernel.viewRoutes().routeManifest}async fetch(x){let A=new URL(x.url);return this.kernel.run.call(this.kernel,async()=>{if(A.pathname.startsWith("/api"))return await this.kernel.apiRoutes().handleApiRequest(x);return await this.kernel.viewRoutes().handleViewRequest(x)})}websocket={message:(x,A)=>{this.kernel.run.bind(this.kernel)(()=>{let z=this.kernel.broadcast();z.run(x.data.headers,()=>{z.handleMessage(x,A)})})},open:(x)=>{},close:(x)=>{console.log("closed ws"),x.terminate()}};onPublish(x){this.kernel.run.bind(this.kernel)(()=>{this.kernel.broadcast().onPublish(x)})}dispatchJob(x,A){return this.kernel.run.bind(this.kernel)(()=>{return this.kernel.queue().dispatchJob(x,A)})}destroy(){this.kernel.destroy()}clone(){return Object.assign(Object.create(Object.getPrototypeOf(this)),this)}}export{B as u};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=C228D5A79149BA1964756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import type { WebSocketHandler } from \"bun\";\nimport type { Kernel } from \"../kernel\";\n\ninterface AppParams {\n kernel: new () => Kernel;\n onException?: (error: Error) => void;\n}\n\nexport class App {\n private kernel: Kernel;\n public onException?: (error: Error) => void;\n\n constructor(params: AppParams) {\n this.kernel = new params.kernel();\n this.kernel.boot.call(this.kernel);\n this.onException =\n params.onException ??\n ((error: Error) => {\n console.error(\"Unhandled exception in App:\", error);\n });\n }\n\n // Every service this class touches is resolved through a `this.kernel.*`\n // accessor rather than by importing the service class and calling `app()`\n // here. That is deliberate: the built bin (`dist/bin/gemi.js`) bundles its own\n // copy of gemi, while the app's Kernel is loaded from source and resolves\n // `gemi/*` to the source modules — so the two copies have *different*\n // `kernelContext` AsyncLocalStorage instances and different `Application`\n // class objects. A method call on the Kernel executes in the app's copy and\n // reads the app's container; a resolution attempted here would not. Service\n // *tokens* still cross the boundary safely (they are plain strings), which is\n // why `kernel.resolve()` works from either side.\n public async waitForBoot() {\n await this.kernel.waitForBoot();\n }\n\n public getComponentTree() {\n return this.kernel.viewRoutes().componentTree;\n }\n\n public getFlatComponentTree() {\n return this.kernel.viewRoutes().flatComponentTree;\n }\n\n public getRouteManifest() {\n return this.kernel.viewRoutes().routeManifest;\n }\n\n public async fetch(req: Request): Promise<Response> {\n const url = new URL(req.url);\n return this.kernel.run.call(this.kernel, async () => {\n if (url.pathname.startsWith(\"/api\")) {\n return await this.kernel.apiRoutes().handleApiRequest(req);\n }\n return await this.kernel.viewRoutes().handleViewRequest(req);\n });\n }\n\n public websocket: WebSocketHandler<{ headers: Headers }> = {\n message: (ws, message) => {\n const kernelRun = this.kernel.run.bind(this.kernel);\n kernelRun(() => {\n const broadcast = this.kernel.broadcast();\n broadcast.run(ws.data.headers, () => {\n broadcast.handleMessage(ws, message);\n });\n });\n },\n open: (_ws) => {},\n close: (ws) => {\n console.log(\"closed ws\");\n ws.terminate();\n },\n };\n\n public onPublish(\n fn: (\n topic: string,\n data: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer,\n compress?: boolean,\n ) => void,\n ) {\n const kernelRun = this.kernel.run.bind(this.kernel);\n kernelRun(() => {\n this.kernel.broadcast().onPublish(fn);\n });\n }\n\n public dispatchJob(jobName: string, args: string) {\n const kernelRun = this.kernel.run.bind(this.kernel);\n return kernelRun(() => {\n return this.kernel.queue().dispatchJob(jobName, args);\n });\n }\n\n public destroy() {\n this.kernel.destroy();\n }\n\n public clone() {\n return Object.assign(Object.create(Object.getPrototypeOf(this)), this);\n }\n}\n\nexport type FetchHandler = InstanceType<typeof App>[\"fetch\"];\n"
|
|
6
6
|
],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AK,KAAK,MAAM,EACjC,IAAM,CACrB,OAAO,KAAK,OAAO,MAAM,EAAE,YAAY,EAAS,CAAI,EACrD,EAGI,OAAO,EAAG,CACf,KAAK,OAAO,QAAQ,EAGf,KAAK,EAAG,CACb,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,eAAe,IAAI,CAAC,EAAG,IAAI,EAEzE",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "C228D5A79149BA1964756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Shallow-merges an app config slice over the framework defaults, ignoring keys\n * whose value is `undefined`.\n *\n * A plain `{ ...defaults, ...config }` lets an explicit `undefined` win — a\n * `defineMailConfig({ headers: undefined })`, or any optional property the app\n * spread in from another object, would erase the default and hand the service a\n * missing dependency. Omitting a key and setting it to `undefined` mean the\n * same thing for a config slice, so both fall back to the default here.\n */\nexport function withDefaults<T extends object>(\n defaults: Required<T>,\n config: Partial<T> | undefined,\n): Required<T>;\nexport function withDefaults<D extends object, C extends object>(\n defaults: D,\n config: C | undefined,\n): D & C;\nexport function withDefaults(\n defaults: Record<string, any>,\n config: Record<string, any> | undefined,\n) {\n const merged: Record<string, any> = { ...defaults };\n if (!config) {\n return merged;\n }\n for (const key of Object.keys(config)) {\n if (config[key] !== undefined) {\n merged[key] = config[key];\n }\n }\n return merged;\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAkBO,SAAS,CAAY,CAC1B,EACA,EACA,CACA,IAAM,EAA8B,IAAK,CAAS,EAClD,GAAI,CAAC,EACH,OAAO,EAET,QAAW,KAAO,OAAO,KAAK,CAAM,EAClC,GAAI,EAAO,KAAS,OAClB,EAAO,GAAO,EAAO,GAGzB,OAAO",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "D887CC25B387885864756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function M(E,C){let A=[],q=new Set;if(C)q.add(C),A.push(C);for(let G of Object.values(E))for(let j of Object.keys(G))if(!q.has(j))q.add(j),A.push(j);return A}function Q(E,C,A=M(E)){let q={};for(let[G,j]of Object.entries(E)){let H=j?.[C];if(typeof H!=="string")for(let I of A){let J=j?.[I];if(typeof J==="string"){H=J;break}}if(typeof H==="string")q[G]=H}return q}function R(E){let C,A;for(let[q,G]of Object.entries(E)){let j=Object.keys(G??{})[0];if(j===void 0)continue;if(A===void 0){A=j,C=q;continue}if(j!==A)return{key:q,first:j,againstKey:C,againstFirst:A}}return null}function P(E){return`{${Object.keys(E).sort().map((q)=>{let G=E[q]??{},H=Object.keys(G).sort().map((I)=>JSON.stringify([I,G[I]])).join(",");return`${JSON.stringify(q)}:[${H}]`}).join(",")}}`}function S(E){let C=P(E),A=2166136261,q=16777619;for(let j=0;j<C.length;j++){let H=C.charCodeAt(j);A=Math.imul(A^H,16777619),q=Math.imul(q^H,2166136261)}let G=(j)=>(j>>>0).toString(16).padStart(8,"0");return`d_${G(A)}${G(q)}`}
|
|
3
|
+
export{M as n,Q as o,R as p,S as q};
|
|
4
|
+
|
|
5
|
+
//# debugId=EC63999FAEF8D81964756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../i18n/dictionaryShape.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * The one implementation of \"what is a dictionary literal, and what is its id\",\n * shared by the runtime (`defineDictionary`) and the Vite plugin.\n *\n * Both sides must agree exactly. A dictionary's id is a hash of its own\n * contents rather than of its file path, so a module that is bundled on one\n * side and evaluated raw on the other still lands on the same id — which is\n * what lets the SSR payload seed the client registry.\n */\n\nexport type DictionaryTranslations = Record<string, Record<string, string>>;\n\nexport type LocaleStrings = Record<string, string>;\n\n/**\n * Locales the dictionary declares, source language first.\n *\n * The order is meaningful: the first locale is the source language, and a key\n * missing from some other locale falls back along this list.\n *\n * `sourceLocale` pins that choice. Without it the source language is whichever\n * locale is seen first while walking the literal, which makes it an emergent\n * property of key order — adding a key at the top of a dictionary whose other\n * keys happen to lack `en-US` would silently re-point every fallback in it. Any\n * dictionary that is not uniformly translated should say which locale it is\n * authored in.\n */\nexport function dictionaryLocales(\n translations: DictionaryTranslations,\n sourceLocale?: string,\n): string[] {\n const locales: string[] = [];\n const seen = new Set<string>();\n if (sourceLocale) {\n seen.add(sourceLocale);\n locales.push(sourceLocale);\n }\n for (const byLocale of Object.values(translations)) {\n for (const locale of Object.keys(byLocale)) {\n if (!seen.has(locale)) {\n seen.add(locale);\n locales.push(locale);\n }\n }\n }\n return locales;\n}\n\n/**\n * Flatten one locale out of a dictionary.\n *\n * A key with no string for `locale` falls back along the declared locale order\n * rather than vanishing, so a half-translated dictionary degrades one string at\n * a time instead of rendering the whole component as raw keys.\n */\nexport function localeStrings(\n translations: DictionaryTranslations,\n locale: string,\n fallbackOrder: string[] = dictionaryLocales(translations),\n): LocaleStrings {\n const out: LocaleStrings = {};\n for (const [key, byLocale] of Object.entries(translations)) {\n let value = byLocale?.[locale];\n if (typeof value !== \"string\") {\n for (const candidate of fallbackOrder) {\n const fallback = byLocale?.[candidate];\n if (typeof fallback === \"string\") {\n value = fallback;\n break;\n }\n }\n }\n if (typeof value === \"string\") {\n out[key] = value;\n }\n }\n return out;\n}\n\nexport interface SourceDisagreement {\n key: string;\n first: string;\n againstKey: string;\n againstFirst: string;\n}\n\n/**\n * Whether the inferred source language survives reordering the literal.\n *\n * `dictionaryLocales` collects locales entry by entry, so `locales[0]` is the\n * first locale of the first entry. That is invariant under key reordering\n * exactly when every entry lists the same locale first — and order-dependent\n * the moment two entries disagree, because then whichever happens to be written\n * first decides what the *whole* dictionary falls back to. Adding one key at\n * the top can flip every other key's fallback language, from a diff that reads\n * as an addition.\n *\n * Returns the disagreement so the build can name both keys; `null` when the\n * inference is stable. `sourceLocale` settles it and makes the question moot.\n */\nexport function findSourceDisagreement(\n translations: DictionaryTranslations,\n): SourceDisagreement | null {\n let againstKey: string | undefined;\n let againstFirst: string | undefined;\n\n for (const [key, byLocale] of Object.entries(translations)) {\n const first = Object.keys(byLocale ?? {})[0];\n // A key with no locales at all is a different problem, reported elsewhere.\n if (first === undefined) continue;\n\n if (againstFirst === undefined) {\n againstFirst = first;\n againstKey = key;\n continue;\n }\n if (first !== againstFirst) {\n return { key, first, againstKey: againstKey!, againstFirst };\n }\n }\n return null;\n}\n\n/**\n * Canonical serialization — key order in the source file must not change the\n * id, or an innocuous reordering would break the payload/registry match.\n */\nexport function canonicalizeDictionary(\n translations: DictionaryTranslations,\n): string {\n const keys = Object.keys(translations).sort();\n const parts = keys.map((key) => {\n const byLocale = translations[key] ?? {};\n const locales = Object.keys(byLocale).sort();\n const inner = locales.map((l) => JSON.stringify([l, byLocale[l]])).join(\",\");\n return `${JSON.stringify(key)}:[${inner}]`;\n });\n return `{${parts.join(\",\")}}`;\n}\n\n/**\n * FNV-1a, run twice with different offsets for a 64-bit-wide id. No crypto\n * import, and it has to work identically in the browser bundle, under Bun on\n * the server, and inside the Vite plugin.\n */\nexport function dictionaryId(translations: DictionaryTranslations): string {\n const input = canonicalizeDictionary(translations);\n let a = 0x811c9dc5;\n let b = 0x01000193;\n for (let i = 0; i < input.length; i++) {\n const c = input.charCodeAt(i);\n a = Math.imul(a ^ c, 0x01000193);\n b = Math.imul(b ^ c, 0x811c9dc5);\n }\n const hex = (n: number) => (n >>> 0).toString(16).padStart(8, \"0\");\n return `d_${hex(a)}${hex(b)}`;\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AA2BO,SAAS,CAAiB,CAC/B,EACA,EACU,CACV,IAAM,EAAoB,CAAC,EACrB,EAAO,IAAI,IACjB,GAAI,EACF,EAAK,IAAI,CAAY,EACrB,EAAQ,KAAK,CAAY,EAE3B,QAAW,KAAY,OAAO,OAAO,CAAY,EAC/C,QAAW,KAAU,OAAO,KAAK,CAA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