@auscera/design-labs 0.0.0-stage → 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/apps/workspace/.skills/design-labs/SKILL.md +63 -0
- package/apps/workspace/.skills/design-labs/references/commands.md +38 -0
- package/apps/workspace/AGENTS.md +9 -0
- package/apps/workspace/app/(lab)/compare/page.tsx +2 -0
- package/apps/workspace/app/(lab)/lab.css +412 -0
- package/apps/workspace/app/(lab)/layout.tsx +21 -0
- package/apps/workspace/app/(lab)/page.tsx +2 -0
- package/apps/workspace/app/api/annotations/route.ts +94 -0
- package/apps/workspace/app/api/versions/events/route.ts +63 -0
- package/apps/workspace/app/api/versions/route.ts +7 -0
- package/apps/workspace/components/animated-icons.tsx +72 -0
- package/apps/workspace/components/dotmatrix-loader.css +1228 -0
- package/apps/workspace/components/glass-controls.tsx +47 -0
- package/apps/workspace/components/lab-providers.tsx +17 -0
- package/apps/workspace/components/molecules/brand-lockup.tsx +13 -0
- package/apps/workspace/components/molecules/pane-url-popover.css +92 -0
- package/apps/workspace/components/molecules/pane-url-popover.tsx +191 -0
- package/apps/workspace/components/pane-preferences.tsx +75 -0
- package/apps/workspace/components/pane-viewport.css +34 -0
- package/apps/workspace/components/pane-viewport.tsx +199 -0
- package/apps/workspace/components/preview-pane.css +293 -0
- package/apps/workspace/components/preview-pane.tsx +662 -0
- package/apps/workspace/components/ui/dotm-triangle-11.tsx +170 -0
- package/apps/workspace/components/ui/dotmatrix-core.tsx +1649 -0
- package/apps/workspace/components/ui/dotmatrix-hooks.ts +224 -0
- package/apps/workspace/components/version-select.tsx +220 -0
- package/apps/workspace/components/workspace.tsx +313 -0
- package/apps/workspace/eslint.config.mjs +3 -0
- package/apps/workspace/lab.config.json +1 -0
- package/apps/workspace/lib/annotation-export.ts +28 -0
- package/apps/workspace/lib/annotation-types.ts +38 -0
- package/apps/workspace/lib/device-presets.ts +103 -0
- package/apps/workspace/lib/use-annotation-bridge.ts +130 -0
- package/apps/workspace/lib/version-types.ts +12 -0
- package/apps/workspace/lib/website-url.ts +78 -0
- package/apps/workspace/next-env.d.ts +6 -0
- package/apps/workspace/next.config.mjs +1 -0
- package/apps/workspace/package.json +35 -0
- package/apps/workspace/public/apple-touch-icon.png +0 -0
- package/apps/workspace/public/brand/design-labs-script.LICENSE.txt +93 -0
- package/apps/workspace/public/brand/design-labs-script.woff2 +0 -0
- package/apps/workspace/public/brand/logo.webp +0 -0
- package/apps/workspace/public/brand/wordmark.css +42 -0
- package/apps/workspace/public/favicon.ico +0 -0
- package/apps/workspace/public/icon-192.png +0 -0
- package/apps/workspace/public/icon-512.png +0 -0
- package/apps/workspace/public/preview-bridge.js +411 -0
- package/apps/workspace/public/site.webmanifest +1 -0
- package/apps/workspace/scripts/annotation-store.mjs +308 -0
- package/apps/workspace/scripts/lab.mjs +414 -0
- package/apps/workspace/scripts/migrate.mjs +2 -0
- package/apps/workspace/scripts/prepare-preview.mjs +203 -0
- package/apps/workspace/tsconfig.json +24 -0
- package/package.json +9 -3
- package/scripts/install.mjs +67 -0
- package/scripts/update.mjs +204 -0
- package/README.md +0 -3
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import net from "node:net";
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
export const ignored = (n) =>
|
|
10
|
+
[
|
|
11
|
+
"node_modules",
|
|
12
|
+
".next",
|
|
13
|
+
".turbo",
|
|
14
|
+
".git",
|
|
15
|
+
"dist",
|
|
16
|
+
"build",
|
|
17
|
+
"out",
|
|
18
|
+
".lab-state",
|
|
19
|
+
"__pycache__",
|
|
20
|
+
].includes(n) ||
|
|
21
|
+
n.startsWith(".env") ||
|
|
22
|
+
n.endsWith(".tsbuildinfo") ||
|
|
23
|
+
n === "next-env.d.ts";
|
|
24
|
+
export function files(dir, prefix = "", exclude = null) {
|
|
25
|
+
return fs
|
|
26
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
27
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
28
|
+
.flatMap((e) => {
|
|
29
|
+
if (ignored(e.name)) return [];
|
|
30
|
+
if (exclude && path.resolve(dir, e.name) === exclude) return [];
|
|
31
|
+
if (e.isSymbolicLink())
|
|
32
|
+
throw Error(
|
|
33
|
+
`Symlink requires explicit agent integration: ${prefix + e.name}`,
|
|
34
|
+
);
|
|
35
|
+
return e.isDirectory()
|
|
36
|
+
? files(path.join(dir, e.name), prefix + e.name + "/", exclude)
|
|
37
|
+
: [prefix + e.name];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function hashes(dir, exclude = null) {
|
|
41
|
+
return Object.fromEntries(
|
|
42
|
+
files(dir, "", exclude).map((f) => [
|
|
43
|
+
f,
|
|
44
|
+
crypto
|
|
45
|
+
.createHash("sha256")
|
|
46
|
+
.update(fs.readFileSync(path.join(dir, f)))
|
|
47
|
+
.digest("hex"),
|
|
48
|
+
]),
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
export const fingerprint = (obj) =>
|
|
52
|
+
crypto.createHash("sha256").update(JSON.stringify(obj)).digest("hex");
|
|
53
|
+
export function write(file, value) {
|
|
54
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
55
|
+
const tmp = file + ".tmp";
|
|
56
|
+
fs.writeFileSync(tmp, JSON.stringify(value, null, 2) + "\n");
|
|
57
|
+
fs.renameSync(tmp, file);
|
|
58
|
+
}
|
|
59
|
+
export function copy(src, dst, exclude = null) {
|
|
60
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
61
|
+
for (const f of files(src, "", exclude)) {
|
|
62
|
+
fs.mkdirSync(path.dirname(path.join(dst, f)), { recursive: true });
|
|
63
|
+
fs.copyFileSync(path.join(src, f), path.join(dst, f));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const now = () => new Date().toISOString();
|
|
67
|
+
export function config(root) {
|
|
68
|
+
return JSON.parse(
|
|
69
|
+
fs.readFileSync(path.join(root, "lab.config.json"), "utf8"),
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
function save(root, c) {
|
|
73
|
+
write(path.join(root, "lab.config.json"), c);
|
|
74
|
+
}
|
|
75
|
+
function slug(s) {
|
|
76
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(s || ""))
|
|
77
|
+
throw Error("Use lowercase letters, numbers and hyphens for IDs");
|
|
78
|
+
return s;
|
|
79
|
+
}
|
|
80
|
+
export function scan(root, offline = false) {
|
|
81
|
+
const c = config(root);
|
|
82
|
+
let changed = false;
|
|
83
|
+
for (const v of c.versions) {
|
|
84
|
+
const h = hashes(path.join(root, v.source));
|
|
85
|
+
const digest = fingerprint(h);
|
|
86
|
+
if (v.contentHash !== digest) {
|
|
87
|
+
v.updatedAt = v.contentHash ? now() : null;
|
|
88
|
+
v.changeTimeKind = v.contentHash
|
|
89
|
+
? offline
|
|
90
|
+
? "detected"
|
|
91
|
+
: "observed"
|
|
92
|
+
: "unknown";
|
|
93
|
+
v.contentHash = digest;
|
|
94
|
+
v.fileHashes = h;
|
|
95
|
+
changed = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (changed) save(root, c);
|
|
99
|
+
return c;
|
|
100
|
+
}
|
|
101
|
+
export function snapshot(
|
|
102
|
+
root,
|
|
103
|
+
{ source, project = "website", category = "landing", version = "production" },
|
|
104
|
+
) {
|
|
105
|
+
slug(project);
|
|
106
|
+
slug(version);
|
|
107
|
+
if (!["landing", "dashboard"].includes(category))
|
|
108
|
+
throw Error("Category must be landing or dashboard");
|
|
109
|
+
source = fs.realpathSync(source);
|
|
110
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(source, "package.json")));
|
|
111
|
+
if (!pkg.dependencies?.next && !pkg.devDependencies?.next)
|
|
112
|
+
throw Error("Only Next.js projects are supported");
|
|
113
|
+
root = fs.realpathSync(root);
|
|
114
|
+
if (source === root) throw Error("Cannot snapshot the Lab itself");
|
|
115
|
+
const exclude = root.startsWith(source + path.sep) ? root : null;
|
|
116
|
+
const c = config(root);
|
|
117
|
+
const key = `${project}/${category}/${version}`;
|
|
118
|
+
if (c.versions.some((v) => v.key === key))
|
|
119
|
+
throw Error("Version already exists");
|
|
120
|
+
const rel = `versions/${category}/${version}/source`;
|
|
121
|
+
const dest = path.join(root, rel);
|
|
122
|
+
if (fs.existsSync(dest)) throw Error("Destination already exists");
|
|
123
|
+
copy(source, dest, exclude);
|
|
124
|
+
const h = hashes(dest);
|
|
125
|
+
if (fingerprint(h) !== fingerprint(hashes(source, exclude)))
|
|
126
|
+
throw Error("Source changed during snapshot; retry with a new version");
|
|
127
|
+
const v = {
|
|
128
|
+
key,
|
|
129
|
+
project,
|
|
130
|
+
category,
|
|
131
|
+
slug: version,
|
|
132
|
+
label: version,
|
|
133
|
+
summary: `${category} source snapshot`,
|
|
134
|
+
status: "needs-setup",
|
|
135
|
+
source: rel,
|
|
136
|
+
origin: source,
|
|
137
|
+
originHashes: h,
|
|
138
|
+
fileHashes: h,
|
|
139
|
+
contentHash: fingerprint(h),
|
|
140
|
+
createdAt: now(),
|
|
141
|
+
updatedAt: now(),
|
|
142
|
+
changeTimeKind: "observed",
|
|
143
|
+
production: version === "production",
|
|
144
|
+
runtime: { port: 4100 + c.versions.length },
|
|
145
|
+
};
|
|
146
|
+
// Monorepos often keep their lockfile above the app. Preserve it as
|
|
147
|
+
// provenance outside source instead of injecting it into the archived app.
|
|
148
|
+
let ancestor = source;
|
|
149
|
+
while (true) {
|
|
150
|
+
const locks = ["pnpm-lock.yaml", "package-lock.json", "yarn.lock", "bun.lock"].filter(
|
|
151
|
+
(name) => fs.existsSync(path.join(ancestor, name)),
|
|
152
|
+
);
|
|
153
|
+
if (locks.length) {
|
|
154
|
+
const records = path.join(root, path.dirname(rel), "dependency-records");
|
|
155
|
+
fs.mkdirSync(records, { recursive: true });
|
|
156
|
+
for (const name of locks) fs.copyFileSync(path.join(ancestor, name), path.join(records, name));
|
|
157
|
+
v.dependencyRecords = path.relative(root, records);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
const parent = path.dirname(ancestor);
|
|
161
|
+
if (parent === ancestor) break;
|
|
162
|
+
ancestor = parent;
|
|
163
|
+
}
|
|
164
|
+
c.versions.push(v);
|
|
165
|
+
save(root, c);
|
|
166
|
+
return v;
|
|
167
|
+
}
|
|
168
|
+
export function duplicate(root, key, name) {
|
|
169
|
+
slug(name);
|
|
170
|
+
const c = config(root),
|
|
171
|
+
v = c.versions.find((v) => v.key === key);
|
|
172
|
+
if (!v) throw Error("Unknown source version");
|
|
173
|
+
const n = snapshot(root, {
|
|
174
|
+
source: path.join(root, v.source),
|
|
175
|
+
project: v.project,
|
|
176
|
+
category: v.category,
|
|
177
|
+
version: name,
|
|
178
|
+
});
|
|
179
|
+
const d = config(root),
|
|
180
|
+
out = d.versions.find((v) => v.key === n.key);
|
|
181
|
+
Object.assign(out, {
|
|
182
|
+
origin: v.origin,
|
|
183
|
+
originHashes: v.originHashes,
|
|
184
|
+
production: false,
|
|
185
|
+
});
|
|
186
|
+
save(root, d);
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
export function selectProduction(root, key) {
|
|
190
|
+
const c = config(root),
|
|
191
|
+
v = c.versions.find((v) => v.key === key);
|
|
192
|
+
if (!v) throw Error("Unknown version");
|
|
193
|
+
for (const x of c.versions)
|
|
194
|
+
if (x.project === v.project && x.category === v.category)
|
|
195
|
+
x.production = x.key === key;
|
|
196
|
+
save(root, c);
|
|
197
|
+
}
|
|
198
|
+
export function diff(root, key) {
|
|
199
|
+
const v = config(root).versions.find((v) => v.key === key);
|
|
200
|
+
if (!v?.origin) throw Error("No origin recorded");
|
|
201
|
+
const lab = fs.realpathSync(root);
|
|
202
|
+
const origin = fs.realpathSync(v.origin);
|
|
203
|
+
const exclude = lab.startsWith(origin + path.sep) ? lab : null;
|
|
204
|
+
const source = hashes(path.join(root, v.source)),
|
|
205
|
+
target = hashes(origin, exclude);
|
|
206
|
+
const protectedPath = exclude && path.relative(origin, exclude).split(path.sep).join("/");
|
|
207
|
+
if (protectedPath && Object.keys(source).some(file => file === protectedPath || file.startsWith(protectedPath + "/")))
|
|
208
|
+
throw Error("Version contains files targeting the installed Lab");
|
|
209
|
+
const changes = [...new Set([...Object.keys(source), ...Object.keys(target)])]
|
|
210
|
+
.filter((f) => source[f] !== target[f])
|
|
211
|
+
.map((file) => ({
|
|
212
|
+
file,
|
|
213
|
+
action: !source[file] ? "delete" : !target[file] ? "add" : "modify",
|
|
214
|
+
}));
|
|
215
|
+
return {
|
|
216
|
+
key,
|
|
217
|
+
target: v.origin,
|
|
218
|
+
changes,
|
|
219
|
+
drift: fingerprint(target) !== fingerprint(v.originHashes),
|
|
220
|
+
token: fingerprint({ source, target }),
|
|
221
|
+
source,
|
|
222
|
+
targetHashes: target,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export function apply(root, key, token) {
|
|
226
|
+
const d = diff(root, key);
|
|
227
|
+
if (d.drift)
|
|
228
|
+
throw Error(
|
|
229
|
+
"Origin changed since snapshot; reconcile explicitly before transfer",
|
|
230
|
+
);
|
|
231
|
+
if (token !== d.token)
|
|
232
|
+
throw Error(
|
|
233
|
+
"Review token missing or stale; run diff and review the changes",
|
|
234
|
+
);
|
|
235
|
+
const v = config(root).versions.find((v) => v.key === key);
|
|
236
|
+
const checkpoint = path.join(
|
|
237
|
+
root,
|
|
238
|
+
".lab-state/checkpoints",
|
|
239
|
+
crypto.randomUUID(),
|
|
240
|
+
);
|
|
241
|
+
const lab = fs.realpathSync(root);
|
|
242
|
+
const origin = fs.realpathSync(v.origin);
|
|
243
|
+
const exclude = lab.startsWith(origin + path.sep) ? lab : null;
|
|
244
|
+
copy(origin, checkpoint, exclude);
|
|
245
|
+
write(checkpoint + ".json", { origin: v.origin, hashes: d.targetHashes });
|
|
246
|
+
for (const { file, action } of d.changes) {
|
|
247
|
+
const to = path.join(v.origin, file);
|
|
248
|
+
if (action === "delete") fs.unlinkSync(to);
|
|
249
|
+
else {
|
|
250
|
+
fs.mkdirSync(path.dirname(to), { recursive: true });
|
|
251
|
+
fs.copyFileSync(path.join(root, v.source, file), to);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const c = config(root);
|
|
255
|
+
c.versions.find((v) => v.key === key).originHashes = hashes(origin, exclude);
|
|
256
|
+
save(root, c);
|
|
257
|
+
return { checkpoint, changes: d.changes };
|
|
258
|
+
}
|
|
259
|
+
export async function availablePort(preferred = 3001, { strict = false, excluded = [] } = {}) {
|
|
260
|
+
const start = Number(preferred);
|
|
261
|
+
if (!Number.isInteger(start) || start < 1 || start > 65535)
|
|
262
|
+
throw Error("Port must be an integer between 1 and 65535");
|
|
263
|
+
for (let port = start; port <= Math.min(start + (strict ? 0 : 49), 65535); port++) {
|
|
264
|
+
if (excluded.includes(port)) continue;
|
|
265
|
+
const free = await new Promise((resolve, reject) => {
|
|
266
|
+
const server = net.createServer();
|
|
267
|
+
server.once("error", (error) => {
|
|
268
|
+
if (error.code === "EADDRINUSE") resolve(false);
|
|
269
|
+
else reject(error);
|
|
270
|
+
});
|
|
271
|
+
server.listen({ host: "127.0.0.1", port, exclusive: true }, () =>
|
|
272
|
+
server.close(() => resolve(true)),
|
|
273
|
+
);
|
|
274
|
+
});
|
|
275
|
+
if (free) return port;
|
|
276
|
+
}
|
|
277
|
+
throw Error(strict
|
|
278
|
+
? `Port ${start} is already in use. Stop that server, choose another --port, or omit --port to select a free port automatically.`
|
|
279
|
+
: `No available port in ${start}–${Math.min(start + 49, 65535)}. Choose another --port.`);
|
|
280
|
+
}
|
|
281
|
+
export async function dev(root, requestedPort) {
|
|
282
|
+
const c = config(root);
|
|
283
|
+
const preferred = requestedPort ?? process.env.PORT ?? c.port ?? 3001;
|
|
284
|
+
const port = await availablePort(preferred, {
|
|
285
|
+
strict: requestedPort !== undefined || process.env.PORT !== undefined,
|
|
286
|
+
excluded: c.versions.filter(v => v.runtime && !v.path).map(v => Number(v.runtime.port)),
|
|
287
|
+
});
|
|
288
|
+
if (port !== Number(preferred)) console.log(`Port ${preferred} is in use; using ${port}.`);
|
|
289
|
+
console.log(`Design Labs: http://127.0.0.1:${port}`);
|
|
290
|
+
scan(root, true);
|
|
291
|
+
const children = [];
|
|
292
|
+
const run = (args, cwd) => {
|
|
293
|
+
const p = spawn("pnpm", args, {
|
|
294
|
+
cwd,
|
|
295
|
+
stdio: "inherit",
|
|
296
|
+
env: {...process.env,NEXT_PUBLIC_DESIGN_LABS_ORIGIN:`http://127.0.0.1:${port}`},
|
|
297
|
+
detached: process.platform !== "win32",
|
|
298
|
+
});
|
|
299
|
+
children.push(p);
|
|
300
|
+
p.on("error", (e) => console.error(e.message));
|
|
301
|
+
return p;
|
|
302
|
+
};
|
|
303
|
+
for (const v of config(root).versions) {
|
|
304
|
+
if (v.runtime && !v.path) {
|
|
305
|
+
const dir = path.join(root, v.adapter || v.source);
|
|
306
|
+
if (!fs.existsSync(path.join(dir, "node_modules"))) {
|
|
307
|
+
console.error(
|
|
308
|
+
`${v.key}: dependencies missing. Run doctor; prepare this preview before launch.`,
|
|
309
|
+
);
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
run(
|
|
313
|
+
[
|
|
314
|
+
"exec",
|
|
315
|
+
"next",
|
|
316
|
+
"dev",
|
|
317
|
+
"-p",
|
|
318
|
+
String(v.runtime.port),
|
|
319
|
+
"--hostname",
|
|
320
|
+
"127.0.0.1",
|
|
321
|
+
],
|
|
322
|
+
dir,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
run(["exec", "next", "dev", "--turbopack", "-p", String(port), "--hostname", "127.0.0.1"], root);
|
|
327
|
+
const timer = setInterval(() => {
|
|
328
|
+
try {
|
|
329
|
+
scan(root);
|
|
330
|
+
} catch (e) {
|
|
331
|
+
console.error(e.message);
|
|
332
|
+
}
|
|
333
|
+
}, 1000);
|
|
334
|
+
let stopping = false;
|
|
335
|
+
function stop() {
|
|
336
|
+
if (stopping) return;
|
|
337
|
+
stopping = true;
|
|
338
|
+
clearInterval(timer);
|
|
339
|
+
for (const p of children) {
|
|
340
|
+
try {
|
|
341
|
+
process.kill(-p.pid, "SIGTERM");
|
|
342
|
+
} catch {
|
|
343
|
+
p.kill("SIGTERM");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
setTimeout(() => process.exit(0), 500).unref();
|
|
347
|
+
}
|
|
348
|
+
process.on("SIGINT", stop);
|
|
349
|
+
process.on("SIGTERM", stop);
|
|
350
|
+
children.at(-1).on("exit", stop);
|
|
351
|
+
}
|
|
352
|
+
export function doctor(root) {
|
|
353
|
+
return config(root).versions.map((v) => ({
|
|
354
|
+
key: v.key,
|
|
355
|
+
sourceExists: fs.existsSync(path.join(root, v.source)),
|
|
356
|
+
runtime: v.path
|
|
357
|
+
? "embedded"
|
|
358
|
+
: fs.existsSync(path.join(root, v.adapter || v.source, "node_modules"))
|
|
359
|
+
? "prepared"
|
|
360
|
+
: "needs dependencies and frontend adapter review",
|
|
361
|
+
note: "Do not copy secrets or launch backend services. Mock auth/data in a separate adapter.",
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
if (
|
|
365
|
+
process.argv[1] &&
|
|
366
|
+
path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)
|
|
367
|
+
) {
|
|
368
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
369
|
+
const [cmd, ...args] = process.argv.slice(2);
|
|
370
|
+
try {
|
|
371
|
+
let result;
|
|
372
|
+
switch (cmd) {
|
|
373
|
+
case "dev":
|
|
374
|
+
if (args.length && (args[0] !== "--port" || args.length !== 2))
|
|
375
|
+
throw Error("Usage: node scripts/lab.mjs dev [--port <number>]");
|
|
376
|
+
await dev(root, args[0] === "--port" ? args[1] : undefined);
|
|
377
|
+
break;
|
|
378
|
+
case "scan":
|
|
379
|
+
result = scan(root, true);
|
|
380
|
+
break;
|
|
381
|
+
case "doctor":
|
|
382
|
+
result = doctor(root);
|
|
383
|
+
break;
|
|
384
|
+
case "snapshot":
|
|
385
|
+
result = snapshot(root, {
|
|
386
|
+
source: path.resolve(args[0]),
|
|
387
|
+
project: args[1],
|
|
388
|
+
category: args[2],
|
|
389
|
+
version: args[3],
|
|
390
|
+
});
|
|
391
|
+
break;
|
|
392
|
+
case "duplicate":
|
|
393
|
+
result = duplicate(root, args[0], args[1]);
|
|
394
|
+
break;
|
|
395
|
+
case "production":
|
|
396
|
+
result = selectProduction(root, args[0]);
|
|
397
|
+
break;
|
|
398
|
+
case "diff":
|
|
399
|
+
result = diff(root, args[0]);
|
|
400
|
+
break;
|
|
401
|
+
case "apply":
|
|
402
|
+
result = apply(root, args[0], args[1]);
|
|
403
|
+
break;
|
|
404
|
+
default:
|
|
405
|
+
throw Error(
|
|
406
|
+
"Commands: dev, doctor, scan, snapshot <source> <project> <landing|dashboard> [version], duplicate <key> <name>, production <key>, diff <key>, apply <key> <review-token>",
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
if (result) console.log(JSON.stringify(result, null, 2));
|
|
410
|
+
} catch (e) {
|
|
411
|
+
console.error(e.message);
|
|
412
|
+
process.exitCode = 1;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import fs from 'node:fs';import path from 'node:path';import {hashes,fingerprint,config,write} from './lab.mjs';
|
|
2
|
+
export function migrate(root){const c=config(root);const moves=[];for(const v of c.versions){const next=`versions/${v.category||'landing'}/${v.slug||v.key.split('/').at(-1)}/source`;if(next===v.source)continue;const src=path.join(root,path.dirname(v.source)),dest=path.join(root,path.dirname(next));if(fs.existsSync(dest))throw Error(`Migration collision: ${dest}`);moves.push({v,src,dest,old:v.source,next,hash:fingerprint(hashes(path.join(root,v.source)))});}for(const m of moves){fs.mkdirSync(path.dirname(m.dest),{recursive:true});fs.renameSync(m.src,m.dest);m.v.source=m.next;if(m.v.adapter)m.v.adapter=m.v.adapter.replace(path.dirname(m.old),path.dirname(m.next));if(m.v.dependencyRecords)m.v.dependencyRecords=m.v.dependencyRecords.replace(path.dirname(m.old),path.dirname(m.next));if(fingerprint(hashes(path.join(root,m.next)))!==m.hash)throw Error('Migration hash mismatch');}function adapters(dir){if(!fs.existsSync(dir))return;for(const e of fs.readdirSync(dir,{withFileTypes:true})){const p=path.join(dir,e.name);if(e.isDirectory())adapters(p);else if(/\.(tsx?|mjs)$/.test(e.name)){let s=fs.readFileSync(p,'utf8');for(const m of moves)s=s.split(m.old).join(m.next);fs.writeFileSync(p,s);}}}adapters(path.join(root,'app'));for(const name of ['landing','dashboard'])fs.mkdirSync(path.join(root,'versions',name),{recursive:true});c.schemaVersion=2;write(path.join(root,'lab.config.json'),c);return moves.map(m=>({from:m.old,to:m.next}));}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { copy, config, hashes, fingerprint } from "./lab.mjs";
|
|
8
|
+
|
|
9
|
+
const manifestName = ".design-labs-preview.json";
|
|
10
|
+
const relative = (root, file) => path.relative(root, file).split(path.sep).join("/");
|
|
11
|
+
function inside(root, name) {
|
|
12
|
+
if (typeof name !== "string" || !name || path.isAbsolute(name)) throw Error("Expected a relative preview path");
|
|
13
|
+
const file = path.resolve(root, name);
|
|
14
|
+
if (!file.startsWith(path.resolve(root) + path.sep)) throw Error("Preview path leaves the workspace");
|
|
15
|
+
for (let current = file; current !== path.resolve(root); current = path.dirname(current)) {
|
|
16
|
+
if (fs.existsSync(current) && fs.lstatSync(current).isSymbolicLink()) throw Error("Preview paths cannot traverse symlinks");
|
|
17
|
+
}
|
|
18
|
+
return file;
|
|
19
|
+
}
|
|
20
|
+
function rootsIn(source) {
|
|
21
|
+
const app = ["app", "src/app"].find(name => fs.existsSync(path.join(source, name)));
|
|
22
|
+
const pages = ["pages", "src/pages"].find(name => fs.existsSync(path.join(source, name)));
|
|
23
|
+
if (app) {
|
|
24
|
+
const walk = directory => fs.readdirSync(directory, { withFileTypes: true }).flatMap(entry => entry.isDirectory() ? walk(path.join(directory, entry.name)) : [path.join(directory, entry.name)]);
|
|
25
|
+
const roots = walk(path.join(source, app)).filter(file => /^layout\.[jt]sx?$/.test(path.basename(file)) && /<html\b|createElement\(\s*["']html["']/.test(fs.readFileSync(file, "utf8")));
|
|
26
|
+
if (!roots.length) throw Error("Could not verify a Next.js root layout; integrate the bridge manually in a preview adapter");
|
|
27
|
+
return roots.map(file => ({ source: relative(source, file), kind: "layout" }));
|
|
28
|
+
}
|
|
29
|
+
if (pages) {
|
|
30
|
+
const original = ["_app.tsx", "_app.jsx", "_app.js", "_app.ts"].find(name => fs.existsSync(path.join(source, pages, name)));
|
|
31
|
+
return [{ source: `${pages}/${original || "_app.tsx"}`, kind: "app", synthetic: !original }];
|
|
32
|
+
}
|
|
33
|
+
throw Error("Could not verify a Next.js frontend; no adapter was created");
|
|
34
|
+
}
|
|
35
|
+
const staticOptions = ["dynamic", "dynamicParams", "revalidate", "fetchCache", "runtime", "preferredRegion", "maxDuration", "experimental_ppr"];
|
|
36
|
+
function forwarding(code, reference) {
|
|
37
|
+
const output = [];
|
|
38
|
+
for (const name of staticOptions) {
|
|
39
|
+
// Next statically analyzes these exports in the actual route module. Never
|
|
40
|
+
// replace them with export*, which hides their values from that analysis.
|
|
41
|
+
if (!new RegExp(`\\bexport\\s+(?:const|let|var)\\s*${name}\\b|\\bexport\\s*\\{[^}]*\\b${name}\\b`).test(code)) continue;
|
|
42
|
+
const stringLiteral = String.raw`(?:"[^"\n]*"|'[^'\n]*')`;
|
|
43
|
+
const literalPattern = String.raw`(?:${stringLiteral}|true|false|[0-9]+|\[\s*(?:${stringLiteral}\s*,?\s*)*\])`;
|
|
44
|
+
const declaration = new RegExp(String.raw`\bexport\s+const\s+${name}(?:\s*:\s*[^=;\n]+)?\s*=\s*(${literalPattern})(?=\s*(?:;|\r?\n|$))`);
|
|
45
|
+
const literal = code.match(declaration)?.[1];
|
|
46
|
+
if (!literal) throw Error(`Root layout ${name} must be a direct static literal before automatic preview preparation`);
|
|
47
|
+
output.push(`export const ${name} = ${literal};`);
|
|
48
|
+
}
|
|
49
|
+
for (const name of ["metadata", "generateMetadata", "viewport", "generateViewport", "generateStaticParams"]) {
|
|
50
|
+
if (new RegExp(`\\bexport\\s+(?:(?:async\\s+)?function\\s+|(?:const|let|var)\\s+)${name}\\b|\\bexport\\s*\\{[^}]*\\b${name}\\b`).test(code)) output.push(`export { ${name} } from '${reference}';`);
|
|
51
|
+
}
|
|
52
|
+
if (/\bexport\s*\*/.test(code)) throw Error("Root layout wildcard exports require explicit agent integration");
|
|
53
|
+
return output.join("\n");
|
|
54
|
+
}
|
|
55
|
+
const bridgeComponent = `"use client";
|
|
56
|
+
import {useEffect} from 'react';
|
|
57
|
+
export default function Bridge(){useEffect(()=>{if(window.parent===window||document.querySelector('script[data-design-labs-adapter]'))return;const origin=process.env.NEXT_PUBLIC_DESIGN_LABS_ORIGIN;if(!origin)return;const s=document.createElement('script');s.src='/__design-labs-bridge.js';s.dataset.labOrigin=origin;s.dataset.designLabsAdapter='true';document.head.append(s);return()=>s.remove();},[]);return null;}
|
|
58
|
+
`;
|
|
59
|
+
function mapping(root) {
|
|
60
|
+
const extension = path.extname(root.source);
|
|
61
|
+
const stem = path.basename(root.source, extension);
|
|
62
|
+
const directory = path.posix.dirname(root.source);
|
|
63
|
+
return { ...root, original: `${directory}/${stem}.design-labs-original${extension}`, wrapper: extension === ".ts" ? `${directory}/${stem}.tsx` : root.source, bridge: `${directory}/design-labs-preview-bridge.tsx` };
|
|
64
|
+
}
|
|
65
|
+
function wrapper(source, item) {
|
|
66
|
+
const extension = path.extname(item.original);
|
|
67
|
+
const ref = "./" + path.basename(item.original, extension);
|
|
68
|
+
const typed = /\.tsx?$/.test(item.wrapper);
|
|
69
|
+
const annotation = typed ? ":import('react').ComponentProps<typeof Original>" : "";
|
|
70
|
+
const exports = forwarding(source, ref);
|
|
71
|
+
const render = item.kind === "app" ? "<><Bridge/><Original {...props}/></>" : "<Original {...props}><Bridge/>{props.children}</Original>";
|
|
72
|
+
return `import Original from '${ref}';\nimport Bridge from './design-labs-preview-bridge';\n${exports}\nexport default function Preview(props${annotation}){return ${render};}\n${item.kind === "app" && /\.getInitialProps\s*=/.test(source) ? "Preview.getInitialProps = Original.getInitialProps;\n" : ""}`;
|
|
73
|
+
}
|
|
74
|
+
function dependencies(root, source) {
|
|
75
|
+
let directory = path.join(source, "node_modules");
|
|
76
|
+
if (fs.existsSync(directory)) return directory;
|
|
77
|
+
const sourcePackage = JSON.parse(fs.readFileSync(path.join(source, "package.json"), "utf8"));
|
|
78
|
+
const hostPackage = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
79
|
+
const major = pkg => ((pkg.dependencies?.next || pkg.devDependencies?.next || "").match(/\d+/) || [])[0];
|
|
80
|
+
if (!major(sourcePackage) || major(sourcePackage) !== major(hostPackage)) throw Error("Install the original preview dependencies before preparation; incompatible Next.js runtime");
|
|
81
|
+
directory = path.join(root, "node_modules");
|
|
82
|
+
if (!fs.existsSync(directory)) throw Error("Install preview dependencies before preparation");
|
|
83
|
+
return directory;
|
|
84
|
+
}
|
|
85
|
+
function readSource(source, item) {
|
|
86
|
+
return item.synthetic ? 'export default function App({Component,pageProps}:import("next/app").AppProps){return <Component {...pageProps}/>;}' : fs.readFileSync(path.join(source, item.source), "utf8");
|
|
87
|
+
}
|
|
88
|
+
function rejectLocalEnvironment(directory) {
|
|
89
|
+
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
90
|
+
if (entry.name.startsWith(".env")) throw Error("Adapter contains local environment files; reconcile them explicitly before refreshing (no secrets are copied)");
|
|
91
|
+
if (entry.isDirectory() && !["node_modules", ".next", ".git", ".turbo", "dist", "build", "out"].includes(entry.name)) rejectLocalEnvironment(path.join(directory, entry.name));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function writeText(root, name, text) { const file = path.join(root, name); fs.mkdirSync(path.dirname(file), { recursive: true }); fs.writeFileSync(file, text); }
|
|
95
|
+
function transaction(root, key, refresh) {
|
|
96
|
+
root = path.resolve(root);
|
|
97
|
+
const configFile = path.join(root, "lab.config.json");
|
|
98
|
+
const configBytes = fs.readFileSync(configFile);
|
|
99
|
+
const settings = config(root);
|
|
100
|
+
const version = settings.versions.find(item => item.key === key);
|
|
101
|
+
if (!version) throw Error("Unknown version");
|
|
102
|
+
if (version.path) throw Error("Embedded preview: bridge is installed at runtime; no adapter required");
|
|
103
|
+
const source = inside(root, version.source);
|
|
104
|
+
const sourceHashes = hashes(source);
|
|
105
|
+
const before = fingerprint(sourceHashes);
|
|
106
|
+
const destinationName = version.adapter || `.lab-state/preview-adapters/${Buffer.from(key).toString("hex")}`;
|
|
107
|
+
const destination = inside(root, destinationName);
|
|
108
|
+
const exists = fs.existsSync(destination);
|
|
109
|
+
if (refresh && !exists) throw Error("No adapter exists to refresh; prepare it first");
|
|
110
|
+
if (!refresh && exists) throw Error("Adapter already exists; use refresh to review source changes without overwriting local fixtures");
|
|
111
|
+
const foundRoots = rootsIn(source).map(mapping);
|
|
112
|
+
let previous;
|
|
113
|
+
let adapterBefore;
|
|
114
|
+
const changes = [];
|
|
115
|
+
if (refresh) {
|
|
116
|
+
rejectLocalEnvironment(destination);
|
|
117
|
+
previous = JSON.parse(fs.readFileSync(path.join(destination, manifestName), "utf8"));
|
|
118
|
+
if (previous.schemaVersion !== 1 || previous.versionKey !== key || previous.source !== version.source || !previous.sourceHashes || !previous.destinationHashes || !Array.isArray(previous.roots)) throw Error("Adapter synchronization metadata is missing or incompatible; integrate explicitly");
|
|
119
|
+
if (JSON.stringify(previous.roots) !== JSON.stringify(foundRoots)) throw Error("Root layout structure changed; integrate explicitly without overwriting adapter fixtures");
|
|
120
|
+
const current = hashes(destination); // Also rejects unsupported local symlinks.
|
|
121
|
+
adapterBefore = fingerprint(current);
|
|
122
|
+
const mapped = name => foundRoots.find(item => item.source === name)?.original || name;
|
|
123
|
+
for (const name of new Set([...Object.keys(previous.sourceHashes), ...Object.keys(sourceHashes)])) {
|
|
124
|
+
if (previous.sourceHashes[name] === sourceHashes[name]) continue;
|
|
125
|
+
const target = mapped(name);
|
|
126
|
+
if ((current[target] || null) !== (previous.destinationHashes[target] || null)) throw Error(`Preview refresh conflict: ${target} has local fixture edits`);
|
|
127
|
+
changes.push({ source: name, destination: target, remove: !Object.hasOwn(sourceHashes, name) });
|
|
128
|
+
}
|
|
129
|
+
for (const item of foundRoots.filter(item => changes.some(change => change.source === item.source))) {
|
|
130
|
+
if ((current[item.wrapper] || null) !== (previous.destinationHashes[item.wrapper] || null)) throw Error(`Preview refresh conflict: ${item.wrapper} has local wrapper edits`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const dependencyPath = dependencies(root, source);
|
|
134
|
+
// All validation happens before staging; only the isolated staging tree mutates.
|
|
135
|
+
const wrappers = new Set();
|
|
136
|
+
for (const item of foundRoots) {
|
|
137
|
+
if (wrappers.has(item.wrapper) || item.wrapper !== item.source && Object.hasOwn(sourceHashes, item.wrapper)) throw Error("Ambiguous root layout extensions require explicit adapter integration");
|
|
138
|
+
wrappers.add(item.wrapper);
|
|
139
|
+
wrapper(readSource(source, item), item);
|
|
140
|
+
for (const reserved of [item.original, item.bridge]) if (Object.hasOwn(sourceHashes, reserved)) throw Error(`Source collides with generated adapter file: ${reserved}`);
|
|
141
|
+
}
|
|
142
|
+
if (Object.hasOwn(sourceHashes, manifestName) || Object.hasOwn(sourceHashes, "public/__design-labs-bridge.js")) throw Error("Source collides with generated preview metadata or bridge");
|
|
143
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
144
|
+
const staging = fs.mkdtempSync(path.join(path.dirname(destination), ".prepare-"));
|
|
145
|
+
const backup = destination + `.previous-${crypto.randomUUID()}`;
|
|
146
|
+
const configTemporary = configFile + `.prepare-${crypto.randomUUID()}`;
|
|
147
|
+
let moved = false;
|
|
148
|
+
let published = false;
|
|
149
|
+
try {
|
|
150
|
+
copy(refresh ? destination : source, staging);
|
|
151
|
+
if (refresh) {
|
|
152
|
+
for (const change of changes) {
|
|
153
|
+
const file = path.join(staging, change.destination);
|
|
154
|
+
if (change.remove) fs.rmSync(file); else { fs.mkdirSync(path.dirname(file), { recursive: true }); fs.copyFileSync(path.join(source, change.source), file); }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
for (const item of foundRoots) {
|
|
158
|
+
if (refresh && !changes.some(change => change.source === item.source)) continue;
|
|
159
|
+
const originalCode = readSource(source, item);
|
|
160
|
+
if (!refresh) {
|
|
161
|
+
if (!item.synthetic) fs.renameSync(path.join(staging, item.source), path.join(staging, item.original));
|
|
162
|
+
else writeText(staging, item.original, originalCode);
|
|
163
|
+
writeText(staging, item.bridge, bridgeComponent);
|
|
164
|
+
}
|
|
165
|
+
writeText(staging, item.wrapper, wrapper(originalCode, item));
|
|
166
|
+
}
|
|
167
|
+
if (!refresh) { fs.mkdirSync(path.join(staging, "public"), { recursive: true }); fs.copyFileSync(path.join(root, "public/preview-bridge.js"), path.join(staging, "public/__design-labs-bridge.js")); }
|
|
168
|
+
const currentHashes = hashes(staging);
|
|
169
|
+
const destinationHashes = refresh ? { ...previous.destinationHashes } : currentHashes;
|
|
170
|
+
if (refresh) {
|
|
171
|
+
// A refresh must not bless unrelated fixture edits as synchronized source.
|
|
172
|
+
// Keep their previous baseline so later source changes still raise conflicts.
|
|
173
|
+
for (const change of changes) {
|
|
174
|
+
if (change.remove) delete destinationHashes[change.destination];
|
|
175
|
+
else destinationHashes[change.destination] = currentHashes[change.destination];
|
|
176
|
+
}
|
|
177
|
+
for (const item of foundRoots.filter(item => changes.some(change => change.source === item.source))) destinationHashes[item.wrapper] = currentHashes[item.wrapper];
|
|
178
|
+
}
|
|
179
|
+
delete destinationHashes[manifestName];
|
|
180
|
+
writeText(staging, manifestName, JSON.stringify({ schemaVersion: 1, versionKey: key, source: version.source, sourceHashes, destinationHashes, roots: foundRoots }, null, 2) + "\n");
|
|
181
|
+
fs.symlinkSync(dependencyPath, path.join(staging, "node_modules"), "dir");
|
|
182
|
+
if (fingerprint(hashes(source)) !== before) throw Error("Source changed during preparation; retry after edits settle");
|
|
183
|
+
if (refresh && fingerprint(hashes(destination)) !== adapterBefore) throw Error("Adapter changed during refresh; no fixture changes were published");
|
|
184
|
+
if (!fs.readFileSync(configFile).equals(configBytes)) throw Error("Lab configuration changed during preparation; retry");
|
|
185
|
+
version.adapter = relative(root, destination); version.bridge = true;
|
|
186
|
+
fs.writeFileSync(configTemporary, JSON.stringify(settings, null, 2) + "\n", { flag: "wx" });
|
|
187
|
+
if (exists) { fs.renameSync(destination, backup); moved = true; }
|
|
188
|
+
fs.renameSync(staging, destination); published = true;
|
|
189
|
+
try { fs.renameSync(configTemporary, configFile); } catch (error) { fs.rmSync(destination, { recursive: true, force: true }); published = false; if (moved) { fs.renameSync(backup, destination); moved = false; } throw error; }
|
|
190
|
+
if (moved) { try { fs.rmSync(backup, { recursive: true, force: true }); } catch { /* A recovery copy may remain after a successful commit. */ } moved = false; }
|
|
191
|
+
return { adapter: version.adapter, roots: foundRoots.length, refreshed: refresh, synchronized: refresh ? changes.length : Object.keys(sourceHashes).length, next: "Review mocked frontend data/auth and dependency compatibility in a browser before marking runnable." };
|
|
192
|
+
} finally {
|
|
193
|
+
fs.rmSync(staging, { recursive: true, force: true });
|
|
194
|
+
fs.rmSync(configTemporary, { force: true });
|
|
195
|
+
if (moved && !published) fs.renameSync(backup, destination);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export const preparePreview = (root, key) => transaction(root, key, false);
|
|
199
|
+
export const refreshPreview = (root, key) => transaction(root, key, true);
|
|
200
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
201
|
+
try { const refresh = process.argv[2] === "refresh"; console.log((refresh ? refreshPreview : preparePreview)(path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."), process.argv[refresh ? 3 : 2])); }
|
|
202
|
+
catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
203
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"strict": true,
|
|
6
|
+
"noEmit": true,
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"jsx": "preserve",
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"plugins": [
|
|
12
|
+
{
|
|
13
|
+
"name": "next"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"allowJs": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"resolveJsonModule": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
23
|
+
"exclude": ["node_modules", "versions/**/source/**"]
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auscera/design-labs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"design-labs-install": "scripts/install.mjs"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"scripts",
|
|
10
|
+
"apps"
|
|
11
|
+
]
|
|
6
12
|
}
|