@zktx.io/walrus-sites-preview 0.0.2 → 0.1.0
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/LICENSE +21 -0
- package/README.md +200 -43
- package/dist/walrus-sites-portal-register-sw.js +1 -1
- package/dist/walrus-sites-sw.js +1 -1
- package/package.json +4 -1
- package/preview.mjs +7 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zktx.io/walrus-sites-preview",
|
|
3
3
|
"description": "Local preview CLI for Walrus Sites (fetch from Sui + Walrus, or serve bundled static portal dist).",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"preview": "preview.mjs"
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"format": "prettier . --write",
|
|
16
16
|
"format:check": "prettier . --check",
|
|
17
17
|
"build": "node ./build-dist.mjs",
|
|
18
|
+
"test": "node ./scripts/verify-maintenance.mjs",
|
|
19
|
+
"verify": "node ./scripts/verify-maintenance.mjs",
|
|
20
|
+
"upstream:download": "node ./scripts/sync-walrus-upstream.mjs",
|
|
18
21
|
"start:mainnet": "node ./preview.mjs -mainnet",
|
|
19
22
|
"prepack": "npm run build"
|
|
20
23
|
},
|
package/preview.mjs
CHANGED
|
@@ -194,7 +194,9 @@ function contentType(filePath) {
|
|
|
194
194
|
function safeResolve(rootDir, urlPath) {
|
|
195
195
|
const rel = urlPath.replace(/^\/+/, "");
|
|
196
196
|
const resolved = path.resolve(rootDir, rel);
|
|
197
|
-
|
|
197
|
+
const normalizedRoot = path.normalize(rootDir + path.sep);
|
|
198
|
+
const normalizedResolved = path.normalize(resolved + path.sep);
|
|
199
|
+
if (!normalizedResolved.startsWith(normalizedRoot)) return null;
|
|
198
200
|
return resolved;
|
|
199
201
|
}
|
|
200
202
|
|
|
@@ -403,9 +405,10 @@ async function createSiteHandler(siteConfig) {
|
|
|
403
405
|
if (message.includes("ERR_MODULE_NOT_FOUND") || message.includes("Cannot find package")) {
|
|
404
406
|
throw new Error(
|
|
405
407
|
[
|
|
406
|
-
"
|
|
407
|
-
"
|
|
408
|
-
|
|
408
|
+
"Failed to load @mysten/sui dependencies for site mode.",
|
|
409
|
+
"If you're running from this repo, run `npm install` here first.",
|
|
410
|
+
"If you're using the published package, reinstall it in your project: `npm i -D @zktx.io/walrus-sites-preview`.",
|
|
411
|
+
"Then run the command again.",
|
|
409
412
|
].join("\n"),
|
|
410
413
|
);
|
|
411
414
|
}
|