docker-parser 0.1.0

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/parser.d.ts ADDED
@@ -0,0 +1,150 @@
1
+ import { Dockerfile } from './types';
2
+ /**
3
+ * Parser options
4
+ */
5
+ export interface ParserOptions {
6
+ includeComments?: boolean;
7
+ }
8
+ /**
9
+ * Dockerfile Parser
10
+ */
11
+ export declare class Parser {
12
+ private tokens;
13
+ private pos;
14
+ private escapeChar;
15
+ private options;
16
+ constructor(options?: ParserOptions);
17
+ /**
18
+ * Parse Dockerfile source into AST
19
+ */
20
+ parse(source: string): Dockerfile;
21
+ /**
22
+ * Check if at end of tokens
23
+ */
24
+ private isAtEnd;
25
+ /**
26
+ * Peek at current token
27
+ */
28
+ private peek;
29
+ /**
30
+ * Advance to next token
31
+ */
32
+ private advance;
33
+ /**
34
+ * Skip whitespace and newlines
35
+ */
36
+ private skipWhitespaceAndNewlines;
37
+ /**
38
+ * Skip whitespace only
39
+ */
40
+ private skipWhitespace;
41
+ /**
42
+ * Collect arguments until newline
43
+ * Combines key=value tokens into single arguments
44
+ */
45
+ private collectArguments;
46
+ /**
47
+ * Collect rest of line as single string
48
+ */
49
+ private collectRestOfLine;
50
+ /**
51
+ * Parse parser directive
52
+ */
53
+ private parseDirective;
54
+ /**
55
+ * Parse comment
56
+ */
57
+ private parseComment;
58
+ /**
59
+ * Parse FROM instruction
60
+ */
61
+ private parseFrom;
62
+ /**
63
+ * Parse instruction based on type
64
+ */
65
+ private parseInstruction;
66
+ /**
67
+ * Parse RUN instruction
68
+ */
69
+ private parseRun;
70
+ /**
71
+ * Parse mount flag
72
+ */
73
+ private parseMountFlag;
74
+ /**
75
+ * Extract value from flag
76
+ */
77
+ private extractFlagValue;
78
+ /**
79
+ * Parse CMD instruction
80
+ */
81
+ private parseCmd;
82
+ /**
83
+ * Parse ENTRYPOINT instruction
84
+ */
85
+ private parseEntrypoint;
86
+ /**
87
+ * Parse COPY instruction
88
+ */
89
+ private parseCopy;
90
+ /**
91
+ * Parse ADD instruction
92
+ */
93
+ private parseAdd;
94
+ /**
95
+ * Parse ENV instruction
96
+ */
97
+ private parseEnv;
98
+ /**
99
+ * Parse ARG instruction
100
+ */
101
+ private parseArg;
102
+ /**
103
+ * Parse WORKDIR instruction
104
+ */
105
+ private parseWorkdir;
106
+ /**
107
+ * Parse USER instruction
108
+ */
109
+ private parseUser;
110
+ /**
111
+ * Parse EXPOSE instruction
112
+ */
113
+ private parseExpose;
114
+ /**
115
+ * Parse VOLUME instruction
116
+ */
117
+ private parseVolume;
118
+ /**
119
+ * Parse LABEL instruction
120
+ */
121
+ private parseLabel;
122
+ /**
123
+ * Parse SHELL instruction
124
+ */
125
+ private parseShell;
126
+ /**
127
+ * Parse HEALTHCHECK instruction
128
+ */
129
+ private parseHealthcheck;
130
+ /**
131
+ * Parse STOPSIGNAL instruction
132
+ */
133
+ private parseStopsignal;
134
+ /**
135
+ * Parse ONBUILD instruction
136
+ */
137
+ private parseOnbuild;
138
+ /**
139
+ * Parse MAINTAINER instruction (deprecated)
140
+ */
141
+ private parseMaintainer;
142
+ /**
143
+ * Remove quotes from string
144
+ */
145
+ private unquote;
146
+ }
147
+ /**
148
+ * Parse Dockerfile source into AST
149
+ */
150
+ export declare function parse(source: string, options?: ParserOptions): Dockerfile;