From 3f6cf76170882a3000be80c3a4f802b05f156cee Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Wed, 17 Jan 2024 12:16:07 +0100 Subject: [PATCH] fix: #3114 build warnings related to a number of wrong `/* #__PURE__ */` annotations --- HISTORY.md | 2 ++ src/entry/configReadonly.js | 2 +- src/type/unit/physicalConstants.js | 2 +- src/utils/number.js | 12 ++++++------ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a6287e5805..8499d60f98 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,6 +7,8 @@ `IndexNode`, `OperatorNode`, and `RelationalNode` (#3123). Thanks @sylee957. - Added a fully featured code editor example with CodeMirror and Katex (#3027). Thanks @dvd101x. +- Fix: #3114 build warnings related to a number of wrong `/* #__PURE__ */` + annotations. # 2024-01-12, 12.3.0 diff --git a/src/entry/configReadonly.js b/src/entry/configReadonly.js index 47f8e61314..1fe4abdc3d 100644 --- a/src/entry/configReadonly.js +++ b/src/entry/configReadonly.js @@ -2,7 +2,7 @@ import { DEFAULT_CONFIG } from '../core/config.js' import { MATRIX_OPTIONS, NUMBER_OPTIONS } from '../core/function/config.js' // create a read-only version of config -export const config = /* #__PURE__ */ function (options) { +export const config = function (options) { if (options) { throw new Error('The global config is readonly. \n' + 'Please create a mathjs instance if you want to change the default configuration. \n' + diff --git a/src/type/unit/physicalConstants.js b/src/type/unit/physicalConstants.js index cd47ea6626..1184fc3583 100644 --- a/src/type/unit/physicalConstants.js +++ b/src/type/unit/physicalConstants.js @@ -44,7 +44,7 @@ export const createAvogadro = /* #__PURE__ */ unitFactory('avogadro', '6.0221407 export const createBoltzmann = /* #__PURE__ */ unitFactory('boltzmann', '1.380649e-23', 'J K^-1') export const createFaraday = /* #__PURE__ */ unitFactory('faraday', '96485.33212331001', 'C mol^-1') export const createFirstRadiation = /* #__PURE__ */ unitFactory('firstRadiation', '3.7417718521927573e-16', 'W m^2') -// export const createSpectralRadiance = /* #__PURE__ */ unitFactory('spectralRadiance', '1.1910429723971881e-16', 'W m^2 sr^-1') // TODO spectralRadiance +// TODO spectralRadiance = 1.1910429723971881e-16 W m^2 sr^-1 export const createLoschmidt = /* #__PURE__ */ unitFactory('loschmidt', '2.686780111798444e25', 'm^-3') export const createGasConstant = /* #__PURE__ */ unitFactory('gasConstant', '8.31446261815324', 'J K^-1 mol^-1') export const createMolarPlanckConstant = /* #__PURE__ */ unitFactory('molarPlanckConstant', '3.990312712893431e-10', 'J s mol^-1') diff --git a/src/utils/number.js b/src/utils/number.js index fd72b57c04..13aea1f9cb 100644 --- a/src/utils/number.js +++ b/src/utils/number.js @@ -24,7 +24,7 @@ export function isInteger (value) { * @param {number} x * @returns {number} */ -export const sign = /* #__PURE__ */ Math.sign || function (x) { +export const sign = Math.sign || function (x) { if (x > 0) { return 1 } else if (x < 0) { @@ -39,7 +39,7 @@ export const sign = /* #__PURE__ */ Math.sign || function (x) { * @param {number} x * @returns {number} */ -export const log2 = /* #__PURE__ */ Math.log2 || function log2 (x) { +export const log2 = Math.log2 || function log2 (x) { return Math.log(x) / Math.LN2 } @@ -48,7 +48,7 @@ export const log2 = /* #__PURE__ */ Math.log2 || function log2 (x) { * @param {number} x * @returns {number} */ -export const log10 = /* #__PURE__ */ Math.log10 || function log10 (x) { +export const log10 = Math.log10 || function log10 (x) { return Math.log(x) / Math.LN10 } @@ -57,7 +57,7 @@ export const log10 = /* #__PURE__ */ Math.log10 || function log10 (x) { * @param {number} x * @returns {number} */ -export const log1p = /* #__PURE__ */ Math.log1p || function (x) { +export const log1p = Math.log1p || function (x) { return Math.log(x + 1) } @@ -70,7 +70,7 @@ export const log1p = /* #__PURE__ */ Math.log1p || function (x) { * @param {number} x * @returns {number} Returns the cubic root of x */ -export const cbrt = /* #__PURE__ */ Math.cbrt || function cbrt (x) { +export const cbrt = Math.cbrt || function cbrt (x) { if (x === 0) { return x } @@ -97,7 +97,7 @@ export const cbrt = /* #__PURE__ */ Math.cbrt || function cbrt (x) { * @param {number} x * @return {number} res */ -export const expm1 = /* #__PURE__ */ Math.expm1 || function expm1 (x) { +export const expm1 = Math.expm1 || function expm1 (x) { return (x >= 2e-4 || x <= -2e-4) ? Math.exp(x) - 1 : x + x * x / 2 + x * x * x / 6