@tramvai/module-server 2.148.0 → 2.149.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.
@@ -8,7 +8,7 @@ export declare const papiExecutorProvider: import("@tinkoff/dippy").Provider<{
8
8
  }) => import("@tramvai/tokens-common").Logger) & {
9
9
  __type?: "base token";
10
10
  };
11
- fastifyRequest: import("fastify").FastifyRequest<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("node:http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>> & {
11
+ fastifyRequest: import("fastify").FastifyRequest<import("fastify").RouteGenericInterface, import("fastify").RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>> & {
12
12
  cookies: Record<string, string>;
13
13
  } & {
14
14
  __type?: "base token";
@@ -4,4 +4,4 @@ export declare const staticAppCommand: ({ logger, envManager, appInfo, }: {
4
4
  logger: typeof LOGGER_TOKEN;
5
5
  envManager: typeof ENV_MANAGER_TOKEN;
6
6
  appInfo: typeof APP_INFO_TOKEN;
7
- }) => () => void;
7
+ }) => (() => Promise<void>) | (() => Promise<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>);
@@ -3,12 +3,15 @@ import fastifyCompress from '@fastify/compress';
3
3
  import { fastifyStatic } from '@fastify/static';
4
4
  import os from 'os';
5
5
 
6
+ const DEFAULT_STATIC_HOST = 'localhost';
6
7
  const staticAppCommand = ({ logger, envManager, appInfo, }) => {
8
+ var _a;
7
9
  if (!envManager.get('DEV_STATIC')) {
8
- return function staticAppNoop() { };
10
+ return async function staticAppNoop() { };
9
11
  }
10
12
  const log = logger('server:static');
11
13
  const port = +envManager.get('PORT_STATIC');
14
+ const host = ((_a = envManager.get('HOST_STATIC')) !== null && _a !== void 0 ? _a : DEFAULT_STATIC_HOST).replace('localhost', '0.0.0.0');
12
15
  const appVersion = envManager.get('APP_VERSION');
13
16
  return async function staticApp() {
14
17
  const appStatic = fastify();
@@ -24,7 +27,7 @@ const staticAppCommand = ({ logger, envManager, appInfo, }) => {
24
27
  res.setHeader('X-Host', os.hostname());
25
28
  },
26
29
  });
27
- appStatic.listen({ port }, () => log.info(`Running static server on port: ${port}`));
30
+ appStatic.listen({ host, port }, () => log.info(`Running static server on ${host}:${port}`));
28
31
  return appStatic;
29
32
  };
30
33
  };
@@ -13,12 +13,15 @@ var fastify__default = /*#__PURE__*/_interopDefaultLegacy(fastify);
13
13
  var fastifyCompress__default = /*#__PURE__*/_interopDefaultLegacy(fastifyCompress);
14
14
  var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
15
15
 
16
+ const DEFAULT_STATIC_HOST = 'localhost';
16
17
  const staticAppCommand = ({ logger, envManager, appInfo, }) => {
18
+ var _a;
17
19
  if (!envManager.get('DEV_STATIC')) {
18
- return function staticAppNoop() { };
20
+ return async function staticAppNoop() { };
19
21
  }
20
22
  const log = logger('server:static');
21
23
  const port = +envManager.get('PORT_STATIC');
24
+ const host = ((_a = envManager.get('HOST_STATIC')) !== null && _a !== void 0 ? _a : DEFAULT_STATIC_HOST).replace('localhost', '0.0.0.0');
22
25
  const appVersion = envManager.get('APP_VERSION');
23
26
  return async function staticApp() {
24
27
  const appStatic = fastify__default["default"]();
@@ -34,7 +37,7 @@ const staticAppCommand = ({ logger, envManager, appInfo, }) => {
34
37
  res.setHeader('X-Host', os__default["default"].hostname());
35
38
  },
36
39
  });
37
- appStatic.listen({ port }, () => log.info(`Running static server on port: ${port}`));
40
+ appStatic.listen({ host, port }, () => log.info(`Running static server on ${host}:${port}`));
38
41
  return appStatic;
39
42
  };
40
43
  };
@@ -6,7 +6,7 @@ import { type FETCH_WEBPACK_STATS_TOKEN } from '@tramvai/tokens-render';
6
6
  import type { ExtractDependencyType } from '@tinkoff/dippy';
