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

Function getTransformOptions

src/javascript/module.ts:269–295  ·  view source on GitHub ↗
(loader: "ts" | "jsx" | "tsx", sourcePath?: string)

Source from the content-addressed store, hash-verified

267}
268
269function getTransformOptions(loader: "ts" | "jsx" | "tsx", sourcePath?: string): TransformOptions {
270 switch (loader) {
271 case "ts":
272 return {
273 loader,
274 sourcefile: sourcePath,
275 tsconfigRaw: '{"compilerOptions": {"verbatimModuleSyntax": true}}'
276 };
277 case "jsx":
278 return {
279 loader,
280 jsx: "automatic",
281 jsxImportSource: "npm:react",
282 sourcefile: sourcePath
283 };
284 case "tsx":
285 return {
286 loader,
287 jsx: "automatic",
288 jsxImportSource: "npm:react",
289 sourcefile: sourcePath,
290 tsconfigRaw: '{"compilerOptions": {"verbatimModuleSyntax": true}}'
291 };
292 default:
293 throw new Error(`unknown loader: ${loader}`);
294 }
295}

Callers 2

transformJavaScriptFunction · 0.85
transformJavaScriptSyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected