From 10cfc11809e34f35e129263f3624e8bf97e62c8b Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Mon, 6 Dec 2021 16:46:14 +0000 Subject: [PATCH] chore: Remove `core/requires.js` (#5718) * chore: Remove requires that duplicate those in blockly.js * refactor: Remove core/requires.js, make blockly.js be entry point It sort of makes sense, doesn't it? The only remaining require not duplicated in `blockly.js` was that for `Blockly.themes.Classic`, but it is already required by `Blockly.themes` (itself required by `Blockly`). --- blockly_uncompressed.js | 2 +- core/requires.js | 80 -------------------------------- scripts/gulpfiles/build_tasks.js | 10 ++-- scripts/gulpfiles/chunks.json | 17 ++++--- tests/deps.js | 1 - 5 files changed, 14 insertions(+), 96 deletions(-) delete mode 100644 core/requires.js diff --git a/blockly_uncompressed.js b/blockly_uncompressed.js index 3e0e200ed..435954011 100644 --- a/blockly_uncompressed.js +++ b/blockly_uncompressed.js @@ -50,6 +50,6 @@ document.write( ''); // Load the rest of Blockly. - document.write(''); + document.write(''); } })(this); diff --git a/core/requires.js b/core/requires.js deleted file mode 100644 index 5fe22ee70..000000000 --- a/core/requires.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @fileoverview Default Blockly entry point. Use this to pick and choose which - * fields and renderers to include in your Blockly bundle. - * @suppress {extraRequire} - */ -'use strict'; - -goog.provide('Blockly.requires'); - -// Blockly Core (absolutely mandatory). -goog.require('Blockly'); -// If block comments aren't required, then Blockly.inject's "comments" -// configuration must be false, and no blocks may be loaded from XML which -// define comments. -goog.require('Blockly.Comment'); -// This registers default contextmenu options. -goog.require('Blockly.ContextMenuItems'); -goog.require('Blockly.FieldAngle'); -goog.require('Blockly.FieldCheckbox'); -goog.require('Blockly.FieldColour'); -goog.require('Blockly.FieldDropdown'); -goog.require('Blockly.FieldImage'); -goog.require('Blockly.FieldLabelSerializable'); -goog.require('Blockly.FieldMultilineInput'); -goog.require('Blockly.FieldNumber'); -goog.require('Blockly.FieldTextInput'); -goog.require('Blockly.FieldVariable'); -// Flyout buttons are needed by the variable category, -// and by any custom toolbox that has a button or a label. -goog.require('Blockly.FlyoutButton'); -// If there is code generation into any language, then the generator is needed. -// Should not be required when using advanced compilation since -// individual generator files should already have this require. -goog.require('Blockly.Generator'); -// One of these two will almost certainly be needed (usually VerticalFlyout). -goog.require('Blockly.HorizontalFlyout'); -// Block dependencies. -// None of these should be required when using advanced compilation since -// individual block files should include the requirements they depend on. -goog.require('Blockly.Mutator'); -// This registers default keyboard shortcuts. -goog.require('Blockly.ShortcutItems'); -// The debug renderer, which shows simplified versions of the blocks for -// developer use. -// goog.require('Blockly.blockRendering.Debug'); - -// Blockly Themes. -// Classic is the default theme. -goog.require('Blockly.Themes.Classic'); -// If the toolbox does not have categories and only has a simple flyout, then -// 'Blockly.Toolbox' is not needed. -goog.require('Blockly.Toolbox'); -// If a trashcan on the workspace isn't required, then Blockly.inject's -// "trashcan" configuration must be false. -goog.require('Blockly.Trashcan'); -// Only needed if one is using the 'VARIABLE_DYNAMIC' typed variables category. -goog.require('Blockly.VariablesDynamic'); -goog.require('Blockly.VerticalFlyout'); -goog.require('Blockly.Warning'); -// Only need to require these two if you're using workspace comments. -// goog.require('Blockly.WorkspaceCommentSvg'); -// If zoom controls aren't required, then Blockly.inject's -// "zoom"/"controls" configuration must be false. -goog.require('Blockly.ZoomControls'); -// Blockly Renderers. -// At least one renderer is mandatory. Geras is the default one. -// Others may be chosen using Blockly.inject's "renderer" configuration. -goog.require('Blockly.geras.Renderer'); -goog.require('Blockly.serialization.blocks'); -goog.require('Blockly.serialization.registry'); -goog.require('Blockly.serialization.variables'); -goog.require('Blockly.serialization.workspaces'); -goog.require('Blockly.thrasos.Renderer'); -goog.require('Blockly.zelos.Renderer'); diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index aa7b77f39..aeec016fb 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -98,7 +98,7 @@ const NAMESPACE_OBJECT = '$'; const chunks = [ { name: 'blockly', - entry: 'core/requires.js', + entry: 'core/blockly.js', exports: 'Blockly', importAs: 'Blockly', factoryPreamble: `const ${NAMESPACE_OBJECT}={};`, @@ -385,10 +385,10 @@ function getChunkOptions() { // // { // chunk: [ - // 'requires:258', - // 'all:10:requires', - // 'all1:11:requires', - // 'all2:11:requires', + // 'blockly:258', + // 'all:10:blockly', + // 'all1:11:blockly', + // 'all2:11:blockly', // /* ... remaining handful of chunks */ // ], // js: [ diff --git a/scripts/gulpfiles/chunks.json b/scripts/gulpfiles/chunks.json index 650c7183a..f63efe1db 100644 --- a/scripts/gulpfiles/chunks.json +++ b/scripts/gulpfiles/chunks.json @@ -1,12 +1,12 @@ { "chunk": [ - "requires:258", - "all:10:requires", - "all1:11:requires", - "all2:11:requires", - "all3:11:requires", - "all4:11:requires", - "all5:11:requires" + "blockly:257", + "all:10:blockly", + "all1:11:blockly", + "all2:11:blockly", + "all3:11:blockly", + "all4:11:blockly", + "all5:11:blockly" ], "js": [ "./core/inject.js", @@ -264,9 +264,8 @@ "./core/xml.js", "./core/connection.js", "./core/common.js", - "./core/blockly.js", "./closure/goog/base_minimal.js", - "./core/requires.js", + "./core/blockly.js", "./blocks/variables_dynamic.js", "./blocks/variables.js", "./blocks/text.js", diff --git a/tests/deps.js b/tests/deps.js index 62a32fc02..2e9528e75 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -201,7 +201,6 @@ goog.addDependency('../../core/renderers/zelos/measurables/top_row.js', ['Blockl goog.addDependency('../../core/renderers/zelos/path_object.js', ['Blockly.zelos.PathObject'], ['Blockly.blockRendering.PathObject', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/renderers/zelos/renderer.js', ['Blockly.zelos.Renderer'], ['Blockly.ConnectionType', 'Blockly.InsertionMarkerManager', 'Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.MarkerSvg', 'Blockly.zelos.PathObject', 'Blockly.zelos.RenderInfo'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/renderers/zelos/zelos.js', ['Blockly.zelos'], ['Blockly.zelos.BottomRow', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.MarkerSvg', 'Blockly.zelos.PathObject', 'Blockly.zelos.RenderInfo', 'Blockly.zelos.Renderer', 'Blockly.zelos.RightConnectionShape', 'Blockly.zelos.StatementInput', 'Blockly.zelos.TopRow'], {'lang': 'es6', 'module': 'goog'}); -goog.addDependency('../../core/requires.js', ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.ContextMenuItems', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldLabelSerializable', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.HorizontalFlyout', 'Blockly.Mutator', 'Blockly.ShortcutItems', 'Blockly.Themes.Classic', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.VerticalFlyout', 'Blockly.Warning', 'Blockly.ZoomControls', 'Blockly.geras.Renderer', 'Blockly.serialization.blocks', 'Blockly.serialization.registry', 'Blockly.serialization.variables', 'Blockly.serialization.workspaces', 'Blockly.thrasos.Renderer', 'Blockly.zelos.Renderer']); goog.addDependency('../../core/scrollbar.js', ['Blockly.Scrollbar'], ['Blockly.Touch', 'Blockly.browserEvents', 'Blockly.utils.Coordinate', 'Blockly.utils.Svg', 'Blockly.utils.dom', 'Blockly.utils.svgMath'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/scrollbar_pair.js', ['Blockly.ScrollbarPair'], ['Blockly.Events.utils', 'Blockly.Scrollbar', 'Blockly.utils.Svg', 'Blockly.utils.dom'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../core/serialization/blocks.js', ['Blockly.serialization.blocks'], ['Blockly.Events.utils', 'Blockly.Xml', 'Blockly.inputTypes', 'Blockly.serialization.ISerializer', 'Blockly.serialization.exceptions', 'Blockly.serialization.priorities', 'Blockly.serialization.registry', 'Blockly.utils.Size'], {'lang': 'es6', 'module': 'goog'});