Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Special characters in plotly.js causing minification and packaging issues #6797

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

Open
chdominguez opened this issue Nov 24, 2023 · 3 comments
Assignees
Labels
bug something broken infrastructure build process etc. P2 considered for next cycle

Comments

@chdominguez
Copy link

I have identified an issue in the plotly.js library where special characters, such as σ and μ, are used in a function. This leads to problems during the minification/packaging process, causing certain package managers to fail as they do not correctly interpret these characters.

I found a related issue in the Parcel bundler repository, which has been addressed and fixed. The details can be found here: Parcel Issue #9370

I propose modifying the original plotly.js function to replace the special characters with safer alternatives. Below is the suggested modification:

normal: function(mu, sigma) {
  var n = arguments.length;
  if (n < 2) sigma = 1;
  if (n < 1) mu = 0;
  return function() {
    var x, y, r;
    do {
      x = Math.random() * 2 - 1;
      y = Math.random() * 2 - 1;
      r = x * x + y * y;
    } while (!r || r > 1);
    return mu + sigma * x * Math.sqrt(-2 * Math.log(r) / r);
  };
},

I will try to push a PR myself

@alexcjohnson
Copy link
Collaborator

IIRC these characters are in D3 code that we import, not in the plotly.js codebase itself, which may make it harder to edit.

@chdominguez
Copy link
Author

I have noticed upon trying to edit the code. This is why I haven't pushed any PR yet. For now I will wait till a parcel.js version is released with the fix to see if the issue is completely gone.

@archmoj
Copy link
Contributor

archmoj commented Nov 24, 2023

If you want to open a PR, please fork this repository: https://github.com/plotly/d3 and submit to it.

@gvwilson gvwilson self-assigned this Jul 12, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added bug something broken P2 considered for next cycle infrastructure build process etc. and removed type: performance labels Aug 8, 2024
@gvwilson gvwilson self-assigned this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken infrastructure build process etc. P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

4 participants