@squadbase/vite-server 0.0.1-build-2 → 0.0.1-build-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/dist/vite-plugin.js +14 -1
- package/package.json +1 -1
package/dist/vite-plugin.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import buildPlugin from "@hono/vite-build/node";
|
|
3
3
|
import devServer from "@hono/vite-dev-server";
|
|
4
4
|
import nodeAdapter from "@hono/vite-dev-server/node";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import path3 from "path";
|
|
5
7
|
|
|
6
8
|
// src/registry.ts
|
|
7
9
|
import { readdir, readFile, mkdir } from "fs/promises";
|
|
@@ -415,6 +417,17 @@ var DEFAULT_EXCLUDE = [
|
|
|
415
417
|
/^\/node_modules\/.*/,
|
|
416
418
|
/^(?!\/api)/
|
|
417
419
|
];
|
|
420
|
+
function resolveEntry(entry) {
|
|
421
|
+
if (entry.startsWith(".") || entry.startsWith("/")) return entry;
|
|
422
|
+
try {
|
|
423
|
+
const resolvedUrl = import.meta.resolve(entry);
|
|
424
|
+
const absolutePath = fileURLToPath(resolvedUrl);
|
|
425
|
+
const relativePath = path3.relative(process.cwd(), absolutePath).replace(/\\/g, "/");
|
|
426
|
+
return "./" + relativePath;
|
|
427
|
+
} catch {
|
|
428
|
+
return entry;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
418
431
|
function squadbasePlugin(options = {}) {
|
|
419
432
|
const {
|
|
420
433
|
buildEntry = "@squadbase/vite-server/main",
|
|
@@ -425,7 +438,7 @@ function squadbasePlugin(options = {}) {
|
|
|
425
438
|
} = options;
|
|
426
439
|
const isServerBuild = (_, { command, mode }) => command === "build" && mode !== "client";
|
|
427
440
|
const rawBuildPlugin = buildPlugin({
|
|
428
|
-
entry: buildEntry,
|
|
441
|
+
entry: resolveEntry(buildEntry),
|
|
429
442
|
outputDir: "./dist/server",
|
|
430
443
|
output: "index.js",
|
|
431
444
|
port,
|