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

Function importTsModule

packages/dev/mcp/s2/scripts/build-data.mjs:37–52  ·  view source on GitHub ↗
(tsFilePath)

Source from the content-addressed store, hash-verified

35}
36
37async function importTsModule(tsFilePath) {
38 if (!fs.existsSync(tsFilePath)) {
39 throw new Error(`TS module not found: ${tsFilePath}`);
40 }
41 const sourceText = fs.readFileSync(tsFilePath, 'utf8');
42 const result = ts.transpileModule(sourceText, {
43 fileName: tsFilePath,
44 compilerOptions: {
45 target: ts.ScriptTarget.ES2022,
46 module: ts.ModuleKind.ESNext,
47 esModuleInterop: true
48 }
49 });
50 const url = `data:text/javascript;base64,${Buffer.from(result.outputText, 'utf8').toString('base64')}`;
51 return import(url);
52}
53
54function buildIconNames() {
55 if (!fs.existsSync(ICONS_DIR)) {

Callers 1

mainFunction · 0.85

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected