Skip to content

Commit c458695

Browse files
committed
Merge branch 'develop' into refactor/mappings
2 parents e457ce3 + cc65cef commit c458695

File tree

98 files changed

+4859
-3332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4859
-3332
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
*~
2-
/node_modules
2+
node_modules
3+
coverage
34
/components/mjs/**/lib
45
/components/cjs
56
/cjs
67
/mjs
78
/bundle
89
/bundle-cjs
9-
/coverage
10+
/testsuite/js
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
import {combineDefaults} from '#js/components/global.js';
22

33
export function fontExtension(id, name, pkg = `@mathjax/${name}`) {
4-
if (MathJax.config?.loader) {
5-
const FONTPATH = (typeof document === 'undefined' ? pkg :
6-
`https://cdn.jsdelivr.net/npm/${name}`);
4+
if (MathJax.loader) {
5+
const FONTPATH = (typeof document === 'undefined' ? pkg : `https://cdn.jsdelivr.net/npm/${name}`);
76
const path = name.replace(/-font-extension$/, '-extension');
87
const extension = name.replace(/-font-extension$/, '');
8+
const jax = (MathJax.config?.startup?.output || 'chtml');
99
combineDefaults(MathJax.config.loader, 'paths', {[path]: FONTPATH});
10-
combineDefaults(MathJax.config.loader, 'dependencies', {
11-
[`[${path}]/chtml`]: ['output/chtml'],
12-
[`[${path}]/svg`]: ['output/svg']
10+
combineDefaults(MathJax.config.loader, 'dependencies', {[`[${path}]/${jax}`]: [`output/${jax}`]});
11+
MathJax.loader.addPackageData(id, {
12+
extraLoads: [`[${path}]/${jax}`],
13+
rendererExtensions: [path]
1314
});
14-
MathJax.config.loader[id] = {
15-
checkReady() {
16-
return MathJax.loader.load(
17-
`[${path}]/${MathJax.config?.startup?.output || 'chtml'}`
18-
).then(() => {
19-
MathJax.startup.document?.outputJax?.addExtension(extension);
20-
});
21-
}
22-
};
2315
}
2416
}

components/mjs/output/chtml/config.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"output/chtml.ts",
66
"output/chtml",
77
"output/common"
8-
],
9-
"exclude": [
10-
"output/chtml/ts5",
11-
"output/chtml/ts6"
128
]
139
},
1410
"webpack": {

components/mjs/output/chtml/nofont.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ export class DefaultFont extends ChtmlFontData {};
44
export const fontName = 'nofont';
55

66
DefaultFont.OPTIONS = {fontURL: '.'};
7+
8+
export const Font = {fontName, DefaultFont};

components/mjs/output/svg/config.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
"output/svg.ts",
66
"output/svg",
77
"output/common"
8-
],
9-
"exclude": [
10-
"output/svg/ts5",
11-
"output/svg/ts6"
128
]
139
},
1410
"webpack": {

components/mjs/output/svg/nofont.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ import {SvgFontData} from '#js/output/svg/FontData.js';
22

33
export class DefaultFont extends SvgFontData {};
44
export const fontName = 'nofont';
5+
6+
export const Font = {fontName, DefaultFont};

components/mjs/output/util.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ export const OutputUtil = {
3131

3232
if (name !== defaultFont) {
3333

34-
combineDefaults(MathJax.config.loader, `output/${jax}`, {
35-
checkReady() {
36-
return MathJax.loader.load(`${font}/${jax}`).catch(err => console.log(err));
37-
}
38-
});
34+
MathJax.loader.addPackageData(`output/${jax}`, {extraLoads: [`${font}/${jax}`]});
3935

4036
} else {
4137

38+
const extraLoads = MathJax.config.loader[`${font}/${jax}`]?.extraLoads;
39+
if (extraLoads) {
40+
MathJax.loader.addPackageData(`output/${jax}`, {extraLoads});
41+
}
42+
4243
combineWithMathJax({_: {
4344
output: {
4445
fonts: {
@@ -78,14 +79,12 @@ export const OutputUtil = {
7879

7980
loadFont(startup, jax, font, preload) {
8081
if (!MathJax.loader) {
81-
return Promise.resolve();
82+
return startup;
8283
}
8384
if (preload) {
8485
MathJax.loader.preLoad(`[${font}]/${jax}`);
8586
}
86-
const check = MathJax.config.loader[`output/${jax}`];
87-
const start = (check && check.checkReady ? check.checkReady().then(startup) : startup());
88-
return start.catch(err => console.log(err));
87+
return Package.loadPromise(`output/${jax}`).then(startup);
8988
}
9089

9190
};

package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"use-cjs": "echo '{\n \"extends\": \"./tsconfig/cjs.json\"\n}' > tsconfig.json",
109109
"use-mjs": "echo '{\n \"extends\": \"./tsconfig/mjs.json\"\n}' > tsconfig.json",
110110
"=============================================================================== aliases": "",
111-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' pnpm jest",
111+
"test": "cd testsuite && pnpm -s test --",
112112
"clean": "pnpm -s clean:mod cjs && pnpm -s cjs:bundle:clean && pnpm -s clean:mod mjs && pnpm -s clean:dir bundle",
113113
"compile-cjs": "pnpm -s cjs:compile",
114114
"compile-mjs": "pnpm -s mjs:compile",
@@ -123,24 +123,17 @@
123123
"build-all": "pnpm -s build-mjs ; echo ; pnpm -s build-cjs"
124124
},
125125
"devDependencies": {
126-
"@jest/globals": "^29.7.0",
127-
"@types/jest": "^29.5.12",
128126
"copyfiles": "^2.4.1",
129127
"diff": "^5.2.0",
130-
"jest": "^29.7.0",
131128
"rimraf": "^5.0.5",
132-
"tape": "^5.7.5",
133129
"terser-webpack-plugin": "^5.3.10",
134-
"ts-jest": "^29.1.2",
135-
"ts-node": "^10.9.2",
136130
"tslint": "^6.1.3",
137131
"tslint-jsdoc-rules": "^0.2.0",
138132
"tslint-unix-formatter": "^0.2.0",
139133
"typescript": "^5.4.5",
140134
"typescript-tools": "^0.3.1",
141135
"webpack": "^5.91.0",
142136
"webpack-cli": "^5.1.4",
143-
"xml-js": "^1.6.11",
144137
"xslt3": "^2.6.0"
145138
},
146139
"dependencies": {

0 commit comments

Comments
 (0)