@plitzi/sdk-shared 0.38.7 → 0.38.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,189 @@
1
1
  # @plitzi/sdk-shared
2
2
 
3
+ ## 0.38.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 1b45aae: ## The CLI's commands are named after what they act on
8
+
9
+ Every command sits under the thing it acts on — `plitzi element move`, never a bare `move` that could mean anything —
10
+ and only what acts on the project as a whole or the account stays at the top:
11
+
12
+ | Before | Now |
13
+ | -------------------------------------------- | ------------------------------------------------------------------ |
14
+ | `where`, `edit`, `remove`, `move` | `element where`, `element edit`, `element remove`, `element move` |
15
+ | `check`, `shot`, `import` | `page check`, `page shot`, `page import` |
16
+ | `space`, `pull`, `push`, `lint`, `fix` | `space use`, `space pull`, `space push`, `space lint`, `space fix` |
17
+ | `add plugin`, `pack plugin`, `upload plugin` | `plugin add`, `plugin pack`, `plugin upload` |
18
+ | `add runtime` | `runtime add` |
19
+ | `pack source` | `source pack` |
20
+ | `update` (alias of `upgrade`) | `upgrade` |
21
+
22
+ `create`, `verify`, `doctor`, `upgrade`, `explain`, `feedback`, `login`, `logout` and `whoami` stay at the top, beside
23
+ `functions`, `runtime`, `data` and `skills`. There are no aliases: a name asked for at the top that is a group's command
24
+ answers where it is — `There is no plitzi push: it is one of plitzi space push, plitzi runtime push, plitzi functions
25
+ push` — read off the commands themselves. A project's scripts (`lint:space`, `check`, `shot`) call the new names;
26
+ `plitzi upgrade --write` updates the ones the CLI wrote.
27
+
28
+ ## Agents load less to do the same (RFC 0025)
29
+ - **The MCP lists the operations vocabulary once.** A connection with a space listed ~69k tokens of tools before an
30
+ agent did anything — the operations schema five times. `plitzi_apply` carries it; `plitzi_render` lists only its
31
+ operations' types beside it (and keeps the whole schema on a guest connection, where it is alone). The listing is
32
+ now ~18k tokens.
33
+ - **`plitzi_validate` is `plitzi_apply`'s `dryRun`**, which already answered the same; the `validate` function, its
34
+ `validateShape` and `ValidateInput` are gone from `@plitzi/sdk-mcp`.
35
+ - **`plitzi_apply` looks at the page it would leave**: `look: 'html' | 'image' | 'accessibility' | 'both'` (with
36
+ `pageRef`, `viewport`, `fullPage`) renders it — with `dryRun`, as the batch would leave it, nothing saved; without, as
37
+ saved. Check, look and save with the operations written twice, not four times.
38
+ - **`plitzi_look` is the one way to see a saved page** — its accessibility outline (the default: text, cheap), its HTML
39
+ or a PNG; `plitzi_preview` and `plitzi_screenshot` are gone. It is always offered: without a browser service it answers
40
+ the HTML and says so.
41
+ - **`plitzi_describe_operation { type }`** answers one operation's schema, or every type there is; a type that does not
42
+ exist is answered with the nearest one.
43
+ - `closest` is exported from `@plitzi/sdk-authoring`: the nearest of a closed list of names.
44
+ - **`plitzi element where <id | class | words>`** answers where the project's code writes an element — the file, the line and
45
+ the call itself — asked of the code as it is now, so it follows an element wherever somebody moved it. A class is
46
+ found by its name or by the variable that holds it (`nav-link`, `navLink`).
47
+ - **`plitzi element edit <id> --set key=value --remove key`** writes attributes in that call (`content` where the factory takes
48
+ it first), keeping each one's kind, formatted as the project formats, and keeps the change only if the space still
49
+ authors with every value there. Behind both, `locateElements` in `@plitzi/sdk-authoring`: every element with the call
50
+ that wrote it.
51
+ - A generated project's `AGENTS.md` says to ask `where` instead of keeping a note of where things are.
52
+ - **`plitzi doctor` says one fact once**: packages installed from the same place, and packages behind the same version,
53
+ are one line each — on a project installed from local tarballs, ~1,050 tokens of output became ~330.
54
+ - **A mistake costs one line.** An operation type that does not exist is answered with the nearest one; a field an
55
+ operation, an element, a binding or a flow step does not have is refused naming the one meant — it used to be dropped,
56
+ and `prop` for `props` answered success having applied nothing. An element type spelt with other capitals
57
+ (`Heading`) is read as the catalog spells it and said in `warnings`.
58
+ - **The same batch refused twice is not run a third time** (`REPEATED_BATCH`), and the second refusal says so; `plitzi
59
+ edit` does the same, kept in the project's `tmp/refusals.json`.
60
+ - **`plitzi_apply`'s `look` renders a batch through the path a save takes** (`draftBatch`): a
61
+ `repeatElement` expanded, what has one reading read, the same refusals.
62
+ - **Each skill is a core an agent reads every time, and references it opens when the task names one.** The core —
63
+ what it is for, the rules that go wrong most, a table routing each task to its one file — is held to 1,500 tokens:
64
+ `plitzi-authoring` went from ~4,000 to ~920 (every rule kept in `reference/rules.md`, the recipes indexed in
65
+ `reference/recipes.md`, every reference in `reference/index.md`), `plitzi-cli` from ~4,000 to ~820 (projects,
66
+ plugins and troubleshooting are references of their own), `plitzi-render` from ~3,100 to ~1,050.
67
+ - **Intent tools on the MCP**: `plitzi_set_attributes`, `plitzi_set_classes` (classes added or removed, the rest
68
+ kept), `plitzi_bind_attribute`, `plitzi_place_component`, `plitzi_add_page` — a few parameters, the element by its ref alone (the
69
+ page is found, a ref that does not exist answered with the nearest), checked and saved as `plitzi_apply` saves, and
70
+ answered in a line with the next step.
71
+ - **An element may only wear a class the space has, or the batch declares**: `plitzi_apply` used to save one nothing
72
+ defines — rendered unstyled, said by nobody. It is refused naming the nearest class.
73
+ - **`plitzi explain` answers any export of `@plitzi/sdk-authoring`** — `pageFamily`, `styles`, `SpaceSpec` — with its
74
+ signature and the first paragraph of its doc, read from the `.d.ts` the project installed: a few dozen tokens where an
75
+ agent used to search ~180k of published types.
76
+ - **`plitzi element where --by id|class|text`** reads a query one way; without it, the first reading that matches is answered
77
+ and every other one that matched is said with its count and the command for it — a query that means two things is
78
+ never answered as one. `plitzi element edit` reads its element by id alone.
79
+ - **A helper written once and called for many elements** is told apart: `locateElements` answers each element's
80
+ `through` — the calls of the author's code that led to the one that wrote it — so `plitzi element where` says which other
81
+ elements the same call writes and the call that leads to this one alone, and `plitzi element edit` changes a value the helper
82
+ is handed where it is handed (`pageHead('about-head', 'About us')`), refuses an edit of a call that writes several
83
+ elements unless `--every` says so, and never writes `content` beside words given as the factory's first argument.
84
+ - `plitzi explain` of a name that is the project's own says where to read it.
85
+ - **Nothing a write does is silent.** `plitzi_apply` answers `effects`: every change the batch made, read off the space
86
+ before and after it (elements added or removed by subtree, attributes, classes, moves, styles, settings, connectors,
87
+ actions), with a note where a changed attribute is one a binding computes; a batch that changed nothing says so, and
88
+ a store with no persister leads the warnings as `NOT saved: …`. The intent tools answer those `effects`, whether it
89
+ was `saved` and what was already so, refuse to take off a class the element does not wear and to write a value under
90
+ a binding. `plitzi element edit` reads the whole space before and after the edit (`plitzi element readings`, in a fresh process),
91
+ prints every change, and puts the files back when anything changed that was not asked, naming it; it refuses an
92
+ attribute a binding computes, and `plitzi element where` marks those `Bound`. `canonicalJson` (`@plitzi/sdk-shared`) is
93
+ what every before-and-after comparison is made with. Authoring keeps deep enough a call stack (64 frames) that a
94
+ helper inside a helper is still told apart.
95
+ - `locateElements` answers the parts of every component too, in the component (`rootId` is its id): `plitzi element where`
96
+ and `plitzi element edit` reach an element inside a component as they reach one on a page or a layout.
97
+
98
+ ## Fixed
99
+ - **A layout no longer mounts twice when the page hydrates.** An element with `runtime: 'server'` was wrapped in its
100
+ static shell while hydrating and handed back without it — under another key — on the next render, so React tore
101
+ down everything under it and built it again. With a server provider around a layout (an `apiContainer` that draws
102
+ no markup of its own), the whole layout's DOM was replaced on every page, and every `motion` arrival in it played
103
+ twice: a visible flicker on load. The shell now stays around the element on both sides of hydration, under the same
104
+ key, and only stops freezing (`frozen`).
105
+ - **A component's instance is written somewhere.** `component(…)` — and each child it places in a slot — rebuilt its
106
+ spec with a spread and lost the marker of where the author wrote it: `plitzi element where` could not place an instance and
107
+ `plitzi element edit` refused it. The original marker is carried (`carryWrittenAt`); `where` finds the words an instance
108
+ hands its component, and `edit` writes an instance's props.
109
+ - `plitzi element edit` follows a value read off a list the call is repeated for (`item.question` in
110
+ `QUESTIONS.flatMap(item => …)`) to the one entry that holds it, in the file the list is written in; when the shared
111
+ value is not a literal it says where it comes from instead of offering `--every`.
112
+ - **`plitzi page check --element` says which class wins.** Each property more than one of the element's classes sets, at
113
+ rest: the value shown, the class it comes from and what the others say — or that they all set it so. Which wins is
114
+ asked of the page, each class taken off for a moment; a style change is verified in text, not with a picture.
115
+ - **`plitzi element where` reads more.** By words it finds every word an element says (`words` on `WrittenElement`: content,
116
+ `label`, `title`, `alt`, `placeholder`, binding templates, an instance's props); by class it says where the class
117
+ is declared (`locateClasses` in `@plitzi/sdk-authoring`); an element repeated over a list says which list, and its
118
+ file; a page or a layout is placed at the object it is declared as.
119
+ - **`plitzi element edit` edits a page** by the attributes `where` shows (`seoPageTitle` written as `seoTitle`;
120
+ `PAGE_SPEC_FIELDS` in `@plitzi/sdk-authoring`), refusing `layout` and `seoEnabled`, which are no field of their own;
121
+ and a value read in more than one place (a list entry a nav and a menu both draw) changes them all only with
122
+ `--every`, each named.
123
+ - **A component prop of a type that does not exist is refused** (`prop-type-unknown`, with the types there are):
124
+ `type: 'string'` was accepted at run time, offered by no editor and checked against nothing. `BUILTIN_PARAM_TYPES`
125
+ in `@plitzi/sdk-shared` is the list, and `BuiltinParamType` is derived from it.
126
+ - **`plitzi element remove <id>` and `plitzi element move <id> --before|--after <id>`** take an element out of the code that writes
127
+ it, or reorder it among its siblings — following a section a helper returns to the helper's call — checked as
128
+ `edit` is: a removal may take only the element and what it holds, a move only reorder its parent, or the file goes
129
+ back. Styles and imports only the removed call used go with it, named; a helper left unread is said.
130
+ - **`plitzi verify`** runs the project's checks — author (no warning), lint:space, typecheck, lint, format — and every
131
+ page with no parameter, and prints only what fails; a page it could not open is said as not checked. Generated
132
+ projects get `npm run verify`, and their `AGENTS.md` names it as the way to leave the project passing.
133
+ - **A component's refusal says where it is written** (by its root's call).
134
+ - **`check --element`** says a class changes nothing on the element only when every property it sets stays without
135
+ it, and names the other elements the class is on: changing the class changes them; taking it off this element does
136
+ not.
137
+ - **An element's generated selector and binding ids are named after its id**, under its parent's place, not after its
138
+ position among its siblings: a move renames nothing. Every space written in code gets new generated names once —
139
+ the same rules, so nothing a visitor sees changes.
140
+ - A change of an element's children is said as what came, went or moved (`faq moved — now after hero, before pricing`).
141
+ - **`plitzi page check --click <id>`** clicks one element and says what changed — flows run and how each step ended, the
142
+ page it went to, what scrolled, what is shown now and what no longer is, the state — or that nothing did, in those words; a flow that
143
+ succeeded while nothing on the page changed is said as that. A click that could not be made, or a flow that failed,
144
+ fails the check.
145
+ - **A refusal of the authored space's gate says where**: each of the validator's errors (`UNRESOLVED_INTERACTION_TARGET`,
146
+ `UNRESOLVED_BINDING_SOURCE`, …) carries the file and line of the element it is about, and a name nothing answers to is
147
+ offered the nearest element that answers the step it was for (`openModal('search')` → `search-modal`, not the
148
+ `search-q` field), or the few that do. `SchemaValidationError` gains `missing` and `wantedBy` (`@plitzi/sdk-schema`).
149
+ - **`plitzi element where` finds the words a list's rows show** when the list is handed them as data (`items:
150
+ [...PLANS]`), and says the list they are the entries of and its file (`Its rows are the entries of PLANS
151
+ (src/space/enterprise/content.ts)`).
152
+ - `plitzi page check --click` says what is **shown** now and what no longer is (drawn, wherever the page is scrolled),
153
+ not "on screen".
154
+ - `plitzi upgrade` says packages installed locally in one line past three, and a skill rewritten within the same
155
+ version as that, not `0.38.7 → 0.38.7`.
156
+ - **What `element edit`, `remove` and `move` read back goes through the gate `npm run author` does**: a change that
157
+ leaves the space refused — a flow still opening a modal that was removed — is put back, the refusal said with where.
158
+ `element remove` refuses before writing when another element's flows act on what it takes away, and says what it
159
+ took once, by the outermost element (`search-modal removed, with 18 inside`). Moving an element beside itself is
160
+ refused as nothing to do.
161
+ - **An id, a plugin folder or a data file written a letter off is offered the nearest one** (`element where`, `edit`,
162
+ `remove`, `move`, `plugin pack`, `data describe`).
163
+ - **A project file that does not load is said at its file and line** — `src/space/hero.ts:139: Expected ','` — by the
164
+ server, `npm run author` and every CLI command, never as a stack (`ProjectModuleError` and `moduleProblem` in
165
+ `@plitzi/sdk-authoring/node`).
166
+ - **`plitzi verify` stops at the first failure** — one broken file fails every later step the same way — and says the
167
+ rest as not run (`--keep-going` runs them anyway); `--no-pages` no longer fails a run that passed.
168
+ - **`plitzi space fix` no longer drops attributes written one level too deep**: `attributes: { value: 5 }` where
169
+ `value: 5` was meant is put in its place (a new `unwrap` fix), not removed with what it said.
170
+ - **`plitzi explain <type>` explains the project's own elements** (`src/plugins/`), and `plugin add` prints how to place
171
+ one with the attributes it was declared with.
172
+ - **`plitzi data describe` says an object keyed by data once**, as a map of one shape with how many keys, so a file of
173
+ five hundred articles reads as one.
174
+ - **`plitzi page check` says a path no page answers before opening it**, with the paths the pages do answer — never a
175
+ redirect home read as a page for signed-in visitors.
176
+ - **`copyToClipboard(text)`**, a utility step (`@plitzi/sdk-interactions`, built with `copyToClipboard` in
177
+ `@plitzi/sdk-authoring`): a "Copy link" button had no step to write with. A browser that gives the page no clipboard
178
+ fails the step, so a toast after it is never said of a copy that was not made.
179
+ - **`plitzi explain` lists the values a param takes only when it is a choice** (`select`): `setState`'s `value` read
180
+ as `'true' | 'false'`, the examples of a free value taken for its only ones.
181
+ - **`plitzi page check --click` says what the page said** — a toast or an alert, `said: "Link copied"` — and **a form
182
+ the browser held back**, with the field and the browser's reason, never as a click that changed nothing.
183
+ - **`plitzi page check --click <id> --fill <id>=<value>`** fills fields before the click as a visitor does (typed, an
184
+ option chosen, a box ticked), so a form's success flow is checked, not only its refusal when empty. A container of
185
+ several fields is refused with their ids; a field filled inside another element says whose it is.
186
+
3
187
  ## 0.38.7
4
188
 
5
189
  ### Patch Changes
@@ -64,7 +64,7 @@ export interface ElementDeclarationData {
64
64
  /**
65
65
  * Whether the element is behaviour rather than content — a clock that fires a flow, a listener — and draws nothing on
66
66
  * a page (at most a tag in the builder, to have something to select). Read by the page checks (`inspectPage`,
67
- * `plitzi check`), which would otherwise wait for it to be on screen and report it hidden.
67
+ * `plitzi page check`), which would otherwise wait for it to be on screen and report it hidden.
68
68
  */
69
69
  drawsNothing?: boolean;
70
70
  content?: {
@@ -1,6 +1,6 @@
1
1
  import { toBuilderParams as e, toInteractionCallback as t, toInteractionCallbacks as n } from "./builder.mjs";
2
2
  import { elementDeclaration as r, valuesOf as i } from "./declare.mjs";
3
- import { hiddenParams as a, invalidParams as o, missingRequiredParams as s, reconcileParams as c } from "./paramSpec.mjs";
4
- import { BUILTIN_ELEMENT_CALLBACKS as l, SCROLL_CALLBACKS as u, applyElementCallback as d, getElementCallback as f } from "./elementCallbacks.mjs";
5
- import { spaceCallbacks as p } from "./spaceCallbacks.mjs";
6
- export { l as BUILTIN_ELEMENT_CALLBACKS, u as SCROLL_CALLBACKS, d as applyElementCallback, r as elementDeclaration, f as getElementCallback, a as hiddenParams, o as invalidParams, s as missingRequiredParams, c as reconcileParams, p as spaceCallbacks, e as toBuilderParams, t as toInteractionCallback, n as toInteractionCallbacks, i as valuesOf };
3
+ import { BUILTIN_PARAM_TYPES as a, hiddenParams as o, invalidParams as s, missingRequiredParams as c, reconcileParams as l } from "./paramSpec.mjs";
4
+ import { BUILTIN_ELEMENT_CALLBACKS as u, SCROLL_CALLBACKS as d, applyElementCallback as f, getElementCallback as p } from "./elementCallbacks.mjs";
5
+ import { spaceCallbacks as m } from "./spaceCallbacks.mjs";
6
+ export { u as BUILTIN_ELEMENT_CALLBACKS, a as BUILTIN_PARAM_TYPES, d as SCROLL_CALLBACKS, f as applyElementCallback, r as elementDeclaration, p as getElementCallback, o as hiddenParams, s as invalidParams, c as missingRequiredParams, l as reconcileParams, m as spaceCallbacks, e as toBuilderParams, t as toInteractionCallback, n as toInteractionCallbacks, i as valuesOf };
@@ -1,5 +1,6 @@
1
1
  import { InteractionParamType } from '../types';
2
- export type BuiltinParamType = 'text' | 'textarea' | 'select' | 'boolean' | 'number' | 'scalar' | 'json' | 'elementIds';
2
+ export declare const BUILTIN_PARAM_TYPES: readonly ["text", "textarea", "select", "boolean", "number", "scalar", "json", "elementIds"];
3
+ export type BuiltinParamType = (typeof BUILTIN_PARAM_TYPES)[number];
3
4
  export interface BuiltinParam {
4
5
  type: BuiltinParamType;
5
6
  description: string;
@@ -1,17 +1,26 @@
1
1
  import { hasValidToken as e } from "../helpers/twigWrapper/tokens/hasValidToken.mjs";
2
2
  //#region src/authoring/paramSpec.ts
3
- var t = (e, t, n) => {
3
+ var t = [
4
+ "text",
5
+ "textarea",
6
+ "select",
7
+ "boolean",
8
+ "number",
9
+ "scalar",
10
+ "json",
11
+ "elementIds"
12
+ ], n = (e, t, n) => {
4
13
  let r = [];
5
14
  for (let [i, a] of Object.entries(n)) a.when && e[i] !== void 0 && !a.when(t) && r.push(i);
6
15
  return r;
7
- }, n = (e, t, n) => {
16
+ }, r = (e, t, n) => {
8
17
  let r = [];
9
18
  for (let [i, a] of Object.entries(n)) a.required && e[i] === void 0 && (!a.when || a.when(t)) && r.push(i);
10
19
  return r;
11
- }, r = (e) => e.trim() !== "" && Number.isFinite(Number(e)), i = (t) => typeof t == "string" && e(t), a = (e, t) => {
20
+ }, i = (e) => e.trim() !== "" && Number.isFinite(Number(e)), a = (t) => typeof t == "string" && e(t), o = (e, t) => {
12
21
  switch (t.type) {
13
22
  case "boolean": return typeof e == "boolean";
14
- case "number": return typeof e == "number" || typeof e == "string" && r(e);
23
+ case "number": return typeof e == "number" || typeof e == "string" && i(e);
15
24
  case "select": return typeof e == "string" && (!t.options || t.options.includes(e));
16
25
  case "scalar": return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
17
26
  case "json": return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "object" && !!e;
@@ -20,23 +29,23 @@ var t = (e, t, n) => {
20
29
  case "elementIds": return Array.isArray(e) && e.every((e) => typeof e == "string");
21
30
  default: return !0;
22
31
  }
23
- }, o = (e, t, n) => {
32
+ }, s = (e, t, n) => {
24
33
  let r = [];
25
- for (let [o, s] of Object.entries(n)) {
26
- let n = e[o];
27
- n === void 0 || i(n) || s.when && !s.when(t) || a(n, s) || r.push({
28
- key: o,
34
+ for (let [i, s] of Object.entries(n)) {
35
+ let n = e[i];
36
+ n === void 0 || a(n) || s.when && !s.when(t) || o(n, s) || r.push({
37
+ key: i,
29
38
  expected: s.type,
30
39
  got: n === null ? "null" : typeof n,
31
40
  ...s.options ? { options: s.options } : {}
32
41
  });
33
42
  }
34
43
  return r;
35
- }, s = (e, t, n) => {
44
+ }, c = (e, t, n) => {
36
45
  let r = {};
37
46
  for (let [i, a] of Object.entries(e)) (!n || i in t) && (r[i] = a);
38
47
  for (let [e, n] of Object.entries(t)) n.default === void 0 || r[e] !== void 0 || n.when && !n.when(r) || (r[e] = n.default);
39
48
  return r;
40
49
  };
41
50
  //#endregion
42
- export { t as hiddenParams, o as invalidParams, n as missingRequiredParams, s as reconcileParams };
51
+ export { t as BUILTIN_PARAM_TYPES, n as hiddenParams, s as invalidParams, r as missingRequiredParams, c as reconcileParams };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The attribute every piece of the dev tools' own chrome carries — the badge, the panel — so whatever looks at the
3
- * page rather than at the tools can leave it out: `plitzi shot` and `plitzi check` hide it, and a picture of a page is
3
+ * page rather than at the tools can leave it out: `plitzi page shot` and `plitzi page check` hide it, and a picture of a page is
4
4
  * a picture of the page.
5
5
  */
6
6
  export declare const DEV_TOOLS_ATTRIBUTE = "data-plitzi-devtools";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A value as JSON with every object's keys in order, so two values that say the same thing in another order read the
3
+ * same: what a before-and-after comparison is made with, where a key moved is not a change. `undefined` reads
4
+ * `undefined`.
5
+ */
6
+ export declare const canonicalJson: (value: unknown) => string;
@@ -0,0 +1,5 @@
1
+ import { isRecord as e } from "./isRecord.mjs";
2
+ //#region src/helpers/canonicalJson.ts
3
+ var t = (t) => t === void 0 ? "undefined" : JSON.stringify(t, (t, n) => e(n) ? Object.fromEntries(Object.keys(n).toSorted().map((e) => [e, n[e]])) : n);
4
+ //#endregion
5
+ export { t as canonicalJson };
@@ -90,7 +90,7 @@ export declare const spaceEventSchemas: {
90
90
  }, z.core.$strip>;
91
91
  /**
92
92
  * A plugin installed — or installed again at a new address, which is how a new version arrives: from the builder,
93
- * or from `plitzi upload plugin` with no builder open. An open builder loads it without a reload.
93
+ * or from `plitzi plugin upload` with no builder open. An open builder loads it without a reload.
94
94
  */
95
95
  readonly SPACE_ADD_PLUGIN: z.ZodObject<{
96
96
  plugin: z.ZodObject<{
@@ -145,7 +145,7 @@ export interface ProjectLayoutOptions {
145
145
  export declare const pluginTypeOf: (folder: string) => string;
146
146
  /**
147
147
  * The file an element's folder is built from, wherever the folder is — its `index.ts`, or `index.tsx` — or nothing
148
- * when it has neither, or both: what `plitzi pack plugin` builds a folder from, as the server does.
148
+ * when it has neither, or both: what `plitzi plugin pack` builds a folder from, as the server does.
149
149
  */
150
150
  export declare const elementEntry: (dir: string) => string | undefined;
151
151
  /**
@@ -195,7 +195,7 @@ var v = {
195
195
  action: "move",
196
196
  from: `${n}/${c}`,
197
197
  to: `${n}/${a}`
198
- })] : [y("plugin-declaration-missing", `${n}/`, `${n}/ has no ${a}: ${s}.`, `Write ${n}/${a} — export default { type: '${o}', … } — as npx plitzi add plugin writes one beside the component it makes.`)];
198
+ })] : [y("plugin-declaration-missing", `${n}/`, `${n}/ has no ${a}: ${s}.`, `Write ${n}/${a} — export default { type: '${o}', … } — as npx plitzi plugin add writes one beside the component it makes.`)];
199
199
  }, B = (e, t) => {
200
200
  if (!x.test(t)) return [te(t)];
201
201
  let n = `${i}/${t}`, r = M(t), a = ne(S(m.join(e, n)).files, t);
@@ -205,14 +205,14 @@ var v = {
205
205
  accepted: o,
206
206
  code: "plugin-entry-missing",
207
207
  lost: `the server cannot build the plugin ${r}`,
208
- write: `Write ${n}/index.ts exporting the component by default${a ? ` — export { default } from './${a}';` : ""} — as npx plitzi add plugin writes it. Every folder of ${i}/ is a plugin: code several plugins share goes outside it (src/shared/).`
208
+ write: `Write ${n}/index.ts exporting the component by default${a ? ` — export { default } from './${a}';` : ""} — as npx plitzi plugin add writes it. Every folder of ${i}/ is a plugin: code several plugins share goes outside it (src/shared/).`
209
209
  }),
210
210
  ...R(e, {
211
211
  folder: `${n}/${s}`,
212
212
  accepted: ["index.ts"],
213
213
  code: "plugin-functions-entry-missing",
214
214
  lost: `none of the plugin's server half runs (its routes under /fn/plugins/${r}/)`,
