@nifrajs/web 2.1.0 → 2.3.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/README.md +3 -3
- package/dist/build-vite.d.ts +68 -0
- package/dist/build-vite.d.ts.map +1 -0
- package/dist/build-vite.js +433 -0
- package/dist/build-vite.js.map +1 -0
- package/dist/build.d.ts +174 -65
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +376 -135
- package/dist/build.js.map +1 -1
- package/dist/bun-dev-entry.d.ts +83 -0
- package/dist/bun-dev-entry.d.ts.map +1 -0
- package/dist/bun-dev-entry.js +136 -0
- package/dist/bun-dev-entry.js.map +1 -0
- package/dist/chunk-names.js +1 -1
- package/dist/client.d.ts +3 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +209 -27
- package/dist/client.js.map +1 -1
- package/dist/conformance.d.ts +2 -2
- package/dist/conformance.js +3 -3
- package/dist/deferred.d.ts +11 -11
- package/dist/deferred.d.ts.map +1 -1
- package/dist/deferred.js +16 -16
- package/dist/dev-error.d.ts +2 -2
- package/dist/dev-error.js +3 -3
- package/dist/dev-port.d.ts +36 -0
- package/dist/dev-port.d.ts.map +1 -0
- package/dist/dev-port.js +48 -0
- package/dist/dev-port.js.map +1 -0
- package/dist/dev.d.ts +62 -5
- package/dist/dev.d.ts.map +1 -1
- package/dist/dev.js +419 -60
- package/dist/dev.js.map +1 -1
- package/dist/draft.d.ts +44 -7
- package/dist/draft.d.ts.map +1 -1
- package/dist/draft.js +92 -9
- package/dist/draft.js.map +1 -1
- package/dist/fn-state.d.ts +56 -0
- package/dist/fn-state.d.ts.map +1 -0
- package/dist/fn-state.js +77 -0
- package/dist/fn-state.js.map +1 -0
- package/dist/fn.d.ts +111 -0
- package/dist/fn.d.ts.map +1 -0
- package/dist/fn.js +125 -0
- package/dist/fn.js.map +1 -0
- package/dist/fonts-google.d.ts +9 -9
- package/dist/fonts-google.js +10 -10
- package/dist/fonts.d.ts +7 -7
- package/dist/fonts.js +1 -1
- package/dist/forms.d.ts +8 -8
- package/dist/fs.d.ts +15 -2
- package/dist/fs.d.ts.map +1 -1
- package/dist/fs.js +8 -2
- package/dist/fs.js.map +1 -1
- package/dist/index.d.ts +266 -74
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +869 -179
- package/dist/index.js.map +1 -1
- package/dist/internal/head-attributes.d.ts +15 -0
- package/dist/internal/head-attributes.d.ts.map +1 -0
- package/dist/internal/head-attributes.js +99 -0
- package/dist/internal/head-attributes.js.map +1 -0
- package/dist/internal/script-types.d.ts +14 -0
- package/dist/internal/script-types.d.ts.map +1 -0
- package/dist/internal/script-types.js +17 -0
- package/dist/internal/script-types.js.map +1 -0
- package/dist/internal/server-boundary.d.ts +60 -0
- package/dist/internal/server-boundary.d.ts.map +1 -0
- package/dist/internal/server-boundary.js +174 -0
- package/dist/internal/server-boundary.js.map +1 -0
- package/dist/internal/timing-safe-equal.d.ts +16 -0
- package/dist/internal/timing-safe-equal.d.ts.map +1 -0
- package/dist/internal/timing-safe-equal.js +26 -0
- package/dist/internal/timing-safe-equal.js.map +1 -0
- package/dist/internal/vite-import.d.ts +63 -0
- package/dist/internal/vite-import.d.ts.map +1 -0
- package/dist/internal/vite-import.js +94 -0
- package/dist/internal/vite-import.js.map +1 -0
- package/dist/islands.d.ts +5 -5
- package/dist/islands.js +5 -5
- package/dist/isr.d.ts +15 -15
- package/dist/isr.d.ts.map +1 -1
- package/dist/isr.js +8 -21
- package/dist/isr.js.map +1 -1
- package/dist/llms-txt.d.ts.map +1 -1
- package/dist/llms-txt.js +12 -6
- package/dist/llms-txt.js.map +1 -1
- package/dist/manifest.d.ts +121 -40
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +136 -26
- package/dist/manifest.js.map +1 -1
- package/dist/module-graph.d.ts +91 -0
- package/dist/module-graph.d.ts.map +1 -0
- package/dist/module-graph.js +92 -0
- package/dist/module-graph.js.map +1 -0
- package/dist/navigation.d.ts +120 -5
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +37 -5
- package/dist/navigation.js.map +1 -1
- package/dist/plugins/css-modules.d.ts +3 -3
- package/dist/plugins/css-modules.d.ts.map +1 -1
- package/dist/plugins/css-modules.js +0 -0
- package/dist/plugins/css-modules.js.map +1 -1
- package/dist/plugins/kit.d.ts +8 -8
- package/dist/plugins/kit.js +9 -9
- package/dist/plugins/scss.js +3 -3
- package/dist/plugins/vite-leak-guard.d.ts +45 -0
- package/dist/plugins/vite-leak-guard.d.ts.map +1 -0
- package/dist/plugins/vite-leak-guard.js +67 -0
- package/dist/plugins/vite-leak-guard.js.map +1 -0
- package/dist/plugins/vite-server-fn.d.ts +23 -0
- package/dist/plugins/vite-server-fn.d.ts.map +1 -0
- package/dist/plugins/vite-server-fn.js +51 -0
- package/dist/plugins/vite-server-fn.js.map +1 -0
- package/dist/plugins/vite-server-only.d.ts +49 -0
- package/dist/plugins/vite-server-only.d.ts.map +1 -0
- package/dist/plugins/vite-server-only.js +57 -0
- package/dist/plugins/vite-server-only.js.map +1 -0
- package/dist/prerender.d.ts +5 -5
- package/dist/prerender.js +7 -7
- package/dist/public-dir.d.ts +36 -0
- package/dist/public-dir.d.ts.map +1 -0
- package/dist/public-dir.js +89 -0
- package/dist/public-dir.js.map +1 -0
- package/dist/query.d.ts +10 -10
- package/dist/query.js +15 -15
- package/dist/route-manifest.d.ts +91 -0
- package/dist/route-manifest.d.ts.map +1 -0
- package/dist/route-manifest.js +128 -0
- package/dist/route-manifest.js.map +1 -0
- package/dist/router.d.ts +94 -22
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +170 -58
- package/dist/router.js.map +1 -1
- package/dist/search.d.ts +94 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +232 -0
- package/dist/search.js.map +1 -0
- package/dist/server-only.d.ts +6 -6
- package/dist/server-only.js +7 -7
- package/dist/service-worker.d.ts +56 -0
- package/dist/service-worker.d.ts.map +1 -0
- package/dist/service-worker.js +127 -0
- package/dist/service-worker.js.map +1 -0
- package/dist/vite.d.ts +25 -17
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +75 -33
- package/dist/vite.js.map +1 -1
- package/package.json +48 -4
- package/server-manifest.d.ts +31 -0
- package/src/build-vite.ts +553 -0
- package/src/build.ts +563 -172
- package/src/bun-dev-entry.ts +184 -0
- package/src/chunk-names.ts +1 -1
- package/src/client.ts +221 -30
- package/src/conformance.ts +3 -3
- package/src/deferred.ts +17 -17
- package/src/dev-error.ts +3 -3
- package/src/dev-port.ts +63 -0
- package/src/dev.ts +468 -66
- package/src/draft.ts +124 -12
- package/src/fn-state.ts +107 -0
- package/src/fn.ts +199 -0
- package/src/fonts-google.ts +13 -13
- package/src/fonts.ts +7 -7
- package/src/forms.ts +8 -8
- package/src/fs.ts +24 -6
- package/src/index.ts +1174 -225
- package/src/internal/head-attributes.ts +109 -0
- package/src/internal/script-types.ts +18 -0
- package/src/internal/server-boundary.ts +187 -0
- package/src/internal/timing-safe-equal.ts +24 -0
- package/src/internal/vite-import.ts +92 -0
- package/src/islands.ts +7 -7
- package/src/isr.ts +18 -30
- package/src/llms-txt.ts +13 -5
- package/src/manifest.ts +264 -48
- package/src/module-graph.ts +146 -0
- package/src/navigation.ts +151 -5
- package/src/plugins/css-modules.ts +0 -0
- package/src/plugins/kit.ts +11 -11
- package/src/plugins/scss.ts +3 -3
- package/src/plugins/vite-leak-guard.ts +110 -0
- package/src/plugins/vite-server-fn.ts +67 -0
- package/src/plugins/vite-server-only.ts +75 -0
- package/src/prerender.ts +10 -10
- package/src/public-dir.ts +108 -0
- package/src/query.ts +22 -22
- package/src/route-manifest.ts +240 -0
- package/src/router.ts +288 -74
- package/src/search.ts +297 -0
- package/src/server-only.ts +7 -7
- package/src/service-worker.ts +165 -0
- package/src/vite.ts +103 -49
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @nifrajs/web
|
|
2
2
|
|
|
3
|
-
Framework-agnostic SSR core for nifra
|
|
3
|
+
Framework-agnostic SSR core for nifra - the render seam + HTML document orchestration.
|
|
4
4
|
|
|
5
|
-
Part of the **[nifra](https://nifra.dev)** full-stack TypeScript framework
|
|
5
|
+
Part of the **[nifra](https://nifra.dev)** full-stack TypeScript framework - one core, five UI libraries, every runtime. Scaffold a new app with `bun create nifra`.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ MIT
|
|
|
19
19
|
|
|
20
20
|
## For AI agents
|
|
21
21
|
|
|
22
|
-
Start with [`LLM.md`](./LLM.md)
|
|
22
|
+
Start with [`LLM.md`](./LLM.md) - this package's contract card (the exports you call + its footguns),
|
|
23
23
|
one cheap read instead of the whole corpus. For the wider framework: the repo's
|
|
24
24
|
[`AGENTS.md`](../../AGENTS.md) is the copy-paste quick reference, and
|
|
25
25
|
[`llms-full.txt`](../../llms-full.txt) is the full machine-readable corpus. Run `nifra check` as the
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type BuildClientOptions, type BuildManifest, type BuildTarget, type BuildTargetOptions, type BuildTargetResult, type Bundler, type ServerBuild } from "./build.js";
|
|
2
|
+
/** Options for {@link buildClientVite} - the Bun {@link BuildClientOptions} minus Bun-plugin specifics,
|
|
3
|
+
* plus the Vite plugin list the app injects for its transforms. */
|
|
4
|
+
export interface BuildClientViteOptions extends Omit<BuildClientOptions, "plugins"> {
|
|
5
|
+
/** Vite plugins for the app's client transforms (e.g. `react()`, `vue()`). */
|
|
6
|
+
readonly vitePlugins?: readonly unknown[];
|
|
7
|
+
/** Vite project root (default: the parent of `routesDir`). Manifest keys are relative to it. */
|
|
8
|
+
readonly root?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build the client bundle with Vite, emitting the SAME {@link BuildManifest} `buildClient` (Bun) does:
|
|
12
|
+
* a content-hashed entry, per-route chunk lists, aggregate + per-route CSS, and copied `public/` files.
|
|
13
|
+
*
|
|
14
|
+
* The route→chunk and route→CSS mappings come from Vite's own `.vite/manifest.json` (`build.manifest`),
|
|
15
|
+
* which records each entry's emitted `file` and its transitive `css` - exactly the two facts the Bun path
|
|
16
|
+
* reconstructs from Bun's metafile. `viteLeakGuard()` runs during the build, so a client leak fails here
|
|
17
|
+
* with the same error as the Bun build rather than shipping.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildClientVite(options: BuildClientViteOptions): Promise<BuildManifest>;
|
|
20
|
+
/** Options for {@link buildServerVite} - the same surface as `buildServer` minus Bun-plugin specifics. */
|
|
21
|
+
export interface BuildServerViteOptions {
|
|
22
|
+
readonly routesDir: string;
|
|
23
|
+
readonly serverEntry: string;
|
|
24
|
+
readonly outDir: string;
|
|
25
|
+
readonly clientEntry: string;
|
|
26
|
+
readonly styles?: readonly string[] | undefined;
|
|
27
|
+
readonly routeStyles?: Readonly<Record<string, readonly string[]>> | undefined;
|
|
28
|
+
readonly resolve?: (file: string) => string;
|
|
29
|
+
readonly manifestFile?: string;
|
|
30
|
+
readonly vitePlugins?: readonly unknown[];
|
|
31
|
+
readonly conditions?: readonly string[];
|
|
32
|
+
readonly define?: Readonly<Record<string, string>>;
|
|
33
|
+
readonly minify?: boolean;
|
|
34
|
+
/** The runtime the worker targets - mirrors `buildServer`. `browser` = the edge (workerd/edge-light). */
|
|
35
|
+
readonly target?: "browser" | "node" | "bun";
|
|
36
|
+
/** Vite project root (default: the parent of `routesDir`). */
|
|
37
|
+
readonly root?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build the SSR worker with Vite, emitting the SAME {@link ServerBuild} `buildServer` (Bun) does: a
|
|
41
|
+
* self-contained worker bundle whose path is returned as `worker`.
|
|
42
|
+
*
|
|
43
|
+
* Like `buildServer`, it codegens the statically-analyzable `server-manifest` next to the entry (so no
|
|
44
|
+
* `node:fs` route scan runs on a disk-less edge), then bundles. `ssr.noExternal` bundles the app + adapter
|
|
45
|
+
* + `@nifrajs/*` into ONE file (the self-contained worker), while `node:` builtins stay external on the
|
|
46
|
+
* `node`/`bun` targets that provide them. `NIFRA_SSR_BUNDLED` is defined so the web-react adapter uses the
|
|
47
|
+
* bundled, deduped react-dom rather than re-rooting to a disk copy at runtime - the same tag `buildServer`
|
|
48
|
+
* sets, and the reason a bundled SSR output does not hit the dual-React crash.
|
|
49
|
+
*
|
|
50
|
+
* The client-leak guards are deliberately NOT run here: a server bundle's `node:` imports are legitimate.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildServerVite(options: BuildServerViteOptions): Promise<ServerBuild>;
|
|
53
|
+
/**
|
|
54
|
+
* The Vite build STRATEGY - plugged into `buildTargetWith`. `plugins` arriving through the shared
|
|
55
|
+
* orchestrator are the app's Vite plugins (the escape hatch's whole reason), cast to Vite's plugin type.
|
|
56
|
+
*/
|
|
57
|
+
export declare const viteBundler: Bundler;
|
|
58
|
+
/**
|
|
59
|
+
* Build a full deploy dir for `target` using the Vite/Rollup pipeline - the escape hatch for apps that
|
|
60
|
+
* need a Vite-only transform in production. Identical output shape to {@link import("./build.js").buildTarget}
|
|
61
|
+
* (same deploy dir, same server entry, same prerender + size report), because both delegate to the ONE
|
|
62
|
+
* `buildTargetWith` orchestrator; only the two bundling steps differ.
|
|
63
|
+
*
|
|
64
|
+
* Pass the app's Vite plugins via `clientPlugins` / `serverPlugins` (the shared option names) - here they
|
|
65
|
+
* are Vite plugins, not Bun plugins.
|
|
66
|
+
*/
|
|
67
|
+
export declare function buildTargetVite(target: BuildTarget, options: BuildTargetOptions): Promise<BuildTargetResult>;
|
|
68
|
+
//# sourceMappingURL=build-vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-vite.d.ts","sourceRoot":"","sources":["../src/build-vite.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EAIZ,KAAK,WAAW,EACjB,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GAAG,MAAM,GAAG,KAAK,CAAA;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAmED;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAwF3F;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,OAwBzB,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAE5B"}
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@nifrajs/web/build-vite` - the **Vite/Rollup production build**: the escape hatch, not the default.
|
|
3
|
+
*
|
|
4
|
+
* nifra's production default is Bun (`@nifrajs/web/build`), and stays so - it is faster and Bun-native,
|
|
5
|
+
* which is what nifra competes on. This exists for the one case that default cannot serve: an app whose
|
|
6
|
+
* client depends on a Vite-only transform with no Bun equivalent. For those, `buildClientVite` /
|
|
7
|
+
* `buildServerVite` produce the SAME artifacts as the Bun build - the same `BuildManifest`, the same
|
|
8
|
+
* `ServerBuild` - through Vite instead, and `buildTargetVite` assembles the same per-target deploy dir.
|
|
9
|
+
*
|
|
10
|
+
* Crucially this is NOT a second orchestrator. `buildTarget`'s deploy assembly, server-entry codegen,
|
|
11
|
+
* prerender and size report are bundler-agnostic; they live in `build.ts` behind `buildTargetWith`, which
|
|
12
|
+
* takes a {@link Bundler} strategy. This file only supplies the Vite strategy - the two bundling steps -
|
|
13
|
+
* so a change to how a deploy dir is shaped happens in one place for both pipelines.
|
|
14
|
+
*
|
|
15
|
+
* And it does not arrive without the client-leak guards: `buildClientVite` wires `viteLeakGuard()`, so
|
|
16
|
+
* server-only code or a `node:` builtin reaching the browser fails the Vite build with the identical
|
|
17
|
+
* error the Bun build raises. A second production pipeline without those guards is exactly the hole the
|
|
18
|
+
* bundler-neutral module graph was built to close.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
21
|
+
import { dirname, join, relative, resolve as resolvePath } from "node:path";
|
|
22
|
+
import { buildTargetWith, copyPublicDir, publicEnvDefines, } from "./build.js";
|
|
23
|
+
import { discoverRoutes } from "./fs.js";
|
|
24
|
+
import { generateClientEntry, generateServerManifest } from "./index.js";
|
|
25
|
+
import { vitePublicEnvPrefix } from "./internal/server-boundary.js";
|
|
26
|
+
import { importVite, isViteUnresolved } from "./internal/vite-import.js";
|
|
27
|
+
import { viteLeakGuard } from "./plugins/vite-leak-guard.js";
|
|
28
|
+
import { viteServerFnStub } from "./plugins/vite-server-fn.js";
|
|
29
|
+
import { viteServerOnlyEmpty } from "./plugins/vite-server-only.js";
|
|
30
|
+
/** Load the app's Vite. Resolved from `root` so it's the project's copy, not this package's. */
|
|
31
|
+
async function loadVite() {
|
|
32
|
+
try {
|
|
33
|
+
return await importVite();
|
|
34
|
+
}
|
|
35
|
+
catch (cause) {
|
|
36
|
+
// The two failures must not be conflated - see `isViteUnresolved`.
|
|
37
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
38
|
+
const unresolved = isViteUnresolved(cause);
|
|
39
|
+
throw new Error(unresolved
|
|
40
|
+
? "[nifra/web] the Vite production build needs `vite` installed in this project (it is an " +
|
|
41
|
+
"optional peer dependency, so it is not installed for you). Add it, or use the default Bun " +
|
|
42
|
+
`build. Underlying error: ${message}`
|
|
43
|
+
: `[nifra/web] \`vite\` resolved but failed to load, so the Vite production build cannot run: ${message}. ` +
|
|
44
|
+
"This is vite (or a native dependency of it) failing on this runtime, not a nifra build error - " +
|
|
45
|
+
"check that the installed vite works here, or use the default Bun build.", { cause });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Vite derives `isProduction` from the process-global NODE_ENV even when an explicit `mode` is supplied.
|
|
49
|
+
// Programmatic builds therefore have to pin it, but two overlapping calls must never observe each other's
|
|
50
|
+
// mode. Serialize only this unavoidable Vite window; the previous value is captured after acquiring the
|
|
51
|
+
// lock and restored before the next build starts. Rejections release the lock too.
|
|
52
|
+
let nodeEnvBuildTail = Promise.resolve();
|
|
53
|
+
async function withSerializedNodeEnv(mode, run) {
|
|
54
|
+
const previousBuild = nodeEnvBuildTail;
|
|
55
|
+
let release;
|
|
56
|
+
nodeEnvBuildTail = new Promise((resolve) => {
|
|
57
|
+
release = resolve;
|
|
58
|
+
});
|
|
59
|
+
await previousBuild;
|
|
60
|
+
const previous = process.env.NODE_ENV;
|
|
61
|
+
process.env.NODE_ENV = mode;
|
|
62
|
+
try {
|
|
63
|
+
return await run();
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
// An env value is always a string when set; `undefined` means the key was absent, so remove it rather
|
|
67
|
+
// than assign `undefined` (which `exactOptionalPropertyTypes` rejects and which would stringify anyway).
|
|
68
|
+
if (previous === undefined)
|
|
69
|
+
delete process.env.NODE_ENV;
|
|
70
|
+
else
|
|
71
|
+
process.env.NODE_ENV = previous;
|
|
72
|
+
release();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build the client bundle with Vite, emitting the SAME {@link BuildManifest} `buildClient` (Bun) does:
|
|
77
|
+
* a content-hashed entry, per-route chunk lists, aggregate + per-route CSS, and copied `public/` files.
|
|
78
|
+
*
|
|
79
|
+
* The route→chunk and route→CSS mappings come from Vite's own `.vite/manifest.json` (`build.manifest`),
|
|
80
|
+
* which records each entry's emitted `file` and its transitive `css` - exactly the two facts the Bun path
|
|
81
|
+
* reconstructs from Bun's metafile. `viteLeakGuard()` runs during the build, so a client leak fails here
|
|
82
|
+
* with the same error as the Bun build rather than shipping.
|
|
83
|
+
*/
|
|
84
|
+
export async function buildClientVite(options) {
|
|
85
|
+
const { routesDir, outDir, clientModule } = options;
|
|
86
|
+
const root = resolvePath(options.root ?? dirname(routesDir));
|
|
87
|
+
const resolve = options.resolve ?? ((file) => `${routesDir}/${file}`);
|
|
88
|
+
const publicPath = options.publicPath ?? "/assets/";
|
|
89
|
+
mkdirSync(outDir, { recursive: true });
|
|
90
|
+
const routeManifest = discoverRoutes(routesDir);
|
|
91
|
+
// The generated bootstrap, written beside the project so its imports resolve the app's deps (same
|
|
92
|
+
// reasoning as buildClient). A unique dir avoids clobbering a user file / colliding with parallel builds.
|
|
93
|
+
const entryDir = mkdtempSync(resolvePath(dirname(routesDir), ".nifra-vite-client-"));
|
|
94
|
+
const entryFile = `${entryDir}/_nifra-entry.ts`;
|
|
95
|
+
writeFileSync(entryFile, `globalThis.process ??= { env: {} };\n${generateClientEntry(routeManifest, { clientModule, resolve })}`);
|
|
96
|
+
// Every unique route/layout/_404 file - each an additional entry so Vite emits a named chunk per file
|
|
97
|
+
// the bootstrap's lazy import dedupes to, giving the per-route chunk + CSS mapping below.
|
|
98
|
+
const routeFiles = [
|
|
99
|
+
...new Set([
|
|
100
|
+
...routeManifest.routes.map((r) => r.file),
|
|
101
|
+
...Object.values(routeManifest.layouts).map((l) => l.file),
|
|
102
|
+
...(routeManifest.notFound ? [routeManifest.notFound.file] : []),
|
|
103
|
+
]),
|
|
104
|
+
].sort();
|
|
105
|
+
// Vite manifest keys are the input path RELATIVE TO ROOT - precompute them so the lookup below is exact
|
|
106
|
+
// (survives same-basename collisions like `index.tsx` + `blog/index.tsx`).
|
|
107
|
+
const keyOf = (absPath) => relative(root, absPath).replaceAll("\\", "/");
|
|
108
|
+
const entryKey = keyOf(entryFile);
|
|
109
|
+
const input = { _nifra: entryFile };
|
|
110
|
+
const fileKey = new Map(); // route/layout file → its manifest key
|
|
111
|
+
for (const file of routeFiles) {
|
|
112
|
+
const abs = resolvePath(resolve(file));
|
|
113
|
+
// FLAT input names (no `/`), so Vite emits `routes_index_tsx-HASH.js` in `outDir` directly, not a
|
|
114
|
+
// nested `routes/…` dir - the deploy assembly + size report map asset URLs by basename and expect a
|
|
115
|
+
// flat layout. The manifest LOOKUP below is keyed by the src path (`keyOf`), independent of this name.
|
|
116
|
+
input[keyOf(abs).replace(/[^\w]/g, "_")] = abs;
|
|
117
|
+
fileKey.set(file, keyOf(abs));
|
|
118
|
+
}
|
|
119
|
+
// Pin Vite's MODE to match the NODE_ENV we define. @vitejs/plugin-react picks the JSX runtime by mode -
|
|
120
|
+
// `jsx` (production) vs `jsxDEV` (development) - so if mode and NODE_ENV disagree, the transform emits
|
|
121
|
+
// `jsxDEV` calls while `react/jsx-dev-runtime` guards `jsxDEV` behind `NODE_ENV !== "production"` and
|
|
122
|
+
// leaves it undefined → `jsxDEV is not a function` at SSR. Vite's default mode follows the ambient
|
|
123
|
+
// NODE_ENV (e.g. "test" under `bun test`), so it MUST be set explicitly, not left to default.
|
|
124
|
+
const mode = options.minify === false ? "development" : "production";
|
|
125
|
+
const buildEnv = (typeof Bun !== "undefined" ? Bun.env : undefined) ?? process.env;
|
|
126
|
+
const publicDefines = publicEnvDefines(options.publicEnvPrefix ?? "PUBLIC_", buildEnv);
|
|
127
|
+
const vite = await loadVite();
|
|
128
|
+
const leakGuard = viteLeakGuard();
|
|
129
|
+
try {
|
|
130
|
+
await withSerializedNodeEnv(mode, () => vite.build({
|
|
131
|
+
root,
|
|
132
|
+
base: publicPath,
|
|
133
|
+
mode,
|
|
134
|
+
// Override Vite's independent `VITE_*` boundary; Nifra has one public-env policy.
|
|
135
|
+
envPrefix: vitePublicEnvPrefix(options.publicEnvPrefix),
|
|
136
|
+
logLevel: "silent",
|
|
137
|
+
// Nifra owns publicDir copying so direct and target builds share symlink confinement and
|
|
138
|
+
// deploy-root placement. Vite's automatic copy would put root files inside /assets.
|
|
139
|
+
publicDir: false,
|
|
140
|
+
define: {
|
|
141
|
+
...publicDefines,
|
|
142
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
143
|
+
...(options.define ?? {}),
|
|
144
|
+
},
|
|
145
|
+
resolve: {
|
|
146
|
+
// Mirror the Bun build's reactDedupePlugin: one physical react/react-dom, or a hook-using route
|
|
147
|
+
// gets a second dispatcher. No-op when the app isn't React.
|
|
148
|
+
dedupe: ["react", "react-dom"],
|
|
149
|
+
...(options.conditions ? { conditions: [...options.conditions] } : {}),
|
|
150
|
+
},
|
|
151
|
+
plugins: [...(options.vitePlugins ?? [])],
|
|
152
|
+
build: {
|
|
153
|
+
outDir,
|
|
154
|
+
emptyOutDir: false, // buildTargetWith owns outDir lifecycle; never let Vite wipe sibling files
|
|
155
|
+
manifest: true,
|
|
156
|
+
minify: options.minify !== false,
|
|
157
|
+
rollupOptions: {
|
|
158
|
+
// Keep `node:` builtins as external specifiers so the leak guard sees `node:crypto` and can
|
|
159
|
+
// name it. Left to itself, rolldown-vite SILENTLY rewrites a `node:` import to a
|
|
160
|
+
// `__vite-browser-external` stub for "browser compatibility" - the code builds, ships, and the
|
|
161
|
+
// builtin is a no-op at runtime, which is a worse footgun than Bun's polyfill and invisible
|
|
162
|
+
// without this. External here means the guard fails the build (below) with the exact builtin.
|
|
163
|
+
external: [/^node:/],
|
|
164
|
+
input,
|
|
165
|
+
// The leak guard is a Rollup plugin - last, so it sees the final graph.
|
|
166
|
+
plugins: [viteServerFnStub(), viteServerOnlyEmpty(), leakGuard],
|
|
167
|
+
output: {
|
|
168
|
+
entryFileNames: "[name]-[hash].js",
|
|
169
|
+
chunkFileNames: "[name]-[hash].js",
|
|
170
|
+
assetFileNames: "[name]-[hash][extname]",
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
// Re-raise the guard's own message. The plugin already threw it, but a plugin error is reported
|
|
178
|
+
// through the bundler, which builds its own error to do so - and on some Bun + rolldown pairings
|
|
179
|
+
// that construction fails, replacing a precise "node:crypto reached the client bundle" with an
|
|
180
|
+
// internal complaint naming nothing. Raising it here puts the message beyond anything that can
|
|
181
|
+
// rewrite it; the bundler's error is kept as `cause` for the rest of the context.
|
|
182
|
+
if (leakGuard.leak !== undefined)
|
|
183
|
+
throw new Error(leakGuard.leak, { cause: error });
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
rmSync(entryDir, { recursive: true, force: true });
|
|
188
|
+
}
|
|
189
|
+
const viteManifestDir = join(outDir, ".vite");
|
|
190
|
+
const viteManifest = JSON.parse(readFileSync(join(viteManifestDir, "manifest.json"), "utf8"));
|
|
191
|
+
// Vite's source-keyed build manifest is an internal mapping input, not a deploy artifact.
|
|
192
|
+
rmSync(viteManifestDir, { recursive: true, force: true });
|
|
193
|
+
const url = (file) => `${publicPath}${file}`;
|
|
194
|
+
const bootstrap = viteManifest[entryKey];
|
|
195
|
+
if (bootstrap === undefined) {
|
|
196
|
+
throw new Error(`[nifra/web] Vite build produced no manifest entry for the bootstrap (${entryKey}). ` +
|
|
197
|
+
"The client build did not emit the generated entry.");
|
|
198
|
+
}
|
|
199
|
+
// routes: each route id → its layout chain + own chunk URLs (per-file entry chunks, like the Bun path).
|
|
200
|
+
const chunkFor = (file) => {
|
|
201
|
+
const key = fileKey.get(file);
|
|
202
|
+
const entry = key !== undefined ? viteManifest[key] : undefined;
|
|
203
|
+
return entry !== undefined ? url(entry.file) : undefined;
|
|
204
|
+
};
|
|
205
|
+
const chainFiles = (route) => [
|
|
206
|
+
...route.layoutIds.map((id) => routeManifest.layouts[id]?.file ?? ""),
|
|
207
|
+
route.file,
|
|
208
|
+
];
|
|
209
|
+
const routes = {};
|
|
210
|
+
for (const route of routeManifest.routes) {
|
|
211
|
+
routes[route.id] = chainFiles(route)
|
|
212
|
+
.map(chunkFor)
|
|
213
|
+
.filter((u) => u !== undefined);
|
|
214
|
+
}
|
|
215
|
+
if (routeManifest.notFound) {
|
|
216
|
+
const c = chunkFor(routeManifest.notFound.file);
|
|
217
|
+
routes._404 = c !== undefined ? [c] : [];
|
|
218
|
+
}
|
|
219
|
+
// CSS per route - Vite's manifest `css` is the transitive stylesheet set for that entry.
|
|
220
|
+
const stylesFor = (files) => {
|
|
221
|
+
const urls = new Set();
|
|
222
|
+
for (const file of files) {
|
|
223
|
+
const key = fileKey.get(file);
|
|
224
|
+
const entry = key !== undefined ? viteManifest[key] : undefined;
|
|
225
|
+
for (const css of entry?.css ?? [])
|
|
226
|
+
urls.add(url(css));
|
|
227
|
+
}
|
|
228
|
+
return [...urls];
|
|
229
|
+
};
|
|
230
|
+
// CSS aggregate - every stylesheet the app emits, the always-safe fallback.
|
|
231
|
+
const allCss = new Set();
|
|
232
|
+
for (const entry of Object.values(viteManifest)) {
|
|
233
|
+
for (const css of entry.css ?? [])
|
|
234
|
+
allCss.add(url(css));
|
|
235
|
+
}
|
|
236
|
+
const css = [...allCss];
|
|
237
|
+
const routeStyles = {};
|
|
238
|
+
if (css.length > 0) {
|
|
239
|
+
for (const route of routeManifest.routes)
|
|
240
|
+
routeStyles[route.id] = stylesFor(chainFiles(route));
|
|
241
|
+
if (routeManifest.notFound)
|
|
242
|
+
routeStyles._404 = stylesFor([routeManifest.notFound.file]);
|
|
243
|
+
}
|
|
244
|
+
// assets - every emitted file + stylesheet across the manifest (chunks, entries, css).
|
|
245
|
+
const assets = new Set();
|
|
246
|
+
for (const entry of Object.values(viteManifest)) {
|
|
247
|
+
assets.add(url(entry.file));
|
|
248
|
+
for (const css of entry.css ?? [])
|
|
249
|
+
assets.add(url(css));
|
|
250
|
+
for (const asset of entry.assets ?? [])
|
|
251
|
+
assets.add(url(asset));
|
|
252
|
+
}
|
|
253
|
+
const publicDir = options.publicDir === false ? undefined : (options.publicDir ?? "public");
|
|
254
|
+
const publicFiles = publicDir !== undefined && existsSync(publicDir) ? await copyPublicDir(publicDir, outDir) : [];
|
|
255
|
+
const manifest = {
|
|
256
|
+
entry: url(bootstrap.file),
|
|
257
|
+
assets: [...assets],
|
|
258
|
+
routes,
|
|
259
|
+
...(publicFiles.length > 0 ? { publicFiles } : {}),
|
|
260
|
+
...(css.length > 0 ? { css } : {}),
|
|
261
|
+
...(Object.keys(routeStyles).length > 0 ? { routeStyles } : {}),
|
|
262
|
+
};
|
|
263
|
+
writeFileSync(`${outDir}/manifest.json`, JSON.stringify(manifest, null, 2));
|
|
264
|
+
return manifest;
|
|
265
|
+
}
|
|
266
|
+
/** Fail closed if Rollup would leave a Node builtin import in a workerd/edge worker. */
|
|
267
|
+
function edgeBuiltinGuard() {
|
|
268
|
+
const plugin = {
|
|
269
|
+
name: "nifra:edge-node-builtin-guard",
|
|
270
|
+
generateBundle(_options, bundle) {
|
|
271
|
+
const builtins = new Set();
|
|
272
|
+
const importers = new Set();
|
|
273
|
+
for (const output of Object.values(bundle)) {
|
|
274
|
+
if (output.type !== "chunk")
|
|
275
|
+
continue;
|
|
276
|
+
for (const specifier of [...(output.imports ?? []), ...(output.dynamicImports ?? [])]) {
|
|
277
|
+
if (specifier.startsWith("node:"))
|
|
278
|
+
builtins.add(specifier);
|
|
279
|
+
}
|
|
280
|
+
for (const id of output.moduleIds ?? []) {
|
|
281
|
+
const info = this.getModuleInfo(id);
|
|
282
|
+
const imports = [...(info?.importedIds ?? []), ...(info?.dynamicallyImportedIds ?? [])];
|
|
283
|
+
if (imports.some((specifier) => specifier.startsWith("node:")))
|
|
284
|
+
importers.add(id);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (builtins.size === 0)
|
|
288
|
+
return;
|
|
289
|
+
const leak = `[nifra/web] Node built-in(s) reached an edge server bundle: ${[...builtins].sort().join(", ")}. ` +
|
|
290
|
+
`Imported by: ${[...importers].sort().join(", ") || "unknown module"}. ` +
|
|
291
|
+
"Move the import behind a Node/Bun target or replace it with an edge-compatible API.";
|
|
292
|
+
// Record, then throw - see `leak`.
|
|
293
|
+
plugin.leak = leak;
|
|
294
|
+
this.error(new Error(leak));
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
return plugin;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Build the SSR worker with Vite, emitting the SAME {@link ServerBuild} `buildServer` (Bun) does: a
|
|
301
|
+
* self-contained worker bundle whose path is returned as `worker`.
|
|
302
|
+
*
|
|
303
|
+
* Like `buildServer`, it codegens the statically-analyzable `server-manifest` next to the entry (so no
|
|
304
|
+
* `node:fs` route scan runs on a disk-less edge), then bundles. `ssr.noExternal` bundles the app + adapter
|
|
305
|
+
* + `@nifrajs/*` into ONE file (the self-contained worker), while `node:` builtins stay external on the
|
|
306
|
+
* `node`/`bun` targets that provide them. `NIFRA_SSR_BUNDLED` is defined so the web-react adapter uses the
|
|
307
|
+
* bundled, deduped react-dom rather than re-rooting to a disk copy at runtime - the same tag `buildServer`
|
|
308
|
+
* sets, and the reason a bundled SSR output does not hit the dual-React crash.
|
|
309
|
+
*
|
|
310
|
+
* The client-leak guards are deliberately NOT run here: a server bundle's `node:` imports are legitimate.
|
|
311
|
+
*/
|
|
312
|
+
export async function buildServerVite(options) {
|
|
313
|
+
const { routesDir, serverEntry, outDir, clientEntry, styles, routeStyles } = options;
|
|
314
|
+
const root = resolvePath(options.root ?? dirname(routesDir));
|
|
315
|
+
const entryDir = dirname(serverEntry);
|
|
316
|
+
const manifestFile = options.manifestFile ?? "server-manifest.ts";
|
|
317
|
+
const rel = relative(entryDir, routesDir).replaceAll("\\", "/");
|
|
318
|
+
const resolve = options.resolve ?? ((file) => `./${rel}/${file}`);
|
|
319
|
+
mkdirSync(outDir, { recursive: true });
|
|
320
|
+
const target = options.target ?? "browser";
|
|
321
|
+
const edge = target === "browser";
|
|
322
|
+
// Same conditions as buildServer: the edge target needs workerd/edge-light so react-dom resolves its
|
|
323
|
+
// edge server build; node/bun resolve their own via the target condition.
|
|
324
|
+
const conditions = options.conditions ?? (edge ? ["workerd", "edge-light", "browser"] : [target]);
|
|
325
|
+
const routeManifest = discoverRoutes(routesDir);
|
|
326
|
+
writeFileSync(`${entryDir}/${manifestFile}`, generateServerManifest(routeManifest, { resolve, clientEntry, styles, routeStyles }));
|
|
327
|
+
// Pin the mode to match NODE_ENV - the react plugin's JSX runtime (jsx vs jsxDEV) follows it, and a
|
|
328
|
+
// mismatch throws `jsxDEV is not a function` at SSR (see buildClientVite for the full reasoning).
|
|
329
|
+
const mode = options.minify === false ? "development" : "production";
|
|
330
|
+
const vite = await loadVite();
|
|
331
|
+
const edgeGuard = edgeBuiltinGuard();
|
|
332
|
+
try {
|
|
333
|
+
await withSerializedNodeEnv(mode, () => vite.build({
|
|
334
|
+
root,
|
|
335
|
+
mode,
|
|
336
|
+
logLevel: "silent",
|
|
337
|
+
define: {
|
|
338
|
+
"process.env.NODE_ENV": JSON.stringify(mode),
|
|
339
|
+
// Tag the bundle so @nifrajs/web-react uses the bundled+deduped react-dom (no runtime re-root →
|
|
340
|
+
// no second React core). Layered after any caller define so it cannot be overridden.
|
|
341
|
+
...(options.define ?? {}),
|
|
342
|
+
"process.env.NIFRA_SSR_BUNDLED": '"1"',
|
|
343
|
+
"globalThis.__NIFRA_EDGE_RUNTIME__": edge ? "true" : "false",
|
|
344
|
+
},
|
|
345
|
+
resolve: {
|
|
346
|
+
dedupe: ["react", "react-dom"],
|
|
347
|
+
conditions: [...conditions],
|
|
348
|
+
},
|
|
349
|
+
plugins: [...(options.vitePlugins ?? [])],
|
|
350
|
+
build: {
|
|
351
|
+
outDir,
|
|
352
|
+
emptyOutDir: false,
|
|
353
|
+
minify: options.minify !== false,
|
|
354
|
+
ssr: serverEntry,
|
|
355
|
+
rollupOptions: {
|
|
356
|
+
// Keep builtins external so Node/Bun use their native implementations. Edge builds add a
|
|
357
|
+
// generateBundle guard below, so an external specifier can never silently ship to workerd.
|
|
358
|
+
external: [/^node:/],
|
|
359
|
+
...(edge ? { plugins: [edgeGuard] } : {}),
|
|
360
|
+
// ONE self-contained `server.js`. `inlineDynamicImports` forces the ENTRY chunk to absorb
|
|
361
|
+
// every module - the app, the adapter, react/react-dom, @nifrajs/* - so no second chunk is
|
|
362
|
+
// emitted. It is NOT redundant with `ssr.noExternal`: `noExternal` decides what gets bundled,
|
|
363
|
+
// this decides how many files it lands in. Without it the `node` SSR target splits vendor deps
|
|
364
|
+
// (verified: a React app emits `assets/react-<hash>.js`), and the deploy assembly copies only
|
|
365
|
+
// the entry, so the server dies at boot with ERR_MODULE_NOT_FOUND on a path that was never
|
|
366
|
+
// written. bun/deno/edge happen not to split today, which is exactly why the node regression
|
|
367
|
+
// went unnoticed - relying on a bundler's default chunking is not a contract.
|
|
368
|
+
// (Under rolldown-vite this option logs a cosmetic deprecation, silenced by `logLevel: silent`.)
|
|
369
|
+
output: { entryFileNames: "server.js", inlineDynamicImports: true },
|
|
370
|
+
},
|
|
371
|
+
// Bundle the app + adapter + @nifrajs/* into one self-contained worker (like Bun's eager output),
|
|
372
|
+
// rather than externalizing node_modules the way a default Vite SSR build does.
|
|
373
|
+
ssrEmitAssets: false,
|
|
374
|
+
},
|
|
375
|
+
ssr: {
|
|
376
|
+
noExternal: true,
|
|
377
|
+
...(edge ? { target: "webworker" } : {}),
|
|
378
|
+
},
|
|
379
|
+
}));
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
// Re-raise the guard's own message from here, where no bundler error-reporting path can rewrite it
|
|
383
|
+
// (see the same handling in buildClientVite).
|
|
384
|
+
if (edgeGuard.leak !== undefined)
|
|
385
|
+
throw new Error(edgeGuard.leak, { cause: error });
|
|
386
|
+
throw error;
|
|
387
|
+
}
|
|
388
|
+
const worker = join(outDir, "server.js");
|
|
389
|
+
if (!existsSync(worker)) {
|
|
390
|
+
throw new Error(`[nifra/web] Vite SSR build produced no ${worker}`);
|
|
391
|
+
}
|
|
392
|
+
return { worker, outputs: [worker] };
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* The Vite build STRATEGY - plugged into `buildTargetWith`. `plugins` arriving through the shared
|
|
396
|
+
* orchestrator are the app's Vite plugins (the escape hatch's whole reason), cast to Vite's plugin type.
|
|
397
|
+
*/
|
|
398
|
+
export const viteBundler = {
|
|
399
|
+
buildClient: (input) => buildClientVite({
|
|
400
|
+
routesDir: input.routesDir,
|
|
401
|
+
outDir: input.outDir,
|
|
402
|
+
clientModule: input.clientModule,
|
|
403
|
+
...(input.plugins ? { vitePlugins: input.plugins } : {}),
|
|
404
|
+
...(input.conditions ? { conditions: input.conditions } : {}),
|
|
405
|
+
...(input.define ? { define: input.define } : {}),
|
|
406
|
+
...(input.publicDir !== undefined ? { publicDir: input.publicDir } : {}),
|
|
407
|
+
...(input.publicEnvPrefix !== undefined ? { publicEnvPrefix: input.publicEnvPrefix } : {}),
|
|
408
|
+
...(input.root ? { root: input.root } : {}),
|
|
409
|
+
}),
|
|
410
|
+
buildServer: (input) => buildServerVite({
|
|
411
|
+
routesDir: input.routesDir,
|
|
412
|
+
serverEntry: input.serverEntry,
|
|
413
|
+
outDir: input.outDir,
|
|
414
|
+
clientEntry: input.clientEntry,
|
|
415
|
+
target: input.target,
|
|
416
|
+
...(input.plugins ? { vitePlugins: input.plugins } : {}),
|
|
417
|
+
...(input.define ? { define: input.define } : {}),
|
|
418
|
+
...(input.root ? { root: input.root } : {}),
|
|
419
|
+
}),
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* Build a full deploy dir for `target` using the Vite/Rollup pipeline - the escape hatch for apps that
|
|
423
|
+
* need a Vite-only transform in production. Identical output shape to {@link import("./build.ts").buildTarget}
|
|
424
|
+
* (same deploy dir, same server entry, same prerender + size report), because both delegate to the ONE
|
|
425
|
+
* `buildTargetWith` orchestrator; only the two bundling steps differ.
|
|
426
|
+
*
|
|
427
|
+
* Pass the app's Vite plugins via `clientPlugins` / `serverPlugins` (the shared option names) - here they
|
|
428
|
+
* are Vite plugins, not Bun plugins.
|
|
429
|
+
*/
|
|
430
|
+
export function buildTargetVite(target, options) {
|
|
431
|
+
return buildTargetWith(target, options, viteBundler);
|
|
432
|
+
}
|
|
433
|
+
//# sourceMappingURL=build-vite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-vite.js","sourceRoot":"","sources":["../src/build-vite.ts"],"names":[],"mapp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