scratch-vm 4.5.378 → 4.5.379

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/.nvmrc CHANGED
@@ -1 +1 @@
1
- 18
1
+ v20
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.5.379](https://github.com/scratchfoundation/scratch-vm/compare/v4.5.378...v4.5.379) (2024-07-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * [UEPR-27] Added missing entry point ([4f146d6](https://github.com/scratchfoundation/scratch-vm/commit/4f146d6290dad94b37d3ee32a9f86aea551e396e))
12
+
6
13
  ## [4.5.378](https://github.com/scratchfoundation/scratch-vm/compare/v4.5.377...v4.5.378) (2024-07-28)
7
14
 
8
15
 
@@ -0,0 +1,630 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["VirtualMachine"] = factory();
8
+ else
9
+ root["VirtualMachine"] = factory();
10
+ })(global, () => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ var __webpack_modules__ = ({
13
+
14
+ /***/ "./src/dispatch/shared-dispatch.js":
15
+ /*!*****************************************!*\
16
+ !*** ./src/dispatch/shared-dispatch.js ***!
17
+ \*****************************************/
18
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
19
+
20
+ const log = __webpack_require__(/*! ../util/log */ "./src/util/log.js");
21
+
22
+ /**
23
+ * @typedef {object} DispatchCallMessage - a message to the dispatch system representing a service method call
24
+ * @property {*} responseId - send a response message with this response ID. See {@link DispatchResponseMessage}
25
+ * @property {string} service - the name of the service to be called
26
+ * @property {string} method - the name of the method to be called
27
+ * @property {Array|undefined} args - the arguments to be passed to the method
28
+ */
29
+
30
+ /**
31
+ * @typedef {object} DispatchResponseMessage - a message to the dispatch system representing the results of a call
32
+ * @property {*} responseId - a copy of the response ID from the call which generated this response
33
+ * @property {*|undefined} error - if this is truthy, then it contains results from a failed call (such as an exception)
34
+ * @property {*|undefined} result - if error is not truthy, then this contains the return value of the call (if any)
35
+ */
36
+
37
+ /**
38
+ * @typedef {DispatchCallMessage|DispatchResponseMessage} DispatchMessage
39
+ * Any message to the dispatch system.
40
+ */
41
+
42
+ /**
43
+ * The SharedDispatch class is responsible for dispatch features shared by
44
+ * {@link CentralDispatch} and {@link WorkerDispatch}.
45
+ */
46
+ class SharedDispatch {
47
+ constructor() {
48
+ /**
49
+ * List of callback registrations for promises waiting for a response from a call to a service on another
50
+ * worker. A callback registration is an array of [resolve,reject] Promise functions.
51
+ * Calls to local services don't enter this list.
52
+ * @type {Array.<Function[]>}
53
+ */
54
+ this.callbacks = [];
55
+
56
+ /**
57
+ * The next response ID to be used.
58
+ * @type {int}
59
+ */
60
+ this.nextResponseId = 0;
61
+ }
62
+
63
+ /**
64
+ * Call a particular method on a particular service, regardless of whether that service is provided locally or on
65
+ * a worker. If the service is provided by a worker, the `args` will be copied using the Structured Clone
66
+ * algorithm, except for any items which are also in the `transfer` list. Ownership of those items will be
67
+ * transferred to the worker, and they should not be used after this call.
68
+ * @example
69
+ * dispatcher.call('vm', 'setData', 'cat', 42);
70
+ * // this finds the worker for the 'vm' service, then on that worker calls:
71
+ * vm.setData('cat', 42);
72
+ * @param {string} service - the name of the service.
73
+ * @param {string} method - the name of the method.
74
+ * @param {*} [args] - the arguments to be copied to the method, if any.
75
+ * @returns {Promise} - a promise for the return value of the service method.
76
+ */
77
+ call(service, method) {
78
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
79
+ args[_key - 2] = arguments[_key];
80
+ }
81
+ return this.transferCall(service, method, null, ...args);
82
+ }
83
+
84
+ /**
85
+ * Call a particular method on a particular service, regardless of whether that service is provided locally or on
86
+ * a worker. If the service is provided by a worker, the `args` will be copied using the Structured Clone
87
+ * algorithm, except for any items which are also in the `transfer` list. Ownership of those items will be
88
+ * transferred to the worker, and they should not be used after this call.
89
+ * @example
90
+ * dispatcher.transferCall('vm', 'setData', [myArrayBuffer], 'cat', myArrayBuffer);
91
+ * // this finds the worker for the 'vm' service, transfers `myArrayBuffer` to it, then on that worker calls:
92
+ * vm.setData('cat', myArrayBuffer);
93
+ * @param {string} service - the name of the service.
94
+ * @param {string} method - the name of the method.
95
+ * @param {Array} [transfer] - objects to be transferred instead of copied. Must be present in `args` to be useful.
96
+ * @param {*} [args] - the arguments to be copied to the method, if any.
97
+ * @returns {Promise} - a promise for the return value of the service method.
98
+ */
99
+ transferCall(service, method, transfer) {
100
+ try {
101
+ const {
102
+ provider,
103
+ isRemote
104
+ } = this._getServiceProvider(service);
105
+ if (provider) {
106
+ for (var _len2 = arguments.length, args = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
107
+ args[_key2 - 3] = arguments[_key2];
108
+ }
109
+ if (isRemote) {
110
+ return this._remoteTransferCall(provider, service, method, transfer, ...args);
111
+ }
112
+
113
+ // TODO: verify correct `this` after switching from apply to spread
114
+ // eslint-disable-next-line prefer-spread
115
+ const result = provider[method].apply(provider, args);
116
+ return Promise.resolve(result);
117
+ }
118
+ return Promise.reject(new Error("Service not found: ".concat(service)));
119
+ } catch (e) {
120
+ return Promise.reject(e);
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Check if a particular service lives on another worker.
126
+ * @param {string} service - the service to check.
127
+ * @returns {boolean} - true if the service is remote (calls must cross a Worker boundary), false otherwise.
128
+ * @private
129
+ */
130
+ _isRemoteService(service) {
131
+ return this._getServiceProvider(service).isRemote;
132
+ }
133
+
134
+ /**
135
+ * Like {@link call}, but force the call to be posted through a particular communication channel.
136
+ * @param {object} provider - send the call through this object's `postMessage` function.
137
+ * @param {string} service - the name of the service.
138
+ * @param {string} method - the name of the method.
139
+ * @param {*} [args] - the arguments to be copied to the method, if any.
140
+ * @returns {Promise} - a promise for the return value of the service method.
141
+ */
142
+ _remoteCall(provider, service, method) {
143
+ for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
144
+ args[_key3 - 3] = arguments[_key3];
145
+ }
146
+ return this._remoteTransferCall(provider, service, method, null, ...args);
147
+ }
148
+
149
+ /**
150
+ * Like {@link transferCall}, but force the call to be posted through a particular communication channel.
151
+ * @param {object} provider - send the call through this object's `postMessage` function.
152
+ * @param {string} service - the name of the service.
153
+ * @param {string} method - the name of the method.
154
+ * @param {Array} [transfer] - objects to be transferred instead of copied. Must be present in `args` to be useful.
155
+ * @param {*} [args] - the arguments to be copied to the method, if any.
156
+ * @returns {Promise} - a promise for the return value of the service method.
157
+ */
158
+ _remoteTransferCall(provider, service, method, transfer) {
159
+ for (var _len4 = arguments.length, args = new Array(_len4 > 4 ? _len4 - 4 : 0), _key4 = 4; _key4 < _len4; _key4++) {
160
+ args[_key4 - 4] = arguments[_key4];
161
+ }
162
+ return new Promise((resolve, reject) => {
163
+ const responseId = this._storeCallbacks(resolve, reject);
164
+
165
+ /** @TODO: remove this hack! this is just here so we don't try to send `util` to a worker */
166
+ if (args.length > 0 && typeof args[args.length - 1].yield === 'function') {
167
+ args.pop();
168
+ }
169
+ if (transfer) {
170
+ provider.postMessage({
171
+ service,
172
+ method,
173
+ responseId,
174
+ args
175
+ }, transfer);
176
+ } else {
177
+ provider.postMessage({
178
+ service,
179
+ method,
180
+ responseId,
181
+ args
182
+ });
183
+ }
184
+ });
185
+ }
186
+
187
+ /**
188
+ * Store callback functions pending a response message.
189
+ * @param {Function} resolve - function to call if the service method returns.
190
+ * @param {Function} reject - function to call if the service method throws.
191
+ * @returns {*} - a unique response ID for this set of callbacks. See {@link _deliverResponse}.
192
+ * @protected
193
+ */
194
+ _storeCallbacks(resolve, reject) {
195
+ const responseId = this.nextResponseId++;
196
+ this.callbacks[responseId] = [resolve, reject];
197
+ return responseId;
198
+ }
199
+
200
+ /**
201
+ * Deliver call response from a worker. This should only be called as the result of a message from a worker.
202
+ * @param {int} responseId - the response ID of the callback set to call.
203
+ * @param {DispatchResponseMessage} message - the message containing the response value(s).
204
+ * @protected
205
+ */
206
+ _deliverResponse(responseId, message) {
207
+ try {
208
+ const [resolve, reject] = this.callbacks[responseId];
209
+ delete this.callbacks[responseId];
210
+ if (message.error) {
211
+ reject(message.error);
212
+ } else {
213
+ resolve(message.result);
214
+ }
215
+ } catch (e) {
216
+ log.error("Dispatch callback failed: ".concat(JSON.stringify(e)));
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Handle a message event received from a connected worker.
222
+ * @param {Worker} worker - the worker which sent the message, or the global object if running in a worker.
223
+ * @param {MessageEvent} event - the message event to be handled.
224
+ * @protected
225
+ */
226
+ _onMessage(worker, event) {
227
+ /** @type {DispatchMessage} */
228
+ const message = event.data;
229
+ message.args = message.args || [];
230
+ let promise;
231
+ if (message.service) {
232
+ if (message.service === 'dispatch') {
233
+ promise = this._onDispatchMessage(worker, message);
234
+ } else {
235
+ promise = this.call(message.service, message.method, ...message.args);
236
+ }
237
+ } else if (typeof message.responseId === 'undefined') {
238
+ log.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(event)));
239
+ } else {
240
+ this._deliverResponse(message.responseId, message);
241
+ }
242
+ if (promise) {
243
+ if (typeof message.responseId === 'undefined') {
244
+ log.error("Dispatch message missing required response ID: ".concat(JSON.stringify(event)));
245
+ } else {
246
+ promise.then(result => worker.postMessage({
247
+ responseId: message.responseId,
248
+ result
249
+ }), error => worker.postMessage({
250
+ responseId: message.responseId,
251
+ error
252
+ }));
253
+ }
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Fetch the service provider object for a particular service name.
259
+ * @abstract
260
+ * @param {string} service - the name of the service to look up
261
+ * @returns {{provider:(object|Worker), isRemote:boolean}} - the means to contact the service, if found
262
+ * @protected
263
+ */
264
+ _getServiceProvider(service) {
265
+ throw new Error("Could not get provider for ".concat(service, ": _getServiceProvider not implemented"));
266
+ }
267
+
268
+ /**
269
+ * Handle a call message sent to the dispatch service itself
270
+ * @abstract
271
+ * @param {Worker} worker - the worker which sent the message.
272
+ * @param {DispatchCallMessage} message - the message to be handled.
273
+ * @returns {Promise|undefined} - a promise for the results of this operation, if appropriate
274
+ * @private
275
+ */
276
+ _onDispatchMessage(worker, message) {
277
+ throw new Error("Unimplemented dispatch message handler cannot handle ".concat(message.method, " method"));
278
+ }
279
+ }
280
+ module.exports = SharedDispatch;
281
+
282
+ /***/ }),
283
+
284
+ /***/ "./src/dispatch/worker-dispatch.js":
285
+ /*!*****************************************!*\
286
+ !*** ./src/dispatch/worker-dispatch.js ***!
287
+ \*****************************************/
288
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
289
+
290
+ const SharedDispatch = __webpack_require__(/*! ./shared-dispatch */ "./src/dispatch/shared-dispatch.js");
291
+ const log = __webpack_require__(/*! ../util/log */ "./src/util/log.js");
292
+
293
+ /**
294
+ * This class provides a Worker with the means to participate in the message dispatch system managed by CentralDispatch.
295
+ * From any context in the messaging system, the dispatcher's "call" method can call any method on any "service"
296
+ * provided in any participating context. The dispatch system will forward function arguments and return values across
297
+ * worker boundaries as needed.
298
+ * @see {CentralDispatch}
299
+ */
300
+ class WorkerDispatch extends SharedDispatch {
301
+ constructor() {
302
+ super();
303
+
304
+ /**
305
+ * This promise will be resolved when we have successfully connected to central dispatch.
306
+ * @type {Promise}
307
+ * @see {waitForConnection}
308
+ * @private
309
+ */
310
+ this._connectionPromise = new Promise(resolve => {
311
+ this._onConnect = resolve;
312
+ });
313
+
314
+ /**
315
+ * Map of service name to local service provider.
316
+ * If a service is not listed here, it is assumed to be provided by another context (another Worker or the main
317
+ * thread).
318
+ * @see {setService}
319
+ * @type {object}
320
+ */
321
+ this.services = {};
322
+ this._onMessage = this._onMessage.bind(this, self);
323
+ if (typeof self !== 'undefined') {
324
+ self.onmessage = this._onMessage;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * @returns {Promise} a promise which will resolve upon connection to central dispatch. If you need to make a call
330
+ * immediately on "startup" you can attach a 'then' to this promise.
331
+ * @example
332
+ * dispatch.waitForConnection.then(() => {
333
+ * dispatch.call('myService', 'hello');
334
+ * })
335
+ */
336
+ get waitForConnection() {
337
+ return this._connectionPromise;
338
+ }
339
+
340
+ /**
341
+ * Set a local object as the global provider of the specified service.
342
+ * WARNING: Any method on the provider can be called from any worker within the dispatch system.
343
+ * @param {string} service - a globally unique string identifying this service. Examples: 'vm', 'gui', 'extension9'.
344
+ * @param {object} provider - a local object which provides this service.
345
+ * @returns {Promise} - a promise which will resolve once the service is registered.
346
+ */
347
+ setService(service, provider) {
348
+ if (Object.prototype.hasOwnProperty.call(this.services, service)) {
349
+ log.warn("Worker dispatch replacing existing service provider for ".concat(service));
350
+ }
351
+ this.services[service] = provider;
352
+ return this.waitForConnection.then(() => this._remoteCall(self, 'dispatch', 'setService', service));
353
+ }
354
+
355
+ /**
356
+ * Fetch the service provider object for a particular service name.
357
+ * @override
358
+ * @param {string} service - the name of the service to look up
359
+ * @returns {{provider:(object|Worker), isRemote:boolean}} - the means to contact the service, if found
360
+ * @protected
361
+ */
362
+ _getServiceProvider(service) {
363
+ // if we don't have a local service by this name, contact central dispatch by calling `postMessage` on self
364
+ const provider = this.services[service];
365
+ return {
366
+ provider: provider || self,
367
+ isRemote: !provider
368
+ };
369
+ }
370
+
371
+ /**
372
+ * Handle a call message sent to the dispatch service itself
373
+ * @override
374
+ * @param {Worker} worker - the worker which sent the message.
375
+ * @param {DispatchCallMessage} message - the message to be handled.
376
+ * @returns {Promise|undefined} - a promise for the results of this operation, if appropriate
377
+ * @protected
378
+ */
379
+ _onDispatchMessage(worker, message) {
380
+ let promise;
381
+ switch (message.method) {
382
+ case 'handshake':
383
+ promise = this._onConnect();
384
+ break;
385
+ case 'terminate':
386
+ // Don't close until next tick, after sending confirmation back
387
+ setTimeout(() => self.close(), 0);
388
+ promise = Promise.resolve();
389
+ break;
390
+ default:
391
+ log.error("Worker dispatch received message for unknown method: ".concat(message.method));
392
+ }
393
+ return promise;
394
+ }
395
+ }
396
+ module.exports = new WorkerDispatch();
397
+
398
+ /***/ }),
399
+
400
+ /***/ "./src/extension-support/argument-type.js":
401
+ /*!************************************************!*\
402
+ !*** ./src/extension-support/argument-type.js ***!
403
+ \************************************************/
404
+ /***/ ((module) => {
405
+
406
+ /**
407
+ * Block argument types
408
+ * @enum {string}
409
+ */
410
+ const ArgumentType = {
411
+ /**
412
+ * Numeric value with angle picker
413
+ */
414
+ ANGLE: 'angle',
415
+ /**
416
+ * Boolean value with hexagonal placeholder
417
+ */
418
+ BOOLEAN: 'Boolean',
419
+ /**
420
+ * Numeric value with color picker
421
+ */
422
+ COLOR: 'color',
423
+ /**
424
+ * Numeric value with text field
425
+ */
426
+ NUMBER: 'number',
427
+ /**
428
+ * String value with text field
429
+ */
430
+ STRING: 'string',
431
+ /**
432
+ * String value with matrix field
433
+ */
434
+ MATRIX: 'matrix',
435
+ /**
436
+ * MIDI note number with note picker (piano) field
437
+ */
438
+ NOTE: 'note',
439
+ /**
440
+ * Inline image on block (as part of the label)
441
+ */
442
+ IMAGE: 'image'
443
+ };
444
+ module.exports = ArgumentType;
445
+
446
+ /***/ }),
447
+
448
+ /***/ "./src/extension-support/block-type.js":
449
+ /*!*********************************************!*\
450
+ !*** ./src/extension-support/block-type.js ***!
451
+ \*********************************************/
452
+ /***/ ((module) => {
453
+
454
+ /**
455
+ * Types of block
456
+ * @enum {string}
457
+ */
458
+ const BlockType = {
459
+ /**
460
+ * Boolean reporter with hexagonal shape
461
+ */
462
+ BOOLEAN: 'Boolean',
463
+ /**
464
+ * A button (not an actual block) for some special action, like making a variable
465
+ */
466
+ BUTTON: 'button',
467
+ /**
468
+ * Command block
469
+ */
470
+ COMMAND: 'command',
471
+ /**
472
+ * Specialized command block which may or may not run a child branch
473
+ * The thread continues with the next block whether or not a child branch ran.
474
+ */
475
+ CONDITIONAL: 'conditional',
476
+ /**
477
+ * Specialized hat block with no implementation function
478
+ * This stack only runs if the corresponding event is emitted by other code.
479
+ */
480
+ EVENT: 'event',
481
+ /**
482
+ * Hat block which conditionally starts a block stack
483
+ */
484
+ HAT: 'hat',
485
+ /**
486
+ * Specialized command block which may or may not run a child branch
487
+ * If a child branch runs, the thread evaluates the loop block again.
488
+ */
489
+ LOOP: 'loop',
490
+ /**
491
+ * General reporter with numeric or string value
492
+ */
493
+ REPORTER: 'reporter'
494
+ };
495
+ module.exports = BlockType;
496
+
497
+ /***/ }),
498
+
499
+ /***/ "./src/extension-support/target-type.js":
500
+ /*!**********************************************!*\
501
+ !*** ./src/extension-support/target-type.js ***!
502
+ \**********************************************/
503
+ /***/ ((module) => {
504
+
505
+ /**
506
+ * Default types of Target supported by the VM
507
+ * @enum {string}
508
+ */
509
+ const TargetType = {
510
+ /**
511
+ * Rendered target which can move, change costumes, etc.
512
+ */
513
+ SPRITE: 'sprite',
514
+ /**
515
+ * Rendered target which cannot move but can change backdrops
516
+ */
517
+ STAGE: 'stage'
518
+ };
519
+ module.exports = TargetType;
520
+
521
+ /***/ }),
522
+
523
+ /***/ "./src/util/log.js":
524
+ /*!*************************!*\
525
+ !*** ./src/util/log.js ***!
526
+ \*************************/
527
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
528
+
529
+ const minilog = __webpack_require__(/*! minilog */ "minilog");
530
+ minilog.enable();
531
+ module.exports = minilog('vm');
532
+
533
+ /***/ }),
534
+
535
+ /***/ "minilog":
536
+ /*!**************************!*\
537
+ !*** external "minilog" ***!
538
+ \**************************/
539
+ /***/ ((module) => {
540
+
541
+ "use strict";
542
+ module.exports = require("minilog");
543
+
544
+ /***/ })
545
+
546
+ /******/ });
547
+ /************************************************************************/
548
+ /******/ // The module cache
549
+ /******/ var __webpack_module_cache__ = {};
550
+ /******/
551
+ /******/ // The require function
552
+ /******/ function __webpack_require__(moduleId) {
553
+ /******/ // Check if module is in cache
554
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
555
+ /******/ if (cachedModule !== undefined) {
556
+ /******/ return cachedModule.exports;
557
+ /******/ }
558
+ /******/ // Create a new module (and put it into the cache)
559
+ /******/ var module = __webpack_module_cache__[moduleId] = {
560
+ /******/ // no module.id needed
561
+ /******/ // no module.loaded needed
562
+ /******/ exports: {}
563
+ /******/ };
564
+ /******/
565
+ /******/ // Execute the module function
566
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
567
+ /******/
568
+ /******/ // Return the exports of the module
569
+ /******/ return module.exports;
570
+ /******/ }
571
+ /******/
572
+ /************************************************************************/
573
+ var __webpack_exports__ = {};
574
+ /*!***************************************************!*\
575
+ !*** ./src/extension-support/extension-worker.js ***!
576
+ \***************************************************/
577
+ /* eslint-env worker */
578
+
579
+ const ArgumentType = __webpack_require__(/*! ../extension-support/argument-type */ "./src/extension-support/argument-type.js");
580
+ const BlockType = __webpack_require__(/*! ../extension-support/block-type */ "./src/extension-support/block-type.js");
581
+ const dispatch = __webpack_require__(/*! ../dispatch/worker-dispatch */ "./src/dispatch/worker-dispatch.js");
582
+ const TargetType = __webpack_require__(/*! ../extension-support/target-type */ "./src/extension-support/target-type.js");
583
+ class ExtensionWorker {
584
+ constructor() {
585
+ this.nextExtensionId = 0;
586
+ this.initialRegistrations = [];
587
+ dispatch.waitForConnection.then(() => {
588
+ dispatch.call('extensions', 'allocateWorker').then(x => {
589
+ const [id, extension] = x;
590
+ this.workerId = id;
591
+ try {
592
+ importScripts(extension);
593
+ const initialRegistrations = this.initialRegistrations;
594
+ this.initialRegistrations = null;
595
+ Promise.all(initialRegistrations).then(() => dispatch.call('extensions', 'onWorkerInit', id));
596
+ } catch (e) {
597
+ dispatch.call('extensions', 'onWorkerInit', id, e);
598
+ }
599
+ });
600
+ });
601
+ this.extensions = [];
602
+ }
603
+ register(extensionObject) {
604
+ const extensionId = this.nextExtensionId++;
605
+ this.extensions.push(extensionObject);
606
+ const serviceName = "extension.".concat(this.workerId, ".").concat(extensionId);
607
+ const promise = dispatch.setService(serviceName, extensionObject).then(() => dispatch.call('extensions', 'registerExtensionService', serviceName));
608
+ if (this.initialRegistrations) {
609
+ this.initialRegistrations.push(promise);
610
+ }
611
+ return promise;
612
+ }
613
+ }
614
+ global.Scratch = global.Scratch || {};
615
+ global.Scratch.ArgumentType = ArgumentType;
616
+ global.Scratch.BlockType = BlockType;
617
+ global.Scratch.TargetType = TargetType;
618
+
619
+ /**
620
+ * Expose only specific parts of the worker to extensions.
621
+ */
622
+ const extensionWorker = new ExtensionWorker();
623
+ global.Scratch.extensions = {
624
+ register: extensionWorker.register.bind(extensionWorker)
625
+ };
626
+ /******/ return __webpack_exports__;
627
+ /******/ })()
628
+ ;
629
+ });
630
+ //# sourceMappingURL=extension-worker.js.map