Skip to content

Commit 64e557a

Browse files
committed
Testing coincident with single payload
1 parent 7bdec25 commit 64e557a

12 files changed

+319
-152
lines changed

Diff for: docs/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/toml-CkEFU7ly.js

+103
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/toml-CkEFU7ly.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/zip-DPXsOtR5.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/zip-DXp-b1fY.js

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docs/zip-DXp-b1fY.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: esm/interpreter/_python.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import * as JSON from '@ungap/structured-clone/json';
1+
import * as FLATTED from '@webreflection/coincident/flatted';
2+
const JSON = { parse: FLATTED.decode, stringify: FLATTED.encode };
3+
24
import { fetchFiles, fetchJSModules, fetchPaths } from './_utils.js';
35
import { IDBMapSync, dedent } from '../utils.js';
46
import { io } from './_io.js';

Diff for: esm/worker/_template.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import IDBMap from '@webreflection/idb-map';
88
import IDBMapSync from '@webreflection/idb-map/sync';
99

10-
import * as JSON from '@ungap/structured-clone/json';
11-
import coincident from 'coincident/window/worker';
10+
import { decoder } from '@webreflection/coincident/flatted/decoder';
11+
import coincident from '@webreflection/coincident/window/worker';
1212

1313
import { assign, create, createFunction, createOverload, createResolved, dispatch, registerJSModules } from '../utils.js';
1414
import createJSModules from './js_modules.js';
@@ -33,21 +33,23 @@ const add = (type, fn) => {
3333
);
3434
};
3535

36-
const { parse, stringify } = JSON;
37-
38-
const { proxy: sync, sync: syncMainAndWorker, polyfill, window, isWindowProxy } = await coincident({
39-
parse,
40-
stringify,
36+
const {
37+
proxy: sync,
38+
native,
39+
window,
40+
isWindowProxy
41+
} = await coincident({
42+
decoder,
4143
transform: value => transform ? transform(value) : value
4244
});
4345

4446
const xworker = {
4547
// propagate the fact SharedArrayBuffer is polyfilled
46-
polyfill,
48+
polyfill: !native,
4749
// allows synchronous utilities between this worker and the main thread
4850
sync,
4951
// allow access to the main thread world whenever it's possible
50-
window: syncMainAndWorker ? window : null,
52+
window: native ? window : null,
5153
// allow introspection for foreign (main thread) refrences
5254
isWindowProxy,
5355
// standard worker related events / features
@@ -126,7 +128,7 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
126128
// there's no way to query the DOM, use foreign CustomEvent and so on
127129
// in case there's no SharedArrayBuffer around.
128130
let CustomEvent, document, notify, currentScript = null, target = '';
129-
if (syncMainAndWorker) {
131+
if (native) {
130132
({ CustomEvent, document } = window);
131133
currentScript = id && document.getElementById(id) || null;
132134
notify = kind => dispatch(currentScript, custom || type, kind, true, CustomEvent);
@@ -216,7 +218,7 @@ add('message', ({ data: { options, config: baseURL, configURL, code, hooks } })
216218
add('error');
217219
add('message');
218220
add('messageerror');
219-
if (syncMainAndWorker) {
221+
if (native) {
220222
addEventListener('py:progress', ({ type, detail }) => {
221223
window.dispatchEvent(new window.CustomEvent(type, { detail }));
222224
});

0 commit comments

Comments
 (0)