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

refactor(blocks)!: Rename Blockly.blocks.* modules to Blockly.libraryBlocks.* #5953

Merged
merged 1 commit into from
Feb 23, 2022

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

Proposed Changes

  • Rename the Blockly.blocks.all module (blocks/all.js) to Blockly.libraryBlocks (blocks/blocks.js).
  • Rename the otherBlockly.blocks.* modules to Blockly.libraryBlocks.*.

Behaviour Before Change

  • Code requiring the blocks dictionary object does const {Blocks} = goog.require('Blockly.blocks');,
    • or uses a script tag to load blockly_compressed.js and then access the dictionary via Blockly.Blocks.
  • Code loading library blocks does goog.require('Blockly.blocks.all');,
    • or uses a <script> tag to load blocks_compressed.js and then accesses exports via Blockly.blocks.all.

Behaviour After Change

  • Code requiring the blocks dictionary object is unchanged.
  • Code loading library blocks does goog.require('Blockly.libraryBlocks');,
    • or uses a <script> tag to load blocks_compressed.js and then accesses exports via Blockly.libraryBlocks.

There will be no changes visible when the blocks chunk is loaded via ES module import or CJS require.

Reason for Changes

An earlier version of this change was originally created as an alternative fix for issue #5932. PR #5945 is a better fix for the actual underlying cause of that issue, but I proposed PR #5946 anyway simply because of providing a more sensible path for the blocks modules exports object for those loading the compiled chunks directly. After discussion, this modified approach was settled on.

Test Coverage

Tested on:

  • Desktop Chrome
  • npm test

Additional Information

The need for naming of modules will shortly go away entirely when we convert from goog.module to ES modules.

@cpcallen cpcallen added component: build process component: library blocks breaking change Used to mark a PR or issue that changes our public APIs. PR: chore General chores (dependencies, typos, etc) labels Feb 23, 2022
@cpcallen cpcallen requested a review from a team as a code owner February 23, 2022 16:17
…Blocks.*

...and rename Blockly.blocks.all (blocks/all.js) to
Blockly.libraryBlocks (blocks/blocks.js

BREAKING CHANGE: (only) because the exports object from the
`blocks_compressed.js` chunk will be accessed as
`Blockly.libraryBlocks` instead of `Blockly.blocks.all` when the
chunk is loaded in a browser via a `<script>` tag.  There will
be no changes visible when the chunk is loaded via ES module
`import` or CJS `require`.
@cpcallen cpcallen changed the title refactor!(blocks): Rename Blockly.blocks.* modules to Blockly.libraryBlocks.* refactor(blocks)!: Rename Blockly.blocks.* modules to Blockly.libraryBlocks.* Feb 23, 2022
@cpcallen
Copy link
Contributor Author

Amended titles of commit & PR to fix conventional commit lint error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Used to mark a PR or issue that changes our public APIs. component: build process component: library blocks PR: chore General chores (dependencies, typos, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants