configorama 0.9.5 → 0.9.11
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/README.md +156 -5
- package/package.json +20 -2
- package/src/main.js +268 -105
- package/src/parsers/esm.js +0 -14
- package/src/parsers/hcl-parse-script.js +40 -0
- package/src/parsers/hcl.js +131 -3
- package/src/parsers/hcl.slow-test.js +141 -0
- package/src/parsers/index.js +3 -1
- package/src/parsers/typescript.js +0 -10
- package/src/resolvers/valueFromEval.js +69 -11
- package/src/resolvers/valueFromFile.js +54 -1
- package/src/resolvers/valueFromIf.js +75 -0
- package/src/resolvers/valueFromIf.test.js +66 -0
- package/src/resolvers/valueFromNumber.js +3 -0
- package/src/utils/handleSignalEvents.js +3 -4
- package/src/utils/lodash.js +18 -7
- package/src/utils/parsing/cloudformationSchema.js +1 -2
- package/src/utils/parsing/cloudformationSchema.test.js +14 -0
- package/src/utils/parsing/parse.js +11 -1
- package/src/utils/parsing/preProcess.js +220 -5
- package/src/utils/paths/getFullFilePath.js +6 -2
- package/src/utils/paths/getFullFilePath.test.js +18 -0
- package/src/utils/regex/index.js +18 -3
- package/src/utils/regex/index.test.js +24 -0
- package/src/utils/strings/quoteAware.js +141 -0
- package/src/utils/strings/replaceAll.js +13 -1
- package/src/utils/strings/splitByComma.js +25 -15
- package/src/utils/strings/splitByComma.test.js +19 -0
- package/src/utils/strings/splitOnPipe.js +30 -0
- package/src/utils/strings/splitOnPipe.test.js +68 -0
- package/src/utils/validation/isValidValue.test.js +1 -1
- package/src/utils/validation/warnIfNotFound.js +1 -1
- package/src/utils/variables/findNestedVariables.js +8 -2
- package/types/src/main.d.ts +3 -1
- package/types/src/main.d.ts.map +1 -1
- package/types/src/parsers/esm.d.ts.map +1 -1
- package/types/src/parsers/hcl-parse-script.d.ts +3 -0
- package/types/src/parsers/hcl-parse-script.d.ts.map +1 -0
- package/types/src/parsers/hcl.d.ts +43 -0
- package/types/src/parsers/hcl.d.ts.map +1 -1
- package/types/src/parsers/hcl.slow-test.d.ts +2 -0
- package/types/src/parsers/hcl.slow-test.d.ts.map +1 -0
- package/types/src/parsers/typescript.d.ts.map +1 -1
- package/types/src/resolvers/valueFromEval.d.ts +1 -0
- package/types/src/resolvers/valueFromEval.d.ts.map +1 -1
- package/types/src/resolvers/valueFromFile.d.ts +4 -0
- package/types/src/resolvers/valueFromFile.d.ts.map +1 -1
- package/types/src/resolvers/valueFromIf.d.ts +7 -0
- package/types/src/resolvers/valueFromIf.d.ts.map +1 -0
- package/types/src/resolvers/valueFromNumber.d.ts.map +1 -1
- package/types/src/utils/handleSignalEvents.d.ts.map +1 -1
- package/types/src/utils/lodash.d.ts.map +1 -1
- package/types/src/utils/parsing/parse.d.ts.map +1 -1
- package/types/src/utils/parsing/preProcess.d.ts +5 -1
- package/types/src/utils/parsing/preProcess.d.ts.map +1 -1
- package/types/src/utils/paths/getFullFilePath.d.ts.map +1 -1
- package/types/src/utils/regex/index.d.ts.map +1 -1
- package/types/src/utils/strings/quoteAware.d.ts +30 -0
- package/types/src/utils/strings/quoteAware.d.ts.map +1 -0
- package/types/src/utils/strings/replaceAll.d.ts.map +1 -1
- package/types/src/utils/strings/splitByComma.d.ts +1 -1
- package/types/src/utils/strings/splitByComma.d.ts.map +1 -1
- package/types/src/utils/strings/splitOnPipe.d.ts +8 -0
- package/types/src/utils/strings/splitOnPipe.d.ts.map +1 -0
- package/types/src/utils/variables/findNestedVariables.d.ts.map +1 -1
|
@@ -32,7 +32,7 @@ function splitByComma(string, regexPattern) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const result = []
|
|
35
|
-
let
|
|
35
|
+
let segmentStart = 0 // Track segment start index (perf: avoid string concat)
|
|
36
36
|
let inQuote = false
|
|
37
37
|
let quoteChar = ""
|
|
38
38
|
let bracketDepth = 0 // Includes (), [], and {}
|
|
@@ -43,12 +43,22 @@ function splitByComma(string, regexPattern) {
|
|
|
43
43
|
const prevChar = i > 0 ? protectedString[i-1] : ''
|
|
44
44
|
|
|
45
45
|
// Handle quotes
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
if (char === "'" || char === '"') {
|
|
47
|
+
// Count consecutive backslashes before this quote
|
|
48
|
+
let backslashCount = 0
|
|
49
|
+
for (let j = i - 1; j >= 0 && protectedString[j] === "\\"; j--) {
|
|
50
|
+
backslashCount++
|
|
51
|
+
}
|
|
52
|
+
// Quote is escaped only if preceded by odd number of backslashes
|
|
53
|
+
const isEscaped = backslashCount % 2 === 1
|
|
54
|
+
|
|
55
|
+
if (!isEscaped) {
|
|
56
|
+
if (!inQuote) {
|
|
57
|
+
inQuote = true
|
|
58
|
+
quoteChar = char
|
|
59
|
+
} else if (char === quoteChar) {
|
|
60
|
+
inQuote = false
|
|
61
|
+
}
|
|
52
62
|
}
|
|
53
63
|
}
|
|
54
64
|
|
|
@@ -78,17 +88,17 @@ function splitByComma(string, regexPattern) {
|
|
|
78
88
|
}
|
|
79
89
|
}
|
|
80
90
|
|
|
81
|
-
// Process comma
|
|
91
|
+
// Process comma - use substring instead of char-by-char concat
|
|
82
92
|
if (char === "," && !inQuote && bracketDepth === 0 && dollarBraceDepth === 0) {
|
|
83
|
-
result.push(
|
|
84
|
-
|
|
85
|
-
} else {
|
|
86
|
-
current += char
|
|
93
|
+
result.push(protectedString.substring(segmentStart, i).trim())
|
|
94
|
+
segmentStart = i + 1
|
|
87
95
|
}
|
|
88
96
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
|
|
98
|
+
// Add final segment
|
|
99
|
+
const finalSegment = protectedString.substring(segmentStart).trim()
|
|
100
|
+
if (finalSegment || result.length > 0) {
|
|
101
|
+
result.push(finalSegment)
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
if (!regexPattern) {
|
|
@@ -125,5 +125,24 @@ test('splitByComma - should handle deeply nested variables with regex', () => {
|
|
|
125
125
|
assert.equal(result[3], '"three"')
|
|
126
126
|
})
|
|
127
127
|
|
|
128
|
+
test('splitByComma - should handle escaped backslash before closing quote', () => {
|
|
129
|
+
// 'text\\' = literal backslash at end of string, quote should close it
|
|
130
|
+
const result = splitByComma("before, 'text\\\\', after")
|
|
131
|
+
assert.equal(result, ["before", "'text\\\\'", "after"])
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test('splitByComma - should handle multiple escaped backslashes before quote', () => {
|
|
135
|
+
// 'test\\\\' = two literal backslashes at end, quote should close it
|
|
136
|
+
const result = splitByComma("a, 'test\\\\\\\\', b")
|
|
137
|
+
assert.equal(result, ["a", "'test\\\\\\\\'", "b"])
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
test('splitByComma - should handle odd backslashes (escaped quote)', () => {
|
|
141
|
+
// 'test\\\' = one literal backslash + escaped quote, string not closed
|
|
142
|
+
// This should NOT split since the quote is escaped
|
|
143
|
+
const result = splitByComma("a, 'test\\\\\\'quoted', b")
|
|
144
|
+
assert.equal(result, ["a", "'test\\\\\\'quoted'", "b"])
|
|
145
|
+
})
|
|
146
|
+
|
|
128
147
|
// Run all tests
|
|
129
148
|
test.run()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Splits string on single pipe (|) but preserves double pipes (||) */
|
|
2
|
+
|
|
3
|
+
const DOUBLE_PIPE_PLACEHOLDER = '\x00DOUBLE_PIPE\x00'
|
|
4
|
+
// Pre-compile regex for placeholder restoration (perf: avoid recompilation in map)
|
|
5
|
+
const DOUBLE_PIPE_REGEX = /\|\|/g
|
|
6
|
+
const PLACEHOLDER_RESTORE_REGEX = new RegExp(DOUBLE_PIPE_PLACEHOLDER, 'g')
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Splits a string on single pipe (|) characters while preserving double pipes (||).
|
|
10
|
+
* This is needed for filter parsing since || is a logical operator, not a filter delimiter.
|
|
11
|
+
* @param {string} str - String to split
|
|
12
|
+
* @returns {string[]} - Array of parts split on single |
|
|
13
|
+
*/
|
|
14
|
+
function splitOnPipe(str) {
|
|
15
|
+
if (!str || typeof str !== 'string') return [str]
|
|
16
|
+
|
|
17
|
+
// Replace || with placeholder, split on |, restore ||
|
|
18
|
+
DOUBLE_PIPE_REGEX.lastIndex = 0
|
|
19
|
+
const parts = str.replace(DOUBLE_PIPE_REGEX, DOUBLE_PIPE_PLACEHOLDER).split('|')
|
|
20
|
+
|
|
21
|
+
// Only restore placeholders if we actually had any
|
|
22
|
+
if (str.indexOf('||') === -1) return parts
|
|
23
|
+
|
|
24
|
+
return parts.map(s => {
|
|
25
|
+
PLACEHOLDER_RESTORE_REGEX.lastIndex = 0
|
|
26
|
+
return s.replace(PLACEHOLDER_RESTORE_REGEX, '||')
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { splitOnPipe }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* Tests for splitOnPipe utility */
|
|
2
|
+
const { test } = require('uvu')
|
|
3
|
+
const assert = require('uvu/assert')
|
|
4
|
+
const { splitOnPipe } = require('./splitOnPipe')
|
|
5
|
+
|
|
6
|
+
test('splitOnPipe - single pipe', () => {
|
|
7
|
+
const result = splitOnPipe('a | b')
|
|
8
|
+
assert.equal(result, ['a ', ' b'])
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('splitOnPipe - multiple single pipes', () => {
|
|
12
|
+
const result = splitOnPipe('a | b | c')
|
|
13
|
+
assert.equal(result, ['a ', ' b ', ' c'])
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('splitOnPipe - preserves double pipe', () => {
|
|
17
|
+
const result = splitOnPipe('a || b')
|
|
18
|
+
assert.equal(result, ['a || b'])
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('splitOnPipe - eval with logical OR', () => {
|
|
22
|
+
const result = splitOnPipe('eval(true || undefined)')
|
|
23
|
+
assert.equal(result, ['eval(true || undefined)'])
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('splitOnPipe - mixed single and double pipes', () => {
|
|
27
|
+
const result = splitOnPipe('eval(a || b) | filter')
|
|
28
|
+
assert.equal(result, ['eval(a || b) ', ' filter'])
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('splitOnPipe - multiple double pipes', () => {
|
|
32
|
+
const result = splitOnPipe('a || b || c')
|
|
33
|
+
assert.equal(result, ['a || b || c'])
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
test('splitOnPipe - double pipe followed by single pipe', () => {
|
|
37
|
+
const result = splitOnPipe('a || b | c')
|
|
38
|
+
assert.equal(result, ['a || b ', ' c'])
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test('splitOnPipe - empty string', () => {
|
|
42
|
+
const result = splitOnPipe('')
|
|
43
|
+
assert.equal(result, [''])
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('splitOnPipe - no pipes', () => {
|
|
47
|
+
const result = splitOnPipe('abc')
|
|
48
|
+
assert.equal(result, ['abc'])
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('splitOnPipe - null input', () => {
|
|
52
|
+
const result = splitOnPipe(null)
|
|
53
|
+
assert.equal(result, [null])
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('splitOnPipe - undefined input', () => {
|
|
57
|
+
const result = splitOnPipe(undefined)
|
|
58
|
+
assert.equal(result, [undefined])
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test('splitOnPipe - bitwise OR should be preserved', () => {
|
|
62
|
+
// Note: bitwise | is a single pipe, so it WILL be split
|
|
63
|
+
// This is expected - bitwise OR in eval still won't work with filters
|
|
64
|
+
const result = splitOnPipe('eval(5 | 3)')
|
|
65
|
+
assert.equal(result, ['eval(5 ', ' 3)'])
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test.run()
|
|
@@ -24,7 +24,7 @@ test('isValidValue - should return true for non-empty array', () => {
|
|
|
24
24
|
assert.is(isValidValue([1, 2, 3]), true)
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
test
|
|
27
|
+
test('isValidValue - should return false for null', () => {
|
|
28
28
|
assert.is(isValidValue(null), false)
|
|
29
29
|
})
|
|
30
30
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const isEmpty = require('lodash.isempty')
|
|
5
5
|
|
|
6
6
|
function isValidValue(val) {
|
|
7
|
-
if (typeof val === 'object' && (val.hasOwnProperty('__internal_only_flag') || val.hasOwnProperty('__internal_metadata'))) {
|
|
7
|
+
if (val !== null && typeof val === 'object' && (val.hasOwnProperty('__internal_only_flag') || val.hasOwnProperty('__internal_metadata'))) {
|
|
8
8
|
return false
|
|
9
9
|
}
|
|
10
10
|
return val !== null && typeof val !== 'undefined' && !(typeof val === 'object' && isEmpty(val))
|
|
@@ -53,7 +53,9 @@ function findNestedVariables(input, regex, variablesKnownTypes, location, variab
|
|
|
53
53
|
|
|
54
54
|
// Generate a unique placeholder
|
|
55
55
|
const placeholder = `__VAR_${iteration - 1}__`
|
|
56
|
-
|
|
56
|
+
// Pre-compile regex for this placeholder (perf: avoids recompilation in replaceAllPlaceholders)
|
|
57
|
+
const placeholderRegex = new RegExp(placeholder, 'g')
|
|
58
|
+
|
|
57
59
|
// Store match details
|
|
58
60
|
const matchInfo = {
|
|
59
61
|
variableType: undefined,
|
|
@@ -66,6 +68,7 @@ function findNestedVariables(input, regex, variablesKnownTypes, location, variab
|
|
|
66
68
|
start: match.index,
|
|
67
69
|
end: match.index + match[0].length,
|
|
68
70
|
placeholder,
|
|
71
|
+
placeholderRegex,
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
if (debug) {
|
|
@@ -136,7 +139,9 @@ function findNestedVariables(input, regex, variablesKnownTypes, location, variab
|
|
|
136
139
|
for (let i = 0; i < matchesArray.length; i++) {
|
|
137
140
|
const m = matchesArray[i]
|
|
138
141
|
if (result.includes(m.placeholder)) {
|
|
139
|
-
|
|
142
|
+
// Reset lastIndex before reusing global regex
|
|
143
|
+
m.placeholderRegex.lastIndex = 0
|
|
144
|
+
result = result.replace(m.placeholderRegex, m[key])
|
|
140
145
|
needsAnotherPass = true
|
|
141
146
|
}
|
|
142
147
|
}
|
|
@@ -219,6 +224,7 @@ function findNestedVariables(input, regex, variablesKnownTypes, location, variab
|
|
|
219
224
|
|
|
220
225
|
const finalMatches = matches.map((m) => {
|
|
221
226
|
delete m.placeholder
|
|
227
|
+
delete m.placeholderRegex
|
|
222
228
|
if (typeof m.variableType === 'undefined') {
|
|
223
229
|
/*
|
|
224
230
|
{
|
package/types/src/main.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare class Configorama {
|
|
|
3
3
|
constructor(fileOrObject: any, opts: any);
|
|
4
4
|
settings: any;
|
|
5
5
|
filterCache: {};
|
|
6
|
+
_originalValueCache: Map<any, any>;
|
|
6
7
|
foundVariables: any[];
|
|
7
8
|
fileRefsFound: any[];
|
|
8
9
|
resolutionTracking: {};
|
|
@@ -12,6 +13,7 @@ declare class Configorama {
|
|
|
12
13
|
varPrefixPattern: RegExp;
|
|
13
14
|
varSuffixPattern: RegExp;
|
|
14
15
|
varSuffixWithSpacePattern: RegExp;
|
|
16
|
+
rawOriginalConfig: any;
|
|
15
17
|
config: any;
|
|
16
18
|
originalConfig: any;
|
|
17
19
|
configPath: any;
|
|
@@ -21,6 +23,7 @@ declare class Configorama {
|
|
|
21
23
|
tracker: PromiseTracker;
|
|
22
24
|
variableTypes: any;
|
|
23
25
|
variablesKnownTypes: RegExp;
|
|
26
|
+
_resolverByPrefix: Map<any, any>;
|
|
24
27
|
filters: any;
|
|
25
28
|
filterMatch: RegExp;
|
|
26
29
|
functions: any;
|
|
@@ -54,7 +57,6 @@ declare class Configorama {
|
|
|
54
57
|
init(cliOpts: any): Promise<any>;
|
|
55
58
|
options: any;
|
|
56
59
|
configFileContents: string;
|
|
57
|
-
rawOriginalConfig: any;
|
|
58
60
|
/**
|
|
59
61
|
* Collect metadata about all variables found in the configuration
|
|
60
62
|
* @returns {object} Metadata object containing variables, fileRefs, and summary
|
package/types/src/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.js"],"names":[],"mappings":";AA6GA;IACE,0CA4dC;IApdC,cAcW;IAuBX,gBAAqB;IAErB,mCAAoC;IAEpC,sBAAwB;IACxB,qBAAuB;IAGvB,uBAA4B;IAsB5B,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,eAkDC;IAOD,YAAc;IACd,cAAgB;IAChB,kBAAkB;IAGpB;;;;OAIG;IACH,0BAHW,MAAM,GACJ,OAAO,CAQnB;IAED;;;;OAIG;IACH,6BAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAOvB;IAED;;;;OAIG;IACH,gCAHW,MAAM,GACJ,OAAO,CA2BnB;IAKD;;;;;OAKG;IACH,oBAFa,OAAO,CAAC,GAAG,CAAC,CAgvBxB;IA7uBC,aAA4B;IAc1B,2BAA4B;IAiuBhC;;;OAGG;IACH,2BAFa,MAAM,CA6alB;IAvBC;;;;;;;;;;;;;;;MAoBC;IAIH;;;;OAIG;IACH,uCAFa,OAAO,CAAC,GAAG,CAAC,CAIxB;IACD,+CAsBC;IAKD;;;;;;;;;;;;;;;;;;;OAmBG;IACH;;;;;;;;;;;OAWG;IACH,mFAHa;;;;cAZC,QAAQ;;;;eACR,IAAI,GAAC,MAAM,SAAO;OAWD,CA6E9B;IACD;;;OAGG;IACH;;;;;OAKG;IACH,oCAHa,OAAO,CAAC;;;;cAjGP,QAAQ;;;;eACR,IAAI,GAAC,MAAM,SAAO;OAgGgB,CAAC,EAAE,CA6BlD;IACD;;;;;OAKG;IACH,iDAFa,OAAO,CAAC,IAAI,CAAC,CAWzB;IAID;;;;;OAKG;IACH;;;;OAIG;IACH,2BAFa,eAAc;;;;;;;;;;OAAa,CAavC;IACD;;;;;OAKG;IACH,yBAHW;;;;;;;;;;OAAa,gCACX,cAAS,CAOrB;IACD;;;;;;OAMG;IACH,6DAFa,GAAC,CAiLb;IAKD;;;;;;;OAOG;IACH,yDAHa,OAAO,CAAC,GAAG,CAAC,CAiCxB;IACD;;;;OAIG;IAOH;;;;;;OAMG;IACH,wFA2BC;IACD;;;;;;;;;;;OAWG;IACH,8BARG;QAAyB,KAAK,EAAtB,GAAG;QACoB,IAAI,GAA3B,MAAM,EAAE;QACa,cAAc,GAAnC,MAAM;QACc,iBAAiB;KAC7C,6CAEU;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,QAAQ;QAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAC,CAma9J;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esm.d.ts","sourceRoot":"","sources":["../../../src/parsers/esm.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,yCAJW,MAAM,eAEJ,OAAO,CAAC,GAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"esm.d.ts","sourceRoot":"","sources":["../../../src/parsers/esm.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,yCAJW,MAAM,eAEJ,OAAO,CAAC,GAAC,CAAC,CAmBtB;AAED;;;;;GAKG;AACH,6CAJW,MAAM,eAEJ,GAAC,CAkBb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hcl-parse-script.d.ts","sourceRoot":"","sources":["../../../src/parsers/hcl-parse-script.js"],"names":[],"mappings":""}
|
|
@@ -1 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronous HCL parsing using child process
|
|
3
|
+
* @param {string} hclContents - HCL string to parse
|
|
4
|
+
* @param {string} [filename='config.tf'] - Filename for context
|
|
5
|
+
* @returns {Object} Parsed HCL object
|
|
6
|
+
* @throws {Error} If HCL parsing fails
|
|
7
|
+
*/
|
|
8
|
+
export function parseSync(hclContents: string, filename?: string): any;
|
|
9
|
+
/**
|
|
10
|
+
* Parse HCL content into JavaScript object
|
|
11
|
+
* Uses @cdktf/hcl2json to convert HCL to JSON
|
|
12
|
+
* @param {string} hclContents - HCL string to parse
|
|
13
|
+
* @param {string} [filename='config.tf'] - Filename for context
|
|
14
|
+
* @returns {Promise<Object>} Parsed HCL object
|
|
15
|
+
* @throws {Error} If HCL parsing fails
|
|
16
|
+
*/
|
|
17
|
+
declare function parse(hclContents: string, filename?: string): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Convert JavaScript object to HCL string
|
|
20
|
+
* Note: HCL generation is complex and not fully supported
|
|
21
|
+
* This is a placeholder for potential future implementation
|
|
22
|
+
* @param {Object} object - Object to convert to HCL
|
|
23
|
+
* @returns {string} HCL string representation
|
|
24
|
+
* @throws {Error} Always throws - HCL generation not implemented
|
|
25
|
+
*/
|
|
26
|
+
export function dump(object: any): string;
|
|
27
|
+
/**
|
|
28
|
+
* Convert HCL content to YAML format
|
|
29
|
+
* @param {string} hclContents - HCL string to convert
|
|
30
|
+
* @param {string} [filename='config.tf'] - Filename for context
|
|
31
|
+
* @returns {Promise<string>} YAML string representation
|
|
32
|
+
* @throws {Error} If conversion fails
|
|
33
|
+
*/
|
|
34
|
+
export function toYaml(hclContents: string, filename?: string): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Convert HCL content to JSON format
|
|
37
|
+
* @param {string} hclContents - HCL string to convert
|
|
38
|
+
* @param {string} [filename='config.tf'] - Filename for context
|
|
39
|
+
* @returns {Promise<string>} JSON string representation
|
|
40
|
+
* @throws {Error} If conversion fails
|
|
41
|
+
*/
|
|
42
|
+
export function toJson(hclContents: string, filename?: string): Promise<string>;
|
|
43
|
+
export { parseSync as parse, parse as parseAsync };
|
|
1
44
|
//# sourceMappingURL=hcl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hcl.d.ts","sourceRoot":"","sources":["../../../src/parsers/hcl.js"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"hcl.d.ts","sourceRoot":"","sources":["../../../src/parsers/hcl.js"],"names":[],"mappings":"AA2CA;;;;;;GAMG;AACH,uCALW,MAAM,aACN,MAAM,OA2BhB;AAlDD;;;;;;;GAOG;AACH,oCALW,MAAM,aACN,MAAM,GACJ,OAAO,KAAQ,CAa3B;AAkCD;;;;;;;GAOG;AACH,mCAHa,MAAM,CAKlB;AAED;;;;;;GAMG;AACH,oCALW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAY3B;AAED;;;;;;GAMG;AACH,oCALW,MAAM,aACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAY3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hcl.slow-test.d.ts","sourceRoot":"","sources":["../../../src/parsers/hcl.slow-test.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/parsers/typescript.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gDAJW,MAAM,eAEJ,OAAO,CAAC,GAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/parsers/typescript.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gDAJW,MAAM,eAEJ,OAAO,CAAC,GAAC,CAAC,CAmDtB;AAED;;;;;GAKG;AACH,oDAJW,MAAM,eAEJ,GAAC,CAmDb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueFromEval.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromEval.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"valueFromEval.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromEval.js"],"names":[],"mappings":"AAQA,gDAIC;AAXD,oCAA+C;AAyC/C,qEA6CC"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* @param {Function} ctx.getDeeperValue - Method for nested lookups
|
|
13
13
|
* @param {RegExp} ctx.fileRefSyntax - Regex for file() syntax
|
|
14
14
|
* @param {RegExp} ctx.textRefSyntax - Regex for text() syntax
|
|
15
|
+
* @param {string} ctx.varPrefix - Variable prefix (e.g., '${')
|
|
16
|
+
* @param {string} ctx.varSuffix - Variable suffix (e.g., '}')
|
|
15
17
|
* @param {string} variableString - The variable string to resolve
|
|
16
18
|
* @param {object} options - Resolution options
|
|
17
19
|
* @returns {Promise<any>}
|
|
@@ -28,6 +30,8 @@ export function getValueFromFile(ctx: {
|
|
|
28
30
|
getDeeperValue: Function;
|
|
29
31
|
fileRefSyntax: RegExp;
|
|
30
32
|
textRefSyntax: RegExp;
|
|
33
|
+
varPrefix: string;
|
|
34
|
+
varSuffix: string;
|
|
31
35
|
}, variableString: string, options: object): Promise<any>;
|
|
32
36
|
/**
|
|
33
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":"
|
|
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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const ifRefSyntax: RegExp;
|
|
2
|
+
declare function getValueFromIf(variableString: any): Promise<any>;
|
|
3
|
+
export declare let type: string;
|
|
4
|
+
export declare let source: string;
|
|
5
|
+
export declare let description: string;
|
|
6
|
+
export { ifRefSyntax as match, getValueFromIf as resolver };
|
|
7
|
+
//# sourceMappingURL=valueFromIf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueFromIf.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromIf.js"],"names":[],"mappings":"AAOA,kCAAqD;AAErD,mEAyDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueFromNumber.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromNumber.js"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"valueFromNumber.d.ts","sourceRoot":"","sources":["../../../src/resolvers/valueFromNumber.js"],"names":[],"mappings":"AAEA,4DAMC;AAED,0EAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSignalEvents.d.ts","sourceRoot":"","sources":["../../../src/utils/handleSignalEvents.js"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"handleSignalEvents.d.ts","sourceRoot":"","sources":["../../../src/utils/handleSignalEvents.js"],"names":[],"mappings":";AAEA,4CAqDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lodash.d.ts","sourceRoot":"","sources":["../../../src/utils/lodash.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lodash.d.ts","sourceRoot":"","sources":["../../../src/utils/lodash.js"],"names":[],"mappings":"AAqDA,mDA4BC;AA/DD,6DA6BC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/parse.js"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/parse.js"],"names":[],"mappings":";;;;cAgBc,MAAM;;;;cACN,MAAM;;;;eACN,MAAM;;;;kBACN,cAAe;;;;;;eA8Gf,MAAM;;;;kBACN,cAAe;;AApH7B;;;;;;GAMG;AAEH;;;;GAIG;AACH,iFAHW,YAAY,OAqGtB;AAED;;;;GAIG;AAEH;;;;;GAKG;AACH,oCAJW,MAAM,SACN,gBAAgB,OAW1B"}
|
|
@@ -4,7 +4,11 @@ export = preProcess;
|
|
|
4
4
|
* @param {Object} configObject - The parsed configuration object
|
|
5
5
|
* @param {RegExp} variableSyntax - The variable syntax regex to use
|
|
6
6
|
* @param {Array} [variableTypes] - Array of variable type definitions with type/prefix fields
|
|
7
|
+
* @param {Object} [options] - Options for preprocessing
|
|
8
|
+
* @param {boolean} [options.skipFallbackFix] - Skip fixing malformed fallbacks (for object configs)
|
|
7
9
|
* @returns {Object} The preprocessed configuration object
|
|
8
10
|
*/
|
|
9
|
-
declare function preProcess(configObject: any, variableSyntax: RegExp, variableTypes?: any[]
|
|
11
|
+
declare function preProcess(configObject: any, variableSyntax: RegExp, variableTypes?: any[], options?: {
|
|
12
|
+
skipFallbackFix?: boolean;
|
|
13
|
+
}): any;
|
|
10
14
|
//# sourceMappingURL=preProcess.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preProcess.d.ts","sourceRoot":"","sources":["../../../../src/utils/parsing/preProcess.js"],"names":[],"mappings":";
|
|
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,OA0XF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFullFilePath.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/getFullFilePath.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"getFullFilePath.d.ts","sourceRoot":"","sources":["../../../../src/utils/paths/getFullFilePath.js"],"names":[],"mappings":";AAmCA,gEAIC;;;;AAED;;;;;;GAMG;AACH,6DALW,MAAM,UACN,MAAM,cACN,MAAM,GACJ;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAC,CAY9E;AAnDD;;;;;GAKG;AACH,gDAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAsBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/regex/index.js"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/regex/index.js"],"names":[],"mappings":";;IA+EQ,wCAAwC;;IAGpC,mCAAkC;;AAlF9C;;GAEG;AAGH,qCAA0D;AAC1D,0CAAgE;AAChE,sCAAiE;AA8EjE;;;;GAIG;AACH,wCAHW,MAAM,EAAE,GACN,MAAM,CAKlB;AApFD;;;;;;GAMG;AACH,uCAHW,MAAM,GACJ,GAAG,CAyDf"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find index of a character/pattern outside of quoted strings
|
|
3
|
+
* @param {string} str - String to search
|
|
4
|
+
* @param {string|function} matcher - Char to find, or function(str, idx) => matchLength|0
|
|
5
|
+
* @param {number} [startIdx=0] - Start index
|
|
6
|
+
* @returns {number} Index of match, or -1 if not found
|
|
7
|
+
*/
|
|
8
|
+
export function findOutsideQuotes(str: string, matcher: string | Function, startIdx?: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Replace a pattern only outside of quoted strings
|
|
11
|
+
* @param {string} str - String to process
|
|
12
|
+
* @param {string|RegExp} pattern - Pattern to match (if string, must be exact match)
|
|
13
|
+
* @param {string|function} replacement - Replacement string or function(match) => string
|
|
14
|
+
* @returns {string} Processed string
|
|
15
|
+
*/
|
|
16
|
+
export function replaceOutsideQuotes(str: string, pattern: string | RegExp, replacement: string | Function): string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if an index is inside a quoted string
|
|
19
|
+
* @param {string} str - String to check
|
|
20
|
+
* @param {number} idx - Index to check
|
|
21
|
+
* @returns {boolean} True if index is inside quotes
|
|
22
|
+
*/
|
|
23
|
+
export function isInsideQuotes(str: string, idx: number): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get ranges of quoted strings in a string
|
|
26
|
+
* @param {string} str - String to analyze
|
|
27
|
+
* @returns {Array<[number, number]>} Array of [start, end] ranges
|
|
28
|
+
*/
|
|
29
|
+
export function getQuoteRanges(str: string): Array<[number, number]>;
|
|
30
|
+
//# sourceMappingURL=quoteAware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quoteAware.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/quoteAware.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,uCALW,MAAM,WACN,MAAM,WAAS,aACf,MAAM,GACJ,MAAM,CAyBlB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,WACN,MAAM,GAAC,MAAM,eACb,MAAM,WAAS,GACb,MAAM,CA4ClB;AAED;;;;;GAKG;AACH,oCAJW,MAAM,OACN,MAAM,GACJ,OAAO,CAiBnB;AAED;;;;GAIG;AACH,oCAHW,MAAM,GACJ,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAsBnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceAll.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/replaceAll.js"],"names":[],"mappings":"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
export function splitByComma(string: any, regexPattern: any):
|
|
1
|
+
export function splitByComma(string: any, regexPattern: any): any[];
|
|
2
2
|
//# sourceMappingURL=splitByComma.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitByComma.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/splitByComma.js"],"names":[],"mappings":"AAiBA,
|
|
1
|
+
{"version":3,"file":"splitByComma.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/splitByComma.js"],"names":[],"mappings":"AAiBA,oEAgGC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a string on single pipe (|) characters while preserving double pipes (||).
|
|
3
|
+
* This is needed for filter parsing since || is a logical operator, not a filter delimiter.
|
|
4
|
+
* @param {string} str - String to split
|
|
5
|
+
* @returns {string[]} - Array of parts split on single |
|
|
6
|
+
*/
|
|
7
|
+
export function splitOnPipe(str: string): string[];
|
|
8
|
+
//# sourceMappingURL=splitOnPipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitOnPipe.d.ts","sourceRoot":"","sources":["../../../../src/utils/strings/splitOnPipe.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,iCAHW,MAAM,GACJ,MAAM,EAAE,CAgBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findNestedVariables.d.ts","sourceRoot":"","sources":["../../../../src/utils/variables/findNestedVariables.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2CARW,MAAM,SACN,MAAM,uBACN,MAAM,YACN,MAAM,gCAEN,OAAO,
|
|
1
|
+
{"version":3,"file":"findNestedVariables.d.ts","sourceRoot":"","sources":["../../../../src/utils/variables/findNestedVariables.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2CARW,MAAM,SACN,MAAM,uBACN,MAAM,YACN,MAAM,gCAEN,OAAO,SA+QjB"}
|