Skip to content

Commit 2e5da7c

Browse files
Merge pull request #136 from pyscript/coincident-v4
Updated coincident to its latest v4
2 parents fa3e02c + b33717a commit 2e5da7c

16 files changed

+133
-130
lines changed

docs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/service-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import s from"https://cdn.jsdelivr.net/npm/sabayon/dist/polyfill.js";if(!globalThis.crossOriginIsolated){const{isArray:r}=Array,t=s=>s.length&&"object"==typeof s[0]&&null!==s[0];globalThis.Blob=class extends Blob{constructor(s,...e){t(e)&&"text/javascript"===e[0].type&&r(s)&&"string"==typeof s.at(0)&&(s[0]=s[0].replace(/^\/\*@\*\//,'import "https://cdn.jsdelivr.net/npm/sabayon/dist/polyfill.js";')),super(s,...e)}},globalThis.Worker=class extends Worker{constructor(r,...e){if(t(e)){const r=e[0].serviceWorker||e[0].service_worker;r&&s(r)}super(r,...e)}}}
1+

docs/toml-CkEFU7ly.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,3 @@ const parse = toml => {
100100
/* c8 ignore stop */
101101

102102
export { parse };
103-
//# sourceMappingURL=toml-CkEFU7ly.js.map

docs/toml-DiUM0_qs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/zip-CAMAhqMX.js

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/zip-CAMAhqMX.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esm/interpreter/_python.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as FLATTED from 'coincident/flatted';
2-
const JSON = { parse: FLATTED.decode, stringify: FLATTED.encode };
1+
import * as DIRECT from 'reflected-ffi/direct';
2+
const JSON = { parse: DIRECT.decode, stringify: DIRECT.encode };
33

44
import { fetchFiles, fetchJSModules, fetchPaths } from './_utils.js';
55
import { IDBMapSync, dedent } from '../utils.js';

esm/interpreter/webr.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
import { create } from 'gc-hook';
21
import { dedent } from '../utils.js';
32
import { fetchFiles, fetchJSModules, fetchPaths } from './_utils.js';
43
import { io, stdio } from './_io.js';
54

65
const type = 'webr';
76
const r = new WeakMap();
7+
const fr = new FinalizationRegistry(fn => fn());
88

99
// REQUIRES INTEGRATION TEST
1010
/* c8 ignore start */
1111
const run = async (interpreter, code) => {
1212
const { shelter, destroy, io } = r.get(interpreter);
1313
const { output, result } = await shelter.captureR(dedent(code));
1414
for (const { type, data } of output) io[type](data);
15-
// this is a double proxy but it's OK as the consumer
16-
// of the result here needs to invoke explicitly a conversion
17-
// or trust the `(await p.toJs()).values` returns what's expected.
18-
return create(result, destroy, { token: false });
15+
fr.register(result, destroy);
16+
return result;
1917
};
2018

2119
export default {

esm/service-worker.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
import sabayon from 'https://cdn.jsdelivr.net/npm/sabayon/dist/polyfill.js';
1+
// Let's avoid 404s *but* this should not be needed anymore*
22

3-
// ignore browsers that already support SharedArrayBuffer
4-
if (!globalThis.crossOriginIsolated) {
5-
const { isArray } = Array;
6-
const isOptions = args => args.length && typeof args[0] === 'object' && args[0] !== null;
3+
// import sabayon from 'https://cdn.jsdelivr.net/npm/sabayon/dist/polyfill.js';
74

8-
// early patch Blob to inject sabayon polyfill for service-worker
9-
globalThis.Blob = class extends Blob {
10-
constructor(blobParts, ...args) {
11-
if (
12-
isOptions(args) &&
13-
args[0].type === 'text/javascript' &&
14-
isArray(blobParts) &&
15-
typeof blobParts.at(0) === 'string'
16-
) {
17-
blobParts[0] = blobParts[0].replace(
18-
/^\/\*@\*\//,
19-
'import "https://cdn.jsdelivr.net/npm/sabayon/dist/polyfill.js";'
20-
);
21-
}
22-
super(blobParts, ...args);
23-
}
24-
};
5+
// // ignore browsers that already support SharedArrayBuffer
6+
// if (!globalThis.crossOriginIsolated) {
7+
// const { isArray } = Array;
8+
// const isOptions = args => args.length && typeof args[0] === 'object' && args[0] !== null;
259

26-
// early patch Worker to bootstrap sabayon for service-worker
27-
globalThis.Worker = class extends Worker {
28-
constructor(url, ...args) {
29-
if (isOptions(args)) {
30-
const sw = args[0].serviceWorker || args[0].service_worker;
31-
if (sw) sabayon(sw);
32-
}
33-
super(url, ...args);
34-
}
35-
};
36-
}
10+
// // early patch Blob to inject sabayon polyfill for service-worker
11+
// globalThis.Blob = class extends Blob {
12+
// constructor(blobParts, ...args) {
13+
// if (
14+
// isOptions(args) &&
15+
// args[0].type === 'text/javascript' &&
16+
// isArray(blobParts) &&
17+
// typeof blobParts.at(0) === 'string'
18+
// ) {
19+
// blobParts[0] = blobParts[0].replace(
20+
// /^\/\*@\*\//,
21+
// 'import "https://cdn.jsdelivr.net/npm/sabayon/dist/polyfill.js";'
22+
// );
23+
// }
24+
// super(blobParts, ...args);
25+
// }
26+
// };
27+
28+
// // early patch Worker to bootstrap sabayon for service-worker
29+
// globalThis.Worker = class extends Worker {
30+
// constructor(url, ...args) {
31+
// if (isOptions(args)) {
32+
// const sw = args[0].serviceWorker || args[0].service_worker;
33+
// if (sw) sabayon(sw);
34+
// }
35+
// super(url, ...args);
36+
// }
37+
// };
38+
// }

0 commit comments

Comments
 (0)