@nano-app/plugins 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cristian Serrano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # @nano-app/plugins
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 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
+
5
+ ```bash
6
+ npm install @nano-app/backend @nano-app/plugins
7
+ ```
8
+
9
+ ```ts
10
+ import { createNanoApp } from "@nano-app/backend";
11
+ import { health } from "@nano-app/plugins/health";
12
+
13
+ createNanoApp({ plugins: [health()] });
14
+ ```
15
+
16
+ ## Plugins
17
+
18
+ | Plugin | Import | Endpoints | Options |
19
+ |---|---|---|---|
20
+ | `health` | `import { health } from "@nano-app/plugins/health"` | `GET /health` → `{ status: "ok" }` | `basePath` (default `"/health"`) |
21
+
22
+ ## Layout
23
+
24
+ ```
25
+ plugins/
26
+ └── <name>/
27
+ ├── index.ts exports the createPlugin factory as `<name>`: the import path
28
+ └── routes/ *.route.ts, mounted under the plugin's basePath
29
+ ```
30
+
31
+ The plugin contract: [PLUGINS.md](https://github.com/Nano-Nathan/nano-app/blob/main/PLUGINS.md).
@@ -0,0 +1,10 @@
1
+ import * as _nano_app_backend from '@nano-app/backend';
2
+
3
+ /** 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;
8
+ }>;
9
+
10
+ export { health };
@@ -0,0 +1,14 @@
1
+ // health/index.ts
2
+ 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")
11
+ }));
12
+ export {
13
+ health
14
+ };
@@ -0,0 +1,8 @@
1
+ // health/routes/index.route.ts
2
+ 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
+ };
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@nano-app/plugins",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Official plugins for @nano-app/backend",
5
+ "type": "module",
6
+ "exports": {
7
+ "./*": {
8
+ "types": "./build/*/index.d.ts",
9
+ "import": "./build/*/index.js"
10
+ }
11
+ },
12
+ "files": [
13
+ "build",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "test": "tsx --env-file-if-exists=../.env --test tests/*.test.ts",
19
+ "prepublishOnly": "pnpm run build"
20
+ },
21
+ "keywords": [
22
+ "nano-app",
23
+ "express",
24
+ "plugins"
25
+ ],
26
+ "author": "Cristian Serrano",
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/Nano-Nathan/nano-app.git",
31
+ "directory": "plugins"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "peerDependencies": {
40
+ "@nano-app/backend": ">=0.7.1"
41
+ },
42
+ "devDependencies": {
43
+ "@nano-app/backend": "workspace:*",
44
+ "@types/node": "^22.19.0",
45
+ "glob": "^13.0.6",
46
+ "tsup": "^9.0.0",
47
+ "tsx": "^4.23.15",
48
+ "typescript": "^5.9.3"
49
+ }
50
+ }