File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
- import { ScriptTarget , transpile as transpileTypeScript } from "typescript" ;
2
1
import type { Cell } from "../lib/notebook.js" ;
3
2
import { toCell } from "../lib/notebook.js" ;
4
3
import { rewriteFileExpressions } from "./files.js" ;
@@ -8,6 +7,7 @@ import {transpileObservable} from "./observable.js";
8
7
import { parseJavaScript } from "./parse.js" ;
9
8
import { Sourcemap } from "./sourcemap.js" ;
10
9
import { transpileTemplate } from "./template.js" ;
10
+ import { transpileTypeScript } from "./typescript.js" ;
11
11
12
12
export type TranspiledJavaScript = {
13
13
/** the source code of a JavaScript function defining the primary variable */
@@ -57,7 +57,7 @@ export function transpile(
57
57
}
58
58
const transpiled =
59
59
mode === "ts"
60
- ? transpileJavaScript ( transpileTypeScript ( input , { target : ScriptTarget . ESNext } ) , options )
60
+ ? transpileJavaScript ( transpileTypeScript ( input ) , options )
61
61
: mode === "ojs"
62
62
? transpileObservable ( input , options )
63
63
: mode !== "js"
Original file line number Diff line number Diff line change
1
+ import { ModuleKind , ScriptTarget , transpile } from "typescript" ;
2
+
3
+ export function transpileTypeScript ( input : string ) : string {
4
+ return transpile ( input , {
5
+ target : ScriptTarget . ESNext ,
6
+ module : ModuleKind . Preserve ,
7
+ verbatimModuleSyntax : true
8
+ } ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments