MCPcopy Create free account
hub / github.com/observablehq/framework / readJavaScriptSync

Function readJavaScriptSync

src/javascript/module.ts:244–255  ·  view source on GitHub ↗
(sourcePath: string)

Source from the content-addressed store, hash-verified

242}
243
244export function readJavaScriptSync(sourcePath: string): string {
245 const source = readFileSync(sourcePath, "utf-8");
246 switch (extname(sourcePath)) {
247 case ".ts":
248 return transformJavaScriptSync(source, "ts", sourcePath);
249 case ".jsx":
250 return transformJavaScriptSync(source, "jsx", sourcePath);
251 case ".tsx":
252 return transformJavaScriptSync(source, "tsx", sourcePath);
253 }
254 return source;
255}
256
257export async function transformJavaScript(
258 source: string,

Callers 1

getModuleInfoFunction · 0.85

Calls 1

transformJavaScriptSyncFunction · 0.85

Tested by

no test coverage detected