@danielx/civet 0.2.11 → 0.2.14
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 +25 -8
- package/dist/browser.js +488 -292
- package/dist/browser.js.map +2 -2
- package/dist/civet +12 -11
- package/dist/cli.js.map +3 -3
- package/dist/main.js +488 -292
- package/dist/types.d.ts +1 -0
- package/esbuild-plugin.js +27 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -46,6 +46,25 @@ createCompilerHost := (options: CompilerOptions, moduleSearchLocations : string[
|
|
|
46
46
|
return fileCache[fileName]
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
ESBuild Plugin
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
```coffee
|
|
53
|
+
esbuild = require "esbuild"
|
|
54
|
+
civetPlugin = require "@danielx/civet/esbuild-plugin"
|
|
55
|
+
|
|
56
|
+
esbuild.build
|
|
57
|
+
entryPoints: ['source/main.civet']
|
|
58
|
+
bundle: true
|
|
59
|
+
platform: 'node'
|
|
60
|
+
outfile: 'dist/main.js'
|
|
61
|
+
plugins: [
|
|
62
|
+
civetPlugin
|
|
63
|
+
]
|
|
64
|
+
.catch -> process.exit 1
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
49
68
|
Things Kept from CoffeeScript
|
|
50
69
|
---
|
|
51
70
|
|
|
@@ -54,6 +73,7 @@ Things Kept from CoffeeScript
|
|
|
54
73
|
- `and` -> `&&`
|
|
55
74
|
- `loop` -> `while(true)`
|
|
56
75
|
- `unless` conditional (without the `else`)
|
|
76
|
+
- `until condition` -> `while(!condition)`
|
|
57
77
|
- Object literal syntax
|
|
58
78
|
```coffee
|
|
59
79
|
x =
|
|
@@ -66,15 +86,13 @@ Things Kept from CoffeeScript
|
|
|
66
86
|
- Optional semi-colons
|
|
67
87
|
- Indentation based block syntax
|
|
68
88
|
- OptionalChain shorthand for index and function application `a?[b]` -> `a?.[b]`, `a?(b)` -> `a?.(b)`
|
|
69
|
-
- `@` -> `this`
|
|
70
|
-
-
|
|
89
|
+
- `@` This shorthand `@` -> `this`, `@id` -> `this.id`
|
|
90
|
+
- Prototype shorthand `X::` -> `X.prototype`, `X::a` -> `X.prototype.a`
|
|
71
91
|
- Postfix `if/unless`
|
|
72
92
|
- JSX 😿
|
|
73
93
|
- TODO
|
|
74
94
|
- [ ] `"""` Strings (for compatibility with existing .coffee code)
|
|
75
95
|
- [ ] Chained comparisons
|
|
76
|
-
- [ ] `until`
|
|
77
|
-
- [ ] Prototype shorthand `X::` -> `X.prototype`, `X::a` -> `X.prototype.a`
|
|
78
96
|
|
|
79
97
|
Things Removed from CoffeeScript
|
|
80
98
|
---
|
|
@@ -122,8 +140,7 @@ Things Added that CoffeeScript didn't
|
|
|
122
140
|
- OptionalChain longhand
|
|
123
141
|
- ConditionalExpression
|
|
124
142
|
- `case` statement
|
|
125
|
-
- `
|
|
126
|
-
- `do`
|
|
143
|
+
- `do`, `do { ... } until condition`
|
|
127
144
|
- Const assignment shorthand `a := b` -> `const a = b`; `{a, b} := c` -> `const {a, b} = c`
|
|
128
145
|
- Convenience for ES6+ Features
|
|
129
146
|
- `<` as `extends` shorthand
|
|
@@ -131,7 +148,7 @@ Things Added that CoffeeScript didn't
|
|
|
131
148
|
- ClassStaticBlock
|
|
132
149
|
- `get`/`set` method definitions
|
|
133
150
|
- Private identifiers `#id`
|
|
134
|
-
- Shebang line
|
|
151
|
+
- Shebang line is kept unmodified in output
|
|
135
152
|
```civet
|
|
136
153
|
#!./node_modules/.bin/ts-node
|
|
137
154
|
console.log "hi"
|
|
@@ -141,6 +158,6 @@ Things Changed from ES6
|
|
|
141
158
|
---
|
|
142
159
|
|
|
143
160
|
- Disallow no parens on single argument arrow function. `x => ...` must become `(x) => ...`
|
|
144
|
-
The reasoning is `x ->
|
|
161
|
+
The reasoning is `x -> ...` => `x(function() ...)` in CoffeeScript and having `->` and `=>`
|
|
145
162
|
behave more differently than they already do is bad. Passing an anonymous function to an
|
|
146
163
|
application without parens is also convenient.
|