frameboard 0.16.0 → 0.18.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/dist/cli.js +90 -28
- package/dist/client/assets/{index-EciSUFrP.css → index-B6qJtt6n.css} +1 -1
- package/dist/client/assets/index-CO9c0yBA.js +110 -0
- package/dist/client/index.html +2 -2
- package/package.json +4 -4
- package/dist/client/assets/index-Dg25rx_8.js +0 -110
- package/dist/faces/geist/files/geist-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/faces/geist/files/geist-cyrillic-wght-italic.woff2 +0 -0
- package/dist/faces/geist/files/geist-latin-ext-wght-italic.woff2 +0 -0
- package/dist/faces/geist/files/geist-latin-wght-italic.woff2 +0 -0
- package/dist/faces/geist/files/geist-vietnamese-wght-italic.woff2 +0 -0
- package/dist/faces/geist-mono/files/geist-mono-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/faces/geist-mono/files/geist-mono-cyrillic-wght-italic.woff2 +0 -0
- package/dist/faces/geist-mono/files/geist-mono-latin-ext-wght-italic.woff2 +0 -0
- package/dist/faces/geist-mono/files/geist-mono-latin-wght-italic.woff2 +0 -0
- package/dist/faces/geist-mono/files/geist-mono-symbols2-wght-italic.woff2 +0 -0
- package/dist/faces/geist-mono/files/geist-mono-vietnamese-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-ext-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-ext-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-ext-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-ext-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-cyrillic-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-ext-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-ext-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-ext-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-ext-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-ext-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-greek-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-ext-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-ext-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-ext-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-ext-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-ext-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-latin-wght-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-vietnamese-opsz-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-vietnamese-opsz-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-vietnamese-standard-italic.woff2 +0 -0
- package/dist/faces/inter/files/inter-vietnamese-standard-normal.woff2 +0 -0
- package/dist/faces/inter/files/inter-vietnamese-wght-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-opsz-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-opsz-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-standard-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-standard-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-opsz-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-opsz-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-standard-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-standard-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-wght-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-greek-opsz-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-greek-opsz-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-greek-standard-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-greek-standard-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-greek-wght-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-opsz-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-opsz-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-standard-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-standard-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-wght-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-opsz-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-opsz-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-standard-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-standard-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-latin-wght-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-opsz-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-opsz-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-standard-italic.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-standard-normal.woff2 +0 -0
- package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-wght-italic.woff2 +0 -0
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import childProcess, { execFile, spawn } from "node:child_process";
|
|
|
4
4
|
import { EventEmitter, once } from "node:events";
|
|
5
5
|
import * as sp from "node:path";
|
|
6
6
|
import path, { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
7
|
-
import fs, { copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync,
|
|
7
|
+
import fs, { copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
8
8
|
import process$1, { versions } from "node:process";
|
|
9
9
|
import { isDeepStrictEqual, promisify, stripVTControlCharacters } from "node:util";
|
|
10
10
|
import { constants, copyFile, cp, link, lstat, mkdir, open, readFile, readdir, readlink, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -9415,7 +9415,7 @@ async function isDirectory(path) {
|
|
|
9415
9415
|
}
|
|
9416
9416
|
}
|
|
9417
9417
|
// package.json
|
|
9418
|
-
var version$1 = "0.
|
|
9418
|
+
var version$1 = "0.18.0";
|
|
9419
9419
|
var dependencies = { "playwright-core": "1.64.1" };
|
|
9420
9420
|
// src/shared/version.ts
|
|
9421
9421
|
const version = version$1;
|
|
@@ -13628,8 +13628,13 @@ const COOKIE_MAX_AGE_S = 3456e4;
|
|
|
13628
13628
|
* trades for the board's cookie, and answers a 303 home either way so a used
|
|
13629
13629
|
* ticket still lands on a board that reads. A failed redeem lands on
|
|
13630
13630
|
* `/?link=expired`, the flag the client's expired-link toast reads.
|
|
13631
|
+
*
|
|
13632
|
+
* With `openRoute`, `GET /api/access/open` mints a ticket per request and
|
|
13633
|
+
* redirects through redeem, so a browser with no shell, such as a recorder's,
|
|
13634
|
+
* lands on a writing board. It is off unless `serve` is asked for it, since it
|
|
13635
|
+
* makes any local browser navigating to it a writer.
|
|
13631
13636
|
*/
|
|
13632
|
-
function accessRoutes(access, tickets) {
|
|
13637
|
+
function accessRoutes(access, tickets, { openRoute = false } = {}) {
|
|
13633
13638
|
const app = new Hono();
|
|
13634
13639
|
app.get("/api/access/redeem", (c) => {
|
|
13635
13640
|
const ticket = c.req.query("ticket");
|
|
@@ -13644,6 +13649,7 @@ function accessRoutes(access, tickets) {
|
|
|
13644
13649
|
}
|
|
13645
13650
|
return c.redirect("/?link=expired", 303);
|
|
13646
13651
|
});
|
|
13652
|
+
if (openRoute) app.get("/api/access/open", (c) => c.redirect(`/api/access/redeem?ticket=${tickets.mint().ticket}`, 303));
|
|
13647
13653
|
app.post("/api/access/ticket", (c) => {
|
|
13648
13654
|
if (!isWriter({ authorization: c.req.header("authorization") }, access)) return c.json({
|
|
13649
13655
|
ok: false,
|
|
@@ -28911,12 +28917,29 @@ function refuse$1(reason, detail) {
|
|
|
28911
28917
|
detail
|
|
28912
28918
|
};
|
|
28913
28919
|
}
|
|
28920
|
+
function checkValue(value) {
|
|
28921
|
+
return value.length > MAX_VALUE_LENGTH ? refuse$1("invalid-edit", `the value runs past ${MAX_VALUE_LENGTH} characters`) : void 0;
|
|
28922
|
+
}
|
|
28923
|
+
function checkDeclaration({ property, value }) {
|
|
28924
|
+
const invalid = checkValue(value);
|
|
28925
|
+
if (invalid) return invalid;
|
|
28926
|
+
if (!PROPERTY_NAME.test(property)) return refuse$1("invalid-edit", `${property} is not a CSS property name`);
|
|
28927
|
+
if (DECLARATION_BREAK.test(value)) return refuse$1("invalid-edit", `${property} takes one value, with no ; { } < > or line break`);
|
|
28928
|
+
}
|
|
28914
28929
|
function checkChange(change) {
|
|
28915
|
-
if (change.
|
|
28916
|
-
if (change.kind === "
|
|
28917
|
-
|
|
28918
|
-
if (
|
|
28930
|
+
if (change.kind === "style") return checkDeclaration(change);
|
|
28931
|
+
if (change.kind === "styles") {
|
|
28932
|
+
const { declarations } = change;
|
|
28933
|
+
if (declarations.length === 0) return refuse$1("invalid-edit", "a styles edit names no declaration");
|
|
28934
|
+
if (new Set(declarations.map(({ property }) => property)).size !== declarations.length) return refuse$1("invalid-edit", "a styles edit names one property twice, so one value would be lost");
|
|
28935
|
+
for (const declaration of declarations) {
|
|
28936
|
+
const invalid = checkDeclaration(declaration);
|
|
28937
|
+
if (invalid) return invalid;
|
|
28938
|
+
}
|
|
28939
|
+
return;
|
|
28919
28940
|
}
|
|
28941
|
+
const invalid = checkValue(change.value);
|
|
28942
|
+
if (invalid) return invalid;
|
|
28920
28943
|
if (change.kind === "attribute") {
|
|
28921
28944
|
if (!ATTRIBUTE_NAME.test(change.name)) return refuse$1("invalid-edit", `${change.name} is not an attribute name`);
|
|
28922
28945
|
if (change.name.toLowerCase() === "style") return refuse$1("invalid-edit", "style is edited one declaration at a time, as a style edit");
|
|
@@ -28935,7 +28958,7 @@ function scopeOf(change) {
|
|
|
28935
28958
|
}
|
|
28936
28959
|
/** The attribute name an edit writes, or undefined for a text edit. */
|
|
28937
28960
|
function editedAttribute(change) {
|
|
28938
|
-
if (change.kind === "style") return "style";
|
|
28961
|
+
if (change.kind === "style" || change.kind === "styles") return "style";
|
|
28939
28962
|
if (change.kind === "attribute") return change.name;
|
|
28940
28963
|
}
|
|
28941
28964
|
function write(source, element, change) {
|
|
@@ -28947,11 +28970,16 @@ function write(source, element, change) {
|
|
|
28947
28970
|
ok: true,
|
|
28948
28971
|
html: setRawAttribute(source, element, change.name, escapeAttribute(change.value))
|
|
28949
28972
|
};
|
|
28950
|
-
const
|
|
28951
|
-
|
|
28973
|
+
const declarations = change.kind === "styles" ? change.declarations : [change];
|
|
28974
|
+
let style = rawAttribute(source, element, "style") ?? "";
|
|
28975
|
+
for (const { property, value } of declarations) {
|
|
28976
|
+
const next = setDeclaration(style, property, escapeAttribute(value));
|
|
28977
|
+
if (!next.ok) return refuse$1("open-quote", `the style on <${element.tagName}> ends inside an open quote or comment`);
|
|
28978
|
+
style = next.style;
|
|
28979
|
+
}
|
|
28952
28980
|
return {
|
|
28953
28981
|
ok: true,
|
|
28954
|
-
html:
|
|
28982
|
+
html: style === "" ? removeAttribute(source, element, "style") : setRawAttribute(source, element, "style", style)
|
|
28955
28983
|
};
|
|
28956
28984
|
}
|
|
28957
28985
|
/**
|
|
@@ -28990,13 +29018,17 @@ function textOf(element) {
|
|
|
28990
29018
|
function holdsValue(element, change) {
|
|
28991
29019
|
if (change.kind === "text") return textOf(element) === change.value;
|
|
28992
29020
|
if (change.kind === "attribute") return element.attrs.find((attribute) => isNamed(attribute, change.name))?.value === change.value;
|
|
28993
|
-
const
|
|
28994
|
-
|
|
28995
|
-
|
|
29021
|
+
const style = element.attrs.find((attribute) => attribute.name === "style")?.value ?? "";
|
|
29022
|
+
return (change.kind === "styles" ? change.declarations : [change]).every(({ property, value }) => {
|
|
29023
|
+
const declared = declaredValues(style, property);
|
|
29024
|
+
const wanted = value.trim();
|
|
29025
|
+
return wanted === "" ? declared.length === 0 : declared.length === 1 && declared[0] === wanted;
|
|
29026
|
+
});
|
|
28996
29027
|
}
|
|
28997
29028
|
/**
|
|
28998
29029
|
* Applies one change to the element the address names and leaves every other
|
|
28999
|
-
* byte of the source as it was
|
|
29030
|
+
* byte of the source as it was, a `styles` change writing each declaration in
|
|
29031
|
+
* turn into the one style attribute. The output is parsed again and refused as
|
|
29000
29032
|
* `verify-failed` unless its tree is the input's with that one change, so an
|
|
29001
29033
|
* input the guards never met is refused rather than written corrupted.
|
|
29002
29034
|
*/
|
|
@@ -29004,6 +29036,12 @@ function applyEdit(source, address, change) {
|
|
|
29004
29036
|
const normalized = change.kind === "style" ? {
|
|
29005
29037
|
...change,
|
|
29006
29038
|
property: change.property.toLowerCase()
|
|
29039
|
+
} : change.kind === "styles" ? {
|
|
29040
|
+
...change,
|
|
29041
|
+
declarations: change.declarations.map((declaration) => ({
|
|
29042
|
+
...declaration,
|
|
29043
|
+
property: declaration.property.toLowerCase()
|
|
29044
|
+
}))
|
|
29007
29045
|
} : change.kind === "attribute" ? {
|
|
29008
29046
|
...change,
|
|
29009
29047
|
name: change.name.toLowerCase()
|
|
@@ -29714,6 +29752,13 @@ const editSchema = object$1({
|
|
|
29714
29752
|
object$1({
|
|
29715
29753
|
kind: literal("text"),
|
|
29716
29754
|
value
|
|
29755
|
+
}),
|
|
29756
|
+
object$1({
|
|
29757
|
+
kind: literal("styles"),
|
|
29758
|
+
declarations: array$1(object$1({
|
|
29759
|
+
property: name$1,
|
|
29760
|
+
value
|
|
29761
|
+
})).max(16)
|
|
29717
29762
|
})
|
|
29718
29763
|
])
|
|
29719
29764
|
});
|
|
@@ -29758,7 +29803,8 @@ const moveSchema$1 = object$1({
|
|
|
29758
29803
|
*
|
|
29759
29804
|
* The edit's body mirrors
|
|
29760
29805
|
* `edit`'s flags with the hash required, since the board always holds the
|
|
29761
|
-
* one it rendered
|
|
29806
|
+
* one it rendered, plus a `styles` change the CLI never sends, which writes
|
|
29807
|
+
* several declarations as one step. It writes through `editFrameFile`, which finds the element
|
|
29762
29808
|
* again in a frame an agent wrote since from the source `version` kept, and
|
|
29763
29809
|
* records the edited element's span as one step. It answers the `edit`
|
|
29764
29810
|
* record with the index written and the hash written over. Each refusal the
|
|
@@ -37204,11 +37250,18 @@ function structureRoutes(root, access, history, measure, tokens = null) {
|
|
|
37204
37250
|
});
|
|
37205
37251
|
app.post("/api/frame/rename", async (c) => {
|
|
37206
37252
|
const body = await parseBody$1(c.req.raw, renameSchema);
|
|
37207
|
-
await
|
|
37253
|
+
const source = await readFrame$1(root, body.ref, { cwd });
|
|
37254
|
+
await refuseHeld([source.ref]);
|
|
37208
37255
|
const frame = await recorded((journal) => renameFrame(root, body.ref, body.name, {
|
|
37209
37256
|
cwd,
|
|
37210
37257
|
journal
|
|
37211
|
-
}), (renamed) =>
|
|
37258
|
+
}), async (renamed) => ({
|
|
37259
|
+
...await onFrames([renamed.ref]),
|
|
37260
|
+
...renamed.ref === source.ref ? {} : { renamed: {
|
|
37261
|
+
before: source.ref,
|
|
37262
|
+
after: renamed.ref
|
|
37263
|
+
} }
|
|
37264
|
+
}));
|
|
37212
37265
|
return c.json({
|
|
37213
37266
|
ok: true,
|
|
37214
37267
|
data: frame
|
|
@@ -37467,7 +37520,7 @@ function boardHostGuard(port) {
|
|
|
37467
37520
|
await next();
|
|
37468
37521
|
};
|
|
37469
37522
|
}
|
|
37470
|
-
function createApp({ clientDir, root, port, actions, tickets, renderFrame, facesDir, tokens, delivery, dispatch, history, selection, checks, thumbnails, measure, frameVersion, settledVersion }) {
|
|
37523
|
+
function createApp({ clientDir, root, port, actions, tickets, openRoute, renderFrame, facesDir, tokens, delivery, dispatch, history, selection, checks, thumbnails, measure, frameVersion, settledVersion }) {
|
|
37471
37524
|
const app = new Hono();
|
|
37472
37525
|
const given = tokens ?? null;
|
|
37473
37526
|
app.use("*", async (c, next) => {
|
|
@@ -37485,7 +37538,7 @@ function createApp({ clientDir, root, port, actions, tickets, renderFrame, faces
|
|
|
37485
37538
|
root,
|
|
37486
37539
|
tokens: given
|
|
37487
37540
|
}));
|
|
37488
|
-
app.route("/", accessRoutes(actions.access, tickets));
|
|
37541
|
+
app.route("/", accessRoutes(actions.access, tickets, { openRoute }));
|
|
37489
37542
|
app.route("/", apiRoutes(root, actions, frames.look, history));
|
|
37490
37543
|
app.route("/", structureRoutes(root, actions.access, history, measure, given));
|
|
37491
37544
|
app.route("/", historyRoutes(actions.access, history));
|
|
@@ -49053,7 +49106,7 @@ async function startServer({ strictPort = true, port, ...options }) {
|
|
|
49053
49106
|
});
|
|
49054
49107
|
}
|
|
49055
49108
|
}
|
|
49056
|
-
async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch, dispatch }) {
|
|
49109
|
+
async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch, dispatch, openRoute }) {
|
|
49057
49110
|
const tabs = new BoardTabs();
|
|
49058
49111
|
const tickets = createTickets();
|
|
49059
49112
|
let bound = 0;
|
|
@@ -49226,6 +49279,7 @@ async function listen({ clientDir, facesDir, root, tokens, port, openUrl, launch
|
|
|
49226
49279
|
root,
|
|
49227
49280
|
port: boundPort,
|
|
49228
49281
|
tickets,
|
|
49282
|
+
openRoute,
|
|
49229
49283
|
delivery,
|
|
49230
49284
|
dispatch: dispatcher,
|
|
49231
49285
|
history,
|
|
@@ -49444,7 +49498,7 @@ const DEFAULT_PORT = 4173;
|
|
|
49444
49498
|
const RECONNECT_WAIT_MS = 1e3;
|
|
49445
49499
|
function registerServe(program, context) {
|
|
49446
49500
|
const { io } = context;
|
|
49447
|
-
act(addVerb(program, "serve", `Serve the board in a local browser. A note sent to a new session runs the shell command in ${DISPATCH_ENV}, read once at start, with the note in FRAMEBOARD_NOTE, FRAMEBOARD_NOTE_ID, FRAMEBOARD_SESSION, and FRAMEBOARD_ROOT`).option("-p, --port <port>", "port to listen on, falling back to a free one when the default is taken", parsePort, DEFAULT_PORT).option("--no-open", "leave the browser alone").option("--tokens <path>", "a token sheet another tool manages, standing in for the board's tokens.css"), context, async (_args, options, self) => {
|
|
49501
|
+
act(addVerb(program, "serve", `Serve the board in a local browser. A note sent to a new session runs the shell command in ${DISPATCH_ENV}, read once at start, with the note in FRAMEBOARD_NOTE, FRAMEBOARD_NOTE_ID, FRAMEBOARD_SESSION, and FRAMEBOARD_ROOT`).option("-p, --port <port>", "port to listen on, falling back to a free one when the default is taken", parsePort, DEFAULT_PORT).option("--no-open", "leave the browser alone").option("--tokens <path>", "a token sheet another tool manages, standing in for the board's tokens.css").addOption(new Option("--open-route", "answer /api/access/open with a fresh edit link per request").default(false).hideHelp()), context, async (_args, options, self) => {
|
|
49448
49502
|
const tokens = options.tokens === void 0 ? void 0 : resolve(io.cwd, options.tokens);
|
|
49449
49503
|
if (tokens !== void 0 && !isFile(tokens)) throw new FrameboardError("tokens-not-found", `No token sheet at ${tokens}.`, { tokens });
|
|
49450
49504
|
const existing = await resolveBoard({
|
|
@@ -49481,7 +49535,8 @@ function registerServe(program, context) {
|
|
|
49481
49535
|
port: options.port,
|
|
49482
49536
|
strictPort: self.getOptionValueSource("port") !== "default",
|
|
49483
49537
|
openUrl: io.openUrl,
|
|
49484
|
-
dispatch: dispatchCommand(io.cwd)
|
|
49538
|
+
dispatch: dispatchCommand(io.cwd),
|
|
49539
|
+
openRoute: options.openRoute
|
|
49485
49540
|
});
|
|
49486
49541
|
const address = newAddress({
|
|
49487
49542
|
root,
|
|
@@ -49559,30 +49614,37 @@ const require$1 = createRequire(import.meta.url);
|
|
|
49559
49614
|
function hasFaces(dir) {
|
|
49560
49615
|
return FACES.every((face) => existsSync(join(dir, face.folder, "index.css")));
|
|
49561
49616
|
}
|
|
49617
|
+
const FILE_REFERENCE = /url\(\s*(['"]?)\.\/files\/([^'")\s]+)\1\s*\)/g;
|
|
49618
|
+
/** The distinct file names a package sheet loads from its `files` folder. */
|
|
49619
|
+
function referencedFiles(sheet) {
|
|
49620
|
+
const names = [...sheet.matchAll(FILE_REFERENCE)].flatMap((m) => m[2] ? [m[2]] : []);
|
|
49621
|
+
return [...new Set(names)];
|
|
49622
|
+
}
|
|
49562
49623
|
/**
|
|
49563
49624
|
* Copies each face every frame imports from its package into `outDir`,
|
|
49564
|
-
* replacing what was there.
|
|
49565
|
-
*
|
|
49625
|
+
* replacing what was there. Only the files a package sheet references are
|
|
49626
|
+
* copied, and a reference to a file the package lacks throws. The faces fill
|
|
49627
|
+
* a sibling folder first and rename into place, so `outDir` holds every file or does not exist, and an
|
|
49566
49628
|
* interrupted write leaves no half-filled face behind. Each sheet is
|
|
49567
49629
|
* rewritten to declare the plain family a frame names, such as Geist, rather
|
|
49568
49630
|
* than the package's own, such as Geist Variable. With `keepComplete`, a
|
|
49569
49631
|
* folder that filled in meanwhile, as from a parallel run, stays as it is.
|
|
49570
49632
|
*/
|
|
49571
|
-
function writeFaces(outDir, { keepComplete = false } = {}) {
|
|
49633
|
+
function writeFaces(outDir, { keepComplete = false, faces = FACES } = {}) {
|
|
49572
49634
|
const staging = `${outDir}.${process.pid}.tmp`;
|
|
49573
49635
|
rmSync(staging, {
|
|
49574
49636
|
recursive: true,
|
|
49575
49637
|
force: true
|
|
49576
49638
|
});
|
|
49577
49639
|
try {
|
|
49578
|
-
for (const face of
|
|
49640
|
+
for (const face of faces) {
|
|
49579
49641
|
const from = dirname(require$1.resolve(`${face.package}/package.json`));
|
|
49580
49642
|
const to = join(staging, face.folder);
|
|
49581
49643
|
mkdirSync(join(to, "files"), { recursive: true });
|
|
49582
49644
|
const sheet = readFileSync(join(from, "index.css"), "utf8");
|
|
49583
49645
|
writeFileSync(join(to, "index.css"), sheet.replaceAll(`'${face.packageFamily}'`, `'${face.family}'`));
|
|
49584
49646
|
copyFileSync(join(from, "LICENSE"), join(to, "LICENSE"));
|
|
49585
|
-
for (const file of
|
|
49647
|
+
for (const file of referencedFiles(sheet)) copyFileSync(join(from, "files", file), join(to, "files", file));
|
|
49586
49648
|
}
|
|
49587
49649
|
if (keepComplete && hasFaces(outDir)) return;
|
|
49588
49650
|
rmSync(outDir, {
|