MCPcopy Create free account
hub / github.com/adobe/react-spectrum / load

Function load

vitest.browser.config.ts:36–55  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

34 return null;
35 },
36 async load(id) {
37 if (id.startsWith('virtual:intl-messages:')) {
38 const intlDir = id.replace('virtual:intl-messages:', '');
39 try {
40 const files = fs.readdirSync(intlDir).filter(f => f.endsWith('.json'));
41 const messages: Record<string, Record<string, string>> = {};
42
43 for (const file of files) {
44 const locale = path.basename(file, '.json');
45 const content = fs.readFileSync(path.join(intlDir, file), 'utf-8');
46 messages[locale] = JSON.parse(content);
47 }
48
49 return `export default ${JSON.stringify(messages)};`;
50 } catch {
51 return 'export default {};';
52 }
53 }
54 return null;
55 }
56 };
57}
58

Callers

nothing calls this directly

Calls 3

sliceMethod · 0.80
filterMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected