Commit Graph

7031 Commits

Author SHA1 Message Date
Rachel Fenichel
4a8668a358 release: merge master into develop (#5792)
* Bump ws from 7.4.4 to 7.5.1

Bumps [ws](https://github.com/websockets/ws) from 7.4.4 to 7.5.1.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.4...7.5.1)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump lodash from 4.17.19 to 4.17.21

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Initial commit for appengine deploy action

* Update comments to be more descriptive

* Get deploy files from the correct directory

Previous path was `_deploy/`. New path is `../_deploy`.

* Create Github Action to comment on PR while develop is frozen (#5006)

* Create develop_freeze_comment.yml

* Update comments

* Fix typo and update uses

* Add test message

* Revert "Create Github Action to comment on PR while develop is frozen (#5006)" (#5013)

This reverts commit 8c635b5fbc.

* Revert "Get deploy files from the correct directory"

* Bump hosted-git-info from 2.8.4 to 2.8.9 (#4980)

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.4 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.4...v2.8.9)

---
updated-dependencies:
- dependency-name: hosted-git-info
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Pull Request template for goog.module PRs

Provide a standard pull request template more suited to PRs doing
goog.module conversions.

There's no way to pick a non-default template when creating a PR
manually, but this one can be used by adding
"&?template=goog_module.md" to the
https://github.com/cpcallen/bugs/compare/ URL.

* Update goog_module.md with suggested fixes

* Fix typos.
* Reinstate "Proposed Changes" section.
* Mark text that should be edit with ALL CAPS.

* Bump normalize-url from 4.5.0 to 4.5.1

Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/sindresorhus/normalize-url/releases)
- [Commits](https://github.com/sindresorhus/normalize-url/commits)

---
updated-dependencies:
- dependency-name: normalize-url
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump trim-newlines from 3.0.0 to 3.0.1

Bumps [trim-newlines](https://github.com/sindresorhus/trim-newlines) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sindresorhus/trim-newlines/releases)
- [Commits](https://github.com/sindresorhus/trim-newlines/commits)

---
updated-dependencies:
- dependency-name: trim-newlines
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump path-parse from 1.0.6 to 1.0.7

Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump postcss from 7.0.35 to 7.0.36 (#4928)

Bumps [postcss](https://github.com/postcss/postcss) from 7.0.35 to 7.0.36.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/7.0.35...7.0.36)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Rollup of all Q3 message changes (#5565)

Courtesy of Translatewiki

* Add Croatian to Code demo (#5583) (#5611)

Contributed courtesy of Lidija Kralj.

* chore: create release.yml (#5588)

* Create release.yml

* chore: update release.yml

* chore: update dependabot messages and labels (#5653)

The same as #5618, but against master because dependabot ignores changes on develop.

* chore: Create separate report_clang_format workflow in master branch (#5670)

The initial version of this workflow just uses `console.log` to report
the context of the `context` object.  It is hoped that there will
be enough information in this context to identify the PR to comment on,
without the `check_clang_format` workflow having to upload a
'build artefact' of some kind - see example of what I hoe to avoid
starting at `ReceivePR.yml` here:

https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

A follow-up PR will (if possible) add the code to create comments
when `check_clang_format` fails.

Part of #5659.

* chore: Remove spurious extra `on` clause in report_clang_format.yml (#5671)

Removes an unwanted `on` clause that was overlooked in #5670 by author and reviewer.

* chore: More spelunking in GitHub Action data (#5673)

Looking for information about PR that triggered original
check_clang_format run.

* chore: revert github action (#5675)

* fix: Don't try to set text fields to null on cancel (#5692)

Mobile users get a window.prompt as an input, if they press the cancel button the return value is null.  Don't attempt to set the value of the field to null.

Caused errors in the custom note field which inherits from FieldTextInput.  Detected in Blockly Games Music.

This PR is for the master branch and includes a recompile.  The develop branch has changed enough that a cherrypick from develop to master won't work.  The bug in question represents a significant number of the errors being reported from Blockly Games.

* Update dependabot.yml (#5705)

* chore: run clang-format

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Monica Kozbial <6621618+moniika@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
Co-authored-by: Neil Fraser <fraser@google.com>
Co-authored-by: alschmiedt <aschmiedt@google.com>
2021-12-07 09:43:57 -08:00
Christopher Allen
10cfc11809 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`).
2021-12-06 08:46:14 -08:00
Rachel Fenichel
5a70f8a337 chore(test): add version of multi_playground with compressed files (#5785) 2021-12-03 11:11:57 -08:00
Rachel Fenichel
3770f20448 chore(deps): remove dependency on typescript-closure-tools (#5776)
* build: remove typings tasks from build and test

* chore(deps): remove typescript-closure-tools

* chore(deps): update package-lock.json
2021-12-03 10:47:24 -08:00
Rachel Fenichel
8635942248 chore(test): Add playground that uses compressed files (#5782) 2021-12-03 10:44:15 -08:00
Christopher Allen
3d7262fed2 fix(tests): Fix & reenable the advanced compilation test (#5781)
* fix(test): Fix advanced compilation test

- Fix loading of blocks in `tests/compile/main.js` caused by
  recent `goog.module`-ification work.
- Fix problem caused by ADVANCED_OPTIMISATIONS renaming the Msg
  property on the fake Blockly object created by the
  translation-loading hack in `blockly.js`.

* chore(build): Reenable advanced compilation test

Fixes #5602.
2021-12-03 10:14:19 -08:00
Christopher Allen
b52c0179cb chore: Fix inadvertent block migration inconsistencies (#5780)
* chore: Fix inadvertent block migration inconsistencies

  - Reinstate `goog.require`s-for-side-effects that were inadvertently
    removed.
  - Always use a destructuring import for `defineBlocksWithJsonArray`.
  - Consistently use `CONSTANT_CASE` names for block-common objects.
    (We could alternatively always use `camelCase` names, but since
    all the `MIXIN`s and `EXTENSIONS` remain all-uppercase this seems
    the more consistent.)

* chore: Fix import ordering
2021-12-03 02:45:47 +00:00
Christopher Allen
b08187cd0a refactor: Migrate blocks/variables_dynamic.js to goog.module syntax (#5779)
* refactor: Migrate blocks/variables_dynamic.js to goog.module

* refactor: Migrate blocks/variables_dynamic.js named requires

* chore: clang-format blocks/variables_dynamic.js
2021-12-03 02:36:14 +00:00
alschmiedt
c93e1dfd30 deprecate!: removes deprecated connection functions (#5713) 2021-12-02 18:21:21 -08:00
Christopher Allen
8b3635ab75 chore: Simplify NPM package wrappers, improve chunk wrapper generator (#5777)
* 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.
2021-12-03 02:21:01 +00:00
alschmiedt
719e0fbf38 chore: updates the names for parsing (#5778) 2021-12-02 17:52:33 -08:00
alschmiedt
0493011201 fix: the advanced playground to work with dec 2021 release (#5775) 2021-12-02 17:43:26 -08:00
alschmiedt
6128f2dfd4 feat: make checkAndDelete a public API (#5772) 2021-12-02 11:39:08 -08:00
Christopher Allen
7d7bd75c3a refactor: Migrate blocks/variables.js to goog.module syntax (#5774)
* refactor: Migrate blocks/variables.js to goog.module

* refactor: Migrate blocks/variables.js named requires

* chore: clang-format blocks/variables.js

* chore: JSDoc grammar correction
2021-12-02 19:06:48 +00:00
alschmiedt
5515afc708 chore: Remove declareLegacyNamespace from serialization folder (#5757) 2021-12-02 10:21:58 -08:00
Christopher Allen
da16a66f33 refactor: msg.js: use named export, remove declareLegacyNamespace (#5768) 2021-12-02 16:47:27 +00:00
alschmiedt
35279eb8b7 chore: correctly updates the compiled flag (#5767) 2021-12-02 08:29:53 -08:00
Christopher Allen
ee18553035 refactor: Migrate blocks/text.js to goog.module syntax (#5766)
* refactor: Migrate blocks/text.js to goog.module

* refactor: Migrate blocks/text.js named requires

* refactor: Factor out common properties of text_prompt* blocks

* clang-format blocks/text.js

* fix: Fix lint warnings for PR #5766
2021-12-02 11:23:31 +00:00
Rachel Fenichel
931499295e refactor: convert python block generators to goog.module (#5771)
* refactor: convert generators/python/colour.js to goog.module

* refactor: convert generators/python/colour.js to named requires

* chore: run clang-format

* refactor: convert generators/python/lists.js to goog.module

* refactor: convert generators/python/lists.js to named requires

* chore: run clang-format

* refactor: convert generators/python/logic.js to goog.module

* refactor: convert generators/python/logic.js to named requires

* chore: run clang-format

* refactor: convert generators/python/loops.js to goog.module

* refactor: convert generators/python/loops.js to named requires

* chore: run clang-format

* refactor: convert generators/python/math.js to goog.module

* refactor: convert generators/python/math.js to named requires

* chore: run clang-format

* refactor: convert generators/python/procedures.js to goog.module

* refactor: convert generators/python/procedures.js to named requires

* chore: run clang-format

* refactor: convert generators/python/text.js to goog.module

* refactor: convert generators/python/text.js to named requires

* chore: run clang-format

* refactor: convert generators/python/variables_dynamic.js to named requires

* refactor: convert generators/python/variables.js to named requires

* chore: run clang-format

* refactor: convert generators/python.js to goog.module

* refactor: convert generators/python.js to named requires

* chore: run clang-format

* chore: remove spurious @private annotations

* chore: rebuild
2021-12-01 20:43:08 -08:00
Rachel Fenichel
c0517ea360 refactor: convert some block generators to goog.module (#5770)
* refactor: convert generators/lua.js to goog.module

* refactor: convert generator/lua.js to named requires

* chore: run clang-format

* refactor: convert generators/php/colour.js to goog.module

* refactor: convert generators/php/colour.js to named requires

* chore: run clang-format

* refactor: convert generators/php/lists.js to goog.module

* refactor: convert generators/php/lists.js to named requires

* chore: run clang-format

* refactor: convert generators/php/logic.js to goog.module

* refactor: convert generators/php/logic.js to named requires

* chore: run clang-format

* refactor: convert generators/php/loops.js to goog.module

* refactor: convert generators/php/loops.js to named requires

* chore: run clang-format

* refactor: convert generators/php/math.js to goog.module

* refactor: convert generators/php/math.js to named requires

* chore: run clang-format

* refactor: convert generators/php/procedures.js to goog.module

* refactor: convert generators/php/procedures.js to named requires

* chore: run clang-format

* refactor: convert generators/php/text.js to goog.module

* refactor: convert generators/php/text.js to named requires

* chore: run clang-format

* refactor: convert generators/php/variables.js to goog.module

* refactor: convert generators/php/variables.js to named requires

* chore: run clang-format

* refactor: convert generators/php/variables_dynamic.js to goog.module

* refactor: convert generators/php/variables_dynamic.js to named requires

* refactor: convert generators/php.js to goog.module

* refactor: convert generators/php.js to named requires

* chore: run clang-format

* chore: rebuild deps.js
2021-12-01 17:59:20 -08:00
Rachel Fenichel
a939fec53b refactor: convert some block generators to goog.module (#5769)
* refactor: convert generators/lua/colour.js to goog.module

* refactor: convert generators/lua/colour.js to named requires

* chore: run clang-format

* refactor: convert generators/lua/lists.js to goog.module

* refactor: convert generators/lua/lists.js to named requires

* chore: run clang-format

* fix: use getListIndex helper function in lua list generators

* refactor: convert generators/lua/logic.js to goog.module

* refactor: convert generators/lua/logic.js to named requires

* chore: run clang-format

* refactor: convert generators/lua/loops.js to goog.module

* refactor: convert generators/lua/loops.js to named requires

* chore: run clang-format

* refactor: convert generators/lua/math.js to goog.module

* refactor: convert generators/lua/math.js to named requires

* chore: run clang-format

* refcator: convert generators/lua/procedures.js to goog.module

* refactor: convert generators/lua/procedures.js to named requires

* chore: run clang-format

* chore: rebuild deps.js

* refactor: convert generators/lua/text.js to goog.module

* refactor: convert generators/lua/text.js to named requires

* refactor: convert generators/lua/variables_dynamic.js to goog.module

* refactor: convert generators/lua/variables_dynamic.js to named requires

* chore: run clang-format on text.js

* refactor: convert generators/lua/variables.js to goog.module

* refactor: convert generators/lua/variables.js to named requires

* chore: run clang-format

* chore: make a lua generator function internal

* chore: rebuild deps.js
2021-12-01 14:57:21 -08:00
Christopher Allen
d7b82cddfc refactor: Migrate blocks/math.js to goog.module syntax (#5765)
* refactor: Migrate blocks/math.js to goog.module

* refactor: Migrate blocks/math.js named requires

* chore: clang-format blocks/math.js
2021-12-01 19:41:14 +00:00
Rachel Fenichel
37a1e9725c refactor: convert some block generators to goog.module (#5762)
* refactor: convert generators/javascript.js to goog.module

* refactor: convert generators/javascript.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/variables.js to goog.module

* refactor: convert generators/dart/variables.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/variables_dynamic.js to goog.module

* refactor: convert generators/dart/variables_dynamic.js to named requires

* refactor: convert generators/dart/text.js to goog.module

* refactor: convert generators/dart/text.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/procedures.js to goog.module

* refactor: convert generators/dart/procedures.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/math.js to goog.module

* refactor: convert generators/dart/math.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/loops.js to goog.module

* refactor: convert generators/dart/loops.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/logic.js to goog.module

* refactor: convert generators/dart/logic.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/lists.js to goog.module

* refactor: convert generators/dart/lists.js to named requires

* chore: run clang-format

* refactor: convert generators/dart/colour.js to goog.module

* refactor: convert generators/dart/colour.js to named requires

* chore: rebuild deps.js

* chore: lint
2021-12-01 10:42:08 -08:00
Rachel Fenichel
93a1bce1ac refactor: convert generators/javascript/loops.js to goog.module (#5758)
* refactor: convert generators/javascript/loops.js to goog.module

* refactor: convert generators/javascript/loops.js to named requires

* chore: run clang-format

* chore: rebuild deps.js
2021-11-30 18:51:11 -08:00
Rachel Fenichel
e11fe348b2 refactor: convert some js block generators to goog.module (#5756)
* refactor: convert generators/javascript/colour.js to goog.module

* refactor: convert generators/javascript/colour.js to named requires

* chore: run clang-format

* refactor: convert generators/javascript/lists.js to goog.module

* refactor: convert generators/javascript/lists.js to named requires

* chore: run clang-format

* refactor: convert generators/javascript/logic.js to goog.module

* refactor: convert generators/javascript/logic.js to named requires

* chore: run clang-format

* refactor: convert genereators/javascript/math.js to goog.module

* refactor: convert generators/javascript/math.js to named requires

* chore: rebuild deps.js
2021-11-30 17:31:55 -08:00
Rachel Fenichel
d9991516cc refactor: convert generators/javascript/procedures.js to goog.module (#5754)
* refactor: convert generators/javascript/procedures.js to goog.module

* refactor: convert generators/javascript/procedures.js to named requires

* chore: run clang-format
2021-11-30 17:25:03 -08:00
alschmiedt
47c821018e fix: procedure callers now remove inputs properly (#5751) 2021-11-30 16:03:18 -08:00
Christopher Allen
208d2008a3 refactor: Migrate blocks/loops.js to goog.module syntax (#5755)
* refactor: Turn .getSurroundLoop into a (Block) method

  This considerably simplifies the code in the genrators, obviating
  the need for generators to import Blockly.Constants.Loops, and
  allowing the compiler to remove blocks/loops.js from the first
  (Blockly) chunk of the compilation.

  (The latter could and should have been arranged by making the
  generator chunks depend on the blocks chunk, but that is no longer
  necessary.)

* refactor: Migrate blocks/loops.js to goog.module

* refactor: Migrate blocks/loops.js named requires

* chore: clang-format blocks/loops.js
2021-11-30 23:51:27 +00:00
Rachel Fenichel
874bbc13c9 refactor: convert some js block generators to goog.module (#5750)
* chore: migrate generators/javascript/text.js to goog.module

* chore: convert generators/javascript/text.js to named requires

* refactor: convert generators/javascript/variables.js to goog.module

* refactor: convert generators/javascript/variables_dynamic to goog.module
2021-11-30 15:09:29 -08:00
alschmiedt
780198e0c0 chore: revert #5730 (#5740)
* chore: revert #5730

* fix: Fix compile failure due to incorrect visibility

The CONTROL_FLOW_IN_LOOP_CHECK_MIXIN is intended to be used outside of
blocks/ (it is, in particular, used in generators/) so it should have
been marked @public from the beginning.
2021-11-30 19:27:19 +00:00
Rachel Fenichel
af2bf583af refactor: migrate generators/dart.js to goog.module syntax (#5749)
* chore: migrate generators/dart.js to goog.module

* chore: migrate generators/dart.js to named requires

* chore: Update generators/dart.js to alphabetize imports

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
2021-11-30 11:11:18 -08:00
Neil Fraser
341dba5965 fix: Prevent error when maxTrashcanContents is 0 (#5739)
* fix: Prevent error when maxTrashcanContents is 0

Resolves #5729.

* Eliminate ’smart’ quotes.
2021-11-30 10:25:16 -08:00
Christopher Allen
2ca6740758 refactor: Migrate blocks/logic.js to goog.module syntax (#5748)
* refactor: Migrate blocks/logic.js to goog.module

* refactor: Migrate blocks/logic.js named requires

* chore: clang-format blocks/logic.js
2021-11-30 17:43:35 +00:00
Rachel Fenichel
8ef0b20146 feat: clarify variable and procedure constants (#5743)
* chore: move dynamic category names into their respective files

* feat: create NameType enum on Names

* chore: use NameType enum for Names helper functions

* docs: update comments for category names
2021-11-30 09:13:36 -08:00
Rachel Fenichel
4db047ff32 chore: fix missing requires in generators (#5744)
* chore: fix some missing requires in generators

* chore: fix missing requires in dart block generators

* chore: replace Blockly.isNumber with Blockly.utils.string.isNumber in generators

* chore: fix more missing requires in block generators
2021-11-30 08:51:21 -08:00
Christopher Allen
1a992386ae refactor: Migrate blocks/lists.js to goog.module syntax (#5746)
* Migrate blocks/lists.js to goog.module

* Migrate blocks/lists.js named requires

* clang-format blocks/lists.js
2021-11-30 16:23:00 +00:00
Christopher Allen
b21130aef8 refactor: Migrate blocks/procedures.js to goog.module syntax (#5736)
* Migrate blocks/procedures.js to goog.module

* Migrate blocks/procedures.js named requires

* clang-format blocks/procedures.js

* chore: Factor common methods out of block definitions

  Addressing comments on PR #5736.
2021-11-30 16:19:47 +00:00
Christopher Allen
3e9878169b chore(build): Update compiler & linter input language to ES2020 (#5745)
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.
2021-11-30 01:31:03 +00:00
Christopher Allen
25a4561e21 Migrate blocks/colour.js to goog.module syntax (#5738)
* Migrate blocks/colour.js to goog.module

* Migrate blocks/colour.js named requires

This causes an apparently harmless reordering of the files for the
first chunk.

* clang-format blocks/colour.js
2021-11-29 22:51:06 +00:00
Christopher Allen
c0d22f2002 refactor: Rename ALIGN to Align and move from constants.js to input.js (#5742)
This constant is used to specify the alignment of
an Input, so it should live in the same file as the Input class.

I've done this as a separate named export, but it could alternatively
be made a static member of Input (i.e., Input.Align with only Input
being exported by name).

Where mocha tests were referring to Blockly.constants.ALIGN.*
without actually requiring Blockly.constants, I have reverted
them to refer to Blockly.ALIGN_* instead (pending conversion
to named requries).

Part of #5073.
2021-11-29 21:59:48 +00:00
Christopher Allen
985af10f6e chore(build): Use chunked compilation (#5721)
* 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.
2021-11-29 17:50:17 +00:00
dependabot[bot]
ef0fa8331c chore(deps): bump google-closure-compiler (#5707)
Bumps [google-closure-compiler](https://github.com/google/closure-compiler-npm) from 20211006.0.0 to 20211107.0.0.
- [Release notes](https://github.com/google/closure-compiler-npm/releases)
- [Commits](https://github.com/google/closure-compiler-npm/compare/v20211006.0.0...v20211107.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>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-29 17:28:03 +00:00
dependabot[bot]
c38913e7f3 chore(deps): bump google-closure-deps from 20210808.0.0 to 20211107.0.0 (#5733)
Bumps [google-closure-deps](https://github.com/google/closure-library) from 20210808.0.0 to 20211107.0.0.
- [Release notes](https://github.com/google/closure-library/releases)
- [Commits](https://github.com/google/closure-library/compare/v20210808...v20211107)

---
updated-dependencies:
- dependency-name: google-closure-deps
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-29 16:35:24 +00:00
Neil Fraser
1a470003fe fix: Stop throwing error when PointerEvent.pageX is 0. (#5727)
The e.pageX (and .pageY) checks aren't strict enough.  0 is a perfectly valid coordinate.

Checking for the existence of changedTouches is an easier way to distinguish a PointerEvent from a TouchEvent.
2021-11-26 10:27:43 -08:00
Mark Friedman
da3df70f6f feat: Enable the creation of concurrent, but not connected, output and previous connectors (#5702)
* Add new connection checks and tests

* Enable concurrent output and previous connections on blocks

  * and remove assumption from unplug().

* Make changes compatible with new module system

* Fix issue do to Connection class change.

  . and change some var's to const's now that that appears to be ok ;-)

* Fix more code that assumes only one of output and previous connections

* Change function name as per PR comment

* Fix lint errors

* Fix clang format issues
2021-11-24 17:03:21 -08:00
alschmiedt
308253bfdf chore: moves the public loop mixin into its own file (#5730) 2021-11-24 15:57:28 -08:00
Maribeth Bottorff
6c33373d5b chore: make Blockly.common.setSelected package and update docs (#5728) 2021-11-22 15:03:41 -08:00
Aaron Dodson
d30d0da96e chore: Record renamings for named exports (#5719) 2021-11-18 13:25:23 -08:00
Rachel Fenichel
bbf768a920 chore: enable eslint-config-google (#5717)
* chore(deps): update package-lock.json

* chore(deps): install eslint-config-google as a dev dependency

* chore: enable eslint-config-google

* chore: fix missing commas
2021-11-18 09:30:34 -08:00
Rachel Fenichel
27699ed08b chore: move remaining function definitions out of blockly.js (#5699)
* chore: move remaining function definitions out of blockly.js

* chore: record renamings

* chore: add aliases to moved function jsdoc

* chore: add deprecation warnings in blockly.js

* chore: fix bad merge

* chore: move functions in response to PR comments

* chore: move isNumber to utils.string
2021-11-17 11:13:27 -08:00