From 3c723f0199b1f3b5eaac58f064b02d52b60d0ddb Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Wed, 9 Mar 2022 19:29:43 +0000 Subject: [PATCH] feat(tests): Add a test to validate `scripts/migration/renamings.js` (#5980) * 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 efe070e3448011202e613dc43580ec127fa50efa. * 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 --- package-lock.json | 193 ++++ package.json | 2 + scripts/migration/renamings.js | 1083 -------------------- scripts/migration/renamings.json5 | 1339 +++++++++++++++++++++++++ tests/migration/renamings-schema.json | 57 ++ tests/migration/validate-renamings.js | 73 ++ tests/run_all_tests.sh | 4 +- 7 files changed, 1667 insertions(+), 1084 deletions(-) delete mode 100644 scripts/migration/renamings.js create mode 100644 scripts/migration/renamings.json5 create mode 100644 tests/migration/renamings-schema.json create mode 100755 tests/migration/validate-renamings.js diff --git a/package-lock.json b/package-lock.json index 8010a1c8f97..e0b806eeb50 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@blockly/block-test": "^2.0.1", "@blockly/dev-tools": "^3.0.1", "@blockly/theme-modern": "^2.1.1", + "@hyperjump/json-schema": "^0.18.4", "@wdio/selenium-standalone-service": "^7.10.1", "chai": "^4.2.0", "clang-format": "^1.6.0", @@ -36,6 +37,7 @@ "gulp-umd": "^2.0.0", "http-server": "^14.0.0", "js-green-licenses": "^3.0.0", + "json5": "^2.2.0", "mocha": "^9.1.1", "readline-sync": "^1.4.10", "rimraf": "^3.0.2", @@ -371,6 +373,68 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@hyperjump/json-pointer": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@hyperjump/json-pointer/-/json-pointer-0.9.2.tgz", + "integrity": "sha512-PGCyTWO+WTkNWhMdlgE7OiQYPVkme9/e6d7K2xiZxH1wMGxGgZEEDNCe8hox7rkuD1equ4eZM+K3eoPCexckmA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "just-curry-it": "^3.2.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jdesrosiers" + } + }, + "node_modules/@hyperjump/json-schema": { + "version": "0.18.4", + "resolved": "https://registry.npmjs.org/@hyperjump/json-schema/-/json-schema-0.18.4.tgz", + "integrity": "sha512-FVdSlOrOio/sWCbVbAP3yH/gKKddvrIvKzLS/id6/CidWH0r0x5ZTPM1zBS0Su7gU6OOjFRxDYhrIhnNBI5ODg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@hyperjump/json-schema-core": "^0.23.4", + "fastest-stable-stringify": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jdesrosiers" + } + }, + "node_modules/@hyperjump/json-schema-core": { + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/@hyperjump/json-schema-core/-/json-schema-core-0.23.6.tgz", + "integrity": "sha512-X0IzGRi5K4c91awB3xNt5bvbs34UyHwOpRKKFFJ2nWDWW7e22VNGvibqo/S2rdFyta3wqOHTICFNTQjjcVdIZg==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@hyperjump/json-pointer": "^0.9.1", + "@hyperjump/pact": "^0.2.0", + "content-type": "^1.0.4", + "node-fetch": "^2.6.5", + "pubsub-js": "^1.9.1", + "url-resolve-browser": "^1.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jdesrosiers" + } + }, + "node_modules/@hyperjump/pact": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@hyperjump/pact/-/pact-0.2.1.tgz", + "integrity": "sha512-imzl9j1UiqM/HC3kgfS0/TdXcEFGFkq5EwjyaztLfdmia8KLBXGy3rC96K+nnyY+2fA69yA9HtnDappub5VSQQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "just-curry-it": "^3.1.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/jdesrosiers" + } + }, "node_modules/@sindresorhus/is": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.0.tgz", @@ -2799,6 +2863,15 @@ "node": ">=10" } }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -4230,6 +4303,12 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, + "node_modules/fastest-stable-stringify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fastest-stable-stringify/-/fastest-stable-stringify-2.0.2.tgz", + "integrity": "sha512-bijHueCGd0LqqNK9b5oCMHc0MluJAx0cwqASgbWMvkO01lCYgIhacVRLcaDz3QnyYIRNJRDwMb41VuT6pHJ91Q==", + "dev": true + }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -6995,6 +7074,21 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "node_modules/json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -7021,6 +7115,12 @@ "node": ">=0.6.0" } }, + "node_modules/just-curry-it": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-3.2.1.tgz", + "integrity": "sha512-Q8206k8pTY7krW32cdmPsP+DqqLgWx/hYPSj9/+7SYqSqz7UuwPbfSe07lQtvuuaVyiSJveXk0E5RydOuWwsEg==", + "dev": true + }, "node_modules/just-debounce": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.1.0.tgz", @@ -9302,6 +9402,12 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" }, + "node_modules/pubsub-js": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/pubsub-js/-/pubsub-js-1.9.4.tgz", + "integrity": "sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A==", + "dev": true + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -11589,6 +11695,12 @@ "node": ">=4" } }, + "node_modules/url-resolve-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/url-resolve-browser/-/url-resolve-browser-1.2.0.tgz", + "integrity": "sha512-L9PBPnlKNDFzt9ElK4br8I8Tufdm1xgv1GhMeiP7ZC87x0b7mr+4vSh13kmPq5km80JKX+UD2BeEFTCrFZ6xDA==", + "dev": true + }, "node_modules/use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -12647,6 +12759,48 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@hyperjump/json-pointer": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@hyperjump/json-pointer/-/json-pointer-0.9.2.tgz", + "integrity": "sha512-PGCyTWO+WTkNWhMdlgE7OiQYPVkme9/e6d7K2xiZxH1wMGxGgZEEDNCe8hox7rkuD1equ4eZM+K3eoPCexckmA==", + "dev": true, + "requires": { + "just-curry-it": "^3.2.1" + } + }, + "@hyperjump/json-schema": { + "version": "0.18.4", + "resolved": "https://registry.npmjs.org/@hyperjump/json-schema/-/json-schema-0.18.4.tgz", + "integrity": "sha512-FVdSlOrOio/sWCbVbAP3yH/gKKddvrIvKzLS/id6/CidWH0r0x5ZTPM1zBS0Su7gU6OOjFRxDYhrIhnNBI5ODg==", + "dev": true, + "requires": { + "@hyperjump/json-schema-core": "^0.23.4", + "fastest-stable-stringify": "^2.0.2" + } + }, + "@hyperjump/json-schema-core": { + "version": "0.23.6", + "resolved": "https://registry.npmjs.org/@hyperjump/json-schema-core/-/json-schema-core-0.23.6.tgz", + "integrity": "sha512-X0IzGRi5K4c91awB3xNt5bvbs34UyHwOpRKKFFJ2nWDWW7e22VNGvibqo/S2rdFyta3wqOHTICFNTQjjcVdIZg==", + "dev": true, + "requires": { + "@hyperjump/json-pointer": "^0.9.1", + "@hyperjump/pact": "^0.2.0", + "content-type": "^1.0.4", + "node-fetch": "^2.6.5", + "pubsub-js": "^1.9.1", + "url-resolve-browser": "^1.2.0" + } + }, + "@hyperjump/pact": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@hyperjump/pact/-/pact-0.2.1.tgz", + "integrity": "sha512-imzl9j1UiqM/HC3kgfS0/TdXcEFGFkq5EwjyaztLfdmia8KLBXGy3rC96K+nnyY+2fA69yA9HtnDappub5VSQQ==", + "dev": true, + "requires": { + "just-curry-it": "^3.1.0" + } + }, "@sindresorhus/is": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.0.tgz", @@ -14594,6 +14748,12 @@ } } }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, "convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -15759,6 +15919,12 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, + "fastest-stable-stringify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fastest-stable-stringify/-/fastest-stable-stringify-2.0.2.tgz", + "integrity": "sha512-bijHueCGd0LqqNK9b5oCMHc0MluJAx0cwqASgbWMvkO01lCYgIhacVRLcaDz3QnyYIRNJRDwMb41VuT6pHJ91Q==", + "dev": true + }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -17958,6 +18124,15 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -17979,6 +18154,12 @@ "verror": "1.10.0" } }, + "just-curry-it": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/just-curry-it/-/just-curry-it-3.2.1.tgz", + "integrity": "sha512-Q8206k8pTY7krW32cdmPsP+DqqLgWx/hYPSj9/+7SYqSqz7UuwPbfSe07lQtvuuaVyiSJveXk0E5RydOuWwsEg==", + "dev": true + }, "just-debounce": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.1.0.tgz", @@ -19813,6 +19994,12 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" }, + "pubsub-js": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/pubsub-js/-/pubsub-js-1.9.4.tgz", + "integrity": "sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A==", + "dev": true + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -21685,6 +21872,12 @@ "prepend-http": "^2.0.0" } }, + "url-resolve-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/url-resolve-browser/-/url-resolve-browser-1.2.0.tgz", + "integrity": "sha512-L9PBPnlKNDFzt9ElK4br8I8Tufdm1xgv1GhMeiP7ZC87x0b7mr+4vSh13kmPq5km80JKX+UD2BeEFTCrFZ6xDA==", + "dev": true + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", diff --git a/package.json b/package.json index 149e38a61bf..008c92dabb3 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "@blockly/block-test": "^2.0.1", "@blockly/dev-tools": "^3.0.1", "@blockly/theme-modern": "^2.1.1", + "@hyperjump/json-schema": "^0.18.4", "@wdio/selenium-standalone-service": "^7.10.1", "chai": "^4.2.0", "clang-format": "^1.6.0", @@ -90,6 +91,7 @@ "gulp-umd": "^2.0.0", "http-server": "^14.0.0", "js-green-licenses": "^3.0.0", + "json5": "^2.2.0", "mocha": "^9.1.1", "readline-sync": "^1.4.10", "rimraf": "^3.0.2", diff --git a/scripts/migration/renamings.js b/scripts/migration/renamings.js deleted file mode 100644 index f32c29e12c1..00000000000 --- a/scripts/migration/renamings.js +++ /dev/null @@ -1,1083 +0,0 @@ -/** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @fileoverview Collected information about modules and module - * exports that have been renamed between versions. - * - * For now this is a node module, not a goog.module. - */ -'use strict'; - -/** - * Map from Blockly core version number to table of renamings made - * *since* that version was released (since we don't know for sure - * what the version number of the release that will incorporate those - * renamings will be yet). - * @type {Object} - */ -const renamings = { - // Example entry: - '0.0.0': { - // These renaming were made after version 0.0.0 was published. - // Each entry is keyed by the original module name. - 'module.name.Old': { - // If the module has been renamed, its new name will be listed. - module: 'module.name.new', - - // Modules which had a default export that has been turned into - // a named export the new name will be given. - export: 'defaultName', - - // For backward-compatibility reasons, we may choose to continue - // to reexport default exports in the same place in the Blockly - // tree that they were previously (or nearby). If so, the full - // path to the former default export will be listed. This path - // is only relevant to code that accesses the export via the - // namespace tree rather than by a named import. - // - // The given example implies that: - // module.name.Old === - // goog.require('module.name.new').defaultExport - // which may not be what what one expects but is very handy. - path: 'module.name.Old', - // If path is not given explicitly then it can be assumed to be - // `${module}.${export}`. - - // Modules which already had named exports can instead list - // information about exports which have been renamed or moved in - // the exports subsection, which is a map from old export name - // to object with info about the new export name. - exports: { - oldExportName: { - // No need to quote this. - - // If the export has been moved to a different module, that - // module is listed. - module: 'module.name.other', - - // If the export has been given a new name, that is listed. - export: 'newExportName', - - // As with default exports, if a named export has been - // reexported on the namespace tree somewhere other than at - // `${module}.${export}` then that can specified explicitly. - path: 'module.name.Old.oldExportName', - // This given example implies that code that previously - // accessed this export via module.name.Old.oldExportName - // can continue to do so; only code using named requires - // needs to update from - // goog.require('module.name.Old').oldExportName - // to - // goog.require('module.name.new').newExportName - }, - // More individual exports in this module can be listed here. - }, - }, - // More modules with renamings can be listed here. - }, - - '4.20201217.0': { - 'Blockly': { - exports: { - // bind/unbind events functions. See PR #4642 - EventData: {module: 'Blockly.eventHandling', export: 'Data'}, - bindEvent_: {module: 'Blockly.browserEvents', export: 'bind'}, - unbindEvent_: {module: 'Blockly.browserEvents', export: 'unbind'}, - bindEventWithChecks_: { - module: 'Blockly.browserEvents', - export: 'conditionalBind', - }, - }, - }, - }, - '6.20210701.0': { - 'Blockly': { - exports: { - // Align. - ALIGN_LEFT: { - module: 'Blockly.Input', - export: 'Align.LEFT', - path: 'Blockly.ALIGN_LEFT', - }, - ALIGN_CENTRE: { - module: 'Blockly.Input', - export: 'Align.CENTRE', - path: 'Blockly.ALIGN_CENTRE', - }, - ALIGN_RIGHT: { - module: 'Blockly.Input', - export: 'Align.RIGHT', - path: 'Blockly.ALIGN_RIGHT', - }, - // Clipboard. See PR #5237. - clipboardXml_: {module: 'Blockly.clipboard', export: 'xml'}, - clipboardSource_: {module: 'Blockly.clipboard', export: 'source'}, - clipboardTypeCounts_: { - module: 'Blockly.clipboard', - export: 'typeCounts', - }, - copy: {module: 'Blockly.clipboard'}, - paste: {module: 'Blockly.clipboard'}, - duplicate: {module: 'Blockly.clipboard'}, - - // mainWorkspace. See PR #5244. - mainWorkspace: { - module: 'Blockly.common', - get: 'getMainWorkspace', - set: 'setMainWorkspace', - }, - getMainWorkspace: {module: 'Blockly.common'}, - - // parentContainer, draggingConnections. See PR #5262. - parentContainer: { - module: 'Blockly.common', - get: 'getParentContainer', - set: 'setParentContainer', - }, - setParentContainer: {module: 'Blockly.common'}, - draggingConnections: {module: 'Blockly.common'}, - // Dialogs. See PR #5457. - alert: { - module: 'Blockly.dialog', - export: 'alert', - set: 'setAlert', - }, - confirm: { - module: 'Blockly.dialog', - export: 'confirm', - set: 'setConfirm', - }, - prompt: { - module: 'Blockly.dialog', - export: 'prompt', - set: 'setPrompt', - }, - // hueToHex. See PR #5462. - hueToHex: {module: 'Blockly.utils.colour'}, - // Blockly.hideChaff() became - // Blockly.common.getMainWorkspace().hideChaff(). See PR #5460. - - // selected. See PR #5489. - selected: { - module: 'Blockly.common', - get: 'getSelected', - set: 'setSelected', - }, - }, - }, - 'Blockly.Blocks': { - module: 'Blockly.blocks', - export: 'Blocks', // Previous default export now named. - path: 'Blockly.Blocks', // But still on tree with original name. - }, - 'Blockly.ContextMenu': { - exports: { - currentBlock: {get: 'getCurrentBlock', set: 'setCurrentBlock'}, - }, - }, - 'Blockly.Events': { - exports: { - recordUndo: {get: 'getRecordUndo', set: 'setRecordUndo'}, - }, - }, - 'Blockly.Tooltip': { - exports: { - DIV: {get: 'getDiv', set: 'setDiv'}, - visible: {get: 'isVisible'}, - }, - }, - 'Blockly.WidgetDiv': { - exports: { - DIV: {get: 'getDiv'}, - }, - }, - 'Blockly.connectionTypes': { - module: 'Blockly.ConnectionType', - export: 'ConnectionType', // Previous default export now named. - path: 'Blockly.ConnectionType', // Type reexported directly. - }, - 'Blockly.utils': { - exports: { - genUid: {module: 'Blockly.utils.idGenerator'}, - getScrollDelta: {module: 'Blockly.utils.browserEvents'}, - isTargetInput: {module: 'Blockly.utils.browserEvents'}, - isRightButton: {module: 'Blockly.utils.browserEvents'}, - mouseToSvg: {module: 'Blockly.utils.browserEvents'}, - }, - }, - 'Blockly.utils.global': { - export: 'globalThis', // Previous default export now named. - path: 'Blockly.utils.global', // But still exported under original name. - }, - 'Blockly.utils.IdGenerator': { - module: 'Blockly.utils.idGenerator', - }, - 'Blockly.utils.xml': { - exports: { - // document was a function before, too - not a static property - // or get accessor. - document: {export: 'getDocument'}, - }, - }, - }, - '7.20211209.0-beta.0': { - 'Blockly.Blocks.colour': {module: 'Blockly.blocks.colour'}, - // Blockly.Blocks.lists not previously provided. - 'Blockly.Blocks.logic': {module: 'Blockly.blocks.logic'}, - 'Blockly.Blocks.loops': {module: 'Blockly.blocks.loops'}, - 'Blockly.Blocks.math': {module: 'Blockly.blocks.math'}, - 'Blockly.Blocks.procedures': {module: 'Blockly.blocks.procedures'}, - 'Blockly.Blocks.texts': {module: 'Blockly.blocks.texts'}, - 'Blockly.Blocks.variables': {module: 'Blockly.blocks.variables'}, - // Blockly.Blocks.variablesDynamic not previously provided. - 'Blockly.utils': { - exports: { - screenToWsCoordinates: {module: 'Blockly.utils.svgMath'}, - getDocumentScroll: {module: 'Blockly.utils.svgMath'}, - getViewportBBox: {module: 'Blockly.utils.svgMath'}, - is3dSupported: {module: 'Blockly.utils.svgMath'}, - getRelativeXY: {module: 'Blockly.utils.svgMath'}, - getInjectionDivXY_: - {module: 'Blockly.utils.svgMath', export: 'getInjectionDivXY'}, - parseBlockColour: {module: 'Blockly.utils.parsing'}, - checkMessageReferences: {module: 'Blockly.utils.parsing'}, - replaceMessageReferences: {module: 'Blockly.utils.parsing'}, - tokenizeInterpolation: {module: 'Blockly.utils.parsing'}, - arrayRemove: {module: 'Blockly.utils.array', export: 'removeElem'}, - getBlockTypeCounts: - {module: 'Blockly.common', export: 'getBlockTypeCounts'}, - runAfterPageLoad: - {module: 'Blockly.Extensions', export: 'runAfterPageLoad'}, - }, - }, - 'Blockly.Events.Abstract': { - export: 'Abstract', - path: 'Blockly.Events.Abstract', - }, - 'Blockly.Events.BlockBase': { - export: 'BlockBase', - path: 'Blockly.Events.BlockBase', - }, - 'Blockly.Events.BlockChange': { - export: 'BlockChange', - path: 'Blockly.Events.BlockChange', - }, - 'Blockly.Events.BlockCreate': { - export: 'BlockCreate', - path: 'Blockly.Events.BlockCreate', - }, - 'Blockly.Events.BlockDelete': { - export: 'BlockDelete', - path: 'Blockly.Events.BlockDelete', - }, - 'Blockly.Events.BlockDrag': { - export: 'BlockDrag', - path: 'Blockly.Events.BlockDrag', - }, - 'Blockly.Events.BlockMove': { - export: 'BlockMove', - path: 'Blockly.Events.BlockMove', - }, - 'Blockly.Events.BubbleOpen': { - export: 'BubbleOpen', - path: 'Blockly.Events.BubbleOpen', - }, - 'Blockly.Events.Click': { - export: 'Click', - path: 'Blockly.Events.Click', - }, - 'Blockly.Events.CommentBase': { - export: 'CommentBase', - path: 'Blockly.Events.CommentBase', - }, - 'Blockly.Events.CommentChange': { - export: 'CommentChange', - path: 'Blockly.Events.CommentChange', - }, - 'Blockly.Events.CommentCreate': { - export: 'CommentCreate', - path: 'Blockly.Events.CommentCreate', - }, - 'Blockly.Events.CommentDelete': { - export: 'CommentDelete', - path: 'Blockly.Events.CommentDelete', - }, - 'Blockly.Events.CommentMove': { - export: 'CommentMove', - path: 'Blockly.Events.CommentMove', - }, - 'Blockly.Events.MarkerMove': { - export: 'MarkerMove', - path: 'Blockly.Events.MarkerMove', - }, - 'Blockly.Events.Selected': { - export: 'Selected', - path: 'Blockly.Events.Selected', - }, - 'Blockly.Events.ThemeChange': { - export: 'ThemeChange', - path: 'Blockly.Events.ThemeChange', - }, - 'Blockly.Events.ToolboxItemSelect': { - export: 'ToolboxItemSelect', - path: 'Blockly.Events.ToolboxItemSelect', - }, - 'Blockly.Events.TrashcanOpen': { - export: 'TrashcanOpen', - path: 'Blockly.Events.TrashcanOpen', - }, - 'Blockly.Events.Ui': { - export: 'Ui', - path: 'Blockly.Events.Ui', - }, - 'Blockly.Events.UiBase': { - export: 'UiBase', - path: 'Blockly.Events.UiBase', - }, - 'Blockly.Events.VarBase': { - export: 'VarBase', - path: 'Blockly.Events.VarBase', - }, - 'Blockly.Events.VarCreate': { - export: 'VarCreate', - path: 'Blockly.Events.VarCreate', - }, - 'Blockly.Events.VarDelete': { - export: 'VarDelete', - path: 'Blockly.Events.VarDelete', - }, - 'Blockly.Events.VarRename': { - export: 'VarRename', - path: 'Blockly.Events.VarRename', - }, - 'Blockly.Events.ViewportChange': { - export: 'ViewportChange', - path: 'Blockly.Events.ViewportChange', - }, - 'Blockly.Events.FinishedLoading': { - export: 'FinishedLoading', - path: 'Blockly.Events.FinishedLoading', - }, - 'Blockly.IASTNodeLocation': { - export: 'IASTNodeLocation', - path: 'Blockly.IASTNodeLocation', - }, - 'Blockly.IASTNodeLocationSvg': { - export: 'IASTNodeLocationSvg', - path: 'Blockly.IASTNodeLocationSvg', - }, - 'Blockly.IASTNodeLocationWithBlock': { - export: 'IASTNodeLocationWithBlock', - path: 'Blockly.IASTNodeLocationWithBlock', - }, - 'Blockly.IAutoHideable': { - export: 'IAutoHideable', - path: 'Blockly.IAutoHideable', - }, - 'Blockly.IBlockDragger': { - export: 'IBlockDragger', - path: 'Blockly.IBlockDragger', - }, - 'Blockly.IBoundedElement': { - export: 'IBoundedElement', - path: 'Blockly.IBoundedElement', - }, - 'Blockly.IBubble': { - export: 'IBubble', - path: 'Blockly.IBubble', - }, - 'Blockly.ICollapsibleToolboxItem': { - export: 'ICollapsibleToolboxItem', - path: 'Blockly.ICollapsibleToolboxItem', - }, - 'Blockly.IComponent': { - export: 'IComponent', - path: 'Blockly.IComponent', - }, - 'Blockly.IConnectionChecker': { - export: 'IConnectionChecker', - path: 'Blockly.IConnectionChecker', - }, - 'Blockly.IContextMenu': { - export: 'IContextMenu', - path: 'Blockly.IContextMenu', - }, - 'Blockly.ICopyable': { - export: 'ICopyable', - path: 'Blockly.ICopyable', - }, - 'Blockly.IDeletable': { - export: 'IDeletable', - path: 'Blockly.IDeletable', - }, - 'Blockly.IDeleteArea': { - export: 'IDeleteArea', - path: 'Blockly.IDeleteArea', - }, - 'Blockly.IDragTarget': { - export: 'IDragTarget', - path: 'Blockly.IDragTarget', - }, - 'Blockly.IDraggable': { - export: 'IDraggable', - path: 'Blockly.IDraggable', - }, - 'Blockly.IFlyout': { - export: 'IFlyout', - path: 'Blockly.IFlyout', - }, - 'Blockly.IKeyboardAccessible': { - export: 'IKeyboardAccessible', - path: 'Blockly.IKeyboardAccessible', - }, - 'Blockly.IMetricsManager': { - export: 'IMetricsManager', - path: 'Blockly.IMetricsManager', - }, - 'Blockly.IMovable': { - export: 'IMovable', - path: 'Blockly.IMovable', - }, - 'Blockly.IPositionable': { - export: 'IPositionable', - path: 'Blockly.IPositionable', - }, - 'Blockly.IRegistrable': { - export: 'IRegistrable', - path: 'Blockly.IRegistrable', - }, - 'Blockly.IRegistrableField': { - export: 'IRegistrableField', - path: 'Blockly.IRegistrableField', - }, - 'Blockly.ISelectable': { - export: 'ISelectable', - path: 'Blockly.ISelectable', - }, - 'Blockly.ISelectableToolboxItem': { - export: 'ISelectableToolboxItem', - path: 'Blockly.ISelectableToolboxItem', - }, - 'Blockly.IStyleable': { - export: 'IStyleable', - path: 'Blockly.IStyleable', - }, - 'Blockly.IToolbox': { - export: 'IToolbox', - path: 'Blockly.IToolbox', - }, - 'Blockly.IToolboxItem': { - export: 'IToolboxItem', - path: 'Blockly.IToolboxItem', - }, - 'Blockly.blockRendering.ConstantProvider': { - export: 'ConstantProvider', - path: 'Blockly.blockRendering.ConstantProvider', - }, - 'Blockly.blockRendering.Debug': { - export: 'Debug', - path: 'Blockly.blockRendering.Debug', - }, - 'Blockly.blockRendering.Drawer': { - export: 'Drawer', - path: 'Blockly.blockRendering.Drawer', - }, - 'Blockly.blockRendering.IPathObject': { - export: 'IPathObject', - path: 'Blockly.blockRendering.IPathObject', - }, - 'Blockly.blockRendering.RenderInfo': { - export: 'RenderInfo', - path: 'Blockly.blockRendering.RenderInfo', - }, - 'Blockly.blockRendering.MarkerSvg': { - export: 'MarkerSvg', - path: 'Blockly.blockRendering.MarkerSvg', - }, - 'Blockly.blockRendering.PathObject': { - export: 'PathObject', - path: 'Blockly.blockRendering.PathObject', - }, - 'Blockly.blockRendering.Renderer': { - export: 'Renderer', - path: 'Blockly.blockRendering.Renderer', - }, - 'Blockly.geras.InlineInput': { - export: 'InlineInput', - path: 'Blockly.geras.InlineInput', - }, - 'Blockly.geras.StatementInput': { - export: 'StatementInput', - path: 'Blockly.geras.StatementInput', - }, - 'Blockly.geras.ConstantProvider': { - export: 'ConstantProvider', - path: 'Blockly.geras.ConstantProvider', - }, - 'Blockly.geras.Drawer': { - export: 'Drawer', - path: 'Blockly.geras.Drawer', - }, - 'Blockly.geras.HighlightConstantProvider': { - export: 'HighlightConstantProvider', - path: 'Blockly.geras.HighlightConstantProvider', - }, - 'Blockly.geras.Highlighter': { - export: 'Highlighter', - path: 'Blockly.geras.Highlighter', - }, - 'Blockly.geras.RenderInfo': { - export: 'RenderInfo', - path: 'Blockly.geras.RenderInfo', - }, - 'Blockly.geras.PathObject': { - export: 'PathObject', - path: 'Blockly.geras.PathObject', - }, - 'Blockly.geras.Renderer': { - export: 'Renderer', - path: 'Blockly.geras.Renderer', - }, - 'Blockly.blockRendering.Measurable': { - export: 'Measurable', - path: 'Blockly.blockRendering.Measurable', - }, - 'Blockly.blockRendering.BottomRow': { - export: 'BottomRow', - path: 'Blockly.blockRendering.BottomRow', - }, - 'Blockly.blockRendering.Connection': { - export: 'Connection', - path: 'Blockly.blockRendering.Connection', - }, - 'Blockly.blockRendering.ExternalValueInput': { - export: 'ExternalValueInput', - path: 'Blockly.blockRendering.ExternalValueInput', - }, - 'Blockly.blockRendering.Field': { - export: 'Field', - path: 'Blockly.blockRendering.Field', - }, - 'Blockly.blockRendering.Hat': { - export: 'Hat', - path: 'Blockly.blockRendering.Hat', - }, - 'Blockly.blockRendering.Icon': { - export: 'Icon', - path: 'Blockly.blockRendering.Icon', - }, - 'Blockly.blockRendering.InRowSpacer': { - export: 'InRowSpacer', - path: 'Blockly.blockRendering.InRowSpacer', - }, - 'Blockly.blockRendering.InlineInput': { - export: 'InlineInput', - path: 'Blockly.blockRendering.InlineInput', - }, - 'Blockly.blockRendering.InputConnection': { - export: 'InputConnection', - path: 'Blockly.blockRendering.InputConnection', - }, - 'Blockly.blockRendering.InputRow': { - export: 'InputRow', - path: 'Blockly.blockRendering.InputRow', - }, - 'Blockly.blockRendering.JaggedEdge': { - export: 'JaggedEdge', - path: 'Blockly.blockRendering.JaggedEdge', - }, - 'Blockly.blockRendering.NextConnection': { - export: 'NextConnection', - path: 'Blockly.blockRendering.NextConnection', - }, - 'Blockly.blockRendering.OutputConnection': { - export: 'OutputConnection', - path: 'Blockly.blockRendering.OutputConnection', - }, - 'Blockly.blockRendering.PreviousConnection': { - export: 'PreviousConnection', - path: 'Blockly.blockRendering.PreviousConnection', - }, - 'Blockly.blockRendering.RoundCorner': { - export: 'RoundCorner', - path: 'Blockly.blockRendering.RoundCorner', - }, - 'Blockly.blockRendering.Row': { - export: 'Row', - path: 'Blockly.blockRendering.Row', - }, - 'Blockly.blockRendering.SpacerRow': { - export: 'SpacerRow', - path: 'Blockly.blockRendering.SpacerRow', - }, - 'Blockly.blockRendering.SquareCorner': { - export: 'SquareCorner', - path: 'Blockly.blockRendering.SquareCorner', - }, - 'Blockly.blockRendering.StatementInput': { - export: 'StatementInput', - path: 'Blockly.blockRendering.StatementInput', - }, - 'Blockly.blockRendering.TopRow': { - export: 'TopRow', - path: 'Blockly.blockRendering.TopRow', - }, - 'Blockly.blockRendering.Types': { - export: 'Types', - path: 'Blockly.blockRendering.Types', - }, - 'Blockly.minimalist.ConstantProvider': { - export: 'ConstantProvider', - path: 'Blockly.minimalist.ConstantProvider', - }, - 'Blockly.minimalist.Drawer': { - export: 'Drawer', - path: 'Blockly.minimalist.Drawer', - }, - 'Blockly.minimalist.RenderInfo': { - export: 'RenderInfo', - path: 'Blockly.minimalist.RenderInfo', - }, - 'Blockly.minimalist.Renderer': { - export: 'Renderer', - path: 'Blockly.minimalist.Renderer', - }, - 'Blockly.thrasos.RenderInfo': { - export: 'RenderInfo', - path: 'Blockly.thrasos.RenderInfo', - }, - 'Blockly.thrasos.Renderer': { - export: 'Renderer', - path: 'Blockly.thrasos.Renderer', - }, - 'Blockly.zelos.BottomRow': { - export: 'BottomRow', - path: 'Blockly.zelos.BottomRow', - }, - 'Blockly.zelos.StatementInput': { - export: 'StatementInput', - path: 'Blockly.zelos.StatementInput', - }, - 'Blockly.zelos.RightConnectionShape': { - export: 'RightConnectionShape', - path: 'Blockly.zelos.RightConnectionShape', - }, - 'Blockly.zelos.TopRow': { - export: 'TopRow', - path: 'Blockly.zelos.TopRow', - }, - 'Blockly.zelos.ConstantProvider': { - export: 'ConstantProvider', - path: 'Blockly.zelos.ConstantProvider', - }, - 'Blockly.zelos.Drawer': { - export: 'Drawer', - path: 'Blockly.zelos.Drawer', - }, - 'Blockly.zelos.RenderInfo': { - export: 'RenderInfo', - path: 'Blockly.zelos.RenderInfo', - }, - 'Blockly.zelos.MarkerSvg': { - export: 'MarkerSvg', - path: 'Blockly.zelos.MarkerSvg', - }, - 'Blockly.zelos.PathObject': { - export: 'PathObject', - path: 'Blockly.zelos.PathObject', - }, - 'Blockly.zelos.Renderer': { - export: 'Renderer', - path: 'Blockly.zelos.Renderer', - }, - 'Blockly.Themes.Classic': { - export: 'Classic', - path: 'Blockly.Themes.Classic', - }, - 'Blockly.Themes.Zelos': { - export: 'Zelos', - path: 'Blockly.Themes.Zelos', - }, - 'Blockly.ToolboxCategory': { - export: 'ToolboxCategory', - path: 'Blockly.ToolboxCategory', - }, - 'Blockly.CollapsibleToolboxCategory': { - export: 'CollapsibleToolboxCategory', - path: 'Blockly.CollapsibleToolboxCategory', - }, - 'Blockly.ToolboxSeparator': { - export: 'ToolboxSeparator', - path: 'Blockly.ToolboxSeparator', - }, - 'Blockly.Toolbox': { - export: 'Toolbox', - path: 'Blockly.Toolbox', - }, - 'Blockly.ToolboxItem': { - export: 'ToolboxItem', - path: 'Blockly.ToolboxItem', - }, - 'Blockly.utils.Coordinate': { - export: 'Coordinate', - path: 'Blockly.utils.Coordinate', - }, - 'Blockly.utils.KeyCodes': { - export: 'KeyCodes', - path: 'Blockly.utils.KeyCodes', - }, - 'Blockly.utils.Metrics': { - export: 'Metrics', - path: 'Blockly.utils.Metrics', - }, - 'Blockly.utils.Rect': { - export: 'Rect', - path: 'Blockly.utils.Rect', - }, - 'Blockly.utils.Size': { - export: 'Size', - path: 'Blockly.utils.Size', - }, - 'Blockly.utils.Svg': { - export: 'Svg', - path: 'Blockly.utils.Svg', - }, - 'Blockly.BlocklyOptions': { - export: 'BlocklyOptions', - path: 'Blockly.BlocklyOptions', - }, - 'Blockly.Bubble': { - export: 'Bubble', - path: 'Blockly.Bubble', - }, - 'Blockly.BubbleDragger': { - export: 'BubbleDragger', - path: 'Blockly.BubbleDragger', - }, - 'Blockly.Comment': { - export: 'Comment', - path: 'Blockly.Comment', - }, - 'Blockly.ComponentManager': { - export: 'ComponentManager', - path: 'Blockly.ComponentManager', - }, - 'Blockly.Connection': { - export: 'Connection', - path: 'Blockly.Connection', - }, - 'Blockly.ConnectionChecker': { - export: 'ConnectionChecker', - path: 'Blockly.ConnectionChecker', - }, - 'Blockly.ConnectionDB': { - export: 'ConnectionDB', - path: 'Blockly.ConnectionDB', - }, - 'Blockly.ContextMenuRegistry': { - export: 'ContextMenuRegistry', - path: 'Blockly.ContextMenuRegistry', - }, - 'Blockly.DeleteArea': { - export: 'DeleteArea', - path: 'Blockly.DeleteArea', - }, - 'Blockly.DragTarget': { - export: 'DragTarget', - path: 'Blockly.DragTarget', - }, - 'Blockly.DropDownDiv': { - export: 'DropDownDiv', - path: 'Blockly.DropDownDiv', - }, - 'Blockly.Field': { - export: 'Field', - path: 'Blockly.Field', - }, - 'Blockly.FieldAngle': { - export: 'FieldAngle', - path: 'Blockly.FieldAngle', - }, - 'Blockly.FieldCheckbox': { - export: 'FieldCheckbox', - path: 'Blockly.FieldCheckbox', - }, - 'Blockly.FieldColour': { - export: 'FieldColour', - path: 'Blockly.FieldColour', - }, - 'Blockly.FieldDropdown': { - export: 'FieldDropdown', - path: 'Blockly.FieldDropdown', - }, - 'Blockly.FieldImage': { - export: 'FieldImage', - path: 'Blockly.FieldImage', - }, - 'Blockly.FieldLabel': { - export: 'FieldLabel', - path: 'Blockly.FieldLabel', - }, - 'Blockly.FieldLabelSerializable': { - export: 'FieldLabelSerializable', - path: 'Blockly.FieldLabelSerializable', - }, - 'Blockly.FieldMultilineInput': { - export: 'FieldMultilineInput', - path: 'Blockly.FieldMultilineInput', - }, - 'Blockly.FieldNumber': { - export: 'FieldNumber', - path: 'Blockly.FieldNumber', - }, - 'Blockly.FieldTextInput': { - export: 'FieldTextInput', - path: 'Blockly.FieldTextInput', - }, - 'Blockly.FieldVariable': { - export: 'FieldVariable', - path: 'Blockly.FieldVariable', - }, - 'Blockly.Flyout': { - export: 'Flyout', - path: 'Blockly.Flyout', - }, - 'Blockly.FlyoutButton': { - export: 'FlyoutButton', - path: 'Blockly.FlyoutButton', - }, - 'Blockly.HorizontalFlyout': { - export: 'HorizontalFlyout', - path: 'Blockly.HorizontalFlyout', - }, - 'Blockly.FlyoutMetricsManager': { - export: 'FlyoutMetricsManager', - path: 'Blockly.FlyoutMetricsManager', - }, - 'Blockly.VerticalFlyout': { - export: 'VerticalFlyout', - path: 'Blockly.VerticalFlyout', - }, - 'Blockly.Generator': { - export: 'Generator', - path: 'Blockly.Generator', - }, - 'Blockly.Gesture': { - export: 'Gesture', - path: 'Blockly.Gesture', - }, - 'Blockly.Grid': { - export: 'Grid', - path: 'Blockly.Grid', - }, - 'Blockly.Icon': { - export: 'Icon', - path: 'Blockly.Icon', - }, - 'Blockly.inject': { - export: 'inject', - path: 'Blockly.inject', - }, - 'Blockly.Input': { - export: 'Input', - path: 'Blockly.Input', - }, - 'Blockly.inputTypes': { - export: 'inputTypes', - path: 'Blockly.inputTypes', - }, - 'Blockly.InsertionMarkerManager': { - export: 'InsertionMarkerManager', - path: 'Blockly.InsertionMarkerManager', - }, - 'Blockly.MarkerManager': { - export: 'MarkerManager', - path: 'Blockly.MarkerManager', - }, - 'Blockly.Menu': { - export: 'Menu', - path: 'Blockly.Menu', - }, - 'Blockly.MenuItem': { - export: 'MenuItem', - path: 'Blockly.MenuItem', - }, - 'Blockly.MetricsManager': { - export: 'MetricsManager', - path: 'Blockly.MetricsManager', - }, - 'Blockly.Msg': { - export: 'Msg', - path: 'Blockly.Msg', - }, - 'Blockly.Mutator': { - export: 'Mutator', - path: 'Blockly.Mutator', - }, - 'Blockly.Names': { - export: 'Names', - path: 'Blockly.Names', - }, - 'Blockly.Options': { - export: 'Options', - path: 'Blockly.Options', - }, - 'Blockly.RenderedConnection': { - export: 'RenderedConnection', - path: 'Blockly.RenderedConnection', - }, - 'Blockly.Scrollbar': { - export: 'Scrollbar', - path: 'Blockly.Scrollbar', - }, - 'Blockly.ScrollbarPair': { - export: 'ScrollbarPair', - path: 'Blockly.ScrollbarPair', - }, - 'Blockly.ShortcutRegistry': { - export: 'ShortcutRegistry', - path: 'Blockly.ShortcutRegistry', - }, - 'Blockly.Theme': { - export: 'Theme', - path: 'Blockly.Theme', - }, - 'Blockly.ThemeManager': { - export: 'ThemeManager', - path: 'Blockly.ThemeManager', - }, - 'Blockly.TouchGesture': { - export: 'TouchGesture', - path: 'Blockly.TouchGesture', - }, - 'Blockly.Trashcan': { - export: 'Trashcan', - path: 'Blockly.Trashcan', - }, - 'Blockly.VariableMap': { - export: 'VariableMap', - path: 'Blockly.VariableMap', - }, - 'Blockly.VariableModel': { - export: 'VariableModel', - path: 'Blockly.VariableModel', - }, - 'Blockly.Warning': { - export: 'Warning', - path: 'Blockly.Warning', - }, - 'Blockly.Workspace': { - export: 'Workspace', - path: 'Blockly.Workspace', - }, - 'Blockly.WorkspaceAudio': { - export: 'WorkspaceAudio', - path: 'Blockly.WorkspaceAudio', - }, - 'Blockly.WorkspaceComment': { - export: 'WorkspaceComment', - path: 'Blockly.WorkspaceComment', - }, - 'Blockly.WorkspaceCommentSvg': { - export: 'WorkspaceCommentSvg', - path: 'Blockly.WorkspaceCommentSvg', - }, - 'Blockly.WorkspaceDragSurfaceSvg': { - export: 'WorkspaceDragSurfaceSvg', - path: 'Blockly.WorkspaceDragSurfaceSvg', - }, - 'Blockly.WorkspaceDragger': { - export: 'WorkspaceDragger', - path: 'Blockly.WorkspaceDragger', - }, - 'Blockly.WorkspaceSvg': { - export: 'WorkspaceSvg', - path: 'Blockly.WorkspaceSvg', - }, - 'Blockly.ZoomControls': { - export: 'ZoomControls', - path: 'Blockly.ZoomControls', - }, - 'Blockly': { - exports: { - svgSize: {module: 'Blockly.utils.svgMath'}, - resizeSvgContents: {module: 'Blockly.WorkspaecSvg'}, - defineBlocksWithJsonArray: {module: 'Blockly.common'}, - isNumber: {module: 'Blockly.utils.string'}, - }, - }, - }, - '7.20211209.0': { - 'Blockly': { - exports: { - DRAG_RADIUS: { - module: 'Blockly.config', - export: 'config.dragRadius', - }, - FLYOUT_DRAG_RADIUS: { - module: 'Blockly.config', - export: 'config.flyoutDragRadius', - }, - SNAP_RADIUS: { - module: 'Blockly.config', - export: 'config.snapRadius', - }, - CONNECTING_SNAP_RADIUS: { - module: 'Blockly.config', - export: 'config.connectingSnapRadius', - }, - CURRENT_CONNECTION_PREFERENCE: { - module: 'Blockly.config', - export: 'config.currentConnectionPreference', - }, - BUMP_DELAY: { - module: 'Blockly.config', - export: 'config.bumpDelay', - }, - SPRITE: { - module: 'Blockly.constants', - }, - }, - }, - 'Blockly.blocks.all': { - module: 'Blockly.libraryBlocks', - }, - 'Blockly.blocks.colour': { - module: 'Blockly.libraryBlocks.colour', - }, - 'Blockly.blocks.lists': { - module: 'Blockly.libraryBlocks.lists', - }, - 'Blockly.blocks.logic': { - module: 'Blockly.libraryBlocks.logic', - }, - 'Blockly.blocks.loops': { - module: 'Blockly.libraryBlocks.loops', - }, - 'Blockly.blocks.math': { - module: 'Blockly.libraryBlocks.math', - }, - 'Blockly.blocks.procedures': { - module: 'Blockly.libraryBlocks.procedures', - }, - 'Blockly.blocks.text': { - module: 'Blockly.libraryBlocks.text', - }, - 'Blockly.blocks.variables': { - module: 'Blockly.libraryBlocks.variables', - }, - 'Blockly.blocks.variablesDynamic': { - module: 'Blockly.libraryBlocks.variablesDynamic', - }, - 'Blockly.DropDownDiv': { - module: 'Blockly.dropDownDiv', - path: 'Blockly.DropDownDiv', - }, - }, -}; - -exports.renamings = renamings; diff --git a/scripts/migration/renamings.json5 b/scripts/migration/renamings.json5 new file mode 100644 index 00000000000..4935f9a365b --- /dev/null +++ b/scripts/migration/renamings.json5 @@ -0,0 +1,1339 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Collected information about modules and module + * exports that have been renamed between versions. + * + * This file is in JSON5 format; see https://json5.org/. + */ + +{ + // Example entry: + '0.0.0': [ // Version that includes the rename. + // Each entry in the array is a module. + // All of the properties are optional. + { + // The name that the module had before this version. + oldName: 'old.module.name', + + // The name that the module now has in this version. + newName: 'new.module.name', + + // If a module had a default export and now has a named export, + // the name of the named export can be given here. + newExport: 'newNameForDefaultExport', + + // The old location of this module on the Blockly tree (the + // mega-object that people access if they are importing all of + // Blockly). Usually this is the same as the oldName and can be + // omitted. + oldPath: 'old.path.on.Blockly.tree', + + // The new location of this module on the Blockly tree. To be + // backwards compatible with people accessing the Blockly tree, + // this should be the same as the oldPath. If omitted, newPath + // is assumed to be the same newName. + newPath: 'new.path.on.Blockly.tree', + + // Each entry in this map is the old name of a named export. + exports: { + // The name that the export had before this version. + // All of the properties on this object are optional. + 'oldExportName': { + // The new module that the export is in in this version. If + // this is not provided, the newModule is assumed to be the + // parent module's newPath. + newModule: 'new.module.name', + + // The name that the export now has in this version. + newExport: 'newExportName', + + // The old location of this module on the Blockly tree. + // If omitted, oldPath defaults to + // .. + oldPath: 'old.path.on.Blockly.tree', + + // The new location of this module on the Blockly tree. To + // be backwards compatible with people accessing the + // Blockkly tree, this should be the same as the oldPath. + // Defaults to `${newModule}.${newExport}`. + newPath: 'new.path.on.Blockly.tree', + + // If a named export has been changed to a private variable + // with a get method, this is the name of the get method. + getMethod: 'getMethodName', + + // If a named export has been changed to a private variable + // with a set method, this is the name of the set method. + setMethod: 'setMethodName', + }, + + // This file can also document the renaming of a property or + // sub-property of an (object-valued) named export. + 'exportExport.oldProperty': { + newExport: 'newExport.newProperty', + // Additional options as above. + }, + + // Or promotion of property to named export, etc. + 'exportExport.oldProperty': { + newExport: 'newTopLevelExport', + }, + }, + }, + ], + + '5.20210325.0': [ + { + oldName: 'Blockly', + exports: { + // bind/unbind events functions. See PR #4642 + EventData: {newModule: 'Blockly.eventHandling', newExport: 'Data'}, + bindEvent_: {newModule: 'Blockly.browserEvents', newExport: 'bind'}, + unbindEvent_: {newModule: 'Blockly.browserEvents', newExport: 'unbind'}, + bindEventWithChecks_: { + newModule: 'Blockly.browserEvents', + newExport: 'conditionalBind', + }, + }, + } + ], + + '7.20211209.0-beta.0': [ + { + oldName: 'Blockly', + exports: { + // Clipboard. See PR #5237. + clipboardXml_: {newModule: 'Blockly.clipboard', newExport: 'xml'}, + clipboardSource_: {newModule: 'Blockly.clipboard', newExport: 'source'}, + clipboardTypeCounts_: { + newModule: 'Blockly.clipboard', + newExport: 'typeCounts', + }, + copy: {newModule: 'Blockly.clipboard'}, + paste: {newModule: 'Blockly.clipboard'}, + duplicate: {newModule: 'Blockly.clipboard'}, + + // mainWorkspace. See PR #5244. + mainWorkspace: { + newModule: 'Blockly.common', + getMethod: 'getMainWorkspace', + setMethod: 'setMainWorkspace', + }, + getMainWorkspace: {newModule: 'Blockly.common'}, + + // parentContainer, draggingConnections. See PR #5262. + parentContainer: { + newModule: 'Blockly.common', + getMethod: 'getParentContainer', + setMethod: 'setParentContainer', + }, + setParentContainer: {newModule: 'Blockly.common'}, + draggingConnections: {newModule: 'Blockly.common'}, + + // Dialogs. See PR #5457. + alert: { + newModule: 'Blockly.dialog', + newExport: 'alert', + setMethod: 'setAlert', + }, + confirm: { + newModule: 'Blockly.dialog', + newExport: 'confirm', + setMethod: 'setConfirm', + }, + prompt: { + newModule: 'Blockly.dialog', + newExport: 'prompt', + setMethod: 'setPrompt', + }, + // hueToHex. See PR #5462. + hueToHex: {newModule: 'Blockly.utils.colour'}, + // Blockly.hideChaff() became + // Blockly.common.getMainWorkspace().hideChaff(). See PR #5460. + + // selected. See PR #5489. + selected: { + newModule: 'Blockly.common', + getMethod: 'getSelected', + setMethod: 'setSelected', + }, + } + }, + { + oldName: 'Blockly.Blocks', + newName: 'Blockly.blocks', + newExport: 'Blocks', // Previous default export now named. + newPath: 'Blockly.Blocks', // But still on tree with original name. + }, + { + oldName: 'Blockly.ContextMenu', + exports: { + currentBlock: { + getMethod: 'getCurrentBlock', + setMethod: 'setCurrentBlock' + }, + }, + }, + { + oldName: 'Blockly.Events', + exports: { + recordUndo: {getMethod: 'getRecordUndo', setMethod: 'setRecordUndo'}, + }, + }, + { + oldName: 'Blockly.Tooltip', + exports: { + DIV: {getMethod: 'getDiv', setMethod: 'setDiv'}, + visible: {getMethod: 'isVisible'}, + }, + }, + { + oldName: 'Blockly.WidgetDiv', + exports: { + DIV: {getMethod: 'getDiv'}, + }, + }, + { + oldName: 'Blockly.connectionTypes', + newName: 'Blockly.ConnectionType', + newExport: 'ConnectionType', // Previous default export now named. + newPath: 'Blockly.ConnectionType', // Type reexported directly. + }, + { + oldName: 'Blockly.utils', + exports: { + genUid: {newModule: 'Blockly.utils.idGenerator'}, + getScrollDelta: {newModule: 'Blockly.utils.browserEvents'}, + isTargetInput: {newModule: 'Blockly.utils.browserEvents'}, + isRightButton: {newModule: 'Blockly.utils.browserEvents'}, + mouseToSvg: {newModule: 'Blockly.utils.browserEvents'}, + }, + }, + { + oldName: 'Blockly.utils.global', + newExport: 'globalThis', + newPath: 'Blockly.utils.global', + }, + { + oldName: 'Blockly.utils.IdGenerator', + newName: 'Blockly.utils.idGenerator', + }, + { + oldName: 'Blockly.utils.xml', + exports: { + // document was a function before, too - not a static property + // or get accessor. + document: {newExport: 'getDocument'}, + }, + }, + ], + + '7.20211209.0': [ + { + oldName: 'Blockly', + exports: { + // Align. + ALIGN_LEFT: { + newModule: 'Blockly.Input', + newExport: 'Align.LEFT', + newPath: 'Blockly.ALIGN_LEFT', + }, + ALIGN_CENTRE: { + newModule: 'Blockly.Input', + newExport: 'Align.CENTRE', + newPath: 'Blockly.ALIGN_CENTRE', + }, + ALIGN_RIGHT: { + newModule: 'Blockly.Input', + newExport: 'Align.RIGHT', + newPath: 'Blockly.ALIGN_RIGHT', + }, + + svgSize: {newModule: 'Blockly.utils.svgMath'}, + resizeSvgContents: {newModule: 'Blockly.WorkspaecSvg'}, + defineBlocksWithJsonArray: {newModule: 'Blockly.common'}, + isNumber: {newModule: 'Blockly.utils.string'}, + } + }, + + { + oldName: 'Blockly.Blocks.colour', + newName: 'Blockly.blocks.colour' + }, + // Blockly.Blocks.lists not previously provided. + { + oldName: 'Blockly.Blocks.logic', + newName: 'Blockly.blocks.logic' + }, + { + oldName: 'Blockly.Blocks.loops', + newName: 'Blockly.blocks.loops' + }, + { + oldName: 'Blockly.Blocks.math', + newName: 'Blockly.blocks.math' + }, + { + oldName: 'Blockly.Blocks.procedures', + newName: 'Blockly.blocks.procedures' + }, + { + oldName: 'Blockly.Blocks.texts', + newName: 'Blockly.blocks.texts' + }, + { + oldName: 'Blockly.Blocks.variables', + newName: 'Blockly.blocks.variables' + }, + // Blockly.Blocks.variablesDynamic not previously provided. + + { + oldName: 'Blockly.utils', + exports: { + screenToWsCoordinates: {newModule: 'Blockly.utils.svgMath'}, + getDocumentScroll: {newModule: 'Blockly.utils.svgMath'}, + getViewportBBox: {newModule: 'Blockly.utils.svgMath'}, + is3dSupported: {newModule: 'Blockly.utils.svgMath'}, + getRelativeXY: {newModule: 'Blockly.utils.svgMath'}, + getInjectionDivXY_: { + newModule: 'Blockly.utils.svgMath', + newExport: 'getInjectionDivXY' + }, + parseBlockColour: {newModule: 'Blockly.utils.parsing'}, + checkMessageReferences: {newModule: 'Blockly.utils.parsing'}, + replaceMessageReferences: {newModule: 'Blockly.utils.parsing'}, + tokenizeInterpolation: {newModule: 'Blockly.utils.parsing'}, + arrayRemove: { + newModule: 'Blockly.utils.array', + newExport: 'removeElem' + }, + getBlockTypeCounts: + {newModule: 'Blockly.common', newExport: 'getBlockTypeCounts'}, + runAfterPageLoad: + {newModule: 'Blockly.Extensions', newExport: 'runAfterPageLoad'}, + }, + }, + + // Default exports to named exports. + { + oldName: 'Blockly.Events.Abstract', + newExport: 'Abstract', + newPath: 'Blockly.Events.Abstract', + }, + { + oldName: 'Blockly.Events.BlockBase', + newExport: 'BlockBase', + newPath: 'Blockly.Events.BlockBase', + }, + { + oldName: 'Blockly.Events.BlockChange', + newExport: 'BlockChange', + newPath: 'Blockly.Events.BlockChange', + }, + { + oldName: 'Blockly.Events.BlockCreate', + newExport: 'BlockCreate', + newPath: 'Blockly.Events.BlockCreate', + }, + { + oldName: 'Blockly.Events.BlockDelete', + newExport: 'BlockDelete', + newPath: 'Blockly.Events.BlockDelete', + }, + { + oldName: 'Blockly.Events.BlockDrag', + newExport: 'BlockDrag', + newPath: 'Blockly.Events.BlockDrag', + }, + { + oldName: 'Blockly.Events.BlockMove', + newExport: 'BlockMove', + newPath: 'Blockly.Events.BlockMove', + }, + { + oldName: 'Blockly.Events.BubbleOpen', + newExport: 'BubbleOpen', + newPath: 'Blockly.Events.BubbleOpen', + }, + { + oldName: 'Blockly.Events.Click', + newExport: 'Click', + newPath: 'Blockly.Events.Click', + }, + { + oldName: 'Blockly.Events.CommentBase', + newExport: 'CommentBase', + newPath: 'Blockly.Events.CommentBase', + }, + { + oldName: 'Blockly.Events.CommentChange', + newExport: 'CommentChange', + newPath: 'Blockly.Events.CommentChange', + }, + { + oldName: 'Blockly.Events.CommentCreate', + newExport: 'CommentCreate', + newPath: 'Blockly.Events.CommentCreate', + }, + { + oldName: 'Blockly.Events.CommentDelete', + newExport: 'CommentDelete', + newPath: 'Blockly.Events.CommentDelete', + }, + { + oldName: 'Blockly.Events.CommentMove', + newExport: 'CommentMove', + newPath: 'Blockly.Events.CommentMove', + }, + { + oldName: 'Blockly.Events.MarkerMove', + newExport: 'MarkerMove', + newPath: 'Blockly.Events.MarkerMove', + }, + { + oldName: 'Blockly.Events.Selected', + newExport: 'Selected', + newPath: 'Blockly.Events.Selected', + }, + { + oldName: 'Blockly.Events.ThemeChange', + newExport: 'ThemeChange', + newPath: 'Blockly.Events.ThemeChange', + }, + { + oldName: 'Blockly.Events.ToolboxItemSelect', + newExport: 'ToolboxItemSelect', + newPath: 'Blockly.Events.ToolboxItemSelect', + }, + { + oldName: 'Blockly.Events.TrashcanOpen', + newExport: 'TrashcanOpen', + newPath: 'Blockly.Events.TrashcanOpen', + }, + { + oldName: 'Blockly.Events.Ui', + newExport: 'Ui', + newPath: 'Blockly.Events.Ui', + }, + { + oldName: 'Blockly.Events.UiBase', + newExport: 'UiBase', + newPath: 'Blockly.Events.UiBase', + }, + { + oldName: 'Blockly.Events.VarBase', + newExport: 'VarBase', + newPath: 'Blockly.Events.VarBase', + }, + { + oldName: 'Blockly.Events.VarCreate', + newExport: 'VarCreate', + newPath: 'Blockly.Events.VarCreate', + }, + { + oldName: 'Blockly.Events.VarDelete', + newExport: 'VarDelete', + newPath: 'Blockly.Events.VarDelete', + }, + { + oldName: 'Blockly.Events.VarRename', + newExport: 'VarRename', + newPath: 'Blockly.Events.VarRename', + }, + { + oldName: 'Blockly.Events.ViewportChange', + newExport: 'ViewportChange', + newPath: 'Blockly.Events.ViewportChange', + }, + { + oldName: 'Blockly.Events.FinishedLoading', + newExport: 'FinishedLoading', + newPath: 'Blockly.Events.FinishedLoading', + }, + { + oldName: 'Blockly.IASTNodeLocation', + newExport: 'IASTNodeLocation', + newPath: 'Blockly.IASTNodeLocation', + }, + { + oldName: 'Blockly.IASTNodeLocationSvg', + newExport: 'IASTNodeLocationSvg', + newPath: 'Blockly.IASTNodeLocationSvg', + }, + { + oldName: 'Blockly.IASTNodeLocationWithBlock', + newExport: 'IASTNodeLocationWithBlock', + newPath: 'Blockly.IASTNodeLocationWithBlock', + }, + { + oldName: 'Blockly.IAutoHideable', + newExport: 'IAutoHideable', + newPath: 'Blockly.IAutoHideable', + }, + { + oldName: 'Blockly.IBlockDragger', + newExport: 'IBlockDragger', + newPath: 'Blockly.IBlockDragger', + }, + { + oldName: 'Blockly.IBoundedElement', + newExport: 'IBoundedElement', + newPath: 'Blockly.IBoundedElement', + }, + { + oldName: 'Blockly.IBubble', + newExport: 'IBubble', + newPath: 'Blockly.IBubble', + }, + { + oldName: 'Blockly.ICollapsibleToolboxItem', + newExport: 'ICollapsibleToolboxItem', + newPath: 'Blockly.ICollapsibleToolboxItem', + }, + { + oldName: 'Blockly.IComponent', + newExport: 'IComponent', + newPath: 'Blockly.IComponent', + }, + { + oldName: 'Blockly.IConnectionChecker', + newExport: 'IConnectionChecker', + newPath: 'Blockly.IConnectionChecker', + }, + { + oldName: 'Blockly.IContextMenu', + newExport: 'IContextMenu', + newPath: 'Blockly.IContextMenu', + }, + { + oldName: 'Blockly.ICopyable', + newExport: 'ICopyable', + newPath: 'Blockly.ICopyable', + }, + { + oldName: 'Blockly.IDeletable', + newExport: 'IDeletable', + newPath: 'Blockly.IDeletable', + }, + { + oldName: 'Blockly.IDeleteArea', + newExport: 'IDeleteArea', + newPath: 'Blockly.IDeleteArea', + }, + { + oldName: 'Blockly.IDragTarget', + newExport: 'IDragTarget', + newPath: 'Blockly.IDragTarget', + }, + { + oldName: 'Blockly.IDraggable', + newExport: 'IDraggable', + newPath: 'Blockly.IDraggable', + }, + { + oldName: 'Blockly.IFlyout', + newExport: 'IFlyout', + newPath: 'Blockly.IFlyout', + }, + { + oldName: 'Blockly.IKeyboardAccessible', + newExport: 'IKeyboardAccessible', + newPath: 'Blockly.IKeyboardAccessible', + }, + { + oldName: 'Blockly.IMetricsManager', + newExport: 'IMetricsManager', + newPath: 'Blockly.IMetricsManager', + }, + { + oldName: 'Blockly.IMovable', + newExport: 'IMovable', + newPath: 'Blockly.IMovable', + }, + { + oldName: 'Blockly.IPositionable', + newExport: 'IPositionable', + newPath: 'Blockly.IPositionable', + }, + { + oldName: 'Blockly.IRegistrable', + newExport: 'IRegistrable', + newPath: 'Blockly.IRegistrable', + }, + { + oldName: 'Blockly.IRegistrableField', + newExport: 'IRegistrableField', + newPath: 'Blockly.IRegistrableField', + }, + { + oldName: 'Blockly.ISelectable', + newExport: 'ISelectable', + newPath: 'Blockly.ISelectable', + }, + { + oldName: 'Blockly.ISelectableToolboxItem', + newExport: 'ISelectableToolboxItem', + newPath: 'Blockly.ISelectableToolboxItem', + }, + { + oldName: 'Blockly.IStyleable', + newExport: 'IStyleable', + newPath: 'Blockly.IStyleable', + }, + { + oldName: 'Blockly.IToolbox', + newExport: 'IToolbox', + newPath: 'Blockly.IToolbox', + }, + { + oldName: 'Blockly.IToolboxItem', + newExport: 'IToolboxItem', + newPath: 'Blockly.IToolboxItem', + }, + { + oldName: 'Blockly.blockRendering.ConstantProvider', + newExport: 'ConstantProvider', + newPath: 'Blockly.blockRendering.ConstantProvider', + }, + { + oldName: 'Blockly.blockRendering.Debug', + newExport: 'Debug', + newPath: 'Blockly.blockRendering.Debug', + }, + { + oldName: 'Blockly.blockRendering.Drawer', + newExport: 'Drawer', + newPath: 'Blockly.blockRendering.Drawer', + }, + { + oldName: 'Blockly.blockRendering.IPathObject', + newExport: 'IPathObject', + newPath: 'Blockly.blockRendering.IPathObject', + }, + { + oldName: 'Blockly.blockRendering.RenderInfo', + newExport: 'RenderInfo', + newPath: 'Blockly.blockRendering.RenderInfo', + }, + { + oldName: 'Blockly.blockRendering.MarkerSvg', + newExport: 'MarkerSvg', + newPath: 'Blockly.blockRendering.MarkerSvg', + }, + { + oldName: 'Blockly.blockRendering.PathObject', + newExport: 'PathObject', + newPath: 'Blockly.blockRendering.PathObject', + }, + { + oldName: 'Blockly.blockRendering.Renderer', + newExport: 'Renderer', + newPath: 'Blockly.blockRendering.Renderer', + }, + { + oldName: 'Blockly.geras.InlineInput', + newExport: 'InlineInput', + newPath: 'Blockly.geras.InlineInput', + }, + { + oldName: 'Blockly.geras.StatementInput', + newExport: 'StatementInput', + newPath: 'Blockly.geras.StatementInput', + }, + { + oldName: 'Blockly.geras.ConstantProvider', + newExport: 'ConstantProvider', + newPath: 'Blockly.geras.ConstantProvider', + }, + { + oldName: 'Blockly.geras.Drawer', + newExport: 'Drawer', + newPath: 'Blockly.geras.Drawer', + }, + { + oldName: 'Blockly.geras.HighlightConstantProvider', + newExport: 'HighlightConstantProvider', + newPath: 'Blockly.geras.HighlightConstantProvider', + }, + { + oldName: 'Blockly.geras.Highlighter', + newExport: 'Highlighter', + newPath: 'Blockly.geras.Highlighter', + }, + { + oldName: 'Blockly.geras.RenderInfo', + newExport: 'RenderInfo', + newPath: 'Blockly.geras.RenderInfo', + }, + { + oldName: 'Blockly.geras.PathObject', + newExport: 'PathObject', + newPath: 'Blockly.geras.PathObject', + }, + { + oldName: 'Blockly.geras.Renderer', + newExport: 'Renderer', + newPath: 'Blockly.geras.Renderer', + }, + { + oldName: 'Blockly.blockRendering.Measurable', + newExport: 'Measurable', + newPath: 'Blockly.blockRendering.Measurable', + }, + { + oldName: 'Blockly.blockRendering.BottomRow', + newExport: 'BottomRow', + newPath: 'Blockly.blockRendering.BottomRow', + }, + { + oldName: 'Blockly.blockRendering.Connection', + newExport: 'Connection', + newPath: 'Blockly.blockRendering.Connection', + }, + { + oldName: 'Blockly.blockRendering.ExternalValueInput', + newExport: 'ExternalValueInput', + newPath: 'Blockly.blockRendering.ExternalValueInput', + }, + { + oldName: 'Blockly.blockRendering.Field', + newExport: 'Field', + newPath: 'Blockly.blockRendering.Field', + }, + { + oldName: 'Blockly.blockRendering.Hat', + newExport: 'Hat', + newPath: 'Blockly.blockRendering.Hat', + }, + { + oldName: 'Blockly.blockRendering.Icon', + newExport: 'Icon', + newPath: 'Blockly.blockRendering.Icon', + }, + { + oldName: 'Blockly.blockRendering.InRowSpacer', + newExport: 'InRowSpacer', + newPath: 'Blockly.blockRendering.InRowSpacer', + }, + { + oldName: 'Blockly.blockRendering.InlineInput', + newExport: 'InlineInput', + newPath: 'Blockly.blockRendering.InlineInput', + }, + { + oldName: 'Blockly.blockRendering.InputConnection', + newExport: 'InputConnection', + newPath: 'Blockly.blockRendering.InputConnection', + }, + { + oldName: 'Blockly.blockRendering.InputRow', + newExport: 'InputRow', + newPath: 'Blockly.blockRendering.InputRow', + }, + { + oldName: 'Blockly.blockRendering.JaggedEdge', + newExport: 'JaggedEdge', + newPath: 'Blockly.blockRendering.JaggedEdge', + }, + { + oldName: 'Blockly.blockRendering.NextConnection', + newExport: 'NextConnection', + newPath: 'Blockly.blockRendering.NextConnection', + }, + { + oldName: 'Blockly.blockRendering.OutputConnection', + newExport: 'OutputConnection', + newPath: 'Blockly.blockRendering.OutputConnection', + }, + { + oldName: 'Blockly.blockRendering.PreviousConnection', + newExport: 'PreviousConnection', + newPath: 'Blockly.blockRendering.PreviousConnection', + }, + { + oldName: 'Blockly.blockRendering.RoundCorner', + newExport: 'RoundCorner', + newPath: 'Blockly.blockRendering.RoundCorner', + }, + { + oldName: 'Blockly.blockRendering.Row', + newExport: 'Row', + newPath: 'Blockly.blockRendering.Row', + }, + { + oldName: 'Blockly.blockRendering.SpacerRow', + newExport: 'SpacerRow', + newPath: 'Blockly.blockRendering.SpacerRow', + }, + { + oldName: 'Blockly.blockRendering.SquareCorner', + newExport: 'SquareCorner', + newPath: 'Blockly.blockRendering.SquareCorner', + }, + { + oldName: 'Blockly.blockRendering.StatementInput', + newExport: 'StatementInput', + newPath: 'Blockly.blockRendering.StatementInput', + }, + { + oldName: 'Blockly.blockRendering.TopRow', + newExport: 'TopRow', + newPath: 'Blockly.blockRendering.TopRow', + }, + { + oldName: 'Blockly.blockRendering.Types', + newExport: 'Types', + newPath: 'Blockly.blockRendering.Types', + }, + { + oldName: 'Blockly.minimalist.ConstantProvider', + newExport: 'ConstantProvider', + newPath: 'Blockly.minimalist.ConstantProvider', + }, + { + oldName: 'Blockly.minimalist.Drawer', + newExport: 'Drawer', + newPath: 'Blockly.minimalist.Drawer', + }, + { + oldName: 'Blockly.minimalist.RenderInfo', + newExport: 'RenderInfo', + newPath: 'Blockly.minimalist.RenderInfo', + }, + { + oldName: 'Blockly.minimalist.Renderer', + newExport: 'Renderer', + newPath: 'Blockly.minimalist.Renderer', + }, + { + oldName: 'Blockly.thrasos.RenderInfo', + newExport: 'RenderInfo', + newPath: 'Blockly.thrasos.RenderInfo', + }, + { + oldName: 'Blockly.thrasos.Renderer', + newExport: 'Renderer', + newPath: 'Blockly.thrasos.Renderer', + }, + { + oldName: 'Blockly.zelos.BottomRow', + newExport: 'BottomRow', + newPath: 'Blockly.zelos.BottomRow', + }, + { + oldName: 'Blockly.zelos.StatementInput', + newExport: 'StatementInput', + newPath: 'Blockly.zelos.StatementInput', + }, + { + oldName: 'Blockly.zelos.RightConnectionShape', + newExport: 'RightConnectionShape', + newPath: 'Blockly.zelos.RightConnectionShape', + }, + { + oldName: 'Blockly.zelos.TopRow', + newExport: 'TopRow', + newPath: 'Blockly.zelos.TopRow', + }, + { + oldName: 'Blockly.zelos.ConstantProvider', + newExport: 'ConstantProvider', + newPath: 'Blockly.zelos.ConstantProvider', + }, + { + oldName: 'Blockly.zelos.Drawer', + newExport: 'Drawer', + newPath: 'Blockly.zelos.Drawer', + }, + { + oldName: 'Blockly.zelos.RenderInfo', + newExport: 'RenderInfo', + newPath: 'Blockly.zelos.RenderInfo', + }, + { + oldName: 'Blockly.zelos.MarkerSvg', + newExport: 'MarkerSvg', + newPath: 'Blockly.zelos.MarkerSvg', + }, + { + oldName: 'Blockly.zelos.PathObject', + newExport: 'PathObject', + newPath: 'Blockly.zelos.PathObject', + }, + { + oldName: 'Blockly.zelos.Renderer', + newExport: 'Renderer', + newPath: 'Blockly.zelos.Renderer', + }, + { + oldName: 'Blockly.Themes.Classic', + newExport: 'Classic', + newPath: 'Blockly.Themes.Classic', + }, + { + oldName: 'Blockly.Themes.Zelos', + newExport: 'Zelos', + newPath: 'Blockly.Themes.Zelos', + }, + { + oldName: 'Blockly.ToolboxCategory', + newExport: 'ToolboxCategory', + newPath: 'Blockly.ToolboxCategory', + }, + { + oldName: 'Blockly.CollapsibleToolboxCategory', + newExport: 'CollapsibleToolboxCategory', + newPath: 'Blockly.CollapsibleToolboxCategory', + }, + { + oldName: 'Blockly.ToolboxSeparator', + newExport: 'ToolboxSeparator', + newPath: 'Blockly.ToolboxSeparator', + }, + { + oldName: 'Blockly.Toolbox', + newExport: 'Toolbox', + newPath: 'Blockly.Toolbox', + }, + { + oldName: 'Blockly.ToolboxItem', + newExport: 'ToolboxItem', + newPath: 'Blockly.ToolboxItem', + }, + { + oldName: 'Blockly.utils.Coordinate', + newExport: 'Coordinate', + newPath: 'Blockly.utils.Coordinate', + }, + { + oldName: 'Blockly.utils.KeyCodes', + newExport: 'KeyCodes', + newPath: 'Blockly.utils.KeyCodes', + }, + { + oldName: 'Blockly.utils.Metrics', + newExport: 'Metrics', + newPath: 'Blockly.utils.Metrics', + }, + { + oldName: 'Blockly.utils.Rect', + newExport: 'Rect', + newPath: 'Blockly.utils.Rect', + }, + { + oldName: 'Blockly.utils.Size', + newExport: 'Size', + newPath: 'Blockly.utils.Size', + }, + { + oldName: 'Blockly.utils.Svg', + newExport: 'Svg', + newPath: 'Blockly.utils.Svg', + }, + { + oldName: 'Blockly.BlocklyOptions', + newExport: 'BlocklyOptions', + newPath: 'Blockly.BlocklyOptions', + }, + { + oldName: 'Blockly.Bubble', + newExport: 'Bubble', + newPath: 'Blockly.Bubble', + }, + { + oldName: 'Blockly.BubbleDragger', + newExport: 'BubbleDragger', + newPath: 'Blockly.BubbleDragger', + }, + { + oldName: 'Blockly.Comment', + newExport: 'Comment', + newPath: 'Blockly.Comment', + }, + { + oldName: 'Blockly.ComponentManager', + newExport: 'ComponentManager', + newPath: 'Blockly.ComponentManager', + }, + { + oldName: 'Blockly.Connection', + newExport: 'Connection', + newPath: 'Blockly.Connection', + }, + { + oldName: 'Blockly.ConnectionChecker', + newExport: 'ConnectionChecker', + newPath: 'Blockly.ConnectionChecker', + }, + { + oldName: 'Blockly.ConnectionDB', + newExport: 'ConnectionDB', + newPath: 'Blockly.ConnectionDB', + }, + { + oldName: 'Blockly.ContextMenuRegistry', + newExport: 'ContextMenuRegistry', + newPath: 'Blockly.ContextMenuRegistry', + }, + { + oldName: 'Blockly.DeleteArea', + newExport: 'DeleteArea', + newPath: 'Blockly.DeleteArea', + }, + { + oldName: 'Blockly.DragTarget', + newExport: 'DragTarget', + newPath: 'Blockly.DragTarget', + }, + { + oldName: 'Blockly.DropDownDiv', + newExport: 'DropDownDiv', + newPath: 'Blockly.DropDownDiv', + }, + { + oldName: 'Blockly.Field', + newExport: 'Field', + newPath: 'Blockly.Field', + }, + { + oldName: 'Blockly.FieldAngle', + newExport: 'FieldAngle', + newPath: 'Blockly.FieldAngle', + }, + { + oldName: 'Blockly.FieldCheckbox', + newExport: 'FieldCheckbox', + newPath: 'Blockly.FieldCheckbox', + }, + { + oldName: 'Blockly.FieldColour', + newExport: 'FieldColour', + newPath: 'Blockly.FieldColour', + }, + { + oldName: 'Blockly.FieldDropdown', + newExport: 'FieldDropdown', + newPath: 'Blockly.FieldDropdown', + }, + { + oldName: 'Blockly.FieldImage', + newExport: 'FieldImage', + newPath: 'Blockly.FieldImage', + }, + { + oldName: 'Blockly.FieldLabel', + newExport: 'FieldLabel', + newPath: 'Blockly.FieldLabel', + }, + { + oldName: 'Blockly.FieldLabelSerializable', + newExport: 'FieldLabelSerializable', + newPath: 'Blockly.FieldLabelSerializable', + }, + { + oldName: 'Blockly.FieldMultilineInput', + newExport: 'FieldMultilineInput', + newPath: 'Blockly.FieldMultilineInput', + }, + { + oldName: 'Blockly.FieldNumber', + newExport: 'FieldNumber', + newPath: 'Blockly.FieldNumber', + }, + { + oldName: 'Blockly.FieldTextInput', + newExport: 'FieldTextInput', + newPath: 'Blockly.FieldTextInput', + }, + { + oldName: 'Blockly.FieldVariable', + newExport: 'FieldVariable', + newPath: 'Blockly.FieldVariable', + }, + { + oldName: 'Blockly.Flyout', + newExport: 'Flyout', + newPath: 'Blockly.Flyout', + }, + { + oldName: 'Blockly.FlyoutButton', + newExport: 'FlyoutButton', + newPath: 'Blockly.FlyoutButton', + }, + { + oldName: 'Blockly.HorizontalFlyout', + newExport: 'HorizontalFlyout', + newPath: 'Blockly.HorizontalFlyout', + }, + { + oldName: 'Blockly.FlyoutMetricsManager', + newExport: 'FlyoutMetricsManager', + newPath: 'Blockly.FlyoutMetricsManager', + }, + { + oldName: 'Blockly.VerticalFlyout', + newExport: 'VerticalFlyout', + newPath: 'Blockly.VerticalFlyout', + }, + { + oldName: 'Blockly.Generator', + newExport: 'Generator', + newPath: 'Blockly.Generator', + }, + { + oldName: 'Blockly.Gesture', + newExport: 'Gesture', + newPath: 'Blockly.Gesture', + }, + { + oldName: 'Blockly.Grid', + newExport: 'Grid', + newPath: 'Blockly.Grid', + }, + { + oldName: 'Blockly.Icon', + newExport: 'Icon', + newPath: 'Blockly.Icon', + }, + { + oldName: 'Blockly.inject', + newExport: 'inject', + newPath: 'Blockly.inject', + }, + { + oldName: 'Blockly.Input', + newExport: 'Input', + newPath: 'Blockly.Input', + }, + { + oldName: 'Blockly.inputTypes', + newExport: 'inputTypes', + newPath: 'Blockly.inputTypes', + }, + { + oldName: 'Blockly.InsertionMarkerManager', + newExport: 'InsertionMarkerManager', + newPath: 'Blockly.InsertionMarkerManager', + }, + { + oldName: 'Blockly.MarkerManager', + newExport: 'MarkerManager', + newPath: 'Blockly.MarkerManager', + }, + { + oldName: 'Blockly.Menu', + newExport: 'Menu', + newPath: 'Blockly.Menu', + }, + { + oldName: 'Blockly.MenuItem', + newExport: 'MenuItem', + newPath: 'Blockly.MenuItem', + }, + { + oldName: 'Blockly.MetricsManager', + newExport: 'MetricsManager', + newPath: 'Blockly.MetricsManager', + }, + { + oldName: 'Blockly.Msg', + newExport: 'Msg', + newPath: 'Blockly.Msg', + }, + { + oldName: 'Blockly.Mutator', + newExport: 'Mutator', + newPath: 'Blockly.Mutator', + }, + { + oldName: 'Blockly.Names', + newExport: 'Names', + newPath: 'Blockly.Names', + }, + { + oldName: 'Blockly.Options', + newExport: 'Options', + newPath: 'Blockly.Options', + }, + { + oldName: 'Blockly.RenderedConnection', + newExport: 'RenderedConnection', + newPath: 'Blockly.RenderedConnection', + }, + { + oldName: 'Blockly.Scrollbar', + newExport: 'Scrollbar', + newPath: 'Blockly.Scrollbar', + }, + { + oldName: 'Blockly.ScrollbarPair', + newExport: 'ScrollbarPair', + newPath: 'Blockly.ScrollbarPair', + }, + { + oldName: 'Blockly.ShortcutRegistry', + newExport: 'ShortcutRegistry', + newPath: 'Blockly.ShortcutRegistry', + }, + { + oldName: 'Blockly.Theme', + newExport: 'Theme', + newPath: 'Blockly.Theme', + }, + { + oldName: 'Blockly.ThemeManager', + newExport: 'ThemeManager', + newPath: 'Blockly.ThemeManager', + }, + { + oldName: 'Blockly.TouchGesture', + newExport: 'TouchGesture', + newPath: 'Blockly.TouchGesture', + }, + { + oldName: 'Blockly.Trashcan', + newExport: 'Trashcan', + newPath: 'Blockly.Trashcan', + }, + { + oldName: 'Blockly.VariableMap', + newExport: 'VariableMap', + newPath: 'Blockly.VariableMap', + }, + { + oldName: 'Blockly.VariableModel', + newExport: 'VariableModel', + newPath: 'Blockly.VariableModel', + }, + { + oldName: 'Blockly.Warning', + newExport: 'Warning', + newPath: 'Blockly.Warning', + }, + { + oldName: 'Blockly.Workspace', + newExport: 'Workspace', + newPath: 'Blockly.Workspace', + }, + { + oldName: 'Blockly.WorkspaceAudio', + newExport: 'WorkspaceAudio', + newPath: 'Blockly.WorkspaceAudio', + }, + { + oldName: 'Blockly.WorkspaceComment', + newExport: 'WorkspaceComment', + newPath: 'Blockly.WorkspaceComment', + }, + { + oldName: 'Blockly.WorkspaceCommentSvg', + newExport: 'WorkspaceCommentSvg', + newPath: 'Blockly.WorkspaceCommentSvg', + }, + { + oldName: 'Blockly.WorkspaceDragSurfaceSvg', + newExport: 'WorkspaceDragSurfaceSvg', + newPath: 'Blockly.WorkspaceDragSurfaceSvg', + }, + { + oldName: 'Blockly.WorkspaceDragger', + newExport: 'WorkspaceDragger', + newPath: 'Blockly.WorkspaceDragger', + }, + { + oldName: 'Blockly.WorkspaceSvg', + newExport: 'WorkspaceSvg', + newPath: 'Blockly.WorkspaceSvg', + }, + { + oldName: 'Blockly.ZoomControls', + newExport: 'ZoomControls', + newPath: 'Blockly.ZoomControls', + }, + ], + + 'develop': [ + { + oldName: 'Blockly', + exports: { + DRAG_RADIUS: { + newModule: 'Blockly.config', + newExport: 'config.dragRadius', + }, + FLYOUT_DRAG_RADIUS: { + newModule: 'Blockly.config', + newExport: 'config.flyoutDragRadius', + }, + SNAP_RADIUS: { + newModule: 'Blockly.config', + newExport: 'config.snapRadius', + }, + CONNECTING_SNAP_RADIUS: { + newModule: 'Blockly.config', + newExport: 'config.connectingSnapRadius', + }, + CURRENT_CONNECTION_PREFERENCE: { + newModule: 'Blockly.config', + newExport: 'config.currentConnectionPreference', + }, + BUMP_DELAY: { + newModule: 'Blockly.config', + newExport: 'config.bumpDelay', + }, + SPRITE: { + newModule: 'Blockly.constants', + }, + }, + }, + { + oldName: 'Blockly.blocks.all', + newName: 'Blockly.libraryBlocks', + }, + { + oldName: 'Blockly.blocks.colour', + newName: 'Blockly.libraryBlocks.colour', + }, + { + oldName: 'Blockly.blocks.lists', + newName: 'Blockly.libraryBlocks.lists', + }, + { + oldName: 'Blockly.blocks.logic', + newName: 'Blockly.libraryBlocks.logic', + }, + { + oldName: 'Blockly.blocks.loops', + newName: 'Blockly.libraryBlocks.loops', + }, + { + oldName: 'Blockly.blocks.math', + newName: 'Blockly.libraryBlocks.math', + }, + { + oldName: 'Blockly.blocks.procedures', + newName: 'Blockly.libraryBlocks.procedures', + }, + { + oldName: 'Blockly.blocks.text', + newName: 'Blockly.libraryBlocks.text', + }, + { + oldName: 'Blockly.blocks.variables', + newName: 'Blockly.libraryBlocks.variables', + }, + { + oldName: 'Blockly.blocks.variablesDynamic', + newName: 'Blockly.libraryBlocks.variablesDynamic', + }, + { + oldName: 'Blockly.DropDownDiv', + newName: 'Blockly.dropDownDiv', + newPath: 'Blockly.DropDownDiv', + }, + ] +} diff --git a/tests/migration/renamings-schema.json b/tests/migration/renamings-schema.json new file mode 100644 index 00000000000..180f94ad8de --- /dev/null +++ b/tests/migration/renamings-schema.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/google/blockly/tests/migration/renamings-schema.json", + "title": "Renamings", + "description": "A file containing information about module and module export renamings", + "type": "object", + "patternProperties": { + "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$": {"$ref": "#/$defs/version"} + }, + "properties": { + "develop": {"$ref": "#/$defs/version"} + }, + "additionalProperties": false, + "$defs": { + "version": { + "description": "All the renamings that happened in a paricular release.", + "type": "array", + "items": { + "description": "All the renamings in/of a particular module.", + "type": "object", + "properties": { + "oldName": {"$ref": "#/$defs/dottedIdentifier"}, + "newName": {"$ref": "#/$defs/dottedIdentifier"}, + "newExport": {"$ref": "#/$defs/dottedIdentifier"}, + "oldPath": {"$ref": "#/$defs/dottedIdentifier"}, + "newPath": {"$ref": "#/$defs/dottedIdentifier"}, + "exports": { + "description": "A list of the exports that have been renamed.", + "type": "object", + "patternProperties": { + "^[A-Za-z$_][A-Za-z0-9$_]*(\\.[A-Za-z$_][A-Za-z0-9$_]*)*$": { + "description": "A single renamed (or moved) export.", + "type": "object", + "properties": { + "newModule": {"$ref": "#/$defs/dottedIdentifier"}, + "newExport": {"$ref": "#/$defs/dottedIdentifier"}, + "oldPath": {"$ref": "#/$defs/dottedIdentifier"}, + "newPath": {"$ref": "#/$defs/dottedIdentifier"}, + "getMethod": {"$ref": "#/$defs/dottedIdentifier"}, + "setMethod": {"$ref": "#/$defs/dottedIdentifier"} + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "required": ["oldName"], + "additionalProperties": false + } + }, + "dottedIdentifier": { + "type": "string", + "pattern": "^[A-Za-z$_][A-Za-z0-9$_]*(\\.[A-Za-z$_][A-Za-z0-9$_]*)*$" + } + } +} diff --git a/tests/migration/validate-renamings.js b/tests/migration/validate-renamings.js new file mode 100755 index 00000000000..8b66e3beab0 --- /dev/null +++ b/tests/migration/validate-renamings.js @@ -0,0 +1,73 @@ +#!/usr/bin/env node +/** + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview A script to validate the renamings file + * (scripts/migration/renamings.json5) agaist the schema + * (renamings-schema.json). + */ + +/* global require __dirname process */ + +const JsonSchema = require('@hyperjump/json-schema'); +const JSON5 = require('json5'); +const fs = require('fs'); +const path = require('path'); + + +/** + * Renaming schema filename. + * @type {string} + */ +const SCHEMA_FILENAME = path.join(__dirname, 'renamings-schema.json'); + +/** + * Renamings filename. + * @type {string} + */ +const RENAMINGS_FILENAME = + path.resolve(__dirname, '../../scripts/migration/renamings.json5'); + +// Can't use top-level await outside a module, and can't use require +// in a module, so use an IIAFE. +(async function() { + const schemaUrl = 'file://' + path.resolve(SCHEMA_FILENAME); + const schema = await JsonSchema.get(schemaUrl); + + const renamingsJson5 = fs.readFileSync(RENAMINGS_FILENAME); + const renamings = JSON5.parse(renamingsJson5); + + const output = + await JsonSchema.validate(schema, renamings, JsonSchema.DETAILED); + + if (!output.valid) { + console.log('Renamings file is invalid.'); + console.log('Maybe this validator output will help you find the problem:'); + console.log(JSON5.stringify(output, undefined, ' ')); + process.exit(1); + } + + // File passed schema validation. Do some additional checks. + let ok = true; + Object.entries(renamings).forEach(([version, modules]) => { + // Scan through modules and check for duplicates. + const seen = new Set(); + for (const {oldName} of modules) { + if (seen.has(oldName)) { + console.log(`Duplicate entry for module ${oldName} ` + + `in version ${version}.`); + ok = false; + } + seen.add(oldName); + } + }); + if (!ok) { + console.log('Renamings file is invalid.'); + process.exit(1); + } + // Default is a successful exit 0. +})(); diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh index 9318ede6a78..1d169be4f89 100755 --- a/tests/run_all_tests.sh +++ b/tests/run_all_tests.sh @@ -62,6 +62,9 @@ run_test_command "build-debug" "npm run build-debug" # TODO(5621): Re-enable this test once typings generation is fixed. # run_test_command "typings" "npm run typings" +# Run renaming validation test. +run_test_command "renamings" "tests/migration/validate-renamings.js" + # Check the sizes of built files for unexpected growth. run_test_command "metadata" "tests/scripts/check_metadata.sh" @@ -80,7 +83,6 @@ run_test_command "node" "./node_modules/.bin/mocha tests/node --config tests/nod # Attempt advanced compilation of a Blockly app. run_test_command "advanced_compile" "npm run test:compile:advanced" - # End of tests. popd echo "======================================="