@danielx/civet 0.4.23 → 0.4.24
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 +22 -2
- package/dist/browser.js +240 -156
- package/dist/esbuild-plugin.js +1 -1
- package/dist/main.js +240 -156
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ The CoffeeScript of TypeScript. Much closer to ES2015+ (for better or worse).
|
|
|
7
7
|
|
|
8
8
|
- [Online Civet Playground](https://civet-web.vercel.app/)
|
|
9
9
|
- [Civet VSCode Extension](https://marketplace.visualstudio.com/items?itemName=DanielX.civet)
|
|
10
|
+
- [Discord Server](https://discord.gg/xkrW9GebBc)
|
|
10
11
|
|
|
11
12
|
Quickstart Guide
|
|
12
13
|
---
|
|
@@ -234,13 +235,20 @@ Things Changed from ES6
|
|
|
234
235
|
of numbers with `1..toString()` use `1.toString()` instead. When exponent follows a dot it is treated as a property access since an exponent
|
|
235
236
|
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`.
|
|
236
237
|
- Additional reserved words `and`, `or`, `loop`, `until`, `unless`
|
|
238
|
+
- Experimental decorator syntax is `@@` instead of `@` because `@` is premium real estate and `@id` -> `this.id`, and `@` is also static fields/methods, etc.
|
|
239
|
+
```
|
|
240
|
+
@@classDecorator
|
|
241
|
+
class X
|
|
242
|
+
@@methodDecorator
|
|
243
|
+
method() {}
|
|
244
|
+
```
|
|
237
245
|
- No whitespace between unary operators and operands. Mandatory whitespace between condition and ternary `?` ex. `x ? a : b` since `x?` is the unary existential operator.
|
|
238
246
|
- No labels (yet...)
|
|
239
247
|
|
|
240
248
|
CoffeeScript Compatibility
|
|
241
249
|
---
|
|
242
250
|
|
|
243
|
-
Civet provides a
|
|
251
|
+
Civet provides a compatibility prologue directive that aims to be 97+% compatible with existing CoffeeScript2 code (still a work in progress).
|
|
244
252
|
|
|
245
253
|
| Configuration | What it enables |
|
|
246
254
|
|---------------------|---------------------------------------------------------------------|
|
|
@@ -255,11 +263,23 @@ Civet provides a compatability prologue directive that aims to be 97+% compatibl
|
|
|
255
263
|
| coffeeNot | `not` -> `!`, `a not instanceof b` -> `!(a instanceof b)`, `a not of b` -> `!(a in b)` |
|
|
256
264
|
| coffeeOf | `a of b` -> `a in b`, `a in b` -> `b.indexOf(a) >= 0`, `a not in b` -> `b.indexOf(a) < 0` |
|
|
257
265
|
|
|
258
|
-
|
|
259
266
|
You can use these with `"civet coffeeCompat"` to opt in to all or use them bit by bit with `"civet coffeeComment coffeeEq coffeeInterpolation"`.
|
|
260
267
|
Another possibility is to slowly remove them to provide a way to migrate files a little at a time `"civet coffeeCompat -coffeeBooleans -coffeeComment -coffeeEq"`.
|
|
261
268
|
Both camel case and hyphens work when specifying options `"civet coffee-compat"`. More options will be added over time until 97+% compatibility is achieved.
|
|
262
269
|
|
|
270
|
+
Other Options
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
The `"civet"` prologue directive can also specify the following options:
|
|
274
|
+
|
|
275
|
+
| Configuration | What it enables |
|
|
276
|
+
|---------------------|---------------------------------------|
|
|
277
|
+
| tab=NNN | treat tab like NNN spaces (default=1) |
|
|
278
|
+
|
|
279
|
+
For example, `"civet tab=2"` or `"civet tab=4"` lets you mix tabs and spaces
|
|
280
|
+
in a file and be treated like they'd render in VSCode with `editor.tabSize`
|
|
281
|
+
set accordingly.
|
|
282
|
+
|
|
263
283
|
Using Civet in your Node.js Environment
|
|
264
284
|
---
|
|
265
285
|
|