refactor!(blocks): Rename module Blockly.blocks.all
to Blockly.blocks
; former Blockly.blocks
back to Blockly.Blocks
#5946
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
(core/blocks.js
) back toBlockly.Blocks
(as it was prior to PR refactor: RenameBlockly.Blocks
, migrate to named exports #5515).Blockly.blocks.all
(blocks/all.js
) toBlockly.blocks
(blocks/blocks.js
).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
const {Blocks} = goog.require('Blockly.Blocks');
script
tag to loadblockly_compressed.js
and then access the dictionary viaBlockly.Blocks
(unchanged).goog.require('Blockly.blocks');
,<script>
tag to loadblocks_compressed.js
and then accesses exports viaBlockly.blocks
.There will be no changes visible when the blocks chunk is loaded via ES module
import
or CJSrequire
.Reason for Changes
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 think it is worth considering doing these renamings anyway simply because of providing a more sensible path for the blocks modules exports object for those loading the compiled chunks directly.
Test Coverage
Tested on:
npm test
Additional Information
Having the
core/blocks.js
module namedBlockly.Blocks
is less in accord with the styleguide, but more consistent with the (mis)capitalisation of its main export, the.Blocks
dictionary object.The need for naming of modules will shortly go away entirely when we convert from
goog.module
to ES modules.