@pracht/cli 1.3.1 → 1.3.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/CHANGELOG.md +11 -0
- package/dist/{build-CiFKxDlE.mjs → build-B7_6RUBf.mjs} +10 -2
- package/dist/{doctor-pY1BYaFH.mjs → doctor-DyOWEA42.mjs} +1 -1
- package/dist/{generate-DqKWCmIu.mjs → generate-V7pQExlW.mjs} +1 -1
- package/dist/index.mjs +18 -6
- package/dist/{inspect-vYYIN8Ju.mjs → inspect-CFD3-dna.mjs} +1 -1
- package/dist/{project-CfxHKBzP.mjs → project-voPTS9UC.mjs} +1 -1
- package/dist/{verification-ClzkW6_q.mjs → verification-CSj-ngqk.mjs} +4 -4
- package/dist/{verify-eRkOdBaK.mjs → verify-D0pGwcyf.mjs} +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @pracht/cli
|
|
2
2
|
|
|
3
|
+
## 1.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0bd717f`](https://github.com/JoviDeCroock/pracht/commit/0bd717f280bc69a65efa6c4cb3142140ec88c9ac) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Tighten framework and deployment DX after the framework review: add shell-level error boundaries and clearer debug errors without route boundaries, fix pages-router route specificity and `.tsrx` server discovery, correct the dev error overlay import, expose generated-entry context factories for built-in adapters, add configurable Node/dev request body limits, fix CLI version reporting, refresh starter defaults, and align docs/onboarding examples with the current package names and adapter APIs.
|
|
8
|
+
|
|
9
|
+
- [`e7be45d`](https://github.com/JoviDeCroock/pracht/commit/e7be45da86eb8d04d2e5dc6c1c76547c2491cd2d) Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Tighten prerender path safety by rejecting dynamic dot segments and unsafe static route segments, and by bounding SSG/ISG writes to `dist/client`. Deduplicate the default Node adapter entry generation and preserve multiple `Set-Cookie` headers in Node responses.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`0bd717f`](https://github.com/JoviDeCroock/pracht/commit/0bd717f280bc69a65efa6c4cb3142140ec88c9ac), [`e7be45d`](https://github.com/JoviDeCroock/pracht/commit/e7be45da86eb8d04d2e5dc6c1c76547c2491cd2d)]:
|
|
12
|
+
- @pracht/core@0.6.0
|
|
13
|
+
|
|
3
14
|
## 1.3.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -2,7 +2,7 @@ import { r as VERSION } from "./index.mjs";
|
|
|
2
2
|
import { t as readClientBuildAssets } from "./build-metadata-BOChHO8g.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { cpSync, existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import { build } from "vite";
|
|
8
8
|
//#region src/build-shared.ts
|
|
@@ -186,7 +186,7 @@ var build_default = defineCommand({
|
|
|
186
186
|
if (pages.length > 0) {
|
|
187
187
|
console.log(`\n Prerendering ${pages.length} SSG/ISG route(s)...\n`);
|
|
188
188
|
for (const page of pages) {
|
|
189
|
-
const filePath =
|
|
189
|
+
const filePath = resolvePrerenderOutputPath(clientDir, page.path);
|
|
190
190
|
mkdirSync(dirname(filePath), { recursive: true });
|
|
191
191
|
writeFileSync(filePath, page.html, "utf-8");
|
|
192
192
|
console.log(` ${page.path} → ${filePath.replace(root + "/", "")}`);
|
|
@@ -222,5 +222,13 @@ var build_default = defineCommand({
|
|
|
222
222
|
console.log("\n Build complete.\n");
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
|
+
function resolvePrerenderOutputPath(clientDir, routePath) {
|
|
226
|
+
if (routePath.includes("\0")) throw new Error(`Refusing to write prerendered route "${routePath}" with a NUL byte.`);
|
|
227
|
+
const root = resolve(clientDir);
|
|
228
|
+
const filePath = routePath === "/" ? resolve(root, "index.html") : resolve(root, `.${routePath}`, "index.html");
|
|
229
|
+
const relativePath = relative(root, filePath);
|
|
230
|
+
if (relativePath === "" || relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath)) throw new Error(`Refusing to write prerendered route "${routePath}" outside dist/client (${filePath}).`);
|
|
231
|
+
return filePath;
|
|
232
|
+
}
|
|
225
233
|
//#endregion
|
|
226
234
|
export { build_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as requireEnum, a as readProjectConfig, c as resolveProjectPath, d as writeGeneratedFile, f as ensureTrailingNewline, g as quote, h as parseCommaList, l as resolveRouteModulePath, m as parseApiMethods, n as displayPath, o as resolveApiModulePath, s as resolvePagesRouteModulePath, t as assertFileExists, u as resolveScopedFile, v as requirePositiveInteger } from "./project-
|
|
1
|
+
import { _ as requireEnum, a as readProjectConfig, c as resolveProjectPath, d as writeGeneratedFile, f as ensureTrailingNewline, g as quote, h as parseCommaList, l as resolveRouteModulePath, m as parseApiMethods, n as displayPath, o as resolveApiModulePath, s as resolvePagesRouteModulePath, t as assertFileExists, u as resolveScopedFile, v as requirePositiveInteger } from "./project-voPTS9UC.mjs";
|
|
2
2
|
import { a as toManifestModulePath, i as insertArrayItem, n as extractRegistryEntries, o as upsertObjectEntry, t as ensureCoreNamedImport } from "./manifest-Bs5hp3gA.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { readFileSync, writeFileSync } from "node:fs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { defineCommand, runMain } from "citty";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
2
3
|
//#region src/constants.ts
|
|
3
|
-
const VERSION =
|
|
4
|
+
const VERSION = readPackageVersion();
|
|
5
|
+
function readPackageVersion() {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8")).version ?? "0.0.0";
|
|
8
|
+
} catch {
|
|
9
|
+
return "0.0.0";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
4
12
|
const PROJECT_DEFAULTS = {
|
|
5
13
|
apiDir: "/src/api",
|
|
6
14
|
appFile: "/src/routes.ts",
|
|
@@ -22,6 +30,10 @@ const HTTP_METHODS = new Set([
|
|
|
22
30
|
]);
|
|
23
31
|
//#endregion
|
|
24
32
|
//#region src/index.ts
|
|
33
|
+
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
34
|
+
console.log(VERSION);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
25
37
|
runMain(defineCommand({
|
|
26
38
|
meta: {
|
|
27
39
|
name: "pracht",
|
|
@@ -29,12 +41,12 @@ runMain(defineCommand({
|
|
|
29
41
|
description: "The pracht CLI"
|
|
30
42
|
},
|
|
31
43
|
subCommands: {
|
|
32
|
-
build: () => import("./build-
|
|
44
|
+
build: () => import("./build-B7_6RUBf.mjs").then((m) => m.default),
|
|
33
45
|
dev: () => import("./dev-BCFe3g38.mjs").then((m) => m.default),
|
|
34
|
-
doctor: () => import("./doctor-
|
|
35
|
-
generate: () => import("./generate-
|
|
36
|
-
inspect: () => import("./inspect-
|
|
37
|
-
verify: () => import("./verify-
|
|
46
|
+
doctor: () => import("./doctor-DyOWEA42.mjs").then((m) => m.default),
|
|
47
|
+
generate: () => import("./generate-V7pQExlW.mjs").then((m) => m.default),
|
|
48
|
+
inspect: () => import("./inspect-CFD3-dna.mjs").then((m) => m.default),
|
|
49
|
+
verify: () => import("./verify-D0pGwcyf.mjs").then((m) => m.default)
|
|
38
50
|
}
|
|
39
51
|
}));
|
|
40
52
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as HTTP_METHODS } from "./index.mjs";
|
|
2
2
|
import { t as readClientBuildAssets } from "./build-metadata-BOChHO8g.mjs";
|
|
3
|
-
import { a as readProjectConfig, c as resolveProjectPath, p as handleCliError } from "./project-
|
|
3
|
+
import { a as readProjectConfig, c as resolveProjectPath, p as handleCliError } from "./project-voPTS9UC.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import { resolve } from "node:path";
|
|
@@ -124,7 +124,7 @@ function listFilesRecursively(dir) {
|
|
|
124
124
|
return files;
|
|
125
125
|
}
|
|
126
126
|
function hasPagesAppShell(filePath) {
|
|
127
|
-
return /^_app\.(ts|tsx|js|jsx)$/.test(basename(filePath));
|
|
127
|
+
return /^_app\.(ts|tsx|tsrx|js|jsx)$/.test(basename(filePath));
|
|
128
128
|
}
|
|
129
129
|
function findConfigFile(root) {
|
|
130
130
|
for (const name of [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as readProjectConfig, c as resolveProjectPath, i as listFilesRecursively, n as displayPath, r as hasPagesAppShell } from "./project-
|
|
1
|
+
import { a as readProjectConfig, c as resolveProjectPath, i as listFilesRecursively, n as displayPath, r as hasPagesAppShell } from "./project-voPTS9UC.mjs";
|
|
2
2
|
import { n as extractRegistryEntries, r as extractRelativeModulePaths } from "./manifest-Bs5hp3gA.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, isAbsolute, relative, resolve } from "node:path";
|
|
@@ -12,8 +12,8 @@ const CONFIG_FILE_NAMES = new Set([
|
|
|
12
12
|
"vite.config.cjs",
|
|
13
13
|
"vite.config.cts"
|
|
14
14
|
]);
|
|
15
|
-
const MODULE_SOURCE_RE = /\.(ts|tsx|js|jsx)$/;
|
|
16
|
-
const PAGE_SOURCE_RE = /\.(ts|tsx|js|jsx|md|mdx)$/;
|
|
15
|
+
const MODULE_SOURCE_RE = /\.(ts|tsx|tsrx|js|jsx)$/;
|
|
16
|
+
const PAGE_SOURCE_RE = /\.(ts|tsx|tsrx|js|jsx|md|mdx)$/;
|
|
17
17
|
function createCheck(status, message) {
|
|
18
18
|
return {
|
|
19
19
|
message,
|
|
@@ -52,7 +52,7 @@ function scanPagesDirectory(pagesDir) {
|
|
|
52
52
|
return listFilesRecursively(pagesDir).filter((file) => PAGE_SOURCE_RE.test(file)).map((file) => describePagesFile(pagesDir, file));
|
|
53
53
|
}
|
|
54
54
|
function describePagesFile(pagesDir, file) {
|
|
55
|
-
const routePath = relative(pagesDir, file).replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mdx?)$/, "");
|
|
55
|
+
const routePath = relative(pagesDir, file).replace(/\\/g, "/").replace(/\.(tsx?|tsrx|jsx?|mdx?)$/, "");
|
|
56
56
|
const name = basename(routePath);
|
|
57
57
|
if (hasPagesAppShell(file)) return {
|
|
58
58
|
file,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pracht/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/JoviDeCroock/pracht/tree/main/packages/cli",
|
|
6
6
|
"bugs": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"citty": "^0.1.6",
|
|
30
|
-
"@pracht/core": "0.
|
|
30
|
+
"@pracht/core": "0.6.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsdown"
|