microdriver 0.0.1__py3-none-any.whl
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.
- microdriver/__init__.py +3 -0
- microdriver/public/bootstrap.js +11 -0
- microdriver/public/ffi/async-0Q0H4a_N.js +41 -0
- microdriver/public/ffi/async-CbwemiL2.js +41 -0
- microdriver/public/ffi/async-D6Zj6i_Q.js +44 -0
- microdriver/public/ffi/async-DLrN8K6M.js +44 -0
- microdriver/public/ffi/broadcast-CKNplfox.js +15 -0
- microdriver/public/ffi/broadcast-CbbtYobq.js +25 -0
- microdriver/public/ffi/broadcast-DIucqhL0.js +25 -0
- microdriver/public/ffi/broadcast-uydYnG6E.js +15 -0
- microdriver/public/ffi/global-DzpOeFX2.js +14 -0
- microdriver/public/ffi/global-LTfnrHcF.js +11 -0
- microdriver/public/ffi/i32-Cw-Rqr5y.js +13 -0
- microdriver/public/ffi/main.js +650 -0
- microdriver/public/ffi/message-2Dqj3uZ3.js +15 -0
- microdriver/public/ffi/message-Co0Oew7f.js +25 -0
- microdriver/public/ffi/message-Cxjrx_su.js +25 -0
- microdriver/public/ffi/message-mK0eTb54.js +15 -0
- microdriver/public/ffi/sender-B7Xmjz4q.js +194 -0
- microdriver/public/ffi/sender-C0gu9RzR.js +194 -0
- microdriver/public/ffi/shared-5Nhc4gvB.js +175 -0
- microdriver/public/ffi/shared-B3KmQkGh.js +425 -0
- microdriver/public/ffi/shared-CjWXp6-D.js +171 -0
- microdriver/public/ffi/shared-Czh3AlGt.js +53 -0
- microdriver/public/ffi/shared-DZdgWBc6.js +53 -0
- microdriver/public/ffi/shared-array-buffer-BQgQXQvC.js +28 -0
- microdriver/public/ffi/shared-ddawRQD0.js +425 -0
- microdriver/public/ffi/views-C3SJnvMr.js +48 -0
- microdriver/public/ffi/views-DBBYng9N.js +52 -0
- microdriver/public/ffi/worker.js +616 -0
- microdriver/public/ffi/xhr-Be-3qHQb.js +101 -0
- microdriver/public/ffi/xhr-CKhf21P8.js +41 -0
- microdriver/public/ffi/xhr-CRJGE1xP.js +41 -0
- microdriver/public/ffi/xhr-DSsSGsb-.js +101 -0
- microdriver/public/index.html +10 -0
- microdriver/public/main.py +20 -0
- microdriver/public/mpy/flatted_view/__init__.py +4 -0
- microdriver/public/mpy/flatted_view/constants.py +41 -0
- microdriver/public/mpy/flatted_view/decode.py +195 -0
- microdriver/public/mpy/flatted_view/encode.py +250 -0
- microdriver/public/mpy/micropython.mjs +1 -0
- microdriver/public/mpy/micropython.wasm +0 -0
- microdriver/public/mpy/reflected_ffi/__init__.py +2 -0
- microdriver/public/mpy/reflected_ffi/local.py +145 -0
- microdriver/public/mpy/reflected_ffi/remote.py +151 -0
- microdriver/public/mpy/reflected_ffi/types.py +4 -0
- microdriver/public/sw.js +155 -0
- microdriver/public/worker.js +120 -0
- microdriver/server/__init__.py +118 -0
- microdriver-0.0.1.dist-info/METADATA +39 -0
- microdriver-0.0.1.dist-info/RECORD +53 -0
- microdriver-0.0.1.dist-info/WHEEL +5 -0
- microdriver-0.0.1.dist-info/top_level.txt +1 -0
microdriver/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import reflected from '/@microdriver/ffi/main.js';
|
|
2
|
+
|
|
3
|
+
const main = document.querySelector('script[src="/@microdriver/bootstrap.js"]').getAttribute('micropython') || '/main.py';
|
|
4
|
+
const { href } = new URL(main, location.href);
|
|
5
|
+
const worker = new URL('/@microdriver/worker.js', location.href);
|
|
6
|
+
worker.searchParams.set('micropython', href);
|
|
7
|
+
|
|
8
|
+
reflected(worker.href, {
|
|
9
|
+
ws: `${location.protocol.replace(/^http/, 'ws')}//${location.host}`,
|
|
10
|
+
serviceWorker: '/sw.js'
|
|
11
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { w as withResolvers, r as byteOffset, s as identity } from './shared-CjWXp6-D.js';
|
|
2
|
+
import { s as sender, d as decoder } from './sender-C0gu9RzR.js';
|
|
3
|
+
import { i as i32 } from './i32-Cw-Rqr5y.js';
|
|
4
|
+
import './views-DBBYng9N.js';
|
|
5
|
+
|
|
6
|
+
const { promise, resolve } = withResolvers();
|
|
7
|
+
|
|
8
|
+
addEventListener(
|
|
9
|
+
'message',
|
|
10
|
+
({ data: [_, main, channel] }) => resolve([main, channel]),
|
|
11
|
+
{ once: true }
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const channel = 'async';
|
|
15
|
+
|
|
16
|
+
const handle = (channel, options) => {
|
|
17
|
+
const bc = new BroadcastChannel(channel);
|
|
18
|
+
const next = i32();
|
|
19
|
+
const decode = (options.decoder ?? decoder)({ byteOffset });
|
|
20
|
+
const onsync = options.onsync ?? identity;
|
|
21
|
+
const map = new Map;
|
|
22
|
+
bc.addEventListener('message', ({ data: [id, { length, buffer }] }) => {
|
|
23
|
+
map.get(id)(onsync(length ? decode(length, buffer) : void 0));
|
|
24
|
+
map.delete(id);
|
|
25
|
+
});
|
|
26
|
+
return (payload, ...rest) => {
|
|
27
|
+
const { promise, resolve } = withResolvers();
|
|
28
|
+
const id = next();
|
|
29
|
+
map.set(id, resolve);
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
bc.postMessage([id, payload], ...rest);
|
|
32
|
+
return promise;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var async = options => promise.then(([main, channel]) => {
|
|
37
|
+
postMessage(1);
|
|
38
|
+
return handle(channel, sender({ ...main, ...options }));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { channel, async as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { w as withResolvers, s as byteOffset, u as identity } from './shared-5Nhc4gvB.js';
|
|
2
|
+
import { s as sender, d as decoder } from './sender-B7Xmjz4q.js';
|
|
3
|
+
import { i as i32 } from './i32-Cw-Rqr5y.js';
|
|
4
|
+
import './views-C3SJnvMr.js';
|
|
5
|
+
|
|
6
|
+
const { promise, resolve } = withResolvers();
|
|
7
|
+
|
|
8
|
+
addEventListener(
|
|
9
|
+
'message',
|
|
10
|
+
({ data: [_, main, channel] }) => resolve([main, channel]),
|
|
11
|
+
{ once: true }
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const channel = 'async';
|
|
15
|
+
|
|
16
|
+
const handle = (channel, options) => {
|
|
17
|
+
const bc = new BroadcastChannel(channel);
|
|
18
|
+
const next = i32();
|
|
19
|
+
const decode = (options.decoder ?? decoder)({ byteOffset });
|
|
20
|
+
const onsync = options.onsync ?? identity;
|
|
21
|
+
const map = new Map;
|
|
22
|
+
bc.addEventListener('message', ({ data: [id, { length, buffer }] }) => {
|
|
23
|
+
map.get(id)(onsync(length ? decode(length, buffer) : void 0));
|
|
24
|
+
map.delete(id);
|
|
25
|
+
});
|
|
26
|
+
return (payload, ...rest) => {
|
|
27
|
+
const { promise, resolve } = withResolvers();
|
|
28
|
+
const id = next();
|
|
29
|
+
map.set(id, resolve);
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
bc.postMessage([id, payload], ...rest);
|
|
32
|
+
return promise;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var async = options => promise.then(([main, channel]) => {
|
|
37
|
+
postMessage(1);
|
|
38
|
+
return handle(channel, sender({ ...main, ...options }));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { channel, async as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { b as bootstrap, S as Sender, h as handler, u as url, p as post } from './shared-ddawRQD0.js';
|
|
2
|
+
import { S as SAB$1 } from './shared-array-buffer-BQgQXQvC.js';
|
|
3
|
+
import { s as byteOffset, x as randomUUID } from './shared-5Nhc4gvB.js';
|
|
4
|
+
|
|
5
|
+
var SAB = ({
|
|
6
|
+
initByteLength = 1024,
|
|
7
|
+
maxByteLength = (1024 * 8)
|
|
8
|
+
}) =>
|
|
9
|
+
new SAB$1(
|
|
10
|
+
byteOffset + initByteLength,
|
|
11
|
+
{ maxByteLength: byteOffset + maxByteLength }
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const CHANNEL = 'async';
|
|
15
|
+
|
|
16
|
+
let Worker$1 = class Worker extends Sender {
|
|
17
|
+
constructor(scriptURL, options, resolve) {
|
|
18
|
+
const channel = randomUUID();
|
|
19
|
+
const bc = new BroadcastChannel(channel);
|
|
20
|
+
const sab = SAB(options);
|
|
21
|
+
const i32a = new Int32Array(sab);
|
|
22
|
+
const handle = handler(sab, options, false);
|
|
23
|
+
bc.addEventListener('message', async ({ data: [id, payload] }) => {
|
|
24
|
+
await handle({ data: payload });
|
|
25
|
+
bc.postMessage([id, new Uint8Array(sab, byteOffset, i32a[1])]);
|
|
26
|
+
});
|
|
27
|
+
super(...url(scriptURL, CHANNEL, options));
|
|
28
|
+
super.addEventListener('message', () => resolve(this), { once: true });
|
|
29
|
+
super.postMessage(post(sab, options).concat(channel));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get channel() {
|
|
33
|
+
return CHANNEL;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var async = bootstrap(Worker$1);
|
|
37
|
+
|
|
38
|
+
var async$1 = /*#__PURE__*/Object.freeze({
|
|
39
|
+
__proto__: null,
|
|
40
|
+
Worker: Worker$1,
|
|
41
|
+
default: async
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { SAB as S, Worker$1 as W, async$1 as a };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { b as bootstrap, S as Sender, h as handler, u as url, p as post } from './shared-B3KmQkGh.js';
|
|
2
|
+
import { S as SAB$1 } from './shared-array-buffer-BQgQXQvC.js';
|
|
3
|
+
import { r as byteOffset, v as randomUUID } from './shared-CjWXp6-D.js';
|
|
4
|
+
|
|
5
|
+
var SAB = ({
|
|
6
|
+
initByteLength = 1024,
|
|
7
|
+
maxByteLength = (1024 * 8)
|
|
8
|
+
}) =>
|
|
9
|
+
new SAB$1(
|
|
10
|
+
byteOffset + initByteLength,
|
|
11
|
+
{ maxByteLength: byteOffset + maxByteLength }
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const CHANNEL = 'async';
|
|
15
|
+
|
|
16
|
+
let Worker$1 = class Worker extends Sender {
|
|
17
|
+
constructor(scriptURL, options, resolve) {
|
|
18
|
+
const channel = randomUUID();
|
|
19
|
+
const bc = new BroadcastChannel(channel);
|
|
20
|
+
const sab = SAB(options);
|
|
21
|
+
const i32a = new Int32Array(sab);
|
|
22
|
+
const handle = handler(sab, options, false);
|
|
23
|
+
bc.addEventListener('message', async ({ data: [id, payload] }) => {
|
|
24
|
+
await handle({ data: payload });
|
|
25
|
+
bc.postMessage([id, new Uint8Array(sab, byteOffset, i32a[1])]);
|
|
26
|
+
});
|
|
27
|
+
super(...url(scriptURL, CHANNEL, options));
|
|
28
|
+
super.addEventListener('message', () => resolve(this), { once: true });
|
|
29
|
+
super.postMessage(post(sab, options).concat(channel));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get channel() {
|
|
33
|
+
return CHANNEL;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var async = bootstrap(Worker$1);
|
|
37
|
+
|
|
38
|
+
var async$1 = /*#__PURE__*/Object.freeze({
|
|
39
|
+
__proto__: null,
|
|
40
|
+
Worker: Worker$1,
|
|
41
|
+
default: async
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { SAB as S, Worker$1 as W, async$1 as a };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { w as withResolvers } from './shared-CjWXp6-D.js';
|
|
2
|
+
import { h as handler } from './shared-Czh3AlGt.js';
|
|
3
|
+
import './sender-C0gu9RzR.js';
|
|
4
|
+
import './views-DBBYng9N.js';
|
|
5
|
+
|
|
6
|
+
const { promise, resolve } = withResolvers();
|
|
7
|
+
|
|
8
|
+
const channel = 'broadcast';
|
|
9
|
+
|
|
10
|
+
var broadcast = handler(
|
|
11
|
+
promise,
|
|
12
|
+
({ data: [sab, main, channel] }) => resolve([sab, main, new BroadcastChannel(channel)]),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export { channel, broadcast as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { b as bootstrap, S as Sender, a as SAB, h as handler, u as url, p as post } from './shared-B3KmQkGh.js';
|
|
2
|
+
import { v as randomUUID } from './shared-CjWXp6-D.js';
|
|
3
|
+
import './i32-Cw-Rqr5y.js';
|
|
4
|
+
import './views-DBBYng9N.js';
|
|
5
|
+
import './global-DzpOeFX2.js';
|
|
6
|
+
|
|
7
|
+
const CHANNEL = 'broadcast';
|
|
8
|
+
|
|
9
|
+
var broadcast = bootstrap(class Worker extends Sender {
|
|
10
|
+
constructor(scriptURL, options, resolve) {
|
|
11
|
+
const channel = randomUUID();
|
|
12
|
+
const bc = new BroadcastChannel(channel);
|
|
13
|
+
const sab = SAB(options);
|
|
14
|
+
bc.addEventListener('message', handler(sab, options, true));
|
|
15
|
+
super(...url(scriptURL, CHANNEL, options));
|
|
16
|
+
super.addEventListener('message', () => resolve(this), { once: true });
|
|
17
|
+
super.postMessage(post(sab, options).concat(channel));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get channel() {
|
|
21
|
+
return CHANNEL;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export { broadcast as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { b as bootstrap, S as Sender, a as SAB, h as handler, u as url, p as post } from './shared-ddawRQD0.js';
|
|
2
|
+
import { x as randomUUID } from './shared-5Nhc4gvB.js';
|
|
3
|
+
import './i32-Cw-Rqr5y.js';
|
|
4
|
+
import './views-C3SJnvMr.js';
|
|
5
|
+
import './global-LTfnrHcF.js';
|
|
6
|
+
|
|
7
|
+
const CHANNEL = 'broadcast';
|
|
8
|
+
|
|
9
|
+
var broadcast = bootstrap(class Worker extends Sender {
|
|
10
|
+
constructor(scriptURL, options, resolve) {
|
|
11
|
+
const channel = randomUUID();
|
|
12
|
+
const bc = new BroadcastChannel(channel);
|
|
13
|
+
const sab = SAB(options);
|
|
14
|
+
bc.addEventListener('message', handler(sab, options, true));
|
|
15
|
+
super(...url(scriptURL, CHANNEL, options));
|
|
16
|
+
super.addEventListener('message', () => resolve(this), { once: true });
|
|
17
|
+
super.postMessage(post(sab, options).concat(channel));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get channel() {
|
|
21
|
+
return CHANNEL;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export { broadcast as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { w as withResolvers } from './shared-5Nhc4gvB.js';
|
|
2
|
+
import { h as handler } from './shared-DZdgWBc6.js';
|
|
3
|
+
import './sender-B7Xmjz4q.js';
|
|
4
|
+
import './views-C3SJnvMr.js';
|
|
5
|
+
|
|
6
|
+
const { promise, resolve } = withResolvers();
|
|
7
|
+
|
|
8
|
+
const channel = 'broadcast';
|
|
9
|
+
|
|
10
|
+
var broadcast = handler(
|
|
11
|
+
promise,
|
|
12
|
+
({ data: [sab, main, channel] }) => resolve([sab, main, new BroadcastChannel(channel)]),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export { channel, broadcast as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { o as object } from './shared-CjWXp6-D.js';
|
|
2
|
+
|
|
3
|
+
const { getPrototypeOf } = Object;
|
|
4
|
+
const { construct } = Reflect;
|
|
5
|
+
const { toStringTag } = Symbol;
|
|
6
|
+
const { toString } = object;
|
|
7
|
+
|
|
8
|
+
const toName = (ref, name = toString.call(ref).slice(8, -1)) =>
|
|
9
|
+
name in globalThis ? name : toName(getPrototypeOf(ref) || object);
|
|
10
|
+
|
|
11
|
+
const toTag = (ref, name = ref[toStringTag]) =>
|
|
12
|
+
name in globalThis ? name : toTag(construct(getPrototypeOf(ref.constructor),[0]));
|
|
13
|
+
|
|
14
|
+
export { toTag as a, toName as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { o as object } from './shared-5Nhc4gvB.js';
|
|
2
|
+
|
|
3
|
+
const { getPrototypeOf } = Object;
|
|
4
|
+
const { construct } = Reflect;
|
|
5
|
+
const { toStringTag } = Symbol;
|
|
6
|
+
const { toString } = object;
|
|
7
|
+
|
|
8
|
+
const toTag = (ref, name = ref[toStringTag]) =>
|
|
9
|
+
name in globalThis ? name : toTag(construct(getPrototypeOf(ref.constructor),[0]));
|
|
10
|
+
|
|
11
|
+
export { toTag as t };
|