configorama 0.10.0 → 0.10.3

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 (34) hide show
  1. package/README.md +58 -25
  2. package/cli.js +67 -4
  3. package/index.d.ts +12 -0
  4. package/package.json +1 -1
  5. package/src/index.js +3 -0
  6. package/src/main.js +23 -2
  7. package/src/metadata.js +5 -2
  8. package/src/utils/parsing/parse.js +1 -1
  9. package/src/utils/paths/ignorePaths.js +69 -0
  10. package/src/utils/strings/splitByComma.test.js +2 -2
  11. package/src/utils/variables/findNestedVariables.js +2 -2
  12. package/src/utils/variables/findNestedVariables.test.js +2 -2
  13. package/src/utils/variables/variableUtils.js +3 -3
  14. package/src/utils/variables/variableUtils.test.js +9 -0
  15. package/types/src/index.d.ts +0 -8
  16. package/types/src/index.d.ts.map +1 -1
  17. package/types/src/main.d.ts +16 -6
  18. package/types/src/main.d.ts.map +1 -1
  19. package/types/src/resolvers/valueFromFile.d.ts +0 -2
  20. package/types/src/resolvers/valueFromFile.d.ts.map +1 -1
  21. package/types/src/resolvers/valueFromGit.d.ts.map +1 -1
  22. package/types/src/resolvers/valueFromSelf.d.ts +1 -0
  23. package/types/src/resolvers/valueFromSelf.d.ts.map +1 -0
  24. package/types/src/utils/parsing/parse.d.ts.map +1 -1
  25. package/types/src/utils/parsing/preProcess.d.ts.map +1 -1
  26. package/types/src/utils/paths/findLineForKey.d.ts +0 -9
  27. package/types/src/utils/paths/findLineForKey.d.ts.map +1 -1
  28. package/types/src/utils/strings/replaceAll.d.ts.map +1 -1
  29. package/types/src/display.d.ts +0 -62
  30. package/types/src/display.d.ts.map +0 -1
  31. package/types/src/metadata.d.ts +0 -26
  32. package/types/src/metadata.d.ts.map +0 -1
  33. package/types/src/utils/BoundedMap.d.ts +0 -10
  34. package/types/src/utils/BoundedMap.d.ts.map +0 -1
package/README.md CHANGED
@@ -356,9 +356,9 @@ Resolution is a **fixed-point loop**: each pass resolves what it can, then `popu
356
356
 
357
357
  ### Performance
358
358
 
359
- Configorama is fast and stays out of the way at runtime — a typical 21KB serverless-style config resolves in **~3ms** on warm Node 22.
359
+ A typical 21KB serverless-style config resolves in **~3ms** on warm Node 22.
360
360
 
361
- - Honest before/after benchmarks against the published `0.9.17` baseline: [`PERF.md`](./PERF.md)
361
+ - Before/after benchmarks against the published `0.9.17` baseline: [`PERF.md`](./PERF.md)
362
362
  - Reproducible bench harness: [`scripts/bench.js`](./scripts/bench.js)
363
363
  - Run against your own configs:
364
364
  ```bash
@@ -366,7 +366,7 @@ Configorama is fast and stays out of the way at runtime — a typical 21KB serve
366
366
  node scripts/bench.js /path/to/another/configorama # A/B
367
367
  ```
368
368
 
369
- If your config is slow, please open an issue with the config (or a redacted reproduction) we can profile and tighten the hot path.
369
+ If your config is slow, please open an issue with the config (or a redacted reproduction). We're happy to profile and tighten the hot path.
370
370
 
371
371
  ---
372
372
 
@@ -1363,7 +1363,7 @@ inRange: ${between(${value}, 50, 100)} # true
1363
1363
 
1364
1364
  ## Bundled Plugins
1365
1365
 
1366
- Plugins ship in the repo under `plugins/` and are opt-in install their peer dependencies, then wire them into `variableSources`. Plugins are *not* required dependencies of `configorama` itself, so consumers who don't need them aren't paying for them.
1366
+ Plugins ship in the repo under `plugins/` and are opt-in: install their peer dependencies, then wire them into `variableSources`. Plugins are *not* required dependencies of `configorama` itself, so consumers who don't need them aren't paying for them.
1367
1367
 
1368
1368
  ### CloudFormation
1369
1369
 
@@ -1393,7 +1393,7 @@ const config = await configorama('config.yml', {
1393
1393
  })
1394
1394
  ```
1395
1395
 
1396
- Full docs: [`plugins/cloudformation/README.md`](./plugins/cloudformation/README.md) covers the env-var-prefix alias convention, refcounted credential mutex for parallel-safe deploys, and the `skipResolution` mode for CI metadata extraction.
1396
+ Full docs: [`plugins/cloudformation/README.md`](./plugins/cloudformation/README.md). Covers the env-var-prefix alias convention, the refcounted credential mutex for parallel-safe deploys, and the `skipResolution` mode for CI metadata extraction.
1397
1397
 
1398
1398
  Peer dependency (install separately):
1399
1399
 
@@ -1590,7 +1590,7 @@ const { format } = require('configorama')
1590
1590
  // Parse YAML
1591
1591
  const yamlObj = format.yaml.parse('key: value')
1592
1592
 
1593
- // Parse JSON (handles JSON5/JSONC too comments, trailing commas)
1593
+ // Parse JSON (handles JSON5/JSONC too: comments, trailing commas)
1594
1594
  const jsonObj = format.json.parse('{ key: "value", }')
1595
1595
 
1596
1596
  // Parse TOML
