hono-svelte 0.4.0 → 0.4.1
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 +8 -0
- package/dist/scaffold.js +11 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- Fix `hono-svelte init` refusing every file on Windows: `isSafeAppPath()`
|
|
6
|
+
now normalizes `\` vs `/` and compares case-insensitively on win32
|
|
7
|
+
(path traversal still blocked).
|
|
8
|
+
- Fix `bin` path without `./` prefix — npm was silently stripping the CLI
|
|
9
|
+
from the published tarball.
|
|
10
|
+
|
|
3
11
|
## 0.4.0
|
|
4
12
|
|
|
5
13
|
- **Typed `c.render` entries (opt-in)**: `pages({ dts })` writes a `.d.ts` file
|
package/dist/scaffold.js
CHANGED
|
@@ -101,7 +101,17 @@ export function checkAppLink(appRoot) {
|
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
103
|
export function isSafeAppPath(appRoot, target) {
|
|
104
|
+
// NOTE: compare case-insensitively on Windows (C:\Users vs c:\users) and
|
|
105
|
+
// accept both separators. `join("C:\\x", "src/a")` yields backslashes,
|
|
106
|
+
// so checking `startsWith(root + "/")` always failed on win32 and `init`
|
|
107
|
+
// refused every file.
|
|
104
108
|
const root = resolve(appRoot);
|
|
105
109
|
const abs = isAbsolute(target) ? target : resolve(root, target);
|
|
106
|
-
|
|
110
|
+
const norm = (p) => p.replace(/\\/g, "/");
|
|
111
|
+
const lower = (p) => (process.platform === "win32" ? p.toLowerCase() : p);
|
|
112
|
+
const nRoot = lower(norm(root));
|
|
113
|
+
const nAbs = lower(norm(abs));
|
|
114
|
+
// Exact root itself is not a writable file, but treat as safe for symmetry
|
|
115
|
+
// with the old check; callers only pass file paths.
|
|
116
|
+
return nAbs === nRoot || nAbs.startsWith(nRoot + "/");
|
|
107
117
|
}
|