-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
fix!: Move backwards-compatibility hacks to main.js
#6260
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Move accessor properties for Blockly.alert, .confirm, .mainWorkspace, .prompt, .selected, .HSV_SATURATION and .HSV_VALUE, as well as the hack to allow loading of messages via <script> tags, from core/blockly.js to core/main.js, which becomes the entrypoint for the first chunk when compiled. BREAKING CHANGE: The aforementioned properties / hack are no longer available in uncompiled mode (or when using advanced compilation, unless also compiling against main.js.)
Move accessor property for ContextMenu.currentBlock from core/contextmenu.js to core/main.js.
Bring the deprecation date forward from May 2026 to September 2022. Not technically a breaking change—just a warning that there will be a breaking change earlier than previously advertised.
Move accessor properties for Blockly.Tooltip.visible and .DIV from core/tooltip.js to core/main.js.
Move accessor property for Blockly.WidgetDiv.DIV from core/widgetdiv.js to core/main.js.
cpcallen
added
component: build process
breaking change
Used to mark a PR or issue that changes our public APIs.
PR: chore
General chores (dependencies, typos, etc)
labels
Jul 5, 2022
NeilFraser
approved these changes
Jul 5, 2022
4 tasks
BeksOmega
reviewed
Jul 6, 2022
*/ | ||
confirm: { | ||
set: function(newConfirm) { | ||
deprecation.warn('Blockly.confirm', 'December 2021', 'December 2022'); |
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.
When we add deprecation warnings to mainWorkspace
and friends, I think we should change this to be 'September 2022'
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
PR: chore
General chores (dependencies, typos, etc)
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
npm run format
andnpm run lint
The details
Resolves
Prerequisite to #5904 and #5857.
Proposed Changes
goog.module
,core/main.js
, which becomes the entry point for the first chunk in compiled mode. (It is not used in uncompiled mode.) Move to this new module:blockly.js
:globalThis.Blockly.Msg
via<script>
tagblockly.js
,contextmenu.js
,events/events.js
,tooltip.js
, andwidgetdiv.js
:Object.defineProperties
calls that provide backward-compatibilityget
/set
accessors for mutable exports that were removed in the migration togoog.module
.Blockly
namespace object in uncompiled mode.generator.js
. Since these are attached to theGenerator
class, which is a named export, instead of the the moduleexports
object, they do not need to be moved out of hat module—but they did have a five-year deprecation period, which has been shortened to end with the 2022Q3 release to bring it in line with the period for the other accessors.Reason for Changes
It is not possible to use
Object.defineProperties
to add properties to aModule
object, so this code can't be run in uncompiled mode. It works in compiled mode only because Closure Compiler is set to output ES5, and the generated code does not contain anyObject.seal
calls for (what would be) Module objects.Test Coverage
npm test
.Documentation
Release notes will need to contain information about what to use instead of the the accessor properties, especially for
.mainWorkspace
,.selected
,HSV_SATURATION
andHSV_VALUE
, which were not previously marked as deprecated.Additional Information
Obsoletes PR #6203.
Does not add deprecation notices to the previously non-deprecated
Blockly..mainWorkspace
,.selected
,.HSV_SATURATION
and.HSV_VALUE
accessors. We want to do that before the delayed Q2 release but it is not a prerequisite to this move, which is a prerequisite to mergingts/migration
intodevelop
.