@tramvai/module-server 6.78.0 → 6.78.1

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.
@@ -41,7 +41,7 @@ More information about redirects - https://tramvai.dev/docs/features/routing/red
41
41
  });
42
42
  reply
43
43
  .header('cache-control', 'no-store, no-cache, must-revalidate')
44
- .redirect(error.httpStatus || 307, error.nextUrl);
44
+ .redirect(error.nextUrl, error.httpStatus || 307);
45
45
  return;
46
46
  }
47
47
  const { logMessage, logLevel, logEvent, httpStatus } = prepareLogsForError({
@@ -49,7 +49,7 @@ More information about redirects - https://tramvai.dev/docs/features/routing/red
49
49
  });
50
50
  reply
51
51
  .header('cache-control', 'no-store, no-cache, must-revalidate')
52
- .redirect(error.httpStatus || 307, error.nextUrl);
52
+ .redirect(error.nextUrl, error.httpStatus || 307);
53
53
  return;
54
54
  }
55
55
  const { logMessage, logLevel, logEvent, httpStatus } = prepareLogsForError.prepareLogsForError({
@@ -11,7 +11,7 @@ const staticAppCommand = ({ logger, envManager, appInfo, }) => {
11
11
  const log = logger('server:static');
12
12
  const port = +envManager.get('PORT_STATIC');
13
13
  const host = (envManager.get('HOST_STATIC') ?? DEFAULT_STATIC_HOST).replace('localhost', '0.0.0.0');
14
- const appVersion = envManager.get('APP_VERSION');
14
+ const appVersion = envManager.get('APP_VERSION') ?? 'unknown';
15
15
  return async function staticApp() {
16
16
  const appStatic = fastify();
17
17
  await appStatic.register(fastifyCompress);
@@ -26,7 +26,15 @@ const staticAppCommand = ({ logger, envManager, appInfo, }) => {
26
26
  res.setHeader('X-Host', os.hostname());
27
27
  },
28
28
  });
29
- appStatic.listen({ host, port }, () => log.info(`Running static server on ${host}:${port}`));
29
+ let resolveStaticServerStart;
30
+ const staticServerWaiter = new Promise((resolve) => {
31
+ resolveStaticServerStart = resolve;
32
+ });
33
+ appStatic.listen({ host, port }, () => {
34
+ log.info(`Running static server on ${host}:${port}`);
35
+ resolveStaticServerStart();
36
+ });
37
+ await staticServerWaiter;
30
38
  return appStatic;
31
39
  };
32
40
  };
@@ -21,7 +21,7 @@ const staticAppCommand = ({ logger, envManager, appInfo, }) => {
21
21
  const log = logger('server:static');
22
22
  const port = +envManager.get('PORT_STATIC');
23
23
  const host = (envManager.get('HOST_STATIC') ?? DEFAULT_STATIC_HOST).replace('localhost', '0.0.0.0');
24
- const appVersion = envManager.get('APP_VERSION');
24
+ const appVersion = envManager.get('APP_VERSION') ?? 'unknown';
25
25
  return async function staticApp() {
26
26
  const appStatic = fastify__default["default"]();
27
27
  await appStatic.register(fastifyCompress__default["default"]);
@@ -36,7 +36,15 @@ const staticAppCommand = ({ logger, envManager, appInfo, }) => {
36
36
  res.setHeader('X-Host', os__default["default"].hostname());
37
37
  },
38
38
  });
39
- appStatic.listen({ host, port }, () => log.info(`Running static server on ${host}:${port}`));
39
+ let resolveStaticServerStart;
40
+ const staticServerWaiter = new Promise((resolve) => {
41
+ resolveStaticServerStart = resolve;
42
+ });
43
+ appStatic.listen({ host, port }, () => {
44
+ log.info(`Running static server on ${host}:${port}`);
45
+ resolveStaticServerStart();
46
+ });
47
+ await staticServerWaiter;
40
48
  return appStatic;
41
49
  };
42
50
  };
