There are small typos in:
- closure/goog/base.js
- demos/minimap/minimap.js
- gulpfile.js
- scripts/gulpfiles/build_tasks.js
- scripts/gulpfiles/cleanup_tasks.js
- scripts/gulpfiles/license_tasks.js
Fixes:
- Should read `prerequisites` rather than `prequisites`.
- Should read `satisfies` rather than `satisifies`.
- Should read `regenerates` rather than `regenrates`.
- Should read `minimap` rather than `mimimap`.
- Should read `diagnostic` rather than `disagnostic`.
Signed-off-by: Tim Gates <tim.gates@iress.com>
* feat: added `tests/typescript` to test supported TS examples
* fix: update the test name, description, and output
* chore: remove unused imports in `test_tasks.js`
* fix: wrap README line at 80 characters
* fix: implemented `different_user_input.ts` feedback
* fix: correct mistaken comments
* chore: rename `./eslintrc.json` to `./eslintrc.js`
* feat: added linting for tests/typescript
* chore: cleanup eslintrc lines over 80 characters
* fix: updated `.eslintrc.js` to provide an override for linting itself
* fix: updated tests to build to the `build` directory
* feat: updated `gulp format` to handle formatting `.eslintrc.js`
* fix: updated `.eslintrc.js` to align with both formatter and linter
* fix: updated config comment wording
* fix: removed quotes for valid identifiers
* Revert "fix: removed quotes for valid identifiers"
This reverts commit 03eff91aea1468e503bc79a90fb139914d3f39d2.
* fix(tests): Fix errors in event tests
- Fix actual syntax errors in imports in event_marker_move_test.js
and event_selected.test.js, which were preventing those tests from
being run.
- Remove suite.only directives in those tests that would prevent
all the other tests from running.
* refactor(build): Improve buildDeps
- Run closure-make-deps only once, instead of separately for core/
and tests/.
- Specify a larger exec maxBuffer size, to ensure output and
diagnostics are not truncated.
- Change stderr filtering in buildDeps to filter out bounded
generics messages and blank lines.
- Attempt to suppress warnings in stderr output when
closure-make-deps returns a non-zero exit code.
Unfortunately, there seems to be a race condition which usually
the stderr argument to the exec callback not to contain the
complete output, so in that case print a helpful message.
- Have buildDeps just return a Promise instead of using a callback.
* fix(docs): Typo fix in JSDoc for log helper
* docs(icon): Better description for Icon.prototype.setVisible
Also tweak description of getBlock.
* docs(blocks): Fix typo in description of BlockDefinition
* chore(tests): Factor out common goog:chromeOptions
* chore(build): Minor style fixes
To make `npm install` and `npm ci` faster, and to avoid redundant
work when doing either of these followed by `npm run build` (or
any other script which does a build), delete the `prepare`
script and instead add an invocation of `npm run deps` to the
beginning of the `start` script.
* Add tsick.js to rewrite enums.
tsc generates JavaScript which is incompatible with the Closure Compiler's advanced optimizations.
* Remove unused 'outputCode' variable.
* Rename 'run_X_in_browser.js' to 'webdriver.js'
The Mocha and generator tests can both be run either manually or via our webdriver. In all cases they run in a browser. These two 'run_X_in_browser.js' files only apply to webdriver, thus they are confusingly named.
Also delete completely unused (and broken) `run_all_tests.sh`
* Linting improvements to mocha/webdriver.js
Still not at 100%. Complains about require/module/process/__dirname not being defined in multiple places.
* runTestBlock -> runTestFunction
'Block' means something very different in Blockly.
* Removal of `var` from scripts.
* Add webdriver test to verify compile test worked.
* Resolve conficts with 'develop'.
* Address PR comments.
* feat(build): Make build tasks invoke their prerequisites
- Divide gulp targets into three kinds: main sequence,
manually invokable, and script-only. The first two categories
automatically invoke their prerequisites.
- Give (most of) the affected gulp targets shorter and more memorable
names that could become their npm script names in future.
* feat(build): Make package tasks invoke their prerequisites
Have the package task invoke the cleanBuildDir (as well as
cleanPackageDir) and build tasks. Remove the checkBuildDir
task as it is now redundant since a fresh build is done every
time.
* feat(build): Make git tasks invoke their prerequisites
* feat(build): Make cleanup, license [sic] tasks invoke their prerequisites
Turns out they don't have any, so this commit just classifies
their gulp targets according to the established scheme.
* feat(build): Make appengine tasks invoke their prerequisites
In this case prepareDeployDir will eventually depend on package
but does not for now.
* feat(build): Have npm scripts run npm ci first where applicable
Have any npm script that have external effects (e.g. publishing an
npm package, pushing a new version to appengine, or updating GitHub
Pages) start by running npm ci to ensure that all dependencies are
up-to-date with respect to package-lock.json.
(This is done by npm and not a gulp script because gulp itself
might need updating. So might npm, but that is less likely to
make any difference to what gets published/pushed.)
* chore(build): have tests use package target
Have the tests just run the package target (with debug flags)
since that runs the the build target automatically.
* feat(tests): Write Closure Compiler output directly to dist/
Since they are already UMD-wrapped, have Closure Compiler write
output chunks directly to RELEASE_DIR, i.e. dist/.
* chore(tests): Use freshly-build files in compressed mode.
Use the freshly-built build/*_compresssed.js files when bootstrapping
in compressed mode, rather than using the checked-in files in the
repository root.
This helps ensure that compressed and uncompressed mode will be
testing (as closely as possible) the same code.
Obsoletes #6218 (though the issues discussed there have not actually
yet been addressed in this branch).
* chore(build): Write intermediate langfiles to build/msg
Write the results of create_messages.py to build/msg instead of
build/msg/js.
* fix(build): Use build/msg/en.js instead of msg/messages.js in tests
This has no direct effect but fixes a long-standing misdesign
where we are testing against the input to, rather than the output
of, the language file processing pipeline.
* feat(demos): Use freshly-built files
Use the freshly-built dist/*_compresssed.js and build/msg/* files
rather than using the checked-in files in the repository root.
This helps ensure that these demos are using the most recent
version of Blockly (even in the develop branch).
* fix(build): Update appengine deployment to include built files
Modify the prepareDemos task as follows:
- Use the git index instead of HEAD, so that most local changes
will be applied (without copying whatever .gitignored cruft
might be in the local directory).
- Run clean and build and then copy build/msg and
dist/*_compressed.js* to the deploy directory.
This fixes the problem created by the previous commit, wherein the
demos relied on built files that were not being deployed to
appengine.
* fix(build): Update GitHub Pages deployment to include built files
Modify the updateGithubPages task to run clean and build and
then git add build/msg dist/*_compressed.js*, so that they will
be included in the deployed pages.
This fixes the problem created by the previous^2 commit,
wherein the demos relied on built files that were not being
deployed to GitHub Pages.
* chore(build): Remove build products from repository
Remove *_compressed.js* and msg/js/* from the blockly repository.
Also remove the now-obsolete checkinBuilt gulp task.
* chore(build): Apply relevant changes to test_tasks.js
Apply changes made to run_all_tests.sh and check_metadata.sh to
the corresponding parts of their JS replacements in
test_tasks.js.
* chore(build): Make updates suggested in PR #6475
- Remove `clean:builddir` and `clean:releasedir` - `clean`
is sufficient.
- Remove duplicate `require` from `appengine_tasks.js`.
* feat(build): Use shorter npm script names
Since scripts that run build tasks now automatically run their
prerequisite tasks, the previous naming scheme of task `build`
running all the `build:subtask`s no longe really makes very
much sense.
Additionally, following a chat discussion, there seems to be a
rough consensus to use "messages" to refer to the .json input
files, and "langfiles" to the generated .js output files.
Consequently, simplify npm script names by renaming as follows:
- "generate:langfiles" -> "messages"
- "build:langfiles" -> "langfiles"
- "build:js" -> "tsc"
- "build:deps" -> "deps"
- "build:compiled" -> "minify"
- "build:compressed": delete this synonym for "build:compiled",
("minify" was chosen as agnostic to Closure Compiler vs. WebPack.)
* chores(build): Add deprecation notice for old scripts
To reduce potential confusion/frustration, restore the previous
npm scripts but have them display a deprecation notice instead
(note that npm prints the script contents before running it, so
echo is not needed).
* docs(build): Add comments distinguishing 'messages' from 'langfiles'
* build: build/test on windows
* chore(deps): bump @hyperjump/json-schema from 0.18.4 to 0.18.5
* chore(deps): add gulp-gzip 1.4.2
* build: migrate test scripts to gulp task (test_tasks.js)
* build: not to use the grep command
* build: normalize path
* fix: Modified based on review suggestions.
* Add JSDoc comment
* Line length <= 80 characters.
* Formatting test output as previously.
* Always continue even if a test unit fails.
* Suppress the gulp messages.
* Fix test_tasks.js to pass eslint.
* fix: Modified based on review suggestions.
* Change generator test output directory.
* Formatting test output as previously.
* fix: Formatting test output as previously.
* fix: Modified based on review suggestions.
* chore(build): Add inline sources to sourcemaps
* chore(build): Don't package sources
Since the sources are now inline in the sourcemaps, they no longer
need to be package separately.
PR #6244 made a change to have the npm run prepare script
(automatically invoked by npm install after package installation)
not bother running the buildJavaScriptAndDeps gulp task when run
from a GitHub action (since our build action will do npm test
straight afterwards, which runs this task already).
Unfortunately, due my misunderstanding of how gulp tasks work
the revised version generated a "Did you forget to signal async
completion?" error from gulp.
Fix this by adding a done parameter and passing the provided
callback to buildJavaScriptAndDeps. This also allows a
simplification of the the don't-run case by simply calling
done and then returning.
Get sourcemaps working again.
- The change in tsconfig.json is sufficient to get functional,
per-.ts-file sourcemaps in build/src/** that work in
uncompiled mode (i.e. in the playground / tests).
- No further changes are required for these to be ingested by
gulp + Closure Compiler; the resulting files -
build/*_compressed.js.map - now point at files in
core/, blocks/, etc. This works correctly when packaged and
also when doing local testing in compiled mode of the checked-in
build products (i.e., after they are copied to the repository
root.)
- In order to get sourcemaps to work for local testing in
compiled mode of the build products directly from build/,
buildCompile now creates symlinks from build/ to core/,
blocks/ and generators/.
* fix: convert files to typescript
* fix: add alias for AnyDuringMigration so that tsc will run
* chore: format
* chore: enable ts for the clang-format workflow (#6233)
* chore: Restore @fileoverview comment locations (#6237)
* chore: add declareModuleId (#6238)
* fix: Revert comment change to app_controller.js (#6241)
* fix: Add missing import goog statements (#6240)
I've added the import statement immediately before the
goog.declareModuleId calls that depend on it.
There is an argument to be made that we should put the import
statement in their normal place amongst any other imports, and
move the declareModuleId statement to below the double blank
line below the imports, but as these are so tightly coupled,
replace the previous goog.module calls, and will both be deleted
at the same time once the transition to TypeScript is fully complete
I think it's fine (and certainly much easier) to do it this way.
* chore: Fix whitespace (#6243)
* fix: Remove spurious blank lines
Remove extraneous blank lines introduced by deletion of
'use strict'; pragmas.
Also fix the location of the goog.declareModuleId call in
core/utils/array.ts.
* fix: Add missing double-blank-line before body of modules
Our convention is to have two blank lines between the imports (or
module ID, if there are no imports) and the beginning of the body
of the module. Enforce this.
* fix: one addition format error for PR #6243
* fix(build): Skip npm prepare when running in CI (#6244)
Have npm prepare do nothing when running in CI.
We don't need to do any building, because npm test will build
everything needed in the workflows in which it is run, and we
don't want to build anything in other workflows because a tsc
error would prevent those workflows from completing.
* fix: re-add `@package` annotations as `@internal` annotations (#6232)
* fix: add ~70% of internal attributes
* fix: work on manually adding more @internal annotations
* fix: add more manual internal annotations
* fix: rename package typos to internal
* fix: final manual fixes for internal annotations
* chore: format
* chore: make unnecessary multiline jsdoc a single line
* fix: fix internal tags in serialization exceptions
* fix: tsc errors picked up from develop (#6224)
* fix: relative path for deprecation utils
* fix: checking if properties exist in svg_math
* fix: set all timeout PIDs to AnyDuringMigration
* fix: make nullability errors explicity in block drag surface
* fix: make null check in events_block_change explicit
* fix: make getEventWorkspace_ internal so we can access it from CommentCreateDeleteHelper
* fix: rename DIV -> containerDiv in tooltip
* fix: ignore backwards compat check in category
* fix: set block styles to AnyDuringMigration
* fix: type typo in KeyboardShortcut
* fix: constants name in row measurables
* fix: typecast in mutator
* fix: populateProcedures type of flattened array
* fix: ignore errors related to workspace comment deserialization
* chore: format files
* fix: renaming imports missing file extensions
* fix: remove check for sound.play
* fix: temporarily remove bad requireType.
All `export type` statements are stripped when tsc is run. This means
that when we attempt to require BlockDefinition from the block files, we
get an error because it does not exist.
We decided to temporarily remove the require, because this will no
longer be a problem when we conver the blocks to typescript, and
everything gets compiled together.
* fix: bad jsdoc in array
* fix: silence missing property errors
Closure was complaining about inexistant properties, but they actually
do exist, they're just not being transpiled by tsc in a way that closure
understands.
I.E. if things are initialized in a function called by the constructor,
rather than in a class field or in the custructor itself, closure would
error.
It would also error on enums, because they are transpiled to a weird
IIFE.
* fix: context menu action handler not knowing the type of this.
this: TypeX information gets stripped when tsc is run, so closure could
not know that this was not global. Fixed this by reorganizing to use the
option object directly instead of passing it to onAction to be bound to
this.
* fix: readd getDeveloperVars checks (should not be part of migration)
This was found because ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE was no
longer being accessed.
* fix: silence closure errors about overriding supertype props
We propertly define the overrides in typescript, but these get removed
from the compiled output, so closure doesn't know they exist.
* fix: silence globalThis errors
this: TypeX annotations get stripped from the compiled output, so
closure can't know that we're accessing the correct things. However,
typescript makes sure that this always has the correct properties, so
silencing this should be fine.
* fix: bad jsdoc name
* chore: attempt compiling with blockly.js
* fix: attempt moving the import statement above the namespace line
* chore: add todo comments to block def files
* chore: remove todo from context menu
* chore: add comments abotu disabled errors
* chore: move comments back to their correct positions (#6249)
* fix: work on fixing comments
* chore: finish moving all comments
* chore: format
* chore: move some other messed up comments
* chore: format
* fix: Correct enum formatting, use merged `namespace`s for types that are class static members (#6246)
* fix: formatting of enum KeyCodes
* fix: Use merged namespace for ContextMenuRegistry static types
- Create a namespace to be merged with the ContextMenuRegistry
class containing the types that were formerly declared as static
properties on that class.
- Use type aliases to export them individually as well, for
compatibility with the changes made by MigranTS (and/or
@gonfunko) to how other modules in core/ now import these
types.
- Update renamings.json5 to reflect the availability of the
direct exports for modules that import this module directly
(though they are not available to, and will not be used by,
code that imports only via blockly.js/blockly.ts.)
* fix: Use merged namespace for Input.Align
- Create a merged namespace for the Input.Align enum.
- Use type/const aliases to export it as Input too.
- Update renamings.json5 to reflect the availability of the
direct export.
* fix: Use merged namespace for Names.NameType
- Create a merged namespace for the Names.NameType enum.
- Use type/const aliases to export it as NameType too.
- Update renamings.json5 to reflect the availability of the
direct export. (This ought to have happened in an earlier
version as it was already available by both routes.)
* chore: Fix minor issues for PR #6246
- Use `Align` instead of `Input.Align` where possible.
* fix(build): Suppress irrelevant JSC_UNUSED_LOCAL_ASSIGNMENT errors
tsc generates code for merged namespaces that looks like:
(function (ClassName) {
let EnumName;
(function (EnumName) {
EnumName[EnumNameAlign["v1"] = 0] = "v1";
// etc.
})(EnumName = ClassName.EnumName || (ClassName.EnumName = {}));
})(ClassName || (ClassName = {}));
and Closure Compiler complains about the fact that the EnumName let
binding is initialised but never used. (It exists so that any other
code that was in the namespace could see the enum.)
Suppress this message, since it is not actionable and lint and/or tsc
should tell us if we have actual unused variables in our .ts files.
* chore(build): Suppress spurious warnings from closure-make-deps (#6253)
A little bit of an ugly hack, but it works: pipe stderr through
grep -v to suppress error output starting with "WARNING in".
* fix: remaining enums that weren't properly exported (#6251)
* fix: remaining enums that weren't properly exported
* chore: format
* fix: add enum value exports
* chore: format
* fix: properly export interfaces that were typedefs (#6250)
* fix: properly export interfaces that were typedefs
* fix: allowCollsion -> allowCollision
* fix: convert unconverted enums
* fix: enums that were/are instance properties
* fix: revert changes to property enums
* fix: renamed protected parameter properties (#6252)
* fix: bad protected parameter properties
* chore:format
* fix: gesture constructor
* fix: overridden properties that were renamed
* refactor: Migrate `blockly.js` to TypeScript (#6261)
* chore: Apply changes to blockly.js to blockly.ts
* fix: Build using core/blockly.ts instead of .js
Compiles and runs in compressed mode correctly!
* fix(build): Don't depend on execSync running bash (#6262)
For some reason on Github CI servers execSync uses /bin/sh, which
is (on Ubuntu) dash rather than bash, and does not understand
the pipefail option.
So remove the grep pipe on stderr and just discard all error output
at all.
This is not ideal as errors in test deps will go unreported AND
not even cause test failure, but it's not clear that it's worth
investing more time to fix this at the moment.
* chore: use `import type` where possible (#6279)
* chore: automatically change imports to import types
* chore: revert changes that actually need to be imports
* chore: format
* chore: add more import type statements based on importsNotUsedAsValues
* chore: fix tsconfig
* chore: add link to compiler issue
* fix: add type information to blockly options (#6283)
* fix: add type information to blockly options
* chore: format
* chore: remove erroneous comment
* fix: bugs revealed by getting the built output working (#6282)
* fix: types of compose and decompose in block
* fix: workspace naming in toolbox
* chore: add jsdoc
* chore: restore registry comments to better positions
* chore: pr comments'
* fix(variables): Revert inadvertent change to allDeveloperVariables (#6290)
It appears that a function call got modified incorrectly (probably
in an effort to fix a typing issue). This fix trivially reverts
the line in question to match the original JS version from develop.
This causes the generator tests to pass.
* fix: circular dependencies (#6281)
* chore: fix circular dependencies w/ static workspace funcs
* remove preserved imports that aren't currently necessary (probably)
* fix circular dependency with workspaces and block using stub
* fix dependency between variables and xml by moving function to utils
* add stub for trashcan as well
* fix line endings from rebase
* fix goog/base order
* add trashcan patch
* fix: types of compose and decompose in block
* fix: workspace naming in toolbox
* chore: add jsdoc
* chore: restore registry comments to better positions
* chore: remove implementations in goog.js
* chore: fix types of stubs
* chore: remove added AnyDuringMigration casts
* chore: remove modifications to xml and variables
* chore: format
* chore: remove event requirements in workspace comments
* chore: fix circular dependency with xml and workspace comments
* fixup remove ContextMenu import
* chore: fix dependency between mutator and workspace
* chore: break circular dependency between names and procedures
* chore: get tests to run?
* chore: pr comments'
* chore: fix stubbing field registry fromJson
* chore: fix spying on fire
* chore: fix stubbing parts of connection checker
* chore: fix stubbing dialog
* chore: fix stubbing style
* chore: fix spying on duplicate
* chore: fix stubbing variables
* chore: fix stubbing copy
* chore: fix stubbing in workspace
* chore: remove unnecessary stubs
* chore: fix formatting
* chore: fix other formatting
* chore: add backwards compatible static properties to workspace
* chore: move static type properties
* chore: move and comment stubs
* chore: add newlines at EOF
* chore: improve errors for monkey patched functions
* chore: update comment with a pointer to the doc
* chore: update comment with a pointer to the doc
* chore: format
* chore: revert changes to playground used for testing (#6292)
* chore: get mocha tests to pass. (#6291)
* chore: fix undo and empty code blocks
* chore: skip IE test
* chore: fix gesture test
* chore: fix replace message references test
* chore: fix string table interpolation
* chore: skip getById tests
* chore: fix field tests
* chore: fix console errors by making workspace nullable
* chore: format
* chore: fix definition overwrite warning
* chore: update metadata
* chore: temporarily modify the the advanced compile test
* chore: fix gestures by fixing test instead
Co-authored-by: Neil Fraser <fraser@google.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* fix!: Move backwards-compatibility hacks out of blockly.js
Move accessor properties for Blockly.alert, .confirm,
.mainWorkspace, .prompt, .selected, .HSV_SATURATION and
.HSV_VALUE, as well as the hack to allow loading of messages
via <script> tags, from core/blockly.js to core/main.js,
which becomes the entrypoint for the first chunk when
compiled.
BREAKING CHANGE: The aforementioned properties / hack are no
longer available in uncompiled mode (or when using advanced
compilation, unless also compiling against main.js.)
* fix!: Move backwards-compatibility hacks out of contextmenu.js
Move accessor property for ContextMenu.currentBlock from
core/contextmenu.js to core/main.js.
* chore: Update deprecation date for Generator.variableDB_ accessors
Bring the deprecation date forward from May 2026 to September 2022.
Not technically a breaking change—just a warning that there will
be a breaking change earlier than previously advertised.
* fix!: Move backwards-compatibility hacks out of tooltip.js
Move accessor properties for Blockly.Tooltip.visible and .DIV
from core/tooltip.js to core/main.js.
* fix!: Move backwards-compatibility hacks out of widgetdiv.js
Move accessor property for Blockly.WidgetDiv.DIV
from core/widgetdiv.js to core/main.js.
* fix(build): Minor corrections to build_tasks.js
- Use TSC_OUTPUT_DIR to find goog/goog.js when suppressing warnings.
- Remove unnecessary trailing semicolons.
* refactor(blocks): Remove declareLegacyNamespace
Remove the call to goog.module.declareLegacyNamespace from
Blockly.libraryBlocks. This entails:
- Changes to the UMD wrapper to be able to find the exports object.
- Changes to tests/bootstrap_helper.js to save the exports object
in the libraryBlocks global variable.
- As a precaution, renaming the tests/compile/test_blocks.js module
so that goog.provide does not touch Blockly or
Blockly.libraryBlocks, which may not exist / be writable.
* feat(build): Add support named exports from chunks
We need to convert the generators to named exports. For backwards
compatibility we still want e.g. Blockly.JavaScript to point at
the generator object when the chunk is loaded using a script tag.
Modify chunkWrapper to honour a .reexportOnly property in the
chunks table and generate suitable additional code in the UMD
wrapper.
* refactor(generators): Migrate JavaScript generator to named export
- Export the JavaScript generator object as javascriptGenerator
from the Blockly.JavaScript module(generators/javascript.js).
- Modify the Blockly.JavaScript.all module
(generators/javascript/all.js) to reexport the exports from
Blockly.JavaScript.
- Update chunk configuration so the generator object remains
available as Blockly.JavaScript when loading
javascript_compressed.js via a <script> tag.
(N.B. it is otherwise necessary to destructure the require
/ import.)
- Modify bootstrap_helper.js to store that export as
window.javascriptGenerator for use in test code.
- Modify test code to use javascriptGenerator instead of
Blockly.JavaScript.
- Modify .eslintrc.json so that javascriptGenerator is allowed
as a global in test/. (Also restrict use of Blockly global
to test/.)
N.B. that demo code in demos/code/code.js uses <script> tag
loading and so will continue to access Blockly.JavaScript.
* refactor(generators): Migrate Lua generator to named export
* refactor(generators): Migrate PHP generator to named export
* refactor(generators): Migrate Python generator to named export
* refactor(generators): Remove declareLegacyNamespace calls
Remove the goog.module.declareLegacyNamespace calls from the
generators.
This turns out to have the unexpected side-effect of causing the
compiler to rename the core/blockly.js exports object from
$.Blockly to just Blockly in blockly_compressed.js - presumably
because it no longer needs to be accessed in any subsequent chunk
because they no longer add properties to it. This requires
some changes (mainly simplification) to the chunkWrapper function
in build_tasks.js.
* refactor(core): Remove declareLegacyNamespace from blockly.js
So easy to do _now_: just need to:
- Make sure the UMD wrapper for the first chunk knows where the
exports object is.
- Use that same value to set the Blockly.VERSION @define.
- Have bootstrap_helper.js set window.Blockly to the exports
object.
- Fix tests/compile/test_blocks.js to not assume a Blockly
global variable, by converting it to a goog.module so we
can use a named require.
* fix(tests): Use tsc-compiled base.js to allow use of goog.js
The Closure Compiler complains if you try to feed it a file named
goog.js which is not in the same directory as the Closure Library's
base.js. Since tsc will "compile" goog.js when it encounters an
"import ... from '.../goog.js'", it is necessary to also have tsc
"compile" base.js and base_minimal.js, so they will come from the
same directory. This necessitates some updates to paths in
* docs(build): JSDoc update for JSCOMP_WARNING
* refactor(utils): Convert utils/deprecation.js to TypeScript
This was done manually for test/proving purposes and might need to
be corrected based on what MigranTS generated.
* chore(utils): Update utils/deprecation.ts from MigranTS output
This manually applies certain changes from BeksOmega's ts/migration2
branch, but notably:
- I did not apply the reordering of the doc comments at the top.
- I applied the deletion of types and @package from the JSDoc.
- I preserved the import goog and goog.declareModuleId lines.
- I have applied a whitespace change on line 37 which violates the
styleguide; I want to figure out why clang-format is not fixing
this.
* feat(build): clang-format .ts files
And fix formatting issues introduced by MigranTS in deprecation.ts.
* fix(build): Fix sources for advanced compilation test
I'm not sure why this didn't fail on my local machine previously;
perhaps it succeeded only because of leftover files and would have
failed if I'd run npm run clean.
* fix(build): Disable checkTypes diagnostic group
Unfortunately TSC doesn't output type information in a form
that Closure Compiler can understand, so the latter raises errors
for situations like omitting an optional parameter.
We may have to turn off more diagnostics in future, but for now
this is sufficient.
* chore(utils): Use @internal where we previously used @package
Per comments on PR #6220.
This requires that we disable the nonStandardJsDocs diagnostic.
* refactor(tests): Move and rename prepare.js, blockly.mjs
Since prepare.js and blockly.mjs are going to be needed for running
all tests in uncompiled mode (not just the playgrounds), move them
tests/. Further, rename prepare.js to bootstrap.js to better reflect
its purpose.
* feat(tests): Introduce BLOCKLY_BOOTSTRAP_OPTIONS
Provide a mechanism for web pages that use bootstrap.js to control
what is loaded and how.
* fix(tests): Use the blockly repository path for all script src= URLs
Previously the (non-advanced) playground was only correctly loadging
on localhost because you can put an arbitrary number of "../"s in front
of a relative URL and it just takes you to the root directory.
* fix(tests): Don't use template literals in bootstrap.js
This is necessary (but not necessarily sufficient) to be able to
load the file in IE 11.
* fix(tests): Throw error if attempting to bootstrap in node.js
* feat(tests): Make bootstrap.js more configurable.
* Terminology change: use "compressed" and "uncompressed" to describe
what Closure Compiler calls "compiled" and "uncompiled", to reduce
confusion with the compilation that will be done by tsc.
* Get the list of modules to bootstrap (in compressed mode), or
scripts to load (in compressed mode) from BLOCKLY_BOOTSTRAP_OPTIONS,
to allow calling scripts to to specify exactly what to load.
* feat(tests): Use a proper quote function
We need to generate string literals. Best to use a quote function
instead of concatenating on quote marks withou escaping. Copy a
well-tested one from Code City.
* feat(tests): Support an additionalScripts option
This is a list of scripts to load (in order) once the required modules
have been bootstrapped.
We do this using goog.addDependency to make the first script depend
on the required modules, then each subsequent script depend on the
previous one, and then finally goog.bootstrapping the last such script.
* refactor(tests): Remove special handling of msg/messages.js
* refactor(tests): Use additionalScripts for all script loading
Use additionalScripts option for all script loading in
playground.html and advanced_playground.html.
* refactor(tests): Use bootstrap instead of uncompressed in Mocha tests
Use tests/bootstrap.js instead of blockly_uncompressed.js to load
blockly in uncompressed mode in the Mocha tests.
This entails adding a new item, despFiles, to BLOCKLY_BOOTSTRAP_OPTIONS,
to allow tests/deps.mocha.js to be loaded at the appropriate point.
Mention of blockly_uncompressed.js is removed from
tests/mocah/.mocharc.js; it's not clear to me what effect the "file:"
directive in this file might have previously had and I was not able to
find documentation for it on mochajs.org, but in any case removing it
appears to have had no ill effect.
* refactor(tests): Use bootstrap instead of uncompressed in generator tests
This entails adding an additional check in bootstrap so as to load
uncompressed when loading from a file: URL, since these are not
localhost URLs - though in fact the generator tests run equally well
in compressed mode, albeit against (for now) the previously-check-in
build products rather than the live code.
* refactor(test): Use bootstrap.js in multi_playground.html
This removes the last use of load_all.js, so remove it.
* 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 playground.html.
* fix(tests): Rewrite bootstrap sequencing code
An earlier commit modified the generated <script> to use
goog.addDependency to trick the debug module loader into loading
.additionalScripts (via goog.bootstrap), but it turns out there is
a small problem: scripts like msg/messages.js have undeclared
dependencies on the Blockly module, and without a call to
goog.require('Blockly') in them they can end up being run before
the Blockly module is fully loaded.
(This problem only occurs when there are ES Modules, rather than
merely goog.modules, in the mix.)
Fix this by adding a script, bootstrap_helper.js, to be loaded
options.requires and any options.additionalScripts that makes an
explicit call to goog.require for each of option.requires.
Also refactor the code so that instead of generating a loop which
calls goog.addDependency, we generate the addDependency calls
directly. This makes debugging a bit easer as we can use the browser's
dev tools to inspect the generated calls in the DOM tree.
* fix(tests): Prevent spurious transpilation warnings
For some reason when the debug module loader encounters ES modules
it starts to complain about being unable to transpile some ES202x
features in other (non-ESM) modules, even though it doesn't normally
try to transpile those.
Since uncompressed-mode testing is almost exclusively on modern
browsers we don't care about transpiling these features, so suppress
the warnings instead.
* refactor(tests): Rename blockly.mjs to bootstrap_done.mjs; simplify
Since blockly.mjs is no longer returning just the exports object
from core/blockly.js (see PR #5995), it might be better named after
its actual purpose: to wait for bootstrapping to be done.
Remove all the code that was used to pass the blockly.js exports
object along from the bootstrap callback to the blockly.mjs export,
since there's no reason to go to a lot of trouble to set a local
variable named Blockly to the same value as a global variable named
Blockly.
(Something like this may be needed again in future, but certainly in
a different form.)
* chore(tests): Use freshly-build files in compressed mode.
Use the freshly-built build/*_compresssed.js files when bootstrapping
in compressed mode, rather than using the checked-in files in the
repository root.
This helps ensure that compressed and uncompressed mode will be
testing (as closely as possible) the same code.
* chore(tests): Rename BlocklyLoader to blocklyLoader; record compressed
- Rename the BlocklyLoader global to blocklyLoader (since it is not
a class constructor).
- Create it regardless of whether we are bootstrapping in
uncompressed or loading compressed via <script> tags.
- Record which we are doing as .compressed, and use this property
to choose playground background colour.
* chore(tests): Resolve comments for PR #6214
Mostly documentation changes, but notably renaming blocklyLoader to
bootstrapInfo.
* Revert "chore(tests): Use freshly-build files in compressed mode."
This reverts commit de8d356838.
* chore(deps): Update closure/goog/base.js, add goog.js
- Update base.js from the latest version (20220502.0.0).
- Also copy over goog.js, which provides access to a suitable subset
of goog.* via an importable module).
* chore(build): Split gulpfiles/config.js exports object
This makes it possible for entries to depend on each other.
* chore(build): build config consistency
- Reorder entries in gulpfiles.config.js to better match order they
are used.
- Have update_metadata.sh reference config.js and vice versa.
* refactor(build): Move deps.js (+ deps.mocha.js) from test/ to build/
Once we start using tsc, deps.js will be created based on the ouptut
of tsc rather than the raw source in core/. Since tsc will need to
be run before running closure-make-deps and also before trying to
load blockly_uncompressed.js, it doesn't really make sense to check
in deps.js; it's better to re-create as needed.
To reduce inconvenience, a new "prepare" script is added to
package.json which will run the buildDeps gulp target automaticaly
when one runs npm install.
* refactor(build): Always build from TypeScript sources
- Add buildJavaScript gulp task to use tsc to compile any .ts files
in core/ into build/src/core/ (and also copy any .js files that
are not yet migrated to TypeScript, which for now is all of them.
- Remove closure/goog from explicit inputs to tsc; it will find
the files it needs (e.g., goog.js) automatically.
- Have buildDeps, the playground, and all the tests that run in
uncompiled mode use build/src/core/ instead of core/ as their
input directory.
* feat(build): Add buildJavaScriptAndDeps gulp task
Have npm run build:deps (and npm run prepare) use a new gulp task,
buildJavaScriptAndDeps, to run tsc followed by closure-make-deps,
ensuring that deps.js is calculated based on the most recent code
in core/.
* fix(build): Fix implementation of flattenCorePaths
Even though this function is going away I want to remove it in
a separate PR so that we can revert easily if desired. But the
previous checked-in code was totally wrong. This version works.
* fix(build): Don't let checkinBuilt copy build/src/**
Now that we are putting a lot more stuff in build/ (specifically,
all the tsc output in build/src/), modify checkinBuilt so that it
only copies the specific things we want to check in (for now):
- _compressed.js build artifacts and their accompanying .js.maps
- the generated build/msg/js/*.js language files.
Unrelatedly, also fix safety-quoting of arguments for one execSync
call.
* fix(build): Correctly handle out-of-order chunks
It turns out that closure-calculate-chunks does not guarantee that
calculated chunks will be output in the same order as the
entrypoints, so modify getChunkOptions so that it no longer makes
that assumption.
* refactor(build): Introduce NAMESPACE_PROPERTY; rename NAMESPACE_OBJECT
Rename the constant NAMESPACE_OBJECT to NAMESPACE_VARIABLE to
better explain its actual meaning, and introduce
NAMESPACE_PROPERTY to specify what property the namespace object
will be stored in (and change the previous value, "internal_",
to "__namespace__" to reduce the chance of conflicts with
properties created by the output of Closure Compiler).
* refactor(build): Always save namespace object on chunk exports object
This is so that chunks whose parent chunk is not the root chunk
(chunks[0]) can obtain the namespace object. (See following commit.)
* fix(build): Correct handling of chunk dependencies
Previously getChunkOptions and chunkWrapper incorrectly assumed
that a chunk could have more than one dependency.
In fact, each chunk can have only a single dependency, which is
its parent chunk. It is used only to retrieve the namespace
object, which is saved on to the exports object for the chunk so
that any child chunk(s) can obtain it.
Update getChunkOptions and chunkWrapper (making the latter
longer but more readable) accordingly.
* refactor(build): Rename/repurpose chunk.exports -> .reexport
And remove chunk.importAs, since it was no longer being used
anywhere.
* fix: remove unnecessary s from reexports
Co-authored-by: alschmiedt <aschmiedt@google.com>
* refactor(tests): Migrate tests/compile/main.js to goog.module
* feat(tests): Enable --debug for test:compile:advanced; demote errors
* Enable the --debug flag when running the
buildAdvancedCompilationTest gulp task.
* Remove partialAlias diagnostic group from `JSC_ERROR`, demoting
JSC_PARTIAL_NAMESPACE to warning.
Reverts "Revert 'fix(tests): Enable --debug for test:compile:advanced;
fix some errors (#5959)'".
Because of our mis-use of @package, and the removal of the hack
that made it work reasonably (in PR #5918), compilation was
generating a large number of JSC_BAD_PACKAGE_PROPERTY_ACCESS
warnings, making it hard to see any other warnings/errors that
might be generated.
To make compiler diagnostics more useful, disable the visibility
diagnostic group entirely for the time being.
Also improve the documentation for JSCOMP_ERROR and the newly-
-introduced JSCOMP_WARNING and JSCOMP_OFF.
...and rename Blockly.blocks.all (blocks/all.js) to
Blockly.libraryBlocks (blocks/blocks.js
BREAKING CHANGE: (only) because the exports object from the
`blocks_compressed.js` chunk will be accessed as
`Blockly.libraryBlocks` instead of `Blockly.blocks.all` when the
chunk is loaded in a browser via a `<script>` tag. There will
be no changes visible when the chunk is loaded via ES module
`import` or CJS `require`.
* fix(build): Correctly handle deep export paths
A problem can occur when loading chunks in a browser: although
factory() will create the full exported path on $, and thus the
assignment
root.<path> = factory(...) { ...; return $.<path> }
will normally be a do-nothing in every chunk except the first, if
the exported path (e.g. Blockly.blocks.all) is more than one level
deeper than any previously-existing path (e.g. Blockly), this will
fail because root.<path> is evaluated before calling factory(), and
so the left hand side will will evaluate to a undefined reference
(e.g. undefined.all) and TypeError will be thrown before the call
to factory is evaluated.
To fix this, call factory first and store the exports object in a
variable before assigning it to the exported path.
Fixes#5932.
* refactor: Stop flattening Blockly sources during compilation in preparation for move to ES modules
* fix: Remove obsolete accessControls and add comment about visibility changes
* refactor: Provide a BlockDefinition type
* refactor: Split defineBlocksWithJsonArray
Split defineBlocksWithJsonArray into:
- createBlockDefinitionsFromJsonArray, which creates BlockDefinitions
from a (possibly JSON-originated) POJsO array, having no side-effects
except possibly issuing warnings to the console.
- defineBlocks, which add any dictionary of BlockDefinitions to
the Blocks dictionary.
* feat(blocks): Export block definitions per-module
- Define all blocks in a local blocks dictionary, often using
createBlockDefinitionFromJsonArray, without registering them.
- Separately, use defineBlocks to register the exported
BlockDefinitions at the end of each Blockly.blocks.*
module.
- In Blockly.blocks.all, create a blocks export that combines all
of the blocks exports from the individual blocks modules.
* chore: have format script run clang-format on blocks/ too
* refactor(blocks): Make loopTypes a Set
This is likely to slightly improve performance, especially if there
are many entries.
* refactor(blocks): Re-export individual block modules from Blockly.blocks.all
* fix!(blocks): Have blocks_compressed.js export Blockly.blocks.all
Previously the value obtained by
const blocks = require('blockly/blocks'); // Node.js
or
import blocks from 'blockly/blocks.js'; // ES Modules
would be the block definitions dictionary (Blockly.Blocks).
Change this so that it is instead the export object from
Blockly.blocks.all.
This means you can now access loopTypes via:
import blocks from 'blockly/blocks.js';
blocks.loops.loopTypes.add('my_loop_blocktype');
This is a breaking change for any code which depended on the value
that was exported by blocks_compressed.js.
BREAKING CHANGE: the exports provided by blocks_compressed.js (and
therefore by `import ... from 'blockly/blocks'`) have changed; see above.
* chore(build): add a script to run the ts compiler and send the new files to closure compiler
* chore(build): clean up tsconfig
* chore: apply suggestions from code review
Cleanup from Chris
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* 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`).
* chore: Clean up NPM package module wrappers
- Slightly improve documentation for each file based on helpful
explanations given by @samelhusseini.
- Removed redundant code---e.g., loading `javascript_compressed.js`
creates and sets Blockly.JavaScript as a side effect, so there is
no need to set `Blockly.JavaScript = BlocklyJavaScript` in
`dist/javascript.js` (generated from `scripts/package/javascript.js`).
- Remove possibly harmful code---e.g., `Blockly.Msg` is initialised
with a null-prototype object in `blockly_compressed.js` and that
initial object should under no circumstances be replaced.
- Remvoe downright misleading code---e.g., `dist/blocks.js` previously
_appeared_ to replace Blockly.Blocks with an empty object, but in
fact the `Blockly` name referred at that point to the exports object
from `blocks_compressed.js`, which would randomly get a useless
`{}`-valued `.Blocks` property tacked on to it; similarly, code in
`dist/browser.js` (generated from `scripts/package/browser/index.js`)
appeared to copy definitions from `BlocklyBlocks` to `Blockly.Blocks`,
but the former would always be (the aforementioned) empty object,
making this code ineffective.
* chore: Improve chunk definition / UMD generation
Make several improvements to the chunks global and chunkWrapper
function:
- Document chunk definition format (and improve the names of
of the documented properties).
- Replace the chunk `.namespace` property with two others:
- `.exports` names the variable/property to be returned by the
factory function, and which will be set on the global object if
the module is loaded in a browser.
- `.importAs` names the parameter that this chunk's exports value
is to be passed to the factory function of other chunks which
depend on this one. (This needs to be different because e.g.
`Blockly.blocks` is not a valid parameter name.)
- Change the definition for the blocks chunk to export Blockly.Blocks
(i.e., the block definition dictionary) as blocks_compressed.js
did previous to PR #5721 (chunked compilation), rather than the
(empty and soon to vanish) Blockly.blocks namespace object.
This is a win for backwards compatibility, though it does mean that
if we want to expose the `loopTypes` export from `blocks/loops.js`
we will need to find a different way to do so.
Also:
- Ensure that the `comma-dangle` rule will not be applied to
function parameter lists (even when multi-line).
- Update tests/node/.eslintrc.json to make the environment
node-specific and not pinned to es6.
* chore(build): Add "all" modules for blocks & generators
These modules (Blockly.blocks.all and Blockly.<Generator>.all) will
be the entry points for the corresponding chunks.
They also make it easier to pull in all the modules in each package
(e.g. for playground and tests).
It is necessary to set the Closure Compiler dependency_mode to
SORT_ONLY as otherwise it tries to compile the "all" modules before
their dependencies, which fails.
The only impact on the _compressed.js files is the addition of a short
string to the very end of each file, e.g.:
var module$exports$Blockly$JavaScript$all={};
* chore(deps): Add devDependency on closure-calculate-chunks
* feat(build): First pass at chunked complation
Add a new buildCompiled gulp target (npm run build:compiled) that
uses closure-calculate-chunks to do chunked compliation of core/,
blocks/ and generators/ all in a single pass.
This work is incomplete: the resulting *_compressed.js files don't
(yet) have UMD wrappers.
* chore(build): Generate chunk wrappers
A first pass; this does not have support for a namespace object yet.
* refactor(build): Use chunked compilation by default
Remove old "compressed" gulp tasks in favour of new "compiled" task.
* chore(build): Remove cruft from buildCompiled
Remove unneeded `done` parameter and commented-out options that had
been cargo-culted from the old build pipeline.
* fix(build): Fix test failures caused by new build pipeline
- Exclude closure/goog/base.js from compiler input; use
externs/goog-externs.js instead.
- Have the build:debug and build:strict targets only build the first
chunk (blockly_compressed.js).
- Fix namespace entries for blocks and generators.
* fix(build): Fix build failures on node v12
closure-calculate-chunks requires node.js v14 or later.
When running on node.js v14 or later have getChunkOptions save
the output of closure-calculate-chunks to
scripts/gulpfiles/chunks.json. When running on older versions of
node.js have it use this checked-in, cached output instead of
attempting to run closure-calculate-chunks.
* chore(build): enable --rename_prefix_namespace
This will allow modules in blocks/ and generators/ to use
goog.require to obtain the exports object of goog.modules from
core/.
* fix(build): Always build all chunks
The previous commit enabled --rename_prefix_namespace option to
Closure Compiler, and this causes the buildCompressed target to
work fine when run without --debug or --strict, but adding either
of those flags (as for example when `npm test` runs
`npm run build:debug`) causes an issue:
- Because of many compiler errors in blocks/ and generators/,
a previous commit added a hack to only build the first chunk
when doing debug/strict builds.
- When asked to build only one chunk, Closure Compiler ignores the
--rename_prefix_namespace flag, because it 'correctly' infers
that there are no later chunks that will need to access global
variables from the first chunk.
- This causes a test failure, because `npm test` first runs
`npm run build`, which generates a valid blockly_compressed.js,
but this is then overrwritten by an invalid one when it next runs
`npm run build:debug`.
(The invalid one is missing all `$.` prefixes on 'global' variables,
including on Blockly, so the wrapper's last two lines -
"$.Blockly.internal_ = $;" and "return $.Blockly" - fail.)
The fix is to add appropriate @suppress annotations to blocks/*.js and
generators/**/*.js and then remove the first-chunk-only hack.
* refactor(build): Just build once
Since the previous commit caused `npm run build:debug` to do
everything that `... build:compressed` does - and to produce
byte-for-byte identical output - it doesn't make sense to run
both when testing. To that end:
- Replace the build:debug and build:strict package scripts that
did `gulp buildCompressed --...` with new scripts build-debug
and build-strict that do `gulp build --...` instead.
(The target names are changed so as to extend our existing naming
convention as follows: a target named "foo:bar" does some sub-part
of the job done by target "foo", but a target named "foo-bar" does
all the work of the target "foo" with some extra options.)
- build:debug:log and build:strict:log are similarly replaced with
build-debug-log and build-strict-log.
- Modify run_all_tests.js to just do `npm run build-debug` instead of
doing both `npm run build` and `npm run build:debug`.
- Also remove the 'build:blocks' script that should have been removed
when the buildBlocks gulp task was deleted previously.
* refactor(build): Compile with base_minimal.js instead of base.js
Introduce a (very!) cut-down version of closure/goog/base.js named
base_minimal.js that is used as input to the compiler as an
alternative to using externs/goog-externs.js (which will be deleted
once the buildAdvancedCompilationTest target has been updated).
This will allow use of goog.setTestOnly since it will now exist in
compiled mode, and allows the changes made in 5b112db to filter
base.js out of the files for the first chunk to be reverted.
(It also obliges a change to the compiled-mode check in blockly.js.)
* fix(build): Fix buildAdvanceCompilationTest
- In build_tasks.js:
- Replace the old compile() function with a new one factored out of
buildCompiled().
- Update buildAdvancedCompilationTest to use the new compile()
and other helpers created in the meantime.
- Remove no-longer-used maybeAddClosureLibrary().
- Remove externs/{block,generator,goog}-externs.js, which are no longer
used by any compile pipeline.
- Update core/blockly.js to fix issue with detection of compiled mode
when using ADVANCED_OPTIMISATIONS.
- Update only other use of globalThis, in core/utils/xml.js, to
consistently treat it as a dictionary object.
- Update instructions in tests/compile/index.html.
This commit is sort-of-a-prerequisite to #5602; test:compile:advanced
was previously working but the generated `main_compresed.js` would
throw errors upon loading.
* chore: rename module Blockly.blocks.Lists to ....lists
All the other Blockly.blocks modules have lower-case names. This
one being named with an upper-case initial appears to have been a
typo on my part.
This module name is not mentioned anywhere else in the source code
(though it will be soon!) so no other files need to be edited.
Further, it does not appear anywhere in the last release (which
before PR #5696) so it is not necessary to add an entry in
renamings.js for this change.
* chore(build): Rationalise deps.js, deps.mocha.js
* Include blocks/*.js (Blockly.blocks.*) in tests/deps.js, since
these modules are used in the playground. (They are goog.provide
modules loaded via <script> tags, so their absence from deps.js
does not cause errors - but it will when they are migrated to
goog.module and must be loaded via goog.require.)
* Filter the entries in deps.mocha.js so that it includes only the
additional mocha test modules (i.e. those not mentioned in deps.js
already).
* refactor: Load blocks and generators using goog.require
* Bump google-closure-compiler from 20210601.0.0 to 20211006.0.0
Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20210601.0.0 to 20211006.0.0.
- [Release notes](https://github.com/google/closure-compiler-npm/releases)
- [Commits](https://github.com/google/closure-compiler-npm/compare/v20210601.0.0...v20211006.0.0)
---
updated-dependencies:
- dependency-name: google-closure-compiler
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* Remove deleted option from Closure Compiler arguments
The closure compiler no longer supports the undefinedNames warning
group (and indeed even prior to deletion it didn't do anything for
some time).
Per @lauraharker, enabling checkVars, missingProperties and
strictMissingProperties gives about the same check coverage; we
already enable the first two, while the third was already listed
but commented out for the time being.
* Provide externs for base.js functions
Per comment: fixes compiler errors from build:debug.
* Fix erroneous import
Blockly.serialization.ISerializer uses named exports, so we need to
destructure the import.
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* Use goog.module in mocha tests
* Fix compiler warnings
* Make test helpers a module
* Name test modules Blockly.test.*
This is to be more consistent with how non-test modules are named.
Also remove top-level goog.require of TestHelpers (now
Blockly.test.helpers) since requiring a side-effect-less module does
nothing.
* Convert block_test.js and comment_test.js to goog.module syntax
* Address PR comments
* Goog modulify tests
* Goog modulify toolbox helpers
* Fixes imports and moves common tests from workspace_test.js to a helper file.
* Update test deps after rebase
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* Use goog.requireType when importing I* interfaces
Interfaces have no code, so should never be referred to outside of
(JSDoc) comments, and so the modules that define only interfaces never
need to be goog.require'd - goog.requireType is always sufficient.
This commit fixes imports of all modules whose name matches
/(.*\.)?I[A-Z]*/ - i.e., the hungarian-notation named ones in
core/interfaces/.
* Use goog.requireType when only using import for type specifications
Where a module is imported only to used in JSDoc comments it can
(and should) be goog.requireType'd instead of goog.require'd.
* Remove spurious eslint-disable no-unused-vars
There were a few cases where modules were being imported with
goog.require (because they are referred to in code, not just JSDoc
comments) but were prefaced by a spurious eslint suppress.
Remove these, restoring the invariant that an import gets an eslint
if and only if it is a requireType.
* Remove obsolete Closure Compiler error group
stricterMissingRequire has been superceded by missingRequire, and now
causes a Java null pointer exception if supplied.