synthesisui 0.16.193 → 0.16.195
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/anatomy-read.js
CHANGED
|
@@ -215,6 +215,13 @@ function measuredAt(node, sketch) {
|
|
|
215
215
|
out.passes = measured.passes;
|
|
216
216
|
if (measured?.repeats)
|
|
217
217
|
out.repeats = measured.repeats;
|
|
218
|
+
/**
|
|
219
|
+
* O TEXTO LITERAL. O nó desenhado já o pegava da leitura autorada; um nó de FRONTEIRA não, e é
|
|
220
|
+
* conteúdo de verdade - medido no repo do dono, `Dialog.Title` diz "Insert link" e `Dialog.Close`
|
|
221
|
+
* diz "Cancel". Quem regenera o componente a partir da receita precisa dos dois.
|
|
222
|
+
*/
|
|
223
|
+
if (measured?.text)
|
|
224
|
+
out.text = String(measured.text).trim().slice(0, 120);
|
|
218
225
|
return out;
|
|
219
226
|
}
|
|
220
227
|
export function resolveAnatomy(read, declared, deps,
|
|
@@ -68,6 +68,11 @@ const CONTENT_WORD = "class|className|style|key|ref|id|href|src|alt|type|name|va
|
|
|
68
68
|
const NOT_A_DECISION = new RegExp(`^(?:${CONTENT_WORD})$|[a-z](?:${CONTENT_WORD.replace(/\b([a-z])/g, (_, c) => `[${c}${c.toUpperCase()}]`)})$|^(?:on[A-Z]|data-|aria-)`);
|
|
69
69
|
/** `import X, { A, B as C } from "spec"` - who owns each local name. */
|
|
70
70
|
const IMPORT = /import\s+(?:type\s+)?([\s\S]*?)\s+from\s+["']([^"']+)["']/g;
|
|
71
|
+
/**
|
|
72
|
+
* A marca de "importado de dentro". Um especificador nunca é um ponto sozinho, então ela não colide
|
|
73
|
+
* com nenhum pacote real - e distingue o que é DELE do que a gente simplesmente não sabe.
|
|
74
|
+
*/
|
|
75
|
+
export const OWN = ".";
|
|
71
76
|
function importedNames(source, internal = []) {
|
|
72
77
|
const out = new Map();
|
|
73
78
|
for (const m of source.matchAll(IMPORT)) {
|
|
@@ -78,18 +83,28 @@ function importedNames(source, internal = []) {
|
|
|
78
83
|
// a sibling package's name). Without the third, `@ui/lib/SignalUI/atoms/Text`
|
|
79
84
|
// - a company's own component behind its own alias - was filed as a
|
|
80
85
|
// third-party package (dono, 30/07).
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
/**
|
|
87
|
+
* DE DENTRO É DIFERENTE DE NÃO IMPORTADO, e essa distinção decide uma acusação.
|
|
88
|
+
*
|
|
89
|
+
* Os dois casos saíam daqui como ausência, então um nome que o arquivo NUNCA importa era tratado
|
|
90
|
+
* como componente dele e cobrado contra o contrato. Medido no repo do dono em 09/08: um
|
|
91
|
+
* `<Button variant="contained">` num arquivo que não importa `Button` em lugar nenhum - o código
|
|
92
|
+
* dele referencia um nome que não existe ali, e a esteira concluía que era o `ds-button`.
|
|
93
|
+
*
|
|
94
|
+
* `OWN` marca "importado de dentro": aí sim é dele e o contrato vale. Sem entrada nenhuma, a
|
|
95
|
+
* gente não sabe de onde veio - e a lei 13 diz que a ORIGEM decide, o que inclui não acusar
|
|
96
|
+
* quando não há origem para ler.
|
|
97
|
+
*/
|
|
98
|
+
const own = /^[./]/.test(spec) ||
|
|
99
|
+
spec.startsWith("@/") ||
|
|
100
|
+
internal.some((pre) => spec === pre || spec.startsWith(`${pre}/`));
|
|
86
101
|
for (const raw of clause.replace(/[{}]/g, ",").split(",")) {
|
|
87
102
|
const part = raw.trim();
|
|
88
103
|
if (!part || part === "*")
|
|
89
104
|
continue;
|
|
90
105
|
const local = (part.split(/\s+as\s+/).pop() ?? "").trim();
|
|
91
106
|
if (/^[A-Z]/.test(local))
|
|
92
|
-
out.set(local, spec);
|
|
107
|
+
out.set(local, own ? OWN : spec);
|
|
93
108
|
}
|
|
94
109
|
}
|
|
95
110
|
return out;
|
|
@@ -166,19 +181,24 @@ internal = []) {
|
|
|
166
181
|
if (!owners.has(name) && private_.has(name.split(".")[0]))
|
|
167
182
|
continue;
|
|
168
183
|
const body = m[2] ?? "";
|
|
184
|
+
// A dotted name belongs to whoever exported its root (`Popover.Root`).
|
|
185
|
+
const owner = owners.get(name) ?? owners.get(name.split(".")[0]);
|
|
186
|
+
/** Ver `ComponentTally`: dois `Button` de pacotes diferentes são duas linhas, não uma. */
|
|
169
187
|
let hit = tally.get(name);
|
|
170
188
|
if (!hit) {
|
|
171
|
-
// A dotted name belongs to whoever exported its root (`Popover.Root`).
|
|
172
|
-
const owner = owners.get(name) ?? owners.get(name.split(".")[0]);
|
|
173
189
|
hit = {
|
|
174
190
|
count: 0,
|
|
175
191
|
files: new Set(),
|
|
176
192
|
props: new Map(),
|
|
177
193
|
propFiles: new Map(),
|
|
178
|
-
...(owner ? { from: owner } : {}),
|
|
194
|
+
...(owner && owner !== OWN ? { from: owner } : {}),
|
|
195
|
+
origins: new Set(),
|
|
179
196
|
};
|
|
180
197
|
tally.set(name, hit);
|
|
181
198
|
}
|
|
199
|
+
/** TODA origem vista, e não só a primeira - ver `origins` no tipo. */
|
|
200
|
+
if (owner)
|
|
201
|
+
hit.origins.add(owner);
|
|
182
202
|
hit.count += 1;
|
|
183
203
|
hit.files.add(file);
|
|
184
204
|
LITERAL_PROP.lastIndex = 0;
|
|
@@ -222,6 +242,10 @@ export function tallyToInventory(tally, max = 80) {
|
|
|
222
242
|
.map(([name, v]) => ({
|
|
223
243
|
name,
|
|
224
244
|
...(v.from ? { from: v.from } : {}),
|
|
245
|
+
/** Só dele quando TODA aparição veio de dentro - ver `origins` e `OWN`. */
|
|
246
|
+
...(v.origins.size > 0 && [...v.origins].every((o) => o === OWN)
|
|
247
|
+
? { own: true }
|
|
248
|
+
: {}),
|
|
225
249
|
count: v.count,
|
|
226
250
|
files: v.files.size,
|
|
227
251
|
propFiles: Object.fromEntries([...v.propFiles.entries()].map(([p, files]) => [p, files.size])),
|
|
@@ -65,6 +65,18 @@ export function checkContracts(used, documents) {
|
|
|
65
65
|
// A third party's component answers to its own package, not to this system.
|
|
66
66
|
if (c.from)
|
|
67
67
|
continue;
|
|
68
|
+
/**
|
|
69
|
+
* E O QUE A GENTE NÃO CONSEGUE ATRIBUIR TAMBÉM NÃO SE COBRA.
|
|
70
|
+
*
|
|
71
|
+
* Um nome que o arquivo não importa de lugar nenhum não é prova de nada: pode ser o componente
|
|
72
|
+
* dele, pode ser um global, pode ser um resto que o código dele carrega. Medido em 09/08, um
|
|
73
|
+
* `<Button variant="contained">` num arquivo sem `import Button` era cobrado contra o `ds-button`
|
|
74
|
+
* - a lei 13 invertida, com a ausência de origem virando atribuição.
|
|
75
|
+
*
|
|
76
|
+
* A regra é a mesma dos dois lados: a ORIGEM decide. Sem origem legível, a esteira cala.
|
|
77
|
+
*/
|
|
78
|
+
if (!c.own)
|
|
79
|
+
continue;
|
|
68
80
|
const recipe = recipeNameOf(c.name);
|
|
69
81
|
const contract = axes.get(recipe);
|
|
70
82
|
if (!contract)
|
package/package.json
CHANGED