@starci/eslint-canon-fe 8.2.18 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +19 -1
- package/callback-shape.mjs +344 -0
- package/client-boundary.mjs +1 -1
- package/docs/hooks-folder.md +1 -1
- package/docs/size-and-state-budget.md +6 -6
- package/drawing.mjs +65 -28
- package/env-owner.mjs +120 -9
- package/function-budget.mjs +49 -0
- package/hooks-folder.mjs +149 -18
- package/icon.mjs +67 -0
- package/index.mjs +47 -0
- package/lib/own-hook-origin.mjs +53 -0
- package/lib/program-for.mjs +22 -0
- package/lib/pure-owner-helper.mjs +148 -0
- package/lib/redux-hook-origin.mjs +44 -0
- package/next-conventions.mjs +38 -35
- package/package.json +1 -1
- package/runtime/knowledge/hfs/canon-pins.yaml +11 -11
- package/runtime/knowledge/hfs/fe-stack.yaml +22 -1
- package/runtime/knowledge/hfs/slots.yaml +430 -92
- package/runtime/knowledge/patterns/fe/folder.yaml +4 -0
- package/runtime/knowledge/sonar-gate.yaml +1 -1
- package/runtime/modules/models/runtimes.yaml +1 -1
- package/runtime/packages/hfs/templates/app/package-scripts/package.json +1 -0
- package/runtime/scripts/api/git/cat-file.mjs +5 -0
- package/runtime/scripts/api/git/diff.mjs +5 -0
- package/runtime/scripts/api/git/lib.mjs +3 -0
- package/runtime/scripts/api/git/merge-base.mjs +9 -0
- package/runtime/scripts/api/git/recorded-lines.mjs +54 -8
- package/runtime/scripts/hfs/architecture/backend-app-files.mjs +103 -0
- package/runtime/scripts/hfs/architecture/backend.mjs +22 -10
- package/runtime/scripts/hfs/architecture/background-unowned.mjs +157 -41
- package/runtime/scripts/hfs/architecture/canon-clones.mjs +240 -0
- package/runtime/scripts/hfs/architecture/canon-jsx-clones.mjs +143 -0
- package/runtime/scripts/hfs/architecture/client-reaches-server.mjs +6 -3
- package/runtime/scripts/hfs/architecture/clones.mjs +17 -8
- package/runtime/scripts/hfs/architecture/connection-map.mjs +14 -12
- package/runtime/scripts/hfs/architecture/context-map.mjs +25 -14
- package/runtime/scripts/hfs/architecture/context-owner.mjs +1 -2
- package/runtime/scripts/hfs/architecture/dead-exports-bindings.mjs +149 -0
- package/runtime/scripts/hfs/architecture/dead-exports.mjs +23 -50
- package/runtime/scripts/hfs/architecture/default-deny.mjs +8 -6
- package/runtime/scripts/hfs/architecture/frontend-block-render.mjs +104 -0
- package/runtime/scripts/hfs/architecture/frontend-world-render.mjs +30 -11
- package/runtime/scripts/hfs/architecture/frontend-world.mjs +1 -1
- package/runtime/scripts/hfs/architecture/function-spec-providers.mjs +153 -0
- package/runtime/scripts/hfs/architecture/hfs.mjs +3 -3
- package/runtime/scripts/hfs/architecture/i18n-keys.mjs +16 -3
- package/runtime/scripts/hfs/architecture/machine-ast.mjs +17 -0
- package/runtime/scripts/hfs/architecture/module-per-transport.mjs +49 -25
- package/runtime/scripts/hfs/architecture/next-data-inference.mjs +176 -0
- package/runtime/scripts/hfs/architecture/next-data-symbols.mjs +26 -0
- package/runtime/scripts/hfs/architecture/next-data.mjs +31 -23
- package/runtime/scripts/hfs/architecture/reachability.mjs +14 -0
- package/runtime/scripts/hfs/architecture/register-once.mjs +15 -7
- package/runtime/scripts/hfs/architecture/required-files.mjs +2 -1
- package/runtime/scripts/hfs/architecture/source-names.mjs +48 -3
- package/runtime/scripts/hfs/architecture/staged-consumers.mjs +37 -0
- package/runtime/scripts/hfs/architecture/supabase-ast.mjs +214 -17
- package/runtime/scripts/hfs/architecture/supabase-be.mjs +1 -6
- package/runtime/scripts/hfs/architecture/supabase.mjs +59 -21
- package/runtime/scripts/hfs/architecture/surface.mjs +2 -1
- package/runtime/scripts/hfs/architecture/tiers.mjs +11 -4
- package/runtime/scripts/hfs/architecture/typescript.mjs +1 -8
- package/runtime/scripts/hfs/architecture/unit-spec-providers.mjs +9 -13
- package/runtime/scripts/hfs/declaration-shape.mjs +39 -3
- package/runtime/scripts/hfs/edition-slots.mjs +2 -2
- package/runtime/scripts/hfs/manifest-shape.mjs +91 -6
- package/runtime/scripts/hfs/path-findings.mjs +32 -2
- package/runtime/scripts/hfs/project-rule.mjs +3 -1
- package/runtime/scripts/hfs/rule-catalog.mjs +156 -11
- package/runtime/scripts/hfs/rule-params-shape.mjs +22 -10
- package/runtime/scripts/hfs/rules/secrets.mjs +26 -0
- package/runtime/scripts/hfs/slot-imports.mjs +18 -3
- package/runtime/scripts/hfs/slot-required.mjs +13 -0
- package/runtime/scripts/hfs/slot-semantic-problems.mjs +2 -1
- package/runtime/scripts/hfs/slots.mjs +1 -0
- package/runtime/scripts/lib/env.mjs +20 -0
- package/runtime/scripts/lib/event-contract.mjs +107 -0
- package/runtime/scripts/lib/json-clone.mjs +61 -0
- package/runtime/scripts/lib/list.mjs +4 -0
- package/runtime/scripts/lib/secret-patterns.mjs +60 -5
- package/runtime/scripts/lib/stack-services.mjs +1 -1
- package/runtime/scripts/lib/ts-analysis.mjs +23 -0
- package/runtime/scripts/lib/ts-ast.mjs +27 -2
- package/served-locale.mjs +80 -9
- package/size-and-state-budget.mjs +11 -8
- package/size-growth.mjs +10 -6
- package/swr-family.mjs +197 -0
- package/translation.mjs +135 -7
- package/transport.mjs +126 -59
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The owner exports an auth callback may use besides the exchange (R287 `FE_CALLBACK_SHAPE`, owner ruling `auth-callback-pure-helpers`,
|
|
3
|
+
* 2026-10-17 "Theo y tro"): a PURE helper of the app's `modules/routes` or `modules/auth` that computes the redirect target or validates
|
|
4
|
+
* `next`, and a static route table. Both are found by TypeScript symbol resolution to the declaration, never by the spelling of the name.
|
|
5
|
+
*
|
|
6
|
+
* A pure helper is a synchronous function that returns text (or null), holds no `await` or `yield`, reaches no I/O global (network, storage,
|
|
7
|
+
* DOM, `process`, `require`, `console`) and calls only locals, language built-ins and other pure helpers of `modules/routes` or
|
|
8
|
+
* `modules/auth` (followed through barrels). `modules/config` is the environment owner: a call to its readers is a configuration read, not I/O.
|
|
9
|
+
* Anything else it imports, a library value included, makes it impure.
|
|
10
|
+
*/
|
|
11
|
+
import ts from "typescript"
|
|
12
|
+
import { reaching } from "./own-hook-origin.mjs"
|
|
13
|
+
import { programFor } from "./program-for.mjs"
|
|
14
|
+
import { resolveImport } from "./scope.mjs"
|
|
15
|
+
|
|
16
|
+
/** Globals that reach the network, storage, the page, the process or the console. */
|
|
17
|
+
const IO_GLOBALS = new Set(["fetch", "XMLHttpRequest", "WebSocket", "EventSource", "Request", "navigator", "localStorage", "sessionStorage", "indexedDB", "document", "window", "self", "globalThis", "process", "require", "console", "setTimeout", "setInterval", "queueMicrotask", "Worker", "BroadcastChannel"])
|
|
18
|
+
|
|
19
|
+
const OWNER_FILE = /\/modules\/(?:routes|auth)(?:\/|\.tsx?$)/
|
|
20
|
+
const CONFIG_FILE = /\/modules\/config(?:\/|\.tsx?$)/
|
|
21
|
+
const EXTENSIONS = ["", ".ts", ".tsx", "/index.ts", "/index.tsx"]
|
|
22
|
+
|
|
23
|
+
const normal = (file) => file.fileName.replaceAll("\\", "/")
|
|
24
|
+
|
|
25
|
+
/** The module file an import specifier names, or null when none exists on disk. */
|
|
26
|
+
const moduleFile = (context, source) => {
|
|
27
|
+
const target = resolveImport(context, source)
|
|
28
|
+
if (target === null) return null
|
|
29
|
+
return EXTENSIONS.map((extension) => `${target}${extension}`).find((candidate) => ts.sys.fileExists(candidate)) ?? null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The declaration an export of the module resolves to, after barrels and re-exports. */
|
|
33
|
+
const exportedDeclaration = (context, source, name) => {
|
|
34
|
+
const file = moduleFile(context, source)
|
|
35
|
+
if (file === null) return null
|
|
36
|
+
const program = reaching(programFor(context), context.filename, file)
|
|
37
|
+
const checker = program.getTypeChecker()
|
|
38
|
+
const sourceFile = program.getSourceFile(file)
|
|
39
|
+
const moduleSymbol = sourceFile && checker.getSymbolAtLocation(sourceFile)
|
|
40
|
+
const exported = moduleSymbol && checker.getExportsOfModule(moduleSymbol).find((symbol) => symbol.name === name)
|
|
41
|
+
if (!exported) return null
|
|
42
|
+
const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported
|
|
43
|
+
return { checker, declaration: symbol.declarations?.[0] ?? null }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Strip `as`, `satisfies` and parentheses. */
|
|
47
|
+
const bare = (node) => {
|
|
48
|
+
let current = node
|
|
49
|
+
while (current && (ts.isAsExpression(current) || ts.isSatisfiesExpression(current) || ts.isParenthesizedExpression(current))) current = current.expression
|
|
50
|
+
return current
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The function-like node of a function declaration or of a variable initialised with an arrow or function expression. */
|
|
54
|
+
const functionOf = (declaration) => {
|
|
55
|
+
if (ts.isFunctionDeclaration(declaration)) return declaration
|
|
56
|
+
const init = ts.isVariableDeclaration(declaration) ? bare(declaration.initializer) : null
|
|
57
|
+
return init && (ts.isArrowFunction(init) || ts.isFunctionExpression(init)) ? init : null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const isInside = (node, root) => node.getSourceFile() === root.getSourceFile() && node.pos >= root.pos && node.end <= root.end
|
|
61
|
+
|
|
62
|
+
/** Whether an identifier names a declaration, a property or a member rather than referring to a binding. */
|
|
63
|
+
const isNameOnly = (node) => {
|
|
64
|
+
const parent = node.parent
|
|
65
|
+
if (ts.isPropertyAccessExpression(parent)) return parent.name === node
|
|
66
|
+
if (ts.isPropertyAssignment(parent) || ts.isMethodDeclaration(parent) || ts.isPropertySignature(parent)) return parent.name === node
|
|
67
|
+
return (ts.isParameter(parent) || ts.isVariableDeclaration(parent) || ts.isFunctionDeclaration(parent) || ts.isBindingElement(parent)) && parent.name === node
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A declaration of another file: an owner helper is followed, the environment owner is a leaf, everything else is impure. */
|
|
71
|
+
const foreignPure = (env, declaration, root) => {
|
|
72
|
+
const file = normal(declaration.getSourceFile())
|
|
73
|
+
if (CONFIG_FILE.test(file)) return true
|
|
74
|
+
if (!OWNER_FILE.test(file) || declaration.getSourceFile().isDeclarationFile) return false
|
|
75
|
+
return declarationPure(env, declaration, root)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** A global of the language or of the lib files is pure unless it reaches I/O. */
|
|
79
|
+
const globalPure = (symbol) => !IO_GLOBALS.has(symbol.getName())
|
|
80
|
+
|
|
81
|
+
/** Whether one identifier reference stays inside the pure surface. */
|
|
82
|
+
const referencePure = (env, node, root) => {
|
|
83
|
+
const symbol = env.checker.getSymbolAtLocation(node)
|
|
84
|
+
if (!symbol) return node.text === "undefined"
|
|
85
|
+
const target = symbol.flags & ts.SymbolFlags.Alias ? env.checker.getAliasedSymbol(symbol) : symbol
|
|
86
|
+
const declarations = target.declarations ?? []
|
|
87
|
+
if (declarations.length === 0) return node.text === "undefined"
|
|
88
|
+
return declarations.every((declaration) => {
|
|
89
|
+
const file = declaration.getSourceFile()
|
|
90
|
+
if (isInside(declaration, root)) return true
|
|
91
|
+
if (!ts.isExternalModule(file)) return globalPure(target)
|
|
92
|
+
return foreignPure(env, declaration, root)
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Walk a node: no await or yield, no impure reference; type positions are not behaviour. */
|
|
97
|
+
const nodePure = (env, node, root) => {
|
|
98
|
+
if (ts.isAwaitExpression(node) || ts.isYieldExpression(node)) return false
|
|
99
|
+
if (ts.isTypeNode(node) && !ts.isExpressionWithTypeArguments(node)) return true
|
|
100
|
+
if (ts.isIdentifier(node) && !isNameOnly(node) && !referencePure(env, node, root)) return false
|
|
101
|
+
return ts.forEachChild(node, (child) => (nodePure(env, child, root) ? undefined : true)) !== true
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** A declaration is pure when its function (or its constant initialiser) is. */
|
|
105
|
+
function declarationPure(env, declaration, root) {
|
|
106
|
+
if (env.seen.has(declaration)) return true
|
|
107
|
+
env.seen.add(declaration)
|
|
108
|
+
const fn = functionOf(declaration)
|
|
109
|
+
if (fn) return !fn.asteriskToken && !fn.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword) && (fn.body ? nodePure(env, fn.body, fn) : false)
|
|
110
|
+
if (ts.isVariableDeclaration(declaration) && declaration.initializer) return nodePure(env, declaration.initializer, declaration.initializer)
|
|
111
|
+
return false
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Whether a function's declared or inferred return type is text, null or undefined. */
|
|
115
|
+
const returnsText = (checker, declaration) => {
|
|
116
|
+
const signature = checker.getSignaturesOfType(checker.getTypeAtLocation(declaration), ts.SignatureKind.Call)[0]
|
|
117
|
+
if (!signature) return false
|
|
118
|
+
const type = checker.getReturnTypeOfSignature(signature)
|
|
119
|
+
const parts = type.isUnion() ? type.types : [type]
|
|
120
|
+
return parts.every((part) => part.flags & (ts.TypeFlags.StringLike | ts.TypeFlags.Null | ts.TypeFlags.Undefined))
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** A static table: a constant object whose leaves are string literals or plain templates. */
|
|
124
|
+
const isStaticTable = (node) => {
|
|
125
|
+
const value = bare(node)
|
|
126
|
+
if (!value) return false
|
|
127
|
+
if (ts.isStringLiteralLike(value)) return true
|
|
128
|
+
if (ts.isObjectLiteralExpression(value)) return value.properties.every((property) => ts.isPropertyAssignment(property) && isStaticTable(property.initializer))
|
|
129
|
+
return false
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* What an import of the callback's owner modules is: `"pure"` (a pure text-returning helper), `"routes"` (a static route table) or null.
|
|
134
|
+
*
|
|
135
|
+
* @param {object} context - The ESLint rule context.
|
|
136
|
+
* @param {string} source - The import specifier.
|
|
137
|
+
* @param {string} name - The imported name.
|
|
138
|
+
* @returns {"pure" | "routes" | null} The kind.
|
|
139
|
+
*/
|
|
140
|
+
export function ownerExportKind(context, source, name) {
|
|
141
|
+
const found = exportedDeclaration(context, source, name)
|
|
142
|
+
if (!found?.declaration) return null
|
|
143
|
+
const { checker, declaration } = found
|
|
144
|
+
if (ts.isVariableDeclaration(declaration) && !functionOf(declaration)) return declaration.parent.flags & ts.NodeFlags.Const && isStaticTable(declaration.initializer) ? "routes" : null
|
|
145
|
+
const fn = functionOf(declaration)
|
|
146
|
+
const env = { checker, seen: new Set() }
|
|
147
|
+
return fn && returnsText(checker, fn) && declarationPure(env, declaration, fn) ? "pure" : null
|
|
148
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Resolve typed Redux hook factories by their import provenance, never by a local use* name. */
|
|
2
|
+
import ts from "typescript"
|
|
3
|
+
import { programFor } from "./program-for.mjs"
|
|
4
|
+
|
|
5
|
+
const REDUX_HOOKS = new Set(["useSelector", "useDispatch", "useStore"])
|
|
6
|
+
|
|
7
|
+
function reduxImport(declaration) {
|
|
8
|
+
if (!ts.isImportSpecifier(declaration) || declaration.isTypeOnly) return false
|
|
9
|
+
const clause = declaration.parent.parent
|
|
10
|
+
return !clause.isTypeOnly && clause.parent.moduleSpecifier.text === "react-redux"
|
|
11
|
+
&& REDUX_HOOKS.has((declaration.propertyName ?? declaration.name).text)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function typedFactory(checker, declaration) {
|
|
15
|
+
if (!ts.isVariableDeclaration(declaration) || !(declaration.parent.flags & ts.NodeFlags.Const)) return false
|
|
16
|
+
const call = declaration.initializer
|
|
17
|
+
if (!call || !ts.isCallExpression(call) || call.arguments.length !== 0) return false
|
|
18
|
+
const member = call.expression
|
|
19
|
+
return ts.isPropertyAccessExpression(member) && member.name.text === "withTypes"
|
|
20
|
+
&& reduxBinding(checker, member.expression)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function reduxBinding(checker, node) {
|
|
24
|
+
const symbol = checker.getSymbolAtLocation(node)
|
|
25
|
+
return (symbol?.declarations ?? []).some(reduxImport)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A relative/barrel import must resolve to a const initialized by a real Redux hook's withTypes(). */
|
|
29
|
+
export function importedReduxHook(context, definition) {
|
|
30
|
+
const specifier = definition.node
|
|
31
|
+
if (specifier.type !== "ImportSpecifier" || definition.parent.importKind === "type" || specifier.importKind === "type") return false
|
|
32
|
+
const source = String(definition.parent.source.value)
|
|
33
|
+
const name = specifier.imported.name ?? specifier.imported.value
|
|
34
|
+
if (source === "react-redux") return REDUX_HOOKS.has(name)
|
|
35
|
+
const program = programFor(context)
|
|
36
|
+
const target = ts.resolveModuleName(source, context.filename, program.getCompilerOptions(), ts.sys).resolvedModule
|
|
37
|
+
const file = target && program.getSourceFile(target.resolvedFileName)
|
|
38
|
+
const checker = program.getTypeChecker()
|
|
39
|
+
const moduleSymbol = file && checker.getSymbolAtLocation(file)
|
|
40
|
+
const exported = moduleSymbol && checker.getExportsOfModule(moduleSymbol).find(symbol => symbol.name === name)
|
|
41
|
+
if (!exported) return false
|
|
42
|
+
const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported
|
|
43
|
+
return (symbol.declarations ?? []).some(declaration => typedFactory(checker, declaration))
|
|
44
|
+
}
|
package/next-conventions.mjs
CHANGED
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { attribute, attributeValue, calleeName, leadingTextOf, stringOf } from "./lib/ast.mjs"
|
|
15
|
+
import { variableOf } from "./lib/bindings.mjs"
|
|
15
16
|
import { forbiddingConcern } from "./lib/fe-stack.mjs"
|
|
16
17
|
import { hfsOf } from "./lib/hfs.mjs"
|
|
17
|
-
import { baseName, classOf, fileOf, inSlot, roleOfFile, slotOfFile
|
|
18
|
+
import { baseName, classOf, fileOf, inSlot, roleOfFile, slotOfFile } from "./lib/scope.mjs"
|
|
18
19
|
|
|
19
20
|
/** Another i18n stack: a second place that decides which language a reader sees (one the fe-stack catalog forbids by name is fe-stack-import's finding). */
|
|
20
|
-
const OTHER_I18N = /^(?:react-i18next|i18next|next-i18next|react-intl|next-translate
|
|
21
|
+
const OTHER_I18N = /^(?:react-i18next|i18next|next-i18next|react-intl|next-translate|typesafe-i18n|rosetta)(?:\/.*)?$|^@lingui\/.+$/
|
|
21
22
|
|
|
22
23
|
// -- FE-NEXT-1 -------------------------------------------------------------------------------------
|
|
23
24
|
|
|
@@ -137,21 +138,23 @@ export const htmlLangFromLocale = {
|
|
|
137
138
|
|
|
138
139
|
// -- FE-NEXT-5 -------------------------------------------------------------------------------------
|
|
139
140
|
|
|
140
|
-
/** The names
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
/** The names one named-export statement introduces. */
|
|
142
|
+
const statementExportNames = (statement) => {
|
|
143
|
+
if (statement.type !== "ExportNamedDeclaration") return []
|
|
144
|
+
const declaration = statement.declaration
|
|
145
|
+
const names = (statement.specifiers ?? []).map((specifier) => specifier.exported.name)
|
|
146
|
+
if (declaration?.id) names.push(declaration.id.name)
|
|
147
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
148
|
+
for (const entry of declaration.declarations) {
|
|
149
|
+
if (entry.id.type === "Identifier") names.push(entry.id.name)
|
|
149
150
|
}
|
|
150
|
-
for (const specifier of statement.specifiers ?? []) names.add(specifier.exported.name)
|
|
151
151
|
}
|
|
152
152
|
return names
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/** The names a module exports, from declarations and specifiers. */
|
|
156
|
+
const exportedNames = (program) => new Set(program.body.flatMap(statementExportNames))
|
|
157
|
+
|
|
155
158
|
/** Every page names itself: `metadata` or `generateMetadata`. */
|
|
156
159
|
export const pageExportsMetadata = {
|
|
157
160
|
meta: {
|
|
@@ -338,34 +341,34 @@ const STACK_FACTORIES = new Map([
|
|
|
338
341
|
["next-intl/middleware", new Set(["default"])],
|
|
339
342
|
])
|
|
340
343
|
|
|
341
|
-
/** The
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const variable = scope.set.get(identifier.name)
|
|
346
|
-
if (variable) return variable.defs[0] ?? null
|
|
347
|
-
scope = scope.upper
|
|
348
|
-
}
|
|
344
|
+
/** The public name selected by a named or default import. */
|
|
345
|
+
const importedName = (specifier) => {
|
|
346
|
+
if (specifier.type === "ImportSpecifier") return specifier.imported.name ?? specifier.imported.value
|
|
347
|
+
if (specifier.type === "ImportDefaultSpecifier") return "default"
|
|
349
348
|
return null
|
|
350
349
|
}
|
|
351
350
|
|
|
351
|
+
/** The known next-intl factory selected from an import. */
|
|
352
|
+
const stackFactory = (definition, exported) => {
|
|
353
|
+
const source = String(definition.parent.source.value)
|
|
354
|
+
if (!STACK_FACTORIES.get(source)?.has(exported)) return null
|
|
355
|
+
return { source, name: exported === "default" ? "createMiddleware" : exported }
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/** A factory called through a namespace import, else null. */
|
|
359
|
+
const namespaceFactory = (context, callee) => {
|
|
360
|
+
if (callee.type !== "MemberExpression" || callee.computed || callee.object.type !== "Identifier" || callee.property.type !== "Identifier") return null
|
|
361
|
+
const definition = variableOf(context, callee.object)?.defs[0] ?? null
|
|
362
|
+
if (definition?.type !== "ImportBinding" || definition.node.type !== "ImportNamespaceSpecifier") return null
|
|
363
|
+
return stackFactory(definition, callee.property.name)
|
|
364
|
+
}
|
|
365
|
+
|
|
352
366
|
/** The name a stack factory has where the call reads it: "defineRouting" (next-intl/routing), else null. */
|
|
353
367
|
const stackFactoryOf = (context, callee) => {
|
|
354
|
-
if (callee.type
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const specifier = definition.node
|
|
359
|
-
const exported = specifier.type === "ImportSpecifier" ? specifier.imported.name ?? specifier.imported.value : specifier.type === "ImportDefaultSpecifier" ? "default" : null
|
|
360
|
-
return exported !== null && STACK_FACTORIES.get(source)?.has(exported) ? { source, name: exported === "default" ? "createMiddleware" : exported } : null
|
|
361
|
-
}
|
|
362
|
-
if (callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Identifier" && callee.property.type === "Identifier") {
|
|
363
|
-
const definition = bindingOf(context, callee.object)
|
|
364
|
-
if (definition?.type !== "ImportBinding" || definition.node.type !== "ImportNamespaceSpecifier") return null
|
|
365
|
-
const source = String(definition.parent.source.value)
|
|
366
|
-
return STACK_FACTORIES.get(source)?.has(callee.property.name) ? { source, name: callee.property.name } : null
|
|
367
|
-
}
|
|
368
|
-
return null
|
|
368
|
+
if (callee.type !== "Identifier") return namespaceFactory(context, callee)
|
|
369
|
+
const definition = variableOf(context, callee)?.defs[0] ?? null
|
|
370
|
+
if (definition?.type !== "ImportBinding") return null
|
|
371
|
+
return stackFactory(definition, importedName(definition.node))
|
|
369
372
|
}
|
|
370
373
|
|
|
371
374
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-canon-fe",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "The StarCi front-end lint canon: every rule its laws publish, gathered as one flat-config plugin and attached by one factory.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,14 +29,14 @@ pins:
|
|
|
29
29
|
source: packages/grammar/package.json
|
|
30
30
|
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.'
|
|
31
31
|
'@starci/eslint-canon-be':
|
|
32
|
-
version: 3.
|
|
32
|
+
version: 3.4.0
|
|
33
33
|
group: starci
|
|
34
34
|
install: registry
|
|
35
35
|
side: be
|
|
36
36
|
source: packages/eslint/be/package.json
|
|
37
37
|
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.'
|
|
38
38
|
'@starci/eslint-canon-fe':
|
|
39
|
-
version: 8.
|
|
39
|
+
version: 8.4.0
|
|
40
40
|
group: starci
|
|
41
41
|
install: registry
|
|
42
42
|
side: fe
|
|
@@ -62,28 +62,28 @@ pins:
|
|
|
62
62
|
side: both
|
|
63
63
|
source: packages/prettier-config/package.json
|
|
64
64
|
'@starci/jest-preset':
|
|
65
|
-
version: 2.
|
|
65
|
+
version: 2.3.0
|
|
66
66
|
group: starci
|
|
67
67
|
install: registry
|
|
68
68
|
side: be
|
|
69
69
|
source: packages/jest-preset/package.json
|
|
70
70
|
why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
|
|
71
71
|
'@starci/test-world':
|
|
72
|
-
version: 1.2.
|
|
72
|
+
version: 1.2.2
|
|
73
73
|
group: starci
|
|
74
74
|
install: registry
|
|
75
75
|
side: be
|
|
76
76
|
source: packages/test-world/package.json
|
|
77
77
|
why: 'the shared e2e library of every back end (R47, R48), a devDependency of every back end: the warm stack behind toxiproxy, the network-edge fakes, the Nest boot, the typed useTestWorld handle, useSandbox for contract specs and the outage lock. Kafka is real own infra (the one digest-pinned apache/kafka KRaft image, a broker listener and proxy per slot, slot-prefixed topics, consumer groups and client ids) and Postgres is schema-per-context (a schema and a login role per context in a shared database). Each worker has its own data slot (<ns>_w<k>) with its own databases, Keycloak realm, leased Redis DB, bucket/collection/topic prefixes, fakes host, toxiproxy proxies and outage lock; a run provisions min(jest workers, workers cap, default 2) slots, and state file protocol 2 pairs exactly with @starci/jest-preset (TEST_WORLD_PAIR_MISMATCH otherwise). A modules world boots real peer apps beside its modules, world.apps.<name>.during(fn) is the outage of a peer app, w.keycloak.clientSecret(client) answers the run-generated secret of a confidential realm client, world.keycloak.events/sessions read the realm user events and live sessions, world.infra.postgresql.connection(name) takes one database connection down while the others serve, and world.resolve and scope.resolve take any Nest token. Every path a declaration names (`stack`, seeds, the realm, Dockerfiles) resolves from the app root (the directory of hfs.json); the globalSetup registers the path aliases as TypeScript resolves them. Its CLI main is exported at ./cli for starci app stack.'
|
|
78
78
|
'@starci/cli':
|
|
79
|
-
version: 1.
|
|
79
|
+
version: 1.4.0
|
|
80
80
|
group: starci
|
|
81
81
|
install: registry
|
|
82
82
|
side: both
|
|
83
83
|
source: packages/cli/package.json
|
|
84
84
|
why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
|
|
85
85
|
'@starci/hfs':
|
|
86
|
-
version: 4.
|
|
86
|
+
version: 4.4.0
|
|
87
87
|
group: starci
|
|
88
88
|
install: registry
|
|
89
89
|
side: both
|
|
@@ -180,7 +180,7 @@ pins:
|
|
|
180
180
|
side: be
|
|
181
181
|
# --- framework
|
|
182
182
|
next:
|
|
183
|
-
version: 16.
|
|
183
|
+
version: 16.4.2
|
|
184
184
|
group: framework
|
|
185
185
|
side: fe
|
|
186
186
|
react:
|
|
@@ -206,7 +206,7 @@ pins:
|
|
|
206
206
|
group: framework
|
|
207
207
|
side: be
|
|
208
208
|
'@nestjs/platform-express':
|
|
209
|
-
version: 11.2.
|
|
209
|
+
version: 11.2.7
|
|
210
210
|
group: framework
|
|
211
211
|
side: be
|
|
212
212
|
'@nestjs/testing':
|
|
@@ -316,7 +316,7 @@ pins:
|
|
|
316
316
|
side: fe
|
|
317
317
|
why: 'the codegen preset of the front-end wire types (fe-stack codegen); the latest registry version on 2026-10-13.'
|
|
318
318
|
'axios':
|
|
319
|
-
version: 1.
|
|
319
|
+
version: 1.20.0
|
|
320
320
|
group: framework
|
|
321
321
|
side: fe
|
|
322
322
|
why: 'the REST client of the front end for uploads, presigned URLs and auth endpoints (fe-stack rest); version read from the starci-academy package-lock on 2026-10-13.'
|
|
@@ -465,12 +465,12 @@ pins:
|
|
|
465
465
|
version: 13.4.5
|
|
466
466
|
group: framework
|
|
467
467
|
side: be
|
|
468
|
-
why: 'the GraphQL transport of every back end (be.transport.graphql) that the front end calls; the ecommerce-app resolution on 2026-10-13.'
|
|
468
|
+
why: 'the GraphQL transport of every back end (be.transport.graphql) that the front end calls; the ecommerce-app resolution on 2026-10-13. Stays on 13.x for alpha.18: the npm-audit advisory fixed by 14.0.3 (semver major) is a documented accepted exception, upgrade deferred to alpha.19 (owner ruling graphql-13-advisory-accepted-until-a19, 2026-10-16).'
|
|
469
469
|
'@nestjs/apollo':
|
|
470
470
|
version: 13.4.5
|
|
471
471
|
group: framework
|
|
472
472
|
side: be
|
|
473
|
-
why: 'the Apollo driver of @nestjs/graphql; the ecommerce-app resolution on 2026-10-13.'
|
|
473
|
+
why: 'the Apollo driver of @nestjs/graphql; the ecommerce-app resolution on 2026-10-13. Stays on 13.x with @nestjs/graphql (accepted advisory, major deferred to alpha.19).'
|
|
474
474
|
'@apollo/server':
|
|
475
475
|
version: 5.5.1
|
|
476
476
|
group: framework
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
schema: starci/fe-stack@1
|
|
2
2
|
purpose: >-
|
|
3
|
-
The front-end stack of every app, lite and full alike (owner ruling 2026-10-13, R212 case-2): for each common front-end concern the
|
|
3
|
+
The front-end stack of every app, lite and full alike (owner ruling 2026-10-13, R212 case-2 (owner:lite-production-swarm), with the Work boundary amended by ruling:R212/case-4): for each common front-end concern the
|
|
4
4
|
ONE canonical library, its HFS home (slot ids of knowledge/hfs/slots.yaml), the pattern id that teaches it
|
|
5
5
|
(knowledge/patterns/fe/*.yaml) and the alternatives a front end never depends on or imports. Versions live in
|
|
6
6
|
knowledge/hfs/canon-pins.yaml only. `tier: core` packages are installed by every scaffold; `opt` packages are added when a feature
|
|
@@ -219,3 +219,24 @@ concerns:
|
|
|
219
219
|
pattern: FE-LINT
|
|
220
220
|
forbids: []
|
|
221
221
|
why: the canon lint and format configuration.
|
|
222
|
+
- id: auth-supabase
|
|
223
|
+
tier: opt
|
|
224
|
+
packages: ['@supabase/supabase-js', '@supabase/ssr']
|
|
225
|
+
home: [fe.modules.auth]
|
|
226
|
+
pattern: FE-AUTH
|
|
227
|
+
forbids: []
|
|
228
|
+
why: the lite auth provider client and PKCE server cookie adapter, confined to modules/auth; data still goes through the back end.
|
|
229
|
+
- id: framework-support
|
|
230
|
+
tier: opt
|
|
231
|
+
packages: [server-only, rxjs]
|
|
232
|
+
home: [fe.source-root-pinned]
|
|
233
|
+
pattern: FE-ROUTE
|
|
234
|
+
forbids: []
|
|
235
|
+
why: the Next server boundary marker and Apollo peer support used by canonical workspaces.
|
|
236
|
+
- id: tool-support
|
|
237
|
+
tier: opt
|
|
238
|
+
packages: ['@types/node', '@types/react', '@types/react-dom', '@starci/tsconfig', '@starci/stylelint-canon', '@tailwindcss/postcss', postcss-value-parser, stylelint, eslint-plugin-react-hooks]
|
|
239
|
+
home: [fe.tool-config]
|
|
240
|
+
pattern: FE-LINT
|
|
241
|
+
forbids: []
|
|
242
|
+
why: the compiler, CSS and lint support packages of the canonical front-end configs.
|