synthesisui 0.16.166 → 0.16.167

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.
@@ -144,9 +144,27 @@ export function looksLocal(spec) {
144
144
  * ressalva inflada é tão inútil quanto uma ausente.
145
145
  */
146
146
  const ASSET = /\.(css|scss|sass|less|styl|png|jpe?g|gif|svg|webp|avif|ico|woff2?|ttf|otf|mp4|webm|json|md|txt|ya?ml|graphql|wasm)$/i;
147
- const isFile = (path) => stat(path).then((s) => s.isFile(), () => false);
147
+ /**
148
+ * Existe como arquivo? Com memória, porque a mesma resposta é pedida centenas de vezes.
149
+ *
150
+ * Cada especificador tenta até treze candidatos (o base, seis extensões, seis `index`), e um barril
151
+ * importado por cem arquivos repete os mesmos treves `stat` cem vezes. Sem isto, medir um app de 1446
152
+ * arquivos passava de três segundos - e um leitor que roda dentro de todo import não pode pagar isso
153
+ * por um dado que não muda durante a rodada.
154
+ */
155
+ function fileChecker() {
156
+ const known = new Map();
157
+ return (path) => {
158
+ const seen = known.get(path);
159
+ if (seen)
160
+ return seen;
161
+ const asked = stat(path).then((s) => s.isFile(), () => false);
162
+ known.set(path, asked);
163
+ return asked;
164
+ };
165
+ }
148
166
  /** Um especificador vira um arquivo real, ou nada. `null` é contado, nunca engolido. */
149
- async function toFile(known, from, spec, aliases) {
167
+ async function toFile(known, from, spec, aliases, isFile) {
150
168
  const bases = [];
151
169
  if (spec.startsWith("."))
152
170
  bases.push(resolve(dirname(from), spec));
@@ -191,6 +209,7 @@ export async function reachabilityOf(input) {
191
209
  * inflava o denominador com arquivos que são inalcançáveis por definição - 2090 no lugar de 966 no
192
210
  * app do dono (07/08), e um número inflado no denominador é uma acusação inflada no numerador.
193
211
  */
212
+ const isFile = fileChecker();
194
213
  const known = new Set([...input.edges.keys()].filter((f) => /\.[jt]sx?$/.test(f) &&
195
214
  !/\.d\.ts$/.test(f) &&
196
215
  !/\/[a-z.-]+\.config\.[jt]sx?$/.test(f)));
@@ -213,7 +232,7 @@ export async function reachabilityOf(input) {
213
232
  unresolved += 1;
214
233
  continue;
215
234
  }
216
- const hit = await toFile(known, file, spec, input.aliases);
235
+ const hit = await toFile(known, file, spec, input.aliases, isFile);
217
236
  if (hit)
218
237
  out.push(hit);
219
238
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.166",
3
+ "version": "0.16.167",
4
4
  "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {