@scratch/scratch-vm 11.0.0-UEPR-176

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 (178) hide show
  1. package/LICENSE +12 -0
  2. package/README.md +120 -0
  3. package/dist/node/extension-worker.js +2 -0
  4. package/dist/node/extension-worker.js.map +1 -0
  5. package/dist/node/scratch-vm.js +3 -0
  6. package/dist/node/scratch-vm.js.LICENSE.txt +205 -0
  7. package/dist/node/scratch-vm.js.map +1 -0
  8. package/dist/web/extension-worker.js +2 -0
  9. package/dist/web/extension-worker.js.map +1 -0
  10. package/dist/web/scratch-vm.js +3 -0
  11. package/dist/web/scratch-vm.js.LICENSE.txt +42 -0
  12. package/dist/web/scratch-vm.js.map +1 -0
  13. package/package.json +108 -0
  14. package/src/.eslintrc.js +7 -0
  15. package/src/blocks/scratch3_control.js +206 -0
  16. package/src/blocks/scratch3_core_example.js +69 -0
  17. package/src/blocks/scratch3_data.js +257 -0
  18. package/src/blocks/scratch3_event.js +137 -0
  19. package/src/blocks/scratch3_looks.js +612 -0
  20. package/src/blocks/scratch3_motion.js +288 -0
  21. package/src/blocks/scratch3_operators.js +154 -0
  22. package/src/blocks/scratch3_procedures.js +79 -0
  23. package/src/blocks/scratch3_sensing.js +336 -0
  24. package/src/blocks/scratch3_sound.js +350 -0
  25. package/src/dispatch/central-dispatch.js +143 -0
  26. package/src/dispatch/shared-dispatch.js +235 -0
  27. package/src/dispatch/worker-dispatch.js +110 -0
  28. package/src/engine/adapter.js +176 -0
  29. package/src/engine/block-utility.js +242 -0
  30. package/src/engine/blocks-execute-cache.js +19 -0
  31. package/src/engine/blocks-runtime-cache.js +78 -0
  32. package/src/engine/blocks.js +1299 -0
  33. package/src/engine/comment.js +56 -0
  34. package/src/engine/execute.js +580 -0
  35. package/src/engine/monitor-record.js +23 -0
  36. package/src/engine/mutation-adapter.js +48 -0
  37. package/src/engine/profiler.js +390 -0
  38. package/src/engine/runtime.js +2686 -0
  39. package/src/engine/scratch-blocks-constants.js +27 -0
  40. package/src/engine/sequencer.js +361 -0
  41. package/src/engine/stage-layering.js +29 -0
  42. package/src/engine/target.js +799 -0
  43. package/src/engine/thread.js +404 -0
  44. package/src/engine/variable.js +70 -0
  45. package/src/extension-support/argument-type.js +47 -0
  46. package/src/extension-support/block-type.js +50 -0
  47. package/src/extension-support/define-messages.js +18 -0
  48. package/src/extension-support/extension-manager.js +440 -0
  49. package/src/extension-support/extension-metadata.js +64 -0
  50. package/src/extension-support/extension-worker.js +59 -0
  51. package/src/extension-support/reporter-scope.js +18 -0
  52. package/src/extension-support/target-type.js +17 -0
  53. package/src/extensions/scratch3_boost/index.js +2113 -0
  54. package/src/extensions/scratch3_ev3/index.js +1355 -0
  55. package/src/extensions/scratch3_gdx_for/index.js +981 -0
  56. package/src/extensions/scratch3_gdx_for/scratch-link-device-adapter.js +44 -0
  57. package/src/extensions/scratch3_makeymakey/index.js +396 -0
  58. package/src/extensions/scratch3_microbit/index.js +984 -0
  59. package/src/extensions/scratch3_music/assets/drums/1-snare.mp3 +0 -0
  60. package/src/extensions/scratch3_music/assets/drums/10-wood-block.mp3 +0 -0
  61. package/src/extensions/scratch3_music/assets/drums/11-cowbell.mp3 +0 -0
  62. package/src/extensions/scratch3_music/assets/drums/12-triangle.mp3 +0 -0
  63. package/src/extensions/scratch3_music/assets/drums/13-bongo.mp3 +0 -0
  64. package/src/extensions/scratch3_music/assets/drums/14-conga.mp3 +0 -0
  65. package/src/extensions/scratch3_music/assets/drums/15-cabasa.mp3 +0 -0
  66. package/src/extensions/scratch3_music/assets/drums/16-guiro.mp3 +0 -0
  67. package/src/extensions/scratch3_music/assets/drums/17-vibraslap.mp3 +0 -0
  68. package/src/extensions/scratch3_music/assets/drums/18-cuica.mp3 +0 -0
  69. package/src/extensions/scratch3_music/assets/drums/2-bass-drum.mp3 +0 -0
  70. package/src/extensions/scratch3_music/assets/drums/3-side-stick.mp3 +0 -0
  71. package/src/extensions/scratch3_music/assets/drums/4-crash-cymbal.mp3 +0 -0
  72. package/src/extensions/scratch3_music/assets/drums/5-open-hi-hat.mp3 +0 -0
  73. package/src/extensions/scratch3_music/assets/drums/6-closed-hi-hat.mp3 +0 -0
  74. package/src/extensions/scratch3_music/assets/drums/7-tambourine.mp3 +0 -0
  75. package/src/extensions/scratch3_music/assets/drums/8-hand-clap.mp3 +0 -0
  76. package/src/extensions/scratch3_music/assets/drums/9-claves.mp3 +0 -0
  77. package/src/extensions/scratch3_music/assets/instruments/1-piano/108.mp3 +0 -0
  78. package/src/extensions/scratch3_music/assets/instruments/1-piano/24.mp3 +0 -0
  79. package/src/extensions/scratch3_music/assets/instruments/1-piano/36.mp3 +0 -0
  80. package/src/extensions/scratch3_music/assets/instruments/1-piano/48.mp3 +0 -0
  81. package/src/extensions/scratch3_music/assets/instruments/1-piano/60.mp3 +0 -0
  82. package/src/extensions/scratch3_music/assets/instruments/1-piano/72.mp3 +0 -0
  83. package/src/extensions/scratch3_music/assets/instruments/1-piano/84.mp3 +0 -0
  84. package/src/extensions/scratch3_music/assets/instruments/1-piano/96.mp3 +0 -0
  85. package/src/extensions/scratch3_music/assets/instruments/10-clarinet/48.mp3 +0 -0
  86. package/src/extensions/scratch3_music/assets/instruments/10-clarinet/60.mp3 +0 -0
  87. package/src/extensions/scratch3_music/assets/instruments/11-saxophone/36.mp3 +0 -0
  88. package/src/extensions/scratch3_music/assets/instruments/11-saxophone/60.mp3 +0 -0
  89. package/src/extensions/scratch3_music/assets/instruments/11-saxophone/84.mp3 +0 -0
  90. package/src/extensions/scratch3_music/assets/instruments/12-flute/60.mp3 +0 -0
  91. package/src/extensions/scratch3_music/assets/instruments/12-flute/72.mp3 +0 -0
  92. package/src/extensions/scratch3_music/assets/instruments/13-wooden-flute/60.mp3 +0 -0
  93. package/src/extensions/scratch3_music/assets/instruments/13-wooden-flute/72.mp3 +0 -0
  94. package/src/extensions/scratch3_music/assets/instruments/14-bassoon/36.mp3 +0 -0
  95. package/src/extensions/scratch3_music/assets/instruments/14-bassoon/48.mp3 +0 -0
  96. package/src/extensions/scratch3_music/assets/instruments/14-bassoon/60.mp3 +0 -0
  97. package/src/extensions/scratch3_music/assets/instruments/15-choir/48.mp3 +0 -0
  98. package/src/extensions/scratch3_music/assets/instruments/15-choir/60.mp3 +0 -0
  99. package/src/extensions/scratch3_music/assets/instruments/15-choir/72.mp3 +0 -0
  100. package/src/extensions/scratch3_music/assets/instruments/16-vibraphone/60.mp3 +0 -0
  101. package/src/extensions/scratch3_music/assets/instruments/16-vibraphone/72.mp3 +0 -0
  102. package/src/extensions/scratch3_music/assets/instruments/17-music-box/60.mp3 +0 -0
  103. package/src/extensions/scratch3_music/assets/instruments/18-steel-drum/60.mp3 +0 -0
  104. package/src/extensions/scratch3_music/assets/instruments/19-marimba/60.mp3 +0 -0
  105. package/src/extensions/scratch3_music/assets/instruments/2-electric-piano/60.mp3 +0 -0
  106. package/src/extensions/scratch3_music/assets/instruments/20-synth-lead/60.mp3 +0 -0
  107. package/src/extensions/scratch3_music/assets/instruments/21-synth-pad/60.mp3 +0 -0
  108. package/src/extensions/scratch3_music/assets/instruments/3-organ/60.mp3 +0 -0
  109. package/src/extensions/scratch3_music/assets/instruments/4-guitar/60.mp3 +0 -0
  110. package/src/extensions/scratch3_music/assets/instruments/5-electric-guitar/60.mp3 +0 -0
  111. package/src/extensions/scratch3_music/assets/instruments/6-bass/36.mp3 +0 -0
  112. package/src/extensions/scratch3_music/assets/instruments/6-bass/48.mp3 +0 -0
  113. package/src/extensions/scratch3_music/assets/instruments/7-pizzicato/60.mp3 +0 -0
  114. package/src/extensions/scratch3_music/assets/instruments/8-cello/36.mp3 +0 -0
  115. package/src/extensions/scratch3_music/assets/instruments/8-cello/48.mp3 +0 -0
  116. package/src/extensions/scratch3_music/assets/instruments/8-cello/60.mp3 +0 -0
  117. package/src/extensions/scratch3_music/assets/instruments/9-trombone/36.mp3 +0 -0
  118. package/src/extensions/scratch3_music/assets/instruments/9-trombone/48.mp3 +0 -0
  119. package/src/extensions/scratch3_music/assets/instruments/9-trombone/60.mp3 +0 -0
  120. package/src/extensions/scratch3_music/index.js +1333 -0
  121. package/src/extensions/scratch3_music/manifest.js +63 -0
  122. package/src/extensions/scratch3_pen/index.js +770 -0
  123. package/src/extensions/scratch3_speech2text/index.js +700 -0
  124. package/src/extensions/scratch3_text2speech/index.js +766 -0
  125. package/src/extensions/scratch3_translate/index.js +286 -0
  126. package/src/extensions/scratch3_video_sensing/debug.js +13 -0
  127. package/src/extensions/scratch3_video_sensing/index.js +594 -0
  128. package/src/extensions/scratch3_video_sensing/library.js +384 -0
  129. package/src/extensions/scratch3_video_sensing/math.js +76 -0
  130. package/src/extensions/scratch3_video_sensing/view.js +509 -0
  131. package/src/extensions/scratch3_wedo2/index.js +1616 -0
  132. package/src/import/load-costume.js +416 -0
  133. package/src/import/load-sound.js +116 -0
  134. package/src/index.js +10 -0
  135. package/src/io/ble.js +256 -0
  136. package/src/io/bt.js +202 -0
  137. package/src/io/clock.js +39 -0
  138. package/src/io/cloud.js +169 -0
  139. package/src/io/keyboard.js +146 -0
  140. package/src/io/mouse.js +145 -0
  141. package/src/io/mouseWheel.js +28 -0
  142. package/src/io/userData.js +24 -0
  143. package/src/io/video.js +210 -0
  144. package/src/playground/benchmark.css +83 -0
  145. package/src/playground/benchmark.js +753 -0
  146. package/src/playground/index.html +111 -0
  147. package/src/playground/suite.css +78 -0
  148. package/src/playground/suite.html +25 -0
  149. package/src/playground/suite.js +544 -0
  150. package/src/playground/video-sensing.html +18 -0
  151. package/src/playground/video-sensing.js +133 -0
  152. package/src/serialization/deserialize-assets.js +178 -0
  153. package/src/serialization/sb2.js +1295 -0
  154. package/src/serialization/sb2_specmap.js +1818 -0
  155. package/src/serialization/sb3.js +1320 -0
  156. package/src/serialization/serialize-assets.js +60 -0
  157. package/src/sprites/rendered-target.js +1115 -0
  158. package/src/sprites/sprite.js +177 -0
  159. package/src/util/base64-util.js +48 -0
  160. package/src/util/cast.js +218 -0
  161. package/src/util/clone.js +17 -0
  162. package/src/util/color.js +204 -0
  163. package/src/util/fetch-with-timeout.js +53 -0
  164. package/src/util/get-monitor-id.js +33 -0
  165. package/src/util/jsonrpc.js +114 -0
  166. package/src/util/log.js +4 -0
  167. package/src/util/math-util.js +122 -0
  168. package/src/util/maybe-format-message.js +18 -0
  169. package/src/util/new-block-ids.js +33 -0
  170. package/src/util/rateLimiter.js +73 -0
  171. package/src/util/scratch-link-websocket.js +133 -0
  172. package/src/util/string-util.js +94 -0
  173. package/src/util/task-queue.js +203 -0
  174. package/src/util/timer.js +103 -0
  175. package/src/util/uid.js +29 -0
  176. package/src/util/variable-util.js +48 -0
  177. package/src/util/xml-escape.js +33 -0
  178. package/src/virtual-machine.js +1586 -0
@@ -0,0 +1,242 @@
1
+ const Thread = require('./thread');
2
+ const Timer = require('../util/timer');
3
+
4
+ /**
5
+ * @fileoverview
6
+ * Interface provided to block primitive functions for interacting with the
7
+ * runtime, thread, target, and convenient methods.
8
+ */
9
+
10
+ class BlockUtility {
11
+ constructor (sequencer = null, thread = null) {
12
+ /**
13
+ * A sequencer block primitives use to branch or start procedures with
14
+ * @type {?Sequencer}
15
+ */
16
+ this.sequencer = sequencer;
17
+
18
+ /**
19
+ * The block primitives thread with the block's target, stackFrame and
20
+ * modifiable status.
21
+ * @type {?Thread}
22
+ */
23
+ this.thread = thread;
24
+
25
+ this._nowObj = {
26
+ now: () => this.sequencer.runtime.currentMSecs
27
+ };
28
+ }
29
+
30
+ /**
31
+ * The target the primitive is working on.
32
+ * @type {Target}
33
+ */
34
+ get target () {
35
+ return this.thread.target;
36
+ }
37
+
38
+ /**
39
+ * The runtime the block primitive is running in.
40
+ * @type {Runtime}
41
+ */
42
+ get runtime () {
43
+ return this.sequencer.runtime;
44
+ }
45
+
46
+ /**
47
+ * Use the runtime's currentMSecs value as a timestamp value for now
48
+ * This is useful in some cases where we need compatibility with Scratch 2
49
+ * @type {function}
50
+ */
51
+ get nowObj () {
52
+ if (this.runtime) {
53
+ return this._nowObj;
54
+ }
55
+ return null;
56
+ }
57
+
58
+ /**
59
+ * The stack frame used by loop and other blocks to track internal state.
60
+ * @type {object}
61
+ */
62
+ get stackFrame () {
63
+ const frame = this.thread.peekStackFrame();
64
+ if (frame.executionContext === null) {
65
+ frame.executionContext = {};
66
+ }
67
+ return frame.executionContext;
68
+ }
69
+
70
+ /**
71
+ * Check the stack timer and return a boolean based on whether it has finished or not.
72
+ * @return {boolean} - true if the stack timer has finished.
73
+ */
74
+ stackTimerFinished () {
75
+ const timeElapsed = this.stackFrame.timer.timeElapsed();
76
+ if (timeElapsed < this.stackFrame.duration) {
77
+ return false;
78
+ }
79
+ return true;
80
+ }
81
+
82
+ /**
83
+ * Check if the stack timer needs initialization.
84
+ * @return {boolean} - true if the stack timer needs to be initialized.
85
+ */
86
+ stackTimerNeedsInit () {
87
+ return !this.stackFrame.timer;
88
+ }
89
+
90
+ /**
91
+ * Create and start a stack timer
92
+ * @param {number} duration - a duration in milliseconds to set the timer for.
93
+ */
94
+ startStackTimer (duration) {
95
+ if (this.nowObj) {
96
+ this.stackFrame.timer = new Timer(this.nowObj);
97
+ } else {
98
+ this.stackFrame.timer = new Timer();
99
+ }
100
+ this.stackFrame.timer.start();
101
+ this.stackFrame.duration = duration;
102
+ }
103
+
104
+ /**
105
+ * Set the thread to yield.
106
+ */
107
+ yield () {
108
+ this.thread.status = Thread.STATUS_YIELD;
109
+ }
110
+
111
+ /**
112
+ * Set the thread to yield until the next tick of the runtime.
113
+ */
114
+ yieldTick () {
115
+ this.thread.status = Thread.STATUS_YIELD_TICK;
116
+ }
117
+
118
+ /**
119
+ * Start a branch in the current block.
120
+ * @param {number} branchNum Which branch to step to (i.e., 1, 2).
121
+ * @param {boolean} isLoop Whether this block is a loop.
122
+ */
123
+ startBranch (branchNum, isLoop) {
124
+ this.sequencer.stepToBranch(this.thread, branchNum, isLoop);
125
+ }
126
+
127
+ /**
128
+ * Stop all threads.
129
+ */
130
+ stopAll () {
131
+ this.sequencer.runtime.stopAll();
132
+ }
133
+
134
+ /**
135
+ * Stop threads other on this target other than the thread holding the
136
+ * executed block.
137
+ */
138
+ stopOtherTargetThreads () {
139
+ this.sequencer.runtime.stopForTarget(this.thread.target, this.thread);
140
+ }
141
+
142
+ /**
143
+ * Stop this thread.
144
+ */
145
+ stopThisScript () {
146
+ this.thread.stopThisScript();
147
+ }
148
+
149
+ /**
150
+ * Start a specified procedure on this thread.
151
+ * @param {string} procedureCode Procedure code for procedure to start.
152
+ */
153
+ startProcedure (procedureCode) {
154
+ this.sequencer.stepToProcedure(this.thread, procedureCode);
155
+ }
156
+
157
+ /**
158
+ * Get names and ids of parameters for the given procedure.
159
+ * @param {string} procedureCode Procedure code for procedure to query.
160
+ * @return {Array.<string>} List of param names for a procedure.
161
+ */
162
+ getProcedureParamNamesAndIds (procedureCode) {
163
+ return this.thread.target.blocks.getProcedureParamNamesAndIds(procedureCode);
164
+ }
165
+
166
+ /**
167
+ * Get names, ids, and defaults of parameters for the given procedure.
168
+ * @param {string} procedureCode Procedure code for procedure to query.
169
+ * @return {Array.<string>} List of param names for a procedure.
170
+ */
171
+ getProcedureParamNamesIdsAndDefaults (procedureCode) {
172
+ return this.thread.target.blocks.getProcedureParamNamesIdsAndDefaults(procedureCode);
173
+ }
174
+
175
+ /**
176
+ * Initialize procedure parameters in the thread before pushing parameters.
177
+ */
178
+ initParams () {
179
+ this.thread.initParams();
180
+ }
181
+
182
+ /**
183
+ * Store a procedure parameter value by its name.
184
+ * @param {string} paramName The procedure's parameter name.
185
+ * @param {*} paramValue The procedure's parameter value.
186
+ */
187
+ pushParam (paramName, paramValue) {
188
+ this.thread.pushParam(paramName, paramValue);
189
+ }
190
+
191
+ /**
192
+ * Retrieve the stored parameter value for a given parameter name.
193
+ * @param {string} paramName The procedure's parameter name.
194
+ * @return {*} The parameter's current stored value.
195
+ */
196
+ getParam (paramName) {
197
+ return this.thread.getParam(paramName);
198
+ }
199
+
200
+ /**
201
+ * Start all relevant hats.
202
+ * @param {!string} requestedHat Opcode of hats to start.
203
+ * @param {object=} optMatchFields Optionally, fields to match on the hat.
204
+ * @param {Target=} optTarget Optionally, a target to restrict to.
205
+ * @return {Array.<Thread>} List of threads started by this function.
206
+ */
207
+ startHats (requestedHat, optMatchFields, optTarget) {
208
+ // Store thread and sequencer to ensure we can return to the calling block's context.
209
+ // startHats may execute further blocks and dirty the BlockUtility's execution context
210
+ // and confuse the calling block when we return to it.
211
+ const callerThread = this.thread;
212
+ const callerSequencer = this.sequencer;
213
+ const result = this.sequencer.runtime.startHats(requestedHat, optMatchFields, optTarget);
214
+
215
+ // Restore thread and sequencer to prior values before we return to the calling block.
216
+ this.thread = callerThread;
217
+ this.sequencer = callerSequencer;
218
+
219
+ return result;
220
+ }
221
+
222
+ /**
223
+ * Query a named IO device.
224
+ * @param {string} device The name of like the device, like keyboard.
225
+ * @param {string} func The name of the device's function to query.
226
+ * @param {Array.<*>} args Arguments to pass to the device's function.
227
+ * @return {*} The expected output for the device's function.
228
+ */
229
+ ioQuery (device, func, args) {
230
+ // Find the I/O device and execute the query/function call.
231
+ if (
232
+ this.sequencer.runtime.ioDevices[device] &&
233
+ this.sequencer.runtime.ioDevices[device][func]) {
234
+ const devObject = this.sequencer.runtime.ioDevices[device];
235
+ // TODO: verify correct `this` after switching from apply to spread
236
+ // eslint-disable-next-line prefer-spread
237
+ return devObject[func].apply(devObject, args);
238
+ }
239
+ }
240
+ }
241
+
242
+ module.exports = BlockUtility;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @fileoverview
3
+ * Access point for private method shared between blocks.js and execute.js for
4
+ * caching execute information.
5
+ */
6
+
7
+ /**
8
+ * A private method shared with execute to build an object containing the block
9
+ * information execute needs and that is reset when other cached Blocks info is
10
+ * reset.
11
+ * @param {Blocks} blocks Blocks containing the expected blockId
12
+ * @param {string} blockId blockId for the desired execute cache
13
+ */
14
+ exports.getCached = function () {
15
+ throw new Error('blocks.js has not initialized BlocksExecuteCache');
16
+ };
17
+
18
+ // Call after the default throwing getCached is assigned for Blocks to replace.
19
+ require('./blocks');
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @fileoverview
3
+ * The BlocksRuntimeCache caches data about the top block of scripts so that
4
+ * Runtime can iterate a targeted opcode and iterate the returned set faster.
5
+ * Many top blocks need to match fields as well as opcode, since that matching
6
+ * compares strings in uppercase we can go ahead and uppercase the cached value
7
+ * so we don't need to in the future.
8
+ */
9
+
10
+ /**
11
+ * A set of cached data about the top block of a script.
12
+ * @param {Blocks} container - Container holding the block and related data
13
+ * @param {string} blockId - Id for whose block data is cached in this instance
14
+ */
15
+ class RuntimeScriptCache {
16
+ constructor (container, blockId) {
17
+ /**
18
+ * Container with block data for blockId.
19
+ * @type {Blocks}
20
+ */
21
+ this.container = container;
22
+
23
+ /**
24
+ * ID for block this instance caches.
25
+ * @type {string}
26
+ */
27
+ this.blockId = blockId;
28
+
29
+ const block = container.getBlock(blockId);
30
+ const fields = container.getFields(block);
31
+
32
+ /**
33
+ * Formatted fields or fields of input blocks ready for comparison in
34
+ * runtime.
35
+ *
36
+ * This is a clone of parts of the targeted blocks. Changes to these
37
+ * clones are limited to copies under RuntimeScriptCache and will not
38
+ * appear in the original blocks in their container. This copy is
39
+ * modified changing the case of strings to uppercase. These uppercase
40
+ * values will be compared later by the VM.
41
+ * @type {object}
42
+ */
43
+ this.fieldsOfInputs = Object.assign({}, fields);
44
+ if (Object.keys(fields).length === 0) {
45
+ const inputs = container.getInputs(block);
46
+ for (const input in inputs) {
47
+ if (!Object.prototype.hasOwnProperty.call(inputs, input)) continue;
48
+ const id = inputs[input].block;
49
+ const inputBlock = container.getBlock(id);
50
+ const inputFields = container.getFields(inputBlock);
51
+ Object.assign(this.fieldsOfInputs, inputFields);
52
+ }
53
+ }
54
+ for (const key in this.fieldsOfInputs) {
55
+ const field = this.fieldsOfInputs[key] = Object.assign({}, this.fieldsOfInputs[key]);
56
+ if (field.value.toUpperCase) {
57
+ field.value = field.value.toUpperCase();
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Get an array of scripts from a block container prefiltered to match opcode.
65
+ * @param {Blocks} container - Container of blocks
66
+ * @param {string} opcode - Opcode to filter top blocks by
67
+ */
68
+ exports.getScripts = function () {
69
+ throw new Error('blocks.js has not initialized BlocksRuntimeCache');
70
+ };
71
+
72
+ /**
73
+ * Exposed RuntimeScriptCache class used by integration in blocks.js.
74
+ * @private
75
+ */
76
+ exports._RuntimeScriptCache = RuntimeScriptCache;
77
+
78
+ require('./blocks');