@danielx/civet 0.4.14 → 0.4.15

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/README.md CHANGED
@@ -41,10 +41,10 @@ fileCache : Record<string, any> := {}
41
41
 
42
42
  createCompilerHost := (options: CompilerOptions, moduleSearchLocations : string[]) ->
43
43
  fileExists := (fileName: string) : boolean ->
44
- return fileCache[fileName]?
44
+ fileCache[fileName]?
45
45
 
46
46
  readFile := (fileName: string) ->
47
- return fileCache[fileName]
47
+ fileCache[fileName]
48
48
  ```
49
49
 
50
50
  ESBuild Plugin
@@ -98,6 +98,7 @@ Things Kept from CoffeeScript
98
98
  - `when` inside `switch` automatically breaks
99
99
  - Multiple `,` separated `case`/`when` expressions
100
100
  - `else` -> `default` in `switch`
101
+ - Array slices `list[0...2]` -> `list.slice(0, 2)`
101
102
  - Implicit returns
102
103
  - Simplified number method calls `1.toFixed()` -> `1..toFixed()`
103
104
  - JSX 😿
@@ -105,7 +106,7 @@ Things Kept from CoffeeScript
105
106
  Things Removed from CoffeeScript
106
107
  ---
107
108
 
108
- - `on/yes/off/no` (use `true/false`, `"civet coffeeCompat"`)
109
+ - `on/yes/off/no` (use `true/false`, or `"civet coffeeCompat"` to add them back)
109
110
  - `isnt` (use `!==`)
110
111
  - `not` (use `!`)
111
112
  - `do` keyword (replaced with JS `do`, invoke using existing `(-> ...)()` syntax)
@@ -117,10 +118,10 @@ Things Removed from CoffeeScript
117
118
  - Will likely add later
118
119
  - `switch` expressions
119
120
  - `if` expressions
120
- - Implicit declarations (in compat mode only)
121
+ - Implicit `var` declarations (in compat mode only)
121
122
  - Might add later
123
+ - Braceless inline objects `x = coolStory: true`
122
124
  - Comprensions
123
- - Array slices `list[0...2]` (use `list.slice(0, 2)`)
124
125
  - `///` Heregexp
125
126
  - Slice assignment `numbers[3..6] = [-3, -4, -5, -6]` (use `numbers.splice(3, 4, -3, -4, -5, -6)`)
126
127
  - Ranges `[0...10]`
@@ -141,6 +142,8 @@ Things Changed from CoffeeScript
141
142
  - No `else` block on `unless` (negate condition and use `if`)
142
143
  - `#{}` interpolation in `""` strings only when `"civet coffeeCompat"` or `"civet coffeeInterpolation"`
143
144
  - Expanded chained comparisons to work on more operators `a in b instanceof C` -> `a in b && b instanceof C`
145
+ - Postfix iteration/conditionals always wrap the statement [#5431](https://github.com/jashkenas/coffeescript/issues/5431)
146
+ `try x() if y` -> `if (y) try x()`
144
147
  - Civet tries to keep the transpiled output verbatim as much as possible.
145
148
  In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x);`.
146
149
  Also in Coffee
@@ -211,7 +214,8 @@ Things Changed from ES6
211
214
  - `for(i of x) ...` defaults to const declaration -> `for(const i of x) ...`
212
215
  - Disallow comma operator in conditionals. `if x, y`
213
216
  - Comma operator in case/when becomes multiple conditions.
214
- - When exponent follows a dot it is treated as a property access since we simplified `1.toString()` -> `1..toString()` and an exponent
217
+ - Numbers can't end with a dot (otherwise would be ambiguous with CoffeeScript slices `y[0..x]`). This also implies that you can't access properties
218
+ of numbers with `1..toString()` use `1.toString()` instead. When exponent follows a dot it is treated as a property access since an exponent
215
219
  could be a valid property `1.e10` -> `1..e10`. The workaround is to add a trailing zero `1.0e10` or remove the dot before the exponent `1e10`.
216
220
  - Additional reserved words `and`, `or`, `loop`, `until`, `unless`
217
221