scratch-blocks 2.1.3 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +18 -10
- package/README.md +40 -0
- package/dist/main.mjs +1 -1
- package/dist/types/src/blocks/procedures.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/scratch_c_block_wrap.d.ts +2 -0
- package/dist/types/src/scratch_c_block_wrap.d.ts.map +1 -0
- package/eslint.config.mjs +5 -1
- package/package.json +10 -3
- package/src/blocks/procedures.ts +81 -17
- package/src/index.ts +13 -5
- package/src/scratch_c_block_wrap.ts +92 -0
- package/src/scratch_connection_checker.ts +8 -2
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +1 -1
- package/vitest.config.ts +35 -0
- package/dist/types/tests/blocks/logic_ternary_test.d.ts +0 -13
- package/dist/types/tests/blocks/logic_ternary_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/block_test.d.ts +0 -4
- package/dist/types/tests/jsunit/block_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/connection_db_test.d.ts +0 -25
- package/dist/types/tests/jsunit/connection_db_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/connection_test.d.ts +0 -39
- package/dist/types/tests/jsunit/connection_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/db_test.d.ts +0 -7
- package/dist/types/tests/jsunit/db_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/event_test.d.ts +0 -76
- package/dist/types/tests/jsunit/event_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/extensions_test.d.ts +0 -18
- package/dist/types/tests/jsunit/extensions_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/field_angle_test.d.ts +0 -3
- package/dist/types/tests/jsunit/field_angle_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/field_number_test.d.ts +0 -3
- package/dist/types/tests/jsunit/field_number_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/field_test.d.ts +0 -8
- package/dist/types/tests/jsunit/field_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/field_variable_getter_test.d.ts +0 -5
- package/dist/types/tests/jsunit/field_variable_getter_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/field_variable_test.d.ts +0 -19
- package/dist/types/tests/jsunit/field_variable_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/generator_test.d.ts +0 -2
- package/dist/types/tests/jsunit/generator_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/gesture_test.d.ts +0 -10
- package/dist/types/tests/jsunit/gesture_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/input_test.d.ts +0 -9
- package/dist/types/tests/jsunit/input_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/json_test.d.ts +0 -11
- package/dist/types/tests/jsunit/json_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/names_test.d.ts +0 -5
- package/dist/types/tests/jsunit/names_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/procedure_test.d.ts +0 -15
- package/dist/types/tests/jsunit/procedure_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/scratch_block_comment_test.d.ts +0 -14
- package/dist/types/tests/jsunit/scratch_block_comment_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/svg_test.d.ts +0 -14
- package/dist/types/tests/jsunit/svg_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/test_runner.d.ts +0 -2
- package/dist/types/tests/jsunit/test_runner.d.ts.map +0 -1
- package/dist/types/tests/jsunit/test_utilities.d.ts +0 -50
- package/dist/types/tests/jsunit/test_utilities.d.ts.map +0 -1
- package/dist/types/tests/jsunit/utils_test.d.ts +0 -10
- package/dist/types/tests/jsunit/utils_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/variable_map_test.d.ts +0 -28
- package/dist/types/tests/jsunit/variable_map_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/variable_model_test.d.ts +0 -14
- package/dist/types/tests/jsunit/variable_model_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/widget_div_test.d.ts +0 -37
- package/dist/types/tests/jsunit/widget_div_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/workspace_comment_test.d.ts +0 -13
- package/dist/types/tests/jsunit/workspace_comment_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/workspace_test.d.ts +0 -22
- package/dist/types/tests/jsunit/workspace_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/workspace_undo_redo_test.d.ts +0 -33
- package/dist/types/tests/jsunit/workspace_undo_redo_test.d.ts.map +0 -1
- package/dist/types/tests/jsunit/xml_test.d.ts +0 -55
- package/dist/types/tests/jsunit/xml_test.d.ts.map +0 -1
- package/dist/types/tests/workspace_svg/workspace_svg_test.d.ts +0 -12
- package/dist/types/tests/workspace_svg/workspace_svg_test.d.ts.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -9,7 +9,8 @@ Use these defaults unless the user asks otherwise:
|
|
|
9
9
|
3. Never edit `node_modules/blockly/`; extend/override from `src/` instead.
|
|
10
10
|
4. When adding runtime guards for states that should never happen, log actionable context unless the path is expected
|
|
11
11
|
control flow.
|
|
12
|
-
5.
|
|
12
|
+
5. When fixing a bug, start by adding one or more tests to reproduce the issue, then implement the fix. Iterate until
|
|
13
|
+
all tests pass, including but not limited to the new tests.
|
|
13
14
|
|
|
14
15
|
## What this repository is
|
|
15
16
|
|
|
@@ -23,12 +24,14 @@ palette and workspace.
|
|
|
23
24
|
## Build and lint
|
|
24
25
|
|
|
25
26
|
```sh
|
|
26
|
-
npm run build
|
|
27
|
-
npm run
|
|
27
|
+
npm run build # Compile TypeScript and bundle with webpack → dist/main.mjs
|
|
28
|
+
npm run format # Auto-format code
|
|
29
|
+
npm run test:lint # Check for lint and formatting issues (does not run other tests)
|
|
30
|
+
npm run test # Run unit and browser tests (but not lint)
|
|
31
|
+
npm run test:unit # Run unit tests only
|
|
32
|
+
npm run test:browser # Run browser tests only
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
There are test files under `tests/` but no `npm test` script is wired up yet.
|
|
31
|
-
|
|
32
35
|
## Repository layout
|
|
33
36
|
|
|
34
37
|
```text
|
|
@@ -133,8 +136,13 @@ explaining why it is both necessary and safe.
|
|
|
133
136
|
|
|
134
137
|
## Before submitting changes
|
|
135
138
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
-
|
|
139
|
+
Review all changes and confirm:
|
|
140
|
+
|
|
141
|
+
- **Scope**: Changes are confined to the user request; nothing extra was added or modified.
|
|
142
|
+
- **Correctness**: Changes make sense and edge cases were considered.
|
|
143
|
+
- **Comments**: Comments are necessary, short, and clear; self-explanatory code has no comment.
|
|
144
|
+
- **Simplicity**: Implementation is as simple as possible; no unnecessary code remains.
|
|
145
|
+
- **`node_modules/`**: No changes within this directory. In particular, no direct edits to Blockly source files.
|
|
146
|
+
- **Runtime checks**: Any new guards for states that should never happen include diagnostic logging.
|
|
147
|
+
- **Tests pass**: `npm run test` completes with no failures.
|
|
148
|
+
- **No lint errors**: `npm run test:lint` passes. Iterate with `npm run format` and/or manual changes as needed.
|
package/README.md
CHANGED
|
@@ -40,6 +40,46 @@ We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep i
|
|
|
40
40
|
[donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community,
|
|
41
41
|
and resource development efforts. Donations of any size are appreciated. Thank you!
|
|
42
42
|
|
|
43
|
+
## Development
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm ci
|
|
47
|
+
npm run build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Testing
|
|
51
|
+
|
|
52
|
+
Unit tests run in jsdom and need no additional setup:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run test:unit
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Browser tests run in Chromium via Playwright. Install the browser once after `npm ci`:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx playwright install chromium
|
|
62
|
+
npm run test:browser
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To run all tests:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To debug a failing browser test with a visible browser window:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm run test:browser -- --browser.headless=false
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
or, to also pause on startup and open devtools:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
PWDEBUG=1 npm run test:browser
|
|
81
|
+
```
|
|
82
|
+
|
|
43
83
|
## Committing
|
|
44
84
|
|
|
45
85
|
This project uses [semantic release](https://github.com/semantic-release/semantic-release) to ensure version bumps
|