Skip to content

Commit 80b5b2b

Browse files
authored
patch(emitter-typescript): Allow running emitter in browser mode (#5)
TypeSpec support running the compiler in browser mode, however when prettier is bundled in standalone mode for browser it requires listing all plugins explicitly: prettier/prettier#6264. This commit adds this to allow running it in browser.
1 parent f51ad5c commit 80b5b2b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/spotty-hornets-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@typespec-tools/emitter-typescript": patch
3+
---
4+
5+
Allow running emitter in browser mode

packages/emitter-typescript/src/emitter.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import * as prettier from "prettier";
2+
import prettierPluginTypescript from "prettier/plugins/typescript";
3+
import prettierPluginEstree from "prettier/plugins/estree";
24
import {
35
BooleanLiteral,
46
EmitContext,
@@ -415,6 +417,7 @@ export class TypescriptEmitter<
415417
emittedSourceFile.contents,
416418
{
417419
parser: "typescript",
420+
plugins: [prettierPluginTypescript, prettierPluginEstree],
418421
}
419422
);
420423
return emittedSourceFile;

0 commit comments

Comments
 (0)