banira
    Preparing search index...

    Function transpileToEsm

    • Transpiles a single TypeScript source string to a browser-ready ES module: type annotations stripped, relative CSS/HTML imports lowered to constructable stylesheets / templates (as in Compiler), and relative imports rewritten with a .js extension (via the shared transformer), without type-checking. This is the per-file transform behind banira serve --ts, producing the same module shape as a full banira compile of one file.

      The output carries an inline source map (with the original TypeScript embedded) so breakpoints in devtools resolve to the .ts — there is no separate .map file to serve. See #47.

      Parameters

      • source: string
      • fileName: string = 'module.ts'
      • options: CompilerOptions = Compiler.DEFAULT_COMPILER_OPTIONS
      • OptionalreadAsset: (absolutePath: string) => string | undefined

        Reads an imported .css/.html file by absolute path, or returns undefined to leave the import untouched. Defaults to a disk read relative to fileName; serve passes one confined to the served root.

      Returns string