timonel 2.13.0 → 3.0.0-beta.1

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.
@@ -0,0 +1,124 @@
1
+ export function helmFragment(...contents) {
2
+ return {
3
+ __helmConstruct: true,
4
+ type: 'fragment',
5
+ data: contents,
6
+ };
7
+ }
8
+ export function createHelmExpression(value) {
9
+ return {
10
+ __helmExpression: true,
11
+ value,
12
+ };
13
+ }
14
+ export function isHelmExpression(value) {
15
+ return (typeof value === 'object' &&
16
+ value !== null &&
17
+ '__helmExpression' in value &&
18
+ value.__helmExpression === true);
19
+ }
20
+ export function helmRange(vars, collection, content, options) {
21
+ return {
22
+ __helmConstruct: true,
23
+ type: 'range',
24
+ data: {
25
+ vars,
26
+ collection,
27
+ content,
28
+ },
29
+ ...(options ? { options } : {}),
30
+ };
31
+ }
32
+ export function helmWith(scope, content, options) {
33
+ return {
34
+ __helmConstruct: true,
35
+ type: 'with',
36
+ data: {
37
+ scope,
38
+ content,
39
+ },
40
+ ...(options ? { options } : {}),
41
+ };
42
+ }
43
+ export function helmInclude(templateName, scope = '.', options) {
44
+ return {
45
+ __helmConstruct: true,
46
+ type: 'include',
47
+ data: {
48
+ templateName,
49
+ scope,
50
+ pipe: options?.pipe,
51
+ },
52
+ ...(options ? { options } : {}),
53
+ };
54
+ }
55
+ export function helmDefine(name, content, options) {
56
+ return {
57
+ __helmConstruct: true,
58
+ type: 'define',
59
+ data: {
60
+ name,
61
+ content,
62
+ },
63
+ ...(options ? { options } : {}),
64
+ };
65
+ }
66
+ export function helmVar(name, value, options) {
67
+ return {
68
+ __helmConstruct: true,
69
+ type: 'var',
70
+ data: {
71
+ name,
72
+ value,
73
+ },
74
+ ...(options ? { options } : {}),
75
+ };
76
+ }
77
+ export function helmBlock(name, content, options) {
78
+ return {
79
+ __helmConstruct: true,
80
+ type: 'block',
81
+ data: {
82
+ name,
83
+ content,
84
+ },
85
+ ...(options ? { options } : {}),
86
+ };
87
+ }
88
+ export function helmComment(text) {
89
+ return {
90
+ __helmConstruct: true,
91
+ type: 'comment',
92
+ data: { text },
93
+ };
94
+ }
95
+ export function helmIf(condition, thenContent, elseContent, options) {
96
+ return {
97
+ __helmConstruct: true,
98
+ type: 'if',
99
+ data: {
100
+ condition,
101
+ then: thenContent,
102
+ else: elseContent,
103
+ },
104
+ ...(options ? { options } : {}),
105
+ };
106
+ }
107
+ export function helmIfSimple(condition, thenContent, options) {
108
+ return {
109
+ __helmConstruct: true,
110
+ type: 'if',
111
+ data: {
112
+ condition,
113
+ then: thenContent,
114
+ else: undefined,
115
+ },
116
+ ...(options ? { options } : {}),
117
+ };
118
+ }
119
+ export function isHelmConstruct(value) {
120
+ return (typeof value === 'object' &&
121
+ value !== null &&
122
+ '__helmConstruct' in value &&
123
+ value.__helmConstruct === true);
124
+ }
@@ -1,26 +1,14 @@
1
- import * as jsYaml from 'js-yaml';
2
- type HelmExpressionType = 'block' | 'nested' | 'comment' | 'action-trimmed' | 'raw' | 'include-context' | 'generic';
3
- interface HelmExpressionMatch {
4
- type: HelmExpressionType;
5
- expression: string;
6
- start: number;
7
- end: number;
8
- }
9
- export interface HelmExpression {
10
- __helmExpression: true;
11
- value: string;
12
- }
13
- declare function createHelmExpression(value: string): HelmExpression;
14
- declare function isHelmExpression(value: unknown): value is HelmExpression;
15
- declare function detectHelmExpressions(str: string): HelmExpressionMatch[];
16
- declare function preprocessHelmExpressions(obj: unknown, depth?: number): unknown;
17
- declare function postProcessHelmExpressions(yaml: string): string;
18
- export declare function dumpHelmAwareYaml(obj: unknown, options?: jsYaml.DumpOptions): string;
1
+ export declare function preprocessHelmConstructs(obj: unknown): unknown;
2
+ export declare function dumpHelmAwareYaml(obj: unknown, options?: {
3
+ lineWidth?: number;
4
+ }): string;
5
+ export declare function postProcessFieldConditionals(yaml: string): string;
19
6
  export declare function stringify(obj: unknown, options?: {
20
7
  lineWidth?: number;
21
8
  doubleQuotedAsJSON?: boolean;
22
9
  simpleKeys?: boolean;
23
10
  }): string;
11
+ type HelmExpressionType = 'block' | 'nested' | 'comment' | 'action-trimmed' | 'raw' | 'include-context' | 'generic';
24
12
  export interface HelmValidationError {
25
13
  type: 'syntax' | 'semantic' | 'reference' | 'type';
26
14
  message: string;
@@ -48,13 +36,7 @@ export declare function parseHelmExpressions(content: string): Array<{
48
36
  endLine: number;
49
37
  endCol: number;
50
38
  }>;
51
- export interface PrettifyOptions {
52
- indentSize?: number;
53
- alignExpressions?: boolean;
54
- preserveComments?: boolean;
55
- maxLineWidth?: number;
56
- sortKeys?: boolean;
57
- groupHelpers?: boolean;
58
- }
59
- export declare function prettifyHelmTemplate(yaml: string, options?: PrettifyOptions): string;
60
- export { createHelmExpression, isHelmExpression, detectHelmExpressions, preprocessHelmExpressions, postProcessHelmExpressions, };
39
+ export declare function detectHelmExpressions(str: string): unknown[];
40
+ export declare function preprocessHelmExpressions(obj: unknown): unknown;
41
+ export declare function postProcessHelmExpressions(yaml: string): string;
42
+ export {};