Skip to content

Commit 62226e2

Browse files
authored
Merge pull request #1284 from mathjax/fix/sre-root
Fix problem with sre-root
2 parents ef47836 + f7d8f6f commit 62226e2

File tree

11 files changed

+40
-50
lines changed

11 files changed

+40
-50
lines changed

components/mjs/a11y/speech/speech.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import {SpeechHandler} from '#js/a11y/speech.js';
88
if (MathJax.loader) {
99
let path = Package.resolvePath('[sre]', false);
1010
if (!hasWindow) {
11-
if (MathJax.config.loader.require?.resolve) {
12-
const require = MathJax.config.loader.require;
11+
const REQUIRE = typeof require !== 'undefined' ? require : MathJax.config.loader.require;
12+
if (REQUIRE?.resolve) {
1313
const pool = MathJax.config.options?.worker?.pool || 'speech-workerpool.js';
1414
path = path.replace(/\/bundle\/sre$/, '/cjs/a11y/sre');
15-
path = require.resolve(`${path}/${pool}`).replace(/\/[^\/]*$/, '');
15+
path = REQUIRE.resolve(`${path}/${pool}`).replace(/\/[^\/]*$/, '');
1616
} else {
1717
path = '';
1818
}

components/mjs/a11y/sre/sre.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import './lib/sre.js';
2-
import './sre_config.js';
32
import * as Sre from '#js/a11y/sre.js';
43

54
export {Sre};

components/mjs/a11y/sre/sre_config.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

components/sre-pack.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//
2+
// Replacement for __dirname for sre-root directory
3+
//
4+
5+
import { mjxRoot } from '@mathjax/src/components/root-pack.js';
6+
7+
export const sreRoot = () => mjxRoot() + '/sre';

components/webpack.common.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ const PLUGINS = function (js, dir, target, font, jax, name) {
6262
/mjs\/components\/mjs\/root\.js/,
6363
'../../../components/root-pack.js'
6464
),
65+
new webpack.NormalModuleReplacementPlugin(
66+
/mjs\/components\/mjs\/sre-root\.js/,
67+
'../../../components/sre-pack.js'
68+
),
6569
new webpack.NormalModuleReplacementPlugin(
6670
/mathjax-full\/js\//,
6771
function (resource) {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mathjax/src",
3-
"version": "4.0.0-rc.1",
3+
"version": "4.0.0-rc.2",
44
"description": "Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers and in server-side node applications. This package includes the source code as well as the packaged components.",
55
"keywords": [
66
"MathJax",
@@ -167,9 +167,9 @@
167167
]
168168
},
169169
"dependencies": {
170-
"@mathjax/mathjax-newcm-font": "4.0.0-rc.1",
170+
"@mathjax/mathjax-newcm-font": "4.0.0-rc.2",
171171
"mhchemparser": "^4.2.1",
172172
"mj-context-menu": "^0.9.1",
173-
"speech-rule-engine": "5.0.0-alpha.5"
173+
"speech-rule-engine": "5.0.0-alpha.6"
174174
}
175175
}

pnpm-lock.yaml

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/components/cjs/root.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ declare const __dirname: string;
3030
* @return {string} The MathJax component root directory
3131
*/
3232
export function mjxRoot(): string {
33-
return __dirname.replace(/[cm]js\/components\/[cm]js$/, (_) => 'bundle');
33+
return __dirname.replace(/[cm]js\/components\/[cm]js$/, 'bundle');
3434
}

ts/components/cjs/sre-root.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
declare const __dirname: string;
2828

2929
/**
30-
* @return {string} The MathJax component root directory
30+
* @return {string} The MathJax mjs SRE root directory
3131
*/
3232
export function sreRoot(): string {
3333
return __dirname.replace(/components\/[cm]js$/, 'a11y/sre');

ts/components/mjs/root.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
export function mjxRoot(): string {
2828
return new URL(import.meta.url).pathname.replace(
2929
/[cm]js\/components\/[cm]js\/root.js$/,
30-
(_) => 'bundle'
30+
'bundle'
3131
);
3232
}

0 commit comments

Comments
 (0)