From 8ab51c863983ae9e3033d4648021f1cbc987c54a Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Wed, 11 Sep 2019 17:30:51 -0700 Subject: [PATCH] Remove closure base file dependency (#2976) * Trim down closure's base dependency even further by removing the dependency on closure's base file. --- .travis.yml | 2 - blockly_compressed.js | 487 +++++++++------------ blockly_uncompressed.js | 114 ++--- build.py | 2 +- core/block.js | 5 +- core/block_events.js | 12 +- core/block_svg.js | 3 +- core/blockly.js | 8 - core/comment.js | 3 +- core/components/menu/menu.js | 5 +- core/components/menu/menuitem.js | 5 +- core/components/tree/basenode.js | 3 +- core/components/tree/treecontrol.js | 3 +- core/components/tree/treenode.js | 3 +- core/field_angle.js | 3 +- core/field_checkbox.js | 3 +- core/field_colour.js | 5 +- core/field_date.js | 37 +- core/field_dropdown.js | 3 +- core/field_image.js | 3 +- core/field_label.js | 3 +- core/field_label_serializable.js | 4 +- core/field_number.js | 3 +- core/field_textinput.js | 3 +- core/field_variable.js | 3 +- core/flyout_dragger.js | 7 +- core/flyout_horizontal.js | 3 +- core/flyout_vertical.js | 3 +- core/keyboard_nav/cursor_svg.js | 3 +- core/msg.js | 32 +- core/mutator.js | 13 +- core/names.js | 2 + core/rendered_connection.js | 3 +- core/renderers/geras/drawer.js | 4 +- core/renderers/geras/info.js | 4 +- core/renderers/geras/renderer.js | 4 +- core/renderers/measurables/connections.js | 10 +- core/renderers/measurables/inputs.js | 9 +- core/renderers/measurables/row_elements.js | 21 +- core/renderers/measurables/rows.js | 11 +- core/renderers/thrasos/info.js | 5 +- core/renderers/thrasos/renderer.js | 4 +- core/renderers/zelos/constants.js | 3 +- core/renderers/zelos/drawer.js | 4 +- core/renderers/zelos/info.js | 4 +- core/renderers/zelos/measurables/rows.js | 11 +- core/renderers/zelos/renderer.js | 4 +- core/toolbox.js | 7 +- core/touch_gesture.js | 3 +- core/ui_events.js | 3 +- core/utils.js | 11 +- core/utils/object.js | 52 +++ core/variable_events.js | 9 +- core/variables.js | 5 +- core/warning.js | 3 +- core/workspace.js | 9 - core/workspace_comment_svg.js | 5 +- core/workspace_events.js | 5 +- core/workspace_svg.js | 7 +- core/ws_comment_events.js | 16 +- core/xml.js | 14 - demos/blockfactory_old/index.html | 2 +- demos/custom-fields/pitch/field_pitch.js | 4 +- demos/custom-fields/turtle/field_turtle.js | 4 +- demos/custom-fields/turtle/index.html | 2 +- gulpfile.js | 19 +- i18n/create_messages.py | 4 - local_build/local_build.sh | 7 - msg/js/ab.js | 5 +- msg/js/ar.js | 5 +- msg/js/az.js | 5 +- msg/js/ba.js | 5 +- msg/js/bcc.js | 11 +- msg/js/be-tarask.js | 5 +- msg/js/be.js | 5 +- msg/js/bg.js | 13 +- msg/js/bn.js | 5 +- msg/js/br.js | 5 +- msg/js/ca.js | 5 +- msg/js/cs.js | 5 +- msg/js/da.js | 5 +- msg/js/de.js | 5 +- msg/js/diq.js | 5 +- msg/js/dty.js | 5 +- msg/js/ee.js | 5 +- msg/js/el.js | 5 +- msg/js/en-gb.js | 5 +- msg/js/en.js | 5 +- msg/js/eo.js | 5 +- msg/js/es.js | 5 +- msg/js/et.js | 5 +- msg/js/eu.js | 5 +- msg/js/fa.js | 5 +- msg/js/fi.js | 25 +- msg/js/fr.js | 13 +- msg/js/gl.js | 5 +- msg/js/gor.js | 5 +- msg/js/ha.js | 5 +- msg/js/he.js | 7 +- msg/js/hi.js | 5 +- msg/js/hrx.js | 5 +- msg/js/hu.js | 5 +- msg/js/hy.js | 5 +- msg/js/ia.js | 5 +- msg/js/id.js | 5 +- msg/js/ig.js | 5 +- msg/js/is.js | 5 +- msg/js/it.js | 5 +- msg/js/ja.js | 5 +- msg/js/kab.js | 5 +- msg/js/ko.js | 5 +- msg/js/lb.js | 5 +- msg/js/lki.js | 5 +- msg/js/lo.js | 5 +- msg/js/lrc.js | 5 +- msg/js/lt.js | 5 +- msg/js/lv.js | 5 +- msg/js/mk.js | 55 ++- msg/js/mnw.js | 5 +- msg/js/ms.js | 5 +- msg/js/nb.js | 5 +- msg/js/nl.js | 5 +- msg/js/oc.js | 5 +- msg/js/pl.js | 5 +- msg/js/pms.js | 5 +- msg/js/pt-br.js | 5 +- msg/js/pt.js | 5 +- msg/js/ro.js | 5 +- msg/js/ru.js | 5 +- msg/js/sc.js | 5 +- msg/js/sd.js | 5 +- msg/js/shn.js | 5 +- msg/js/sk.js | 5 +- msg/js/skr-arab.js | 11 +- msg/js/sl.js | 5 +- msg/js/sq.js | 5 +- msg/js/sr-latn.js | 5 +- msg/js/sr.js | 5 +- msg/js/sv.js | 13 +- msg/js/ta.js | 5 +- msg/js/tcy.js | 5 +- msg/js/te.js | 5 +- msg/js/th.js | 5 +- msg/js/tl.js | 5 +- msg/js/tlh.js | 5 +- msg/js/tr.js | 5 +- msg/js/ug-arab.js | 5 +- msg/js/uk.js | 5 +- msg/js/ur.js | 5 +- msg/js/vi.js | 5 +- msg/js/xmf.js | 5 +- msg/js/yo.js | 5 +- msg/js/zh-hans.js | 5 +- msg/js/zh-hant.js | 5 +- msg/json/en.json | 3 +- msg/json/qqq.json | 10 +- msg/messages.js | 4 - tests/compile/compile.sh | 23 +- tests/compile/index.html | 1 + tests/compile/main.js | 2 - tests/mocha/field_registry_test.js | 2 +- tests/mocha/field_test.js | 2 +- 162 files changed, 706 insertions(+), 959 deletions(-) create mode 100644 core/utils/object.js diff --git a/.travis.yml b/.travis.yml index 2ad7f4101..b5f109f00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,6 @@ addons: env: - TRAVIS_CI=true before_script: - # Symlink closure library used by test/jsunit - - ln -s $(npm root)/google-closure-library ../closure-library - export DISPLAY=:99.0 - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( tests/scripts/setup_osx_env.sh ) fi diff --git a/blockly_compressed.js b/blockly_compressed.js index e113ab4b1..666f49634 100644 --- a/blockly_compressed.js +++ b/blockly_compressed.js @@ -1,94 +1,24 @@ // Do not edit this file; automatically generated by build.py. 'use strict'; -var COMPILED=!0,goog=goog||{};goog.global=this||self;goog.isDef=function(a){return void 0!==a};goog.isString=function(a){return"string"==typeof a};goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&goog.isDef(b)?c[d]=b:c=c[d]&&c[d]!==Object.prototype[d]?c[d]:c[d]={}}; -goog.define=function(a,b){var c=b;if(!COMPILED){var d=goog.global.CLOSURE_UNCOMPILED_DEFINES,e=goog.global.CLOSURE_DEFINES;d&&void 0===d.nodeType&&Object.prototype.hasOwnProperty.call(d,a)?c=d[a]:e&&void 0===e.nodeType&&Object.prototype.hasOwnProperty.call(e,a)&&(c=e[a])}return c};goog.FEATURESET_YEAR=2012;goog.DEBUG=!1;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1; -goog.provide=function(a){if(goog.isInModuleLoader_())throw Error("goog.provide cannot be used within a module.");if(!COMPILED&&goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');goog.constructNamespace_(a)};goog.constructNamespace_=function(a,b){if(!COMPILED){delete goog.implicitNamespaces_[a];for(var c=a;(c=c.substring(0,c.lastIndexOf(".")))&&!goog.getObjectByName(c);)goog.implicitNamespaces_[c]=!0}goog.exportPath_(a,b)}; -goog.getScriptNonce=function(a){if(a&&a!=goog.global)return goog.getScriptNonce_(a.document);null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document));return goog.cspNonce_};goog.NONCE_PATTERN_=/^[\w+/_-]+[=]{0,2}$/;goog.cspNonce_=null;goog.getScriptNonce_=function(a){return(a=a.querySelector&&a.querySelector("script[nonce]"))&&(a=a.nonce||a.getAttribute("nonce"))&&goog.NONCE_PATTERN_.test(a)?a:""};goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/; -goog.module=function(a){if(!goog.isString(a)||!a||-1==a.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInGoogModuleLoader_())throw Error("Module "+a+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide."); -if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)}; -goog.module.getInternal_=function(a){if(!COMPILED){if(a in goog.loadedModules_)return goog.loadedModules_[a].exports;if(!goog.implicitNamespaces_[a])return a=goog.getObjectByName(a),null!=a?a:null}return null};goog.ModuleType={ES6:"es6",GOOG:"goog"};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()};goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG}; -goog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var a=goog.global.$jscomp;return a?"function"!=typeof a.getCurrentModulePath?!1:!!a.getCurrentModulePath():!1}; -goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0}; -goog.declareModuleId=function(a){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error("goog.declareModuleId may only be called from within an ES6 module");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error("goog.declareModuleId may only be called once per module.");if(a in goog.loadedModules_)throw Error('Module with namespace "'+a+'" already exists.');}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=a;else{var b=goog.global.$jscomp;if(!b||"function"!=typeof b.getCurrentModulePath)throw Error('Module with namespace "'+ -a+'" has been loaded incorrectly.');b=b.require(b.getCurrentModulePath());goog.loadedModules_[a]={exports:b,type:goog.ModuleType.ES6,moduleId:a}}};goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.forwardDeclare=function(a){}; -COMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&goog.isDefAndNotNull(goog.getObjectByName(a))},goog.implicitNamespaces_={"goog.module":!0});goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e=0;e>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid; -goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if("function"===typeof a.clone)return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)}; -goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')}); -a("es7",function(){return b("2 ** 2 == 4")});a("es8",function(){return b("async () => 1, true")});a("es9",function(){return b("({...rest} = {}), true")});a("es_next",function(){return!1});return{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(a,b){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var c=this.createRequiresTranspilation_();this.requiresTranspilation_=c.map;this.transpilationTarget_=this.transpilationTarget_|| -c.target}if(a in this.requiresTranspilation_)return this.requiresTranspilation_[a]?!0:!goog.inHtmlDocument_()||"es6"!=b||"noModule"in goog.global.document.createElement("script")?!1:!0;throw Error("Unknown language mode: "+a);},goog.Transpiler.prototype.transpile=function(a,b){return goog.transpile_(a,b,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(a){return a.replace(/<\/(SCRIPT)/ig,"\\x3c/$1")},goog.DebugLoader_=function(){this.dependencies_={}; -this.idToPath_={};this.written_={};this.loadingDeps_=[];this.depsToLoad_=[];this.paused_=!1;this.factory_=new goog.DependencyFactory(goog.transpiler_);this.deferredCallbacks_={};this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(a,b){function c(){d&&(goog.global.setTimeout(d,0),d=null)}var d=b;if(a.length){for(var e=[],f=0;f\x3c/script>";b.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}else{var e=b.createElement("script");e.defer=goog.Dependency.defer_;e.async=!1;e.type="text/javascript";(d=goog.getScriptNonce())&&e.setAttribute("nonce",d);goog.DebugLoader_.IS_OLD_IE_? -(a.pause(),e.onreadystatechange=function(){if("loaded"==e.readyState||"complete"==e.readyState)a.loaded(),a.resume()}):e.onload=function(){e.onload=null;a.loaded()};e.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path;b.head.appendChild(e)}}else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."),"deps.js"==this.relativePath?(goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."), -a.loaded()):a.pause()},goog.Es6ModuleDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(a){function b(a,b){var c=b?' - +