@naturalcycles/backend-lib 9.56.0 → 9.57.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.
@@ -1,3 +1,4 @@
1
+ import { loadEnvFileIfExists } from '@naturalcycles/nodejs-lib';
1
2
  import { dimGrey } from '@naturalcycles/nodejs-lib/colors';
2
3
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
3
4
  import { kpySync } from '@naturalcycles/nodejs-lib/kpy';
@@ -52,7 +53,7 @@ const DEFAULT_FILES = [
52
53
  ];
53
54
  const defaultFilesDir = `${srcDir}/deploy/files-default`;
54
55
  export async function deployPrepare(opt = {}) {
55
- await import('dotenv/config'); // ensure .env is loaded
56
+ loadEnvFileIfExists();
56
57
  const { projectDir = '.', targetDir = './tmp/deploy', createNpmrc = true } = opt;
57
58
  const backendCfg = getBackendCfg(projectDir);
58
59
  const inputPatterns = backendCfg.files || DEFAULT_FILES;
@@ -64,11 +64,8 @@ export function compressionMiddleware(options) {
64
64
  let length;
65
65
  let listeners = [];
66
66
  let stream;
67
- // oxlint-disable-next-line typescript/unbound-method -- monkey-patching, rebound via .call()
68
67
  const _end = res.end;
69
- // oxlint-disable-next-line typescript/unbound-method -- monkey-patching, rebound via .call()
70
68
  const _on = res.on;
71
- // oxlint-disable-next-line typescript/unbound-method -- monkey-patching, rebound via .call()
72
69
  const _write = res.write;
73
70
  res.flush = function flush() {
74
71
  if (stream) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
3
  "type": "module",
4
- "version": "9.56.0",
4
+ "version": "9.57.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/db-lib": "^10",
7
7
  "@naturalcycles/js-lib": "^15",
@@ -17,7 +17,6 @@
17
17
  "compressible": "^2",
18
18
  "cookie-parser": "^1",
19
19
  "cors": "^2",
20
- "dotenv": "^17",
21
20
  "express": "^5",
22
21
  "helmet": "^8",
23
22
  "negotiator": "^1",
@@ -1,3 +1,4 @@
1
+ import { loadEnvFileIfExists } from '@naturalcycles/nodejs-lib'
1
2
  import { dimGrey } from '@naturalcycles/nodejs-lib/colors'
2
3
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2'
3
4
  import { kpySync } from '@naturalcycles/nodejs-lib/kpy'
@@ -69,7 +70,7 @@ const DEFAULT_FILES = [
69
70
  const defaultFilesDir = `${srcDir}/deploy/files-default`
70
71
 
71
72
  export async function deployPrepare(opt: DeployPrepareOptions = {}): Promise<DeployInfo> {
72
- await import('dotenv/config') // ensure .env is loaded
73
+ loadEnvFileIfExists()
73
74
 
74
75
  const { projectDir = '.', targetDir = './tmp/deploy', createNpmrc = true } = opt
75
76
 
@@ -114,11 +114,8 @@ export function compressionMiddleware(options?: CompressionOptions): BackendRequ
114
114
  let listeners: [string, (...args: any[]) => void][] | null = []
115
115
  let stream: zlib.Gzip | zlib.Deflate | zlib.BrotliCompress | zlib.ZstdCompress | undefined
116
116
 
117
- // oxlint-disable-next-line typescript/unbound-method -- monkey-patching, rebound via .call()
118
117
  const _end = res.end
119
- // oxlint-disable-next-line typescript/unbound-method -- monkey-patching, rebound via .call()
120
118
  const _on = res.on
121
- // oxlint-disable-next-line typescript/unbound-method -- monkey-patching, rebound via .call()
122
119
  const _write = res.write
123
120
 
124
121
  // flush