@plitzi/sdk-authoring 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/dist/index.d.ts CHANGED
@@ -1311,6 +1311,11 @@ export declare const AUTHORING_CODES: {
1311
1311
  readonly means: "a prop whose name a template cannot read as `props.x`";
1312
1312
  readonly fix: "letters, digits and `_`";
1313
1313
  };
1314
+ readonly 'prop-type-unknown': {
1315
+ readonly kind: "refused";
1316
+ readonly means: "a prop declared with a type no editor offers and nothing checks a value against";
1317
+ readonly fix: "one of text, textarea, select, boolean, number, scalar, json, elementIds — words are `text`";
1318
+ };
1314
1319
  readonly 'prop-unknown': {
1315
1320
  readonly kind: "refused";
1316
1321
  readonly means: "a prop the component does not declare, handed in or read";
@@ -2012,6 +2017,8 @@ export declare const BUILTIN_ELEMENT_CALLBACKS: Record<string, BuiltinElementCal
2012
2017
  */
2013
2018
  export declare const BUILTIN_GLOBAL_CALLBACKS: Record<string, BuiltinGlobalCallback>;
2014
2019
 
2020
+ export declare const BUILTIN_PARAM_TYPES: readonly ["text", "textarea", "select", "boolean", "number", "scalar", "json", "elementIds"];
2021
+
2015
2022
  export declare const BUILTIN_TRANSFORMERS: Record<string, BuiltinTransformer>;
2016
2023
 
2017
2024
  export declare const BUILTIN_UTILITIES: Record<string, BuiltinUtility>;
@@ -2072,7 +2079,7 @@ export declare interface BuiltinParam {
2072
2079
  elementType?: string;
2073
2080
  }
2074
2081
 
2075
- export declare type BuiltinParamType = 'text' | 'textarea' | 'select' | 'boolean' | 'number' | 'scalar' | 'json' | 'elementIds';
2082
+ export declare type BuiltinParamType = (typeof BUILTIN_PARAM_TYPES)[number];
2076
2083
 
2077
2084
  export declare interface BuiltinTransformer {
2078
2085
  title: string;
@@ -2275,6 +2282,8 @@ export declare const closeDialog: (target: string) => StepSpec;
2275
2282
  /** Closes a `modalContainer`, by id — from a button inside it or anywhere else. */
2276
2283
  export declare const closeModal: (target: string) => StepSpec;
2277
2284
 
2285
+ export declare const closest: (name: string, candidates: Iterable<string>) => string | undefined;
2286
+
2278
2287
  declare type Codes = typeof AUTHORING_CODES;
2279
2288
 
2280
2289
  /**
@@ -2432,6 +2441,13 @@ declare type ContentShorthand<A> = 'content' extends keyof A ? {
2432
2441
  (content: string, props?: ElementProps<A>): ElementSpec;
2433
2442
  } : unknown;
2434
2443
 
2444
+ /**
2445
+ * Copies `text` to the visitor's clipboard — a template like any param: `copyToClipboard('{{ navigation.href }}')` copies
2446
+ * the page's address. Where the browser offers no clipboard the step fails, so a flow's `onFailure` says so and its
2447
+ * "Copied" never shows for nothing.
2448
+ */
2449
+ export declare const copyToClipboard: (text: string) => StepSpec;
2450
+
2435
2451
  /**
2436
2452
  * A `tw()` with colours of its own: `createTw({ colors: tokens(variables) })` makes `bg-surface` the space's token.
2437
2453
  *
@@ -2544,7 +2560,7 @@ export declare interface DataIssue {
2544
2560
  * — `landing.data.plans` where the answer is `{ plans }` — was "36 elements on screen, nothing wrong". Read here, with
2545
2561
  * the provider's answer in hand, it is the binding, the path it reads and the keys that ARE there.
2546
2562
  *
2547
- * Pure: the sources come from the page's dev tools (`window.__plitzi.sources()`), so a suite or `plitzi check` reads
2563
+ * Pure: the sources come from the page's dev tools (`window.__plitzi.sources()`), so a suite or `plitzi page check` reads
2548
2564
  * them however it reaches the page.
2549
2565
  */
2550
2566
  export declare type DataIssueCode = 'binding-reads-nothing' | 'provider-failed';
@@ -2570,7 +2586,7 @@ export declare interface DataReport {
2570
2586
  /**
2571
2587
  * Every list of the page whose rows come from a provider: how many rows its source holds, `null` when it reads
2572
2588
  * nothing. The source, before the binding's transformers: a list that filters or slices them draws fewer — what is
2573
- * drawn is the page's to count (`plitzi check` does).
2589
+ * drawn is the page's to count (`plitzi page check` does).
2574
2590
  */
2575
2591
  lists: Record<string, number | null>;
2576
2592
  }
@@ -2928,7 +2944,7 @@ export declare interface ElementDeclarationData {
2928
2944
  /**
2929
2945
  * Whether the element is behaviour rather than content — a clock that fires a flow, a listener — and draws nothing on
2930
2946
  * a page (at most a tag in the builder, to have something to select). Read by the page checks (`inspectPage`,
2931
- * `plitzi check`), which would otherwise wait for it to be on screen and report it hidden.
2947
+ * `plitzi page check`), which would otherwise wait for it to be on screen and report it hidden.
2932
2948
  */
2933
2949
  drawsNothing?: boolean;
2934
2950
  content?: {
@@ -7937,14 +7953,17 @@ export declare interface FixChange {
7937
7953
  on: 'attribute' | 'field' | 'binding' | {
7938
7954
  step: string;
7939
7955
  };
7940
- /** `replace` swaps one literal text for another anywhere under the key — a transformer's action in a binding. */
7941
- op: 'remove' | 'rename' | 'set' | 'replace';
7956
+ /**
7957
+ * `replace` swaps one literal text for another anywhere under the key — a transformer's action in a binding.
7958
+ * `unwrap` puts what the key holds — an object — in its place, one level up: `attributes: { value: 5 }` → `value: 5`.
7959
+ */
7960
+ op: 'remove' | 'rename' | 'set' | 'replace' | 'unwrap';
7942
7961
  /** The attribute, field or param; a binding's target; the text `replace` looks for. */
7943
7962
  key: string;
7944
7963
  /** What `rename` renames to, and what `replace` writes. */
7945
7964
  to?: string;
7946
7965
  /** What `set` writes. */
7947
- value?: string | boolean;
7966
+ value?: string | number | boolean;
7948
7967
  }
7949
7968
 
7950
7969
  /** What is wrong with a declaration, and what of it has one fix. */
@@ -8360,7 +8379,7 @@ export declare interface ImportProbeInput {
8360
8379
 
8361
8380
  export declare const importSlug: (text: string) => string;
8362
8381
 
8363
- /** What an import found, counted — the few lines `plitzi import` answers with. */
8382
+ /** What an import found, counted — the few lines `plitzi page import` answers with. */
8364
8383
  export declare interface ImportSummary {
8365
8384
  url: string;
8366
8385
  widths: number[];
@@ -8785,6 +8804,15 @@ export declare const loadImages: (budgetMs: number) => Promise<LoadedImages>;
8785
8804
  */
8786
8805
  export declare const locate: <L>(source: LocatorSource<L>, handles: SpaceHandles) => (id: string) => L;
8787
8806
 
8807
+ /** `locateClasses`, holding the same catalogs: every class the space declares, with the `styles()` call that wrote it. */
8808
+ export declare const locateClasses: (spec: SpaceSpec, options?: AuthorSpaceOptions) => WrittenClass[];
8809
+
8810
+ /**
8811
+ * `locateElements`, holding the same catalogs: every element the space authors to, with the call in the author's code
8812
+ * that wrote it — what `plitzi element where` answers and `plitzi element edit` edits at.
8813
+ */
8814
+ export declare const locateElements: (spec: SpaceSpec, options?: AuthorSpaceOptions) => WrittenElement[];
8815
+
8788
8816
  /**
8789
8817
  * The shape this borrows from a browser driver, declared structurally so the package still installs nothing.
8790
8818
  *
@@ -9335,6 +9363,13 @@ export declare interface OpenPageOptions {
9335
9363
 
9336
9364
  declare type Operator = '' | '=' | '!=' | '<' | '>' | '<=' | '>=' | 'contains' | 'doesNotContain' | 'beginsWith' | 'doesNotBeginWith' | 'endsWith' | 'doesNotEndWith' | 'empty' | 'notEmpty' | 'in' | 'notIn' | 'between' | 'notBetween';
9337
9365
 
9366
+ /**
9367
+ * A page's attributes that are one field of its `PageSpec` each, by attribute name: the page writes `seoTitle` and the
9368
+ * document reads `seoPageTitle`. What an edit of a page's attribute writes in the code. Its layout is not here — two
9369
+ * attributes from one field (`layout: { id, slot }`) — nor `seoEnabled`, which follows from the other two.
9370
+ */
9371
+ export declare const PAGE_SPEC_FIELDS: Readonly<Record<string, keyof PageSpec>>;
9372
+
9338
9373
  /** How many texts a page is read for: enough for a long page, few enough to stay quick. */
9339
9374
  export declare const PAGE_TEXT_LIMIT = 2000;
9340
9375
 
@@ -9686,7 +9721,7 @@ export declare interface PictureRegion {
9686
9721
 
9687
9722
  /**
9688
9723
  * `planFixes`, holding the same catalogs: every fix `fixSpace` would make in this declaration, each with the place in
9689
- * the author's code that wrote the element and the edit that makes the fix there — what `plitzi fix` shows and writes.
9724
+ * the author's code that wrote the element and the edit that makes the fix there — what `plitzi space fix` shows and writes.
9690
9725
  */
9691
9726
  export declare const planFixes: (spec: SpaceSpec, options?: AuthorSpaceOptions) => FixPlan;
9692
9727
 
@@ -10356,6 +10391,10 @@ export declare type SchemaValidationError = {
10356
10391
  elementId?: string;
10357
10392
  /** The component whose tree the error is in; absent for the pages' tree. */
10358
10393
  componentId?: string;
10394
+ /** The name an element points at that no element answers to — what a suggestion of the nearest one is made from. */
10395
+ missing?: string;
10396
+ /** The step the missing element was to answer (`openModal`): a suggestion is drawn from the elements that do. */
10397
+ wantedBy?: string;
10359
10398
  details?: unknown;
10360
10399
  };
10361
10400
 
@@ -12183,6 +12222,54 @@ export declare interface WornList {
12183
12222
  classes: WornClass[];
12184
12223
  }
12185
12224
 
12225
+ /** One class of the space, and where the author's code declares it. */
12226
+ export declare interface WrittenClass {
12227
+ name: string;
12228
+ /** Where it was declared: `src/space/styles.ts:118`. Absent for one no `styles()` call wrote (a space-wide object). */
12229
+ at?: string;
12230
+ position?: WrittenPosition;
12231
+ }
12232
+
12233
+ /** One element of the space, and the call in the author's code that wrote it. */
12234
+ export declare interface WrittenElement {
12235
+ elementId: string;
12236
+ type: string;
12237
+ /** The page, layout or component it is in. */
12238
+ rootId: string;
12239
+ /** The classes it wears, by name. */
12240
+ classes: string[];
12241
+ /** Its own words, when it has some. */
12242
+ content?: string;
12243
+ /** The templates its bindings compute an attribute with — where the words it shows live when they are not its own. */
12244
+ templates: string[];
12245
+ /**
12246
+ * Every word it says to a person, read or heard: its `content`, `label`, `title`, `alt` and `placeholder`, the
12247
+ * templates its bindings write, and — an instance of a component — the words it hands the component. What
12248
+ * `plitzi element where` finds an element by when it is asked for words.
12249
+ */
12250
+ words: string[];
12251
+ /** Its attributes as authored. */
12252
+ attributes: Record<string, unknown>;
12253
+ /** The elements it holds, in their order. */
12254
+ children: string[];
12255
+ /** The other elements its flows act on, each with the step that does: what taking one of them away would break. */
12256
+ targets: {
12257
+ elementId: string;
12258
+ step: string;
12259
+ }[];
12260
+ /** The attributes its bindings compute: what the page shows of them is the binding's, never the value written. */
12261
+ bound: string[];
12262
+ /** Where it was written: `src/space/pages/home.ts:42`. Absent for an element no call of the author's code wrote. */
12263
+ at?: string;
12264
+ /** The same place exactly — the factory's name, at its line and column — which is what an edit is made at. */
12265
+ position?: WrittenPosition;
12266
+ /**
12267
+ * The calls of the author's code that led to `position`, the nearest first: a helper written once and called for
12268
+ * each element (`pageHead('about-head', …)`) is told apart by them.
12269
+ */
12270
+ through: WrittenPosition[];
12271
+ }
12272
+
12186
12273
  /** Where a call is, exactly: the file, its line and the column its function's name starts at, from 1. */
12187
12274
  export declare interface WrittenPosition {
12188
12275
  /** Relative to the working directory when it is under it. */
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as explainKindOf, $i as elementAttributeValues, $n as twigTemplate, $r as dropdownPopup, $t as SpaceRefusedError, A as inspectPage, Ai as COMPONENT_SOURCES, An as BUILTIN_UTILITIES, Ar as publishOn, At as isClassModifier, B as catalogTemplateFiles, Bi as toBindingSpecs, Bn as clearState, Br as withPluginCatalogs, Bt as toBlocks, C as comparePictures, Ci as video, Cn as authorFlows, Cr as onLoad, Ct as tw, D as loadImages, Di as defineElement, Dn as whenFailed, Dr as onSubmit, Dt as className, E as profilePictures, Ei as defaultLabel, En as when, Er as onScroll, Et as row, F as dataIssues, Fi as bindTemplate, Fn as appendState, Fr as scrollTo, Ft as BREAKPOINTS, G as darkScheme, Gi as source, Gn as moveState, Gr as button, Gt as expandShorthandTraced, H as toPortableSource, Hi as visibleWhen, Hn as delay, Hr as apiContainer, Ht as cssShorthands, I as answerAction, Ii as groupBindings, In as authLogin, Ir as setFieldValue, It as STYLE_STATES, J as importProbe, Ji as AUTHORING_CODES, Jn as runServerAction, Jr as channel, Jt as cssProperties, K as importSlug, Ki as twig, Kn as navigate, Kr as carousel, Kt as shorthandLonghands, L as CATALOG_TEMPLATE_IDENTITY, Li as hasVisibilityBinding, Ln as authLogout, Lr as toggleElement, Lt as css, M as failedFlowText, Mi as activeOn, Mn as getUtility, Mr as resetForm, Mt as modifierClassName, N as readDevTools, Ni as activeWhen, Nn as SET_STATE_TYPES, Nr as scrollBy, Nt as splitClassList, O as unrollPage, Oi as element, On as whenSucceeded, Or as openDialog, Ot as classNames, P as readDevToolsInPage, Pi as authorBinding, Pn as addNotification, Pr as scrollIntoView, Pt as styles, Q as explain, Qi as elementAncestorTypes, Qn as toggleState, Qr as dropdown, Qt as suggestCssProperty, R as blankSpace, Ri as hiddenWhen, Rn as authRefreshDetails, Rr as updateElement, Rt as isRuleSetSpec, S as alignPictures, Si as themeToggle, Sn as authorFlow, Sr as onKey, St as createTw, T as pageRegions, Ti as defaultAttributes, Tn as named, Tr as onPointerDown, Tt as grid, U as space$1, Ui as withVisibility, Un as hostAction, Ur as blockHtml, Ut as expandShorthand, V as emptySpaceSource, Vi as variantFrom, Vn as cycleState, Vt as toResponsive, W as space, Wi as actionSource, Wn as invalidateQueries, Wr as blockJsx, Wt as expandShorthandPatch, X as EXPLAIN_KINDS, Xi as authoringCodeEntry, Xn as stepState, Xr as custom, Xt as isCssProperty, Y as BUILDER_NAMES, Yi as AuthoringError, Yn as setState, Yr as container, Yt as cssPropertyName, Z as GLOBAL_CALLBACK_BUILDERS, Zi as isSuggestionCode, Zn as toggleInState, Zr as dialogContainer, Zt as isCustomProperty, _ as inspectRenders, _a as s, _i as tabContainer, _n as selectorFor, _r as onClick, _t as suggestSpace, a as planFixes, aa as elementSlots, ai as image, an as i, ar as announceOn, at as SCHEMA_SETTINGS, b as compareTexts, ba as s$1, bi as tabContainerItem, bn as authoringCodesTable, br as onFlowProgress, bt as unusedDeclarations, c as a$1, ca as elementTypeNames, ci as listItem, cn as r, cr as carouselNext, ct as actionSpecFromEntry, d as compactSvg, da as e$1, di as nodeHtml, dn as digest, dr as carouselPrevious, dt as BUILTIN_TRANSFORMERS, ea as elementCallbacks, ei as embed, en as refusalOf, er as webHook, et as explainList, f as singlePageSpace, fa as t$1, fi as pagination, fn as slugify, fr as closeDialog, ft as getTransformer, g as openPage, ga as o, gi as svg, gn as pathForSlug, gr as on, gt as assertSpaceValid, h as shortcutKey, ha as i$1, hi as richText, hn as locate, hr as declaredTrigger, ht as assertSnippetValid, i as lintSpace, ia as elementPartTypes, ii as heading, in as d, ir as e, it as specToSource, j as onScreen, ji as GLOBAL_SOURCES, jn as applyUtility, jr as reloadApi, jt as isStyleDeclaration, k as inspectDocument, ki as inferredLinkMode, kn as whileRunning, kr as openModal, kt as classRefs, l as i$2, la as typeCallbackDefinitions, li as markdown, ln as t, lr as carouselPause, lt as actionToSource, m as pressShortcut, ma as a, mi as reference, mn as instanceSelectorFor, mr as declaredCallback, mt as transformerCatalog, n as authorSpace, na as elementDefaultAttributes, ni as form, nn as notificationsCss, nr as applyBuiltinCallback, nt as ELEMENT_FIELDS, o as validateSnippet, oa as elementSourceTypes, oi as link, on as FIXABLE_CODES, or as cancelApi, ot as specFromSpace, p as withElement, pa as elementAttributeNames, pi as paragraph, pn as buildHandles, pr as closeModal, pt as suggestTransformer, q as importedFiles, qi as scope, qn as removeState, qr as carouselTrack, qt as cssNumberValue, r as fixSpace, ra as elementLeafTypes, ri as formControl, rn as withNotificationsCss, rr as getGlobalCallback, rt as SPACE_FIELDS, s as validateSpace, sa as elementTriggers, si as list, sn as n, sr as carouselGoTo, st as compareSpaces, t as authorSnippet, ta as elementCatalog, ti as fontAwesome, tn as pageFamily, tr as BUILTIN_GLOBAL_CALLBACKS, tt as explanationText, u as o$2, ua as typeTriggerDefinitions, ui as modalContainer, ur as carouselPlay, ut as withNamedIds, v as summariseRenders, va as n$1, vi as tabContainerBody, vn as flagGateOf, vr as onFlowEnd, vt as withoutQuieted, w as diffPictures, wi as component, wn as flowStepIds, wr as onPageLoad, wt as column, x as pageTexts, xa as t$2, xi as text, xn as defineAction, xr as onInterval, xt as tokens, y as PAGE_TEXT_LIMIT, ya as o$1, yi as tabContainerHeader, yn as flagSpecOf, yr as onFlowError, yt as suggestClassOverrides, z as blankTemplateFiles, zi as resolveSource, zn as cancelServerAction, zr as elementsFromManifest, zt as sameBlocks } from "./index-src.js";
2
- export { AUTHORING_CODES, AuthoringError, BREAKPOINTS, BUILDER_NAMES, a as BUILTIN_ELEMENT_CALLBACKS, BUILTIN_GLOBAL_CALLBACKS, BUILTIN_TRANSFORMERS, BUILTIN_UTILITIES, CATALOG_TEMPLATE_IDENTITY, COMPONENT_SOURCES, ELEMENT_FIELDS, EXPLAIN_KINDS, FIXABLE_CODES, GLOBAL_CALLBACK_BUILDERS, GLOBAL_SOURCES, t as MOTION_ENTERS, r as MOTION_LOOPS, n as MOTION_TRIGGERS, i as NOTIFICATIONS_FIELDS, PAGE_TEXT_LIMIT, SCHEMA_SETTINGS, i$1 as SCROLL_CALLBACKS, SET_STATE_TYPES, SPACE_FIELDS, STYLE_STATES, SpaceRefusedError, actionSource, actionSpecFromEntry, actionToSource, activeOn, activeWhen, addNotification, alignPictures, announceOn, answerAction, apiContainer, appendState, applyBuiltinCallback, s as applyElementCallback, applyUtility, assertSnippetValid, assertSpaceValid, authLogin, authLogout, authRefreshDetails, authorBinding, authorFlow, authorFlows, authorSnippet, authorSpace, authoringCodeEntry, authoringCodesTable, bindTemplate, blankSpace, space as blankSpaceSpec, blankTemplateFiles, blockHtml, blockJsx, buildHandles, button, cancelApi, cancelServerAction, carousel, carouselGoTo, carouselNext, carouselPause, carouselPlay, carouselPrevious, carouselTrack, catalogTemplateFiles, channel, className, classNames, classRefs, clearState, closeDialog, closeModal, column, compactSvg, comparePictures, compareSpaces, compareTexts, component, container, createTw, css, cssNumberValue, cssProperties, cssPropertyName, cssShorthands, custom, cycleState, darkScheme, dataIssues, declaredCallback, declaredTrigger, defaultAttributes, defaultLabel, defineAction, defineElement, delay, dialogContainer, diffPictures, digest, dropdown, dropdownPopup, element, elementAncestorTypes, elementAttributeNames, elementAttributeValues, elementCallbacks, elementCatalog, t$1 as elementDeclaration, elementDefaultAttributes, elementLeafTypes, elementPartTypes, elementSlots, elementSourceTypes, elementTriggers, elementTypeNames, elementsFromManifest, embed, emptySpaceSource, space$1 as emptySpaceSpec, expandShorthand, expandShorthandPatch, expandShorthandTraced, explain, explainKindOf, explainList, explanationText, failedFlowText, fixSpace, flagGateOf, flagSpecOf, flowStepIds, fontAwesome, form, formControl, o as getElementCallback, getGlobalCallback, getTransformer, getUtility, grid, groupBindings, hasVisibilityBinding, heading, t$2 as hiddenParams, hiddenWhen, hostAction, image, importProbe, importSlug, importedFiles, inferredLinkMode, inspectDocument, inspectPage, inspectRenders, instanceSelectorFor, o$1 as invalidParams, invalidateQueries, isClassModifier, isCssProperty, isCustomProperty, isRuleSetSpec, isStyleDeclaration, isSuggestionCode, link, lintSpace, list, listItem, loadImages, locate, markdown, n$1 as missingRequiredParams, modalContainer, modifierClassName, moveState, named, navigate, nodeHtml, notificationsCss, on, onClick, onFlowEnd, onFlowError, onFlowProgress, onInterval, onKey, onLoad, onPageLoad, onPointerDown, onScreen, onScroll, onSubmit, openDialog, openModal, openPage, pageFamily, pageRegions, pageTexts, pagination, paragraph, pathForSlug, planFixes, pressShortcut, profilePictures, publishOn, readDevTools, readDevToolsInPage, s$1 as reconcileParams, reference, refusalOf, reloadApi, removeState, resetForm, resolveSource, richText, row, runServerAction, sameBlocks, scope, scrollBy, scrollIntoView, scrollTo, selectorFor, setFieldValue, setState, shortcutKey, shorthandLonghands, singlePageSpace, slugify, source, e as spaceCallbacks, specFromSpace, specToSource, splitClassList, d as splitNotificationsCss, stepState, styles, suggestClassOverrides, suggestCssProperty, suggestSpace, suggestTransformer, summariseRenders, svg, tabContainer, tabContainerBody, tabContainerHeader, tabContainerItem, text, themeToggle, toBindingSpecs, toBlocks, i$2 as toBuilderParams, a$1 as toInteractionCallback, o$2 as toInteractionCallbacks, toPortableSource, toResponsive, toggleElement, toggleInState, toggleState, tokens, transformerCatalog, tw, twig, twigTemplate, typeCallbackDefinitions, typeTriggerDefinitions, unrollPage, unusedDeclarations, updateElement, validateSnippet, validateSpace, e$1 as valuesOf, variantFrom, video, visibleWhen, webHook, when, whenFailed, whenSucceeded, whileRunning, withElement, withNamedIds, withNotificationsCss, withPluginCatalogs, withVisibility, withoutQuieted };
1
+ import { $ as GLOBAL_CALLBACK_BUILDERS, $i as AUTHORING_CODES, $n as setState, $r as container, $t as isCssProperty, A as unrollPage, Ai as defaultLabel, An as whenFailed, Ar as onScroll, At as className, B as blankSpace, Bi as groupBindings, Bn as authLogout, Br as setFieldValue, Bt as css, C as pageTexts, Ca as c, Ci as tabContainerHeader, Cn as authoringCodesTable, Cr as onFlowError, Ct as unusedDeclarations, D as pageRegions, Da as t, Di as video, Dn as flowStepIds, Dr as onLoad, Dt as column, E as diffPictures, Ea as s$1, Ei as themeToggle, En as authorFlows, Er as onKey, Et as tw, F as readDevTools, Fi as GLOBAL_SOURCES, Fn as getUtility, Fr as reloadApi, Ft as modifierClassName, G as space$1, Gi as variantFrom, Gn as cycleState, Gt as cssShorthands, H as catalogTemplateFiles, Hi as hiddenWhen, Hn as cancelServerAction, Hr as updateElement, Ht as sameBlocks, I as readDevToolsInPage, Ii as activeOn, In as SET_STATE_TYPES, Ir as resetForm, It as splitClassList, J as importSlug, Ji as actionSource, Jn as invalidateQueries, Jr as blockJsx, Jt as expandShorthandTraced, K as space, Ki as visibleWhen, Kn as delay, Kr as apiContainer, Kt as expandShorthand, L as dataIssues, Li as activeWhen, Ln as addNotification, Lr as scrollBy, Lt as styles, M as inspectPage, Mi as element, Mn as whileRunning, Mr as openDialog, Mt as classRefs, N as onScreen, Ni as inferredLinkMode, Nn as BUILTIN_UTILITIES, Nr as openModal, Nt as isClassModifier, O as profilePictures, Oi as component, On as named, Or as onPageLoad, Ot as grid, P as failedFlowText, Pi as COMPONENT_SOURCES, Pn as applyUtility, Pr as publishOn, Pt as isStyleDeclaration, Q as EXPLAIN_KINDS, Qi as scope, Qn as runServerAction, Qr as channel, Qt as cssPropertyName, R as answerAction, Ri as authorBinding, Rn as appendState, Rr as scrollIntoView, Rt as BREAKPOINTS, S as compareTexts, Sa as s, Si as tabContainerBody, Sn as flagSpecOf, Sr as onFlowEnd, St as suggestClassOverrides, T as comparePictures, Ta as r$1, Ti as text, Tn as authorFlow, Tr as onInterval, Tt as createTw, U as emptySpaceSource, Ui as resolveSource, Un as clearState, Ur as elementsFromManifest, Ut as toBlocks, V as blankTemplateFiles, Vi as hasVisibilityBinding, Vn as authRefreshDetails, Vr as toggleElement, Vt as isRuleSetSpec, W as toPortableSource, Wi as toBindingSpecs, Wn as copyToClipboard, Wr as withPluginCatalogs, Wt as toResponsive, X as importProbe, Xi as twig, Xn as navigate, Xr as carousel, Xt as cssNumberValue, Y as importedFiles, Yi as source, Yn as moveState, Yr as button, Yt as shorthandLonghands, Z as BUILDER_NAMES, Zi as closest, Zn as removeState, Zr as carouselTrack, Zt as cssProperties, _ as shortcutKey, _a as t$2, _i as paragraph, _n as instanceSelectorFor, _r as closeModal, _t as assertSnippetValid, a as locateClasses, aa as elementCallbacks, ai as fontAwesome, an as notificationsCss, ar as BUILTIN_GLOBAL_CALLBACKS, at as SPACE_FIELDS, b as summariseRenders, ba as i$1, bi as svg, bn as selectorFor, br as on, bt as suggestSpace, c as validateSnippet, ca as elementLeafTypes, ci as heading, cn as i, cr as e, ct as specFromSpace, d as i$2, da as elementSourceTypes, di as list, dn as r, dr as carouselGoTo, dt as actionToSource, ea as AuthoringError, ei as custom, en as isCustomProperty, er as stepState, et as explain, f as o$1, fa as elementTriggers, fi as listItem, fn as t$1, fr as carouselNext, ft as withNamedIds, g as pressShortcut, ga as e$1, gi as pagination, gn as buildHandles, gr as closeDialog, gt as transformerCatalog, h as withElement, ha as typeTriggerDefinitions, hi as nodeHtml, hn as slugify, hr as carouselPrevious, ht as suggestTransformer, i as lintSpace, ia as elementAttributeValues, ii as embed, in as pageFamily, ir as webHook, it as ELEMENT_FIELDS, j as inspectDocument, ji as defineElement, jn as whenSucceeded, jr as onSubmit, jt as classNames, k as loadImages, ki as defaultAttributes, kn as when, kr as onPointerDown, kt as row, l as validateSpace, la as elementPartTypes, li as image, ln as FIXABLE_CODES, lr as announceOn, lt as compareSpaces, m as singlePageSpace, ma as typeCallbackDefinitions, mi as modalContainer, mn as digest, mr as carouselPlay, mt as getTransformer, n as authorSpace, na as isSuggestionCode, ni as dropdown, nn as SpaceRefusedError, nr as toggleState, nt as explainList, o as locateElements, oa as elementCatalog, oi as form, on as withNotificationsCss, or as applyBuiltinCallback, ot as specToSource, p as compactSvg, pa as elementTypeNames, pi as markdown, pr as carouselPause, pt as BUILTIN_TRANSFORMERS, q as darkScheme, qi as withVisibility, qn as hostAction, qr as blockHtml, qt as expandShorthandPatch, r as fixSpace, ra as elementAncestorTypes, ri as dropdownPopup, rn as refusalOf, rr as twigTemplate, rt as explanationText, s as planFixes, sa as elementDefaultAttributes, si as formControl, sn as d, sr as getGlobalCallback, st as SCHEMA_SETTINGS, t as authorSnippet, ta as authoringCodeEntry, ti as dialogContainer, tn as suggestCssProperty, tr as toggleInState, tt as explainKindOf, u as a$1, ua as elementSlots, ui as link, un as n, ur as cancelApi, ut as actionSpecFromEntry, v as openPage, va as elementAttributeNames, vi as reference, vn as locate, vr as declaredCallback, vt as PAGE_SPEC_FIELDS, w as alignPictures, wa as n$1, wi as tabContainerItem, wn as defineAction, wr as onFlowProgress, wt as tokens, x as PAGE_TEXT_LIMIT, xa as o, xi as tabContainer, xn as flagGateOf, xr as onClick, xt as withoutQuieted, y as inspectRenders, ya as a, yi as richText, yn as pathForSlug, yr as declaredTrigger, yt as assertSpaceValid, z as CATALOG_TEMPLATE_IDENTITY, zi as bindTemplate, zn as authLogin, zr as scrollTo, zt as STYLE_STATES } from "./index-src.js";
2
+ export { AUTHORING_CODES, AuthoringError, BREAKPOINTS, BUILDER_NAMES, a as BUILTIN_ELEMENT_CALLBACKS, BUILTIN_GLOBAL_CALLBACKS, t as BUILTIN_PARAM_TYPES, BUILTIN_TRANSFORMERS, BUILTIN_UTILITIES, CATALOG_TEMPLATE_IDENTITY, COMPONENT_SOURCES, ELEMENT_FIELDS, EXPLAIN_KINDS, FIXABLE_CODES, GLOBAL_CALLBACK_BUILDERS, GLOBAL_SOURCES, t$1 as MOTION_ENTERS, r as MOTION_LOOPS, n as MOTION_TRIGGERS, i as NOTIFICATIONS_FIELDS, PAGE_SPEC_FIELDS, PAGE_TEXT_LIMIT, SCHEMA_SETTINGS, i$1 as SCROLL_CALLBACKS, SET_STATE_TYPES, SPACE_FIELDS, STYLE_STATES, SpaceRefusedError, actionSource, actionSpecFromEntry, actionToSource, activeOn, activeWhen, addNotification, alignPictures, announceOn, answerAction, apiContainer, appendState, applyBuiltinCallback, s as applyElementCallback, applyUtility, assertSnippetValid, assertSpaceValid, authLogin, authLogout, authRefreshDetails, authorBinding, authorFlow, authorFlows, authorSnippet, authorSpace, authoringCodeEntry, authoringCodesTable, bindTemplate, blankSpace, space as blankSpaceSpec, blankTemplateFiles, blockHtml, blockJsx, buildHandles, button, cancelApi, cancelServerAction, carousel, carouselGoTo, carouselNext, carouselPause, carouselPlay, carouselPrevious, carouselTrack, catalogTemplateFiles, channel, className, classNames, classRefs, clearState, closeDialog, closeModal, closest, column, compactSvg, comparePictures, compareSpaces, compareTexts, component, container, copyToClipboard, createTw, css, cssNumberValue, cssProperties, cssPropertyName, cssShorthands, custom, cycleState, darkScheme, dataIssues, declaredCallback, declaredTrigger, defaultAttributes, defaultLabel, defineAction, defineElement, delay, dialogContainer, diffPictures, digest, dropdown, dropdownPopup, element, elementAncestorTypes, elementAttributeNames, elementAttributeValues, elementCallbacks, elementCatalog, t$2 as elementDeclaration, elementDefaultAttributes, elementLeafTypes, elementPartTypes, elementSlots, elementSourceTypes, elementTriggers, elementTypeNames, elementsFromManifest, embed, emptySpaceSource, space$1 as emptySpaceSpec, expandShorthand, expandShorthandPatch, expandShorthandTraced, explain, explainKindOf, explainList, explanationText, failedFlowText, fixSpace, flagGateOf, flagSpecOf, flowStepIds, fontAwesome, form, formControl, o as getElementCallback, getGlobalCallback, getTransformer, getUtility, grid, groupBindings, hasVisibilityBinding, heading, n$1 as hiddenParams, hiddenWhen, hostAction, image, importProbe, importSlug, importedFiles, inferredLinkMode, inspectDocument, inspectPage, inspectRenders, instanceSelectorFor, s$1 as invalidParams, invalidateQueries, isClassModifier, isCssProperty, isCustomProperty, isRuleSetSpec, isStyleDeclaration, isSuggestionCode, link, lintSpace, list, listItem, loadImages, locate, locateClasses, locateElements, markdown, r$1 as missingRequiredParams, modalContainer, modifierClassName, moveState, named, navigate, nodeHtml, notificationsCss, on, onClick, onFlowEnd, onFlowError, onFlowProgress, onInterval, onKey, onLoad, onPageLoad, onPointerDown, onScreen, onScroll, onSubmit, openDialog, openModal, openPage, pageFamily, pageRegions, pageTexts, pagination, paragraph, pathForSlug, planFixes, pressShortcut, profilePictures, publishOn, readDevTools, readDevToolsInPage, c as reconcileParams, reference, refusalOf, reloadApi, removeState, resetForm, resolveSource, richText, row, runServerAction, sameBlocks, scope, scrollBy, scrollIntoView, scrollTo, selectorFor, setFieldValue, setState, shortcutKey, shorthandLonghands, singlePageSpace, slugify, source, e as spaceCallbacks, specFromSpace, specToSource, splitClassList, d as splitNotificationsCss, stepState, styles, suggestClassOverrides, suggestCssProperty, suggestSpace, suggestTransformer, summariseRenders, svg, tabContainer, tabContainerBody, tabContainerHeader, tabContainerItem, text, themeToggle, toBindingSpecs, toBlocks, i$2 as toBuilderParams, a$1 as toInteractionCallback, o$1 as toInteractionCallbacks, toPortableSource, toResponsive, toggleElement, toggleInState, toggleState, tokens, transformerCatalog, tw, twig, twigTemplate, typeCallbackDefinitions, typeTriggerDefinitions, unrollPage, unusedDeclarations, updateElement, validateSnippet, validateSpace, e$1 as valuesOf, variantFrom, video, visibleWhen, webHook, when, whenFailed, whenSucceeded, whileRunning, withElement, withNamedIds, withNotificationsCss, withPluginCatalogs, withVisibility, withoutQuieted };
package/dist/node.d.ts CHANGED
@@ -720,6 +720,11 @@ declare const AUTHORING_CODES: {
720
720
  readonly means: "a prop whose name a template cannot read as `props.x`";
721
721
  readonly fix: "letters, digits and `_`";
722
722
  };
723
+ readonly 'prop-type-unknown': {
724
+ readonly kind: "refused";
725
+ readonly means: "a prop declared with a type no editor offers and nothing checks a value against";
726
+ readonly fix: "one of text, textarea, select, boolean, number, scalar, json, elementIds — words are `text`";
727
+ };
723
728
  readonly 'prop-unknown': {
724
729
  readonly kind: "refused";
725
730
  readonly means: "a prop the component does not declare, handed in or read";
@@ -1083,6 +1088,8 @@ declare type BindingTransformer = {
1083
1088
  enabled?: boolean;
1084
1089
  };
1085
1090
 
1091
+ declare const BUILTIN_PARAM_TYPES: readonly ["text", "textarea", "select", "boolean", "number", "scalar", "json", "elementIds"];
1092
+
1086
1093
  declare interface BuiltinParam {
1087
1094
  type: BuiltinParamType;
1088
1095
  description: string;
@@ -1105,7 +1112,7 @@ declare interface BuiltinParam {
1105
1112
  elementType?: string;
1106
1113
  }
1107
1114
 
1108
- declare type BuiltinParamType = 'text' | 'textarea' | 'select' | 'boolean' | 'number' | 'scalar' | 'json' | 'elementIds';
1115
+ declare type BuiltinParamType = (typeof BUILTIN_PARAM_TYPES)[number];
1109
1116
 
1110
1117
  /**
1111
1118
  * One kind of channel a space offers, declared under a topic PATTERN — `board:{id}` is every board, each its own topic.
@@ -1711,6 +1718,9 @@ declare interface LayoutSpec {
1711
1718
  body: ElementSpec[];
1712
1719
  }
1713
1720
 
1721
+ /** Where in the project's own files an error points first, and what it says: a module that did not load, located. */
1722
+ export declare const moduleProblem: (error: unknown, root: string) => string;
1723
+
1714
1724
  /**
1715
1725
  * An element's declared motion — how it arrives, when, and whether it keeps moving — which the SDK's own stylesheet
1716
1726
  * plays (`_motion.scss`). Every preset moves only `opacity` and `transform`, which the compositor animates without
@@ -1969,6 +1979,15 @@ export declare const projectAuthoringAt: (root: string) => Promise<ProjectAuthor
1969
1979
  */
1970
1980
  export declare const projectData: (folder: string | URL) => ((query: string) => unknown);
1971
1981
 
1982
+ /**
1983
+ * A module of the project that did not load — a file that does not parse, an import of nothing, a module that throws
1984
+ * as it runs — said at the first of the project's own files it points at: `src/space/hero.ts:139: Expected ','…`. The
1985
+ * server, `npm run author` and the CLI each say it in those words, never as a stack.
1986
+ */
1987
+ export declare class ProjectModuleError extends Error {
1988
+ constructor(message: string);
1989
+ }
1990
+
1972
1991
  /**
1973
1992
  * The space of the project this process runs — `src/space/index.ts`'s `space` — with what it is checked against, once
1974
1993
  * the project's root and layout are (`projectAuthoring`). Imported only then, so a factory that refuses what it is
@@ -2236,6 +2255,10 @@ declare type SchemaValidationError = {
2236
2255
  elementId?: string;
2237
2256
  /** The component whose tree the error is in; absent for the pages' tree. */
2238
2257
  componentId?: string;
2258
+ /** The name an element points at that no element answers to — what a suggestion of the nearest one is made from. */
2259
+ missing?: string;
2260
+ /** The step the missing element was to answer (`openModal`): a suggestion is drawn from the elements that do. */
2261
+ wantedBy?: string;
2239
2262
  details?: unknown;
2240
2263
  };
2241
2264
 
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Vr as e, d as compactSvg, n as authorSpace, un as e$1 } from "./index-src.js";
1
+ import { Gr as e, n as authorSpace, p as compactSvg, pn as e$1 } from "./index-src.js";
2
2
  import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
3
3
  import m from "node:path";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -230,7 +230,7 @@ var z = (e, t) => {
230
230
  action: "move",
231
231
  from: `${n}/${c}`,
232
232
  to: `${n}/${c$1}`
233
- })] : [y("plugin-declaration-missing", `${n}/`, `${n}/ has no ${c$1}: ${s}.`, `Write ${n}/${c$1} — export default { type: '${o}', … } — as npx plitzi add plugin writes one beside the component it makes.`)];
233
+ })] : [y("plugin-declaration-missing", `${n}/`, `${n}/ has no ${c$1}: ${s}.`, `Write ${n}/${c$1} — export default { type: '${o}', … } — as npx plitzi plugin add writes one beside the component it makes.`)];
234
234
  };
235
235
  var B = (e, t) => {
236
236
  if (!x.test(t)) return [te(t)];
@@ -241,14 +241,14 @@ var B = (e, t) => {
241
241
  accepted: s$1,
242
242
  code: "plugin-entry-missing",
243
243
  lost: `the server cannot build the plugin ${r}`,
244
- 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 ${o$1}/ is a plugin: code several plugins share goes outside it (src/shared/).`
244
+ 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 ${o$1}/ is a plugin: code several plugins share goes outside it (src/shared/).`
245
245
  }),
246
246
  ...R(e, {
247
247
  folder: `${n}/${l$1}`,
248
248
  accepted: ["index.ts"],
249
249
  code: "plugin-functions-entry-missing",
250
250
  lost: `none of the plugin's server half runs (its routes under /fn/plugins/${r}/)`,
251
- write: `Write ${n}/${l$1}/index.ts exporting defineFunctions({ … }) by default — as npx plitzi add plugin --server writes it.`
251
+ write: `Write ${n}/${l$1}/index.ts exporting defineFunctions({ … }) by default — as npx plitzi plugin add --server writes it.`
252
252
  }),
253
253
  ...z(e, t)
254
254
  ];