7
7
  export declare const webAppFactory: ({ server }: {
8
8
  server: typeof SERVER_TOKEN;
9
- }) => import("fastify").FastifyInstance<import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> & PromiseLike<import("fastify").FastifyInstance<import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>, import("node:http").IncomingMessage, import("node:http").ServerResponse<import("node:http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
9
+ }) => import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault> & PromiseLike<import("fastify").FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
10
10
  export declare const webAppInitCommand: ({ app, logger, commandLineRunner, executionContextManager, beforeInit, requestMetrics, limiterRequest, init, afterInit, beforeError, afterError, fetchWebpackStats, }: {
11
11
  app: ExtractDependencyType<typeof WEB_FASTIFY_APP_TOKEN>;
12
12
  logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
package/lib/server.es.js CHANGED
@@ -143,6 +143,7 @@ ServerModule = __decorate([
143
143
  useValue: [
144
144
  { key: 'DEV_STATIC', optional: true, dehydrate: false },
145
145
  { key: 'PORT_STATIC', optional: true, dehydrate: false, value: 4000 },
146
+ { key: 'HOST_STATIC', optional: true, dehydrate: false, value: 'localhost' },
146
147
  { key: 'PORT', optional: true, dehydrate: false, value: 3000 },
147
148
  {
148
149
  key: 'APP_VERSION',
package/lib/server.js CHANGED
@@ -150,6 +150,7 @@ exports.ServerModule = tslib.__decorate([
150
150
  useValue: [
151
151
  { key: 'DEV_STATIC', optional: true, dehydrate: false },
152
152
  { key: 'PORT_STATIC', optional: true, dehydrate: false, value: 4000 },
153
+ { key: 'HOST_STATIC', optional: true, dehydrate: false, value: 'localhost' },
153
154
  { key: 'PORT', optional: true, dehydrate: false, value: 3000 },
154
155
  {
155
156
  key: 'APP_VERSION',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-server",
3
- "version": "2.148.0",
3
+ "version": "2.149.0",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -25,11 +25,11 @@
25
25
  "@tinkoff/monkeypatch": "2.0.5",
26
26
  "@tinkoff/terminus": "0.1.9",
27
27
  "@tinkoff/url": "0.8.6",
28
- "@tramvai/module-cache-warmup": "2.148.0",
29
- "@tramvai/module-metrics": "2.148.0",
30
- "@tramvai/papi": "2.148.0",
31
- "@tramvai/tokens-server": "2.148.0",
32
- "@tramvai/tokens-server-private": "2.148.0",
28
+ "@tramvai/module-cache-warmup": "2.149.0",
29
+ "@tramvai/module-metrics": "2.149.0",
30
+ "@tramvai/papi": "2.149.0",
31
+ "@tramvai/tokens-server": "2.149.0",
32
+ "@tramvai/tokens-server-private": "2.149.0",
33
33
  "@tramvai/safe-strings": "0.5.12",
34
34
  "fastify": "^4.14.1",
35
35
  "@fastify/cookie": "^8.3.0",
@@ -42,14 +42,14 @@
42
42
  "peerDependencies": {
43
43
  "@tinkoff/dippy": "0.8.15",
44
44
  "@tinkoff/utils": "^2.1.2",
45
- "@tramvai/cli": "2.148.0",
46
- "@tramvai/core": "2.148.0",
47
- "@tramvai/react": "2.148.0",
48
- "@tramvai/module-common": "2.148.0",
49
- "@tramvai/module-environment": "2.148.0",
50
- "@tramvai/tokens-common": "2.148.0",
51
- "@tramvai/tokens-core-private": "2.148.0",
52
- "@tramvai/tokens-render": "2.148.0",
45
+ "@tramvai/cli": "2.149.0",
46
+ "@tramvai/core": "2.149.0",
47
+ "@tramvai/react": "2.149.0",
48
+ "@tramvai/module-common": "2.149.0",
49
+ "@tramvai/module-environment": "2.149.0",
50
+ "@tramvai/tokens-common": "2.149.0",
51
+ "@tramvai/tokens-core-private": "2.149.0",
52
+ "@tramvai/tokens-render": "2.149.0",
53
53
  "react": ">=16.14.0",
54
54
  "react-dom": ">=16.14.0",
55
55
  "tslib": "^2.4.0"