@tsed/config 8.43.0 → 8.43.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.
@@ -1,4 +1,4 @@
1
- import JsYaml from "js-yaml";
1
+ import { load } from "js-yaml";
2
2
  import { existsSync, readFileSync, watch } from "node:fs";
3
3
  import { logger } from "@tsed/di";
4
4
  export class YamlConfigSource {
@@ -11,7 +11,11 @@ export class YamlConfigSource {
11
11
  }
12
12
  // Read the file
13
13
  const fileContent = readFileSync(path, encoding);
14
- return ((await JsYaml.load(fileContent, opts)) || {});
14
+ // js-yaml v5 throws on a document without content (empty file, comments only)
15
+ if (!fileContent.replace(/^\s*(#.*)?$/gm, "").trim()) {
16
+ return {};
17
+ }
18
+ return ((await load(fileContent, opts)) || {});
15
19
  }
16
20
  watch(onChange) {
17
21
  const { path } = this.options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/config",
3
- "version": "8.43.0",
3
+ "version": "8.43.2",
4
4
  "description": "Configuration management for Ts.ED",
5
5
  "keywords": [
6
6
  "Config",
@@ -70,25 +70,26 @@
70
70
  "tslib": ">=2.7.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@tsed/barrels": "8.43.0",
74
- "@tsed/core": "8.43.0",
75
- "@tsed/di": "8.43.0",
76
- "@tsed/typescript": "8.43.0",
77
- "@types/js-yaml": "4.0.9",
78
- "dotenv": "^16.5.0",
79
- "dotenv-expand": "^12.0.2",
73
+ "@tsed/barrels": "8.43.2",
74
+ "@tsed/core": "8.43.2",
75
+ "@tsed/di": "8.43.2",
76
+ "@tsed/typescript": "8.43.2",
77
+ "dotenv": "^18.0.2",
78
+ "dotenv-expand": "^1000.0.0",
80
79
  "dotenv-flow": "^4.1.0",
80
+ "globby": "^16.2.4",
81
+ "js-yaml": "^5.4.2",
81
82
  "typescript": "6.0.2",
82
83
  "vitest": "4.1.4"
83
84
  },
84
85
  "peerDependencies": {
85
86
  "@tsed/core": ">=8.0.0",
86
87
  "@tsed/di": ">=8.0.0",
87
- "dotenv": "^16.5.0",
88
- "dotenv-expand": "^12.0.2",
89
- "dotenv-flow": "^4.1.0",
90
- "globby": "^14.1.0",
91
- "js-yaml": "^4.1.0"
88
+ "dotenv": ">=16.5.0",
89
+ "dotenv-expand": ">=12.0.2",
90
+ "dotenv-flow": ">=4.1.0",
91
+ "globby": ">=14.1.0",
92
+ "js-yaml": ">=5.0.0"
92
93
  },
93
94
  "peerDependenciesMeta": {
94
95
  "@tsed/core": {