@env-spec/parser 0.0.0 → 0.0.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.
@@ -0,0 +1,185 @@
1
+ declare class ParsedEnvSpecDivider {
2
+ data: {
3
+ contents: string;
4
+ leadingSpace?: string;
5
+ _location?: any;
6
+ };
7
+ constructor(data: {
8
+ contents: string;
9
+ leadingSpace?: string;
10
+ _location?: any;
11
+ });
12
+ toString(): string;
13
+ }
14
+ declare class ParsedEnvSpecStaticValue {
15
+ data: {
16
+ rawValue: any;
17
+ quote?: '"' | "'" | '`' | undefined;
18
+ isImplicit?: boolean;
19
+ _location?: any;
20
+ };
21
+ value: any;
22
+ constructor(data: {
23
+ rawValue: any;
24
+ quote?: '"' | "'" | '`' | undefined;
25
+ isImplicit?: boolean;
26
+ _location?: any;
27
+ });
28
+ get unescapedValue(): any;
29
+ toString(): string;
30
+ }
31
+ declare class ParsedEnvSpecKeyValuePair {
32
+ data: {
33
+ key: string;
34
+ val: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
35
+ };
36
+ constructor(data: {
37
+ key: string;
38
+ val: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
39
+ });
40
+ get key(): string;
41
+ get value(): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
42
+ toString(): string;
43
+ }
44
+ declare class ParsedEnvSpecFunctionArgs {
45
+ data: {
46
+ values: Array<ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair>;
47
+ _location?: any;
48
+ };
49
+ constructor(data: {
50
+ values: Array<ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair>;
51
+ _location?: any;
52
+ });
53
+ get values(): (ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair)[];
54
+ get simplifiedValues(): Array<any> | Record<string, any>;
55
+ toString(): string;
56
+ }
57
+ declare class ParsedEnvSpecFunctionCall {
58
+ data: {
59
+ name: string;
60
+ args: ParsedEnvSpecFunctionArgs;
61
+ _location?: any;
62
+ };
63
+ constructor(data: {
64
+ name: string;
65
+ args: ParsedEnvSpecFunctionArgs;
66
+ _location?: any;
67
+ });
68
+ get name(): string;
69
+ get simplifiedArgs(): any[] | Record<string, any>;
70
+ toString(): string;
71
+ }
72
+ declare class ParsedEnvSpecDecorator {
73
+ data: {
74
+ name: string;
75
+ valueOrFnArgs: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecFunctionArgs | undefined;
76
+ _location?: any;
77
+ };
78
+ constructor(data: {
79
+ name: string;
80
+ valueOrFnArgs: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecFunctionArgs | undefined;
81
+ _location?: any;
82
+ });
83
+ get name(): string;
84
+ get bareFnArgs(): ParsedEnvSpecFunctionArgs | undefined;
85
+ get value(): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
86
+ get simplifiedValue(): any;
87
+ toString(): string;
88
+ }
89
+ declare class ParsedEnvSpecComment {
90
+ data: {
91
+ contents: string;
92
+ leadingSpace?: string;
93
+ _location?: any;
94
+ };
95
+ constructor(data: {
96
+ contents: string;
97
+ leadingSpace?: string;
98
+ _location?: any;
99
+ });
100
+ get contents(): string;
101
+ toString(): string;
102
+ }
103
+ declare class ParsedEnvSpecDecoratorComment {
104
+ data: {
105
+ decorators: Array<ParsedEnvSpecDecorator>;
106
+ leadingSpace?: string;
107
+ postComment?: any;
108
+ _location?: any;
109
+ };
110
+ constructor(data: {
111
+ decorators: Array<ParsedEnvSpecDecorator>;
112
+ leadingSpace?: string;
113
+ postComment?: any;
114
+ _location?: any;
115
+ });
116
+ get decorators(): ParsedEnvSpecDecorator[];
117
+ get postComment(): any;
118
+ toString(): string;
119
+ }
120
+ type ParsedEnvSpecDecoratorValue = ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecFunctionArgs;
121
+ declare class ParsedEnvSpecCommentBlock {
122
+ data: {
123
+ comments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
124
+ divider: ParsedEnvSpecDivider | null;
125
+ _location?: any;
126
+ };
127
+ constructor(data: {
128
+ comments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
129
+ divider: ParsedEnvSpecDivider | null;
130
+ _location?: any;
131
+ });
132
+ get comments(): (ParsedEnvSpecComment | ParsedEnvSpecDecoratorComment)[];
133
+ get divider(): ParsedEnvSpecDivider | undefined;
134
+ get decoratorsObject(): Record<string, ParsedEnvSpecDecorator>;
135
+ toString(): string;
136
+ }
137
+ declare class ParsedEnvSpecBlankLine {
138
+ data: {
139
+ _location?: any;
140
+ };
141
+ constructor(data: {
142
+ _location?: any;
143
+ });
144
+ toString(): string;
145
+ }
146
+ declare class ParsedEnvSpecConfigItem {
147
+ data: {
148
+ key: string;
149
+ value: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
150
+ preComments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
151
+ postComment: ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment | undefined;
152
+ _location?: any;
153
+ };
154
+ expandedValue: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
155
+ constructor(data: {
156
+ key: string;
157
+ value: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
158
+ preComments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
159
+ postComment: ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment | undefined;
160
+ _location?: any;
161
+ });
162
+ get key(): string;
163
+ get value(): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
164
+ get decoratorsObject(): Record<string, ParsedEnvSpecDecorator>;
165
+ get description(): string;
166
+ processExpansion(_opts?: {}): void;
167
+ private get resolverDef();
168
+ toString(): string;
169
+ }
170
+ type ParsedEnvSpecFileNode = ParsedEnvSpecCommentBlock | ParsedEnvSpecDivider | ParsedEnvSpecConfigItem | ParsedEnvSpecBlankLine;
171
+ declare class ParsedEnvSpecFile {
172
+ contents: Array<ParsedEnvSpecFileNode>;
173
+ constructor(_contents: Array<ParsedEnvSpecFileNode>);
174
+ get configItems(): ParsedEnvSpecConfigItem[];
175
+ get header(): ParsedEnvSpecCommentBlock | undefined;
176
+ get decoratorsObject(): Record<string, ParsedEnvSpecDecorator>;
177
+ toString(): string;
178
+ /**
179
+ * simple helper to convert an object in a basic case
180
+ * mostly useful for comparison with other env parsers
181
+ * */
182
+ toSimpleObj(): Record<string, any>;
183
+ }
184
+
185
+ export { ParsedEnvSpecFile as P, ParsedEnvSpecDecorator as a, ParsedEnvSpecStaticValue as b, ParsedEnvSpecFunctionCall as c, ParsedEnvSpecKeyValuePair as d, ParsedEnvSpecDivider as e, ParsedEnvSpecFunctionArgs as f, ParsedEnvSpecComment as g, ParsedEnvSpecDecoratorComment as h, type ParsedEnvSpecDecoratorValue as i, ParsedEnvSpecCommentBlock as j, ParsedEnvSpecBlankLine as k, ParsedEnvSpecConfigItem as l };
@@ -0,0 +1,185 @@
1
+ declare class ParsedEnvSpecDivider {
2
+ data: {
3
+ contents: string;
4
+ leadingSpace?: string;
5
+ _location?: any;
6
+ };
7
+ constructor(data: {
8
+ contents: string;
9
+ leadingSpace?: string;
10
+ _location?: any;
11
+ });
12
+ toString(): string;
13
+ }
14
+ declare class ParsedEnvSpecStaticValue {
15
+ data: {
16
+ rawValue: any;
17
+ quote?: '"' | "'" | '`' | undefined;
18
+ isImplicit?: boolean;
19
+ _location?: any;
20
+ };
21
+ value: any;
22
+ constructor(data: {
23
+ rawValue: any;
24
+ quote?: '"' | "'" | '`' | undefined;
25
+ isImplicit?: boolean;
26
+ _location?: any;
27
+ });
28
+ get unescapedValue(): any;
29
+ toString(): string;
30
+ }
31
+ declare class ParsedEnvSpecKeyValuePair {
32
+ data: {
33
+ key: string;
34
+ val: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
35
+ };
36
+ constructor(data: {
37
+ key: string;
38
+ val: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
39
+ });
40
+ get key(): string;
41
+ get value(): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
42
+ toString(): string;
43
+ }
44
+ declare class ParsedEnvSpecFunctionArgs {
45
+ data: {
46
+ values: Array<ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair>;
47
+ _location?: any;
48
+ };
49
+ constructor(data: {
50
+ values: Array<ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair>;
51
+ _location?: any;
52
+ });
53
+ get values(): (ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair)[];
54
+ get simplifiedValues(): Array<any> | Record<string, any>;
55
+ toString(): string;
56
+ }
57
+ declare class ParsedEnvSpecFunctionCall {
58
+ data: {
59
+ name: string;
60
+ args: ParsedEnvSpecFunctionArgs;
61
+ _location?: any;
62
+ };
63
+ constructor(data: {
64
+ name: string;
65
+ args: ParsedEnvSpecFunctionArgs;
66
+ _location?: any;
67
+ });
68
+ get name(): string;
69
+ get simplifiedArgs(): any[] | Record<string, any>;
70
+ toString(): string;
71
+ }
72
+ declare class ParsedEnvSpecDecorator {
73
+ data: {
74
+ name: string;
75
+ valueOrFnArgs: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecFunctionArgs | undefined;
76
+ _location?: any;
77
+ };
78
+ constructor(data: {
79
+ name: string;
80
+ valueOrFnArgs: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecFunctionArgs | undefined;
81
+ _location?: any;
82
+ });
83
+ get name(): string;
84
+ get bareFnArgs(): ParsedEnvSpecFunctionArgs | undefined;
85
+ get value(): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
86
+ get simplifiedValue(): any;
87
+ toString(): string;
88
+ }
89
+ declare class ParsedEnvSpecComment {
90
+ data: {
91
+ contents: string;
92
+ leadingSpace?: string;
93
+ _location?: any;
94
+ };
95
+ constructor(data: {
96
+ contents: string;
97
+ leadingSpace?: string;
98
+ _location?: any;
99
+ });
100
+ get contents(): string;
101
+ toString(): string;
102
+ }
103
+ declare class ParsedEnvSpecDecoratorComment {
104
+ data: {
105
+ decorators: Array<ParsedEnvSpecDecorator>;
106
+ leadingSpace?: string;
107
+ postComment?: any;
108
+ _location?: any;
109
+ };
110
+ constructor(data: {
111
+ decorators: Array<ParsedEnvSpecDecorator>;
112
+ leadingSpace?: string;
113
+ postComment?: any;
114
+ _location?: any;
115
+ });
116
+ get decorators(): ParsedEnvSpecDecorator[];
117
+ get postComment(): any;
118
+ toString(): string;
119
+ }
120
+ type ParsedEnvSpecDecoratorValue = ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecFunctionArgs;
121
+ declare class ParsedEnvSpecCommentBlock {
122
+ data: {
123
+ comments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
124
+ divider: ParsedEnvSpecDivider | null;
125
+ _location?: any;
126
+ };
127
+ constructor(data: {
128
+ comments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
129
+ divider: ParsedEnvSpecDivider | null;
130
+ _location?: any;
131
+ });
132
+ get comments(): (ParsedEnvSpecComment | ParsedEnvSpecDecoratorComment)[];
133
+ get divider(): ParsedEnvSpecDivider | undefined;
134
+ get decoratorsObject(): Record<string, ParsedEnvSpecDecorator>;
135
+ toString(): string;
136
+ }
137
+ declare class ParsedEnvSpecBlankLine {
138
+ data: {
139
+ _location?: any;
140
+ };
141
+ constructor(data: {
142
+ _location?: any;
143
+ });
144
+ toString(): string;
145
+ }
146
+ declare class ParsedEnvSpecConfigItem {
147
+ data: {
148
+ key: string;
149
+ value: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
150
+ preComments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
151
+ postComment: ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment | undefined;
152
+ _location?: any;
153
+ };
154
+ expandedValue: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
155
+ constructor(data: {
156
+ key: string;
157
+ value: ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | undefined;
158
+ preComments: Array<ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment>;
159
+ postComment: ParsedEnvSpecDecoratorComment | ParsedEnvSpecComment | undefined;
160
+ _location?: any;
161
+ });
162
+ get key(): string;
163
+ get value(): ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall;
164
+ get decoratorsObject(): Record<string, ParsedEnvSpecDecorator>;
165
+ get description(): string;
166
+ processExpansion(_opts?: {}): void;
167
+ private get resolverDef();
168
+ toString(): string;
169
+ }
170
+ type ParsedEnvSpecFileNode = ParsedEnvSpecCommentBlock | ParsedEnvSpecDivider | ParsedEnvSpecConfigItem | ParsedEnvSpecBlankLine;
171
+ declare class ParsedEnvSpecFile {
172
+ contents: Array<ParsedEnvSpecFileNode>;
173
+ constructor(_contents: Array<ParsedEnvSpecFileNode>);
174
+ get configItems(): ParsedEnvSpecConfigItem[];
175
+ get header(): ParsedEnvSpecCommentBlock | undefined;
176
+ get decoratorsObject(): Record<string, ParsedEnvSpecDecorator>;
177
+ toString(): string;
178
+ /**
179
+ * simple helper to convert an object in a basic case
180
+ * mostly useful for comparison with other env parsers
181
+ * */
182
+ toSimpleObj(): Record<string, any>;
183
+ }
184
+
185
+ export { ParsedEnvSpecFile as P, ParsedEnvSpecDecorator as a, ParsedEnvSpecStaticValue as b, ParsedEnvSpecFunctionCall as c, ParsedEnvSpecKeyValuePair as d, ParsedEnvSpecDivider as e, ParsedEnvSpecFunctionArgs as f, ParsedEnvSpecComment as g, ParsedEnvSpecDecoratorComment as h, type ParsedEnvSpecDecoratorValue as i, ParsedEnvSpecCommentBlock as j, ParsedEnvSpecBlankLine as k, ParsedEnvSpecConfigItem as l };
@@ -0,0 +1,35 @@
1
+ import { P as ParsedEnvSpecFile, a as ParsedEnvSpecDecorator, b as ParsedEnvSpecStaticValue, c as ParsedEnvSpecFunctionCall, d as ParsedEnvSpecKeyValuePair } from './classes-BGrn6GBW.mjs';
2
+ export { k as ParsedEnvSpecBlankLine, g as ParsedEnvSpecComment, j as ParsedEnvSpecCommentBlock, l as ParsedEnvSpecConfigItem, h as ParsedEnvSpecDecoratorComment, i as ParsedEnvSpecDecoratorValue, e as ParsedEnvSpecDivider, f as ParsedEnvSpecFunctionArgs } from './classes-BGrn6GBW.mjs';
3
+
4
+ declare function ensureHeader(file: ParsedEnvSpecFile, newHeaderContents?: string): void;
5
+ declare function createDummyDecoratorNode(decoratorName: string, valueStr: string, opts?: {
6
+ bareFnArgs?: boolean;
7
+ explicitTrue?: boolean;
8
+ }): ParsedEnvSpecDecorator;
9
+ declare function setRootDecorator(file: ParsedEnvSpecFile, decoratorName: string, valueStr: string, opts?: Parameters<typeof createDummyDecoratorNode>[2] & {
10
+ comment?: string;
11
+ }): void;
12
+ declare function setItemDecorator(file: ParsedEnvSpecFile, key: string, decoratorName: string, valueStr: string, opts?: Parameters<typeof createDummyDecoratorNode>[2]): void;
13
+ declare function injectFromStr(file: ParsedEnvSpecFile, content: string, opts?: {
14
+ location: 'start' | 'after_header' | 'end' | 'items';
15
+ key?: string;
16
+ }): void;
17
+ declare function deleteItem(file: ParsedEnvSpecFile, key: string): void;
18
+ declare const envSpecUpdater: {
19
+ ensureHeader: typeof ensureHeader;
20
+ setRootDecorator: typeof setRootDecorator;
21
+ setItemDecorator: typeof setItemDecorator;
22
+ injectFromStr: typeof injectFromStr;
23
+ deleteItem: typeof deleteItem;
24
+ };
25
+
26
+ type ParsedEnvSpecValueNode = ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair;
27
+ /**
28
+ * takes in a value node and runs expansion (execs, refs) according to options
29
+ * returns a new value node with all expansions applied
30
+ * */
31
+ declare function expand(val: ParsedEnvSpecValueNode, _opts?: {}): ParsedEnvSpecValueNode;
32
+
33
+ declare function parseEnvSpecDotEnvFile(source: string): ParsedEnvSpecFile;
34
+
35
+ export { ParsedEnvSpecDecorator, ParsedEnvSpecFile, ParsedEnvSpecFunctionCall, ParsedEnvSpecKeyValuePair, ParsedEnvSpecStaticValue, envSpecUpdater, expand, parseEnvSpecDotEnvFile };
@@ -0,0 +1,35 @@
1
+ import { P as ParsedEnvSpecFile, a as ParsedEnvSpecDecorator, b as ParsedEnvSpecStaticValue, c as ParsedEnvSpecFunctionCall, d as ParsedEnvSpecKeyValuePair } from './classes-BGrn6GBW.js';
2
+ export { k as ParsedEnvSpecBlankLine, g as ParsedEnvSpecComment, j as ParsedEnvSpecCommentBlock, l as ParsedEnvSpecConfigItem, h as ParsedEnvSpecDecoratorComment, i as ParsedEnvSpecDecoratorValue, e as ParsedEnvSpecDivider, f as ParsedEnvSpecFunctionArgs } from './classes-BGrn6GBW.js';
3
+
4
+ declare function ensureHeader(file: ParsedEnvSpecFile, newHeaderContents?: string): void;
5
+ declare function createDummyDecoratorNode(decoratorName: string, valueStr: string, opts?: {
6
+ bareFnArgs?: boolean;
7
+ explicitTrue?: boolean;
8
+ }): ParsedEnvSpecDecorator;
9
+ declare function setRootDecorator(file: ParsedEnvSpecFile, decoratorName: string, valueStr: string, opts?: Parameters<typeof createDummyDecoratorNode>[2] & {
10
+ comment?: string;
11
+ }): void;
12
+ declare function setItemDecorator(file: ParsedEnvSpecFile, key: string, decoratorName: string, valueStr: string, opts?: Parameters<typeof createDummyDecoratorNode>[2]): void;
13
+ declare function injectFromStr(file: ParsedEnvSpecFile, content: string, opts?: {
14
+ location: 'start' | 'after_header' | 'end' | 'items';
15
+ key?: string;
16
+ }): void;
17
+ declare function deleteItem(file: ParsedEnvSpecFile, key: string): void;
18
+ declare const envSpecUpdater: {
19
+ ensureHeader: typeof ensureHeader;
20
+ setRootDecorator: typeof setRootDecorator;
21
+ setItemDecorator: typeof setItemDecorator;
22
+ injectFromStr: typeof injectFromStr;
23
+ deleteItem: typeof deleteItem;
24
+ };
25
+
26
+ type ParsedEnvSpecValueNode = ParsedEnvSpecStaticValue | ParsedEnvSpecFunctionCall | ParsedEnvSpecKeyValuePair;
27
+ /**
28
+ * takes in a value node and runs expansion (execs, refs) according to options
29
+ * returns a new value node with all expansions applied
30
+ * */
31
+ declare function expand(val: ParsedEnvSpecValueNode, _opts?: {}): ParsedEnvSpecValueNode;
32
+
33
+ declare function parseEnvSpecDotEnvFile(source: string): ParsedEnvSpecFile;
34
+
35
+ export { ParsedEnvSpecDecorator, ParsedEnvSpecFile, ParsedEnvSpecFunctionCall, ParsedEnvSpecKeyValuePair, ParsedEnvSpecStaticValue, envSpecUpdater, expand, parseEnvSpecDotEnvFile };