configorama 0.9.17 → 0.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configorama",
3
- "version": "0.9.17",
3
+ "version": "0.10.2",
4
4
  "description": "Variable support for configuration files",
5
5
  "main": "src/index.js",
6
6
  "types": "index.d.ts",
@@ -71,16 +71,19 @@
71
71
  "devDependencies": {
72
72
  "@cdktf/hcl2json": "^0.21.0",
73
73
  "@types/node": "^24.10.1",
74
- "markdown-magic": "^3.4.0",
74
+ "markdown-magic": "^4.8.0",
75
75
  "tsx": "^4.7.0",
76
76
  "typescript": "^5.8.3",
77
77
  "uvu": "^0.5.6",
78
78
  "watchlist": "^0.3.1"
79
79
  },
80
+ "overrides": {
81
+ "lodash": "^4.18.1"
82
+ },
80
83
  "peerDependencies": {
81
84
  "@cdktf/hcl2json": ">=0.20.0",
82
- "tsx": ">=4.0.0",
83
- "ts-node": ">=10.0.0"
85
+ "ts-node": ">=10.0.0",
86
+ "tsx": ">=4.0.0"
84
87
  },
85
88
  "peerDependenciesMeta": {
86
89
  "@cdktf/hcl2json": {
package/src/main.js CHANGED
@@ -8,7 +8,37 @@ console.log = () => {}
8
8
  /** */
9
9
  /* External dependencies */
10
10
  const findUp = require('find-up')
11
- const traverse = require('traverse')
11
+ /**
12
+ * Pre-order DFS walk that mimics the subset of `traverse(obj).forEach(fn)`
13
+ * we actually use: only `this.path` and `this.update(v)`. ~2x faster than
14
+ * the `traverse` package because it avoids the per-node State object alloc.
15
+ *
16
+ * @param {*} root
17
+ * @param {Function} callback - called with `this = {path, update}` per node
18
+ */
19
+ function walkAndUpdate(root, callback) {
20
+ function visit(value, path, parent, key) {
21
+ const ctx = {
22
+ path,
23
+ update(newValue) { if (parent !== null) parent[key] = newValue }
24
+ }
25
+ callback.call(ctx, value)
26
+ // Re-read in case callback mutated the slot
27
+ const current = parent === null ? root : parent[key]
28
+ if (current !== null && typeof current === 'object') {
29
+ // Use Object.keys for both arrays and objects so sparse-array holes are
30
+ // skipped, matching the `traverse` package's behavior.
31
+ const keys = Object.keys(current)
32
+ const isArr = Array.isArray(current)
33
+ for (let i = 0; i < keys.length; i++) {
34
+ const k = keys[i]
35
+ const idx = isArr ? Number(k) : k
36
+ visit(current[k], path.concat(idx), current, k)
37
+ }
38
+ }
39
+ }
40
+ visit(root, [], null, null)
41
+ }
12
42
  const dotProp = require('dot-prop')
13
43
  /* Utils - root */
14
44
  const {
@@ -158,6 +188,22 @@ class Configorama {
158
188
  this.filterCache = {}
159
189
  // Cache for originalValue lookups (perf: avoid repeated dotProp.get)
160
190
  this._originalValueCache = new Map()
191
+ // Paths whose current value is a literal with no variables — skip rebuilding
192
+ // their leaf object on every subsequent populateObjectImpl iteration.
193
+ this._resolvedPaths = new Set()
194
+ // Cache raw file contents per absolute path so repeated ${file:...} refs
195
+ // to the same file (e.g., merged twice into different keys) don't reread.
196
+ this._fileContentCache = new Map()
197
+
198
+ // rawOriginalConfig (a pre-preProcess snapshot) is only consumed by metadata
199
+ // display paths. Skipping the cloneDeep when none of those paths are active
200
+ // saves ~10-15ms per init.
201
+ const showFound = this.settings.dynamicArgs && (this.settings.dynamicArgs.list || this.settings.dynamicArgs.info)
202
+ this._needsRawClone = !!(
203
+ this.settings.returnMetadata ||
204
+ this.settings.returnPreResolvedVariableDetails ||
205
+ VERBOSE || SETUP_MODE || showFound
206
+ )
161
207
 
162
208
  this.foundVariables = []
163
209
  this.fileRefsFound = []
@@ -188,6 +234,10 @@ class Configorama {
188
234
  }
189
235
  const variableSyntax = varRegex
190
236
  this.variableSyntax = variableSyntax
237
+ // Non-global twin for cheap boolean checks: `.test()` on a global regex
238
+ // would advance lastIndex between calls, and `.match()` on a global regex
239
+ // allocates an array of every match. Use this whenever we only need truthy.
240
+ this.variableSyntaxTest = new RegExp(variableSyntax.source, variableSyntax.flags.replace('g', ''))
191
241
 
192
242
  // Extract variable prefix/suffix from syntax regex for reconstructing variables
193
243
  const syntaxWrapper = extractVariableWrapper(variableSyntax.source)
@@ -200,8 +250,10 @@ class Configorama {
200
250
 
201
251
  // Set initial config object to populate
202
252
  if (typeof fileOrObject === 'object') {
203
- // Store truly raw config before any preprocessing
204
- this.rawOriginalConfig = cloneDeep(fileOrObject)
253
+ // Store truly raw config before any preprocessing (only when needed)
254
+ if (this._needsRawClone) {
255
+ this.rawOriginalConfig = cloneDeep(fileOrObject)
256
+ }
205
257
  // Preprocess: convert bare refs in if(), escape help() args
206
258
  // Skip fallback fixing for object configs (they handle bare refs differently)
207
259
  const processed = preProcess(fileOrObject, this.variableSyntax, this.variableTypes, { skipFallbackFix: true })
@@ -677,8 +729,10 @@ class Configorama {
677
729
  /*
678
730
  console.log('before preprocess', configObject)
679
731
  /** */
680
- // Store truly raw config before any preprocessing (for metadata display)
681
- this.rawOriginalConfig = cloneDeep(configObject)
732
+ // Store truly raw config before any preprocessing (only when needed)
733
+ if (this._needsRawClone) {
734
+ this.rawOriginalConfig = cloneDeep(configObject)
735
+ }
682
736
 
683
737
  /* Preprocess step here - escapes ${} in help() args, fixes malformed fallbacks */
684
738
  configObject = preProcess(configObject, this.variableSyntax, this.variableTypes)
@@ -816,7 +870,7 @@ class Configorama {
816
870
  const originalConfig = this.originalConfig
817
871
 
818
872
  /* If no variables found just return early */
819
- if (this.originalString && !this.originalString.match(this.variableSyntax)) {
873
+ if (this.originalString && !this.variableSyntaxTest.test(this.originalString)) {
820
874
  if (this._markdownContent !== undefined) {
821
875
  this.originalConfig[this._markdownContentKey] = this._markdownContent
822
876
  }
@@ -829,7 +883,7 @@ class Configorama {
829
883
  /* has hardcoded stage */
830
884
  if (
831
885
  this.originalConfig && this.originalConfig.provider &&
832
- this.originalConfig.provider.stage && !this.originalConfig.provider.stage.match(this.variableSyntax)
886
+ this.originalConfig.provider.stage && !this.variableSyntaxTest.test(this.originalConfig.provider.stage)
833
887
  ) {
834
888
  providerStage = this.originalConfig.provider.stage
835
889
  }
@@ -859,7 +913,7 @@ class Configorama {
859
913
  // console.log('leaves two', leaves)
860
914
  // Traverse resolved object and run functions
861
915
  // console.log('this.config', this.config)
862
- traverse(this.config).forEach(function (rawValue) {
916
+ walkAndUpdate(this.config, function (rawValue) {
863
917
  /* Pass through unknown variables */
864
918
  if (!configoramaOpts.allowUndefinedValues && typeof rawValue === 'undefined') {
865
919
  const configValuePath = this.path.join('.')
@@ -1048,6 +1102,11 @@ class Configorama {
1048
1102
  // #######################
1049
1103
  // ## PROPERTY HANDLING ##
1050
1104
  // #######################
1105
+ isCloudFormationSubPath(pathValue) {
1106
+ if (!pathValue || !pathValue.length) return false
1107
+ return pathValue[pathValue.length - 1] === 'Fn::Sub'
1108
+ }
1109
+
1051
1110
  /**
1052
1111
  * The declaration of a terminal property. This declaration includes the path and value of the
1053
1112
  * property.
@@ -1096,12 +1155,16 @@ class Configorama {
1096
1155
  mapValues(current, addContext)
1097
1156
  }
1098
1157
  } else {
1158
+ // Compute path once, then skip work for paths already known to be fully resolved.
1159
+ const thePath = context.length > 1 ? context.join('.') : context[0]
1160
+ if (this._resolvedPaths.has(thePath)) {
1161
+ return results
1162
+ }
1099
1163
  // TODO Add values to leaves here
1100
1164
  const leaf = {
1101
1165
  path: context,
1102
1166
  value: current,
1103
1167
  }
1104
- const thePath = leaf.path.length > 1 ? leaf.path.join('.') : leaf.path[0]
1105
1168
  // console.log('thePath', thePath)
1106
1169
  // console.log('this.originalConfig', this.originalConfig)
1107
1170
 
@@ -1113,21 +1176,39 @@ class Configorama {
1113
1176
  originalValue = cached.value
1114
1177
  originalValuePath = cached.originalValuePath
1115
1178
  } else {
1116
- originalValue = dotProp.get(this.originalConfig, thePath)
1117
- // TODO @DWELLS make recursive
1179
+ // Walk down originalConfig once using the path array directly. Avoids
1180
+ // dotProp.get's path-segmenting work and the previous O(depth²) loop
1181
+ // that re-joined and re-walked parent paths.
1182
+ const ancestorValues = []
1183
+ let node = this.originalConfig
1184
+ let fullPathReached = true
1185
+ for (let i = 0; i < context.length; i++) {
1186
+ if (node == null || typeof node !== 'object') {
1187
+ fullPathReached = false
1188
+ break
1189
+ }
1190
+ node = node[context[i]]
1191
+ ancestorValues.push(node)
1192
+ }
1193
+
1194
+ const lastIdx = ancestorValues.length - 1
1195
+ originalValue = fullPathReached ? ancestorValues[lastIdx] : undefined
1196
+
1118
1197
  if (!originalValue) {
1119
- // Recurse up the tree until we find a value
1120
- // Use index instead of slice() to avoid array allocations
1121
- for (let pathLen = leaf.path.length - 1; pathLen > 0 && !originalValue; pathLen--) {
1122
- const currentPath = leaf.path.slice(0, pathLen).join('.')
1123
- // console.log('checking parent path:', currentPath)
1124
- originalValue = dotProp.get(this.originalConfig, currentPath)
1125
- if (typeof originalValue !== 'undefined') {
1126
- originalValuePath = currentPath
1198
+ // Same semantics as the previous "recurse up" loop: walk from the
1199
+ // deepest non-full ancestor toward the root, take the first truthy
1200
+ // ancestor as originalValue, and update originalValuePath each time
1201
+ // we see a defined ancestor along the way.
1202
+ const startIdx = fullPathReached ? lastIdx - 1 : lastIdx
1203
+ for (let i = startIdx; i >= 0; i--) {
1204
+ const ancestor = ancestorValues[i]
1205
+ if (typeof ancestor !== 'undefined') {
1206
+ originalValuePath = i > 0 ? context.slice(0, i + 1).join('.') : context[0]
1207
+ originalValue = ancestor
1208
+ if (ancestor) break
1127
1209
  }
1128
1210
  }
1129
1211
  }
1130
- // Cache the result
1131
1212
  this._originalValueCache.set(thePath, { value: originalValue, originalValuePath })
1132
1213
  }
1133
1214
  if (originalValuePath) {
@@ -1150,6 +1231,9 @@ class Configorama {
1150
1231
  leaf.isFileRef = true
1151
1232
  }
1152
1233
  }
1234
+ // Pre-compute hasVar so populateVariables doesn't have to re-test every leaf
1235
+ // every iteration. Non-string values can never contain a variable.
1236
+ leaf.hasVar = isString(current) && this.variableSyntaxTest.test(current)
1153
1237
  // dotProp.get(this.originalConfig, thePath)
1154
1238
  results.push(leaf)
1155
1239
  }
@@ -1167,9 +1251,23 @@ class Configorama {
1167
1251
  */
1168
1252
  populateVariables(properties) {
1169
1253
  // console.log('properties', properties)
1254
+ // hasVar was precomputed in getProperties — no need to re-test the regex here.
1255
+ // Properties whose value is defined and lacks a variable are terminally
1256
+ // resolved: record their path so getProperties can skip them on the next
1257
+ // iteration. Undefined-valued leaves stay eligible — the final
1258
+ // undefined-detection traverse still needs to find them in this.leaves.
1170
1259
  let variables = properties.filter((property) => {
1171
- // Initial check if value has variable string in it
1172
- return isString(property.value) && property.value.match(this.variableSyntax)
1260
+ if (property.hasVar) return true
1261
+ if (property.value !== undefined) {
1262
+ const p = property.path
1263
+ this._resolvedPaths.add(p.length > 1 ? p.join('.') : p[0])
1264
+ }
1265
+ return false
1266
+ })
1267
+ /* Leave CloudFormation Fn::Sub bodies verbatim. ${...} inside a !Sub is a
1268
+ CloudFormation reference, not a configorama variable. */
1269
+ variables = variables.filter((property) => {
1270
+ return !this.isCloudFormationSubPath(property.path)
1173
1271
  })
1174
1272
  /*
1175
1273
  console.log(`variables at call count ${this.callCount}`, variables)
@@ -1205,6 +1303,15 @@ class Configorama {
1205
1303
  if (result.value !== result.populated) {
1206
1304
  set(target, result.path, result.populated)
1207
1305
  }
1306
+ // If the populated value is defined and no longer contains a variable,
1307
+ // mark this path resolved so getProperties skips it on subsequent
1308
+ // iterations. Undefined means resolution failed — keep it eligible so
1309
+ // the final undefined-detection traverse still has a leaf to reference.
1310
+ const populated = result.populated
1311
+ if (populated !== undefined && (typeof populated !== 'string' || !this.variableSyntaxTest.test(populated))) {
1312
+ const p = result.path
1313
+ this._resolvedPaths.add(p.length > 1 ? p.join('.') : p[0])
1314
+ }
1208
1315
  })
1209
1316
  })
1210
1317
  }
@@ -1354,7 +1461,7 @@ class Configorama {
1354
1461
  historyEntry.fallbackValues = variableParts.slice(1).map((fallback) => {
1355
1462
  const trimmedFallback = fallback.trim()
1356
1463
  // Check if it's a variable reference
1357
- const isVariable = trimmedFallback.match(this.variableSyntax) || trimmedFallback.match(this.variablesKnownTypes)
1464
+ const isVariable = this.variableSyntaxTest.test(trimmedFallback) || this.variablesKnownTypes.test(trimmedFallback)
1358
1465
  const fallbackData = {
1359
1466
  isVariable: !!isVariable,
1360
1467
  fullMatch: trimmedFallback,
@@ -1448,6 +1555,9 @@ class Configorama {
1448
1555
  console.log(valueObject)
1449
1556
  }
1450
1557
  const property = valueObject.value
1558
+ if (this.isCloudFormationSubPath(valueObject.path)) {
1559
+ return Promise.resolve(property)
1560
+ }
1451
1561
  const matches = this.getMatches(property)
1452
1562
  /*
1453
1563
  console.log('populateValue matches', matches)
@@ -1592,7 +1702,7 @@ class Configorama {
1592
1702
  }
1593
1703
 
1594
1704
  /* Handle ${self:custom.ref, ''} with deep values */
1595
- if (v.match(deepRefSyntax) && originalSrc.match(this.variableSyntax) && !v.match(/deep\:(\d*)\..*}$/)) {
1705
+ if (v.match(deepRefSyntax) && this.variableSyntaxTest.test(originalSrc) && !v.match(/deep\:(\d*)\..*}$/)) {
1596
1706
  // console.log('deep ref syntax')
1597
1707
  // console.log('deep var', this.deep)
1598
1708
  // console.log('originalSrc', originalSrc)
@@ -1642,8 +1752,8 @@ class Configorama {
1642
1752
  /** */
1643
1753
  // Handle comma ${opt:stage, dev} and remove extra suffix
1644
1754
  if (
1645
- currentMatchedString.match(this.variableSyntax) &&
1646
- !valueToPopulate.match(this.variableSyntax) &&
1755
+ this.variableSyntaxTest.test(currentMatchedString) &&
1756
+ !this.variableSyntaxTest.test(valueToPopulate) &&
1647
1757
  valueToPopulate.match(this.varSuffixPattern)
1648
1758
  ) {
1649
1759
  valueToPopulate = valueToPopulate.replace(this.varSuffixPattern, '')
@@ -1651,7 +1761,7 @@ class Configorama {
1651
1761
 
1652
1762
  // For eval/if expressions, string values need quotes unless already quoted
1653
1763
  // BUT don't quote strings that contain variable refs (they need further resolution)
1654
- if (evalIfPattern.test(property) && !valueToPopulate.match(this.variableSyntax)) {
1764
+ if (evalIfPattern.test(property) && !this.variableSyntaxTest.test(valueToPopulate)) {
1655
1765
  const matchIdx = property.indexOf(currentMatchedString)
1656
1766
  const charBefore = matchIdx > 0 ? property[matchIdx - 1] : ''
1657
1767
  // Always escape quotes in values for eval/if context
@@ -1689,8 +1799,8 @@ class Configorama {
1689
1799
  const isNestedInVariable = (
1690
1800
  property.trim() !== matchedString.trim() &&
1691
1801
  property.indexOf(matchedString) !== -1 &&
1692
- matchedString.match(this.variableSyntax) &&
1693
- property.match(this.variableSyntax)
1802
+ this.variableSyntaxTest.test(matchedString) &&
1803
+ this.variableSyntaxTest.test(property)
1694
1804
  )
1695
1805
  // Only encode for file() or text() references where JSON braces break regex matching
1696
1806
  const isFileOrTextRef = /\bfile\s*\(|\btext\s*\(/.test(property)
@@ -1861,7 +1971,7 @@ Missing Value ${missingValue} - ${matchedString}
1861
1971
 
1862
1972
  if (
1863
1973
  /* Not another variable reference */
1864
- !prop.match(this.variableSyntax)
1974
+ !this.variableSyntaxTest.test(prop)
1865
1975
  &&
1866
1976
  /* Not file or text refs */
1867
1977
  !prop.match(fileRefSyntax)
@@ -1898,7 +2008,7 @@ Missing Value ${missingValue} - ${matchedString}
1898
2008
  typeof valueToPopulate === 'string' &&
1899
2009
  !valueToPopulate.match(deepRefSyntax) &&
1900
2010
  foundFilters.length &&
1901
- !property.match(this.variableSyntax)
2011
+ !this.variableSyntaxTest.test(property)
1902
2012
  ) {
1903
2013
  runFilters = true
1904
2014
  }
@@ -1977,7 +2087,7 @@ Missing Value ${missingValue} - ${matchedString}
1977
2087
  const secondValue = variableStrings[1]
1978
2088
  if (
1979
2089
  isString(firstValue) && firstValue.match(this.variablesKnownTypes)
1980
- && isString(secondValue) && !secondValue.match(this.variablesKnownTypes) && !secondValue.match(this.variableSyntax)
2090
+ && isString(secondValue) && !secondValue.match(this.variablesKnownTypes) && !this.variableSyntaxTest.test(secondValue)
1981
2091
  ) {
1982
2092
  if (!isSurroundedByQuotes(secondValue) && !/^-?\d+(\.\d+)?$/.test(secondValue) && !startsWithQuotedPipe(secondValue)) {
1983
2093
  variableStrings = [firstValue, ensureQuote(secondValue)]
@@ -2009,7 +2119,7 @@ Missing Value ${missingValue} - ${matchedString}
2009
2119
 
2010
2120
  extractedValues.forEach((value, index) => {
2011
2121
  // console.log('───────────────────────────────> value', value)
2012
- if (isString(value) && value.match(this.variableSyntax)) {
2122
+ if (isString(value) && this.variableSyntaxTest.test(value)) {
2013
2123
  deepProperties += 1
2014
2124
  // console.log('makeDeepVariable overwrite', value)
2015
2125
  const deepVariable = this.makeDeepVariable(value, 'via overwrite')
@@ -2630,7 +2740,8 @@ Missing Value ${missingValue} - ${matchedString}
2630
2740
  fileRefSyntax: fileRefSyntax,
2631
2741
  textRefSyntax: textRefSyntax,
2632
2742
  varPrefix: this.varPrefix,
2633
- varSuffix: this.varSuffix
2743
+ varSuffix: this.varSuffix,
2744
+ fileContentCache: this._fileContentCache
2634
2745
  }
2635
2746
  return getValueFromFileResolver(ctx, variableString, options)
2636
2747
  }
@@ -2654,7 +2765,7 @@ Missing Value ${missingValue} - ${matchedString}
2654
2765
  // if there is a deep reference remaining
2655
2766
  ret = ret.then((result) => {
2656
2767
  // console.log('DEEP RESULT', result)
2657
- if (isString(result.value) && result.value.match(this.variableSyntax)) {
2768
+ if (isString(result.value) && this.variableSyntaxTest.test(result.value)) {
2658
2769
  // console.log('makeDeepVariable getValueFromDeep', result.value)
2659
2770
  const deepVariable = this.makeDeepVariable(result.value, 'via getValueFromDeep')
2660
2771
  return Promise.resolve(appendDeepVariable(deepVariable, deepRef))
@@ -2759,7 +2870,7 @@ Missing Value ${missingValue} - ${matchedString}
2759
2870
 
2760
2871
  reducedValue = reducedValue[subProperty]
2761
2872
  }
2762
- if (typeof reducedValue === 'string' && reducedValue.match(this.variableSyntax)) {
2873
+ if (typeof reducedValue === 'string' && this.variableSyntaxTest.test(reducedValue)) {
2763
2874
  // console.log('makeDeepVariable reducedValue', reducedValue)
2764
2875
  reducedValue = this.makeDeepVariable(reducedValue, 'via getDeeperValue')
2765
2876
  }
@@ -108,6 +108,7 @@ function parseFileContents(content, filePath) {
108
108
  * @param {RegExp} ctx.textRefSyntax - Regex for text() syntax
109
109
  * @param {string} ctx.varPrefix - Variable prefix (e.g., '${')
110
110
  * @param {string} ctx.varSuffix - Variable suffix (e.g., '}')
111
+ * @param {Map<string, string>} [ctx.fileContentCache] - Optional per-instance read cache keyed by absolute file path
111
112
  * @param {string} variableString - The variable string to resolve
112
113
  * @param {object} options - Resolution options
113
114
  * @returns {Promise<any>}
@@ -254,7 +255,14 @@ ${JSON.stringify(options.context, null, 2)}`,
254
255
 
255
256
  let valueToPopulate
256
257
 
257
- const variableFileContents = fs.readFileSync(fullFilePath, 'utf-8')
258
+ // Per-instance read cache: identical ${file:...} refs hit fs once per resolve.
259
+ let variableFileContents
260
+ if (ctx.fileContentCache && ctx.fileContentCache.has(fullFilePath)) {
261
+ variableFileContents = ctx.fileContentCache.get(fullFilePath)
262
+ } else {
263
+ variableFileContents = fs.readFileSync(fullFilePath, 'utf-8')
264
+ if (ctx.fileContentCache) ctx.fileContentCache.set(fullFilePath, variableFileContents)
265
+ }
258
266
 
259
267
  /* handle case for referencing raw JS files to inline them */
260
268
  if ((argsToPass.length
@@ -233,12 +233,8 @@ function preProcess(configObject, variableSyntax, variableTypes, options = {}) {
233
233
  const afterOp = afterRef.substring(op.length).trimStart()
234
234
  return afterOp.startsWith('"') || afterOp.startsWith("'")
235
235
  }
236
- // Check if preceded by: "string" op
237
- for (const o of comparisonOps) {
238
- const pattern = new RegExp(`["'][^"']*["']\\s*${o.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*$`)
239
- if (pattern.test(beforeRef)) return true
240
- }
241
- return false
236
+ // Check if preceded by: "string" op (reuses precededByPatterns)
237
+ return precededByPatterns.some(p => p.test(beforeRef))
242
238
  })
243
239
 
244
240
  if (!precededByQuote && !followedByQuote && isComparedToString) {
@@ -57,14 +57,6 @@ type ConfigoramaSettings = {
57
57
  * - return both config and metadata about variables found
58
58
  */
59
59
  returnMetadata?: boolean;
60
- /**
61
- * - suppress env-stage-loader logs when useDotenv/useDotEnv is enabled
62
- */
63
- dotEnvSilent?: boolean;
64
- /**
65
- * - enable env-stage-loader debug logs when useDotenv/useDotEnv is enabled
66
- */
67
- dotEnvDebug?: boolean;
68
60
  /**
69
61
  * - keys to merge in arrays of objects
70
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;AAyCiB,0BALH,CAAC,4BACJ,MAAM,MAAO,aACb,mBAAmB,GACjB,OAAO,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAiD7C;;IASqB,qBALR,CAAC,4BACJ,MAAM,MAAO,aACb,mBAAmB,GACjB,CAAC,CAgBb;IAQwB,4CAJb,MAAM,GAAC,MAAM,aACd,MAAM,gBAUhB;;;;;;;;;;;;;;;;aAtHa,MAAM;;;;gBACN,MAAM;;;;;;;;;;;;;;;;;;;;uBAIN,OAAO;;;;2BACP,OAAO;;;;kBACP,cAAe;;;;qBACf,OAAO;;;;mBACP,OAAO;;;;kBACP,OAAO;;;;gBACP,MAAM,EAAE;;;;;;;;uBAKR,CAAC;;;;oBAED,MAAM;;;;;;;;;;YAEN,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";;;AAuCiB,0BALH,CAAC,4BACJ,MAAM,MAAO,aACb,mBAAmB,GACjB,OAAO,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAiD7C;;IASqB,qBALR,CAAC,4BACJ,MAAM,MAAO,aACb,mBAAmB,GACjB,CAAC,CAgBb;IAQwB,4CAJb,MAAM,GAAC,MAAM,aACd,MAAM,gBAUhB;;;;;;;;;;;;;;;;aApHa,MAAM;;;;gBACN,MAAM;;;;;;;;;;;;;;;;;;;;uBAIN,OAAO;;;;2BACP,OAAO;;;;kBACP,cAAe;;;;qBACf,OAAO;;;;gBACP,MAAM,EAAE;;;;;;;;uBAKR,CAAC;;;;oBAED,MAAM;;;;;;;;;;YAEN,CAAC"}
@@ -7,7 +7,6 @@ declare class Configorama {
7
7
  foundVariables: any[];
8
8
  fileRefsFound: any[];
9
9
  resolutionTracking: {};
10
- _trackCalls: boolean;
11
10
  variableSyntax: RegExp;
12
11
  varPrefix: string;
13
12
  varSuffix: string;
@@ -65,7 +64,22 @@ declare class Configorama {
65
64
  * @returns {object} Metadata object containing variables, fileRefs, and summary
66
65
  */
67
66
  collectVariableMetadata(): object;
68
- _cachedMetadata: any;
67
+ _cachedMetadata: {
68
+ variables: {};
69
+ uniqueVariables: {};
70
+ fileDependencies: {
71
+ globPatterns: any[];
72
+ dynamicPaths: any[];
73
+ resolvedPaths: any[];
74
+ byConfigPath: any[];
75
+ references: any[];
76
+ };
77
+ summary: {
78
+ totalVariables: number;
79
+ requiredVariables: number;
80
+ variablesWithDefaults: number;
81
+ };
82
+ };
69
83
  /**
70
84
  * Populate the variables in the given object.
71
85
  * @param objectToPopulate The object to populate variables within.
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":";AA2GA;IACE,0CAieC;IAzdC,cAkBW;IAuBX,gBAAqB;IAErB,mCAAoC;IAEpC,sBAAwB;IACxB,qBAAuB;IAGvB,uBAA4B;IAE5B,qBAAmD;IAsBnD,uBAAoC;IAIpC,kBAAqC;IACrC,kBAAqC;IAErC,yBAA+F;IAC/F,yBAAuD;IACvD,kCAAyE;IAKvE,uBAAgD;IAKhD,YAAuB;IAEvB,oBAA0C;IAE1C,gBAAoD;IAOpD,uBAAkC;IAElC,uBAA8B;IAE9B,uBAAkC;IASpC,wBAAmC;IAGnC,mBAqHC;IAwED,4BAA8C;IAG9C,iCAAkC;IAalC,aA2EC;IAUD,oBAEC;IAGD,eAiDC;IAOD,YAAc;IACd,cAAgB;IAChB,kBAAkB;IAGpB;;;;OAIG;IACH,0BAHW,MAAM,GAC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oExB;IAKD;;;;;;;OAOG;IACH,0FAFa,OAAO,CAAC,GAAG,CAAC,CAiiBxB;IACD,+EA+BC;IACD,yDAiBC;IACD,oEA6BC;IAKD,8CAQC;IACD,kDAyBC;IACD;;;;;;;;;;;;;OAaG;IACH,wEAoDC;IAKD,4BAOC;IACD,sCAqEC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"valueFromGit.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromGit.js"],"names":[],"mappings":"AA4XiB;;;;;;;;EAUhB"}
1
+ {"version":3,"file":"valueFromGit.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromGit.js"],"names":[],"mappings":"AA2XiB;;;;;;;;EAUhB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=valueFromSelf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valueFromSelf.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromSelf.js"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/parse.js"],"names":[],"mappings":";;;;cA4Dc,MAAM;;;;cACN,MAAM;;;;eACN,MAAM;;;;kBACN,cAAe;;;;;;eAyIf,MAAM;;;;kBACN,cAAe;;AA/I7B;;;;;;GAMG;AAEH;;;;GAIG;AACH,iFAHW,YAAY,OAgItB;AAED;;;;GAIG;AAEH;;;;;GAKG;AACH,oCAJW,MAAM,SACN,gBAAgB,OAW1B"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/parse.js"],"names":[],"mappings":";;;;cAgBc,MAAM;;;;cACN,MAAM;;;;eACN,MAAM;;;;kBACN,cAAe;;;;;;eAmIf,MAAM;;;;kBACN,cAAe;;AAzI7B;;;;;;GAMG;AAEH;;;;GAIG;AACH,iFAHW,YAAY,OA0HtB;AAED;;;;GAIG;AAEH;;;;;GAKG;AACH,oCAJW,MAAM,SACN,gBAAgB,OAW1B"}
@@ -9,13 +9,4 @@
9
9
  * @returns {number} Line number (1-indexed) or 0 if not found
10
10
  */
11
11
  export function findLineForKey(keyToFind: string, lines: string[], fileType: string): number;
12
- /**
13
- * Walk a dot-separated config path through raw file lines to find the exact line.
14
- * YAML uses indentation-based nesting, JSON uses brace-based nesting.
15
- * @param {string} configPath - Dot-separated path (e.g. 'resources.Parameters.Description')
16
- * @param {string[]} lines - Array of file lines
17
- * @param {string} fileType - File extension (e.g., '.yml', '.json')
18
- * @returns {number} Line number (1-indexed) or 0 if not found
19
- */
20
- export function findLineByPath(configPath: string, lines: string[], fileType: string): number;
21
12
  //# sourceMappingURL=findLineForKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findLineForKey.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/findLineForKey.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,0CALW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GACJ,MAAM,CAiClB;AAED;;;;;;;GAOG;AACH,2CALW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GACJ,MAAM,CAYlB"}
1
+ {"version":3,"file":"findLineForKey.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/findLineForKey.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,0CALW,MAAM,SACN,MAAM,EAAE,YACR,MAAM,GACJ,MAAM,CAiClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"replaceAll.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/replaceAll.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,wCALW,MAAM,YACN,MAAM,UACN,MAAM,GACJ,MAAM,CAelB"}
1
+ {"version":3,"file":"replaceAll.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/replaceAll.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wCALW,MAAM,YACN,MAAM,UACN,MAAM,GACJ,MAAM,CAelB"}
@@ -1,62 +0,0 @@
1
- /**
2
- * Display "No Variables Found" message
3
- * @param {string} configFilePath
4
- * @param {RegExp} variableSyntax
5
- * @param {Object} variableTypes
6
- */
7
- export function displayNoVariablesFound(configFilePath: string, variableSyntax: RegExp, variableTypes: any): void;
8
- /**
9
- * Display variable details in stacked box format
10
- * @param {Object} params
11
- * @param {string[]} params.varKeys
12
- * @param {Object} params.variableData
13
- * @param {Object} params.uniqueVariables
14
- * @param {RegExp} params.varPrefixPattern
15
- * @param {RegExp} params.varSuffixPattern
16
- * @param {string[]} params.lines
17
- * @param {string} params.fileType
18
- * @param {string} params.configFilePath
19
- */
20
- export function displayVariableDetails({ varKeys, variableData, uniqueVariables, varPrefixPattern, varSuffixPattern, lines, fileType, configFilePath }: {
21
- varKeys: string[];
22
- variableData: any;
23
- uniqueVariables: any;
24
- varPrefixPattern: RegExp;
25
- varSuffixPattern: RegExp;
26
- lines: string[];
27
- fileType: string;
28
- configFilePath: string;
29
- }): void;
30
- /**
31
- * Display unique variables in stacked box format
32
- * @param {Object} params
33
- * @param {string[]} params.uniqueVarKeys
34
- * @param {Object} params.uniqueVariables
35
- * @param {string[]} params.lines
36
- * @param {string} params.fileType
37
- * @param {string} params.configFilePath
38
- */
39
- export function displayUniqueVariables({ uniqueVarKeys, uniqueVariables, lines, fileType, configFilePath }: {
40
- uniqueVarKeys: string[];
41
- uniqueVariables: any;
42
- lines: string[];
43
- fileType: string;
44
- configFilePath: string;
45
- }): void;
46
- /**
47
- * Display configurable variables grouped by source type
48
- * @param {Object} params
49
- * @param {string[]} params.uniqueVarKeys
50
- * @param {Object} params.uniqueVariables
51
- * @param {string[]} params.lines
52
- * @param {string} params.fileType
53
- * @param {string} params.configFilePath
54
- */
55
- export function displayConfigurableVariables({ uniqueVarKeys, uniqueVariables, lines, fileType, configFilePath }: {
56
- uniqueVarKeys: string[];
57
- uniqueVariables: any;
58
- lines: string[];
59
- fileType: string;
60
- configFilePath: string;
61
- }): void;
62
- //# sourceMappingURL=display.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/display.js"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,wDAJW,MAAM,kBACN,MAAM,4BAwBhB;AAED;;;;;;;;;;;GAWG;AACH,wJATG;IAAyB,OAAO,EAAxB,MAAM,EAAE;IACO,YAAY;IACZ,eAAe;IACf,gBAAgB,EAA/B,MAAM;IACS,gBAAgB,EAA/B,MAAM;IACW,KAAK,EAAtB,MAAM,EAAE;IACO,QAAQ,EAAvB,MAAM;IACS,cAAc,EAA7B,MAAM;CAChB,QAyJA;AAED;;;;;;;;GAQG;AACH,4GANG;IAAyB,aAAa,EAA9B,MAAM,EAAE;IACO,eAAe;IACb,KAAK,EAAtB,MAAM,EAAE;IACO,QAAQ,EAAvB,MAAM;IACS,cAAc,EAA7B,MAAM;CAChB,QAiHA;AAED;;;;;;;;GAQG;AACH,kHANG;IAAyB,aAAa,EAA9B,MAAM,EAAE;IACO,eAAe;IACb,KAAK,EAAtB,MAAM,EAAE;IACO,QAAQ,EAAvB,MAAM;IACS,cAAc,EAA7B,MAAM;CAChB,QAyIA"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Collect metadata about all variables found in the configuration
3
- * @param {Object} params
4
- * @param {RegExp} params.variableSyntax
5
- * @param {Object} params.variablesKnownTypes
6
- * @param {Object} params.variableTypes
7
- * @param {RegExp|null} params.filterMatch
8
- * @param {string} params.configFilePath
9
- * @param {Object} params.displayConfig - rawOriginalConfig || originalConfig, used for traversal
10
- * @param {Object} params.originalConfig - this.originalConfig, used for dotProp.get checks
11
- * @param {string} params.varSuffix
12
- * @param {RegExp} params.varSuffixWithSpacePattern
13
- * @returns {Object} Metadata object containing variables, fileDependencies, and summary
14
- */
15
- export function collectVariableMetadata({ variableSyntax, variablesKnownTypes, variableTypes, filterMatch, configFilePath, displayConfig, originalConfig, varSuffix, varSuffixWithSpacePattern, }: {
16
- variableSyntax: RegExp;
17
- variablesKnownTypes: any;
18
- variableTypes: any;
19
- filterMatch: RegExp | null;
20
- configFilePath: string;
21
- displayConfig: any;
22
- originalConfig: any;
23
- varSuffix: string;
24
- varSuffixWithSpacePattern: RegExp;
25
- }): any;
26
- //# sourceMappingURL=metadata.d.ts.map