@@ -264,7 +264,7 @@ var H = (t) => e(t.assets) ? Object.values(t.assets).flatMap((t) => e(t) && type
264
264
  isMain: t.isMain === !0
265
265
  }] : []) : [];
266
266
  var U = (t, n) => {
267
- let r = `${u}/${n}`, i = `${r}/${d}`, a = `npx plitzi pull brings it again — or delete ${r}/, and the space renders no ${n}.`;
267
+ let r = `${u}/${n}`, i = `${r}/${d}`, a = `npx plitzi space pull brings it again — or delete ${r}/, and the space renders no ${n}.`;
268
268
  if (!C(t, i, "file")) return { problem: y("vendor-manifest-missing", `${r}/`, `${r}/ has no ${d}: the server runs a built plugin by what its manifest names, so ${n} does not run.`, a) };
269
269
  let o;
270
270
  try {
@@ -287,7 +287,7 @@ var U = (t, n) => {
287
287
  var W = (e) => {
288
288
  let { files: t, folders: n } = S(m.join(e, o$1)), r = t.filter((e) => !b.has(e) && e !== "declarations.ts").map((e) => {
289
289
  let { name: t } = m.parse(e), n = t !== "index" && N(t) || "<Name>";
290
- return y("plugin-file-loose", `${o$1}/${e}`, `${o$1}/${e} is a file, and every plugin is a folder of ${o$1}/: the server reads nothing of it.`, `Give it a folder with an index.ts that exports it by default — ${o$1}/${n}/${e} and ${o$1}/${n}/index.ts, as npx plitzi add plugin writes them — or move it out of ${o$1}/.`);
290
+ return y("plugin-file-loose", `${o$1}/${e}`, `${o$1}/${e} is a file, and every plugin is a folder of ${o$1}/: the server reads nothing of it.`, `Give it a folder with an index.ts that exports it by default — ${o$1}/${n}/${e} and ${o$1}/${n}/index.ts, as npx plitzi plugin add writes them — or move it out of ${o$1}/.`);
291
291
  }), a = S(m.join(e, u)).folders, o = new Set(n.filter((e) => x.test(e)).map(M)), s = a.filter((e) => o.has(e)).map((e) => y("plugin-shadowed", `${u}/${e}/`, `${e} is both ${u}/${e}/, as it was built, and a folder of ${o$1}/: the server runs the built one, and a change to the source shows nowhere.`, `Delete ${u}/${e}/: the source is the plugin now.`)), c = a.flatMap((t) => {
292
292
  let n = U(e, t);
293
293
  return "problem" in n ? [n.problem] : [];
@@ -387,7 +387,7 @@ var ae = (e) => {
387
387
  ...c
388
388
  ];
389
389
  };
390
- var oe = (e) => w(e, m$1).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 ${m$1}/.`));
390
+ var oe = (e) => w(e, m$1).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 ${m$1}/.`));
391
391
  var 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;
392
392
  var ce = (e, t) => {
393
393
  let r = w(e, p, /* @__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 ${p}/ 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 ${p}/: settings go in the root's .env${t === "server" ? `, data only the server reads in ${m$1}/` : ""}.`)), a = `${p}/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 ${m$1}/ — 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.`)] : [];
@@ -420,7 +420,7 @@ var Q = (e, t = {}) => {
420
420
  accepted: ["index.ts"],
421
421
  code: "runtime-entry-missing",
422
422
  lost: "the space’s runtime does not run",
423
- write: `Write ${g}/index.ts exporting defineRuntime(…) by default — npx plitzi add runtime writes one.`
423
+ write: `Write ${g}/index.ts exporting defineRuntime(…) by default — npx plitzi runtime add writes one.`
424
424
  }),
425
425
  ...n.space === "local" ? re(e, i) : [],
426
426
  ...i,
@@ -551,7 +551,7 @@ var pluginDeclarations = async (folder) => {
551
551
  const root = pathOf(folder);
552
552
  const files = existsSync(root) ? readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => m.join(root, entry.name, c$1)).filter((file) => existsSync(file)).sort() : [];
553
553
  return Promise.all(files.map(async (file) => {
554
- const loaded = await import(pathToFileURL(file).href);
554
+ const loaded = await importProjectModule(file, root);
555
555
  const declaration = typeof loaded === "object" && loaded !== null && "default" in loaded ? loaded.default : void 0;
556
556
  if (typeof declaration !== "object" || declaration === null || !("type" in declaration) || typeof declaration.type !== "string") throw new Error(`${file} exports no declaration by default: \`export default { type: '…', … }\`.`);
557
557
  return declaration;
@@ -619,6 +619,37 @@ var ProjectSpaceError = class extends Error {
619
619
  };
620
620
  Object.defineProperty(ProjectSpaceError, "name", { value: "ProjectSpaceError" });
621
621
  /**
622
+ * A module of the project that did not load — a file that does not parse, an import of nothing, a module that throws
623
+ * as it runs — said at the first of the project's own files it points at: `src/space/hero.ts:139: Expected ','…`. The
624
+ * server, `npm run author` and the CLI each say it in those words, never as a stack.
625
+ */
626
+ var ProjectModuleError = class extends Error {
627
+ constructor(message) {
628
+ super(message);
629
+ this.name = "ProjectModuleError";
630
+ }
631
+ };
632
+ Object.defineProperty(ProjectModuleError, "name", { value: "ProjectModuleError" });
633
+ /** Where in the project's own files an error points first, and what it says: a module that did not load, located. */
634
+ var moduleProblem = (error, root) => {
635
+ const message = error instanceof Error ? error.message.split("\n")[0] : String(error);
636
+ const frame = (error instanceof Error ? error.stack ?? "" : "").split("\n").map((line) => /(?:file:\/\/)?(\/[^\s:()]+\.(?:tsx?|m?js|json)):(\d+)/.exec(line)).find((match) => match !== null && match[1].startsWith(root) && !match[1].includes("/node_modules/"));
637
+ const at = frame ? `${m.relative(process.cwd(), frame[1])}:${frame[2]}` : void 0;
638
+ return at ? `${at}: ${message}` : message;
639
+ };
640
+ /**
641
+ * A project's module imported: a refusal of authoring's thrown as the module ran (a factory given what it refuses) is
642
+ * said as it is; anything else is the module not loading, located (`ProjectModuleError`).
643
+ */
644
+ var importProjectModule = async (file, root) => {
645
+ try {
646
+ return await import(pathToFileURL(file).href);
647
+ } catch (error) {
648
+ if (error instanceof Error && (error.name === "AuthoringError" || error.name === "SpaceRefusedError")) throw error;
649
+ throw new ProjectModuleError(moduleProblem(error, root));
650
+ }
651
+ };
652
+ /**
622
653
  * What the module exports as `space`, taken as a declaration when it has the shape of one. `authorSpace` checks the
623
654
  * rest of it, field by field, and says what is wrong — so this only has to tell a space from anything else.
624
655
  */
@@ -629,7 +660,7 @@ var isSpaceSpec = (value) => e(value) && typeof value.name === "string" && typeo
629
660
  */
630
661
  var projectSpaceAt = async (root) => {
631
662
  const authoring = await projectAuthoringAt(root);
632
- const module = await import(pathToFileURL(l(root, a$1, process.argv[1])).href);
663
+ const module = await importProjectModule(l(root, a$1, process.argv[1]), root);
633
664
  const space = e(module) ? module.space : void 0;
634
665
  if (!isSpaceSpec(space)) throw new ProjectSpaceError(a$1);
635
666
  return {
@@ -653,4 +684,4 @@ var authorProjectSpace = async () => {
653
684
  return authorSpace(space, authoring);
654
685
  };
655
686
  //#endregion
656
- export { ProjectSpaceError, authorProjectSpace, compactSvg, pluginDeclarations, projectAuthoring, projectAuthoringAt, projectData, projectSpace, projectSpaceAt, publicData, svgFile, svgFiles };
687
+ export { ProjectModuleError, ProjectSpaceError, authorProjectSpace, compactSvg, moduleProblem, pluginDeclarations, projectAuthoring, projectAuthoringAt, projectData, projectSpace, projectSpaceAt, publicData, svgFile, svgFiles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.38.7",
3
+ "version": "0.38.8",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -54,11 +54,11 @@
54
54
  "devDependencies": {
55
55
  "@microsoft/api-extractor": "^7.59.3",
56
56
  "@plitzi/plitzi-ui": "^1.6.32",
57
- "@plitzi/sdk-elements": "0.38.7",
58
- "@plitzi/sdk-interactions": "0.38.7",
59
- "@plitzi/sdk-schema": "0.38.7",
60
- "@plitzi/sdk-shared": "0.38.7",
61
- "@plitzi/sdk-style": "0.38.7",
57
+ "@plitzi/sdk-elements": "0.38.8",
58
+ "@plitzi/sdk-interactions": "0.38.8",
59
+ "@plitzi/sdk-schema": "0.38.8",
60
+ "@plitzi/sdk-shared": "0.38.8",
61
+ "@plitzi/sdk-style": "0.38.8",
62
62
  "@types/react": "^19.3.0",
63
63
  "eslint": "^9.39.5",
64
64
  "prettier": "^3.9.9",