GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adds the Module transformers by rbuckton · Pull Request #7206 · microsoft/TypeScript

Conversation

@rbuckton

@rbuckton Ron Buckton (rbuckton) commented Feb 24, 2016

Copy link
Copy Markdown
Contributor

The Module transformer is designed to transform most Module-specific syntax into compatible down-level JavaScript, including:

  • Top-level Import Declarations
  • Top-level Export Declarations
  • Default exports and export assignments
  • Exported functions and classes

The Module transformers include support for the following module kinds:

  • CommonJS
  • AMD
  • UMD
  • SystemJS
  • ES6 (which is effectively a no-op).

Related Pull Requests:

  • Adds the visitor API foundation for tree transformations. #6892 - Adds the visitor API foundation for tree transformations.
  • Adds the Transform Flags concept for tree transformations #6983 - Adds the Transform Flags concept for tree transformations.
  • Adds the transformFiles API for tree transformations #6986 - Adds the transformFiles API for tree transformations.
  • Adds a simplified pretty printer for tree transformations #6987 - Adds a simplified pretty printer for tree transformations.
  • Adds the TypeScript transformer #7191 - Adds the TypeScript transformer.
  • Adds the JSX transformer #7192 - Adds the JSX transformer.
  • Adds the ES7 transformer #7193 - Adds the ES7 transformer.
  • Adds the ES6 transformer #7194 - Adds the ES6 transformer.
  • Adds the Module transformers #7206 - Adds the Module transformer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Ron Buckton (rbuckton) added 5 commits February 19, 2016 18:23
@rbuckton
Added CommonJS/AMD/UMD module transformer
39628d7
@rbuckton
Added initial SystemJS transformer.
5564537
@rbuckton
Merge branch 'transforms-transformer-es6' into transforms-transformer…
0b64048
…-module
@rbuckton
Merge branch 'transforms-transformer-es6' into transforms-transformer…
0d8e152
…-module
@rbuckton
Fixed linter warnings.
72bfd2f
@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-not-required label Feb 24, 2016
This was referenced Feb 24, 2016
Adds the ES6 transformer #7194
Merged
Adds the ES7 transformer #7193
Merged
Adds the JSX transformer #7192
Merged
Adds the TypeScript transformer #7191
Merged
Adds a simplified pretty printer for tree transformations #6987
Merged
Adds the transformFiles API for tree transformations #6986
Merged
Adds the Transform Flags concept for tree transformations #6983
Merged
Adds the visitor API foundation for tree transformations. #6892
Merged
Ron Buckton (rbuckton) added 5 commits March 2, 2016 12:32
@rbuckton
Merge branch 'transforms-transformer-es6' into transforms-transformer…
70cbb9b
…-module
@rbuckton
Merge branch 'transforms-transformer-es6' into transforms-transformer…
c4a75ba
…-module
@rbuckton
Switched to onEmitNode
72eebdb
@rbuckton
Fixed invalid assertion in ts transformer
1cf183b
@rbuckton
General fixes and cleanup
d89e21a
sandersn
sandersn reviewed Mar 10, 2016
View reviewed changes
Comment thread src/compiler/transformers/module/module.ts
define,
flattenNodes([
// Add the module name (if provided).
moduleName,

@sandersn Nathan Shively-Sanders (sandersn) Mar 10, 2016

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's undefined, will it be skipped in the emit or emitted as undefined?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rbuckton Ron Buckton (rbuckton) Mar 18, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flattenNodes removes undefined nodes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Ron Buckton (rbuckton) added 5 commits March 10, 2016 11:12
@rbuckton
Moved modifier related flags to separate enum
5b8cf96
@rbuckton
Removed ModifiersArray
99e6ad8
@rbuckton
Add support for array return values from visitors
47cdfbe
@rbuckton
Removed NodeArrayNode in favor of arrays
2699bf9
@rbuckton
cleaned up assertions and removed flattenNodes.
94018a1
sandersn
sandersn reviewed Mar 10, 2016
View reviewed changes
Comment thread src/compiler/transformers/module/module.ts Outdated
const moduleName = getExternalModuleNameLiteral(importNode);
return createCall(
createIdentifier("require"),
moduleName ? [moduleName] : []

@sandersn Nathan Shively-Sanders (sandersn) Mar 10, 2016

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without moduleName, this just generates require(), right? What will the larger generated statement be in that case, and is it meaningful?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sandersn
sandersn reviewed Mar 11, 2016
View reviewed changes
Comment thread src/compiler/transformers/module/module.ts Outdated

function visitExportDeclaration(node: ExportDeclaration): OneOrMany<Statement> {
if (contains(externalImports, node)) {
const generatedName = getGeneratedNameForNode(node);

@sandersn Nathan Shively-Sanders (sandersn) Mar 11, 2016

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does visitExportDeclaration save the result of getGeneratedNameForNode but visitImportDeclaration and visitImportEqualsDeclaration doesn't?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rbuckton Ron Buckton (rbuckton) Mar 18, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • visitExportDeclaration must always call getGeneratedNameForNode.
  • visitImportDeclaration calls it conditionally.
  • visitImportEqualsDeclaration doesn't call it at all.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Ron Buckton (rbuckton) added 2 commits March 18, 2016 12:38
@rbuckton
Fixed perf issue in binder, plus PR feedback
ad0dd4e
@rbuckton
Updated baselines
44ca7d4
Ron Buckton (rbuckton) added a commit that referenced this pull request Mar 18, 2016
@rbuckton
Merge pull request #7206 from Microsoft/transforms-transformer-module
3c5f170
Adds the Module transformers
@rbuckton
Ron Buckton (rbuckton) merged commit 3c5f170 into transforms-transformer-es6 Mar 18, 2016
@rbuckton
Ron Buckton (rbuckton) deleted the transforms-transformer-module branch March 18, 2016 21:37
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@rbuckton @sandersn @msftclas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.