Skip to content

Commit 856bbe7

Browse files
authored
Merge pull request #1285 from mathjax/update/workers
Update weborker code to work with te CDN
2 parents 62226e2 + 8448689 commit 856bbe7

23 files changed

+256
-822
lines changed

components/mjs/a11y/speech/speech.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ import {SpeechHandler} from '#js/a11y/speech.js';
77

88
if (MathJax.loader) {
99
let path = Package.resolvePath('[sre]', false);
10-
if (!hasWindow) {
10+
let maps = Package.resolvePath('[mathmaps]', false);
11+
if (hasWindow) {
12+
path = new URL(path, location).href;
13+
maps = new URL(maps, location).href;
14+
} else {
1115
const REQUIRE = typeof require !== 'undefined' ? require : MathJax.config.loader.require;
1216
if (REQUIRE?.resolve) {
13-
const pool = MathJax.config.options?.worker?.pool || 'speech-workerpool.js';
14-
path = path.replace(/\/bundle\/sre$/, '/cjs/a11y/sre');
15-
path = REQUIRE.resolve(`${path}/${pool}`).replace(/\/[^\/]*$/, '');
17+
path = REQUIRE.resolve(`${path}/package.json`).replace(/\/[^\/]*$/, '');
18+
maps = REQUIRE.resolve(`${maps}/base.json`).replace(/\/[^\/]*$/, '');
1619
} else {
17-
path = '';
20+
path = maps = '';
1821
}
1922
}
2023
if (path) {
21-
combineDefaults(MathJax.config, 'options', { worker: { path } });
24+
combineDefaults(MathJax.config, 'options', { worker: { path, maps } });
2225
}
2326
}
2427

components/mjs/a11y/sre/workerpool/config.json

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

components/mjs/a11y/sre/workerpool/speech-workerpool.js

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

components/mjs/a11y/sre/workerpool/webpack.cjs

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

components/mjs/dependencies.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export const dependencies = {
6767
export const paths = {
6868
tex: '[mathjax]/input/tex/extensions',
6969
mml: '[mathjax]/input/mml/extensions',
70-
sre: '[mathjax]/sre'
70+
sre: '[mathjax]/sre',
71+
mathmaps: '[sre]/mathmaps',
7172
};
7273

7374
export const provides = {

components/mjs/source.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export const source = {
7575
'a11y/complexity': `${src}/a11y/complexity/complexity.js`,
7676
'a11y/explorer': `${src}/a11y/explorer/explorer.js`,
7777
'a11y/sre': `${src}/a11y/sre/sre.js`,
78+
'[mathmaps]': `${src}/../../bundle/sre/mathmaps`,
7879
'ui/lazy': `${src}/ui/lazy/lazy.js`,
7980
'ui/menu': `${src}/ui/menu/menu.js`,
8081
'ui/safe': `${src}/ui/safe/safe.js`,

lab/build/init.js

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

lab/build/sre.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
import './init.js';
21
export * from '#js/a11y/sre/sre.js';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,6 @@
170170
"@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.6"
173+
"speech-rule-engine": "5.0.0-alpha.7"
174174
}
175175
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)