@starci/eslint-canon-fe 9.9.8 → 9.9.9

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.9.9
4
+
5
+ - Changed: Preserve mounted RootPage children through selected native body layouts only when their metadata constraints, immutable props and required context are proven. Retain exact body and import identity, and refresh the generated canon pins.
6
+
3
7
  ## 9.9.8
4
8
 
5
9
  - Changed: Enforce the documented one-level connected RootPage children composition with mounted selected-export and actual sibling-Base proof shared with R325. Keep ordinary block/atom restrictions and inspect shape records for rendered trees.
@@ -1,6 +1,6 @@
1
1
  import { grammarContractFor } from "#runtime/scripts/lib/grammar-lint.mjs";
2
2
  import { canonicalStatusOwnerBinding } from "#runtime/scripts/hfs/architecture/canon-jsx-clones.mjs";
3
- import { attribute, attributeValue, walk } from "./ast.js";
3
+ import { attribute, attributeValue, stringOf, walk } from "./ast.js";
4
4
  import { isFn, unwrap, variableOf } from "./bindings.js";
5
5
  import { hfsOf } from "./hfs.js";
6
6
  import { importedHeader, jsxImport } from "./owner-source.js";
@@ -28,18 +28,52 @@ const references = (content, node) => {
28
28
  });
29
29
  return count;
30
30
  };
