@zeltjs/adapter-node 0.8.2-canary.0 → 0.8.2-canary.2

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.cjs ADDED
@@ -0,0 +1,151 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _hono_node_server = require("@hono/node-server");
3
+ let _zeltjs_core = require("@zeltjs/core");
4
+ //#region src/node-cli.config.ts
5
+ function _ts_decorate$1(decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ }
11
+ var NodeCliConfig = class extends _zeltjs_core.CliConfig {
12
+ cwd() {
13
+ return process.cwd();
14
+ }
15
+ argv() {
16
+ return process.argv;
17
+ }
18
+ exit(code) {
19
+ process.exit(code);
20
+ }
21
+ setExitCode(code) {
22
+ process.exitCode = code;
23
+ }
24
+ onSignal(signal, handler) {
25
+ process.on(signal, handler);
26
+ }
27
+ offSignal(signal, handler) {
28
+ process.off(signal, handler);
29
+ }
30
+ };
31
+ NodeCliConfig = _ts_decorate$1([_zeltjs_core.Config], NodeCliConfig);
32
+ //#endregion
33
+ //#region src/process-env.adaptor.ts
34
+ function _ts_decorate(decorators, target, key, desc) {
35
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
38
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
39
+ }
40
+ var ProcessEnvAdaptor = class extends _zeltjs_core.EnvAdaptor {
41
+ get(key) {
42
+ return process.env[key];
43
+ }
44
+ };
45
+ ProcessEnvAdaptor = _ts_decorate([_zeltjs_core.Config], ProcessEnvAdaptor);
46
+ //#endregion
47
+ //#region src/on-node.ts
48
+ const createListenForHttp = (appFetch, appShutdown) => {
49
+ return async (portOrOptions) => {
50
+ const listenOptions = typeof portOrOptions === "number" ? { port: portOrOptions } : portOrOptions ?? {};
51
+ const port = listenOptions.port ?? 3e3;
52
+ const hostname = listenOptions.hostname ?? "0.0.0.0";
53
+ let server;
54
+ const address = await new Promise((resolve) => {
55
+ server = (0, _hono_node_server.serve)({
56
+ fetch: appFetch,
57
+ port,
58
+ hostname
59
+ }, (info) => resolve({
60
+ port: info.port,
61
+ address: info.address
62
+ }));
63
+ });
64
+ const shutdown = async () => {
65
+ await new Promise((resolve, reject) => {
66
+ server.close((err) => err ? reject(err) : resolve());
67
+ });
68
+ await appShutdown();
69
+ };
70
+ return {
71
+ address,
72
+ shutdown
73
+ };
74
+ };
75
+ };
76
+ const getArgs = () => globalThis.process.argv.slice(2);
77
+ const createNodeApp = (readyApp, shutdown, args) => {
78
+ const base = {
79
+ ...readyApp,
80
+ args,
81
+ shutdown
82
+ };
83
+ const httpCaps = readyApp.getFeatureCapabilities(_zeltjs_core.HttpFeature);
84
+ if (!httpCaps) return base;
85
+ return {
86
+ ...base,
87
+ listen: createListenForHttp(httpCaps.fetch, shutdown)
88
+ };
89
+ };
90
+ /** @throws {ZeltLifecycleStateError} */ async function onNode(app, options = {}) {
91
+ const readyApp = await app.createRuntime({
92
+ fallbackConfigs: [NodeCliConfig, ProcessEnvAdaptor],
93
+ warmup: options.warmup ?? true
94
+ });
95
+ const cliConfig = await readyApp.get(NodeCliConfig);
96
+ const runtimeShutdown = readyApp.shutdown;
97
+ let shuttingDown = false;
98
+ const detachSignals = () => {
99
+ cliConfig.offSignal("SIGINT", gracefulShutdown);
100
+ cliConfig.offSignal("SIGTERM", gracefulShutdown);
101
+ };
102
+ const shutdown = async () => {
103
+ if (shuttingDown) return;
104
+ shuttingDown = true;
105
+ try {
106
+ await runtimeShutdown();
107
+ } finally {
108
+ detachSignals();
109
+ }
110
+ };
111
+ const gracefulShutdown = () => {
112
+ shutdown().catch(() => {});
113
+ };
114
+ cliConfig.onSignal("SIGINT", gracefulShutdown);
115
+ cliConfig.onSignal("SIGTERM", gracefulShutdown);
116
+ return createNodeApp(readyApp, shutdown, getArgs());
117
+ }
118
+ //#endregion
119
+ //#region src/serve.lib.ts
120
+ const buildServeOptions = (optionsOrCallback) => typeof optionsOrCallback === "function" ? {} : optionsOrCallback ?? {};
121
+ const extractCallback = (optionsOrCallback, maybeCallback) => typeof optionsOrCallback === "function" ? optionsOrCallback : maybeCallback;
122
+ const serveApp = (app, optionsOrCallback, maybeCallback) => {
123
+ const options = buildServeOptions(optionsOrCallback);
124
+ const callback = extractCallback(optionsOrCallback, maybeCallback);
125
+ return (0, _hono_node_server.serve)({
126
+ fetch: app.fetch,
127
+ port: options.port ?? 3e3,
128
+ hostname: options.hostname ?? "0.0.0.0"
129
+ }, callback);
130
+ };
131
+ //#endregion
132
+ Object.defineProperty(exports, "NodeCliConfig", {
133
+ enumerable: true,
134
+ get: function() {
135
+ return NodeCliConfig;
136
+ }
137
+ });
138
+ Object.defineProperty(exports, "ProcessEnvAdaptor", {
139
+ enumerable: true,
140
+ get: function() {
141
+ return ProcessEnvAdaptor;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "createAdaptorServer", {
145
+ enumerable: true,
146
+ get: function() {
147
+ return _hono_node_server.createAdaptorServer;
148
+ }
149
+ });
150
+ exports.onNode = onNode;
151
+ exports.serve = serveApp;
@@ -0,0 +1,61 @@
1
+ import { ServerType, createAdaptorServer } from "@hono/node-server";
2
+ import { CliConfig, ConfiguredFeature, EnvAdaptor, FeatureApp, HttpFeature, RuntimeApp, Signal, SignalHandler } from "@zeltjs/core";
3
+
4
+ //#region src/node-cli.config.d.ts
5
+ declare class NodeCliConfig extends CliConfig {
6
+ cwd(): string;
7
+ argv(): readonly string[];
8
+ exit(code: number): never;
9
+ setExitCode(code: number): void;
10
+ onSignal(signal: Signal, handler: SignalHandler): void;
11
+ offSignal(signal: Signal, handler: SignalHandler): void;
12
+ }
13
+ //#endregion
14
+ //#region src/on-node.d.ts
15
+ type ListenOptions = {
16
+ readonly port?: number;
17
+ readonly hostname?: string;
18
+ };
19
+ type ServerHandle = {
20
+ readonly address: {
21
+ port: number;
22
+ address: string;
23
+ };
24
+ readonly shutdown: () => Promise<void>;
25
+ };
26
+ type NodeAppOptions = {
27
+ readonly warmup?: boolean;
28
+ };
29
+ type EnvironmentNodeAppPart = {
30
+ readonly args: readonly string[];
31
+ readonly shutdown: () => Promise<void>;
32
+ };
33
+ type HttpNodeAppPart = {
34
+ readonly listen: (portOrOptions?: number | ListenOptions) => Promise<ServerHandle>;
35
+ };
36
+ type HasFeatureClass<F extends readonly ConfiguredFeature[], TFeature extends ConfiguredFeature> = Extract<F[number], TFeature> extends never ? false : true;
37
+ type WithFeatureClass<F extends readonly ConfiguredFeature[], TFeature extends ConfiguredFeature, TPart extends object> = HasFeatureClass<F, TFeature> extends true ? TPart : unknown;
38
+ type NodeAppForFeatures<F extends readonly ConfiguredFeature[]> = RuntimeApp<F> & EnvironmentNodeAppPart & (number extends F['length'] ? Partial<HttpNodeAppPart> : WithFeatureClass<F, HttpFeature, HttpNodeAppPart>);
39
+ declare function onNode<const F extends readonly ConfiguredFeature[]>(app: FeatureApp<F>, options?: NodeAppOptions): Promise<NodeAppForFeatures<F>>;
40
+ //#endregion
41
+ //#region src/process-env.adaptor.d.ts
42
+ declare class ProcessEnvAdaptor extends EnvAdaptor {
43
+ get(key: string): string | undefined;
44
+ }
45
+ //#endregion
46
+ //#region src/serve.lib.d.ts
47
+ type ServeOptions = {
48
+ port?: number;
49
+ hostname?: string;
50
+ };
51
+ type AddressInfo = {
52
+ port: number;
53
+ address: string;
54
+ };
55
+ type AppLike = {
56
+ fetch: (request: Request) => Promise<Response>;
57
+ };
58
+ declare const serveApp: (app: AppLike, optionsOrCallback?: ServeOptions | ((info: AddressInfo) => void), maybeCallback?: (info: AddressInfo) => void) => ServerType;
59
+ //#endregion
60
+ export { type AddressInfo, NodeCliConfig, ProcessEnvAdaptor, type ServeOptions, type ServerHandle, createAdaptorServer, onNode, serveApp as serve };
61
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/node-cli.config.ts","../src/on-node.ts","../src/process-env.adaptor.ts","../src/serve.lib.ts"],"mappings":";;;;cAIa,aAAA,SAAsB,SAAA;EACxB,GAAA,CAAA;EAIA,IAAA,CAAA;EAIA,IAAA,CAAK,IAAA;EAIL,WAAA,CAAY,IAAA;EAIZ,QAAA,CAAS,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,aAAA;EAIlC,SAAA,CAAU,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,aAAA;AAAA;;;KCjBzC,aAAA;EAAA,SACM,IAAA;EAAA,SACA,QAAA;AAAA;AAAA,KAGC,YAAA;EAAA,SACD,OAAA;IAAW,IAAA;IAAc,OAAA;EAAA;EAAA,SACzB,QAAA,QAAgB,OAAA;AAAA;AAAA,KAGf,cAAA;EAAA,SACD,MAAA;AAAA;AAAA,KAKN,sBAAA;EAAA,SACM,IAAA;EAAA,SACA,QAAA,QAAgB,OAAA;AAAA;AAAA,KAGtB,eAAA;EAAA,SACM,MAAA,GAAS,aAAA,YAAyB,aAAA,KAAkB,OAAA,CAAQ,YAAA;AAAA;AAAA,KAMlE,eAAA,oBAAmC,iBAAA,qBAAsC,iBAAA,IAC5E,OAAA,CAAQ,CAAA,UAAW,QAAA;AAAA,KAEhB,gBAAA,oBACgB,iBAAA,qBACF,iBAAA,0BAEf,eAAA,CAAgB,CAAA,EAAG,QAAA,iBAAyB,KAAA;AAAA,KAE3C,kBAAA,oBAAsC,iBAAA,MAAuB,UAAA,CAAW,CAAA,IAC3E,sBAAA,mBACgB,CAAA,aACZ,OAAA,CAAQ,eAAA,IACR,gBAAA,CAAiB,CAAA,EAAG,WAAA,EAAa,eAAA;AAAA,iBAsDvB,MAAA,0BAAgC,iBAAA,GAAA,CAC9C,GAAA,EAAK,UAAA,CAAW,CAAA,GAChB,OAAA,GAAU,cAAA,GACT,OAAA,CAAQ,kBAAA,CAAmB,CAAA;;;cCvGjB,iBAAA,SAA0B,UAAA;EAC5B,GAAA,CAAI,GAAA;AAAA;;;KCDH,YAAA;EACV,IAAA;EACA,QAAA;AAAA;AAAA,KAGU,WAAA;EACV,IAAA;EACA,OAAA;AAAA;AAAA,KAGG,OAAA;EACH,KAAA,GAAQ,OAAA,EAAS,OAAA,KAAY,OAAA,CAAQ,QAAA;AAAA;AAAA,cAa1B,QAAA,GACX,GAAA,EAAK,OAAA,EACL,iBAAA,GAAoB,YAAA,KAAiB,IAAA,EAAM,WAAA,YAC3C,aAAA,IAAiB,IAAA,EAAM,WAAA,cACtB,UAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ServerType, createAdaptorServer } from "@hono/node-server";
2
- import { CliConfig, ConfiguredFeature, EnvAdaptor, FeatureApp, RuntimeApp, Signal, SignalHandler } from "@zeltjs/core";
2
+ import { CliConfig, ConfiguredFeature, EnvAdaptor, FeatureApp, HttpFeature, RuntimeApp, Signal, SignalHandler } from "@zeltjs/core";
3
3
 
4
4
  //#region src/node-cli.config.d.ts
5
5
  declare class NodeCliConfig extends CliConfig {
@@ -33,9 +33,9 @@ type EnvironmentNodeAppPart = {
33
33
  type HttpNodeAppPart = {
34
34
  readonly listen: (portOrOptions?: number | ListenOptions) => Promise<ServerHandle>;
35
35
  };
36
- type FeatureKeys<F extends readonly ConfiguredFeature[]> = F[number]['key'];
37
- type WithFeature<F extends readonly ConfiguredFeature[], TKey extends string, TPart extends object> = TKey extends FeatureKeys<F> ? TPart : unknown;
38
- type NodeAppForFeatures<F extends readonly ConfiguredFeature[]> = RuntimeApp<F> & EnvironmentNodeAppPart & (string extends FeatureKeys<F> ? Partial<HttpNodeAppPart> : WithFeature<F, 'http', HttpNodeAppPart>);
36
+ type HasFeatureClass<F extends readonly ConfiguredFeature[], TFeature extends ConfiguredFeature> = Extract<F[number], TFeature> extends never ? false : true;
37
+ type WithFeatureClass<F extends readonly ConfiguredFeature[], TFeature extends ConfiguredFeature, TPart extends object> = HasFeatureClass<F, TFeature> extends true ? TPart : unknown;
38
+ type NodeAppForFeatures<F extends readonly ConfiguredFeature[]> = RuntimeApp<F> & EnvironmentNodeAppPart & (number extends F['length'] ? Partial<HttpNodeAppPart> : WithFeatureClass<F, HttpFeature, HttpNodeAppPart>);
39
39
  declare function onNode<const F extends readonly ConfiguredFeature[]>(app: FeatureApp<F>, options?: NodeAppOptions): Promise<NodeAppForFeatures<F>>;
40
40
  //#endregion
41
41
  //#region src/process-env.adaptor.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/node-cli.config.ts","../src/on-node.ts","../src/process-env.adaptor.ts","../src/serve.lib.ts"],"mappings":";;;;cAIa,aAAA,SAAsB,SAAA;EACxB,GAAA,CAAA;EAIA,IAAA,CAAA;EAIA,IAAA,CAAK,IAAA;EAIL,WAAA,CAAY,IAAA;EAIZ,QAAA,CAAS,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,aAAA;EAIlC,SAAA,CAAU,MAAA,EAAQ,MAAA,EAAQ,OAAA,EAAS,aAAA;AAAA;;;KCjBzC,aAAA;EAAA,SACM,IAAA;EAAA,SACA,QAAA;AAAA;AAAA,KAGC,YAAA;EAAA,SACD,OAAA;IAAW,IAAA;IAAc,OAAA;EAAA;EAAA,SACzB,QAAA,QAAgB,OAAA;AAAA;AAAA,KAGf,cAAA;EAAA,SACD,MAAA;AAAA;AAAA,KAKN,sBAAA;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AA,GAAoB,YAAA,KAAiB,IAAA,EAAM,WAAA,YAC3C,aAAA,IAAiB,IAAA,EAAM,WAAA,cACtB,UAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { createAdaptorServer, serve } from "@hono/node-server";
2
- import { CliConfig, Config, EnvAdaptor } from "@zeltjs/core";
3
- import { unsafeGetNamespacedCallable } from "@zeltjs/unsafe-type-lib";
2
+ import { CliConfig, Config, EnvAdaptor, HttpFeature } from "@zeltjs/core";
4
3
  //#region src/node-cli.config.ts
5
4
  function _ts_decorate$1(decorators, target, key, desc) {
6
5
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -75,16 +74,16 @@ const createListenForHttp = (appFetch, appShutdown) => {
75
74
  };
76
75
  const getArgs = () => globalThis.process.argv.slice(2);
77
76
  const createNodeApp = (readyApp, shutdown, args) => {
78
- const fetch = unsafeGetNamespacedCallable(readyApp, "http", "fetch");
79
77
  const base = {
80
78
  ...readyApp,
81
79
  args,
82
80
  shutdown
83
81
  };
84
- if (typeof fetch !== "function") return base;
82
+ const httpCaps = readyApp.getFeatureCapabilities(HttpFeature);
83
+ if (!httpCaps) return base;
85
84
  return {
86
85
  ...base,
87
- listen: createListenForHttp(fetch, shutdown)
86
+ listen: createListenForHttp(httpCaps.fetch, shutdown)
88
87
  };
89
88
  };
90
89
  /** @throws {ZeltLifecycleStateError} */ async function onNode(app, options = {}) {
@@ -93,6 +92,7 @@ const createNodeApp = (readyApp, shutdown, args) => {
93
92
  warmup: options.warmup ?? true
94
93
  });
95
94
  const cliConfig = await readyApp.get(NodeCliConfig);
95
+ const runtimeShutdown = readyApp.shutdown;
96
96
  let shuttingDown = false;
97
97
  const detachSignals = () => {
98
98
  cliConfig.offSignal("SIGINT", gracefulShutdown);
@@ -102,7 +102,7 @@ const createNodeApp = (readyApp, shutdown, args) => {
102
102
  if (shuttingDown) return;
103
103
  shuttingDown = true;
104
104
  try {
105
- await readyApp.shutdown();
105
+ await runtimeShutdown();
106
106
  } finally {
107
107
  detachSignals();
108
108
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CliConfig","Config","NodeCliConfig","cwd","process","argv","exit","code","setExitCode","exitCode","onSignal","signal","handler","on","offSignal","off","Config","EnvAdaptor","ProcessEnvAdaptor","get","key","process","env","serve","unsafeGetNamespacedCallable","NodeCliConfig","ProcessEnvAdaptor","createListenForHttp","appFetch","appShutdown","portOrOptions","listenOptions","port","hostname","server","serverReady","Promise","resolve","fetch","info","address","shutdown","reject","close","err","getArgs","globalThis","process","argv","slice","createNodeApp","readyApp","args","base","listen","onNode","app","options","createRuntime","fallbackConfigs","warmup","cliConfig","get","shuttingDown","detachSignals","offSignal","gracefulShutdown","catch","onSignal","serve","buildServeOptions","optionsOrCallback","extractCallback","maybeCallback","serveApp","app","options","callback","fetch","port","hostname"],"sources":["../src/node-cli.config.ts","../src/process-env.adaptor.ts","../src/on-node.ts","../src/serve.lib.ts"],"sourcesContent":["import type { Signal, SignalHandler } from '@zeltjs/core';\nimport { CliConfig, Config } from '@zeltjs/core';\n\n@Config\nexport class NodeCliConfig extends CliConfig {\n override cwd(): string {\n return process.cwd();\n }\n\n override argv(): readonly string[] {\n return process.argv;\n }\n\n override exit(code: number): never {\n process.exit(code);\n }\n\n override setExitCode(code: number): void {\n process.exitCode = code;\n }\n\n override onSignal(signal: Signal, handler: SignalHandler): void {\n process.on(signal, handler);\n }\n\n override offSignal(signal: Signal, handler: SignalHandler): void {\n process.off(signal, handler);\n }\n}\n","import { Config, EnvAdaptor } from '@zeltjs/core';\n\n@Config\nexport class ProcessEnvAdaptor extends EnvAdaptor {\n override get(key: string): string | undefined {\n return process.env[key];\n }\n}\n","import type { ServerType } from '@hono/node-server';\nimport { serve } from '@hono/node-server';\nimport type { ConfiguredFeature, FeatureApp, HttpCapabilities, RuntimeApp } from '@zeltjs/core';\nimport { unsafeGetNamespacedCallable } from '@zeltjs/unsafe-type-lib';\n\nimport { NodeCliConfig } from './node-cli.config';\nimport { ProcessEnvAdaptor } from './process-env.adaptor';\n\ntype ListenOptions = {\n readonly port?: number;\n readonly hostname?: string;\n};\n\nexport type ServerHandle = {\n readonly address: { port: number; address: string };\n readonly shutdown: () => Promise<void>;\n};\n\nexport type NodeAppOptions = {\n readonly warmup?: boolean;\n};\n\nexport type { ExecResult } from '@zeltjs/core';\n\ntype EnvironmentNodeAppPart = {\n readonly args: readonly string[];\n readonly shutdown: () => Promise<void>;\n};\n\ntype HttpNodeAppPart = {\n readonly listen: (portOrOptions?: number | ListenOptions) => Promise<ServerHandle>;\n};\n\nexport type NodeApp = (RuntimeApp<readonly ConfiguredFeature[]> & EnvironmentNodeAppPart) &\n Partial<HttpNodeAppPart>;\n\ntype FeatureKeys<F extends readonly ConfiguredFeature[]> = F[number]['key'];\n\ntype WithFeature<\n F extends readonly ConfiguredFeature[],\n TKey extends string,\n TPart extends object,\n> = TKey extends FeatureKeys<F> ? TPart : unknown;\n\ntype NodeAppForFeatures<F extends readonly ConfiguredFeature[]> = RuntimeApp<F> &\n EnvironmentNodeAppPart &\n (string extends FeatureKeys<F>\n ? Partial<HttpNodeAppPart>\n : WithFeature<F, 'http', HttpNodeAppPart>);\n\nconst createListenForHttp = (\n appFetch: (request: Request) => Promise<Response>,\n appShutdown: () => Promise<void>,\n): ((portOrOptions?: number | ListenOptions) => Promise<ServerHandle>) => {\n return async (portOrOptions?: number | ListenOptions): Promise<ServerHandle> => {\n const listenOptions: ListenOptions =\n typeof portOrOptions === 'number' ? { port: portOrOptions } : (portOrOptions ?? {});\n\n const port = listenOptions.port ?? 3000;\n const hostname = listenOptions.hostname ?? '0.0.0.0';\n\n let server!: ServerType;\n const serverReady = new Promise<{ port: number; address: string }>((resolve) => {\n server = serve({ fetch: appFetch, port, hostname }, (info) =>\n resolve({ port: info.port, address: info.address }),\n );\n });\n\n const address = await serverReady;\n\n const shutdown = async (): Promise<void> => {\n await new Promise<void>((resolve, reject) => {\n server.close((err) => (err ? reject(err) : resolve()));\n });\n await appShutdown();\n };\n\n return { address, shutdown };\n };\n};\n\nconst getArgs = (): readonly string[] => globalThis.process.argv.slice(2);\n\nconst createNodeApp = (\n readyApp: RuntimeApp<readonly ConfiguredFeature[]>,\n shutdown: () => Promise<void>,\n args: readonly string[],\n): NodeApp => {\n const fetch = unsafeGetNamespacedCallable<HttpCapabilities['fetch']>(readyApp, 'http', 'fetch');\n const base: RuntimeApp<readonly ConfiguredFeature[]> & EnvironmentNodeAppPart = {\n ...readyApp,\n args,\n shutdown,\n };\n\n if (typeof fetch !== 'function') return base;\n return { ...base, listen: createListenForHttp(fetch, shutdown) };\n};\n\nexport function onNode<const F extends readonly ConfiguredFeature[]>(\n app: FeatureApp<F>,\n options?: NodeAppOptions,\n): Promise<NodeAppForFeatures<F>>;\n\n/** @throws {ZeltLifecycleStateError} */\nexport async function onNode(\n app: FeatureApp<readonly ConfiguredFeature[]>,\n options: NodeAppOptions = {},\n): Promise<NodeApp> {\n const readyApp = await app.createRuntime({\n fallbackConfigs: [NodeCliConfig, ProcessEnvAdaptor],\n warmup: options.warmup ?? true,\n });\n\n const cliConfig = await readyApp.get(NodeCliConfig);\n\n let shuttingDown = false;\n const detachSignals = (): void => {\n cliConfig.offSignal('SIGINT', gracefulShutdown);\n cliConfig.offSignal('SIGTERM', gracefulShutdown);\n };\n\n const shutdown = async (): Promise<void> => {\n if (shuttingDown) return;\n shuttingDown = true;\n try {\n await readyApp.shutdown();\n } finally {\n detachSignals();\n }\n };\n\n const gracefulShutdown = (): void => {\n void shutdown().catch(() => {});\n };\n\n cliConfig.onSignal('SIGINT', gracefulShutdown);\n cliConfig.onSignal('SIGTERM', gracefulShutdown);\n\n const args = getArgs();\n\n return createNodeApp(readyApp, shutdown, args);\n}\n","import type { ServerType } from '@hono/node-server';\nimport { serve } from '@hono/node-server';\n\nexport type ServeOptions = {\n port?: number;\n hostname?: string;\n};\n\nexport type AddressInfo = {\n port: number;\n address: string;\n};\n\ntype AppLike = {\n fetch: (request: Request) => Promise<Response>;\n};\n\nconst buildServeOptions = (\n optionsOrCallback: ServeOptions | ((info: AddressInfo) => void) | undefined,\n): ServeOptions => (typeof optionsOrCallback === 'function' ? {} : (optionsOrCallback ?? {}));\n\nconst extractCallback = (\n optionsOrCallback: ServeOptions | ((info: AddressInfo) => void) | undefined,\n maybeCallback: ((info: AddressInfo) => void) | undefined,\n): ((info: AddressInfo) => void) | undefined =>\n typeof optionsOrCallback === 'function' ? optionsOrCallback : maybeCallback;\n\nexport const serveApp = (\n app: AppLike,\n optionsOrCallback?: ServeOptions | ((info: AddressInfo) => void),\n maybeCallback?: (info: AddressInfo) => void,\n): ServerType => {\n const options = buildServeOptions(optionsOrCallback);\n const callback = extractCallback(optionsOrCallback, maybeCallback);\n\n return serve(\n {\n fetch: app.fetch,\n port: options.port ?? 3000,\n hostname: options.hostname ?? '0.0.0.0',\n },\n callback,\n );\n};\n"],"mappings":";;;;;;;;;;AAIA,IAAaE,gBAAb,cAAmCF,UAAAA;CACxBG,MAAc;AACrB,SAAOC,QAAQD,KAAG;;CAGXE,OAA0B;AACjC,SAAOD,QAAQC;;CAGRC,KAAKC,MAAqB;AACjCH,UAAQE,KAAKC,KAAAA;;CAGNC,YAAYD,MAAoB;AACvCH,UAAQK,WAAWF;;CAGZG,SAASC,QAAgBC,SAA8B;AAC9DR,UAAQS,GAAGF,QAAQC,QAAAA;;CAGZE,UAAUH,QAAgBC,SAA8B;AAC/DR,UAAQW,IAAIJ,QAAQC,QAAAA;;;;;;;;;;;;ACvBxB,IAAaM,oBAAb,cAAuCD,WAAAA;CAC5BE,IAAIC,KAAiC;AAC5C,SAAOC,QAAQC,IAAIF;;;;;;AC6CvB,MAAMO,uBACJC,UACAC,gBAAAA;AAEA,QAAO,OAAOC,kBAAAA;EACZ,MAAMC,gBACJ,OAAOD,kBAAkB,WAAW,EAAEE,MAAMF,eAAc,GAAKA,iBAAiB,EAAC;EAEnF,MA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;CAIJ,MAAME,yBAAmB;AAClBzB,YAAAA,CAAW0B,YAAM,GAAO;;AAG/BN,WAAUO,SAAS,UAAUF,iBAAAA;AAC7BL,WAAUO,SAAS,WAAWF,iBAAAA;AAI9B,QAAOhB,cAAcC,UAAUV,UAFlBI,SAE4BO,CAAAA;;;;AC5H3C,MAAMkB,qBACJC,sBACkB,OAAOA,sBAAsB,aAAa,EAAC,GAAKA,qBAAqB,EAAC;AAE1F,MAAMC,mBACJD,mBACAE,kBAEA,OAAOF,sBAAsB,aAAaA,oBAAoBE;AAEhE,MAAaC,YACXC,KACAJ,mBACAE,kBAAAA;CAEA,MAAMG,UAAUN,kBAAkBC,kBAAAA;CAClC,MAAMM,WAAWL,gBAAgBD,mBAAmBE,cAAAA;AAEpD,QAAOJ,MACL;EACES,OAAOH,IAAIG;EACXC,MAAMH,QAAQG,QAAQ;EACtBC,UAAUJ,QAAQI,YAAY;EAChC,EACAH,SAAAA"}
1
+ {"version":3,"file":"index.js","names":["CliConfig","Config","NodeCliConfig","cwd","process","argv","exit","code","setExitCode","exitCode","onSignal","signal","handler","on","offSignal","off","Config","EnvAdaptor","ProcessEnvAdaptor","get","key","process","env","serve","HttpFeature","NodeCliConfig","ProcessEnvAdaptor","createListenForHttp","appFetch","appShutdown","portOrOptions","listenOptions","port","hostname","server","serverReady","Promise","resolve","fetch","info","address","shutdown","reject","close","err","getArgs","globalThis","process","argv","slice","createNodeApp","readyApp","args","base","httpCaps","getFeatureCapabilities","listen","onNode","app","options","createRuntime","fallbackConfigs","warmup","cliConfig","get","runtimeShutdown","shuttingDown","detachSignals","offSignal","gracefulShutdown","catch","onSignal","serve","buildServeOptions","optionsOrCallback","extractCallback","maybeCallback","serveApp","app","options","callback","fetch","port","hostname"],"sources":["../src/node-cli.config.ts","../src/process-env.adaptor.ts","../src/on-node.ts","../src/serve.lib.ts"],"sourcesContent":["import type { Signal, SignalHandler } from '@zeltjs/core';\nimport { CliConfig, Config } from '@zeltjs/core';\n\n@Config\nexport class NodeCliConfig extends CliConfig {\n override cwd(): string {\n return process.cwd();\n }\n\n override argv(): readonly string[] {\n return process.argv;\n }\n\n override exit(code: number): never {\n process.exit(code);\n }\n\n override setExitCode(code: number): void {\n process.exitCode = code;\n }\n\n override onSignal(signal: Signal, handler: SignalHandler): void {\n process.on(signal, handler);\n }\n\n override offSignal(signal: Signal, handler: SignalHandler): void {\n process.off(signal, handler);\n }\n}\n","import { Config, EnvAdaptor } from '@zeltjs/core';\n\n@Config\nexport class ProcessEnvAdaptor extends EnvAdaptor {\n override get(key: string): string | undefined {\n return process.env[key];\n }\n}\n","import type { ServerType } from '@hono/node-server';\nimport { serve } from '@hono/node-server';\nimport type { ConfiguredFeature, FeatureApp, RuntimeApp } from '@zeltjs/core';\nimport { HttpFeature } from '@zeltjs/core';\n\nimport { NodeCliConfig } from './node-cli.config';\nimport { ProcessEnvAdaptor } from './process-env.adaptor';\n\ntype ListenOptions = {\n readonly port?: number;\n readonly hostname?: string;\n};\n\nexport type ServerHandle = {\n readonly address: { port: number; address: string };\n readonly shutdown: () => Promise<void>;\n};\n\nexport type NodeAppOptions = {\n readonly warmup?: boolean;\n};\n\nexport type { ExecResult } from '@zeltjs/core';\n\ntype EnvironmentNodeAppPart = {\n readonly args: readonly string[];\n readonly shutdown: () => Promise<void>;\n};\n\ntype HttpNodeAppPart = {\n readonly listen: (portOrOptions?: number | ListenOptions) => Promise<ServerHandle>;\n};\n\nexport type NodeApp = (RuntimeApp<readonly ConfiguredFeature[]> & EnvironmentNodeAppPart) &\n Partial<HttpNodeAppPart>;\n\ntype HasFeatureClass<F extends readonly ConfiguredFeature[], TFeature extends ConfiguredFeature> =\n Extract<F[number], TFeature> extends never ? false : true;\n\ntype WithFeatureClass<\n F extends readonly ConfiguredFeature[],\n TFeature extends ConfiguredFeature,\n TPart extends object,\n> = HasFeatureClass<F, TFeature> extends true ? TPart : unknown;\n\ntype NodeAppForFeatures<F extends readonly ConfiguredFeature[]> = RuntimeApp<F> &\n EnvironmentNodeAppPart &\n (number extends F['length']\n ? Partial<HttpNodeAppPart>\n : WithFeatureClass<F, HttpFeature, HttpNodeAppPart>);\n\nconst createListenForHttp = (\n appFetch: (request: Request) => Promise<Response>,\n appShutdown: () => Promise<void>,\n): ((portOrOptions?: number | ListenOptions) => Promise<ServerHandle>) => {\n return async (portOrOptions?: number | ListenOptions): Promise<ServerHandle> => {\n const listenOptions: ListenOptions =\n typeof portOrOptions === 'number' ? { port: portOrOptions } : (portOrOptions ?? {});\n\n const port = listenOptions.port ?? 3000;\n const hostname = listenOptions.hostname ?? '0.0.0.0';\n\n let server!: ServerType;\n const serverReady = new Promise<{ port: number; address: string }>((resolve) => {\n server = serve({ fetch: appFetch, port, hostname }, (info) =>\n resolve({ port: info.port, address: info.address }),\n );\n });\n\n const address = await serverReady;\n\n const shutdown = async (): Promise<void> => {\n await new Promise<void>((resolve, reject) => {\n server.close((err) => (err ? reject(err) : resolve()));\n });\n await appShutdown();\n };\n\n return { address, shutdown };\n };\n};\n\nconst getArgs = (): readonly string[] => globalThis.process.argv.slice(2);\n\nconst createNodeApp = (\n readyApp: RuntimeApp<readonly ConfiguredFeature[]>,\n shutdown: () => Promise<void>,\n args: readonly string[],\n): NodeApp => {\n const base: RuntimeApp<readonly ConfiguredFeature[]> & EnvironmentNodeAppPart = {\n ...readyApp,\n args,\n shutdown,\n };\n\n const httpCaps = readyApp.getFeatureCapabilities(HttpFeature);\n if (!httpCaps) return base;\n return {\n ...base,\n listen: createListenForHttp(httpCaps.fetch, shutdown),\n };\n};\n\nexport function onNode<const F extends readonly ConfiguredFeature[]>(\n app: FeatureApp<F>,\n options?: NodeAppOptions,\n): Promise<NodeAppForFeatures<F>>;\n\n/** @throws {ZeltLifecycleStateError} */\nexport async function onNode<const F extends readonly ConfiguredFeature[]>(\n app: FeatureApp<F>,\n options: NodeAppOptions = {},\n): Promise<NodeApp> {\n const readyApp = await app.createRuntime({\n fallbackConfigs: [NodeCliConfig, ProcessEnvAdaptor],\n warmup: options.warmup ?? true,\n });\n\n const cliConfig = await readyApp.get(NodeCliConfig);\n const runtimeShutdown = readyApp.shutdown;\n\n let shuttingDown = false;\n const detachSignals = (): void => {\n cliConfig.offSignal('SIGINT', gracefulShutdown);\n cliConfig.offSignal('SIGTERM', gracefulShutdown);\n };\n\n const shutdown = async (): Promise<void> => {\n if (shuttingDown) return;\n shuttingDown = true;\n try {\n await runtimeShutdown();\n } finally {\n detachSignals();\n }\n };\n\n const gracefulShutdown = (): void => {\n void shutdown().catch(() => {});\n };\n\n cliConfig.onSignal('SIGINT', gracefulShutdown);\n cliConfig.onSignal('SIGTERM', gracefulShutdown);\n\n const args = getArgs();\n\n return createNodeApp(readyApp, shutdown, args);\n}\n","import type { ServerType } from '@hono/node-server';\nimport { serve } from '@hono/node-server';\n\nexport type ServeOptions = {\n port?: number;\n hostname?: string;\n};\n\nexport type AddressInfo = {\n port: number;\n address: string;\n};\n\ntype AppLike = {\n fetch: (request: Request) => Promise<Response>;\n};\n\nconst buildServeOptions = (\n optionsOrCallback: ServeOptions | ((info: AddressInfo) => void) | undefined,\n): ServeOptions => (typeof optionsOrCallback === 'function' ? {} : (optionsOrCallback ?? {}));\n\nconst extractCallback = (\n optionsOrCallback: ServeOptions | ((info: AddressInfo) => void) | undefined,\n maybeCallback: ((info: AddressInfo) => void) | undefined,\n): ((info: AddressInfo) => void) | undefined =>\n typeof optionsOrCallback === 'function' ? optionsOrCallback : maybeCallback;\n\nexport const serveApp = (\n app: AppLike,\n optionsOrCallback?: ServeOptions | ((info: AddressInfo) => void),\n maybeCallback?: (info: AddressInfo) => void,\n): ServerType => {\n const options = buildServeOptions(optionsOrCallback);\n const callback = extractCallback(optionsOrCallback, maybeCallback);\n\n return serve(\n {\n fetch: app.fetch,\n port: options.port ?? 3000,\n hostname: options.hostname ?? '0.0.0.0',\n },\n callback,\n );\n};\n"],"mappings":";;;;;;;;;AAIA,IAAaE,gBAAb,cAAmCF,UAAAA;CACxBG,MAAc;AACrB,SAAOC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node",
3
- "version": "0.8.2-canary.0",
3
+ "version": "0.8.2-canary.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,24 +13,33 @@
13
13
  },
14
14
  "exports": {
15
15
  ".": {
16
- "types": "./dist/index.d.ts",
17
- "import": "./dist/index.js"
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.cts",
22
+ "default": "./dist/index.cjs"
23
+ }
18
24
  }
19
25
  },
20
26
  "files": [
21
27
  "dist"
22
28
  ],
23
29
  "dependencies": {
24
- "@hono/node-server": "2.0.1",
25
- "@zeltjs/core": "0.8.2-canary.0",
26
- "@zeltjs/unsafe-type-lib": "0.8.2-canary.0"
30
+ "@hono/node-server": "2.0.1"
31
+ },
32
+ "peerDependencies": {
33
+ "@zeltjs/core": "0.8.2-canary.2"
27
34
  },
28
35
  "devDependencies": {
29
- "@types/node": "22.19.17"
36
+ "@types/node": "22.19.17",
37
+ "@zeltjs/core": "0.8.2-canary.2"
30
38
  },
31
39
  "volta": {
32
40
  "extends": "../../package.json"
33
41
  },
42
+ "main": "./dist/index.cjs",
34
43
  "scripts": {
35
44
  "build": "tsdown",
36
45
  "test": "vitest run",