@tokenoftrust/storefront-runner 3.7.0 → 3.7.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/apps/storefront/astro.config.mjs +7 -5
- package/apps/storefront/src/components/catalog/storefront/islands/RecentlyViewed.tsx +5 -2
- package/package.json +1 -1
- package/packages/cli/src/visual-parity.mjs +5 -2
- package/packages/public-runtime/scripts/generate-managed-analytics-api-v1-schemas.mjs +7 -4
|
@@ -16,16 +16,18 @@ import cloudflare from "@astrojs/cloudflare";
|
|
|
16
16
|
// npm before/as this storefront ships, else the pasted `npm i -g @tokenoftrust/cli@<v>` 404s.
|
|
17
17
|
// The CLI publish workflow (.github/workflows/publish-cli.yml) is the publisher; there is no
|
|
18
18
|
// deploy-time guard yet that asserts the embedded version exists on npm — a worthwhile add.
|
|
19
|
-
//
|
|
20
|
-
// bare read here crashed `astro dev` for every standalone invited-dev boot.
|
|
21
|
-
//
|
|
19
|
+
// A missing package.json does not throw: the published RUNNER tree prunes packages/cli, and a
|
|
20
|
+
// bare read here crashed `astro dev` for every standalone invited-dev boot. Unreadable or
|
|
21
|
+
// corrupt JSON still fails the build. The runner's local page falls back to the floating spec.
|
|
22
22
|
const cliVersion = (() => {
|
|
23
23
|
try {
|
|
24
24
|
return JSON.parse(
|
|
25
25
|
readFileSync(fileURLToPath(new URL("../../packages/cli/package.json", import.meta.url)), "utf8"),
|
|
26
26
|
).version;
|
|
27
|
-
} catch {
|
|
28
|
-
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// Missing file: the published runner tree prunes packages/cli. Unreadable or corrupt JSON still fails the build.
|
|
29
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return null;
|
|
30
|
+
throw error;
|
|
29
31
|
}
|
|
30
32
|
})();
|
|
31
33
|
const cliInstallSpec = cliVersion ? `@tokenoftrust/cli@${cliVersion}` : "@tokenoftrust/cli";
|
|
@@ -38,8 +38,11 @@ function read(): RVItem[] {
|
|
|
38
38
|
if (!raw) return [];
|
|
39
39
|
const arr = JSON.parse(raw);
|
|
40
40
|
return Array.isArray(arr) ? (arr as RVItem[]) : [];
|
|
41
|
-
} catch {
|
|
42
|
-
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// Corrupt JSON or blocked storage is an empty rail. Any other failure is a bug.
|
|
43
|
+
if (error instanceof SyntaxError) return [];
|
|
44
|
+
if (typeof DOMException !== "undefined" && error instanceof DOMException) return [];
|
|
45
|
+
throw error;
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
|
|
6
6
|
"packageManager": "pnpm@11.9.0",
|
|
@@ -61,11 +61,14 @@ function parseConfig(tenantDir) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/** The checkout's `.tot/config.json`, or null when absent or
|
|
64
|
+
/** The checkout's `.tot/config.json`, or null when it is absent or malformed. Unreadable throws. */
|
|
65
65
|
function readTotConfig(tenantDir) {
|
|
66
66
|
try {
|
|
67
67
|
return JSON.parse(readFileSync(join(tenantDir, ".tot", "config.json"), "utf8"));
|
|
68
|
-
} catch {
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (error?.code === "ENOENT" || error instanceof SyntaxError) return null;
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
function allowedNavigation(value, allowlist) {
|
|
@@ -36,19 +36,22 @@ export async function renderManagedAnalyticsSchemas() {
|
|
|
36
36
|
*/
|
|
37
37
|
export async function findSchemaDrift(root = repoRoot) {
|
|
38
38
|
const files = await renderManagedAnalyticsSchemas();
|
|
39
|
+
/** A missing file is drift. An unreadable one is not "absent". @param {unknown} error */
|
|
40
|
+
const missing = (error) => error && typeof error === "object" && "code" in error && error.code === "ENOENT";
|
|
39
41
|
/** @param {string} path */
|
|
40
42
|
const committed = (path) => {
|
|
41
43
|
try {
|
|
42
44
|
return readFileSync(resolve(root, path), "utf8");
|
|
43
|
-
} catch {
|
|
44
|
-
return null;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (missing(error)) return null;
|
|
47
|
+
throw error;
|
|
45
48
|
}
|
|
46
49
|
};
|
|
47
50
|
let present = [];
|
|
48
51
|
try {
|
|
49
52
|
present = readdirSync(resolve(root, OUTPUT_DIR));
|
|
50
|
-
} catch {
|
|
51
|
-
|
|
53
|
+
} catch (error) {
|
|
54
|
+
if (!missing(error)) throw error;
|
|
52
55
|
}
|
|
53
56
|
return {
|
|
54
57
|
files,
|