215
- write: `Write ${n}/${s}/index.ts exporting defineFunctions({ … }) by default — as npx plitzi add plugin --server writes it.`
215
+ write: `Write ${n}/${s}/index.ts exporting defineFunctions({ … }) by default — as npx plitzi plugin add --server writes it.`
216
216
  }),
217
217
  ...z(e, t)
218
218
  ];
@@ -225,7 +225,7 @@ var v = {
225
225
  type: t.type,
226
226
  isMain: t.isMain === !0
227
227
  }] : []) : [], U = (t, n) => {
228
- let r = `${p}/${n}`, i = `${r}/${c}`, a = `npx plitzi pull brings it again — or delete ${r}/, and the space renders no ${n}.`;
228
+ let r = `${p}/${n}`, i = `${r}/${c}`, a = `npx plitzi space pull brings it again — or delete ${r}/, and the space renders no ${n}.`;
229
229
  if (!C(t, i, "file")) return { problem: y("vendor-manifest-missing", `${r}/`, `${r}/ has no ${c}: the server runs a built plugin by what its manifest names, so ${n} does not run.`, a) };
230
230
  let o;
231
231
  try {
@@ -247,7 +247,7 @@ var v = {
247
247
  }, W = (e) => {
248
248
  let { files: t, folders: n } = S(m.join(e, i)), r = t.filter((e) => !b.has(e) && e !== "declarations.ts").map((e) => {
249
249
  let { name: t } = m.parse(e), n = t !== "index" && N(t) || "<Name>";
250
- return y("plugin-file-loose", `${i}/${e}`, `${i}/${e} is a file, and every plugin is a folder of ${i}/: the server reads nothing of it.`, `Give it a folder with an index.ts that exports it by default — ${i}/${n}/${e} and ${i}/${n}/index.ts, as npx plitzi add plugin writes them — or move it out of ${i}/.`);
250
+ return y("plugin-file-loose", `${i}/${e}`, `${i}/${e} is a file, and every plugin is a folder of ${i}/: the server reads nothing of it.`, `Give it a folder with an index.ts that exports it by default — ${i}/${n}/${e} and ${i}/${n}/index.ts, as npx plitzi plugin add writes them — or move it out of ${i}/.`);
251
251
  }), a = S(m.join(e, p)).folders, o = new Set(n.filter((e) => x.test(e)).map(M)), s = a.filter((e) => o.has(e)).map((e) => y("plugin-shadowed", `${p}/${e}/`, `${e} is both ${p}/${e}/, as it was built, and a folder of ${i}/: the server runs the built one, and a change to the source shows nowhere.`, `Delete ${p}/${e}/: the source is the plugin now.`)), c = a.flatMap((t) => {
252
252
  let n = U(e, t);
253
253
  return "problem" in n ? [n.problem] : [];
@@ -337,7 +337,7 @@ var v = {
337
337
  ...s,
338
338
  ...c
339
339
  ];
340
- }, oe = (e) => w(e, n).filter((e) => !b.has(m.posix.basename(e)) && !e.endsWith(".json")).map((e) => y("data-not-json", e, `${e} is not JSON: a provider's /data/<file> and ctx.data read JSON files only, and plitzi push leaves it behind.`, `Keep it as JSON (${e.replace(/\.[^./]*$/, "")}.json), or move it out of ${n}/.`)), se = /^\.env(?:\..*)?$|\.(?:pem|key|p12|pfx|jks|keystore|sqlite3?|db|sql|dump)$|secret|credential|password|passwd|private[-_.]?key|id_rsa|id_ed25519|service[-_]?account/i, ce = (e, t) => {
340
+ }, oe = (e) => w(e, n).filter((e) => !b.has(m.posix.basename(e)) && !e.endsWith(".json")).map((e) => y("data-not-json", e, `${e} is not JSON: a provider's /data/<file> and ctx.data read JSON files only, and plitzi space push leaves it behind.`, `Keep it as JSON (${e.replace(/\.[^./]*$/, "")}.json), or move it out of ${n}/.`)), se = /^\.env(?:\..*)?$|\.(?:pem|key|p12|pfx|jks|keystore|sqlite3?|db|sql|dump)$|secret|credential|password|passwd|private[-_.]?key|id_rsa|id_ed25519|service[-_]?account/i, ce = (e, t) => {
341
341
  let r = w(e, l, /* @__PURE__ */ new Set(["node_modules"])), i = r.filter((e) => se.test(m.posix.basename(e))).map((e) => y("public-secret-file", e, `${e} is served to anyone who asks, as it is — everything in ${l}/ is on the internet once the project is deployed — and its name says it holds a secret, a key or a database.`, `Take it out of ${l}/: settings go in the root's .env${t === "server" ? `, data only the server reads in ${n}/` : ""}.`)), a = `${l}/data`, o = t === "server" ? r.filter((e) => e.startsWith(`${a}/`) && e.endsWith(".json")) : [], s = o.slice(0, 3).map((e) => m.posix.basename(e)), c = o.length > 0 ? [y("public-data", `${a}/`, `${a}/ holds ${String(o.length)} JSON file${o.length === 1 ? "" : "s"} (${s.join(", ")}${o.length > s.length ? ", …" : ""}), served to anyone who asks: every visitor can read all of ${o.length === 1 ? "it" : "them"}, not only what a page shows.`, `Data only the server should read goes in ${n}/ — a provider reads it on the server (runtime: 'server', query: '/data/<file>'), a function with ctx.data('<file>'), and neither serves the file. What every visitor may read can stay.`)] : [];
342
342
  return [...i, ...c];
343
343
  }, Z = (t) => {
@@ -365,7 +365,7 @@ var v = {
365
365
  accepted: ["index.ts"],
366
366
  code: "runtime-entry-missing",
367
367
  lost: "the space’s runtime does not run",
368
- write: `Write ${u}/index.ts exporting defineRuntime(…) by default — npx plitzi add runtime writes one.`
368
+ write: `Write ${u}/index.ts exporting defineRuntime(…) by default — npx plitzi runtime add writes one.`
369
369
  }),
370
370
  ...n.space === "local" ? re(e, i) : [],
371
371
  ...i,
@@ -39,7 +39,7 @@ export declare const PLUGINS_DIR = "src/plugins";
39
39
  * and one of them, never both.
40
40
  */
41
41
  export declare const PLUGIN_ENTRIES: readonly ["index.ts", "index.tsx"];
42
- /** What a plugin folder declares itself in — its type, attributes, triggers — as `plitzi add plugin` writes it. */
42
+ /** What a plugin folder declares itself in — its type, attributes, triggers — as `plitzi plugin add` writes it. */
43
43
  export declare const PLUGIN_DECLARATION_FILE = "declaration.ts";
44
44
  /** A plugin's server half, a folder of its own beside its component: built from its `index.ts`. */
45
45
  export declare const PLUGIN_FUNCTIONS_DIR = "functions";
@@ -48,7 +48,7 @@ export declare const PLUGIN_FUNCTIONS_DIR = "functions";
48
48
  * beside the manifest it was published with (`PLUGIN_MANIFEST_FILE`).
49
49
  */
50
50
  export declare const VENDOR_PLUGINS_DIR = "vendor/plugins";
51
- /** What `plitzi pack plugin` writes beside a plugin's bundle: its version, its files, and the elements it provides. */
51
+ /** What `plitzi plugin pack` writes beside a plugin's bundle: its version, its files, and the elements it provides. */
52
52
  export declare const PLUGIN_MANIFEST_FILE = "plugin-manifest.json";
53
53
  /** A runtime that came across built only (a project made from a space): run as it was built. */
54
54
  export declare const RUNTIME_BUNDLE = "vendor/runtime.bundle";
@@ -29,7 +29,7 @@ export type SpaceExport = {
29
29
  /** The version taken out: the draft (`main`, revision 0), or a snapshot an environment holds. */
30
30
  version: Pick<SpaceVersionContents, 'environment' | 'revision' | 'snapshot'>;
31
31
  /**
32
- * Which state of the draft's documents this is — its schema, style, actions and connectors — what `plitzi push`
32
+ * Which state of the draft's documents this is — its schema, style, actions and connectors — what `plitzi space push`
33
33
  * checks the space's draft has not moved on from. `null` for a snapshot, which no push writes.
34
34
  */
35
35
  draft: string | null;
@@ -62,7 +62,7 @@ export type SpaceExport = {
62
62
  };
63
63
  /**
64
64
  * The space's own data, by path in `src/data/` (JSON its providers read on the server, never served), and the version
65
- * of it this is — what `plitzi push` checks the space's copy has not moved on from.
65
+ * of it this is — what `plitzi space push` checks the space's copy has not moved on from.
66
66
  */
67
67
  data: {
68
68
  version: string;
@@ -1,6 +1,6 @@
1
1
  import { Schema, Style } from '../types';
2
2
  /**
3
- * A project's space put back on Plitzi as the space's draft (docs/en/projects-from-spaces.md): what `plitzi push` sends
3
+ * A project's space put back on Plitzi as the space's draft (docs/en/projects-from-spaces.md): what `plitzi space push` sends
4
4
  * to `PUT /spaces/:spaceId/import`, and what it is answered. The way back of `SpaceExport` — one shape for both ends.
5
5
  */
6
6
  export declare const SPACE_IMPORT_FORMAT = 1;
@@ -10,7 +10,7 @@ export declare const PLUGIN_CSS_LAYER = "plitzi-sdk-plugin";
10
10
  export declare const RUNTIME_CSS_LAYER = "plitzi-sdk-runtime";
11
11
  /**
12
12
  * A plugin's stylesheet, as it ships: everything in it in {@link PLUGIN_CSS_LAYER}. Written by whatever builds a
13
- * plugin — a server compiling one, `plitzi pack plugin` — so every way the file later reaches a page (a `<link>` in the
13
+ * plugin — a server compiling one, `plitzi plugin pack` — so every way the file later reaches a page (a `<link>` in the
14
14
  * server's HTML, the SDK's assets, the builder's canvas) puts it in its place with no work of its own.
15
15
  *
16
16
  * Idempotent: a stylesheet already wrapped is returned as it is.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.38.7",
3
+ "version": "0.38.8",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -318,6 +318,10 @@
318
318
  "types": "./dist/helpers/index.d.ts",
319
319
  "import": "./dist/helpers/index.mjs"
320
320
  },
321
+ "./helpers/canonicalJson": {
322
+ "types": "./dist/helpers/canonicalJson.d.ts",
323
+ "import": "./dist/helpers/canonicalJson.mjs"
324
+ },
321
325
  "./helpers/cookies": {
322
326
  "types": "./dist/helpers/cookies.d.ts",
323
327
  "import": "./dist/helpers/cookies.mjs"