@@ -1605,7 +1605,7 @@ const hclObj = await format.hcl.parse('variable "example" { default = "value" }'
1605
1605
 
1606
1606
  **Available parsers:** `format.json`, `format.yaml`, `format.toml`, `format.ini`, `format.hcl`, `format.markdown`.
1607
1607
 
1608
- Each has at minimum a `parse(content)` method; `dump(obj)` / `stringify(obj)` and cross-format converters (e.g. `format.yaml.toJson`, `format.toml.toYaml`) are available where the underlying format supports them. `format.markdown` is a frontmatter parser see [Markdown Files](#markdown-files) below.
1608
+ Each has at minimum a `parse(content)` method; `dump(obj)` / `stringify(obj)` and cross-format converters (e.g. `format.yaml.toJson`, `format.toml.toYaml`) are available where the underlying format supports them. `format.markdown` is a frontmatter parser; see [Markdown Files](#markdown-files) below.
1609
1609
 
1610
1610
  **Real use cases for `format`:**
1611
1611
 
@@ -1644,7 +1644,7 @@ Resolves to:
1644
1644
  }
1645
1645
  ```
1646
1646
 
1647
- The body is detached during variable resolution (so `${…}` inside the body text is left alone) and re-attached afterward only frontmatter keys get variable expansion.
1647
+ The body is detached during variable resolution (so `${…}` inside the body text is left alone) and re-attached afterward; only frontmatter keys get variable expansion.
1648
1648
 
1649
1649
  ---
1650
1650
 
@@ -1667,7 +1667,7 @@ const config = await configorama('config.yml', { syntax })
1667
1667
  |---|---|---|---|
1668
1668
  | `prefix` | `string` | `'${'` | Opening delimiter |
1669
1669
  | `suffix` | `string` | `'}'` | Closing delimiter |
1670
- | `excludePatterns` | `string[]` | `['AWS', 'stageVariables']` | Patterns to exclude via negative lookahead (so e.g. `${AWS::Region}` is left untouched by CloudFormation users) |
1670
+ | `excludePatterns` | `string[]` | `['AWS', 'aws:', 'stageVariables']` | Patterns to exclude via negative lookahead (so e.g. `${AWS::Region}` and `${aws:username}` are left untouched by CloudFormation users) |
1671
1671
 
1672
1672
  ---
1673
1673
 
@@ -1762,7 +1762,7 @@ buildVariableSyntax('<', '>') // <env:FOO>
1762
1762
  function buildVariableSyntax(
1763
1763
  prefix: string = '${',
1764
1764
  suffix: string = '}',
1765
- excludePatterns: string[] = ['AWS', 'stageVariables']
1765
+ excludePatterns: string[] = ['AWS', 'aws:', 'stageVariables']
1766
1766
  ): string
1767
1767
  ```
1768
1768
 
@@ -1821,7 +1821,7 @@ const config = await configorama(configFile, {
1821
1821
  - Serverless Framework integration (let the framework resolve SSM and other refs it owns)
1822
1822
  - Gradual migration (allow unknown types during transition period)
1823
1823
 
1824
- > CloudFormation refs (`${cf:…}`, `${cf(region):…}`, `${cf(account:region):…}`) are now resolved natively by the bundled [`plugins/cloudformation/`](./plugins/cloudformation/README.md) plugin no external resolver required.
1824
+ > CloudFormation refs (`${cf:…}`, `${cf(region):…}`, `${cf(account:region):…}`) are now resolved natively by the bundled [`plugins/cloudformation/`](./plugins/cloudformation/README.md) plugin; no external resolver required.
1825
1825
 
1826
1826
  ---
1827
1827
 
@@ -1891,6 +1891,9 @@ const config = await configorama(configFile, {
1891
1891
  | `allowUnknownVariableTypes` | `boolean \| string[]` | `false` | Allow unknown variable types to pass through |
1892
1892
  | `allowUnresolvedVariables` | `boolean \| string[]` | `false` | Allow known types that can't resolve to pass through |
1893
1893
  | `allowUndefinedValues` | `boolean` | `false` | Allow undefined as a valid end result |
1894
+ | `ignorePaths` | `string[]` | Built-in CloudFormation/code paths | Glob-like config paths whose values should be left verbatim |
1895
+ | `skipResolutionPaths` | `string[]` | `[]` | Alias for `ignorePaths` |
1896
+ | `disableDefaultIgnorePaths` | `boolean` | `false` | Disable the built-in CloudFormation/code ignore paths |
1894
1897
  | `returnMetadata` | `boolean` | `false` | Return `{ config, metadata }` instead of just the resolved config |
1895
1898
  | `returnPreResolvedVariableDetails` | `boolean` | `false` | Return metadata about variables *without* resolving them (used by `analyze()`) |
1896
1899
  | `useDotEnvFiles` | `boolean` | `false` | Auto-load `.env`, `.env.{stage}`, etc. into `process.env` before resolution (via [env-stage-loader](https://www.npmjs.com/package/env-stage-loader)) |
@@ -1900,7 +1903,7 @@ const config = await configorama(configFile, {
1900
1903
  | `mergeKeys` | `string[]` | `[]` | Keys to merge in arrays of objects |
1901
1904
  | `filePathOverrides` | `Record<string, string>` | `{}` | Map of file paths to override (for testing/mocking) |
1902
1905
 
1903
- > The config file itself can also set `useDotenv: true` (or `useDotEnv: true`) at the top level to trigger dotenv loading useful if you want the behavior intrinsic to the config rather than the JS caller.
1906
+ > The config file itself can also set `useDotenv: true` (or `useDotEnv: true`) at the top level to trigger dotenv loading. Useful when you want the behavior intrinsic to the config rather than the JS caller.
1904
1907
 
1905
1908
  **Legacy options (deprecated):**
1906
1909
 
@@ -2051,7 +2054,7 @@ const config = await configorama('config.yml', {
2051
2054
  })
2052
2055
  ```
2053
2056
 
2054
- > **See also:** the bundled [`plugins/cloudformation/`](./plugins/cloudformation/README.md) plugin is a production-grade example of a `source: 'remote'` resolver it handles multi-region, multi-account credential swapping, and per-instance client/output caching.
2057
+ > **See also:** the bundled [`plugins/cloudformation/`](./plugins/cloudformation/README.md) plugin is a working example of a `source: 'remote'` resolver. It handles multi-region and multi-account credential swapping, plus per-instance client and output caching.
2055
2058
 
2056
2059
  ```yaml
2057
2060
  # config.yml
@@ -2084,8 +2087,14 @@ configorama config.yml --info
2084
2087
  # Verify config (check for errors without resolving)
2085
2088
  configorama config.yml --verify
2086
2089
 
2087
- # Extract specific path from config
2088
- configorama config.yml database.host
2090
+ # Extract a specific path from config
2091
+ configorama config.yml .database.host
2092
+
2093
+ # Print an extracted scalar without JSON quotes
2094
+ configorama config.yml .database.host --raw
2095
+
2096
+ # Copy the formatted output to your clipboard
2097
+ configorama config.yml .database.host --raw --copy
2089
2098
 
2090
2099
  # Output as YAML
2091
2100
  configorama config.yml --format yaml
@@ -2102,6 +2111,8 @@ Options:
2102
2111
  -v, --version Show version number
2103
2112
  -o, --output <file> Write output to file instead of stdout
2104
2113
  -f, --format <format> Output format: json, yaml, or js (default: json)
2114
+ -r, --raw Print extracted scalar values without JSON quoting
2115
+ -c, --copy Copy the formatted output to the clipboard
2105
2116
  -d, --debug Enable debug mode
2106
2117
  -i, --info Show info about the config
2107
2118
  -V, --verify Verify the config
@@ -2110,10 +2121,24 @@ Options:
2110
2121
  --allow-undefined Allow undefined values in the final output
2111
2122
 
2112
2123
  Path Extraction:
2113
- configorama config.yml database.host Extract specific value
2114
- configorama config.yml functions[0] Extract from array
2124
+ configorama config.yml .database.host Extract a nested value
2125
+ configorama config.yml '.functions[0]' Extract from an array
2126
+ configorama -r config.yml .stage Print raw scalar output
2127
+ configorama -r -c config.yml .stage Print and copy raw scalar output
2115
2128
  ```
2116
2129
 
2130
+ Path extraction uses jq-style paths. JSON remains the default output format, so extracted strings are quoted by default:
2131
+
2132
+ ```bash
2133
+ configorama config.yml .stage
2134
+ # "prod"
2135
+
2136
+ configorama config.yml .stage --raw
2137
+ # prod
2138
+ ```
2139
+
2140
+ `--copy` copies exactly the formatted value that the CLI prints. It uses native clipboard commands where available: `pbcopy` on macOS, `clip` on Windows, and `wl-copy`, `xclip`, or `xsel` on Linux.
2141
+
2117
2142
  ### CLI Examples
2118
2143
 
2119
2144
  **Basic resolution:**
@@ -2151,12 +2176,20 @@ database:
2151
2176
  host: localhost
2152
2177
  port: 5432
2153
2178
 
2154
- # Extract database.host
2155
- configorama config.yml database.host
2179
+ # Extract database.host as JSON
2180
+ configorama config.yml .database.host
2181
+ # Output: "localhost"
2182
+
2183
+ # Extract database.host as a raw scalar
2184
+ configorama config.yml .database.host --raw
2185
+ # Output: localhost
2186
+
2187
+ # Extract and copy the raw scalar
2188
+ configorama config.yml .database.host --raw --copy
2156
2189
  # Output: localhost
2157
2190
 
2158
2191
  # Extract database config as JSON
2159
- configorama config.yml database --format json
2192
+ configorama config.yml .database --format json
2160
2193
  # Output: {"host":"localhost","port":5432}
2161
2194
  ```
2162
2195
 
@@ -2216,7 +2249,7 @@ configorama config.yml --allow-unknown
2216
2249
  **Allow undefined values in the final output:**
2217
2250
 
2218
2251
  ```bash
2219
- # Don't error on values that resolved to undefined emit them as nulls
2252
+ # Don't error on values that resolved to undefined; emit them as nulls
2220
2253
  # (useful for downstream tooling that does its own validation)
2221
2254
  configorama config.yml --allow-undefined
2222
2255
  ```
@@ -2863,7 +2896,7 @@ const fullyResolved = await externalResolver(partiallyResolved)
2863
2896
 
2864
2897
  **Use case:** Serverless Framework + Serverless Dashboard workflow.
2865
2898
 
2866
- > For CloudFormation refs specifically, the bundled [CF plugin](./plugins/cloudformation/README.md) resolves them natively in Stage 1 you don't need a second pass.
2899
+ > For CloudFormation refs specifically, the bundled [CF plugin](./plugins/cloudformation/README.md) resolves them natively in Stage 1, so you don't need a second pass.
2867
2900
 
2868
2901
  ---
2869
2902
 
@@ -3000,11 +3033,11 @@ timeout: ${selectByEnv(30, 5, ${environment})}
3000
3033
 
3001
3034
  ## Comparison vs Serverless Framework Variables
3002
3035
 
3003
- Configorama was forked from the Serverless Framework variable system and extended. Here's what's different:
3036
+ Configorama was forked from the Serverless Framework variable system and extended. The differences:
3004
3037
 
3005
3038
  | Capability | Serverless | Configorama |
3006
3039
  |---|---|---|
3007
- | Framework-agnostic use outside Serverless | ❌ Serverless-only | ✅ Any tool, any framework |
3040
+ | Framework-agnostic; use outside Serverless | ❌ Serverless-only | ✅ Any tool, any framework |
3008
3041
  | Pluggable variable sources | ❌ Hardcoded | ✅ Custom resolvers, custom syntax |
3009
3042
  | `self:` prefix optional in self-refs | ❌ Required | ✅ `${foo.bar}` works without `self:` |
3010
3043
  | Numbers as defaults | ❌ Coerced to string | ✅ `${env:TIMEOUT, 30}` stays numeric |
@@ -3067,7 +3100,7 @@ MIT © [David Wells](https://davidwells.io)
3067
3100
 
3068
3101
  ## Contributing
3069
3102
 
3070
- Bug reports and reproductions are very welcome please open an [issue](https://github.com/DavidWells/configorama/issues) with a minimal failing config. PRs are reviewed case-by-case; small targeted fixes with a test case are most likely to land quickly.
3103
+ Bug reports and reproductions are very welcome. Please open an [issue](https://github.com/DavidWells/configorama/issues) with a minimal failing config. PRs are reviewed case-by-case; small targeted fixes with a test case are most likely to land quickly.
3071
3104
 
3072
3105
  ## Support
3073
3106
 
package/cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const fs = require('fs')
4
4
  const minimist = require('minimist')
5
+ const { spawnSync } = require('child_process')
5
6
  const Configorama = require('./src/main')
6
7
  const deepLog = require('./src/utils/ui/deep-log')
7
8
  const { logHeader } = require('./src/utils/ui/logs')
@@ -12,13 +13,15 @@ const getValueAtPath = require('./src/utils/parsing/getValueAtPath')
12
13
  // Parse command line arguments
13
14
  const argv = minimist(process.argv.slice(2), {
14
15
  string: ['output', 'o', 'format', 'f', 'param'],
15
- boolean: ['help', 'h', 'version', 'v', 'V', 'debug', 'allow-unknown', 'allow-undefined', 'list', 'info', 'verify'],
16
+ boolean: ['help', 'h', 'version', 'v', 'V', 'debug', 'allow-unknown', 'allow-undefined', 'list', 'info', 'verify', 'raw', 'r', 'copy', 'c'],
16
17
  alias: {
17
18
  h: 'help',
18
19
  v: 'version',
19
20
  V: 'verify',
20
21
  o: 'output',
21
22
  f: 'format',
23
+ r: 'raw',
24
+ c: 'copy',
22
25
  l: 'list',
23
26
  i: 'info',
24
27
  },
@@ -40,6 +43,8 @@ Options:
40
43
  -v, --version Show version number
41
44
  -o, --output <file> Write output to file instead of stdout
42
45
  -f, --format <format> Output format: json, yaml, or js (default: json)
46
+ -r, --raw Print extracted scalar values without JSON quoting
47
+ -c, --copy Copy the formatted output to the clipboard
43
48
  -d, --debug Enable debug mode
44
49
  -i, --info Show info about the config
45
50
  -V, --verify Verify the config
@@ -62,6 +67,8 @@ Path Extraction:
62
67
  Examples:
63
68
  configorama config.yml
64
69
  configorama config.yml .database.host
70
+ configorama -r config.yml .database.host
71
+ configorama -r --copy config.yml .database.host
65
72
  configorama '.servers[0].port' config.yml
66
73
  configorama --info config.yml
67
74
  configorama --format yaml config.json
@@ -84,11 +91,53 @@ if (argv.version) {
84
91
  let inputFile = null
85
92
  let extractPath = null
86
93
 
94
+ function isFileArg(arg) {
95
+ if (fs.existsSync(arg) && fs.statSync(arg).isFile()) return true
96
+ return arg.startsWith('./') || arg.startsWith('../')
97
+ }
98
+
99
+ function getClipboardCommands() {
100
+ if (process.env.CONFIGORAMA_CLIPBOARD_COMMAND) {
101
+ return [{ command: process.env.CONFIGORAMA_CLIPBOARD_COMMAND, shell: true }]
102
+ }
103
+
104
+ if (process.platform === 'darwin') return [{ command: 'pbcopy', args: [] }]
105
+ if (process.platform === 'win32') return [{ command: 'clip', args: [] }]
106
+
107
+ return [
108
+ { command: 'wl-copy', args: [] },
109
+ { command: 'xclip', args: ['-selection', 'clipboard'] },
110
+ { command: 'xsel', args: ['--clipboard', '--input'] }
111
+ ]
112
+ }
113
+
114
+ function copyToClipboard(value) {
115
+ let lastError = ''
116
+ for (const candidate of getClipboardCommands()) {
117
+ const result = spawnSync(candidate.command, candidate.args || [], {
118
+ input: String(value),
119
+ encoding: 'utf8',
120
+ shell: !!candidate.shell,
121
+ stdio: ['pipe', 'ignore', 'pipe']
122
+ })
123
+
124
+ if (!result.error && result.status === 0) return { ok: true }
125
+ lastError = result.error ? result.error.message : (result.stderr || '').trim()
126
+ }
127
+
128
+ return {
129
+ ok: false,
130
+ error: lastError || 'No supported clipboard command found'
131
+ }
132
+ }
133
+
87
134
  for (const arg of argv._) {
88
135
  if (arg === 'setup') continue
89
136
 
90
137
  // jq-style paths start with '.' or '['
91
- if (arg.startsWith('.') || arg.startsWith('[')) {
138
+ if (!inputFile && isFileArg(arg)) {
139
+ inputFile = arg
140
+ } else if (arg.startsWith('.') || arg.startsWith('[')) {
92
141
  extractPath = arg
93
142
  } else if (!inputFile) {
94
143
  inputFile = arg
@@ -134,6 +183,10 @@ const {
134
183
  l,
135
184
  info,
136
185
  i,
186
+ r,
187
+ raw,
188
+ c,
189
+ copy,
137
190
  'allow-unknown': allowUnknown,
138
191
  'allow-undefined': allowUndefined,
139
192
  'allow-unknown-file-refs': allowUnknownFileRefs,
@@ -177,7 +230,9 @@ configorama(inputFile, options)
177
230
  let output
178
231
 
179
232
  // Format the output
180
- switch (argv.format.toLowerCase()) {
233
+ if (argv.raw && extractPath && (config === null || ['string', 'number', 'boolean'].includes(typeof config))) {
234
+ output = config === null ? 'null' : String(config)
235
+ } else switch (argv.format.toLowerCase()) {
181
236
  case 'yaml':
182
237
  case 'yml':
183
238
  const YAML = require('./src/parsers/yaml')
@@ -204,6 +259,14 @@ configorama(inputFile, options)
204
259
  output = JSON.stringify(config, null, 2)
205
260
  }
206
261
 
262
+ if (argv.copy) {
263
+ const copyResult = copyToClipboard(output)
264
+ if (!copyResult.ok) {
265
+ console.error(`Error: Unable to copy to clipboard: ${copyResult.error}`)
266
+ process.exit(1)
267
+ }
268
+ }
269
+
207
270
  // Write to file or stdout
208
271
  if (argv.output) {
209
272
  fs.writeFileSync(argv.output, output)
@@ -230,4 +293,4 @@ configorama(inputFile, options)
230
293
  console.error('error', error)
231
294
  }
232
295
  process.exit(1)
233
- })
296
+ })
package/index.d.ts CHANGED
@@ -38,6 +38,18 @@ interface ConfigoramaSettings {
38
38
  /** Allow undefined values as final results */
39
39
  allowUndefinedValues?: boolean
40
40
 
41
+ /**
42
+ * Glob-like config paths whose values should be left verbatim.
43
+ * Useful for embedded languages that also use ${...}.
44
+ */
45
+ ignorePaths?: string[]
46
+
47
+ /** Alias for ignorePaths */
48
+ skipResolutionPaths?: string[]
49
+
50
+ /** Disable the built-in CloudFormation and embedded-code ignore paths */
51
+ disableDefaultIgnorePaths?: boolean
52
+
41
53
  // === Legacy Options (deprecated, use above instead) ===
42
54
 
43
55
  /** @deprecated Use allowUnknownVariableTypes instead */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configorama",
3
- "version": "0.10.0",
3
+ "version": "0.10.3",
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
@@ -13,6 +13,9 @@ const { buildVariableSyntax } = require('./utils/variables/variableUtils')
13
13
  * @property {Object.<string, Function>} [functions] - Object of custom functions
14
14
  * @property {boolean} [allowUnknownVars] - allow unknown variables to pass through without throwing errors
15
15
  * @property {boolean} [allowUndefinedValues] - allow undefined values to pass through without throwing errors
16
+ * @property {string[]} [ignorePaths] - glob-like config paths whose values should be left verbatim
17
+ * @property {string[]} [skipResolutionPaths] - alias for ignorePaths
18
+ * @property {boolean} [disableDefaultIgnorePaths] - disable built-in CloudFormation and embedded-code ignore paths
16
19
  * @property {Object|Function} [dynamicArgs] - values passed into .js config files if user using javascript config
17
20
  * @property {boolean} [returnMetadata] - return both config and metadata about variables found
18
21
  * @property {boolean} [dotEnvSilent] - suppress env-stage-loader logs when useDotenv/useDotEnv is enabled
package/src/main.js CHANGED
@@ -60,6 +60,7 @@ const { mergeByKeys } = require('./utils/parsing/mergeByKeys')
60
60
  const { arrayToJsonPath } = require('./utils/parsing/arrayToJsonPath')
61
61
  /* Utils - paths */
62
62
  const { findLineByPath } = require('./utils/paths/findLineForKey')
63
+ const { normalizeIgnorePaths, compileIgnorePaths, shouldIgnorePath } = require('./utils/paths/ignorePaths')
63
64
  /* Utils - regex */
64
65
  const { combineRegexes, funcRegex, fileRefSyntax, textRefSyntax } = require('./utils/regex')
65
66
  /* Utils - strings */
@@ -162,6 +163,11 @@ class Configorama {
162
163
  // CLI users can still see them with --verbose or dotEnvSilent: false.
163
164
  dotEnvSilent: !VERBOSE,
164
165
  dotEnvDebug: false,
166
+ // Glob-like path patterns whose values should be left verbatim.
167
+ // Useful for embedded languages that also use ${...}, such as
168
+ // CloudFormation Fn::Sub, inline Lambda code, and CloudFront functions.
169
+ ignorePaths: [],
170
+ skipResolutionPaths: [],
165
171
  }, options)
166
172
 
167
173
  // Backward compat: allowUnknownVars -> allowUnknownVariableTypes
@@ -221,9 +227,10 @@ class Configorama {
221
227
 
222
228
  // Use $[...] syntax for HCL/Terraform files to avoid conflicts with Terraform's ${} syntax
223
229
  const isHclFile = detectedFileType === '.tf' || detectedFileType === '.hcl'
230
+ const defaultExcludedPatterns = ['AWS', 'aws:', 'stageVariables']
224
231
  const defaultSyntax = isHclFile
225
- ? buildVariableSyntax('$[', ']', ['AWS', 'stageVariables'])
226
- : buildVariableSyntax('${', '}', ['AWS', 'stageVariables'])
232
+ ? buildVariableSyntax('$[', ']', defaultExcludedPatterns)
233
+ : buildVariableSyntax('${', '}', defaultExcludedPatterns)
227
234
 
228
235
  const varSyntax = options.syntax || defaultSyntax
229
236
  let varRegex
@@ -247,6 +254,7 @@ class Configorama {
247
254
  this.varPrefixPattern = new RegExp('^' + this.varPrefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
248
255
  this.varSuffixPattern = new RegExp(escapedSuffix + '$')
249
256
  this.varSuffixWithSpacePattern = new RegExp('\\s+' + escapedSuffix + '$')
257
+ this.ignorePathPatterns = compileIgnorePaths(normalizeIgnorePaths(this.settings))
250
258
 
251
259
  // Set initial config object to populate
252
260
  if (typeof fileOrObject === 'object') {
@@ -1063,6 +1071,7 @@ class Configorama {
1063
1071
  originalConfig: this.originalConfig,
1064
1072
  varSuffix: this.varSuffix,
1065
1073
  varSuffixWithSpacePattern: this.varSuffixWithSpacePattern,
1074
+ ignorePathPatterns: this.ignorePathPatterns,
1066
1075
  })
1067
1076
 
1068
1077
  return this._cachedMetadata
@@ -1102,6 +1111,10 @@ class Configorama {
1102
1111
  // #######################
1103
1112
  // ## PROPERTY HANDLING ##
1104
1113
  // #######################
1114
+ shouldSkipResolution(pathValue) {
1115
+ return shouldIgnorePath(pathValue, this.ignorePathPatterns)
1116
+ }
1117
+
1105
1118
  /**
1106
1119
  * The declaration of a terminal property. This declaration includes the path and value of the
1107
1120
  * property.
@@ -1259,6 +1272,11 @@ class Configorama {
1259
1272
  }
1260
1273
  return false
1261
1274
  })
1275
+ /* Leave opaque paths verbatim. These often contain non-configorama
1276
+ `${...}` syntax from CloudFormation, JavaScript, shell, VTL, etc. */
1277
+ variables = variables.filter((property) => {
1278
+ return !this.shouldSkipResolution(property.path)
1279
+ })
1262
1280
  /*
1263
1281
  console.log(`variables at call count ${this.callCount}`, variables)
1264
1282
  /** */
@@ -1545,6 +1563,9 @@ class Configorama {
1545
1563
  console.log(valueObject)
1546
1564
  }
1547
1565
  const property = valueObject.value
1566
+ if (this.shouldSkipResolution(valueObject.path)) {
1567
+ return Promise.resolve(property)
1568
+ }
1548
1569
  const matches = this.getMatches(property)
1549
1570
  /*
1550
1571
  console.log('populateValue matches', matches)
package/src/metadata.js CHANGED
@@ -6,6 +6,7 @@ const fs = require('fs')
6
6
  const traverse = require('traverse')
7
7
  const dotProp = require('dot-prop')
8
8
  const { normalizePath, extractFilePath, resolveInnerVariables } = require('./utils/paths/filePathUtils')
9
+ const { shouldIgnorePath } = require('./utils/paths/ignorePaths')
9
10
  const { findNestedVariables } = require('./utils/variables/findNestedVariables')
10
11
  const { splitOnPipe } = require('./utils/strings/splitOnPipe')
11
12
 
@@ -21,6 +22,7 @@ const { splitOnPipe } = require('./utils/strings/splitOnPipe')
21
22
  * @param {Object} params.originalConfig - this.originalConfig, used for dotProp.get checks
22
23
  * @param {string} params.varSuffix
23
24
  * @param {RegExp} params.varSuffixWithSpacePattern
25
+ * @param {string[][]} [params.ignorePathPatterns]
24
26
  * @returns {Object} Metadata object containing variables, fileDependencies, and summary
25
27
  */
26
28
  function collectVariableMetadata({
@@ -33,6 +35,7 @@ function collectVariableMetadata({
33
35
  originalConfig,
34
36
  varSuffix,
35
37
  varSuffixWithSpacePattern,
38
+ ignorePathPatterns,
36
39
  }) {
37
40
  const foundVariables = []
38
41
  const variableData = {}
@@ -46,8 +49,8 @@ function collectVariableMetadata({
46
49
  traverse(displayConfig).forEach(function (rawValue) {
47
50
  if (typeof rawValue === 'string' && rawValue.match(variableSyntax)) {
48
51
  const configValuePath = this.path.join('.')
49
- /* Skip Fn::Sub variables */
50
- if (configValuePath.endsWith('Fn::Sub')) {
52
+ /* Skip opaque paths that contain non-configorama ${...} syntax. */
53
+ if (shouldIgnorePath(this.path, ignorePathPatterns)) {
51
54
  return
52
55
  }
53
56
 
@@ -10,7 +10,7 @@ const { executeTypeScriptFileSync } = require('../../parsers/typescript')
10
10
  const { executeESMFileSync } = require('../../parsers/esm')
11
11
  const cloudFormationSchema = require('./cloudformationSchema')
12
12
 
13
- const DEFAULT_VAR_SYNTAX = '\\${((?!AWS|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._\'",|\\-\\/\\(\\)\\\\]+?)}'
13
+ const DEFAULT_VAR_SYNTAX = '\\${((?!AWS|aws:|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._\'",|\\-\\/\\(\\)\\\\]+?)}'
14
14
 
15
15
  const KNOWN_EXTENSIONS = new Set([
16
16
  '.yml', '.yaml', '.json', '.json5', '.jsonc',
@@ -0,0 +1,69 @@
1
+ const DEFAULT_IGNORE_PATHS = [
2
+ '**.Fn::Sub',
3
+ '**.Properties.Code.ZipFile',
4
+ '**.Properties.FunctionCode',
5
+ '**.Properties.UserData',
6
+ '**.Properties.BuildSpec',
7
+ '**.Properties.DefinitionString',
8
+ '**.Properties.DefinitionBody',
9
+ '**.Properties.RequestMappingTemplate',
10
+ '**.Properties.ResponseMappingTemplate',
11
+ '**.Properties.RequestTemplates.*',
12
+ '**.Properties.ResponseTemplates.*',
13
+ '**.Metadata.AWS::CloudFormation::Init.*.files.*.content',
14
+ '**.Metadata.AWS::CloudFormation::Init.*.commands.*.command'
15
+ ]
16
+
17
+ function toArray(value) {
18
+ if (!value) return []
19
+ return Array.isArray(value) ? value : [value]
20
+ }
21
+
22
+ function pathToSegments(pathValue) {
23
+ if (!pathValue) return []
24
+ return Array.isArray(pathValue) ? pathValue.map(String) : String(pathValue).split('.')
25
+ }
26
+
27
+ function patternToSegments(pattern) {
28
+ return String(pattern).split('.')
29
+ }
30
+
31
+ function matchSegments(patternSegments, pathSegments) {
32
+ if (!patternSegments.length) return pathSegments.length === 0
33
+
34
+ const [head, ...tail] = patternSegments
35
+ if (head === '**') {
36
+ if (matchSegments(tail, pathSegments)) return true
37
+ return pathSegments.length > 0 && matchSegments(patternSegments, pathSegments.slice(1))
38
+ }
39
+
40
+ if (!pathSegments.length) return false
41
+ if (head !== '*' && head !== pathSegments[0]) return false
42
+ return matchSegments(tail, pathSegments.slice(1))
43
+ }
44
+
45
+ function normalizeIgnorePaths(options = {}) {
46
+ const defaults = options.disableDefaultIgnorePaths ? [] : DEFAULT_IGNORE_PATHS
47
+ return Array.from(new Set([
48
+ ...defaults,
49
+ ...toArray(options.ignorePaths),
50
+ ...toArray(options.skipResolutionPaths)
51
+ ]))
52
+ }
53
+
54
+ function compileIgnorePaths(patterns) {
55
+ return toArray(patterns).map(patternToSegments)
56
+ }
57
+
58
+ function shouldIgnorePath(pathValue, compiledPatterns) {
59
+ if (!compiledPatterns || !compiledPatterns.length) return false
60
+ const pathSegments = pathToSegments(pathValue)
61
+ return compiledPatterns.some((patternSegments) => matchSegments(patternSegments, pathSegments))
62
+ }
63
+
64
+ module.exports = {
65
+ DEFAULT_IGNORE_PATHS,
66
+ normalizeIgnorePaths,
67
+ compileIgnorePaths,
68
+ shouldIgnorePath
69
+ }
@@ -2,7 +2,7 @@ const { test } = require('uvu')
2
2
  const assert = require('uvu/assert')
3
3
  const { splitByComma } = require('./splitByComma')
4
4
 
5
- const variableSyntax = /\${((?!AWS|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._'",|\-\/\(\)\\]+?)}/g
5
+ const variableSyntax = /\${((?!AWS|aws:|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._'",|\-\/\(\)\\]+?)}/g
6
6
 
7
7
  test('splitByComma - should return array with original string when no commas present', () => {
8
8
  const result = splitByComma('singleString')
@@ -145,4 +145,4 @@ test('splitByComma - should handle odd backslashes (escaped quote)', () => {
145
145
  })
146
146
 
147
147
  // Run all tests
148
- test.run()
148
+ test.run()
@@ -358,7 +358,7 @@ function findNestedVariablesOld(input, regex, variablesKnownTypes, debug = false
358
358
  }
359
359
 
360
360
  // // Test with the example
361
- // const regex = /\${((?!AWS|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._'",|\-\/\(\)\\]+?)}/g
361
+ // const regex = /\${((?!AWS|aws:|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._'",|\-\/\(\)\\]+?)}/g
362
362
  // const input = '${file(./config.${opt:stage, ${defaultStage}}.json):CREDS}'
363
363
 
364
364
  // // Run the function with debug output
@@ -374,4 +374,4 @@ function findNestedVariablesOld(input, regex, variablesKnownTypes, debug = false
374
374
 
375
375
  module.exports = {
376
376
  findNestedVariables
377
- }
377
+ }
@@ -9,7 +9,7 @@ const getValueFromOptions = require('../../resolvers/valueFromOptions')
9
9
  const getValueFromGit = require('../../resolvers/valueFromGit')
10
10
 
11
11
  // Define the regex pattern as used in the main function
12
- const regex = /\${((?!AWS|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._'",|\-\/\(\)\\]+?)}/g;
12
+ const regex = /\${((?!AWS|aws:|stageVariables)[ ~:a-zA-Z0-9=+!@#%*<>?._'",|\-\/\(\)\\]+?)}/g;
13
13
  const variablesKnownTypes = /(^env:|^opt:|^self:|^file\((~?[\{\}\:\$a-zA-Z0-9._\-\/,'" ]+?)\)|^git:|(\${)?deep:\d+(\.[^}]+)*()}?)/
14
14
 
15
15
  const fileRefSyntax = RegExp(/^file\((~?[@\{\}\:\$a-zA-Z0-9._\-\/,'" ]+?)\)/g)
@@ -239,4 +239,4 @@ test('findNestedVariables - deep - no var types passed', () => {
239
239
 
240
240
 
241
241
  // Run all tests
242
- test.run();
242
+ test.run();
@@ -93,10 +93,10 @@ Remove or update the \${${variableString}} to fix
93
93
  * Excludes suffix characters from the allowed set to prevent parsing issues
94
94
  * @param {string} [prefix='${'] - Variable prefix
95
95
  * @param {string} [suffix='}'] - Variable suffix
96
- * @param {string[]} [excludePatterns=['AWS', 'stageVariables']] - Patterns to exclude via negative lookahead
96
+ * @param {string[]} [excludePatterns=['AWS', 'aws:', 'stageVariables']] - Patterns to exclude via negative lookahead
97
97
  * @returns {string} Regex source string
98
98
  */
99
- function buildVariableSyntax(prefix = '${', suffix = '}', excludePatterns = ['AWS', 'stageVariables']) {
99
+ function buildVariableSyntax(prefix = '${', suffix = '}', excludePatterns = ['AWS', 'aws:', 'stageVariables']) {
100
100
  // All allowed characters, stored as individual escaped entries for regex character class
101
101
  // Each entry is how it appears in a regex character class
102
102
  // NOTE: { and } are intentionally excluded - they break nested variable matching
@@ -145,4 +145,4 @@ module.exports = {
145
145
  getFallbackString,
146
146
  verifyVariable,
147
147
  buildVariableSyntax
148
- }
148
+ }
@@ -172,6 +172,15 @@ test('buildVariableSyntax - supports backslash in values', () => {
172
172
  assert.is(match[0], "${env:FOO, 'path\\to\\file'}")
173
173
  })
174
174
 
175
+ test('buildVariableSyntax - default ${} syntax excludes IAM aws variables', () => {
176
+ const syntax = buildVariableSyntax('${', '}')
177
+ const regex = new RegExp(syntax, 'g')
178
+
179
+ assert.not.ok('${aws:username}'.match(regex))
180
+ assert.not.ok('arn:aws:s3:::bucket/${aws:PrincipalTag/team}/*'.match(regex))
181
+ assert.ok('${self:custom.value}'.match(regex))
182
+ })
183
+
175
184
  test('buildVariableSyntax - double brace ${{}} syntax excludes }', () => {
176
185
  const syntax = buildVariableSyntax('${{', '}}')
177
186
  const regex = new RegExp(syntax, 'g')
@@ -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"}
@@ -4,15 +4,10 @@ declare class Configorama {
4
4
  settings: any;
5
5
  filterCache: {};
6
6
  _originalValueCache: Map<any, any>;
7
- _resolvedPaths: Set<any>;
8
- _fileContentCache: Map<any, any>;
9
- _needsRawClone: boolean;
10
7
  foundVariables: any[];
11
8
  fileRefsFound: any[];
12
9
  resolutionTracking: {};
13
- _trackCalls: boolean;
14
10
  variableSyntax: RegExp;
15
- variableSyntaxTest: RegExp;
16
11
  varPrefix: string;
17
12
  varSuffix: string;
18
13
  varPrefixPattern: RegExp;
@@ -69,7 +64,22 @@ declare class Configorama {
69
64
  * @returns {object} Metadata object containing variables, fileRefs, and summary
70
65
  */
71
66
  collectVariableMetadata(): object;
72
- _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
+ };
73
83
  /**
74
84
  * Populate the variables in the given object.
75
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":";AAyIA;IACE,0CAufC;IA/eC,cAkBW;IAuBX,gBAAqB;IAErB,mCAAoC;IAGpC,yBAA+B;IAG/B,iCAAkC;IAMlC,wBAIC;IAED,sBAAwB;IACxB,qBAAuB;IAGvB,uBAA4B;IAE5B,qBAAmD;IAsBnD,uBAAoC;IAIpC,2BAAkG;IAIlG,kBAAqC;IACrC,kBAAqC;IAErC,yBAA+F;IAC/F,yBAAuD;IACvD,kCAAyE;IAMrE,uBAAgD;IAMlD,YAAuB;IAEvB,oBAA0C;IAE1C,gBAAoD;IAOpD,uBAAkC;IAElC,uBAA8B;IAE9B,uBAAkC;IASpC,wBAAmC;IAGnC,mBAqHC;IAwED,4BAA8C;IAG9C,iCAAkC;IA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AAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAsa9J;IAID;;;;;;;;OAQG;IACH,qEAHa,OAAO,CAAC,GAAG,CAAC,CAoExB;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"}
@@ -14,7 +14,6 @@
14
14
  * @param {RegExp} ctx.textRefSyntax - Regex for text() syntax
15
15
  * @param {string} ctx.varPrefix - Variable prefix (e.g., '${')
16
16
  * @param {string} ctx.varSuffix - Variable suffix (e.g., '}')
17
- * @param {Map<string, string>} [ctx.fileContentCache] - Optional per-instance read cache keyed by absolute file path
18
17
  * @param {string} variableString - The variable string to resolve
19
18
  * @param {object} options - Resolution options
20
19
  * @returns {Promise<any>}
@@ -33,7 +32,6 @@ export function getValueFromFile(ctx: {
33
32
  textRefSyntax: RegExp;
34
33
  varPrefix: string;
35
34
  varSuffix: string;
36
- fileContentCache?: Map<string, string>;
37
35
  }, variableString: string, options: object): Promise<any>;
38
36
  /**
39
37
  * Parse file contents based on file extension
@@ -1 +1 @@
1
- {"version":3,"file":"valueFromFile.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromFile.js"],"names":[],"mappings":"AA8FA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,sCAlBG;IAAoB,UAAU,EAAtB,MAAM;IACK,aAAa;IACZ,cAAc,EAA1B,MAAM;IACM,mBAAmB,EAA/B,MAAM;IACM,aAAa,EAAzB,MAAM;IACM,IAAI,EAAhB,MAAM;IACM,cAAc,EAA1B,MAAM;IACM,MAAM,EAAlB,MAAM;IACQ,cAAc;IAChB,aAAa,EAAzB,MAAM;IACM,aAAa,EAAzB,MAAM;IACM,SAAS,EAArB,MAAM;IACM,SAAS,EAArB,MAAM;IACoB,gBAAgB,GAA1C,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B,kBAAQ,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,CA+VxB;AA5YD;;;;;GAKG;AACH,2CAJW,MAAM,YACN,MAAM,GACJ,GAAC,CAoBb;AAsXD;;;;;;GAMG;AACH,qDAJW,MAAM,qBACN,MAAM,GACJ;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,GAAC,IAAI,CAAA;CAAE,CAkBhE;AAED;;;;;;GAMG;AACH,sDALW,MAAM,qBACN,MAAM,yBACN,OAAO,GACL,MAAM,EAAE,CAcpB"}
1
+ {"version":3,"file":"valueFromFile.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromFile.js"],"names":[],"mappings":"AA8FA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sCAjBG;IAAoB,UAAU,EAAtB,MAAM;IACK,aAAa;IACZ,cAAc,EAA1B,MAAM;IACM,mBAAmB,EAA/B,MAAM;IACM,aAAa,EAAzB,MAAM;IACM,IAAI,EAAhB,MAAM;IACM,cAAc,EAA1B,MAAM;IACM,MAAM,EAAlB,MAAM;IACQ,cAAc;IAChB,aAAa,EAAzB,MAAM;IACM,aAAa,EAAzB,MAAM;IACM,SAAS,EAArB,MAAM;IACM,SAAS,EAArB,MAAM;CACd,kBAAQ,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,CAwVxB;AApYD;;;;;GAKG;AACH,2CAJW,MAAM,YACN,MAAM,GACJ,GAAC,CAoBb;AA8WD;;;;;;GAMG;AACH,qDAJW,MAAM,qBACN,MAAM,GACJ;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,GAAC,IAAI,CAAA;CAAE,CAkBhE;AAED;;;;;;GAMG;AACH,sDALW,MAAM,qBACN,MAAM,yBACN,OAAO,GACL,MAAM,EAAE,CAcpB"}
@@ -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"}
@@ -1 +1 @@
1
- {"version":3,"file":"preProcess.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/preProcess.js"],"names":[],"mappings":";AASA;;;;;;;;GAQG;AACH,+DANW,MAAM,mCAGd;IAA0B,eAAe,GAAjC,OAAO;CACf,OA4XF"}
1
+ {"version":3,"file":"preProcess.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/preProcess.js"],"names":[],"mappings":";AASA;;;;;;;;GAQG;AACH,+DANW,MAAM,mCAGd;IAA0B,eAAe,GAAjC,OAAO;CACf,OAgYF"}
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/metadata.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,mMAXG;IAAuB,cAAc,EAA7B,MAAM;IACS,mBAAmB;IACnB,aAAa;IACR,WAAW,EAA/B,MAAM,GAAC,IAAI;IACI,cAAc,EAA7B,MAAM;IACS,aAAa;IACb,cAAc;IACd,SAAS,EAAxB,MAAM;IACS,yBAAyB,EAAxC,MAAM;CACd,OAyaF"}
@@ -1,10 +0,0 @@
1
- export = BoundedMap;
2
- declare class BoundedMap {
3
- constructor(maxSize?: number);
4
- _map: Map<any, any>;
5
- _maxSize: number;
6
- get(key: any): any;
7
- has(key: any): boolean;
8
- set(key: any, value: any): this;
9
- }
10
- //# sourceMappingURL=BoundedMap.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BoundedMap.d.ts","sourceRoot":"","sources":["../../../src/utils/BoundedMap.js"],"names":[],"mappings":";AAGA;IACE,8BAGC;IAFC,oBAAqB;IACrB,iBAAuB;IAEzB,mBAEC;IACD,uBAEC;IACD,gCAOC;CACF"}