scratch-blocks 2.1.4 → 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.
Files changed (77) hide show
  1. package/AGENTS.md +18 -10
  2. package/README.md +40 -0
  3. package/dist/main.mjs +1 -1
  4. package/dist/types/src/index.d.ts +1 -0
  5. package/dist/types/src/index.d.ts.map +1 -1
  6. package/dist/types/src/scratch_c_block_wrap.d.ts +2 -0
  7. package/dist/types/src/scratch_c_block_wrap.d.ts.map +1 -0
  8. package/eslint.config.mjs +5 -1
  9. package/package.json +10 -3
  10. package/src/index.ts +3 -5
  11. package/src/scratch_c_block_wrap.ts +92 -0
  12. package/src/scratch_connection_checker.ts +1 -2
  13. package/tsconfig.build.json +4 -0
  14. package/tsconfig.json +1 -1
  15. package/vitest.config.ts +35 -0
  16. package/dist/types/tests/blocks/logic_ternary_test.d.ts +0 -13
  17. package/dist/types/tests/blocks/logic_ternary_test.d.ts.map +0 -1
  18. package/dist/types/tests/jsunit/block_test.d.ts +0 -4
  19. package/dist/types/tests/jsunit/block_test.d.ts.map +0 -1
  20. package/dist/types/tests/jsunit/connection_db_test.d.ts +0 -25
  21. package/dist/types/tests/jsunit/connection_db_test.d.ts.map +0 -1
  22. package/dist/types/tests/jsunit/connection_test.d.ts +0 -39
  23. package/dist/types/tests/jsunit/connection_test.d.ts.map +0 -1
  24. package/dist/types/tests/jsunit/db_test.d.ts +0 -7
  25. package/dist/types/tests/jsunit/db_test.d.ts.map +0 -1
  26. package/dist/types/tests/jsunit/event_test.d.ts +0 -76
  27. package/dist/types/tests/jsunit/event_test.d.ts.map +0 -1
  28. package/dist/types/tests/jsunit/extensions_test.d.ts +0 -18
  29. package/dist/types/tests/jsunit/extensions_test.d.ts.map +0 -1
  30. package/dist/types/tests/jsunit/field_angle_test.d.ts +0 -3
  31. package/dist/types/tests/jsunit/field_angle_test.d.ts.map +0 -1
  32. package/dist/types/tests/jsunit/field_number_test.d.ts +0 -3
  33. package/dist/types/tests/jsunit/field_number_test.d.ts.map +0 -1
  34. package/dist/types/tests/jsunit/field_test.d.ts +0 -8
  35. package/dist/types/tests/jsunit/field_test.d.ts.map +0 -1
  36. package/dist/types/tests/jsunit/field_variable_getter_test.d.ts +0 -5
  37. package/dist/types/tests/jsunit/field_variable_getter_test.d.ts.map +0 -1
  38. package/dist/types/tests/jsunit/field_variable_test.d.ts +0 -19
  39. package/dist/types/tests/jsunit/field_variable_test.d.ts.map +0 -1
  40. package/dist/types/tests/jsunit/generator_test.d.ts +0 -2
  41. package/dist/types/tests/jsunit/generator_test.d.ts.map +0 -1
  42. package/dist/types/tests/jsunit/gesture_test.d.ts +0 -10
  43. package/dist/types/tests/jsunit/gesture_test.d.ts.map +0 -1
  44. package/dist/types/tests/jsunit/input_test.d.ts +0 -9
  45. package/dist/types/tests/jsunit/input_test.d.ts.map +0 -1
  46. package/dist/types/tests/jsunit/json_test.d.ts +0 -11
  47. package/dist/types/tests/jsunit/json_test.d.ts.map +0 -1
  48. package/dist/types/tests/jsunit/names_test.d.ts +0 -5
  49. package/dist/types/tests/jsunit/names_test.d.ts.map +0 -1
  50. package/dist/types/tests/jsunit/procedure_test.d.ts +0 -15
  51. package/dist/types/tests/jsunit/procedure_test.d.ts.map +0 -1
  52. package/dist/types/tests/jsunit/scratch_block_comment_test.d.ts +0 -14
  53. package/dist/types/tests/jsunit/scratch_block_comment_test.d.ts.map +0 -1
  54. package/dist/types/tests/jsunit/svg_test.d.ts +0 -14
  55. package/dist/types/tests/jsunit/svg_test.d.ts.map +0 -1
  56. package/dist/types/tests/jsunit/test_runner.d.ts +0 -2
  57. package/dist/types/tests/jsunit/test_runner.d.ts.map +0 -1
  58. package/dist/types/tests/jsunit/test_utilities.d.ts +0 -50
  59. package/dist/types/tests/jsunit/test_utilities.d.ts.map +0 -1
  60. package/dist/types/tests/jsunit/utils_test.d.ts +0 -10
  61. package/dist/types/tests/jsunit/utils_test.d.ts.map +0 -1
  62. package/dist/types/tests/jsunit/variable_map_test.d.ts +0 -28
  63. package/dist/types/tests/jsunit/variable_map_test.d.ts.map +0 -1
  64. package/dist/types/tests/jsunit/variable_model_test.d.ts +0 -14
  65. package/dist/types/tests/jsunit/variable_model_test.d.ts.map +0 -1
  66. package/dist/types/tests/jsunit/widget_div_test.d.ts +0 -37
  67. package/dist/types/tests/jsunit/widget_div_test.d.ts.map +0 -1
  68. package/dist/types/tests/jsunit/workspace_comment_test.d.ts +0 -13
  69. package/dist/types/tests/jsunit/workspace_comment_test.d.ts.map +0 -1
  70. package/dist/types/tests/jsunit/workspace_test.d.ts +0 -22
  71. package/dist/types/tests/jsunit/workspace_test.d.ts.map +0 -1
  72. package/dist/types/tests/jsunit/workspace_undo_redo_test.d.ts +0 -33
  73. package/dist/types/tests/jsunit/workspace_undo_redo_test.d.ts.map +0 -1
  74. package/dist/types/tests/jsunit/xml_test.d.ts +0 -55
  75. package/dist/types/tests/jsunit/xml_test.d.ts.map +0 -1
  76. package/dist/types/tests/workspace_svg/workspace_svg_test.d.ts +0 -12
  77. 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. Run `npm run test:lint` after meaningful code changes.
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 # Compile TypeScript and bundle with webpack → dist/main.mjs
27
- npm run test:lint # Run ESLint
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
- - Confirm changes are confined to requested scope.
137
- - Confirm no edits were made under `node_modules/blockly/`.
138
- - If you added runtime checks for states that should never happen (especially early-outs), confirm diagnostics were
139
- added where appropriate.
140
- - Run `npm run test:lint`.
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