MCPcopy Index your code
hub / github.com/adobe/react-spectrum / analyzeCss

Function analyzeCss

scripts/buildRegistry.mjs:165–190  ·  view source on GitHub ↗
(file, seen = new Set())

Source from the content-addressed store, hash-verified

163}
164
165function analyzeCss(file, seen = new Set()) {
166 if (seen.has(file)) {
167 return [];
168 }
169 seen.add(file);
170
171 let content = fs.readFileSync(file, 'utf8');
172 let ast = postcss.parse(content);
173
174 let imports = new Set();
175 ast.walkAtRules('import', rule => {
176 imports.add(rule.params.slice(1, -1));
177 });
178
179 return [
180 {
181 path: 'components/ui/' + path.basename(file),
182 type: 'registry:component',
183 content
184 },
185 ...[...imports].flatMap(specifier => {
186 let resolved = path.resolve(path.dirname(file), specifier);
187 return analyzeCss(resolved, seen);
188 })
189 ];
190}

Callers 1

buildRegistry.mjsFile · 0.85

Calls 4

sliceMethod · 0.80
hasMethod · 0.65
addMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected