@wervt/nitro 0.0.8 → 0.0.10
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/dist/index.d.ts +6 -0
- package/dist/index.js +7 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ServiceOptions } from "@wervt/core";
|
|
1
2
|
import { DevOptions } from "@wervt/platform/dev";
|
|
2
3
|
import { NitroModule } from "nitro/types";
|
|
3
4
|
export interface WervtNitroOptions {
|
|
@@ -9,6 +10,11 @@ export interface WervtNitroOptions {
|
|
|
9
10
|
framework?: string;
|
|
10
11
|
/** The local stack `nitro dev` provisions the app's database in. */
|
|
11
12
|
dev?: DevOptions;
|
|
13
|
+
/**
|
|
14
|
+
* Containers next to the app, built from a Dockerfile in the app or pulled, reachable only from
|
|
15
|
+
* the app through `useService(name)`: `{ faces: { build: './face-service', port: 8000 } }`.
|
|
16
|
+
*/
|
|
17
|
+
services?: Record<string, ServiceOptions>;
|
|
12
18
|
}
|
|
13
19
|
/** The module, configured: `modules: [wervt({ timezone: 'Europe/Berlin' })]`. */
|
|
14
20
|
export declare function wervt(options?: WervtNitroOptions): NitroModule & {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DENO_INJECT, denoPlugins } from "./build.js";
|
|
|
2
2
|
import { glob, mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, sep } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { BUNDLE_MANIFEST } from "@wervt/core";
|
|
5
|
+
import { BUNDLE_MANIFEST, serviceManifests } from "@wervt/core";
|
|
6
6
|
import { SEED_TASK, resolveAppName, setupDev, unscheduleSeed } from "@wervt/platform/dev";
|
|
7
7
|
// src/index.ts
|
|
8
8
|
const ext = import.meta.url.endsWith(".ts") ? ".ts" : ".js";
|
|
@@ -23,6 +23,7 @@ var src_default = wervt();
|
|
|
23
23
|
async function setup(nitro, options) {
|
|
24
24
|
const { rootDir, dev } = nitro.options;
|
|
25
25
|
const app = await resolveAppName(rootDir, options.app);
|
|
26
|
+
const services = serviceManifests(options.services);
|
|
26
27
|
if (!nitro.options.experimental.tasks) {
|
|
27
28
|
nitro.options.experimental.tasks = true;
|
|
28
29
|
await scanTasks(nitro);
|
|
@@ -43,7 +44,7 @@ async function setup(nitro, options) {
|
|
|
43
44
|
});
|
|
44
45
|
if (nitro.options.noExternals !== true) nitro.options.noExternals = [...nitro.options.noExternals || [], runtimeDir];
|
|
45
46
|
if (dev) {
|
|
46
|
-
if (!process.env.NITRO_PRERENDER) await setupDevServer(nitro, app, options.dev ?? {});
|
|
47
|
+
if (!process.env.NITRO_PRERENDER) await setupDevServer(nitro, app, options.dev ?? {}, services);
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
if (!/deno/i.test(String(nitro.options.preset))) throw new Error(`@wervt/nitro: wervt runs apps on Deno. Set \`preset: 'deno-server'\` in nitro.config (now: ${nitro.options.preset}).`);
|
|
@@ -72,7 +73,8 @@ async function setup(nitro, options) {
|
|
|
72
73
|
await writeFile(join(serverDir, "wervt-tasks.json"), `${JSON.stringify(tasks, null, 2)}\n`);
|
|
73
74
|
const bundle = {
|
|
74
75
|
version: 2,
|
|
75
|
-
framework: options.framework ?? "nitro"
|
|
76
|
+
framework: options.framework ?? "nitro",
|
|
77
|
+
...services ? { services } : {}
|
|
76
78
|
};
|
|
77
79
|
await writeFile(join(dirname(serverDir), BUNDLE_MANIFEST), `${JSON.stringify(bundle, null, 2)}\n`);
|
|
78
80
|
});
|
|
@@ -94,7 +96,7 @@ async function scanTasks(nitro) {
|
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
async function setupDevServer(nitro, app, options) {
|
|
99
|
+
async function setupDevServer(nitro, app, options, services) {
|
|
98
100
|
await setupDev({
|
|
99
101
|
rootDir: nitro.options.rootDir,
|
|
100
102
|
onClose: (fn) => nitro.hooks.hook("close", fn),
|
|
@@ -104,6 +106,6 @@ async function setupDevServer(nitro, app, options) {
|
|
|
104
106
|
success: (message) => nitro.logger.success(message),
|
|
105
107
|
warn: (message, ...args) => nitro.logger.warn(message, ...args)
|
|
106
108
|
}
|
|
107
|
-
}, app, options);
|
|
109
|
+
}, app, options, { services });
|
|
108
110
|
}
|
|
109
111
|
export { src_default as default, wervt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wervt/nitro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Nitro module for apps hosted on wervt: Deno build for the runtime, tasks, local database and the bundle manifest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nitro",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@wervt/core": "^0.0.
|
|
35
|
-
"@wervt/platform": "^0.0.
|
|
34
|
+
"@wervt/core": "^0.0.7",
|
|
35
|
+
"@wervt/platform": "^0.0.8"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"nitro": "3.0.261102-rc",
|