Skip to content

Commit cc973eb

Browse files
committed
Remove computed flag of literal property names
1 parent 856fbbc commit cc973eb

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,39 @@ export { name, name as default, name as alias };
2929

3030
See [wiki](//github.com/dk00/livescript-next/wiki) for what are added and what are going to be added.
3131

32-
## Usage
32+
## Usage with babel in node
3333

3434
Install required packages:
3535

3636
```
37-
npm i --save-dev livescript livescript-next babel-plugin-preset-stage-0
37+
npm i --save-dev livescript livescript-next babel-plugin-preset-stage-0 transform-es2015-modules-commonjs
3838
```
3939

40-
The `parse` function can be used by `babel` to parse `.ls` files, add this to babel options to enable it. Also add `stage-0` presets to handle [stage 0](//github.com/tc39/proposals/blob/master/stage-0-proposals.md) and [above](//github.com/tc39/proposals) ES features.
40+
Set babel options(or specify this in `.babelrc`):
4141

4242
```ls
43-
presets: <[stage-0]>
44-
parser-opts: parser: require \livescript-next .parse
43+
babel-options =
44+
presets: <[stage-0]>
45+
plugins: <[transform-es2015-modules-commonjs]>
46+
parser-opts: parser: \livescript-next
4547
```
4648

47-
When using in node with `babel-register`, add commonjs transform plugin
49+
Register require hook and require the entry file:
4850

4951
```ls
50-
plugins: <[transform-es2015-modules-commonjs]>
52+
require \livescript
53+
delete require.extensions\.ls
54+
require \babel-register <| babel-options
55+
require \./index.ls
5156
```
5257

5358
## Features
5459

5560
- Module
5661
- [x] Named import and export
57-
- [ ] Export expression
62+
- [ ] Export declaration
5863
- [ ] Import only side-effect
59-
- Destructing assignment/parameter
64+
- ES Destructuring assignment/parameter output
6065
- [x] Basic support
6166
- [x] With default value
6267
- [x] Spread operator

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "livescript-next",
33
"description": "Enable latest ES features for LiveScript",
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"main": "lib/index.js",
66
"module": "es/index.js",
77
"browser": "dist/index.js",
@@ -55,6 +55,6 @@
5555
"babel",
5656
"javascript"
5757
],
58-
"author": "dk00 <dk00@users.noreply.github.com>",
58+
"author": "dk00 <dk@csie.org>",
5959
"license": "Unlicense"
6060
}

src/convert.ls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,9 @@ function convert-property => derive-property[it.type] it
666666
t.object = (properties) ->
667667
t.object-expression properties.map convert-property
668668

669+
function computed => !it.key && !t.is-literal it
669670
t.property = (key, value) ->
670-
t.object-property key, value, !key.key, key.name == value.name
671+
t.object-property key, value, (computed key), key.name == value.name
671672

672673
t <<<
673674
unk: -> throw "not implemented: #{it.type}"

0 commit comments

Comments
 (0)