sweet-js / sweet-core

Sweeten your JavaScript.
https://www.sweetjs.org
BSD 2-Clause "Simplified" License
4.58k stars 208 forks source link

Errors with valid ES6 import syntax #743

Open glaba opened 6 years ago

glaba commented 6 years ago

This results in an error:

module.js

export syntax hi = function(ctx) {
    return #`console.log('hello, world!')`;
}

file2.js

export const TEST = 3;

file.js

import { hi } from "./module.js";
import * as Test from "./file2.js";
hi;

Running sjs file.js results in

/usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/token_stream.js:95
      var rightChar = tokenStr.charAt(0);
                               ^

TypeError: tokenStr.charAt is not a function
    at TokenStream.put (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/token_stream.js:95:32)
    at Token.emit (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/coderep.js:247:10)
    at /usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/coderep.js:444:19
    at Array.forEach (native)
    at Seq.emit (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/coderep.js:443:21)
    at /usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/coderep.js:444:19
    at Array.forEach (native)
    at Seq.emit (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/coderep.js:443:21)
    at codeGen (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/shift-codegen/dist/index.js:153:7)
    at codegen (/usr/local/lib/node_modules/@sweet-js/cli/node_modules/@sweet-js/core/dist/codegen.js:16:38)
wdanilo commented 6 years ago

Hi! Is there any progress regarding this issue? Is this library still being developed? I'm asking because the number of bug reports increases and there was no single commit in the past months :(

disnet commented 6 years ago

It's still being developed, just been busy the past few months. Hope to get some time soon.

goranmoomin commented 4 years ago

@disnet Okay, I know this project is inactive, but are there any plans (any) this project can revive? I started studying sweet.js internals just for fun (after reading the Honu paper) for the past half year, and I progressed pretty much to the point where I understand most of sweet.js v1.0.0 code, but I figured out to understand the codebase to real I should write the whole thing myself.

I may be doing a rewrite of sweet.js (and make something similar), but I just wanted to ask if there is any possibility for sweet.js can revive. If it does, I would be better joining forces & helping on the bugs right now. If not, I would be proceeding to the rewrite!