wikiparser-node 1.12.2-b → 1.12.3-b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  (() => {
2
+ const version = '1.12.3';
2
3
  const workerJS = () => {
3
- importScripts('https://testingcf.jsdelivr.net/npm/wikiparser-node@1.12.2-b/bundle/bundle.min.js');
4
+ importScripts(`https://testingcf.jsdelivr.net/npm/wikiparser-node@${version}-b/bundle/bundle.min.js`);
4
5
  const entities = { '&': 'amp', '<': 'lt', '>': 'gt' };
5
6
  self.onmessage = ({ data }) => {
6
7
  const [command, qid, wikitext, include, stage] = data;
@@ -15,7 +16,7 @@ const workerJS = () => {
15
16
  postMessage([qid, Parser.getConfig()]);
16
17
  break;
17
18
  case 'json':
18
- postMessage([qid, Parser.parse(wikitext, include).json()]);
19
+ postMessage([qid, Parser.parse(wikitext, include, stage).json()]);
19
20
  break;
20
21
  case 'lint':
21
22
  postMessage([qid, Parser.parse(wikitext, include).lint(), wikitext]);
@@ -34,7 +35,7 @@ const workerJS = () => {
34
35
  }
35
36
  };
36
37
  };
37
- const blob = new Blob([`(${String(workerJS)})()`], { type: 'text/javascript' }), url = URL.createObjectURL(blob), worker = new Worker(url);
38
+ const blob = new Blob([`(${String(workerJS).replace(`\${version}`, version)})()`], { type: 'text/javascript' }), url = URL.createObjectURL(blob), worker = new Worker(url);
38
39
  URL.revokeObjectURL(url);
39
40
  const getListener = (qid, resolve, raw) => {
40
41
  const listener = ({ data: [rid, res, resRaw] }) => {
@@ -56,7 +57,7 @@ const getFeedback = (command, qid, strict, raw, ...args) => new Promise(resolve
56
57
  worker.postMessage([command, qid, raw, ...args]);
57
58
  });
58
59
  const getConfig = () => getFeedback('getConfig', -3);
59
- const json = (wikitext, include, qid = -4) => getFeedback('json', qid, false, wikitext, include);
60
+ const json = (wikitext, include, qid = -4, stage) => getFeedback('json', qid, false, wikitext, include, stage);
60
61
  const print = (wikitext, include, stage, qid = -1) => getFeedback('print', qid, false, wikitext, include, stage);
61
62
  const lint = (wikitext, include, qid = -2) => getFeedback('lint', qid, true, wikitext, include);
62
63
  const append = (parent, text) => {
@@ -157,6 +158,6 @@ const lineNumbers = (html, start = 1, paddingTop = '') => {
157
158
  intersectionObserver.observe(html);
158
159
  }
159
160
  };
160
- const wikiparse = { id: 0, setI18N, setConfig, getConfig, print, lint, json, lineNumbers };
161
+ const wikiparse = { version, id: 0, setI18N, setConfig, getConfig, print, lint, json, lineNumbers };
161
162
  Object.assign(window, { wikiparse });
162
163
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wikiparser-node",
3
- "version": "1.12.2-b",
3
+ "version": "1.12.3-b",
4
4
  "description": "A Node.js parser for MediaWiki markup with AST",
5
5
  "keywords": [
6
6
  "mediawiki",