You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
11 KiB

4 years ago
  1. ### v1.0.1 [[code][c1.0.1], [diff][d1.0.1]]
  2. [c1.0.1]: https://github.com/json5/json5/tree/v1.0.1
  3. [d1.0.1]: https://github.com/json5/json5/compare/v1.0.0...v1.0.1
  4. This release includes a bug fix and minor change.
  5. - Fix: `parse` throws on unclosed objects and arrays.
  6. - New: `package.json5` has been removed until an easier way to keep it in sync
  7. with `package.json` is found.
  8. ### v1.0.0 [[code][c1.0.0], [diff][d1.0.0]]
  9. [c1.0.0]: https://github.com/json5/json5/tree/v1.0.0
  10. [d1.0.0]: https://github.com/json5/json5/compare/v0.5.1...v1.0.0
  11. This release includes major internal changes and public API enhancements.
  12. - **Major** JSON5 officially supports Node.js v4 and later. Support for Node.js
  13. v0.10 and v0.12 have been dropped.
  14. - New: Unicode property names and Unicode escapes in property names are
  15. supported. ([#1])
  16. - New: `stringify` outputs trailing commas in objects and arrays when a `space`
  17. option is provided. ([#66])
  18. - New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
  19. in strings in order to be compatible with JSON. However, ES5 does not allow
  20. these characters in strings, so JSON5 gives a warning when they are parsed and
  21. escapes them when they are stringified. ([#70])
  22. - New: `stringify` accepts an options object as its second argument. The
  23. supported options are `replacer`, `space`, and a new `quote` option that
  24. specifies the quote character used in strings. ([#71])
  25. - New: The CLI supports STDIN and STDOUT and adds `--out-file`, `--space`, and
  26. `--validate` options. See `json5 --help` for more information. ([#72], [#84],
  27. and [#108])
  28. - New: In addition to the white space characters space `\t`, `\v`, `\f`, `\n`,
  29. `\r`, and `\xA0`, the additional white space characters `\u2028`, `\u2029`,
  30. and all other characters in the Space Separator Unicode category are allowed.
  31. - New: In addition to the character escapes `\'`, `\"`, `\\`, `\b`, `\f`, `\n`,
  32. `\r`, and `\t`, the additional character escapes `\v` and `\0`, hexadecimal
  33. escapes like `\x0F`, and unnecessary escapes like `\a` are allowed in string
  34. values and string property names.
  35. - New: `stringify` outputs strings with single quotes by default but
  36. intelligently uses double quotes if there are more single quotes than double
  37. quotes inside the string. (i.e. `stringify('Stay here.')` outputs
  38. `'Stay here.'` while `stringify('Let\'s go.')` outputs `"Let's go."`)
  39. - New: When a character is not allowed in a string, `stringify` outputs a
  40. character escape like `\t` when available, a hexadecimal escape like `\x0F`
  41. when the Unicode code point is less than 256, or a Unicode character escape
  42. like `\u01FF`, in that order.
  43. - New: `stringify` checks for a `toJSON5` method on objects and, if it exists,
  44. stringifies its return value instead of the object. `toJSON5` overrides
  45. `toJSON` if they both exist.
  46. - New: To `require` or `import` JSON5 files, use `require('json5/lib/register')`
  47. or `import 'json5/lib/register'`. Previous versions used `json5/lib/require`,
  48. which still exists for backward compatibility but is deprecated and will give
  49. a warning.
  50. - New: To use JSON5 in browsers, use the file at `dist/index.js` or
  51. `https://unpkg.com/json5@^1.0.0`.
  52. - Fix: `stringify` properly outputs `Infinity` and `NaN`. ([#67])
  53. - Fix: `isWord` no longer becomes a property of `JSON5` after calling
  54. `stringify`. ([#68] and [#89])
  55. - Fix: `stringify` no longer throws when an object does not have a `prototype`.
  56. ([#154])
  57. - Fix: `stringify` properly handles the `key` argument of `toJSON(key)` methods.
  58. `toJSON5(key)` follows this pattern.
  59. - Fix: `stringify` accepts `Number` and `String` objects as its `space`
  60. argument.
  61. - Fix: In addition to a function, `stringify` also accepts an array of keys to
  62. include in the output as its `replacer` argument. Numbers, `Number` objects,
  63. and `String` objects will be converted to a string if they are given as array
  64. values.
  65. ### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
  66. [c0.5.1]: https://github.com/json5/json5/tree/v0.5.1
  67. [d0.5.1]: https://github.com/json5/json5/compare/v0.5.0...v0.5.1
  68. This release includes a minor fix for indentations when stringifying empty
  69. arrays.
  70. - Fix: Indents no longer appear in empty arrays when stringified. ([#134])
  71. ### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
  72. [c0.5.0]: https://github.com/json5/json5/tree/v0.5.0
  73. [d0.5.0]: https://github.com/json5/json5/compare/v0.4.0...v0.5.0
  74. This release includes major internal changes and public API enhancements.
  75. - **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
  76. Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
  77. remain.
  78. - Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
  79. - New: `parse` and the CLI provide line and column numbers when displaying error
  80. messages. ([#101]; awesome work by [@amb26].)
  81. ### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
  82. [c0.4.0]: https://github.com/json5/json5/tree/v0.4.0
  83. [d0.4.0]: https://github.com/json5/json5/compare/v0.2.0...v0.4.0
  84. Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
  85. changelog entry includes v0.3.0 features.
  86. This is a massive release that adds `stringify` support, among other things.
  87. - **Major:** `JSON5.stringify()` now exists!
  88. This method is analogous to the native `JSON.stringify()`;
  89. it just avoids quoting keys where possible.
  90. See the [usage documentation](./README.md#usage) for more.
  91. ([#32]; huge thanks and props [@aeisenberg]!)
  92. - New: `NaN` and `-NaN` are now allowed number literals.
  93. ([#30]; thanks [@rowanhill].)
  94. - New: Duplicate object keys are now allowed; the last value is used.
  95. This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
  96. - Fix: Properly handle various whitespace and newline cases now.
  97. E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
  98. and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
  99. ([#58], [#60], and [#63]; thanks [@jordanbtucker].)
  100. - New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
  101. (They were disallowed in v0.2.0; see below.)
  102. It turns out they *are* valid in ES5, so JSON5 supports them now too.
  103. ([#36]; thanks [@jordanbtucker]!)
  104. ### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
  105. [c0.2.0]: https://github.com/json5/json5/tree/v0.2.0
  106. [d0.2.0]: https://github.com/json5/json5/compare/v0.1.0...v0.2.0
  107. This release fixes some bugs and adds some more utility features to help you
  108. express data more easily:
  109. - **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
  110. While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
  111. in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
  112. and Node), so JSON5 officially rejects them now, too. ([#36])
  113. - New: Trailing decimal points in decimal numbers are allowed again.
  114. (They were disallowed in v0.1.0; see below.)
  115. They're allowed by ES5, and differentiating between integers and floats may
  116. make sense on some platforms. ([#16]; thanks [@Midar].)
  117. - New: `Infinity` and `-Infinity` are now allowed number literals.
  118. ([#30]; thanks [@pepkin88].)
  119. - New: Plus signs (`+`) in front of numbers are now allowed, since it can
  120. be helpful in some contexts to explicitly mark numbers as positive.
  121. (E.g. when a property represents changes or deltas.)
  122. - Fix: unescaped newlines in strings are rejected now.
  123. ([#24]; thanks [@Midar].)
  124. ### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
  125. [c0.1.0]: https://github.com/json5/json5/tree/v0.1.0
  126. [d0.1.0]: https://github.com/json5/json5/compare/v0.0.1...v0.1.0
  127. This release tightens JSON5 support and adds helpful utility features:
  128. - New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
  129. - Fix: Reject octal numbers properly now. Previously, they were accepted but
  130. improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
  131. - **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
  132. leading zero). These are disallowed by both JSON5 and JSON, as well as by
  133. ES5's strict mode. (Thanks [@MaxNanasy].)
  134. - New: Support leading decimal points in decimal numbers.
  135. (Thanks [@MaxNanasy].)
  136. - **Breaking:** Reject trailing decimal points in decimal numbers now. These
  137. are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
  138. - **Breaking:** Reject omitted elements in arrays now. These are disallowed by
  139. both JSON5 and JSON.
  140. - Fix: Throw proper `SyntaxError` instances on errors now.
  141. - New: Add Node.js `require()` hook. Register via `json5/lib/require`.
  142. - New: Add Node.js `json5` executable to compile JSON5 files to JSON.
  143. ### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
  144. [c0.0.1]: https://github.com/json5/json5/tree/v0.0.1
  145. [d0.0.1]: https://github.com/json5/json5/compare/v0.0.0...v0.0.1
  146. This was the first implementation of this JSON5 parser.
  147. - Support unquoted object keys, including reserved words. Unicode characters
  148. and escape sequences sequences aren't yet supported.
  149. - Support single-quoted strings.
  150. - Support multi-line strings.
  151. - Support trailing commas in arrays and objects.
  152. - Support comments, both inline and block.
  153. ### v0.0.0 [[code](https://github.com/json5/json5/tree/v0.0.0)]
  154. Let's consider this to be Douglas Crockford's original [json_parse.js] — a
  155. parser for the regular JSON format.
  156. [json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
  157. [v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
  158. [@MaxNanasy]: https://github.com/MaxNanasy
  159. [@Midar]: https://github.com/Midar
  160. [@pepkin88]: https://github.com/pepkin88
  161. [@rowanhill]: https://github.com/rowanhill
  162. [@aeisenberg]: https://github.com/aeisenberg
  163. [@jordanbtucker]: https://github.com/jordanbtucker
  164. [@amb26]: https://github.com/amb26
  165. [#1]: https://github.com/json5/json5/issues/1
  166. [#16]: https://github.com/json5/json5/issues/16
  167. [#24]: https://github.com/json5/json5/issues/24
  168. [#30]: https://github.com/json5/json5/issues/30
  169. [#32]: https://github.com/json5/json5/issues/32
  170. [#36]: https://github.com/json5/json5/issues/36
  171. [#57]: https://github.com/json5/json5/issues/57
  172. [#58]: https://github.com/json5/json5/pull/58
  173. [#60]: https://github.com/json5/json5/pull/60
  174. [#63]: https://github.com/json5/json5/pull/63
  175. [#66]: https://github.com/json5/json5/issues/66
  176. [#67]: https://github.com/json5/json5/issues/67
  177. [#68]: https://github.com/json5/json5/issues/68
  178. [#70]: https://github.com/json5/json5/issues/70
  179. [#71]: https://github.com/json5/json5/issues/71
  180. [#72]: https://github.com/json5/json5/issues/72
  181. [#84]: https://github.com/json5/json5/pull/84
  182. [#89]: https://github.com/json5/json5/pull/89
  183. [#97]: https://github.com/json5/json5/pull/97
  184. [#101]: https://github.com/json5/json5/pull/101
  185. [#108]: https://github.com/json5/json5/pull/108
  186. [#134]: https://github.com/json5/json5/pull/134
  187. [#154]: https://github.com/json5/json5/issues/154