configorama 0.6.16 → 0.6.17

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configorama",
3
- "version": "0.6.16",
3
+ "version": "0.6.17",
4
4
  "description": "Variable support for configuration files",
5
5
  "main": "src/index.js",
6
6
  "types": "index.d.ts",
package/src/index.js CHANGED
@@ -42,6 +42,20 @@ module.exports = async (configPathOrObject, settings = {}) => {
42
42
  instance.variableTypes
43
43
  )
44
44
 
45
+ // Collect custom metadata from variable sources that have collectMetadata
46
+ if (settings.variableSources && Array.isArray(settings.variableSources)) {
47
+ for (const source of settings.variableSources) {
48
+ if (typeof source.collectMetadata === 'function') {
49
+ const customData = source.collectMetadata()
50
+ if (customData !== undefined && customData !== null) {
51
+ // Use source.metadataKey if specified, otherwise default to `${type}References`
52
+ const metadataKey = source.metadataKey || `${source.type}References`
53
+ enrichedMetadata[metadataKey] = customData
54
+ }
55
+ }
56
+ }
57
+ }
58
+
45
59
  return {
46
60
  variableSyntax: instance.variableSyntax,
47
61
  variableTypes: instance.variableTypes,