@danielx/civet 0.4.33 → 0.4.35

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.
Files changed (4) hide show
  1. package/README.md +16 -17
  2. package/dist/browser.js +554 -354
  3. package/dist/main.js +554 -354
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -97,7 +97,7 @@ Things Kept from CoffeeScript
97
97
  - RestElement/RestParameter in any position `(first, ...midle, last) ->` -> `function(first, ...middle) { let [last] = middle.splice(-1)}`
98
98
  - `///` Heregexp
99
99
  - With some [changes](#things-changed-from-coffeescript).
100
- - JSX 😿
100
+ - JSX
101
101
 
102
102
  Things Removed from CoffeeScript
103
103
  ---
@@ -142,17 +142,7 @@ Things Changed from CoffeeScript
142
142
  - Postfix iteration/conditionals always wrap the statement [#5431](https://github.com/jashkenas/coffeescript/issues/5431)
143
143
  `try x() if y` -> `if (y) try x()`
144
144
  - Civet tries to keep the transpiled output verbatim as much as possible.
145
- In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x);`.
146
- Also in Coffee
147
- ```coffee
148
- x + 3
149
- ```
150
- -> `x + 3` without the spacing
151
- In Civet
152
- ```typescript
153
- x + 3
154
- ```
155
- remains as is.
145
+ In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x)`. Spacing and comments are also preserved as much as possible.
156
146
  - Heregex / re.X
157
147
  - Stay closer to the [Python spec](https://docs.python.org/3/library/re.html#re.X)
158
148
  - Allows both kinds of substitutions `#{..}`, `${..}`.
@@ -181,8 +171,8 @@ Things Added that CoffeeScript didn't
181
171
  ```
182
172
  ```typescript
183
173
  class A {
184
- readonly x = 3;
185
- };
174
+ readonly x = 3
175
+ }
186
176
  ```
187
177
  - JS Compatability
188
178
  - `var`, `let`, `const`
@@ -196,7 +186,7 @@ Things Added that CoffeeScript didn't
196
186
  - `get`/`set` method definitions
197
187
  - Private identifiers `#id`
198
188
  - Convenience for ES6+ Features
199
- - Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
189
+ - Const assignment shorthand `a := b` -> `const a = b`, `{a, b} := c` -> `const {a, b} = c`
200
190
  - `@#id` -> `this.#id` shorthand for private identifiers
201
191
  - `import` shorthand: `x from ./x` -> `import x from "./x"`
202
192
  - `export` shorthand: `export x, y` -> `export {x, y}`
@@ -211,8 +201,17 @@ Things Added that CoffeeScript didn't
211
201
  - unary operators `x.map !!&`, -> `x.map($ => !!$)`
212
202
  - binary operators `x.map &+1` -> `x.map($ => $+1)`
213
203
  - Flagging shorthand [from LiveScript](https://livescript.net/#literals) `{+debug, -live}` -> `{debug: true, live: false}`
214
- - Indentation JSX: instead of explicitly closing `<tag>`s or `<>`s,
215
- you can indent the children and Civet will close your tags for you
204
+ - JSX enhancements:
205
+ - Indentation: instead of explicitly closing `<tag>`s or `<>`s,
206
+ you can indent the children and Civet will close your tags for you
207
+ - Any braced object literal can be used as an attribute.
208
+ `{foo}` -> `foo={foo}`, `{foo: bar}` -> `foo={bar}`,
209
+ `{...foo}` remains as is; methods and getters/setters work too.
210
+ - Many attribute values (basic literals, array literals, braced object
211
+ literals, regular expressions, template strings, and parenthesized
212
+ expressions) do not need braces. `foo=bar` -> `foo={bar}`
213
+ - Attributes can use computed property names:
214
+ `[expr]={value}` -> `{...{[expr]: value}}`
216
215
  - CoffeeScript improvements
217
216
  - Postfix loop `run() loop` -> `while(true) run()`
218
217
  - Character range literals `["a".."z"]`, `['f'..'a']`, `['0'..'9']`