Skip to content

Update JS SDK target to es2017 #80

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

Merged
merged 2 commits into from
Apr 30, 2025
Merged

Conversation

dobrac
Copy link
Contributor

@dobrac dobrac commented Apr 29, 2025

Updates the JS SDK target to es2017 (from es2015). This change improves error logs that include user code. This is happening because before es2017 (e.g. es2015) tsup adds polyfill for async (which we use in the API) obfuscating the code execution path.

(The previously generated code)

var __async = (__this, __arguments, generator) => {
  return new Promise((resolve, reject) => {
    var fulfilled = (value) => {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    };
    var rejected = (value) => {
      try {
        step(generator.throw(value));
      } catch (e) {
        reject(e);
      }
    };
    var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
    step((generator = generator.apply(__this, __arguments)).next());
  });
};
var __await = function(promise, isYieldStar) {
  this[0] = promise;
  this[1] = isYieldStar;
};

@dobrac dobrac added the javascript Pull requests that update Javascript code label Apr 29, 2025
@dobrac dobrac self-assigned this Apr 29, 2025
@jakubno jakubno merged commit 2d75507 into main Apr 30, 2025
2 checks passed
@jakubno jakubno deleted the update-tsup-target-to-es2017 branch April 30, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants