plotly / plotly/plotly.js

Special characters in plotly.js causing minification and packaging issues

Offen
#6,797 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug infrastructure P2
Vorherrschende Sprache
JavaScript
Sterne
18.3k
Forks
2k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
28

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Durchsuche den plotly.js-Quellcode nach der Funktion normal, die die Parameter mu und sigma verwendet, und prüfe anschließend das zugehörige Parcel-Issue, um den Packaging-Kontext zu verstehen. Ersetze die problematischen Bezeichner mit Sonderzeichen durch die vorgeschlagenen sichereren Namen und verifiziere, dass Minifizierung und Packaging nicht mehr fehlschlagen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.