* feat: make quoting methods public
* feat: add quote and multilineQuote methods
* fix: update code generators to use new methods
* chore: remove aliases
* chore: revert changes to generators
* fix(build): Have buildShims clean up up after itself
We need to create a build/package.json file to allow node.js to
load build/src/core/blockly.js and the other chunk entry points
as ES modules (it forcibly assumes .js means CJS even if one is
trying to import, unless package.json says {"type": "module"}),
but this interferes with scripts/migration/js2ts doing a
require('build/deps.js'), which is _not_ an ES module.
Specific error message was:
/Users/cpcallen/src/blockly/scripts/migration/js2ts:56
require(path.resolve(__dirname, '../../build/deps.js'));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module
/Users/cpcallen/src/blockly/build/deps.js from /Users/cpcallen/src/blockly/scripts/migration/js2ts
not supported.
deps.js is treated as an ES module file as it is a .js file whose
nearest parent package.json contains "type": "module" which
declares all .js files in that package scope as ES modules.
Instead rename deps.js to end in .cjs, change the requiring code
to use dynamic import() which is available in all CommonJS
modules, or change "type": "module" to "type": "commonjs" in
/Users/cpcallen/src/blockly/build/package.json to treat all .js
files as CommonJS (using .mjs for all ES modules instead).
at Object.<anonymous> (/Users/cpcallen/src/blockly/scripts/migration/js2ts:56:1) {
code: 'ERR_REQUIRE_ESM'
}
* chore(tests): Reorder to put interesting script nearer top of file
* chore(tests): Add missing imports of closure/goog/goog.js
These modules were depending on being loaded via the
debug module loader, which cannot be used without first loading
base.js as a script, and thereby defining goog.declareModuleId
as a side effect—but if they are to be loaded via direct import
statements then they need to actually import their own
dependencies.
This is a temporary measure as soon the goog.declareMouleId
calls can themselves be deleted.
* refactor(tests): Use import instead of bootstrap to load Blockly
* chores(build): Stop generating deps.mocha.js
This file was only needed by tests/mocha/index.html's use of
the debug module loader (via bootstrap.js), which has now been
removed.
* chore(tests): Remove unneeded goog.declareModuleId calls
These were only needed because these modules were previously
being loaded by goog.require and/or goog.bootstrap.
* chores(tests): Remove dead code
We are fully committed to proper modules now.
In PR #7380 it was suggested[1] that the shims be renamed from
(e.g.) blockly.mjs to blockly.loader.mjs, and in commit 6f930f5
this was duly done, but alas one place was overlooked.
The problem was not spotted in local testing because the
blockly.mjs module that the blocks and generators chunks were
attempting to import did still exist on disk, left over from
before the change was made.
Running npm run clean would have revealed the issue but alas
that was not done.
[1] https://github.com/google/blockly/pull/7380#discussion_r1291667037
* refactor(build): Simplify implementation of posixPath
* fix(closure): Make safe to import in node.js
Make the implementation declareModlueId safe to import and
execute in node.js, which does not provide a window global.
(N.B. because this is an ESM and therefore automatically
strict, using window?.goog?.declareModuleId doesn't work
because window being undefined is an early error.)
* feat(tests): Introduce chunk loading shims
- Add a buildShims task to build_tasks.js that, for each chunk,
creates a correspondingly-named build/<chunk>.mjs that will
either (in uncompressed mode) import and reexport that chunk's
entry point module (e.g. core/blockly.js) or (in compressed
mode) load dist/<chunk>_compressed.js using a <script> tag
and then export the corresponding properties on the chunk's
exports object.
- Provide helper methods used by these shims in
tests/scripts/loading.mjs, including code to detect whether
to load in compressed or uncompressed mode.
- Add a quote() function to scripts/helpers.js, used by
buildShims. This is copied from tests/bootstrap_helper.js,
which will be removed in a later commit.
* refactor(tests): Update playground.html to use new loading shims
* refactor(tests): Update advanced_playground.html to use new loading shims
* refactor(tests): Update multi_playground.html to use new loading shims
* chore(tests): Delete playgrounds/shared_procedures.html
Shared procedure support was moved to a plugin and this should
have been removed from core along with it.
* docs(tests): Typo corrections.
* chore(tests): Add ".loader" infix to shim filenames.
Per suggestion on PR #7380, have buildShims name the shims
${chunk.name}.loader.mjs instead of just `${chunk.name}.mjs`.
Don't add next block to the insertion marker when we do
an insertion marker json serialization.
Also, to keep consistent with the old behavior, we don't
need to add input blocks for the insertion marker.
And we don't need to do a full serialization here as it
will just become an insertion marker.
Resolves#7383
Address issues in PR #7364
Signed-off-by: Hollow Man <hollowman@opensuse.org>
(cherry picked from commit 18ee0ec41b)
Don't add next block to the insertion marker when we do
an insertion marker json serialization.
Also, to keep consistent with the old behavior, we don't
need to add input blocks for the insertion marker.
And we don't need to do a full serialization here as it
will just become an insertion marker.
Resolves#7383
Address issues in PR #7364
Signed-off-by: Hollow Man <hollowman@opensuse.org>
* feat: Parse message newlines as endOfRow dummies.
* Fix the multilineinput field test.
* Addressing PR feedback.
* Addressing PR feedback.
* Newline parsing now uses a new custom input.
* npm run format
* Added input_end_row to block factory.
* Addres feedback, fix endrow after external value.
* fix: insertion markers to use JSON deserialization
* removed the const DUPLICATE_BLOCK_ERROR
* modified to import module instead of referencing
* removed coments for better readability
Glockenspiel broke due to 'query' now being required within a client context. This change fixed Glockenspiel. Blockly samples doesn't appear to be broken yet, but Glokenspeil broke at midnight yesterday.
Similar change being made to Blockly Games.
* chore: change the way we look for upstream remote
* chore: use js instead of shell
thanks christopher
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* chore: store the found upstream name
---------
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* fix: removed X & Y from toolbox.ts and replaced movBy to moveTo in Horizontal/ Vertical flyout
* forget to run npm lint and format
* removed the mistakenly added comment
* chore: rename module-local variables to not conflict
* feat: make ICopyable generic and update clipboard APIs
* chore: switch over more things to use generic ICopyables
* chore: fix shortcut items using copy paste
* chore: add test for interface between clipboard and pasters
* chore: export isCopyable
* chore: format
* chore: fixup PR comments
* chore: add deprecation tags