Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 class support #349

Closed
matthewmueller opened this issue Dec 9, 2021 · 3 comments
Closed

ES6 class support #349

matthewmueller opened this issue Dec 9, 2021 · 3 comments

Comments

@matthewmueller
Copy link

Hey @dop251, thanks for all your hard work on Goja. I'm especially grateful for the recent Promise API support.

Goja is really close to being ready to natively run what ESBuild outputs to ES6 via esbuild --target=es2015 <entry...>.

One thing that's missing is class support:

class A extends B {
  constructor() {
     super()
  }
}

I was actually surprised to see that class support came in ES6, but I had a look at the ES6 support table and it looks like it's there.

For my use-case, I'm trying to render Svelte code on the server-side, but the compiler generates classes:

var SvelteElement
if (typeof HTMLElement === "function") {
  SvelteElement = class extends HTMLElement {
    constructor() {
      super()
      this.attachShadow({ mode: "open" })
    }
    // ...
}
@dop251 dop251 added this to the ES6 (and beyond) milestone Jan 3, 2022
@dzonerzy
Copy link

dzonerzy commented May 3, 2022

Thanks for all your hard work first of all! do we have an eta for the es6 support?

@arukiidou
Copy link

arukiidou commented May 4, 2022

@dzonerzy
He says that,

I will be adding features in their dependency order and as quickly as time permits. Please do not ask for ETAs.

@dop251
Copy link
Owner

dop251 commented May 4, 2022

I can only say it's next on my list. It's no small feat and I also want to implement private fields so that I don't have to return to it (and potentially do a complete rewrite).

@dop251 dop251 closed this as completed in 0b5d210 Jul 21, 2022
Gabri3l pushed a commit to mongodb-forks/goja that referenced this issue Sep 1, 2022
Gabri3l added a commit to mongodb-forks/goja that referenced this issue Mar 22, 2023
* Implemented classes (including private elements). Closes dop251#349.
* Fixed "delete 'a'.prop". Optimised a[<const_string>] to a.<const_string>
* Enabled more tests and fixed some bugs. Closes dop251#410.
* Fixed this binding initialisation. Fixes dop251#415.
* Added NewSharedDynamicObject() and NewSharedDynamicArray(). Closes dop251#418.
* Optimised memory usage when generating function and class initialisation code
* Fixed Export() value for arrow functions and classes. Added Runtime.AssertConstructor. Closes dop251#419.
* Always create a map when exporting. Fixes dop251#422.
* Refactored conversion to primitive. Always use `String()` method if defined. Closes dop251#423.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants