@squadbase/vite-server 0.1.19-dev.2880e8d → 0.1.19-dev.40d2ebd
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/build-entry/server-entry.mjs +13 -18
- package/dist/cli/index.js +460 -417
- package/dist/connectors/google-analytics-oauth.js +192 -96
- package/dist/index.d.ts +5 -22
- package/dist/index.js +617 -499
- package/dist/main.d.ts +1 -1
- package/dist/main.js +620 -502
- package/dist/types/server-logic.d.ts +0 -3
- package/dist/vite-plugin.d.ts +1 -7
- package/dist/vite-plugin.js +47523 -41
- package/package.json +2 -1
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
// Server entry used by squadbasePlugin
|
|
1
|
+
// Server build entry used by `squadbasePlugin` (see vite-plugin.ts).
|
|
2
2
|
//
|
|
3
|
-
// It
|
|
4
|
-
// (
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
3
|
+
// It re-exports the vite-server app as default (so @hono/vite-build's injected
|
|
4
|
+
// `serve({ fetch: app.fetch })` works), and statically imports the project's
|
|
5
|
+
// TypeScript server-logic handlers via the `virtual:squadbase-server-logics`
|
|
6
|
+
// module (generated by the plugin from `server-logic/*.json`). Because the
|
|
7
|
+
// handlers are compiled into THIS bundle, they share the server's module graph
|
|
8
|
+
// — in particular hono's `contextStorage` AsyncLocalStorage — so `getContext()`
|
|
9
|
+
// works. This replaces runtime jiti transpilation.
|
|
8
10
|
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import { handlerModules, metaModules } from "virtual:squadbase-server-logics";
|
|
11
|
+
// Registration goes through `@squadbase/vite-server/main` (not `/`) because
|
|
12
|
+
// `./main` and `./` are separate bundle entry points with separate module state.
|
|
13
|
+
import app, { registerBundledHandlers } from "@squadbase/vite-server/main";
|
|
14
|
+
import { HANDLERS } from "virtual:squadbase-server-logics";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// In the built (production) server, start the Node HTTP server. In dev the app is
|
|
18
|
-
// served by @hono/vite-dev-server via `app.fetch`, so `serve()` must NOT run there.
|
|
19
|
-
if (import.meta.env.PROD) {
|
|
20
|
-
serve({ fetch: app.fetch, port: Number(process.env.PORT) || 3000 });
|
|
21
|
-
}
|
|
16
|
+
registerBundledHandlers(HANDLERS);
|
|
22
17
|
|
|
23
18
|
export default app;
|