chore(tests): Delete blockly_uncompressed.js

Its function has now been entirely subsumed by tests/bootstrap.js,
so remove it and update any remaining mentions of it.

Also fix formatting and positions of some comments in playround.html.
This commit is contained in:
Christopher Allen
2022-06-12 12:51:57 +01:00
parent 229dbf7ea0
commit de1aab837c
4 changed files with 8 additions and 70 deletions

View File

@@ -1,58 +0,0 @@
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Bootstrap code to load Blockly in uncompiled mode.
*/
'use strict';
/* eslint-disable no-var */
/**
* Blockly uncompiled-mode startup code. If running in a browser
* loads closure/goog/base.js and build/deps.js, then (in any case)
* requires Blockly.requires.
*/
(function(globalThis) {
/* eslint-disable-next-line no-undef */
var IS_NODE_JS = !!(typeof module !== 'undefined' && module.exports);
if (IS_NODE_JS) {
// Load Blockly.
goog.require('Blockly.requires');
/* eslint-disable no-undef */
module.exports = Blockly;
} else {
var BLOCKLY_DIR = '';
// Find name of current directory.
var scripts = document.getElementsByTagName('script');
var re = /(.+)[\\/]blockly_(?:.*)uncompressed\.js$/;
for (var script, i = 0; (script = scripts[i]); i++) {
var match = re.exec(script.src);
if (match) {
BLOCKLY_DIR = match[1];
break;
}
}
if (!BLOCKLY_DIR) {
alert('Could not detect Blockly\'s directory name.');
}
// Disable loading of closure/goog/deps.js (which doesn't exist).
globalThis.CLOSURE_NO_DEPS = true;
// Load Closure Library base.js (the only part of the libary we use,
// mainly for goog.require / goog.provide / goog.module).
document.write(
'<script src="' + BLOCKLY_DIR + '/closure/goog/base.js"></script>');
// Load dependency graph info from build/deps.js. To update
// deps.js, run `npm run build:deps`.
document.write(
'<script src="' + BLOCKLY_DIR + '/build/deps.js"></script>');
// Load the rest of Blockly.
document.write('<script>goog.require(\'Blockly\');</script>');
}
/* eslint-disable-next-line no-invalid-this */
})(this);

View File

@@ -262,7 +262,7 @@ function buildJavaScript(done) {
/**
* This task updates DEPS_FILE (deps.js), used by
* blockly_uncompressed.js when loading Blockly in uncompiled mode.
* bootstrap.js when loading Blockly in uncompiled mode.
*
* Also updates TEST_DEPS_FILE (deps.mocha.js), used by the mocha test
* suite.
@@ -673,7 +673,6 @@ function buildAdvancedCompilationTest() {
* php_compressed.js
* lua_compressed.js
* dart_compressed.js
* blockly_uncompressed.js
* msg/json/*.js
* test/deps*.js
*/

View File

@@ -19,17 +19,16 @@ var path = require('path');
// - tests/scripts/compile_typings.sh
// - tests/scripts/check_metadata.sh
// - tests/scripts/update_metadata.sh
// - blockly_uncompressed.js (for location of deps.js)
// - tests/bootstrap.js (for location of deps.js)
// - tests/mocha/index.html (for location of deps.mocha.js)
// Directory to write compiled output to.
exports.BUILD_DIR = 'build';
// Dependencies file (for blockly_uncompressed.js):
// Dependencies file (used by bootstrap.js in uncompiled mode):
exports.DEPS_FILE = path.join(exports.BUILD_DIR, 'deps.js');
// Dependencies file (for blockly_uncompressed.js):
// Mocha test dependencies file (used by tests/mocha/index.html):
exports.TEST_DEPS_FILE = path.join(exports.BUILD_DIR, 'deps.mocha.js');
// Directory to write typings output to.

View File

@@ -4,9 +4,8 @@
<meta charset="utf-8">
<title>Blockly Playground</title>
<!-- This script loads uncompressed when on localhost and loads
compressed when it is being hosted. Please add any other
dependencies to bootstrap.js. -->
<!-- This script loads uncompressed when on localhost and loads
compressed when it is being hosted or on Internet Explorer. -->
<script>
var BLOCKLY_BOOTSTRAP_OPTIONS = {
additionalScripts: [
@@ -393,10 +392,6 @@ var spaghettiXml = [
'next': { }
});
// Call start(). Because this <script> has type=module, it is
// automatically deferred, so it will not be run until after the
// document has been parsed, but before firing DOMContentLoaded.
function addEventHandlers() {
document.getElementById('save-json').addEventListener('click', saveJson);
document.getElementById('save-xml').addEventListener('click', saveXml);
@@ -434,6 +429,9 @@ function addEventHandlers() {
.addEventListener('click', function() { workspace.setVisible(false); });
}
// Call start(). Because this <script> has type=module, it is
// automatically deferred, so it will not be run until after the
// document has been parsed, but before firing DOMContentLoaded.
start();
</script>