mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
Replace CSL validator with reproducible WASM build (#5525)
This commit is contained in:
parent
cd82ab7c59
commit
afc02141ce
6 changed files with 20 additions and 1666 deletions
|
|
@ -35,7 +35,7 @@ Zotero.Styles = new function () {
|
|||
"csl":"http://purl.org/net/xbiblio/csl"
|
||||
};
|
||||
|
||||
this.CSL_VALIDATOR_URL = "resource://zotero/csl-validator.js";
|
||||
this.CSL_VALIDATOR_URL = "resource://zotero/csl-validator-wasm/worker.mjs";
|
||||
|
||||
this._memoryPressureObserver = {
|
||||
observe: (subject, topic) => {
|
||||
|
|
@ -261,18 +261,20 @@ Zotero.Styles = new function () {
|
|||
* with the validation error if validation fails, or resolved if it is not.
|
||||
*/
|
||||
this.validate = function (style) {
|
||||
return new Zotero.Promise((resolve, reject) => {
|
||||
let worker = new Worker(this.CSL_VALIDATOR_URL);
|
||||
return new Promise((resolve, reject) => {
|
||||
let worker = new Worker(this.CSL_VALIDATOR_URL, { type: 'module' });
|
||||
worker.onmessage = function (event) {
|
||||
if (event.data) {
|
||||
reject(event.data);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
resolve();
|
||||
}
|
||||
worker.terminate();
|
||||
};
|
||||
worker.postMessage(style);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Installs a style file, getting the contents of an nsIFile and showing appropriate
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ export default [
|
|||
"resource/bluebird/*",
|
||||
"resource/classnames.js",
|
||||
"resource/citeproc_rs*",
|
||||
"resource/csl-validator.js",
|
||||
"resource/jspath.js",
|
||||
"resource/loader.mjs",
|
||||
"resource/pako.js",
|
||||
|
|
|
|||
11
package-lock.json
generated
11
package-lock.json
generated
|
|
@ -11,6 +11,7 @@
|
|||
"@citeproc-rs/wasm": "^0.2.0",
|
||||
"ace-builds": "^1.4.12",
|
||||
"classnames": "^2.2.6",
|
||||
"csl-validator-wasm": "^1.0.0",
|
||||
"monaco-editor": "^0.47.0",
|
||||
"monacopilot": "^1.1.15",
|
||||
"prop-types": "^15.8.0",
|
||||
|
|
@ -2808,6 +2809,11 @@
|
|||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/csl-validator-wasm": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/csl-validator-wasm/-/csl-validator-wasm-1.0.0.tgz",
|
||||
"integrity": "sha512-UcWQBj6cH1aUe7HGLxn2Y+DCNppyu/oznD08iIBhvGB4r1y/ziQkyfuC7eXJaumvzpP/tvIRW7WqSu6RFss/GQ=="
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.4.tgz",
|
||||
|
|
@ -11019,6 +11025,11 @@
|
|||
"randomfill": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"csl-validator-wasm": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/csl-validator-wasm/-/csl-validator-wasm-1.0.0.tgz",
|
||||
"integrity": "sha512-UcWQBj6cH1aUe7HGLxn2Y+DCNppyu/oznD08iIBhvGB4r1y/ziQkyfuC7eXJaumvzpP/tvIRW7WqSu6RFss/GQ=="
|
||||
},
|
||||
"csstype": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.4.tgz",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
"@citeproc-rs/wasm": "^0.2.0",
|
||||
"ace-builds": "^1.4.12",
|
||||
"classnames": "^2.2.6",
|
||||
"csl-validator-wasm": "^1.0.0",
|
||||
"monaco-editor": "^0.47.0",
|
||||
"monacopilot": "^1.1.15",
|
||||
"prop-types": "^15.8.0",
|
||||
|
|
|
|||
1
resource/csl-validator-wasm
Symbolic link
1
resource/csl-validator-wasm
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../node_modules/csl-validator-wasm
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue