vike-lite 1.17.0 → 1.17.2
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 +2 -2
- package/dist/__internal/client.d.mts +1 -1
- package/dist/__internal/server.d.mts +1 -1
- package/dist/__internal/server.mjs +1 -1
- package/dist/__internal/shared.d.mts +1 -2
- package/dist/__internal/shared.mjs +2 -4
- package/dist/server.mjs +1 -1
- package/dist/shared-Dh8Fb_3P.mjs +6 -0
- package/dist/{store-BCs8gL_o.mjs → store-D-6PbvfY.mjs} +1 -1
- package/dist/{store-9UNcAe5D.d.mts → store-DRuFjsY3.d.mts} +1 -1
- package/dist/vite.mjs +41 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,10 +43,10 @@ When set to `true`, at the end of each production build (client and server) the
|
|
|
43
43
|
|
|
44
44
|
```sh
|
|
45
45
|
|
|
46
|
-
📦 [Client bundle]
|
|
46
|
+
📦 [Client bundle] 1 dependencies used from package.json:
|
|
47
47
|
- solid-js@^1.9.3
|
|
48
48
|
|
|
49
|
-
📦 [Server bundle]
|
|
49
|
+
📦 [Server bundle] 2 dependencies used from package.json:
|
|
50
50
|
- solid-js@^1.9.3
|
|
51
51
|
- hono@^4.12.31
|
|
52
52
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as VikeState } from "../store-
|
|
1
|
+
import { t as VikeState } from "../store-DRuFjsY3.mjs";
|
|
2
2
|
//#region src/__internal/client.d.ts
|
|
3
3
|
declare function createLinkClickHandler(onNavigate: (url: URL) => void): (e: MouseEvent) => void;
|
|
4
4
|
declare function createLinkPrefetchHandler(onPrefetch: (url: URL) => void): (e: Event) => void;
|
|
@@ -14,7 +14,6 @@ interface RenderContext {
|
|
|
14
14
|
};
|
|
15
15
|
nonce?: string;
|
|
16
16
|
}
|
|
17
|
-
declare function escapeRegex(str: string): string;
|
|
18
17
|
declare function matchRoute(urlPathname: string, routes: typeof import('virtual:vike-lite/routes').routes): {
|
|
19
18
|
route: any;
|
|
20
19
|
routeParams: Record<string, string>;
|
|
@@ -31,4 +30,4 @@ declare function stripBase(pathname: string): string;
|
|
|
31
30
|
*/
|
|
32
31
|
declare function prependBase(pathname: string): string;
|
|
33
32
|
//#endregion
|
|
34
|
-
export { BASE_URL, RenderContext,
|
|
33
|
+
export { BASE_URL, RenderContext, matchRoute, prependBase, stripBase };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import { t as escapeRegex } from "../shared-Dh8Fb_3P.mjs";
|
|
1
2
|
//#region src/__internal/shared.ts
|
|
2
3
|
const regexCache = /* @__PURE__ */ new Map();
|
|
3
|
-
function escapeRegex(str) {
|
|
4
|
-
return str.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
5
|
-
}
|
|
6
4
|
function matchRoute(urlPathname, routes) {
|
|
7
5
|
for (const route of routes) {
|
|
8
6
|
if (!route.path.includes(":")) {
|
|
@@ -62,4 +60,4 @@ function prependBase(pathname) {
|
|
|
62
60
|
return BASE_URL + (pathname === "/" ? "" : pathname);
|
|
63
61
|
}
|
|
64
62
|
//#endregion
|
|
65
|
-
export { BASE_URL,
|
|
63
|
+
export { BASE_URL, matchRoute, prependBase, stripBase };
|
package/dist/server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BASE_URL, matchRoute, stripBase } from "./__internal/shared.mjs";
|
|
2
2
|
import { AbortRedirect, AbortRender } from "./server/abort.mjs";
|
|
3
|
-
import { n as store } from "./store-
|
|
3
|
+
import { n as store } from "./store-D-6PbvfY.mjs";
|
|
4
4
|
//#region src/utils/serializeContext.ts
|
|
5
5
|
const ESCAPE_LOOKUP = {
|
|
6
6
|
"&": String.raw`\u0026`,
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { escapeRegex } from "./
|
|
1
|
+
import { t as escapeRegex } from "./shared-Dh8Fb_3P.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { Readable } from "node:stream";
|
|
@@ -121,15 +121,18 @@ function findPackageJsonPath(startDir) {
|
|
|
121
121
|
dir = parent;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
function extractPkgName(id) {
|
|
125
|
+
const normalized = id.replaceAll("\\", "/");
|
|
126
|
+
const matches = [...normalized.matchAll(/(?:node_modules|\.yarn(?:\/__virtual__)?)\/(@[^/]+\/[^/]+|[^/]+)/g)];
|
|
127
|
+
if (matches.length > 0) {
|
|
128
|
+
const pkg = matches[matches.length - 1][1];
|
|
129
|
+
if (pkg !== ".pnpm") return pkg;
|
|
130
|
+
}
|
|
131
|
+
if (!normalized.startsWith(".") && !normalized.startsWith("/") && !normalized.includes(":")) {
|
|
132
|
+
const parts = normalized.split("/");
|
|
133
|
+
return normalized.startsWith("@") && parts.length > 1 ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
133
136
|
}
|
|
134
137
|
//#endregion
|
|
135
138
|
//#region src/vite/index.ts
|
|
@@ -167,10 +170,18 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
167
170
|
const pkgJsonPath = findPackageJsonPath(viteConfigRoot);
|
|
168
171
|
if (pkgJsonPath) {
|
|
169
172
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
|
|
170
|
-
projectDependencies = {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
projectDependencies = {};
|
|
174
|
+
for (const [k, v] of Object.entries(pkgJson.dependencies || {})) projectDependencies[k] = {
|
|
175
|
+
version: v,
|
|
176
|
+
type: ""
|
|
177
|
+
};
|
|
178
|
+
for (const [k, v] of Object.entries(pkgJson.devDependencies || {})) projectDependencies[k] = {
|
|
179
|
+
version: v,
|
|
180
|
+
type: "dev"
|
|
181
|
+
};
|
|
182
|
+
for (const [k, v] of Object.entries(pkgJson.peerDependencies || {})) if (!projectDependencies[k]) projectDependencies[k] = {
|
|
183
|
+
version: v,
|
|
184
|
+
type: "peer"
|
|
174
185
|
};
|
|
175
186
|
}
|
|
176
187
|
}
|
|
@@ -336,27 +347,25 @@ function vikeLite({ pagesDir = "pages", apiPrefix = "/api", prerender = false, s
|
|
|
336
347
|
if (!printDependencies || !projectDependencies) return;
|
|
337
348
|
const envName = this.environment.name;
|
|
338
349
|
if (envName !== "client" && envName !== "ssr") return;
|
|
339
|
-
const
|
|
340
|
-
for (const
|
|
341
|
-
if (
|
|
342
|
-
for (const
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
}
|
|
346
|
-
for (const imp of file.imports) {
|
|
347
|
-
const pkgName = extractPackageNameFromImport(imp);
|
|
348
|
-
if (pkgName && projectDependencies[pkgName] !== void 0) usedPackages.add(pkgName);
|
|
350
|
+
const usedDeps = /* @__PURE__ */ new Map();
|
|
351
|
+
for (const chunk of Object.values(bundle)) {
|
|
352
|
+
if (chunk.type !== "chunk") continue;
|
|
353
|
+
for (const id of chunk.moduleIds) {
|
|
354
|
+
const pkg = extractPkgName(id);
|
|
355
|
+
if (pkg && !pkg.startsWith("vike-lite") && Object.hasOwn(projectDependencies, pkg)) usedDeps.set(pkg, projectDependencies[pkg]);
|
|
349
356
|
}
|
|
350
|
-
for (const imp of
|
|
351
|
-
const
|
|
352
|
-
if (
|
|
357
|
+
for (const imp of [...chunk.imports, ...chunk.dynamicImports]) {
|
|
358
|
+
const pkg = extractPkgName(imp);
|
|
359
|
+
if (pkg && !pkg.startsWith("vike-lite") && Object.hasOwn(projectDependencies, pkg)) usedDeps.set(pkg, projectDependencies[pkg]);
|
|
353
360
|
}
|
|
354
361
|
}
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
362
|
+
const sorted = [...usedDeps.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
363
|
+
console.log(`\n📦 [${envName === "client" ? "Client" : "Server"} bundle] ${sorted.length} dependencies used from package.json:`);
|
|
364
|
+
if (sorted.length === 0) console.log(" (None)");
|
|
365
|
+
else for (const [name, info] of sorted) {
|
|
366
|
+
const typeTag = info.type ? ` \u{1B}[33m[${info.type}]\u{1B}[0m` : "";
|
|
367
|
+
console.log(` - \u{1B}[36m${name}@${info.version}\u{1B}[0m${typeTag}`);
|
|
368
|
+
}
|
|
360
369
|
},
|
|
361
370
|
closeBundle: {
|
|
362
371
|
order: "pre",
|