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

Function illustrationResolverPlugin

vitest.browser.config.ts:60–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58
59// Resolve @react-spectrum/s2/illustrations/* imports
60function illustrationResolverPlugin(): Plugin {
61 return {
62 name: 'illustration-resolver',
63 enforce: 'pre',
64 resolveId(source) {
65 if (source.startsWith('@react-spectrum/s2/illustrations/')) {
66 const illustrationPath = source.replace('@react-spectrum/s2/illustrations/', '');
67 const tsxPath = path.resolve(s2Dir, 'spectrum-illustrations', illustrationPath + '.tsx');
68
69 if (fs.existsSync(tsxPath)) {
70 return tsxPath;
71 }
72
73 return null;
74 }
75 return null;
76 }
77 };
78}
79
80/**
81 * Handle S2 illustrations.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected