* feat(tests): Add a test script for the renamings file
* Make scripts/migration/renamings.js a valid JSON5 file.
* Add a schema for it in tests/migration/renamings-schema.json.
* Add a script to test one against the other, as
tests/migration/validate-renamings. It is a node.js script
that will exit 0 if the renamings file is valid, or 1 if it
is not (and print a not-very-helpful error message from which
is possible, with some effort, to deduce what the error is.)
* fix: convert to JSON5 and refactor example
* fix: convert keys to new key names
* fix: change versions to arrays instead of objects
* fix: fix version numbers
* fix: associate renames with the version where they were added
* fix: fixup example
* fix: put older renames at the bottom, and newer renames at the top
* fix: enable renamings test in run_all_tests
* fix: put newer renames back at the bottom
This reverts commit efe070e344.
* fix(tests): add missing additionalProperties: false to schema
And fix the resulting validation error in the example entry.
* chore(tests): Improve wording of example entry; add extra examples
Tweaked line wrapping of some existing entries (example and
acutal) that were otherwise untouched.
* feat: add dropDownDiv renaming to new database
* feat(tests): Check for duplicate entries for the same module
Also fixed extraneous whitespace in run_all_tests.sh
* fix(tests): Make validate-renamings.js compatible with node.js v12
Also remove success message, to adhere to usual unix convention
(silence implies success) as eslint does, and reduce unecessary
npm test output clutter.
* fix(tests): Fixes for PR #5980
* Fix typos.
* Remove redundant check.
Co-authored-by: Beka Westberg <bwestberg@google.com>
* fix: remove drop down div class
* fix: change name and export for drop down div
* fix: make module-local variables conform to styleguide
* fix: format
* fix: shadowing
...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`.
* chore: revert #5730
* fix: Fix compile failure due to incorrect visibility
The CONTROL_FLOW_IN_LOOP_CHECK_MIXIN is intended to be used outside of
blocks/ (it is, in particular, used in generators/) so it should have
been marked @public from the beginning.
This constant is used to specify the alignment of
an Input, so it should live in the same file as the Input class.
I've done this as a separate named export, but it could alternatively
be made a static member of Input (i.e., Input.Align with only Input
being exported by name).
Where mocha tests were referring to Blockly.constants.ALIGN.*
without actually requiring Blockly.constants, I have reverted
them to refer to Blockly.ALIGN_* instead (pending conversion
to named requries).
Part of #5073.
* chore: move remaining function definitions out of blockly.js
* chore: record renamings
* chore: add aliases to moved function jsdoc
* chore: add deprecation warnings in blockly.js
* chore: fix bad merge
* chore: move functions in response to PR comments
* chore: move isNumber to utils.string
* chore: move arrayRemove to a new utils.array namespace
* chore: move getBlockTypeCounts out of utils.js
* chore: remove last functions from utils.js
* chore: reorder imports
* chore: add re-export for runAfterPageLoad
* chore: move functions from utils to more specific files
* chore: use new names for utils functions
* chore: run clang-format
* chore: add deprecation warnings back to utils.js
Use Blockly.blocks.* for blocks modules, leaving the Blockly.Blocks
name for the block dictionary object.
This resolves a problem with advanced compilation of Blockly Games,
where, in the compressed output, (the minified name of)
Blockly.Blocks gets overwritten, with the dictionary object defined in
core/blocks.js being replaced by an empty namespace object
created by the provides of Blockly.Blocks.* in blocks/*.js. Without
this fix, some block definitions end up being created in the
dictionary and some on the namespace object—with chaos
predictably ensuing.
* 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.
* 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>
* Add getSelected/setSelected to core/common.js
* Migrate core to use Blockly.common.getSelected/setSelected instead of Blockly.selected
* Migrate demos to use Blockly.common.getSelected/setSelected instead of Blockly.selected
* Remove Blockly.selected
* Use variable instead of calling common.getSelected() multiple times
* Add accessor for selected on Blockly
* Add renaming record for Blockly.selected -> Blockly.common.getSelected/setSelected
* Use Object.defineProperties instead of .defineProperty when
installing get and set accessors for previously-mutable exports.
* Add entries to renamings.js where feasible (i.e., for static rather
than instance properties).
(Don't do blockly.js yet, to avoid merge conflicts.)
This is part of #5153 but is being prioritised because we want remove
the declareLegacyNamespace calls from the core/utils/*.js modules and
then reexport them explicitly via utils.js, and it turns out that
doing so results in the exports object of this module being passed to
Object.freeze - which fails on the global object, which can't be made
non-extensible!
The new name chosen for the former default export is globalThis, since
it is intended to have the same value as the global variable of that
name; see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
Create a file scripts/migration/renamings.js to collect information about renamed API entries. Start by filling it with the renamings already done to blockly.js.