@danielx/civet 0.4.19-pre.9 → 0.4.20
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/LICENSE +21 -0
- package/README.md +15 -4
- package/dist/browser.js +7515 -2482
- package/dist/civet +28 -7
- package/dist/esbuild-plugin.js +3 -3
- package/dist/esm.mjs +1 -1
- package/dist/main.js +7515 -2482
- package/package.json +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Daniel X Moore and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -53,6 +53,8 @@ Things Kept from CoffeeScript
|
|
|
53
53
|
- `is` -> `===`
|
|
54
54
|
- `or` -> `||`
|
|
55
55
|
- `and` -> `&&`
|
|
56
|
+
- `or=` -> `||=`
|
|
57
|
+
- `and=` -> `&&=`
|
|
56
58
|
- `loop` -> `while(true)`
|
|
57
59
|
- `unless exp` -> `if(!exp)`
|
|
58
60
|
- `until condition` -> `while(!condition)`
|
|
@@ -88,6 +90,9 @@ Things Kept from CoffeeScript
|
|
|
88
90
|
- Simplified number method calls `1.toFixed()` -> `1..toFixed()`
|
|
89
91
|
- `if`/`switch`/`for`/`loop`/`while`/`throw` expressions
|
|
90
92
|
- Destructuring object assignment doesn't require being wrapped in parens at the statement level `{a, b} = c` -> `({a, b} = c)`
|
|
93
|
+
- Prefix or postfix splats `[...a]`, `x = [a...]`
|
|
94
|
+
- `///` Heregexp
|
|
95
|
+
- With some [changes](#things-changed-from-coffeescript).
|
|
91
96
|
- JSX 😿
|
|
92
97
|
|
|
93
98
|
Things Removed from CoffeeScript
|
|
@@ -108,7 +113,6 @@ Civet.
|
|
|
108
113
|
- `for from` (use JS `for of`, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
|
|
109
114
|
- `for own of` (use JS `for in` and check manually, switch to `Map#keys/values/entries`, or use `Object.create(null)`, or `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
|
|
110
115
|
- `for ... when <condition>` (use `continue if exp` inside loop, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
|
|
111
|
-
- `and=`, `or=` (don't mix and match words and symbols)
|
|
112
116
|
- `a ? b` (use `a ?? b`, though it doesn't check for undeclared variables, `"civet coffeeCompat"`, or `"civet coffeeBinaryExistential"` enables this at the cost of losing JS ternary operator)
|
|
113
117
|
- `a of b` (use `a in b` matching JS, or `"civet coffeeCompat"`, or `"civet coffeeOf"`)
|
|
114
118
|
- Iteration expression results
|
|
@@ -117,7 +121,6 @@ Civet.
|
|
|
117
121
|
- Optional assignment `x?.y = 3` -> `x != null ? x.y = 3 : undefined`
|
|
118
122
|
- Conditional assignment `a?[x] = 3` -> `a ? a[x] = 3 : undefined`
|
|
119
123
|
- Might add later
|
|
120
|
-
- `///` Heregexp
|
|
121
124
|
- Rest parameter in any assignment position
|
|
122
125
|
- Multiple slice assignment `otherNumbers[0...] = numbers[3..6] = [-3, -4, -5, -6]`
|
|
123
126
|
|
|
@@ -127,7 +130,6 @@ Things Changed from CoffeeScript
|
|
|
127
130
|
- `==` -> `==` rather than `===` (can be kept with `"civet coffeeCompat"` or `"civet coffeeEq"`)
|
|
128
131
|
- `!=` -> `!=` rather than `!==` (can be kept with `"civet coffeeCompat"` or `"civet coffeeEq"`)
|
|
129
132
|
- `for in` and `for of` are no longer swapped and become their JS equivalents.
|
|
130
|
-
- `a...` is now `...a` just like JS
|
|
131
133
|
- `a in b` is now `a in b` rather than `b.indexOf(a) >= 0`
|
|
132
134
|
- `x?.y` now compiles to `x?.y` rather than the `if typeof x !== 'undefined' && x !== null` if check
|
|
133
135
|
- Existential `x?` -> `(x != null)` no longer checks for undeclared variables.
|
|
@@ -150,6 +152,15 @@ Things Changed from CoffeeScript
|
|
|
150
152
|
x + 3
|
|
151
153
|
```
|
|
152
154
|
remains as is.
|
|
155
|
+
- Heregex
|
|
156
|
+
- Allows both kinds of substitutions `#{..}`, `${..}`.
|
|
157
|
+
- Also allows both kinds of single line comments `//`, `#`.
|
|
158
|
+
- Keeps non-newline whitespace inside of character classes.
|
|
159
|
+
- Doesn't require escaping `#` after space inside of character classes.
|
|
160
|
+
- `#` is always the start of a comment outside of character classes regardless of leading space (CoffeeScript treats
|
|
161
|
+
`\s+#` as comment starts inside and outside of character classes).
|
|
162
|
+
- Might later add a compat flag to get more CoffeeScript compatibility.
|
|
163
|
+
- Might also later add a compat flag to only use ES interpolations and comments inside Heregexes.
|
|
153
164
|
|
|
154
165
|
Things Added that CoffeeScript didn't
|
|
155
166
|
---
|
|
@@ -242,7 +253,7 @@ coffeeOf (`a of b` -> `a in b`, `a in b` -> `b.indexOf(a) >= 0`, `a not in
|
|
|
242
253
|
```
|
|
243
254
|
|
|
244
255
|
You can use these with `"civet coffeeCompat"` to opt in to all or use them bit by bit with `"civet coffeeComment coffeeEq coffeeInterpolation"`.
|
|
245
|
-
Another
|
|
256
|
+
Another possibility is to slowly remove them to provide a way to migrate files a little at a time `"civet coffeeCompat -coffeeBooleans -coffeeComment -coffeeEq"`.
|
|
246
257
|
Both camel case and hyphens work when specifying options `"civet coffee-compat"`. More options will be added over time until 97+% compatibility is achieved.
|
|
247
258
|
|
|
248
259
|
Using Civet in your Node.js Environment
|