You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a thoughtpad, not an issue but there isn't a better place to file it.
Let's support TypeScript as a mechanism to generate Closure Types
There are two sources of code for a TypeScript project. Local source, and remote (including NPM depdencies).
For Local Source: Convert TypeScript types into Closure annotations. Similar to Tsickle.
For Remote Source: Find the appropriate definition file (either @types/x or local to the remote source) and convert the resource to a closure extern definition. This extern must only be given to closure compiler for source that imports this remote source.
How
During rollup's transform step, we can indicate this plugin requires to inspect source before other plugins. If the input to rollup was typescript (uses the .ts or .tsx extension) then we can transform the local source using this tsickle-alike (or even just tsickle with configuration).
Before we execute the conversion, we should rename each imported name with a uuid unique to the import path. This will allow us to know during chunk transformation which imported members come from where (and use the appropriate externs when compiling them).
Once we have chunks, use the modified import names to map back to original imported names and know which externs to use on this chunk during compilation.
Should this be done for simple optimizations?
We could for simple optimization just enhance the existing system by obtaining the proper shape for each imported member during the transform phase (still using the rename trick with uuids per imported path).
The text was updated successfully, but these errors were encountered:
This is a thoughtpad, not an issue but there isn't a better place to file it.
Let's support TypeScript as a mechanism to generate Closure Types
There are two sources of code for a TypeScript project. Local source, and remote (including NPM depdencies).
For Local Source: Convert TypeScript types into Closure annotations. Similar to Tsickle.
For Remote Source: Find the appropriate definition file (either
@types/x
or local to the remote source) and convert the resource to a closure extern definition. This extern must only be given to closure compiler for source that imports this remote source.How
During rollup's
transform
step, we can indicate this plugin requires to inspect source before other plugins. If the input to rollup was typescript (uses the.ts
or.tsx
extension) then we can transform the local source using this tsickle-alike (or even just tsickle with configuration).Before we execute the conversion, we should rename each imported name with a uuid unique to the import path. This will allow us to know during
chunk
transformation which imported members come from where (and use the appropriate externs when compiling them).Once we have chunks, use the modified import names to map back to original imported names and know which externs to use on this chunk during compilation.
Should this be done for simple optimizations?
We could for simple optimization just enhance the existing system by obtaining the proper shape for each imported member during the transform phase (still using the rename trick with uuids per imported path).
The text was updated successfully, but these errors were encountered: