Skip to content

Translate require/export to goog.module equivalents #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
evmar opened this issue Mar 25, 2016 · 1 comment
Closed

Translate require/export to goog.module equivalents #111

evmar opened this issue Mar 25, 2016 · 1 comment

Comments

@evmar
Copy link
Contributor

evmar commented Mar 25, 2016

To run sickle by itself, we need to translate the emitted require("foo") statements into goog.require calls.

This basically means move convertCommonJsToGoogModule from Google internal to sickle repo, which is likely where it belonged in the first place.

@mprobst
Copy link
Contributor

mprobst commented Mar 25, 2016

+1.

evmar added a commit that referenced this issue Mar 29, 2016
Summary:
Sickle now processes "export *" at input type, before JS emit.

If we end up generating JS that uses __export(), we've already
lost, because Closure doesn't know about the types of all the
exported variables.

Part of issue #111.

Reviewers: rkirov, alexeagle

Reviewed By: alexeagle

Subscribers: typescript-eng

Differential Revision: https://reviews.angular.io/D32
evmar added a commit that referenced this issue Apr 6, 2016
Summary:
The superclass "Rewriter" manages the AST traversal and node emitting,
while Annotator then implements a node-visit function and handles all
the same logic it did before.

This split is so we can use the Rewriter logic a second time, in the
module rewriter (the piece that processes JS->JS to inject goog.module
etc.).

More work to prepare for #111.

Reviewers: rkirov, mprobst

Reviewed By: mprobst

Subscribers: typescript-eng

Differential Revision: https://reviews.angular.io/D41
@evmar evmar closed this as completed in 07973dd Apr 7, 2016
evmar added a commit that referenced this issue Apr 8, 2016
Summary:
The bug was that we'd look for the first statement before producing
a goog.module, so if the file had no statements we wouldn't produce one.

The code looked like it was trying to be clever and emit the goog.module
after an initial file comment, but it didn't actually work.  Do the simpler
equivalent thing for now.

More work on #111.

Reviewers: alexeagle

Reviewed By: alexeagle

Subscribers: typescript-eng

Differential Revision: https://reviews.angular.io/D58
evmar added a commit that referenced this issue Apr 8, 2016
Summary:
The convertCommonJsToGoogModule API returned a referencedModules
array, but it was always empty(!).  Actually return the referenced
modules.

More work on issue #111.

Reviewers: alexeagle

Reviewed By: alexeagle

Subscribers: typescript-eng

Differential Revision: https://reviews.angular.io/D59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants