plotly / plotly/plotly.js

Special characters in plotly.js causing minification and packaging issues

未关闭
#6,797 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug infrastructure P2
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在 plotly.js 源代码中搜索使用 musigma 参数的 normal 函数,然后查看相关的 Parcel issue 以了解打包上下文。将有问题的特殊字符标识符替换为提议的更安全名称,并验证压缩和打包不再失败。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。