Merge branch 'main' into poc_ui_blocks

This commit is contained in:
Andrea Giammarchi
2024-02-14 15:51:22 +01:00
committed by GitHub
15 changed files with 360 additions and 148 deletions

View File

@@ -11,7 +11,9 @@ body:
There will always be more issues than there is time to do them, and so we will need to selectively close issues that don't provide enough information, so we can focus our time on helping people like you who fill out the issue form completely. Thank you for your collaboration! There will always be more issues than there is time to do them, and so we will need to selectively close issues that don't provide enough information, so we can focus our time on helping people like you who fill out the issue form completely. Thank you for your collaboration!
There are also already a lot of open issues, so please take 2 minutes and search through existing ones to see if what you are experiencing already exists There are also already a lot of open issues, so please take 2 minutes and search through existing ones to see if what you are experiencing already exists.
Finally, if you are opening **a bug report related to PyScript.com** please [use this repository instead](https://github.com/anaconda/pyscript-dot-com-issues/issues/new/choose).
Thanks for helping PyScript be amazing. We are nothing without people like you helping build a better community 💐! Thanks for helping PyScript be amazing. We are nothing without people like you helping build a better community 💐!
- type: checkboxes - type: checkboxes

View File

@@ -25,7 +25,7 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.11.0 rev: 24.1.1
hooks: hooks:
- id: black - id: black
exclude: pyscript\.core/src/stdlib/pyscript/__init__\.py exclude: pyscript\.core/src/stdlib/pyscript/__init__\.py
@@ -46,7 +46,7 @@ repos:
args: [--tab-width, "4"] args: [--tab-width, "4"]
- repo: https://github.com/pycqa/isort - repo: https://github.com/pycqa/isort
rev: 5.12.0 rev: 5.13.2
hooks: hooks:
- id: isort - id: isort
name: isort (python) name: isort (python)

View File

@@ -79,3 +79,103 @@ The Project abides by the Organization's [trademark policy](https://github.com/p
Part of MVG-0.1-beta. Part of MVG-0.1-beta.
Made with love by GitHub. Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/). Made with love by GitHub. Licensed under the [CC-BY 4.0 License](https://creativecommons.org/licenses/by-sa/4.0/).
# Quick guide to pytest
We make heavy usage of pytest. Here is a quick guide and collection of useful options:
- To run all tests in the current directory and subdirectories: pytest
- To run tests in a specific directory or file: pytest path/to/dir/test_foo.py
- -s: disables output capturing
- --pdb: in case of exception, enter a (Pdb) prompt so that you can inspect what went wrong.
- -v: verbose mode
- -x: stop the execution as soon as one test fails
- -k foo: run only the tests whose full name contains foo
- -k 'foo and bar'
- -k 'foo and not bar'
## Running integration tests under pytest
make test is useful to run all the tests, but during the development is useful to have more control on how tests are run. The following guide assumes that you are in the directory pyscriptjs/tests/integration/.
### To run all the integration tests, single or multi core
$ pytest -xv
...
test_00_support.py::TestSupport::test_basic[chromium] PASSED [ 0%]
test_00_support.py::TestSupport::test_console[chromium] PASSED [ 1%]
test_00_support.py::TestSupport::test_check_js_errors_simple[chromium] PASSED [ 2%]
test_00_support.py::TestSupport::test_check_js_errors_expected[chromium] PASSED [ 3%]
test_00_support.py::TestSupport::test_check_js_errors_expected_but_didnt_raise[chromium] PASSED [ 4%]
test_00_support.py::TestSupport::test_check_js_errors_multiple[chromium] PASSED [ 5%]
...
-x means "stop at the first failure". -v means "verbose", so that you can see all the test names one by one. We try to keep tests in a reasonable order, from most basic to most complex. This way, if you introduced some bug in very basic things, you will notice immediately.
If you have the pytest-xdist plugin installed, you can run all the integration tests on 4 cores in parallel:
$ pytest -n 4
### To run a single test, headless
$ pytest test_01_basic.py -k test_pyscript_hello -s
...
[ 0.00 page.goto ] pyscript_hello.html
[ 0.01 request ] 200 - fake_server - http://fake_server/pyscript_hello.html
...
[ 0.17 console.info ] [py-loader] Downloading pyodide-x.y.z...
[ 0.18 request ] 200 - CACHED - https://cdn.jsdelivr.net/pyodide/vx.y.z/full/pyodide.js
...
[ 3.59 console.info ] [pyscript/main] PyScript page fully initialized
[ 3.60 console.log ] hello pyscript
-k selects tests by pattern matching as described above. -s instructs pytest to show the output to the terminal instead of capturing it. In the output you can see various useful things, including network requests and JS console messages.
### To run a single test, headed
$ pytest test_01_basic.py -k test_pyscript_hello -s --headed
...
Same as above, but with --headed the browser is shown in a window, and you can interact with it. The browser uses a fake server, which means that HTTP requests are cached.
Unfortunately, in this mode source maps does not seem to work, and you cannot debug the original typescript source code. This seems to be a bug in playwright, for which we have a workaround:
$ pytest test_01_basic.py -k test_pyscript_hello -s --headed --no-fake-server
...
As the name implies, -no-fake-server disables the fake server: HTTP requests are not cached, but source-level debugging works.
Finally:
$ pytest test_01_basic.py -k test_pyscript_hello -s --dev
...
--dev implies --headed --no-fake-server. In addition, it also automatically open chrome dev tools.
### To run only main thread or worker tests
By default, we run each test twice: one with execution_thread = "main" and one with execution_thread = "worker". If you want to run only half of them, you can use -m:
$ pytest -m main # run only the tests in the main thread
$ pytest -m worker # ron only the tests in the web worker
## Fake server, HTTP cache
By default, our test machinery uses a playwright router which intercepts and cache HTTP requests, so that for example you don't have to download pyodide again and again. This also enables the possibility of running tests in parallel on multiple cores.
The cache is stored using the pytest-cache plugin, which means that it survives across sessions.
If you want to temporarily disable the cache, the easiest thing is to use --no-fake-server, which bypasses it completely.
If you want to clear the cache, you can use the special option --clear-http-cache:
NOTE: this works only if you are inside tests/integration, or if you explicitly specify tests/integration from the command line. This is due to how pytest decides to search for and load the various conftest.py.

View File

@@ -1,37 +1,37 @@
{ {
"name": "@pyscript/core", "name": "@pyscript/core",
"version": "0.3.23", "version": "0.4.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pyscript/core", "name": "@pyscript/core",
"version": "0.3.23", "version": "0.4.4",
"license": "APACHE-2.0", "license": "APACHE-2.0",
"dependencies": { "dependencies": {
"@ungap/with-resolvers": "^0.1.0", "@ungap/with-resolvers": "^0.1.0",
"basic-devtools": "^0.1.6", "basic-devtools": "^0.1.6",
"polyscript": "^0.6.18", "polyscript": "^0.8.1",
"sticky-module": "^0.1.1", "sticky-module": "^0.1.1",
"to-json-callback": "^0.1.1", "to-json-callback": "^0.1.1",
"type-checked-collections": "^0.1.7" "type-checked-collections": "^0.1.7"
}, },
"devDependencies": { "devDependencies": {
"@codemirror/commands": "^6.3.3", "@codemirror/commands": "^6.3.3",
"@codemirror/lang-python": "^6.1.3", "@codemirror/lang-python": "^6.1.4",
"@codemirror/language": "^6.10.0", "@codemirror/language": "^6.10.1",
"@codemirror/state": "^6.4.0", "@codemirror/state": "^6.4.0",
"@codemirror/view": "^6.23.1", "@codemirror/view": "^6.24.0",
"@playwright/test": "^1.41.1", "@playwright/test": "^1.41.2",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-terser": "^0.4.4",
"@webreflection/toml-j0.4": "^1.1.3", "@webreflection/toml-j0.4": "^1.1.3",
"@xterm/addon-fit": "^0.9.0-beta.1", "@xterm/addon-fit": "^0.9.0-beta.1",
"chokidar": "^3.5.3", "chokidar": "^3.6.0",
"codemirror": "^6.0.1", "codemirror": "^6.0.1",
"eslint": "^8.56.0", "eslint": "^8.56.0",
"rollup": "^4.9.6", "rollup": "^4.10.0",
"rollup-plugin-postcss": "^4.0.2", "rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-string": "^3.0.0", "rollup-plugin-string": "^3.0.0",
"static-handler": "^0.4.3", "static-handler": "^0.4.3",
@@ -80,20 +80,22 @@
} }
}, },
"node_modules/@codemirror/lang-python": { "node_modules/@codemirror/lang-python": {
"version": "6.1.3", "version": "6.1.4",
"resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.1.3.tgz", "resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.1.4.tgz",
"integrity": "sha512-S9w2Jl74hFlD5nqtUMIaXAq9t5WlM0acCkyuQWUUSvZclk1sV+UfnpFiZzuZSG+hfEaOmxKR5UxY/Uxswn7EhQ==", "integrity": "sha512-b6d1TDqrkCjFNvMO01SWldFiDoZ39yl3tDMC1Y5f8glA2eZpynPxJhwYVTlGFr0stizcJgrp6ojLEGH2myoZAw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@codemirror/autocomplete": "^6.3.2", "@codemirror/autocomplete": "^6.3.2",
"@codemirror/language": "^6.8.0", "@codemirror/language": "^6.8.0",
"@codemirror/state": "^6.0.0",
"@lezer/common": "^1.2.1",
"@lezer/python": "^1.1.4" "@lezer/python": "^1.1.4"
} }
}, },
"node_modules/@codemirror/language": { "node_modules/@codemirror/language": {
"version": "6.10.0", "version": "6.10.1",
"resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.10.0.tgz", "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.10.1.tgz",
"integrity": "sha512-2vaNn9aPGCRFKWcHPFksctzJ8yS5p7YoaT+jHpc0UGKzNuAIx4qy6R5wiqbP+heEEdyaABA582mNqSHzSoYdmg==", "integrity": "sha512-5GrXzrhq6k+gL5fjkAwt90nYDmjlzTIJV8THnxNFtNKWotMIlzzN+CpqxqwXOECnUdOndmSeWntVrVcv5axWRQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@codemirror/state": "^6.0.0", "@codemirror/state": "^6.0.0",
@@ -133,9 +135,9 @@
"dev": true "dev": true
}, },
"node_modules/@codemirror/view": { "node_modules/@codemirror/view": {
"version": "6.23.1", "version": "6.24.0",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.23.1.tgz", "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.24.0.tgz",
"integrity": "sha512-J2Xnn5lFYT1ZN/5ewEoMBCmLlL71lZ3mBdb7cUEuHhX2ESoSrNEucpsDXpX22EuTGm9LOgC9v4Z0wx+Ez8QmGA==", "integrity": "sha512-zK6m5pNkdhdJl8idPP1gA4N8JKTiSsOz8U/Iw+C1ChMwyLG7+MLiNXnH/wFuAk6KeGEe33/adOiAh5jMqee03w==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@codemirror/state": "^6.4.0", "@codemirror/state": "^6.4.0",
@@ -361,12 +363,12 @@
} }
}, },
"node_modules/@playwright/test": { "node_modules/@playwright/test": {
"version": "1.41.1", "version": "1.41.2",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.41.1.tgz", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.41.2.tgz",
"integrity": "sha512-9g8EWTjiQ9yFBXc6HjCWe41msLpxEX0KhmfmPl9RPLJdfzL4F0lg2BdJ91O9azFdl11y1pmpwdjBiSxvqc+btw==", "integrity": "sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"playwright": "1.41.1" "playwright": "1.41.2"
}, },
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
@@ -470,9 +472,9 @@
} }
}, },
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.10.0.tgz",
"integrity": "sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==", "integrity": "sha512-/MeDQmcD96nVoRumKUljsYOLqfv1YFJps+0pTrb2Z9Nl/w5qNUysMaWQsrd1mvAlNT4yza1iVyIu4Q4AgF6V3A==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -483,9 +485,9 @@
] ]
}, },
"node_modules/@rollup/rollup-android-arm64": { "node_modules/@rollup/rollup-android-arm64": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.10.0.tgz",
"integrity": "sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==", "integrity": "sha512-lvu0jK97mZDJdpZKDnZI93I0Om8lSDaiPx3OiCk0RXn3E8CMPJNS/wxjAvSJJzhhZpfjXsjLWL8LnS6qET4VNQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -496,9 +498,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-arm64": { "node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.10.0.tgz",
"integrity": "sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==", "integrity": "sha512-uFpayx8I8tyOvDkD7X6n0PriDRWxcqEjqgtlxnUA/G9oS93ur9aZ8c8BEpzFmsed1TH5WZNG5IONB8IiW90TQg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -509,9 +511,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-x64": { "node_modules/@rollup/rollup-darwin-x64": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.10.0.tgz",
"integrity": "sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==", "integrity": "sha512-nIdCX03qFKoR/MwQegQBK+qZoSpO3LESurVAC6s6jazLA1Mpmgzo3Nj3H1vydXp/JM29bkCiuF7tDuToj4+U9Q==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -522,9 +524,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-gnueabihf": { "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.10.0.tgz",
"integrity": "sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==", "integrity": "sha512-Fz7a+y5sYhYZMQFRkOyCs4PLhICAnxRX/GnWYReaAoruUzuRtcf+Qnw+T0CoAWbHCuz2gBUwmWnUgQ67fb3FYw==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -535,9 +537,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-gnu": { "node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.10.0.tgz",
"integrity": "sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==", "integrity": "sha512-yPtF9jIix88orwfTi0lJiqINnlWo6p93MtZEoaehZnmCzEmLL0eqjA3eGVeyQhMtxdV+Mlsgfwhh0+M/k1/V7Q==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -548,9 +550,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-musl": { "node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.10.0.tgz",
"integrity": "sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==", "integrity": "sha512-9GW9yA30ib+vfFiwjX+N7PnjTnCMiUffhWj4vkG4ukYv1kJ4T9gHNg8zw+ChsOccM27G9yXrEtMScf1LaCuoWQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -561,9 +563,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-riscv64-gnu": { "node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.10.0.tgz",
"integrity": "sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==", "integrity": "sha512-X1ES+V4bMq2ws5fF4zHornxebNxMXye0ZZjUrzOrf7UMx1d6wMQtfcchZ8SqUnQPPHdOyOLW6fTcUiFgHFadRA==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@@ -574,9 +576,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.10.0.tgz",
"integrity": "sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==", "integrity": "sha512-w/5OpT2EnI/Xvypw4FIhV34jmNqU5PZjZue2l2Y3ty1Ootm3SqhI+AmfhlUYGBTd9JnpneZCDnt3uNOiOBkMyw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -587,9 +589,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-musl": { "node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.10.0.tgz",
"integrity": "sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==", "integrity": "sha512-q/meftEe3QlwQiGYxD9rWwB21DoKQ9Q8wA40of/of6yGHhZuGfZO0c3WYkN9dNlopHlNT3mf5BPsUSxoPuVQaw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -600,9 +602,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-arm64-msvc": { "node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.10.0.tgz",
"integrity": "sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==", "integrity": "sha512-NrR6667wlUfP0BHaEIKgYM/2va+Oj+RjZSASbBMnszM9k+1AmliRjHc3lJIiOehtSSjqYiO7R6KLNrWOX+YNSQ==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -613,9 +615,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-ia32-msvc": { "node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.10.0.tgz",
"integrity": "sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==", "integrity": "sha512-FV0Tpt84LPYDduIDcXvEC7HKtyXxdvhdAOvOeWMWbQNulxViH2O07QXkT/FffX4FqEI02jEbCJbr+YcuKdyyMg==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -626,9 +628,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-msvc": { "node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.6.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.10.0.tgz",
"integrity": "sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==", "integrity": "sha512-OZoJd+o5TaTSQeFFQ6WjFCiltiYVjIdsXxwu/XZ8qRpsvMQr4UsVrE5UyT9RIvsnuF47DqkJKhhVZ2Q9YW9IpQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -920,16 +922,10 @@
} }
}, },
"node_modules/chokidar": { "node_modules/chokidar": {
"version": "3.5.3", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
"dev": true, "dev": true,
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"dependencies": { "dependencies": {
"anymatch": "~3.1.2", "anymatch": "~3.1.2",
"braces": "~3.0.2", "braces": "~3.0.2",
@@ -942,6 +938,9 @@
"engines": { "engines": {
"node": ">= 8.10.0" "node": ">= 8.10.0"
}, },
"funding": {
"url": "https://paulmillr.com/funding/"
},
"optionalDependencies": { "optionalDependencies": {
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
@@ -970,13 +969,13 @@
} }
}, },
"node_modules/coincident": { "node_modules/coincident": {
"version": "1.1.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/coincident/-/coincident-1.1.1.tgz", "resolved": "https://registry.npmjs.org/coincident/-/coincident-1.2.1.tgz",
"integrity": "sha512-4i6bejrHuY6aOY8uhq56g/psUK2k99y5hImpavQz7yfPNCXuJkmtRYpvBOguC0mdYXPgQjvoz+Odw/WO6q4okg==", "integrity": "sha512-OXlCJBtBC278tNueIEyc5I9dvh9qOOZh1YPUbSRFI+i0AK4ELT/Io67qUv3uPmemW6dPHNmTdr/WKmkmnuBU5g==",
"dependencies": { "dependencies": {
"@ungap/structured-clone": "^1.2.0", "@ungap/structured-clone": "^1.2.0",
"@ungap/with-resolvers": "^0.1.0", "@ungap/with-resolvers": "^0.1.0",
"gc-hook": "^0.3.0", "gc-hook": "^0.3.1",
"proxy-target": "^3.0.1" "proxy-target": "^3.0.1"
}, },
"optionalDependencies": { "optionalDependencies": {
@@ -1634,9 +1633,9 @@
} }
}, },
"node_modules/gc-hook": { "node_modules/gc-hook": {
"version": "0.3.0", "version": "0.3.1",
"resolved": "https://registry.npmjs.org/gc-hook/-/gc-hook-0.3.0.tgz", "resolved": "https://registry.npmjs.org/gc-hook/-/gc-hook-0.3.1.tgz",
"integrity": "sha512-Qkp0HM3z839Ns0LpXFJBXqClNW23wQo6JpUdJAjuf1/2jB+oUWSOMzeMv2yFq8Ur45z8IWw9hpRhkSjxSt5RWg==" "integrity": "sha512-E5M+O/h2o7eZzGhzRZGex6hbB3k4NWqO0eA+OzLRLXxhdbYPajZnynPwAtphnh+cRHPwsj5Z80dqZlfI4eK55A=="
}, },
"node_modules/generic-names": { "node_modules/generic-names": {
"version": "4.0.0", "version": "4.0.0",
@@ -2359,12 +2358,12 @@
"integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA==" "integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA=="
}, },
"node_modules/playwright": { "node_modules/playwright": {
"version": "1.41.1", "version": "1.41.2",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.41.1.tgz", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.41.2.tgz",
"integrity": "sha512-gdZAWG97oUnbBdRL3GuBvX3nDDmUOuqzV/D24dytqlKt+eI5KbwusluZRGljx1YoJKZ2NRPaeWiFTeGZO7SosQ==", "integrity": "sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"playwright-core": "1.41.1" "playwright-core": "1.41.2"
}, },
"bin": { "bin": {
"playwright": "cli.js" "playwright": "cli.js"
@@ -2377,9 +2376,9 @@
} }
}, },
"node_modules/playwright-core": { "node_modules/playwright-core": {
"version": "1.41.1", "version": "1.41.2",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.41.1.tgz", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.41.2.tgz",
"integrity": "sha512-/KPO5DzXSMlxSX77wy+HihKGOunh3hqndhqeo/nMxfigiKzogn8kfL0ZBDu0L1RKgan5XHCPmn6zXd2NUJgjhg==", "integrity": "sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==",
"dev": true, "dev": true,
"bin": { "bin": {
"playwright-core": "cli.js" "playwright-core": "cli.js"
@@ -2403,16 +2402,16 @@
} }
}, },
"node_modules/polyscript": { "node_modules/polyscript": {
"version": "0.6.18", "version": "0.8.1",
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.6.18.tgz", "resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.8.1.tgz",
"integrity": "sha512-naU5tisWCt/a12kl1lIdtphaGUCEDf4mmlzuOcvjayqkmfXUlxLdc9A5VEEZLcleWr5Wtx34aU9IBBG8hfSI6Q==", "integrity": "sha512-ziLElKhO+NE233aNVb7Kcjbd1a3X7XMEjxLh8aUXFr9NZ9Al16zD6A0Q6XFX/m4GS2Jn69bWIeOGGeGMF6C+uA==",
"dependencies": { "dependencies": {
"@ungap/structured-clone": "^1.2.0", "@ungap/structured-clone": "^1.2.0",
"@ungap/with-resolvers": "^0.1.0", "@ungap/with-resolvers": "^0.1.0",
"basic-devtools": "^0.1.6", "basic-devtools": "^0.1.6",
"codedent": "^0.1.2", "codedent": "^0.1.2",
"coincident": "^1.1.1", "coincident": "^1.2.1",
"gc-hook": "^0.3.0", "gc-hook": "^0.3.1",
"html-escaper": "^3.0.3", "html-escaper": "^3.0.3",
"proxy-target": "^3.0.1", "proxy-target": "^3.0.1",
"sticky-module": "^0.1.1", "sticky-module": "^0.1.1",
@@ -3124,9 +3123,9 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.9.6", "version": "4.10.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.6.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.10.0.tgz",
"integrity": "sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==", "integrity": "sha512-t2v9G2AKxcQ8yrG+WGxctBes1AomT0M4ND7jTFBCVPXQ/WFTvNSefIrNSmLKhIKBrvN8SG+CZslimJcT3W2u2g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/estree": "1.0.5" "@types/estree": "1.0.5"
@@ -3139,19 +3138,19 @@
"npm": ">=8.0.0" "npm": ">=8.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.9.6", "@rollup/rollup-android-arm-eabi": "4.10.0",
"@rollup/rollup-android-arm64": "4.9.6", "@rollup/rollup-android-arm64": "4.10.0",
"@rollup/rollup-darwin-arm64": "4.9.6", "@rollup/rollup-darwin-arm64": "4.10.0",
"@rollup/rollup-darwin-x64": "4.9.6", "@rollup/rollup-darwin-x64": "4.10.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.9.6", "@rollup/rollup-linux-arm-gnueabihf": "4.10.0",
"@rollup/rollup-linux-arm64-gnu": "4.9.6", "@rollup/rollup-linux-arm64-gnu": "4.10.0",
"@rollup/rollup-linux-arm64-musl": "4.9.6", "@rollup/rollup-linux-arm64-musl": "4.10.0",
"@rollup/rollup-linux-riscv64-gnu": "4.9.6", "@rollup/rollup-linux-riscv64-gnu": "4.10.0",
"@rollup/rollup-linux-x64-gnu": "4.9.6", "@rollup/rollup-linux-x64-gnu": "4.10.0",
"@rollup/rollup-linux-x64-musl": "4.9.6", "@rollup/rollup-linux-x64-musl": "4.10.0",
"@rollup/rollup-win32-arm64-msvc": "4.9.6", "@rollup/rollup-win32-arm64-msvc": "4.10.0",
"@rollup/rollup-win32-ia32-msvc": "4.9.6", "@rollup/rollup-win32-ia32-msvc": "4.10.0",
"@rollup/rollup-win32-x64-msvc": "4.9.6", "@rollup/rollup-win32-x64-msvc": "4.10.0",
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },

View File

@@ -1,6 +1,6 @@
{ {
"name": "@pyscript/core", "name": "@pyscript/core",
"version": "0.3.23", "version": "0.4.4",
"type": "module", "type": "module",
"description": "PyScript", "description": "PyScript",
"module": "./index.js", "module": "./index.js",
@@ -42,27 +42,27 @@
"dependencies": { "dependencies": {
"@ungap/with-resolvers": "^0.1.0", "@ungap/with-resolvers": "^0.1.0",
"basic-devtools": "^0.1.6", "basic-devtools": "^0.1.6",
"polyscript": "^0.6.18", "polyscript": "^0.8.1",
"sticky-module": "^0.1.1", "sticky-module": "^0.1.1",
"to-json-callback": "^0.1.1", "to-json-callback": "^0.1.1",
"type-checked-collections": "^0.1.7" "type-checked-collections": "^0.1.7"
}, },
"devDependencies": { "devDependencies": {
"@codemirror/commands": "^6.3.3", "@codemirror/commands": "^6.3.3",
"@codemirror/lang-python": "^6.1.3", "@codemirror/lang-python": "^6.1.4",
"@codemirror/language": "^6.10.0", "@codemirror/language": "^6.10.1",
"@codemirror/state": "^6.4.0", "@codemirror/state": "^6.4.0",
"@codemirror/view": "^6.23.1", "@codemirror/view": "^6.24.0",
"@playwright/test": "^1.41.1", "@playwright/test": "^1.41.2",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-terser": "^0.4.4",
"@webreflection/toml-j0.4": "^1.1.3", "@webreflection/toml-j0.4": "^1.1.3",
"@xterm/addon-fit": "^0.9.0-beta.1", "@xterm/addon-fit": "^0.9.0-beta.1",
"chokidar": "^3.5.3", "chokidar": "^3.6.0",
"codemirror": "^6.0.1", "codemirror": "^6.0.1",
"eslint": "^8.56.0", "eslint": "^8.56.0",
"rollup": "^4.9.6", "rollup": "^4.10.0",
"rollup-plugin-postcss": "^4.0.2", "rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-string": "^3.0.0", "rollup-plugin-string": "^3.0.0",
"static-handler": "^0.4.3", "static-handler": "^0.4.3",

View File

@@ -29,10 +29,36 @@ import { hooks, main, worker, codeFor, createFunction } from "./hooks.js";
// generic helper to disambiguate between custom element and script // generic helper to disambiguate between custom element and script
const isScript = ({ tagName }) => tagName === "SCRIPT"; const isScript = ({ tagName }) => tagName === "SCRIPT";
// Used to create either Pyodide or MicroPython workers
// with the PyScript module available within the code
const [PyWorker, MPWorker] = [...TYPES.entries()].map(
([TYPE, interpreter]) =>
/**
* A `Worker` facade able to bootstrap on the worker thread only a PyScript module.
* @param {string} file the python file to run ina worker.
* @param {{config?: string | object, async?: boolean}} [options] optional configuration for the worker.
* @returns {Promise<Worker & {sync: object}>}
*/
async function PyScriptWorker(file, options) {
await configs.get(TYPE).plugins;
const xworker = XWorker.call(
new Hook(null, hooked.get(TYPE)),
file,
{
...options,
type: interpreter,
},
);
assign(xworker.sync, sync);
return xworker.ready;
},
);
// avoid multiple initialization of the same library // avoid multiple initialization of the same library
const [ const [
{ {
PyWorker: exportedPyWorker, PyWorker: exportedPyWorker,
MPWorker: exportedMPWorker,
hooks: exportedHooks, hooks: exportedHooks,
config: exportedConfig, config: exportedConfig,
whenDefined: exportedWhenDefined, whenDefined: exportedWhenDefined,
@@ -40,6 +66,7 @@ const [
alreadyLive, alreadyLive,
] = stickyModule("@pyscript/core", { ] = stickyModule("@pyscript/core", {
PyWorker, PyWorker,
MPWorker,
hooks, hooks,
config: {}, config: {},
whenDefined, whenDefined,
@@ -48,6 +75,7 @@ const [
export { export {
TYPES, TYPES,
exportedPyWorker as PyWorker, exportedPyWorker as PyWorker,
exportedMPWorker as MPWorker,
exportedHooks as hooks, exportedHooks as hooks,
exportedConfig as config, exportedConfig as config,
exportedWhenDefined as whenDefined, exportedWhenDefined as whenDefined,
@@ -314,24 +342,3 @@ for (const [TYPE, interpreter] of TYPES) {
// export the used config without allowing leaks through it // export the used config without allowing leaks through it
exportedConfig[TYPE] = structuredClone(config); exportedConfig[TYPE] = structuredClone(config);
} }
/**
* A `Worker` facade able to bootstrap on the worker thread only a PyScript module.
* @param {string} file the python file to run ina worker.
* @param {{config?: string | object, async?: boolean}} [options] optional configuration for the worker.
* @returns {Worker & {sync: ProxyHandler<object>}}
*/
function PyWorker(file, options) {
const hooks = hooked.get("py");
// this propagates pyscript worker hooks without needing a pyscript
// bootstrap + it passes arguments and it defaults to `pyodide`
// as the interpreter to use in the worker, as all hooks assume that
// and as `pyodide` is the only default interpreter that can deal with
// all the features we need to deliver pyscript out there.
const xworker = XWorker.call(new Hook(null, hooks), file, {
type: "pyodide",
...options,
});
assign(xworker.sync, sync);
return xworker;
}

View File

@@ -21,7 +21,7 @@ const write = (base, literal) => {
python.push(`_path = _Path("${base}/${key}")`); python.push(`_path = _Path("${base}/${key}")`);
if (typeof value === "string") { if (typeof value === "string") {
const code = JSON.stringify(value); const code = JSON.stringify(value);
python.push(`_path.write_text(${code})`); python.push(`_path.write_text(${code},encoding="utf-8")`);
} else { } else {
// @see https://github.com/pyscript/pyscript/pull/1813#issuecomment-1781502909 // @see https://github.com/pyscript/pyscript/pull/1813#issuecomment-1781502909
python.push(`if not _os.path.exists("${base}/${key}"):`); python.push(`if not _os.path.exists("${base}/${key}"):`);

View File

@@ -24,16 +24,33 @@ for name in globalThis.Reflect.ownKeys(js_modules):
sys.modules["pyscript.js_modules"] = js_modules sys.modules["pyscript.js_modules"] = js_modules
if RUNNING_IN_WORKER: if RUNNING_IN_WORKER:
import js
import polyscript import polyscript
PyWorker = NotSupported( PyWorker = NotSupported(
"pyscript.PyWorker", "pyscript.PyWorker",
"pyscript.PyWorker works only when running in the main thread", "pyscript.PyWorker works only when running in the main thread",
) )
window = polyscript.xworker.window
document = window.document try:
js.document = document globalThis.SharedArrayBuffer.new(4)
import js
window = polyscript.xworker.window
document = window.document
js.document = document
except:
globalThis.console.debug("SharedArrayBuffer is not available")
# in this scenario none of the utilities would work
# as expected so we better export these as NotSupported
window = NotSupported(
"pyscript.window",
"pyscript.window in workers works only via SharedArrayBuffer",
)
document = NotSupported(
"pyscript.document",
"pyscript.document in workers works only via SharedArrayBuffer",
)
sync = polyscript.xworker.sync sync = polyscript.xworker.sync
# in workers the display does not have a default ID # in workers the display does not have a default ID

View File

@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="../dist/core.css">
<script type="module">
import { hooks } from "../dist/core.js";
hooks.main.codeBeforeRun.add('print(0)');
hooks.main.codeAfterRun.add('print(2)');
</script>
</head>
<body>
<script type="py">
# raise an error instead to see it on line 1
print(1)
</script>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../dist/core.css">
<script type="module">
import { PyWorker } from '../../dist/core.js';
const { sync } = await PyWorker(
'./worker.py',
{
config: {
sync_main_only: true
}
}
);
document.documentElement.classList.add(
await sync.get_class()
);
</script>
</head>
</html>

View File

@@ -0,0 +1,3 @@
from pyscript import sync
sync.get_class = lambda: "ok"

View File

@@ -98,6 +98,8 @@
<p class="collection"></p> <p class="collection"></p>
<div class="collection"></div> <div class="collection"></div>
<h3 class="collection"></h3> <h3 class="collection"></h3>
<div id="element_attribute_tests"></div>
</div> </div>

View File

@@ -163,6 +163,30 @@ class TestElement:
assert called assert called
def test_html_attribute(self):
# GIVEN an existing element on the page with a known empty text content
div = pydom["#element_attribute_tests"][0]
# WHEN we set the html attribute
div.html = "<b>New Content</b>"
# EXPECT the element html and underlying JS Element innerHTML property
# to match what we expect and what
assert div.html == div._js.innerHTML == "<b>New Content</b>"
assert div.text == div._js.textContent == "New Content"
def test_text_attribute(self):
# GIVEN an existing element on the page with a known empty text content
div = pydom["#element_attribute_tests"][0]
# WHEN we set the html attribute
div.text = "<b>New Content</b>"
# EXPECT the element html and underlying JS Element innerHTML property
# to match what we expect and what
assert div.html == div._js.innerHTML == "&lt;b&gt;New Content&lt;/b&gt;"
assert div.text == div._js.textContent == "<b>New Content</b>"
class TestCollection: class TestCollection:
def test_iter_eq_children(self): def test_iter_eq_children(self):

View File

View File

@@ -3,14 +3,26 @@ import TYPES from "./types.js";
* A `Worker` facade able to bootstrap on the worker thread only a PyScript module. * A `Worker` facade able to bootstrap on the worker thread only a PyScript module.
* @param {string} file the python file to run ina worker. * @param {string} file the python file to run ina worker.
* @param {{config?: string | object, async?: boolean}} [options] optional configuration for the worker. * @param {{config?: string | object, async?: boolean}} [options] optional configuration for the worker.
* @returns {Worker & {sync: ProxyHandler<object>}} * @returns {Promise<Worker & {sync: object}>}
*/ */
declare function exportedPyWorker(file: string, options?: { declare function exportedPyWorker(file: string, options?: {
config?: string | object; config?: string | object;
async?: boolean; async?: boolean;
}): Worker & { }): Promise<Worker & {
sync: ProxyHandler<object>; sync: object;
}; }>;
/**
* A `Worker` facade able to bootstrap on the worker thread only a PyScript module.
* @param {string} file the python file to run ina worker.
* @param {{config?: string | object, async?: boolean}} [options] optional configuration for the worker.
* @returns {Promise<Worker & {sync: object}>}
*/
declare function exportedMPWorker(file: string, options?: {
config?: string | object;
async?: boolean;
}): Promise<Worker & {
sync: object;
}>;
declare const exportedHooks: { declare const exportedHooks: {
main: { main: {
onWorker: Set<Function>; onWorker: Set<Function>;
@@ -26,7 +38,11 @@ declare const exportedHooks: {
}; };
worker: { worker: {
onReady: Set<Function>; onReady: Set<Function>;
onBeforeRun: Set<Function>; onBeforeRun: Set<Function>; /**
* Given a generic DOM Element, tries to fetch the 'src' attribute, if present.
* It either throws an error if the 'src' can't be fetched or it returns a fallback
* content as source.
*/
onBeforeRunAsync: Set<Function>; onBeforeRunAsync: Set<Function>;
onAfterRun: Set<Function>; onAfterRun: Set<Function>;
onAfterRunAsync: Set<Function>; onAfterRunAsync: Set<Function>;
@@ -39,4 +55,4 @@ declare const exportedHooks: {
declare const exportedConfig: {}; declare const exportedConfig: {};
declare const exportedWhenDefined: (type: string) => Promise<any>; declare const exportedWhenDefined: (type: string) => Promise<any>;
import sync from "./sync.js"; import sync from "./sync.js";
export { TYPES, exportedPyWorker as PyWorker, exportedHooks as hooks, exportedConfig as config, exportedWhenDefined as whenDefined }; export { TYPES, exportedPyWorker as PyWorker, exportedMPWorker as MPWorker, exportedHooks as hooks, exportedConfig as config, exportedWhenDefined as whenDefined };