@pyscript/core 0.0.4 → 0.0.5

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.
Files changed (49) hide show
  1. package/README.md +14 -2
  2. package/cjs/custom/pyscript.js +3 -3
  3. package/cjs/custom-types.js +0 -2
  4. package/cjs/custom.js +6 -6
  5. package/cjs/interpreter/_python.js +4 -2
  6. package/cjs/interpreter/micropython.js +10 -12
  7. package/cjs/interpreter/webr.js +48 -0
  8. package/cjs/plugins.js +89 -0
  9. package/cjs/runtime/_python.js +34 -0
  10. package/cjs/runtime/_utils.js +141 -0
  11. package/cjs/runtime/micropython.js +40 -0
  12. package/cjs/runtime/pyodide.js +40 -0
  13. package/cjs/runtime/ruby.js +50 -0
  14. package/cjs/runtime/wasmoon.js +46 -0
  15. package/cjs/runtimes.js +63 -0
  16. package/cjs/worker/class.js +11 -2
  17. package/cjs/worker/hooks.js +11 -2
  18. package/cjs/worker/xworker.js +1 -1
  19. package/core.js +2 -2
  20. package/docs/README.md +481 -0
  21. package/esm/custom/pyscript.js +3 -3
  22. package/esm/custom.js +6 -6
  23. package/esm/interpreter/_python.js +4 -2
  24. package/esm/interpreter/micropython.js +10 -12
  25. package/esm/worker/class.js +11 -2
  26. package/esm/worker/hooks.js +11 -2
  27. package/esm/worker/xworker.js +1 -1
  28. package/package.json +12 -4
  29. package/pyscript.js +2 -2
  30. package/types/coincident/window.d.ts +4 -4
  31. package/types/custom.d.ts +54 -0
  32. package/types/index.d.ts +1 -1
  33. package/types/interpreter/_python.d.ts +7 -0
  34. package/types/interpreter/_utils.d.ts +11 -0
  35. package/types/interpreter/micropython.d.ts +18 -0
  36. package/types/interpreter/pyodide.d.ts +19 -0
  37. package/types/interpreter/ruby-wasm-wasi.d.ts +15 -0
  38. package/types/interpreter/wasmoon.d.ts +21 -0
  39. package/types/interpreters.d.ts +9 -0
  40. package/types/listeners.d.ts +2 -0
  41. package/types/pyscript/pyscript.core/esm/custom.d.ts +3 -3
  42. package/types/pyscript/pyscript.core/esm/interpreter/_python.d.ts +2 -2
  43. package/types/pyscript/pyscript.core/esm/interpreter/micropython.d.ts +1 -2
  44. package/types/pyscript/pyscript.core/esm/interpreter/webr.d.ts +14 -0
  45. package/types/pyscript/pyscript.core/esm/plugins.d.ts +21 -14
  46. package/types/pyscript/pyscript.core/esm/worker/hooks.d.ts +4 -1
  47. package/types/script-handler.d.ts +2 -1
  48. package/types/worker/class.d.ts +4 -4
  49. package/types/worker/hooks.d.ts +6 -2
@@ -1,29 +1,32 @@
1
- export const CUSTOM_SELECTORS: any[];
1
+ export const PLUGINS_SELECTORS: any[];
2
2
  export function handlePlugin(node: Element): void;
3
- export function define(type: string, options: PluginOptions): void;
4
- export function whenDefined(type: string): Promise<object>;
3
+ export function registerPlugin(name: string, options: PluginOptions): void;
5
4
  /**
6
5
  * plugin configuration
7
6
  */
8
7
  export type Runtime = {
9
8
  /**
10
- * the bootstrapped interpreter
9
+ * the runtime type
11
10
  */
12
- interpreter: object;
11
+ type: string;
13
12
  /**
14
- * an XWorker constructor that defaults to same interpreter on the Worker.
13
+ * the bootstrapped runtime
14
+ */
15
+ runtime: object;
16
+ /**
17
+ * an XWorker constructor that defaults to same runtime on the Worker.
15
18
  */
16
19
  XWorker: (url: string, options?: object) => Worker;
17
20
  /**
18
- * a cloned config used to bootstrap the interpreter
21
+ * a cloned config used to bootstrap the runtime
19
22
  */
20
23
  config: object;
21
24
  /**
22
- * an utility to run code within the interpreter
25
+ * an utility to run code within the runtime
23
26
  */
24
27
  run: (code: string) => any;
25
28
  /**
26
- * an utility to run code asynchronously within the interpreter
29
+ * an utility to run code asynchronously within the runtime
27
30
  */
28
31
  runAsync: (code: string) => Promise<any>;
29
32
  /**
@@ -36,19 +39,23 @@ export type Runtime = {
36
39
  */
37
40
  export type PluginOptions = {
38
41
  /**
39
- * the interpreter to use
42
+ * the runtime/interpreter type to receive
40
43
  */
41
- interpreter: 'pyodide' | 'micropython' | 'wasmoon' | 'ruby-wasm-wasi';
44
+ type: string;
42
45
  /**
43
- * the optional interpreter version to use
46
+ * the optional runtime version to use
44
47
  */
45
48
  version?: string;
46
49
  /**
47
- * the optional config to use within such interpreter
50
+ * the optional config to use within such runtime
48
51
  */
49
52
  config?: string;
53
+ /**
54
+ * the optional environment to use
55
+ */
56
+ env?: string;
50
57
  /**
51
58
  * the callback that will be invoked once
52
59
  */
53
- onRuntimeReady?: (environment: object, node: Element) => void;
60
+ onRuntimeReady: (node: Element, runtime: Runtime) => void;
54
61
  };
@@ -1,3 +1,6 @@
1
1
  export class Hook {
2
- constructor(fields: any);
2
+ constructor(interpreter: any, options: any);
3
+ interpreter: any;
4
+ onWorkerReady: any;
5
+ get stringHooks(): {};
3
6
  }
@@ -1,3 +1,4 @@
1
- export const runtimes: Map<any, any>;
1
+ export function queryTarget(script: any, idOrSelector: any): any;
2
+ export const interpreters: Map<any, any>;
2
3
  export function getDetails(type: any, id: any, name: any, version: any, config: any): any;
3
4
  export function handle(script: HTMLScriptElement): Promise<void>;
@@ -1,19 +1,19 @@
1
1
  declare function _default(...args: any[]): (url: string, options?: WorkerOptions) => Worker;
2
2
  export default _default;
3
3
  /**
4
- * plugin configuration
4
+ * custom configuration
5
5
  */
6
6
  export type WorkerOptions = {
7
7
  /**
8
- * the runtime/interpreter type to use
8
+ * the interpreter type to use
9
9
  */
10
10
  type: string;
11
11
  /**
12
- * the optional runtime version to use
12
+ * the optional interpreter version to use
13
13
  */
14
14
  version?: string;
15
15
  /**
16
- * the optional config to use within such runtime
16
+ * the optional config to use within such interpreter
17
17
  */
18
18
  config?: string;
19
19
  };
@@ -1,2 +1,6 @@
1
- declare const _default: WeakMap<object, any>;
2
- export default _default;
1
+ export class Hook {
2
+ constructor(interpreter: any, options: any);
3
+ interpreter: any;
4
+ onWorkerReady: any;
5
+ get stringHooks(): {};
6
+ }