@squadbase/vite-server 0.1.18 → 0.1.19-dev.2880e8d
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 +23 -0
- package/dist/cli/index.js +419 -452
- package/dist/connectors/google-analytics-oauth.js +102 -188
- package/dist/index.d.ts +25 -1
- package/dist/index.js +501 -592
- package/dist/main.d.ts +1 -0
- package/dist/main.js +505 -596
- package/dist/types/server-logic.d.ts +3 -0
- package/dist/vite-plugin.d.ts +7 -2
- package/dist/vite-plugin.js +53 -47455
- package/package.json +3 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Server entry used by squadbasePlugin for both the dev server and the build.
|
|
2
|
+
//
|
|
3
|
+
// It imports the app and the server-logic files collected by `import.meta.glob`
|
|
4
|
+
// (via the `virtual:squadbase-server-logics` module), populates the registry,
|
|
5
|
+
// and re-exports the app as default. Because the handlers are collected through
|
|
6
|
+
// the same Vite module graph as the server, hono's context storage resolves to a
|
|
7
|
+
// single instance and `getContext` works.
|
|
8
|
+
//
|
|
9
|
+
// Population goes through `@squadbase/vite-server/main` (not `.`) so it targets the
|
|
10
|
+
// same module instance as the running app.
|
|
11
|
+
import { serve } from "@hono/node-server";
|
|
12
|
+
import app, { populateServerLogics } from "@squadbase/vite-server/main";
|
|
13
|
+
import { handlerModules, metaModules } from "virtual:squadbase-server-logics";
|
|
14
|
+
|
|
15
|
+
populateServerLogics({ handlerModules, metaModules });
|
|
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
|
+
}
|
|
22
|
+
|
|
23
|
+
export default app;
|