refactor(blocks)!: Rename Blockly.blocks.*
modules to Blockly.libraryBlocks.*
#5953
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.
The basics
The details
Proposed Changes
Blockly.blocks.all
module (blocks/all.js
) toBlockly.libraryBlocks
(blocks/blocks.js
).Blockly.blocks.*
modules toBlockly.libraryBlocks.*
.Behaviour Before Change
const {Blocks} = goog.require('Blockly.blocks');
,script
tag to loadblockly_compressed.js
and then access the dictionary viaBlockly.Blocks
.goog.require('Blockly.blocks.all');
,<script>
tag to loadblocks_compressed.js
and then accesses exports viaBlockly.blocks.all
.Behaviour After Change
goog.require('Blockly.libraryBlocks');
,<script>
tag to loadblocks_compressed.js
and then accesses exports viaBlockly.libraryBlocks
.There will be no changes visible when the blocks chunk is loaded via ES module
import
or CJSrequire
.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:
npm test
Additional Information
The need for naming of modules will shortly go away entirely when we convert from
goog.module
to ES modules.