Skip to content
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

BREAKING CHANGE: Migrate core/ to goog.module #5544

Merged
merged 936 commits into from
Sep 27, 2021
Merged

BREAKING CHANGE: Migrate core/ to goog.module #5544

merged 936 commits into from
Sep 27, 2021

Conversation

cpcallen
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

Part (in fact, most) of #5026.

Proposed Changes

Migrate almost all of core/ from goog.provides to goog.module.

Reason for Changes

This is the first step of migrating Blockly to ES modules and perhaps eventually TypeScript.

Test Coverage

Passes npm test.

Playground not obviously broken on desktop Chrome.

Documentation

Some renamings are documented in scripts/migration/renamings.js. (Most renamings are not externally visible.)

Additional documentation will probably be required, but changes from the point of view of Blockly library users should be minimal.

Additional Information

gonfunko and others added 30 commits August 11, 2021 08:30
* Migrate core/renderers/geras/renderer.js to goog.module

* Migrate core/renderers/geras/renderer.js to named requires

* clang-format core/renderers/geras/renderer.js
* Migrate core/events/events_theme_change.js to ES6 const/let

* Migrate core/events/events_theme_change.js to goog.module

* Migrate core/events/events_theme_change.js to named requires

* clang-format core/events/events_theme_change.js
* Migrate core/events/events_block_drag.js to ES6 const/let

* Migrate core/events/events_block_drag.js to goog.module

* Migrate core/events/events_block_drag.js to named requires

* clang-format core/events/events_block_drag.js
* Use goog.requireType when importing I* interfaces

Interfaces have no code, so should never be referred to outside of
(JSDoc) comments, and so the modules that define only interfaces never
need to be goog.require'd - goog.requireType is always sufficient.

This commit fixes imports of all modules whose name matches
/(.*\.)?I[A-Z]*/ - i.e., the hungarian-notation named ones in
core/interfaces/.

* Use goog.requireType when only using import for type specifications

Where a module is imported only to used in JSDoc comments it can
(and should) be goog.requireType'd instead of goog.require'd.

* Remove spurious eslint-disable no-unused-vars

There were a few cases where modules were being imported with
goog.require (because they are referred to in code, not just JSDoc
comments) but were prefaced by a spurious eslint suppress.

Remove these, restoring the invariant that an import gets an eslint
if and only if it is a requireType.

* Remove obsolete Closure Compiler error group

stricterMissingRequire has been superceded by missingRequire, and now
causes a Java null pointer exception if supplied.
* Migrate core/procedures.js to ES6 const/let

* Migrate core/procedures.js to goog.module

* Migrate core/procedures.js to named requires

* clang-format core/procedures.js

* Rename xml to utilsXml to disambiguate from Xml
kozbial and others added 21 commits September 23, 2021 12:31
chore: Remove declareLegacyNamespace() from field_* files
* chore: Remove declareLegacyNamespace() from files in core

* fix: Update missing/errant re-exports in blockly.js
…5407)

* Renamed Blockly.connectionTypes to Blockly.ConnectionType
* Renamed core/connection_types.js to connection_type.js
* Add entry to renamings.js for renaming of Blockly.connectionTypes

Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* chore: Remove declareLegacyNamespace from Geras renderer

* chore: Remove declareLegacyNamespace from minimalist renderer

* chore: Remove declareLegacyNamespace from thrasos renderer

* chore: Remove declareLegacyNamespace from zelos renderer

* fix: Move debugger functionality out of Blockly.blockRendering to avoid dependency cycle when re-exporting submodules

* chore: Remove declareLegacyNamespace from Blockly.blockRendering.*
* refactor: Migrate Blockly.ConnectionType to named exports
* Add corresponding information to renamings.js
Fixes #5503

This makes the value of Blockly.utils.global the same as it was
before PR #5451.
* Rename Blockly.Blocks to Blockly.blocks
  Because it does not export a type as its default export.

  Part of #5073.

* Name default export of Blockly.blocks Blocks.

  Use named exports in Blockly.blocks by giving the former default
  export the name Blocks.

  Part of #5153.

* Reexport Blockly.blocks from blockly.js

* Document the format of renamings.js better.
- Adds an extra events/utils.js file to hold helper methods related to events.
@cpcallen cpcallen added this to the 2021_q3_release milestone Sep 27, 2021
@cpcallen cpcallen requested a review from a team as a code owner September 27, 2021 16:58
@google-cla google-cla bot added the cla: yes Used by Google's CLA checker. label Sep 27, 2021
Copy link
Collaborator

@rachel-fenichel rachel-fenichel left a comment

Choose a reason for hiding this comment

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

The list of changed files matches what I expected, and the changes in a random subset of the files also match what I expected.

@cpcallen cpcallen merged commit 3f063f0 into develop Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by Google's CLA checker. type: cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants