UNPKG

21.3 kBMarkdownView Raw
1# Changelog
2All notable changes to this project will be documented in this file.
3
4## [0.3.4] - 2021-09-21
5### Fixed
6- prevent comments from marking the end of an instruction if it is embedded within a keyword ([#99](https://github.com/rcjsuen/dockerfile-ast/issues/99))
7
8## [0.3.3] - 2021-09-19
9### Fixed
10- prevent merging of instructions if the keyword has an escape character in it and spans multiple lines ([#98](https://github.com/rcjsuen/dockerfile-ast/issues/98))
11
12## [0.3.2] - 2021-09-07
13### Fixed
14- prevent merging of instructions if the keyword has an escape character in it ([#97](https://github.com/rcjsuen/dockerfile-ast/issues/97))
15
16## [0.3.1] - 2021-08-28
17### Added
18- support quoted delimiter names for heredocs ([#94](https://github.com/rcjsuen/dockerfile-ast/issues/94))
19- support multiple heredocs in an instruction ([#94](https://github.com/rcjsuen/dockerfile-ast/issues/96))
20
21## [0.3.0] - 2021-07-28
22### Added
23- enabled support for parsing heredocs in Dockerfiles ([#92](https://github.com/rcjsuen/dockerfile-ast/issues/92))
24
25### Fixed
26- fix line range calculation when the last non-whitespace character is an escape character ([#92](https://github.com/rcjsuen/dockerfile-ast/issues/92))
27
28## [0.2.1] - 2021-04-11
29### Fixed
30- fix parsing of an escape character immediately following a label which caused the next label to be parsed incorrectly ([#90](https://github.com/rcjsuen/dockerfile-ast/issues/90))
31
32## [0.2.0] - 2021-02-21
33### Added
34- `Dockerfile`
35 - `getAvailableWorkingDirectories()` ([#87](https://github.com/rcjsuen/dockerfile-ast/issues/87))
36- `Workdir`
37 - `getPath()` ([#88](https://github.com/rcjsuen/dockerfile-ast/issues/88))
38 - `getAbsolutePath()` ([#88](https://github.com/rcjsuen/dockerfile-ast/issues/88))
39
40## [0.1.0] - 2020-12-24
41### Added
42- `Property`
43 - `getAssignmentOperator()` ([#86](https://github.com/rcjsuen/dockerfile-ast/issues/86))
44 - `getAssignmentOperatorRange()` ([#86](https://github.com/rcjsuen/dockerfile-ast/issues/86))
45
46## [0.0.30] - 2020-07-14
47### Fixed
48- do not consider a single escape character as being an argument for the instruction ([#83](https://github.com/rcjsuen/dockerfile-ast/issues/83))
49- do not consider a single escape character as being a property for an instruction ([#84](https://github.com/rcjsuen/dockerfile-ast/issues/84))
50
51## [0.0.29] - 2020-07-12
52### Fixed
53- ignore leading whitespace before a comment in escaped newlines for `getArgumentsContent()` and `getArgumentsRanges()` of `Instruction` ([#82](https://github.com/rcjsuen/dockerfile-ast/issues/82))
54
55## [0.0.28] - 2020-07-11
56### Fixed
57- improve handling of trailing whitespace that is not a newline character after an escape character ([#81](https://github.com/rcjsuen/dockerfile-ast/issues/81))
58
59## [0.0.27] - 2020-06-17
60### Fixed
61- allow comments to immediately follow the declaration of an ARG or ENV instruction ([#80](https://github.com/rcjsuen/dockerfile-ast/issues/80))
62
63## [0.0.26] - 2020-04-22
64### Fixed
65- correct range of multiline arguments that end with a character preceded by an escape character ([#78](https://github.com/rcjsuen/dockerfile-ast/issues/78))
66- correct range of arguments that are split on multiple lines with escaped whitespace lines in between ([#77](https://github.com/rcjsuen/dockerfile-ast/issues/77))
67- enable parsing of flag options that do not have a value defined ([#79](https://github.com/rcjsuen/dockerfile-ast/issues/79))
68
69## [0.0.25] - 2020-04-01
70### Added
71- `Flag`
72 - `getOptions()` ([#75](https://github.com/rcjsuen/dockerfile-ast/issues/75))
73 - `getOption(string)` ([#75](https://github.com/rcjsuen/dockerfile-ast/issues/75))
74 - `hasOptions()` ([#75](https://github.com/rcjsuen/dockerfile-ast/issues/75))
75- `FlagOption` ([#75](https://github.com/rcjsuen/dockerfile-ast/issues/75))
76- `Run` ([#76](https://github.com/rcjsuen/dockerfile-ast/issues/76))
77 - `RUN` instructions will now of type `Run` instead of `JSONInstruction`
78 - `Run` extends `JSONInstruction` so this is not be a breaking change
79
80### Fixed
81- allow `From`'s `getBuildStage()` and `getBuildStageRange()` to return non-`null` values even if the instruction has more than three arguments as long as parts of it is valid ([#74](https://github.com/rcjsuen/dockerfile-ast/issues/74))
82
83## [0.0.24] - 2020-03-08
84### Fixed
85- `Instruction`'s `getArguments()` will no longer exclude arguments that follow an embedded comment that ends with the escape character ([#73](https://github.com/rcjsuen/dockerfile-ast/issues/73))
86
87## [0.0.23] - 2020-03-08
88### Fixed
89- `Instruction`'s `getArguments()` will no longer incorrectly exclude arguments because they look like comments ([#72](https://github.com/rcjsuen/dockerfile-ast/issues/72))
90
91## [0.0.22] - 2020-03-07
92### Fixed
93- instructions will no longer be cut off prematurely due to empty continuation lines embedded in the keyword itself ([#70](https://github.com/rcjsuen/dockerfile-ast/issues/70))
94- `Instruction`'s `getArguments()` will now correctly account for multiple embedded comments instead of considering them as an argument ([#71](https://github.com/rcjsuen/dockerfile-ast/issues/71))
95
96## [0.0.21] - 2020-02-27
97### Fixed
98- `Instruction`'s `getArgumentsRanges()` will no longer throw an error if an instruction spans multiple lines and has escaped newlines at the beginning of a line ([#67](https://github.com/rcjsuen/dockerfile-ast/issues/67))
99- `ModifiableInstruction`'s `toString()` will now include the instruction's flags ([#68](https://github.com/rcjsuen/dockerfile-ast/issues/68))
100- `ModifiableInstruction`'s `getVariables()` will now include variables that are used in the instruction's flags ([#69](https://github.com/rcjsuen/dockerfile-ast/issues/69))
101
102## [0.0.20] - 2020-02-11
103### Added
104- `Dockerfile`
105 - `getDirectives()` ([#62](https://github.com/rcjsuen/dockerfile-ast/issues/62))
106 - originally introduced in 0.0.18 to support compatibility in the future, the function is now fully implemented and will return an ordered list of all the parser directives defined at the top of the Dockerfile
107
108- `Directive`
109 - `syntax` ([#63](https://github.com/rcjsuen/dockerfile-ast/issues/63))
110 - this enum can be used for identifying the `syntax` parser directive used by BuildKit
111
112### Changed
113- `ParserDirective`
114 - `getDirective()` ([#63](https://github.com/rcjsuen/dockerfile-ast/issues/63))
115 - this function originally stated that it would return a `Directive`
116 - `undefined` would be returned if the name of the parser directive was not recognized
117 - the function now returns `Directive | null`
118 - the function will return `null` if the parser directive is not recognized instead of `undefined`
119
120### Fixed
121- `Instruction`'s `getArgumentsRanges()` will no longer throw an error if the instruction has its last argument on its own line with no leading whitespace and the length of that argument is one ([#66](https://github.com/rcjsuen/dockerfile-ast/issues/66))
122
123## [0.0.19] - 2020-01-27
124### Added
125- `From`
126 - `getPlatformFlag()` ([#65](https://github.com/rcjsuen/dockerfile-ast/issues/65))
127
128### Changed
129- `From`
130 - this class now subclasses `ModifiableInstruction` instead of `Instruction` ([#65](https://github.com/rcjsuen/dockerfile-ast/issues/65))
131 - this was changed to support the `--platform` flag introduced in Docker CE 18.04
132 - as `ModifiableInstruction` extends `Instruction`, this should not impact anyone at an API level from a compilation standpoint
133 - note that this will break users that previously used `getArguments()` to parse and retrieve the `--platform` flag manually, please replace such usages with the new `getPlatformFlag()` API
134
135## [0.0.18] - 2019-12-07
136### Added
137- `Dockerfile`
138 - `getDirectives()` ([#64](https://github.com/rcjsuen/dockerfile-ast/issues/64))
139
140### Changed
141- `getDirective()` of `Dockerfile` has been deprecated and will be replaced by `getDirectives()` in the future ([#64](https://github.com/rcjsuen/dockerfile-ast/issues/64))
142 - note that this is purely a cosmetic API change to facilitate migration at the moment, proper support for returning an array will follow in the future
143
144### Fixed
145- add support for TypeScript 3.7 by fixing TS2440 compiler error ([#61](https://github.com/rcjsuen/dockerfile-ast/issues/61))
146
147## [0.0.17] - 2019-10-13
148### Fixed
149- correct parsing of image names that were incorrectly identified as a Docker registry ([#59](https://github.com/rcjsuen/dockerfile-ast/issues/59))
150
151## [0.0.16] - 2019-05-22
152### Fixed
153- only allow alphanumeric and underscore characters in variable names ([#58](https://github.com/rcjsuen/dockerfile-ast/issues/58))
154
155## [0.0.15] - 2019-05-21
156### Fixed
157- variables in `FROM` should return `true` for `isDefined()` if it is defined in the `ARG` instructions above it ([#56](https://github.com/rcjsuen/dockerfile-ast/issues/56))
158- variables in `FROM` should return `true` for `isBuildVariable()` if it is defined in the `ARG` instructions above it ([#57](https://github.com/rcjsuen/dockerfile-ast/issues/57))
159
160## [0.0.14] - 2019-04-28
161### Added
162- `ImageTemplate`
163 - `getRange()` ([#53](https://github.com/rcjsuen/dockerfile-ast/issues/53))
164
165### Changed
166- the enum value for `Keyword.ADD` was incorrectly assigned to `"ARG"`, it is now assigned to `"ADD"` ([#51](https://github.com/rcjsuen/dockerfile-ast/issues/51))
167 - this is a breaking change but presumably no consumers were relying on this incorrect behaviour
168- `Dockerfile`'s `getContainingImage()` has been changed for comments immediately before a build stage
169 - previously, they would return the build stage that came after the comment, now they will simply return the entire Dockerfile
170 - this is because the comment is actually ambiguous as it may be a commented out instruction for the build stage that came before the comment
171
172### Fixed
173- correct incorrectly assigned string enum value for `Keyword.ADD` ([#51](https://github.com/rcjsuen/dockerfile-ast/issues/51))
174- ensure quotation marks and apostrophes are included for expanded arguments in `Instruction`'s `getExpandedArguments()` if they surround a variable ([#52](https://github.com/rcjsuen/dockerfile-ast/issues/52))
175- fixed `getComments()` for build stages so that they will not simply return empty arrays ([#54](https://github.com/rcjsuen/dockerfile-ast/issues/54))
176 - the returned comments will only be from comments contained within the `FROM` instruction and the last instruction of that build stage
177
178## [0.0.13] - 2018-12-20
179### Fixed
180- prevent TypeError from being thrown by `Dockerfile`'s `resolveVariable(string, number)` when an invalid line number is provided ([#48](https://github.com/rcjsuen/dockerfile-ast/issues/48))
181- correct compiler error due to incomplete interface signature ([#46](https://github.com/rcjsuen/dockerfile-ast/issues/46))
182
183## [0.0.12] - 2018-08-10
184### Fixed
185- handle quoted properties on separate lines properly for `ENV`s and `LABEL`s ([#44](https://github.com/rcjsuen/dockerfile-ast/issues/45))
186
187## [0.0.11] - 2018-06-16
188### Fixed
189- ignore initial `ENV`s when resolving variables in `FROM`s ([#44](https://github.com/rcjsuen/dockerfile-ast/issues/44))
190
191## [0.0.10] - 2018-06-16
192### Added
193- `From`
194 - `getImageRange()` ([#43](https://github.com/rcjsuen/dockerfile-ast/issues/43))
195 - `getImageTag()` ([#43](https://github.com/rcjsuen/dockerfile-ast/issues/43))
196 - `getImageDigest()` ([#43](https://github.com/rcjsuen/dockerfile-ast/issues/43))
197 - `getRegistry()` ([#43](https://github.com/rcjsuen/dockerfile-ast/issues/43))
198 - `getRegistryRange()` ([#43](https://github.com/rcjsuen/dockerfile-ast/issues/43))
199
200### Changed
201- [upgraded the dependency of Mocha](https://github.com/mochajs/mocha/issues/2791) from 3.x to 5.x
202 - versions prior to 4.x of Mocha depended on Growl 1.9.2 which contained a [security vulnerability](https://github.com/tj/node-growl/issues/60)
203 - as Mocha is a `devDependencies` module, there is no reason to believe that the `dockerfile-ast` module itself was affected by this vulnerability
204
205### Fixed
206- do not resolve reinitialized `ARG` variables with `ENV` instructions at the top of the Dockerfile ([#42](https://github.com/rcjsuen/dockerfile-ast/issues/42))
207- improve parsing of `FROM` instructions that refer to variables ([#39](https://github.com/rcjsuen/dockerfile-ast/issues/39))
208
209## [0.0.9] - 2018-05-28
210### Fixed
211- handle comments in the last line of a file properly for `ARG`, `ENV`, and `LABEL` ([#40](https://github.com/rcjsuen/dockerfile-ast/issues/40))
212- parse `ARG` instructions properly when its value contains an unclosed quote ([#41](https://github.com/rcjsuen/dockerfile-ast/issues/41))
213
214## [0.0.8] - 2018-05-27
215### Fixed
216- prevent `getVariables()` from throwing an error if a `LABEL` has no value defined ([#38](https://github.com/rcjsuen/dockerfile-ast/issues/38))
217
218## [0.0.7] - 2018-05-25
219### Added
220- `ParserDirective`
221 - `toString()` ([#4](https://github.com/rcjsuen/dockerfile-ast/issues/4))
222- `PropertyInstruction`
223 - `getPropertyArguments()` ([#37](https://github.com/rcjsuen/dockerfile-ast/issues/37))
224- `Variable`
225 - `getModifier()` ([#27](https://github.com/rcjsuen/dockerfile-ast/issues/27))
226 - `getModifierRange()` ([#33](https://github.com/rcjsuen/dockerfile-ast/issues/33))
227 - `getSubstitutionParameter()` ([#27](https://github.com/rcjsuen/dockerfile-ast/issues/27))
228 - `getSubstitutionRange()` ([#33](https://github.com/rcjsuen/dockerfile-ast/issues/33))
229 - `toString()` ([#4](https://github.com/rcjsuen/dockerfile-ast/issues/4))
230
231### Changed
232- `PropertyInstruction`
233 - `getArguments()` ([#34](https://github.com/rcjsuen/dockerfile-ast/issues/34))
234 - to make this function more predictable, `PropertyInstruction` no longer overrides this function with its own implementation, existing callers should call `getPropertyArguments()` instead if the old behaviour is desired
235```TypeScript
236// this function has been changed to possibly not return the same thing
237// depending on the structure of the instruction's arguments
238let args = propertyInstruction.getArguments();
239// to get the same behaviour in 0.0.6, use getPropertyArguments() instead
240let args = propertyInstruction.getPropertyArguments();
241```
242
243### Fixed
244- resolve references to uninitialized `ARG` variables against `ARG` variables before the first `FROM` if present ([#26](https://github.com/rcjsuen/dockerfile-ast/issues/26))
245- change `FROM` to parse its image argument correctly if it is in a private registry ([#28](https://github.com/rcjsuen/dockerfile-ast/issues/28))
246- fix parsing issue with quoted keys and values in `ARG`, `ENV`, and `LABEL` ([#30](https://github.com/rcjsuen/dockerfile-ast/issues/30))
247- ignore equals signs that are found inside quotes ([#29](https://github.com/rcjsuen/dockerfile-ast/issues/29))
248- prevent arguments from being split up if they span multiple lines via escaped newlines ([#34](https://github.com/rcjsuen/dockerfile-ast/issues/34))
249- prevent variables from being split up if they span multiple lines via escaped newlines ([#35](https://github.com/rcjsuen/dockerfile-ast/issues/35))
250
251## [0.0.6] - 2018-04-19
252### Changed
253- `Property`
254 - `getRawValue()` has been renamed to `getUnescapedValue()` ([#25](https://github.com/rcjsuen/dockerfile-ast/issues/25))
255 - the underlying implementation of the function has not changed so it should be easy for clients to migrate to the new API
256
257### Fixed
258- fix parsing of spaces embedded within a variable replacement in `ARG`, `ENV`, and `LABEL` instructions ([#24](https://github.com/rcjsuen/dockerfile-ast/issues/24))
259
260## [0.0.5] - 2018-04-15
261### Fixed
262- fix resolution of `ARG` variables that are used in a `FROM` ([#22](https://github.com/rcjsuen/dockerfile-ast/issues/22))
263- prevent error from being thrown if an invalid line number is specified by `Dockerfile`'s `getAvailableVariables(number)` function ([#23](https://github.com/rcjsuen/dockerfile-ast/issues/23))
264
265## [0.0.4] - 2018-04-03
266### Added
267- `JSONArgument extends Argument` ([#20](https://github.com/rcjsuen/dockerfile-ast/issues/20))
268 - `getJSONRange()`
269 - `getJSONValue()`
270- `Comment`
271 - `toString()` ([#4](https://github.com/rcjsuen/dockerfile-ast/issues/4))
272
273### Changed
274- `JSONInstruction`
275 - `getJSONStrings()` now returns `JSONArgument[]` instead of `Argument[]`
276 - since `JSONArgument` extends `Argument`, any existing code should continue to work with no code changes required
277
278## [0.0.3] - 2018-02-10
279### Added
280- `From`
281 - `getImageNameRange()` ([#16](https://github.com/rcjsuen/dockerfile-ast/issues/16))
282- `Instruction`
283 - `toString()` ([#4](https://github.com/rcjsuen/dockerfile-ast/issues/4))
284
285### Fixed
286- calling `ImageTemplate`'s `getAvailableVariables(number)` with a Dockerfile should only return the variables that are declared in the build stage of the given line ([#15](https://github.com/rcjsuen/dockerfile-ast/issues/15))
287- correct `From`'s `getImageName()` to return the right name for the image if it is pointing at a digest ([#17](https://github.com/rcjsuen/dockerfile-ast/issues/17))
288- calling `ImageTemplate`'s `getAvailableVariables(number)` on a line with a `FROM` should return variables defined by the Dockerfile's initial `ARG` instructions (if any) ([#18](https://github.com/rcjsuen/dockerfile-ast/issues/18))
289
290## [0.0.2] - 2018-01-20
291### Added
292- `Argument`
293 - `toString()` ([#4](https://github.com/rcjsuen/dockerfile-ast/issues/4))
294- `Variable`
295 - `isBuildVariable()` ([#13](https://github.com/rcjsuen/dockerfile-ast/issues/13))
296 - `isDefined()` ([#12](https://github.com/rcjsuen/dockerfile-ast/issues/12))
297 - `isEnvironmentVariable()` ([#13](https://github.com/rcjsuen/dockerfile-ast/issues/13))
298
299### Fixed
300- restrict variable resolution to the containing build stage ([#14](https://github.com/rcjsuen/dockerfile-ast/issues/14))
301
302### Removed
303- `Argument`'s `getRawValue()` function has been removed ([#10](https://github.com/rcjsuen/dockerfile-ast/issues/10))
304```TypeScript
305// this convenience function has been removed
306let rawValue = argument.getRawValue();
307// to retrieve the identical value, use the following code instead
308import { TextDocument } from 'vscode-languageserver-types';
309let document = TextDocument.create(uri, languageId, version, buffer);
310let range = argument.getRange();
311let rawValue = buffer.substring(document.offsetAt(range.start), document.offsetAt(range.end));
312```
313
314## 0.0.1 - 2017-12-20
315### Added
316- Dockerfile parser
317 - handles escape characters
318 - preserves comments
319 - provides variable lookup and resolution
320
321[Unreleased]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.3.4...HEAD
322[0.3.4]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.3.3...v0.3.4
323[0.3.3]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.3.2...v0.3.3
324[0.3.2]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.3.1...v0.3.2
325[0.3.1]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.3.0...v0.3.1
326[0.3.0]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.2.1...v0.3.0
327[0.2.1]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.2.0...v0.2.1
328[0.2.0]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.1.0...v0.2.0
329[0.1.0]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.30...v0.1.0
330[0.0.30]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.29...v0.0.30
331[0.0.29]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.28...v0.0.29
332[0.0.28]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.27...v0.0.28
333[0.0.27]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.26...v0.0.27
334[0.0.26]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.25...v0.0.26
335[0.0.25]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.24...v0.0.25
336[0.0.24]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.23...v0.0.24
337[0.0.23]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.22...v0.0.23
338[0.0.22]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.21...v0.0.22
339[0.0.21]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.20...v0.0.21
340[0.0.20]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.19...v0.0.20
341[0.0.19]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.18...v0.0.19
342[0.0.18]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.17...v0.0.18
343[0.0.17]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.16...v0.0.17
344[0.0.16]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.15...v0.0.16
345[0.0.15]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.14...v0.0.15
346[0.0.14]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.13...v0.0.14
347[0.0.13]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.12...v0.0.13
348[0.0.12]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.11...v0.0.12
349[0.0.11]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.10...v0.0.11
350[0.0.10]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.9...v0.0.10
351[0.0.9]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.8...v0.0.9
352[0.0.8]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.7...v0.0.8
353[0.0.7]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.6...v0.0.7
354[0.0.6]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.5...v0.0.6
355[0.0.5]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.4...v0.0.5
356[0.0.4]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.3...v0.0.4
357[0.0.3]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.2...v0.0.3
358[0.0.2]: https://github.com/rcjsuen/dockerfile-ast/compare/v0.0.1...v0.0.2