@jsnw/srv-utils 1.0.9 → 1.0.10

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.
@@ -110,15 +110,25 @@ class ConfigLoader {
110
110
  const node = nodesToVisit[i];
111
111
  if (typeof node !== 'object' || Array.isArray(node))
112
112
  continue;
113
- if (node['$include'] && typeof node['$include'] === 'string') {
114
- const [loadedYaml, loadError] = this.loadYamlFile(this.resolveIncludePath(mainYamlDirname, node['$include']));
115
- delete node['$include'];
116
- if (loadError) {
117
- errors.push(loadError);
113
+ if (node['$include']) {
114
+ const $includePaths = [];
115
+ if (typeof node['$include'] === 'string') {
116
+ $includePaths.push(node['$include']);
117
+ }
118
+ else if (Array.isArray(node['$include'])) {
119
+ $includePaths.push(...(node['$include']
120
+ .filter(v => v && typeof v === 'string' && v.trim() !== '')));
118
121
  }
119
- else {
120
- for (const [k, v] of Object.entries(loadedYaml))
121
- node[k] = v;
122
+ delete node['$include'];
123
+ for (const path of $includePaths) {
124
+ const [loadedYaml, loadError] = this.loadYamlFile(this.resolveIncludePath(mainYamlDirname, path));
125
+ if (loadError) {
126
+ errors.push(loadError);
127
+ }
128
+ else {
129
+ for (const [k, v] of Object.entries(loadedYaml))
130
+ node[k] = v;
131
+ }
122
132
  }
123
133
  }
124
134
  for (const k of Object.keys(node)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnw/srv-utils",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Server-side utilities for Node.js/TypeScript: tsconfig paths, Nest helpers, and config loading.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",