31
- const bodyContainer = (owner, opening) => {
31
+ const bodyContainer = (owner, opening, contexts) => {
32
32
  const family = hfsOf(owner.context).grammar;
33
33
  if (!family)
34
- return false;
34
+ return null;
35
35
  const roles = grammarContractFor(family).semanticRoles;
36
36
  const page = record(roles) ? roles.page : null;
37
37
  if (!record(page) || !Array.isArray(page.bodyContainers) || !Array.isArray(page.entries))
38
- return false;
38
+ return null;
39
39
  const imported = jsxImport(owner.context, opening);
40
- return (imported !== null &&
41
- page.bodyContainers.includes(imported.exported) &&
42
- page.entries.some((entry) => typeof entry === "string" && entry.replace("<family>", family) === imported.source));
40
+ if (!imported || !page.bodyContainers.includes(imported.exported) || !page.entries.some((entry) => typeof entry === "string" && entry.replace("<family>", family) === imported.source))
41
+ return null;
42
+ if (page.bodyContainerConstraints !== undefined && !record(page.bodyContainerConstraints))
43
+ return null;
44
+ const constraint = record(page.bodyContainerConstraints) ? page.bodyContainerConstraints[imported.exported] : undefined;
45
+ if (constraint === undefined)
46
+ return contexts;
47
+ if (!record(constraint) || Object.keys(constraint).some((key) => !["requiresContext", "providesContext", "absentProps", "literalProps"].includes(key)))
48
+ return null;
49
+ if (constraint.requiresContext !== undefined && (typeof constraint.requiresContext !== "string" || !contexts.has(constraint.requiresContext)))
50
+ return null;
51
+ if (constraint.absentProps !== undefined) {
52
+ const absent = constraint.absentProps;
53
+ if (!Array.isArray(absent) || !absent.every((name) => typeof name === "string"))
54
+ return null;
55
+ if (opening.attributes.some((item) => item.type === "JSXAttribute" && item.name.type === "JSXIdentifier" && absent.includes(item.name.name)))
56
+ return null;
57
+ }
58
+ if (constraint.literalProps !== undefined) {
59
+ if (!record(constraint.literalProps))
60
+ return null;
61
+ for (const [name, choices] of Object.entries(constraint.literalProps)) {
62
+ if (!Array.isArray(choices) || !choices.every((choice) => typeof choice === "string"))
63
+ return null;
64
+ for (const item of opening.attributes) {
65
+ if (item.type !== "JSXAttribute" || item.name.type !== "JSXIdentifier" || item.name.name !== name)
66
+ continue;
67
+ const value = attributeValue(item);
68
+ const literal = value && stringOf(unwrap(value));
69
+ if (literal === null || !choices.includes(literal))
70
+ return null;
71
+ }
72
+ }
73
+ }
74
+ if (constraint.providesContext === undefined)
75
+ return contexts;
76
+ return typeof constraint.providesContext === "string" ? new Set(contexts).add(constraint.providesContext) : null;
43
77
  };
44
78
  /** The exactly returned fragment/expression, with no unused or duplicated call hidden beside it. */
45
79
  const returnedCall = (node) => {
@@ -155,13 +189,13 @@ const helperOwner = (content, opening, readers) => {
155
189
  : null;
156
190
  };
157
191
  /** A finite path must consume the content exactly once; unknown JSX/calls/branches fail closed. */
158
- const rendered = (content, node, readers, seen) => {
192
+ const rendered = (content, node, readers, seen, contexts) => {
159
193
  if (parameterMember(content, node))
160
194
  return true;
161
195
  if (node.type === "JSXExpressionContainer")
162
- return rendered(content, node.expression, readers, seen);
196
+ return rendered(content, node.expression, readers, seen, contexts);
163
197
  if (node.type === "JSXFragment")
164
- return renderedChildren(content, node.children, readers, seen);
198
+ return renderedChildren(content, node.children, readers, seen, contexts);
165
199
  if (node.type !== "JSXElement" || node.openingElement.attributes.some((item) => item.type === "JSXSpreadAttribute"))
166
200
  return false;
167
201
  const imported = jsxImport(content.owner.context, node.openingElement);
@@ -175,10 +209,11 @@ const rendered = (content, node, readers, seen) => {
175
209
  const values = readers.returned({ ...content.owner, value: callback });
176
210
  return values !== null && values.length > 0 && values.every((value) => parameterMember(content, value));
177
211
  }
178
- if (bodyContainer(content.owner, node.openingElement)) {
212
+ const containerContexts = bodyContainer(content.owner, node.openingElement, contexts);
213
+ if (containerContexts !== null) {
179
214
  if (node.openingElement.attributes.some((item) => references(content, item) > 0))
180
215
  return false;
181
- return renderedChildren(content, node.children, readers, seen);
216
+ return renderedChildren(content, node.children, readers, seen, containerContexts);
182
217
  }
183
218
  const helper = helperOwner(content, node.openingElement, readers);
184
219
  if (!helper || seen.has(helper.value))
@@ -194,11 +229,11 @@ const rendered = (content, node, readers, seen) => {
194
229
  return (references(target, helper.value) === 1 &&
195
230
  values !== null &&
196
231
  values.length > 0 &&
197
- values.every((value) => rendered(target, value, readers, new Set(seen).add(helper.value))));
232
+ values.every((value) => rendered(target, value, readers, new Set(seen).add(helper.value), contexts)));
198
233
  };
199
- const renderedChildren = (content, children, readers, seen) => {
234
+ const renderedChildren = (content, children, readers, seen, contexts = new Set()) => {
200
235
  const carrying = children.filter((child) => references(content, child) > 0);
201
- return carrying.length === 1 && carrying[0] !== undefined && rendered(content, carrying[0], readers, seen);
236
+ return carrying.length === 1 && carrying[0] !== undefined && rendered(content, carrying[0], readers, seen, contexts);
202
237
  };
203
238
  /** Only Page's body carries owner content; a header/unknown attribute/dead callback cannot stand in for it. */
204
239
  export const preservesPageBody = (owner, page, readers) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-canon-fe",
3
- "version": "9.9.8",
3
+ "version": "9.9.9",
4
4
  "description": "Universal front-end lint laws for TypeScript and Next.js, independent of the selected Grammar family.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -69,7 +69,17 @@ families:
69
69
  entry: '@starci/grammar/common'
70
70
  styleEntry: '@starci/grammar/common.css'
71
71
  semanticRoles:
72
- page: { export: Page, entries: ['@starci/grammar/common', '@starci/grammar/<family>'], segment: { attribute: header, member: tabs }, bodyContainers: [PaneGrid, Pane] }
72
+ page:
73
+ export: Page
74
+ entries: ['@starci/grammar/common', '@starci/grammar/<family>']
75
+ segment: { attribute: header, member: tabs }
76
+ bodyContainers: [PaneGrid, Pane, Stack, PaneSection, Section]
77
+ # Native body transparency follows the renderer's exact context, status and intrinsic-element API.
78
+ bodyContainerConstraints:
79
+ Pane: { providesContext: pane }
80
+ Stack: { literalProps: { as: [div, header, footer] } }
81
+ PaneSection: { requiresContext: pane, absentProps: [error], literalProps: { as: [div, header, footer] } }
82
+ Section: { absentProps: [error], literalProps: { kind: [region] } }
73
83
  peers: [react, '@heroui/react', '@xyflow/react', react-aria-components]
74
84
  packageSnapshot: common/DNA.yaml
75
85
  scope: |
@@ -31,35 +31,35 @@ pins:
31
31
  source: packages/event-stream/package.json
32
32
  why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
33
33
  '@starci/grammar':
34
- version: 0.21.8
34
+ version: 0.21.9
35
35
  group: starci
36
36
  install: registry
37
37
  side: fe
38
38
  source: packages/grammar/package.json
39
39
  why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
40
40
  '@starci/eslint-canon-be':
41
- version: 3.11.15
41
+ version: 3.11.16
42
42
  group: starci
43
43
  install: registry
44
44
  side: be
45
45
  source: packages/eslint-canon-be/package.json
46
46
  why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
47
47
  '@starci/eslint-canon-fe':
48
- version: 9.9.8
48
+ version: 9.9.9
49
49
  group: starci
50
50
  install: registry
51
51
  side: fe
52
52
  source: packages/eslint-canon-fe/package.json
53
53
  why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
54
54
  '@starci/eslint-grammar-core':
55
- version: 0.21.8
55
+ version: 0.21.9
56
56
  group: starci
57
57
  install: registry
58
58
  side: fe
59
59
  source: packages/eslint-grammar-core/package.json
60
60
  why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
61
61
  '@starci/eslint-grammar-offset-pop':
62
- version: 0.21.8
62
+ version: 0.21.9
63
63
  group: starci
64
64
  install: registry
65
65
  side: fe
@@ -106,7 +106,7 @@ pins:
106
106
  source: packages/ai-router/package.json
107
107
  why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
108
108
  '@starci/hfs':
109
- version: 5.0.4
109
+ version: 5.0.5
110
110
  group: starci
111
111
  install: registry
112
112
  side: both