@@ -8,7 +8,9 @@ import type { DI_TOKEN, ExtractDependencyType } from '@tinkoff/dippy';
8
8
  import type { STATIC_ROOT_ERROR_BOUNDARY_ERROR_TOKEN } from '@tramvai/tokens-server';
9
9
  export declare const webAppFactory: ({ server }: {
10
10
  server: typeof SERVER_TOKEN;
11
- }) => 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>>;
11
+ }) => 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>> & {
12
+ __linterBrands: "SafePromiseLike";
13
+ };
12
14
  export declare const webAppInitCommand: ({ app, logger, commandLineRunner, executionContextManager, beforeInit, requestMetrics, limiterRequest, init, afterInit, beforeError, afterError, fetchWebpackStats, staticRootErrorBoundaryError, rootDi, asyncLocalStorage, }: {
13
15
  app: ExtractDependencyType<typeof WEB_FASTIFY_APP_TOKEN>;
14
16
  logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-server",
3
- "version": "6.78.0",
3
+ "version": "6.78.1",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -21,38 +21,38 @@
21
21
  "watch": "tsc -w"
22
22
  },
23
23
  "dependencies": {
24
- "@fastify/compress": "^6.2.0",
25
- "@fastify/cookie": "^8.3.0",
26
- "@fastify/formbody": "^7.4.0",
27
- "@fastify/static": "^6.9.0",
24
+ "@fastify/compress": "^8.3.0",
25
+ "@fastify/cookie": "^11.0.2",
26
+ "@fastify/formbody": "^8.0.2",
27
+ "@fastify/static": "^8.3.0",
28
28
  "@loadable/server": "^5.15.0",
29
29
  "@tinkoff/errors": "0.7.2",
30
30
  "@tinkoff/monkeypatch": "6.0.1",
31
31
  "@tinkoff/terminus": "0.5.3",
32
32
  "@tinkoff/url": "0.12.2",
33
- "@tramvai/module-cache-warmup": "6.78.0",
34
- "@tramvai/module-metrics": "6.78.0",
35
- "@tramvai/papi": "6.78.0",
33
+ "@tramvai/module-cache-warmup": "6.78.1",
34
+ "@tramvai/module-metrics": "6.78.1",
35
+ "@tramvai/papi": "6.78.1",
36
36
  "@tramvai/safe-strings": "0.9.1",
37
- "@tramvai/tokens-router": "6.78.0",
38
- "@tramvai/tokens-server": "6.78.0",
39
- "@tramvai/tokens-server-private": "6.78.0",
37
+ "@tramvai/tokens-router": "6.78.1",
38
+ "@tramvai/tokens-server": "6.78.1",
39
+ "@tramvai/tokens-server-private": "6.78.1",
40
40
  "afterframe": "^1.0.2",
41
- "fastify": "^4.14.1",
41
+ "fastify": "^5.6.2",
42
42
  "http-proxy-middleware": "^2.0.2",
43
43
  "undici": "^7.16.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@tinkoff/dippy": "0.12.6",
47
47
  "@tinkoff/utils": "^2.1.2",
48
- "@tramvai/cli": "6.78.0",
49
- "@tramvai/core": "6.78.0",
50
- "@tramvai/module-common": "6.78.0",
51
- "@tramvai/module-environment": "6.78.0",
52
- "@tramvai/react": "6.78.0",
53
- "@tramvai/tokens-common": "6.78.0",
54
- "@tramvai/tokens-core-private": "6.78.0",
55
- "@tramvai/tokens-render": "6.78.0",
48
+ "@tramvai/cli": "6.78.1",
49
+ "@tramvai/core": "6.78.1",
50
+ "@tramvai/module-common": "6.78.1",
51
+ "@tramvai/module-environment": "6.78.1",
52
+ "@tramvai/react": "6.78.1",
53
+ "@tramvai/tokens-common": "6.78.1",
54
+ "@tramvai/tokens-core-private": "6.78.1",
55
+ "@tramvai/tokens-render": "6.78.1",
56
56
  "react": ">=16.14.0",
57
57
  "react-dom": ">=16.14.0",
58
58
  "tslib": "^2.4.0"