Replies: 4 comments 5 replies
-
why not just a rootSpecifier property (like main), to indicate which source is the root ? const { diagnostics, files, ignoredOptions, stats } = await Deno.emit(
{
compilerOptions: {
module: "amd",
sourceMap: false,
},
sources: { "/a.ts": `export const a = "a";` },
main: "/a.ts",
// or root
},
); |
Beta Was this translation helpful? Give feedback.
2 replies
-
I see |
Beta Was this translation helpful? Give feedback.
1 reply
-
I'm confused on what this line does: sources: { "/a.ts": `export const a = "a";` }` |
Beta Was this translation helpful? Give feedback.
2 replies
-
This has been delivered, so the conversation here is locked. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Part of the reason why the runtime compiler APIs were never stabilised is because we knew that we weren't really happy with them. As Deno has evolved, so has our understanding of how we consume, type check, and emit code.
In #4752 we indicated that we would be refactoring these and we now have that work done in #8799.
While holding them behind the
--unstable
flag should have set community expectations that we would break them in the future, we realise that there are quite a few people and projects who have leveraged and implemented the previous APIs, as they are one of the powerful features of Deno, having the ability to emit arbitrary JavaScript and TypeScript to JavaScript. We think the new, consolidated API is better and easier to use for everyone, but it will require those using the feature to refactor their code once it is landed in master.Based on the potential disruption we are currently targeting Deno 1.7.0 for this breaking change, but of course want to hear feedback from the wider community.
A couple new features over the existing APIs:
ignoredOptions
are returned to the caller, instead of logged to the console.stats
which for internal compiles are logged at a debug level are returned to the caller. This helps expose some performance information for better management of applications.check
tofalse
will cause the API to behave like--no-check
does on the command line.Deno.emit()
API respects the same permissions that dynamicimport()
and workers do, which require currently--allow-read
and/or--allow-net
permissions.The new API looks something like this:
And has the signature of:
A couple of things that we can do down the road, which aren't addressed in the PR at the moment:
tsc
compiler runtime in memory, so that several calls toDeno.emit()
with type checking do not require the compiler runtime to be "spun up". Currently that occurs every time. I would have added it to this PR, but it is a more complex refactor to do that then I had anticipated, and we need to get this in first, before addressing that.Deno.emit()
follows whatever behaviour is followed on the command line.Beta Was this translation helpful? Give feedback.
All reactions