@nano-app/plugins 0.1.1 → 0.3.0

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/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # @nano-app/plugins
2
2
 
3
+ [![plugins](https://img.shields.io/npm/v/@nano-app/plugins?label=plugins)](https://www.npmjs.com/package/@nano-app/plugins)
4
+
3
5
  Official plugins for [`@nano-app/backend`](https://www.npmjs.com/package/@nano-app/backend). One import path per plugin: `@nano-app/plugins/<name>`. Nothing is mounted unless you list it.
4
6
 
5
7
  ```bash
6
- npm install @nano-app/backend @nano-app/plugins
8
+ pnpm add @nano-app/backend @nano-app/plugins
7
9
  ```
8
10
 
9
11
  ```ts
10
- import { createNanoApp } from "@nano-app/backend";
11
- import { health } from "@nano-app/plugins/health";
12
+ import { createNanoApp } from '@nano-app/backend';
13
+ import health from '@nano-app/plugins/health';
12
14
 
13
15
  createNanoApp({ plugins: [health()] });
14
16
  ```
@@ -17,14 +19,16 @@ createNanoApp({ plugins: [health()] });
17
19
 
18
20
  | Plugin | Import | Endpoints | Options |
19
21
  |---|---|---|---|
20
- | `health` | `import { health } from "@nano-app/plugins/health"` | `GET /health` → `{ status: "ok" }` | `basePath` (default `"/health"`) |
22
+ | `health` | `import health from '@nano-app/plugins/health'` | `GET /health` → `{ status: "ok" }` | `basePath` (default `"/health"`) |
21
23
 
22
24
  ## Layout
23
25
 
24
26
  ```
25
27
  plugins/
26
28
  └── <name>/
27
- ├── index.ts exports the createPlugin factory as `<name>`: the import path
29
+ ├── index.ts default-exports the plugin factory: the import path
30
+ ├── schema.prisma its tables, when it has any
31
+ ├── migrations/ their migrations, applied at startup
28
32
  └── routes/ *.route.ts, mounted under the plugin's basePath
29
33
  ```
30
34
 
@@ -1,10 +1,9 @@
1
- import * as _nano_app_backend from '@nano-app/backend';
2
-
1
+ //#region health/index.d.ts
3
2
  /** Health check: `GET /health` answers `{ status: "ok" }` while the server is up. */
4
- declare const health: (options?: {
5
- basePath?: string;
6
- } | undefined) => _nano_app_backend.PluginConfig<{
7
- basePath?: string;
3
+ declare const _default: (options?: {
4
+ basePath?: string;
5
+ } | undefined) => import("@nano-app/backend").PluginConfig<{
6
+ basePath?: string;
8
7
  }>;
9
-
10
- export { health };
8
+ //#endregion
9
+ export { _default as default };
@@ -1,14 +1,13 @@
1
- // health/index.ts
1
+ import { dirname, resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
2
3
  import { createPlugin } from "@nano-app/backend";
3
- import { dirname, resolve } from "path";
4
- import { fileURLToPath } from "url";
5
- var health = createPlugin((options) => ({
6
- name: "health",
7
- basePath: options?.basePath ?? "/health",
8
- stage: "before",
9
- // Next to this file, from the sources and from the build
10
- routesDir: resolve(dirname(fileURLToPath(import.meta.url)), "routes")
4
+ //#region health/index.ts
5
+ /** Health check: `GET /health` answers `{ status: "ok" }` while the server is up. */
6
+ var health_default = createPlugin((options) => ({
7
+ name: "health",
8
+ basePath: options?.basePath ?? "/health",
9
+ stage: "before",
10
+ routesDir: resolve(dirname(fileURLToPath(import.meta.url)), "routes")
11
11
  }));
12
- export {
13
- health
14
- };
12
+ //#endregion
13
+ export { health_default as default };
@@ -1,8 +1,8 @@
1
- // health/routes/index.route.ts
2
1
  import { createRoute } from "@nano-app/backend";
3
- var index_route_default = createRoute({
4
- GET: async () => ({ success: true, result: { status: "ok" } })
5
- });
6
- export {
7
- index_route_default as default
8
- };
2
+ //#region health/routes/index.route.ts
3
+ var index_route_default = createRoute({ GET: async () => ({
4
+ success: true,
5
+ result: { status: "ok" }
6
+ }) });
7
+ //#endregion
8
+ export { index_route_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nano-app/plugins",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Official plugins for @nano-app/backend",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "LICENSE"
15
15
  ],
16
16
  "scripts": {
17
- "build": "tsup",
17
+ "build": "tsdown",
18
18
  "test": "tsx --env-file-if-exists=../.env --test tests/*.test.ts",
19
19
  "prepublishOnly": "pnpm run build"
20
20
  },
@@ -34,17 +34,22 @@
34
34
  "access": "public"
35
35
  },
36
36
  "engines": {
37
- "node": ">=20"
37
+ "node": ">=22"
38
38
  },
39
39
  "peerDependencies": {
40
- "@nano-app/backend": ">=0.7.1"
40
+ "@nano-app/backend": ">=0.9.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@nano-app/backend": "workspace:*",
44
+ "@prisma/adapter-pg": "^7.10.1",
45
+ "@prisma/client": "^7.10.1",
44
46
  "@types/node": "^26.6.5",
47
+ "@types/pg": "^8.23.1",
45
48
  "glob": "^13.0.6",
46
- "tsup": "^9.0.0",
49
+ "pg": "^8.23.1",
50
+ "prisma": "^7.10.1",
51
+ "tsdown": "^0.23.1",
47
52
  "tsx": "^4.23.15",
48
- "typescript": "^5.9.3"
53
+ "typescript": "^7.0.2"
49
54
  }
50
55
  }