@vercube/vite 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,12 +73,12 @@ node dist/index.mjs # runs the built server
73
73
 
74
74
  ## Options
75
75
 
76
- | Option | Type | Default | Description |
77
- | ------------ | ----------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
78
- | `rootDir` | `string` | Vite `root` | Project root used to resolve `scanDirs` and `setupFile`. |
79
- | `scanDirs` | `string[]` | `['src']` | Directories scanned (recursively) for `@Controller` and `@Injectable` classes. |
80
- | `setupFile` | `string` | `undefined` | Module whose default export `(app: App) => void \| Promise<void>` runs as `createApp`'s setup hook (before init). |
81
- | `runner` | `string` | `'node-worker'` | The `env-runner` runner used to execute server code in dev. |
76
+ | Option | Type | Default | Description |
77
+ | ------------ | ---------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
78
+ | `rootDir` | `string` | Vite `root` | Project root used to resolve `scanDirs` and `setupFile`. |
79
+ | `scanDirs` | `string[]` | `['src']` | Directories scanned (recursively) for `@Controller` and `@Injectable` classes. |
80
+ | `setupFile` | `string` | `undefined` | Module whose default export `(app: App) => void \| Promise<void>` runs as `createApp`'s setup hook (before init). |
81
+ | `runner` | `string` | `'node-worker'` | The `env-runner` runner used to execute server code in dev. |
82
82
  | `noExternal` | `(string \| RegExp)[]` | `undefined` | Extra dev `resolve.noExternal` patterns merged after `@vercube/*` (see below). |
83
83
 
84
84
  ### Dev `noExternal`
@@ -30,12 +30,12 @@ function generateServerEntry(ctx) {
30
30
  lines.push(...imports.values(), "");
31
31
  const setupBody = [];
32
32
  if (ctx.setupFile) setupBody.push(" await __vercubeSetup__(app);");
33
- if (ctx.hasClient) setupBody.push(" if (import.meta.main) {", " const dir = fileURLToPath(new URL('./public', import.meta.url));", " app.container.get(HttpServer).addPlugin(serveStaticFiles(dir));", " }");
34
33
  if (setupBody.length > 0) lines.push("const app = await createApp({ setup: async (app) => {", ...setupBody, "} });", "");
35
34
  else lines.push("const app = await createApp();", "");
36
35
  lines.push(...[...imports.keys()].map((name) => `app.container.bind(${name});`), "");
37
36
  lines.push("app.container.flushQueue();", "");
38
- lines.push("if (import.meta.main) {", " await app.listen();", "}", "");
37
+ if (ctx.hasClient) lines.push("if (import.meta.main) {", " const dir = fileURLToPath(new URL('./public', import.meta.url));", " const httpServer = app.container.get(HttpServer);", " httpServer.addPlugin(serveStaticFiles(dir));", " httpServer.enableSpaFallback(dir);", " await app.listen();", "}", "");
38
+ else lines.push("if (import.meta.main) {", " await app.listen();", "}", "");
39
39
  lines.push("export const fetch = app.fetch.bind(app);", "");
40
40
  lines.push("export const handleUpgrade = (req, socket, head) => globalThis.__vercube_ws_upgrade__?.(req, socket, head);", "");
41
41
  return lines.join("\n");
@@ -1,4 +1,4 @@
1
- import { r as scanProject } from "./context-CfzvWZrR.mjs";
1
+ import { r as scanProject } from "./context-CEnkMbwW.mjs";
2
2
  import { t as VERCUBE_ENV } from "./types-Cpd32Lkt.mjs";
3
3
  import { createViteHotChannel } from "env-runner/vite";
4
4
  import { watch } from "chokidar";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as setupContext, n as createContext, t as CLIENT_OUT_DIR } from "./context-CfzvWZrR.mjs";
1
+ import { i as setupContext, n as createContext, t as CLIENT_OUT_DIR } from "./context-CEnkMbwW.mjs";
2
2
  import { t as VERCUBE_ENV } from "./types-Cpd32Lkt.mjs";
3
3
  import { defu } from "defu";
4
4
  import { dirname, isAbsolute, resolve } from "pathe";
@@ -61,7 +61,7 @@ function createVercubeEnvironment(ctx) {
61
61
  }
62
62
  },
63
63
  dev: { createEnvironment: async (envName, envConfig) => {
64
- const { createFetchableDevEnvironment } = await import("./dev-Bl0akm-q.mjs");
64
+ const { createFetchableDevEnvironment } = await import("./dev-Czr9pV4P.mjs");
65
65
  const env = createFetchableDevEnvironment(envName, envConfig, getEnvRunner(ctx), ctx.serverEntry);
66
66
  (ctx._viteEnvs ??= /* @__PURE__ */ new Map()).set(envName, ctx.serverEntry);
67
67
  return env;
@@ -116,14 +116,16 @@ function getEnvRunner(ctx) {
116
116
  }
117
117
  /**
118
118
  * Returns true for bare module specifiers (npm/workspace packages), which the
119
- * production build externalizes. Relative paths, absolute paths and virtual
120
- * (`\0`-prefixed) ids are bundled.
119
+ * production build externalizes. Relative paths, absolute paths, virtual
120
+ * (`\0`-prefixed) ids, Vite path aliases (`@/…`), and bundler helper runtimes
121
+ * are bundled.
121
122
  *
122
123
  * @param id - The import specifier to classify.
123
124
  * @returns Whether the specifier is a bare dependency.
124
125
  */
125
126
  function isBareSpecifier(id) {
126
127
  if (id.startsWith("\0") || id.startsWith(".") || isAbsolute(id)) return false;
128
+ if (id.startsWith("@/") || id.startsWith("@oxc-project/")) return false;
127
129
  return true;
128
130
  }
129
131
  /**
@@ -188,8 +190,8 @@ function vercubeMain(ctx) {
188
190
  }
189
191
  },
190
192
  configureServer: async (server) => {
191
- const { configureViteDevServer } = await import("./dev-Bl0akm-q.mjs");
192
- return configureViteDevServer(ctx, server);
193
+ const { configureViteDevServer } = await import("./dev-Czr9pV4P.mjs");
194
+ await configureViteDevServer(ctx, server);
193
195
  },
194
196
  hotUpdate() {
195
197
  if (this.environment.name !== "vercube") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercube/vite",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Vite plugin integrating Vercube with the Vite Environment API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "pathe": "2.0.3",
37
37
  "rou3": "0.8.1",
38
38
  "srvx": "0.11.17",
39
- "@vercube/scan": "1.1.1"
39
+ "@vercube/scan": "1.1.3"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "vite": "^8.0.0"