@primate/python 0.1.3 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/python",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Primate Python backend",
5
5
  "homepage": "https://primatejs.com/modules/python",
6
6
  "bugs": "https://github.com/primatejs/primate/issues",
@@ -15,17 +15,17 @@
15
15
  "directory": "packages/python"
16
16
  },
17
17
  "dependencies": {
18
- "@rcompat/fs": "^0.5.0",
18
+ "@rcompat/fs": "^0.7.0",
19
19
  "pyodide": "^0.26.2",
20
- "@primate/core": "^0.1.6"
20
+ "@primate/core": "^0.1.9"
21
21
  },
22
22
  "peerDependencies": {
23
- "primate": "^0.32.3"
23
+ "primate": "^0.32.5"
24
24
  },
25
25
  "type": "module",
26
26
  "imports": {
27
27
  "#*": {
28
- "@primate/lt": "./src/private/*.js",
28
+ "livetypes": "./src/private/*.js",
29
29
  "default": "./src/private/*.js"
30
30
  }
31
31
  },
package/src/default.js CHANGED
@@ -5,4 +5,8 @@ import pkgname from "#pkgname";
5
5
  export default ({ extension = default_extension, packages = [] } = {}) => ({
6
6
  name: pkgname,
7
7
  build: build({ extension, packages }),
8
+ init(app, next) {
9
+ app.bind(extension, () => null);
10
+ return next(app);
11
+ },
8
12
  });
package/src/load.js ADDED
@@ -0,0 +1 @@
1
+ export { loadPyodide as default } from "pyodide";
@@ -1,4 +1,6 @@
1
- const routes_re = /def (?<route>get|post|put|delete)/gu;
1
+ import verbs from "@primate/core/http/verbs";
2
+
3
+ const routes_re = new RegExp(`def (?<route>${verbs.join("|")})`, "gu");
2
4
  const get_routes = code => [...code.matchAll(routes_re)]
3
5
  .map(({ groups: { route } }) => route);
4
6
 
@@ -16,7 +18,7 @@ const js_wrapper = async (path, routes, packages) => `
16
18
  import to_request from "@primate/python/to-request";
17
19
  import to_response from "@primate/python/to-response";
18
20
  import wrap from "@primate/python/wrap";
19
- import { loadPyodide as load } from "pyodide";
21
+ import load from "@primate/python/load";
20
22
 
21
23
  const pyodide = await load({ indexURL: "./node_modules/pyodide" });
22
24
  const python_route = await file(${JSON.stringify(path)}).text();