@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/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.2",
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
- if (!resolved.startsWith(rootDir + path.sep) && resolved !== rootDir) return null;
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
- "Missing npm dependencies for site mode.",
407
- "Run `npm install` in this package (requires network access).",
408
- `Or run static mode: \`${CLI_NAME} --mode static\``,
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
  }