textbrowser 0.49.0 → 0.49.1
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.
- package/.babelrc.json +2 -7
- package/.ncurc.cjs +6 -0
- package/CHANGES.md +4 -0
- package/dist/WorkInfo-es.js +107 -143
- package/dist/activateCallback-es.js +1 -1
- package/dist/assets/index-D_XVedS3.css +9 -0
- package/dist/assets/languages-DWwAAJMo.json +67 -0
- package/dist/index-es.js +1538 -1454
- package/dist/index-es.min.js +4 -4
- package/eslint.config.js +69 -0
- package/package.json +22 -40
- package/resources/activateCallback.js +1 -1
- package/resources/index.js +1 -13
- package/resources/resultsDisplay.js +7 -3
- package/resources/templates/index.js +1 -1
- package/resources/templates/languageSelect.js +0 -1
- package/resources/templates/resultsDisplayServerOrClient.js +3 -2
- package/resources/templates/workDisplay.js +1 -1
- package/resources/templates/workSelect.js +3 -2
- package/resources/utils/Languages.js +0 -1
- package/resources/utils/Metadata.js +4 -3
- package/resources/utils/Params.js +0 -1
- package/resources/utils/Plugin.js +3 -4
- package/resources/utils/ServiceWorker.js +2 -1
- package/resources/utils/WorkInfo.js +2 -1
- package/resources/workDisplay.js +0 -1
- package/resources/workSelect.js +0 -1
- package/server/main.js +8 -6
- package/.eslintignore +0 -4
- package/.eslintrc.cjs +0 -108
- package/.ncurc.js +0 -8
package/eslint.config.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import ashNazg from 'eslint-config-ash-nazg';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
ignores: [
|
|
6
|
+
'resources/vendor',
|
|
7
|
+
'dist/**',
|
|
8
|
+
'!dist/sw-helper.js'
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
...ashNazg(['sauron', 'browser']),
|
|
12
|
+
{
|
|
13
|
+
files: ['resources/user-sample.js'],
|
|
14
|
+
rules: {
|
|
15
|
+
'n/no-missing-import': 0,
|
|
16
|
+
'import/no-unresolved': 0
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: ['sw-sample.js'],
|
|
21
|
+
rules: {
|
|
22
|
+
'import/no-unresolved': 0,
|
|
23
|
+
'import/unambiguous': 0,
|
|
24
|
+
strict: 0
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
files: ['test/index.html', 'test/textbrowserTests.js'],
|
|
29
|
+
languageOptions: {
|
|
30
|
+
globals: {
|
|
31
|
+
assert: false,
|
|
32
|
+
mocha: false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
'import/unambiguous': 0
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
settings: {
|
|
41
|
+
polyfills: [
|
|
42
|
+
'navigator.serviceWorker',
|
|
43
|
+
'Notification.requestPermission'
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
// Disable for now
|
|
48
|
+
'array-bracket-newline': 0,
|
|
49
|
+
'no-console': 0,
|
|
50
|
+
'require-unicode-regexp': 0,
|
|
51
|
+
'@stylistic/max-len': 0,
|
|
52
|
+
'no-shadow': 0,
|
|
53
|
+
'implicit-arrow-linebreak': 0,
|
|
54
|
+
'function-paren-newline': 0,
|
|
55
|
+
'class-methods-use-this': 0,
|
|
56
|
+
'callback-return': 0,
|
|
57
|
+
'multiline-ternary': 0,
|
|
58
|
+
'consistent-return': 0,
|
|
59
|
+
'arrow-parens': 0,
|
|
60
|
+
'require-await': 0,
|
|
61
|
+
'prefer-named-capture-group': 0,
|
|
62
|
+
'jsdoc/require-jsdoc': 0,
|
|
63
|
+
'promise/avoid-new': 0,
|
|
64
|
+
'promise/prefer-await-to-callbacks': 0,
|
|
65
|
+
'import/no-anonymous-default-export': 0,
|
|
66
|
+
'unicorn/no-array-callback-reference': 0
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textbrowser",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.1",
|
|
4
4
|
"description": "Multilinear text browser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index-es.min.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"textbrowser": "./server/main.js"
|
|
11
11
|
},
|
|
12
12
|
"browserslist": [
|
|
13
|
-
"
|
|
13
|
+
"defaults, not op_mini all"
|
|
14
14
|
],
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/bahaidev/textbrowser/issues"
|
|
@@ -30,59 +30,41 @@
|
|
|
30
30
|
"text"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/core": "^7.
|
|
33
|
+
"@babel/core": "^7.25.2",
|
|
34
34
|
"@brettz9/node-static": "^0.1.1",
|
|
35
|
-
"command-line-args": "^
|
|
35
|
+
"command-line-args": "^6.0.0",
|
|
36
36
|
"dom-parser": "^1.1.5",
|
|
37
37
|
"form-serialization": "^0.11.0",
|
|
38
|
-
"indexeddbshim": "^
|
|
39
|
-
"intl-dom": "^0.
|
|
38
|
+
"indexeddbshim": "^15.2.0",
|
|
39
|
+
"intl-dom": "^0.20.0",
|
|
40
40
|
"intl-locale-textinfo-polyfill": "^2.1.1",
|
|
41
|
-
"jamilih": "0.
|
|
42
|
-
"jsdom": "^
|
|
41
|
+
"jamilih": "0.60.0",
|
|
42
|
+
"jsdom": "^25.0.0",
|
|
43
43
|
"json-refs": "^3.0.15",
|
|
44
|
-
"load-stylesheets": "0.
|
|
45
|
-
"node-fetch": "^
|
|
44
|
+
"load-stylesheets": "0.12.5",
|
|
45
|
+
"node-fetch": "^3.3.2",
|
|
46
46
|
"simple-get-json": "^9.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/eslint-parser": "^7.23.3",
|
|
50
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.20.2",
|
|
51
49
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
52
|
-
"@babel/preset-env": "^7.
|
|
53
|
-
"@brettz9/eslint-plugin": "^1.0.4",
|
|
50
|
+
"@babel/preset-env": "^7.25.4",
|
|
54
51
|
"@rollup/plugin-babel": "^6.0.4",
|
|
55
|
-
"@rollup/plugin-commonjs": "^
|
|
56
|
-
"@rollup/plugin-json": "^6.0
|
|
52
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
53
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
57
54
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
58
55
|
"@rollup/plugin-terser": "^0.4.4",
|
|
59
56
|
"@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
|
|
60
|
-
"@web/rollup-plugin-import-meta-assets": "^2.2.
|
|
61
|
-
"ajv": "8.
|
|
57
|
+
"@web/rollup-plugin-import-meta-assets": "^2.2.1",
|
|
58
|
+
"ajv": "8.17.1",
|
|
62
59
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
63
|
-
"chai": "^
|
|
64
|
-
"eslint": "^
|
|
65
|
-
"eslint-config-ash-nazg": "^
|
|
66
|
-
"eslint-config-standard": "^17.1.0",
|
|
67
|
-
"eslint-plugin-array-func": "^4.0.0",
|
|
68
|
-
"eslint-plugin-compat": "^4.2.0",
|
|
69
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
70
|
-
"eslint-plugin-html": "^7.1.0",
|
|
71
|
-
"eslint-plugin-import": "^2.29.0",
|
|
72
|
-
"eslint-plugin-jsdoc": "^46.9.0",
|
|
73
|
-
"eslint-plugin-markdown": "^3.0.1",
|
|
74
|
-
"eslint-plugin-n": "^16.3.1",
|
|
75
|
-
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
76
|
-
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
|
77
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
78
|
-
"eslint-plugin-sonarjs": "^0.23.0",
|
|
79
|
-
"eslint-plugin-standard": "^4.1.0",
|
|
80
|
-
"eslint-plugin-unicorn": "^49.0.0",
|
|
60
|
+
"chai": "^5.1.1",
|
|
61
|
+
"eslint": "^9.10.0",
|
|
62
|
+
"eslint-config-ash-nazg": "^36.17.0",
|
|
81
63
|
"json-metaschema": "1.3.0",
|
|
82
|
-
"mocha": "^10.
|
|
64
|
+
"mocha": "^10.7.3",
|
|
83
65
|
"npm-run-all": "^4.1.5",
|
|
84
|
-
"open-cli": "^
|
|
85
|
-
"rollup": "^4.
|
|
66
|
+
"open-cli": "^8.0.0",
|
|
67
|
+
"rollup": "^4.22.0",
|
|
86
68
|
"rollup-plugin-re": "^1.0.7",
|
|
87
69
|
"textbrowser-data-schemas": "^0.2.0"
|
|
88
70
|
},
|
|
@@ -91,7 +73,7 @@
|
|
|
91
73
|
"start": "static -p 8081",
|
|
92
74
|
"rollup": "rollup -c",
|
|
93
75
|
"lint": "npm run eslint",
|
|
94
|
-
"eslint": "eslint
|
|
76
|
+
"eslint": "eslint .",
|
|
95
77
|
"mocha": "mocha --require test/bootstrap/node.js --require chai/register-assert.js test/textbrowserTests.js",
|
|
96
78
|
"node": "npm run eslint && npm run rollup && npm run mocha",
|
|
97
79
|
"open-test": "open-cli http://127.0.0.1:8081/test/",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file Note that this should be kept as a polyglot client-server file
|
|
3
3
|
* (besides the server, it is to be invoked by the project service worker).
|
|
4
4
|
*/
|
|
5
|
-
/* eslint-env worker */
|
|
5
|
+
/* eslint-env worker -- Worker environment */
|
|
6
6
|
|
|
7
7
|
const {ceil} = Math;
|
|
8
8
|
const arrayChunk = (arr, size) => {
|
package/resources/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
|
|
3
1
|
import {getJSON} from 'simple-get-json';
|
|
4
2
|
import {i18n} from 'intl-dom';
|
|
5
3
|
import loadStylesheets from 'load-stylesheets';
|
|
@@ -22,15 +20,6 @@ import workSelect from './workSelect.js';
|
|
|
22
20
|
import workDisplay from './workDisplay.js';
|
|
23
21
|
import {resultsDisplayClient} from './resultsDisplay.js';
|
|
24
22
|
|
|
25
|
-
/* eslint-disable no-unused-vars, @stylistic/brace-style */
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param {null|number|string|PlainObject|GenericArray} obj
|
|
29
|
-
* @returns {void}
|
|
30
|
-
*/
|
|
31
|
-
function s (obj) { dialogs.alert(JSON.stringify(obj)); } // lgtm [js/unused-local-variable]
|
|
32
|
-
/* eslint-enable no-unused-vars, @stylistic/brace-style */
|
|
33
|
-
|
|
34
23
|
/**
|
|
35
24
|
*
|
|
36
25
|
* @returns {Promise<void>}
|
|
@@ -138,7 +127,7 @@ async function requestPermissions (langs, l) {
|
|
|
138
127
|
// rememberRefusal();
|
|
139
128
|
resolve();
|
|
140
129
|
return;
|
|
141
|
-
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
|
130
|
+
// eslint-disable-next-line sonarjs/no-duplicated-branches -- Ease of maintenance
|
|
142
131
|
case 'default':
|
|
143
132
|
resolve();
|
|
144
133
|
return;
|
|
@@ -269,7 +258,6 @@ class TextBrowser {
|
|
|
269
258
|
const url = location.href.replace(/#.*$/, '') + '#' + $p.toString();
|
|
270
259
|
history.replaceState(formSerialize(form, {hash: true, empty: true}), document.title, url);
|
|
271
260
|
// Get and set new state within URL
|
|
272
|
-
// eslint-disable-next-line n/callback-return
|
|
273
261
|
cb();
|
|
274
262
|
location.hash = '#' + $p.toString();
|
|
275
263
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
1
|
import Locale from 'intl-locale-textinfo-polyfill';
|
|
3
2
|
import JsonRefs from 'json-refs';
|
|
4
3
|
import {jml} from 'jamilih';
|
|
@@ -42,6 +41,7 @@ const setAnchor = ({
|
|
|
42
41
|
if (!anchor) {
|
|
43
42
|
const anchors = [];
|
|
44
43
|
let anchorField = '';
|
|
44
|
+
// eslint-disable-next-line sonarjs/misplaced-loop-counter -- Ok
|
|
45
45
|
for (let i = 1, breakout; !breakout && !anchors.length; i++) {
|
|
46
46
|
for (let j = 1; ; j++) {
|
|
47
47
|
const anchorText = work + '-' + 'anchor' + i + '-' + j;
|
|
@@ -65,7 +65,9 @@ const setAnchor = ({
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if (anchors.length) {
|
|
68
|
-
const escapeSelectorAttValue = (str) => (str || '').replaceAll(
|
|
68
|
+
const escapeSelectorAttValue = (str) => (str || '').replaceAll(
|
|
69
|
+
/["\\]/g, String.raw`\$&`
|
|
70
|
+
);
|
|
69
71
|
const escapedRow = escapeSelectorAttValue(anchors.join('-'));
|
|
70
72
|
const escapedCol = anchorField
|
|
71
73
|
? escapeSelectorAttValue(anchorField)
|
|
@@ -428,7 +430,9 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
|
|
|
428
430
|
const $pEscArbitrary = (param) => escapeHTML($p.get(param, true));
|
|
429
431
|
|
|
430
432
|
// Not currently in use
|
|
431
|
-
const escapeQuotedCSS = (s) => s.replaceAll('\\', '\\\\').replaceAll(
|
|
433
|
+
const escapeQuotedCSS = (s) => s.replaceAll('\\', '\\\\').replaceAll(
|
|
434
|
+
'"', String.raw`\"`
|
|
435
|
+
);
|
|
432
436
|
|
|
433
437
|
const {
|
|
434
438
|
fileData, workI18n, getFieldAliasOrName, schemaObj, metadataObj,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
1
|
import {jml, $, body} from 'jamilih';
|
|
3
2
|
|
|
4
3
|
import languageSelect from './languageSelect.js';
|
|
@@ -33,6 +32,7 @@ const Templates = {
|
|
|
33
32
|
installationDialog.showModal();
|
|
34
33
|
const container = $('#dialogContainer');
|
|
35
34
|
container.hidden = false;
|
|
35
|
+
// eslint-disable-next-line no-unused-vars -- Ok
|
|
36
36
|
} catch (err) {
|
|
37
37
|
// May already be open
|
|
38
38
|
}
|
|
@@ -135,9 +135,9 @@ div.inner-caption {
|
|
|
135
135
|
letter-spacing: ${$pEscArbitrary('letterspacing')};
|
|
136
136
|
line-height: ${$pEscArbitrary('lineheight')};
|
|
137
137
|
${colorEsc ? `color: ${escapeCSS(colorEsc)};` : ''
|
|
138
|
-
}
|
|
138
|
+
}
|
|
139
139
|
${bgcolorEsc ? `background-color: ${escapeCSS(bgcolorEsc)};` : ''
|
|
140
|
-
}
|
|
140
|
+
}
|
|
141
141
|
}
|
|
142
142
|
${escapeCSS($pEscArbitrary('pagecss') || '')}
|
|
143
143
|
` +
|
|
@@ -248,6 +248,7 @@ body {
|
|
|
248
248
|
};
|
|
249
249
|
|
|
250
250
|
const addChildren = (el, children) => {
|
|
251
|
+
// eslint-disable-next-line unicorn/prefer-structured-clone -- Need JSON
|
|
251
252
|
el = JSON.parse(JSON.stringify(el));
|
|
252
253
|
el.push(children);
|
|
253
254
|
return el;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
1
|
import {jml, $, $$, nbsp} from 'jamilih';
|
|
3
2
|
import Templates from './index.js';
|
|
4
3
|
import {colors, fonts} from './utils/html.js';
|
|
@@ -898,6 +897,7 @@ export default {
|
|
|
898
897
|
const url = replaceHash(paramsCopy) + `&work=${work}&${work}-startEnd1=%s`; // %s will be escaped if set as param; also add changeable workName here
|
|
899
898
|
try {
|
|
900
899
|
await navigator.clipboard.writeText(url);
|
|
900
|
+
// eslint-disable-next-line no-unused-vars -- Okay to ignore
|
|
901
901
|
} catch (err) {
|
|
902
902
|
// User rejected
|
|
903
903
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
1
|
import {jml, $} from 'jamilih';
|
|
3
2
|
import {deserialize as formDeserialize} from 'form-serialization';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
const workSelect = function ({groups, workI18n, getNextAlias, $p, followParams}) {
|
|
6
5
|
const form = jml(
|
|
7
6
|
'form',
|
|
8
7
|
{id: 'workSelect', class: 'focus', $on: {
|
|
@@ -55,3 +54,5 @@ export default ({groups, workI18n, getNextAlias, $p, followParams}) => {
|
|
|
55
54
|
}
|
|
56
55
|
return form;
|
|
57
56
|
};
|
|
57
|
+
|
|
58
|
+
export default workSelect;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
1
|
import {getPreferredLanguages} from './Languages.js';
|
|
3
2
|
// Keep this as the last import for Rollup
|
|
4
|
-
import JsonRefs from 'json-refs'; // eslint-disable-line import/order
|
|
3
|
+
import JsonRefs from 'json-refs'; // // eslint-disable-line import/order
|
|
5
4
|
|
|
6
5
|
const getCurrDir = () => {
|
|
7
6
|
return window.location.href.replace(/(index\.html)?#.*$/, '');
|
|
@@ -90,6 +89,7 @@ export const getFieldNameAndValueAliases = function ({
|
|
|
90
89
|
true
|
|
91
90
|
);
|
|
92
91
|
}
|
|
92
|
+
// eslint-disable-next-line unicorn/prefer-structured-clone -- Expecting JSON
|
|
93
93
|
ret.rawFieldValueAliasMap = JSON.parse(JSON.stringify(fieldValueAliasMap));
|
|
94
94
|
ret.aliases = [];
|
|
95
95
|
// Todo: We could use `prefer_alias` but algorithm below may cover
|
|
@@ -130,6 +130,7 @@ export const getFieldNameAndValueAliases = function ({
|
|
|
130
130
|
);
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
+
// eslint-disable-next-line unicorn/prefer-structured-clone -- Expecting JSON
|
|
133
134
|
ret.fieldValueAliasMap = JSON.parse(JSON.stringify(fieldValueAliasMap));
|
|
134
135
|
// ret.aliases.sort();
|
|
135
136
|
}
|
|
@@ -160,7 +161,7 @@ export const getBrowseFieldData = function ({
|
|
|
160
161
|
getFieldAliasOrName
|
|
161
162
|
});
|
|
162
163
|
});
|
|
163
|
-
callback({setName, browseFields, i, presort});
|
|
164
|
+
callback({setName, browseFields, i, presort});
|
|
164
165
|
});
|
|
165
166
|
};
|
|
166
167
|
|
|
@@ -51,7 +51,7 @@ export class PluginsForWork {
|
|
|
51
51
|
onByDefault: onByDefaultDefault, lang: pluginLang, meta
|
|
52
52
|
}] = this.pluginsInWork[i];
|
|
53
53
|
const plugin = this.getPluginObject(pluginName);
|
|
54
|
-
cb({
|
|
54
|
+
cb({
|
|
55
55
|
plugin,
|
|
56
56
|
placement,
|
|
57
57
|
applicableFields,
|
|
@@ -71,11 +71,10 @@ export class PluginsForWork {
|
|
|
71
71
|
}]) => {
|
|
72
72
|
if (Array.isArray(targetLanguage)) {
|
|
73
73
|
targetLanguage.forEach((targetLanguage) => {
|
|
74
|
-
cb({applicableField, targetLanguage, onByDefault, metaApplicableField});
|
|
74
|
+
cb({applicableField, targetLanguage, onByDefault, metaApplicableField});
|
|
75
75
|
});
|
|
76
76
|
} else {
|
|
77
|
-
|
|
78
|
-
cb({applicableField, targetLanguage, onByDefault, metaApplicableField}); // eslint-disable-line n/no-callback-literal
|
|
77
|
+
cb({applicableField, targetLanguage, onByDefault, metaApplicableField});
|
|
79
78
|
}
|
|
80
79
|
});
|
|
81
80
|
return true;
|
|
@@ -103,7 +103,7 @@ export const respondToState = async ({
|
|
|
103
103
|
// We use this promise for rejecting (inside a listener)
|
|
104
104
|
// to a common catch and to prevent continuation by
|
|
105
105
|
// failing to return
|
|
106
|
-
return new Promise(async () => { // eslint-disable-line no-async-promise-executor
|
|
106
|
+
return new Promise(async () => { // eslint-disable-line no-async-promise-executor, sonarjs/no-misused-promises -- See above
|
|
107
107
|
navigator.serviceWorker.addEventListener('message', ({data}) => {
|
|
108
108
|
const {message, type, name, errorType} = data;
|
|
109
109
|
console.log('msg1', message, r);
|
|
@@ -263,6 +263,7 @@ export const registerServiceWorker = async ({
|
|
|
263
263
|
type: 'module'
|
|
264
264
|
}
|
|
265
265
|
);
|
|
266
|
+
// eslint-disable-next-line no-unused-vars -- Ok
|
|
266
267
|
} catch (err) {
|
|
267
268
|
console.log('serviceWorkerPath', serviceWorkerPath);
|
|
268
269
|
await dialogs.alert(`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* globals process -- Node polyglot */
|
|
1
2
|
import {getJSON} from 'simple-get-json';
|
|
2
3
|
import {i18n} from 'intl-dom';
|
|
3
4
|
import {getMetaProp, getMetadata, Metadata} from './Metadata.js';
|
|
@@ -152,7 +153,7 @@ export const getWorkData = async function ({
|
|
|
152
153
|
getPlugins
|
|
153
154
|
? Promise.all(
|
|
154
155
|
pluginPaths.map((pluginPath) => {
|
|
155
|
-
// eslint-disable-next-line no-unsanitized/method
|
|
156
|
+
// // eslint-disable-next-line no-unsanitized/method
|
|
156
157
|
return import(
|
|
157
158
|
cwd +
|
|
158
159
|
pluginPath
|
package/resources/workDisplay.js
CHANGED
package/resources/workSelect.js
CHANGED
package/server/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
/* eslint-env node */
|
|
3
|
+
/* eslint-env node -- Environment here */
|
|
4
4
|
import http from 'http';
|
|
5
5
|
|
|
6
6
|
import statik from '@brettz9/node-static';
|
|
@@ -100,8 +100,11 @@ setGlobalVars(null, {
|
|
|
100
100
|
}); // Adds `indexedDB` and `IDBKeyRange` to global in Node
|
|
101
101
|
|
|
102
102
|
if (userParams.nodeActivate) {
|
|
103
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- node-fetch
|
|
103
104
|
global.fetch = fetch;
|
|
104
|
-
|
|
105
|
+
setTimeout(async () => {
|
|
106
|
+
await activateCallback({...userParamsWithDefaults, basePath});
|
|
107
|
+
});
|
|
105
108
|
console.log('Activated');
|
|
106
109
|
}
|
|
107
110
|
console.log('past activate check');
|
|
@@ -131,7 +134,6 @@ const srv = http.createServer(async (req, res) => {
|
|
|
131
134
|
* @returns {Promise<void>}
|
|
132
135
|
*/
|
|
133
136
|
const runHttpServer = async function () {
|
|
134
|
-
// eslint-disable-next-line no-unsanitized/method -- Site-specified plugin
|
|
135
137
|
const server = (await import(userParams.httpServer)).default();
|
|
136
138
|
return await server(
|
|
137
139
|
req,
|
|
@@ -146,13 +148,12 @@ const srv = http.createServer(async (req, res) => {
|
|
|
146
148
|
);
|
|
147
149
|
};
|
|
148
150
|
if (userParams.expressServer) {
|
|
149
|
-
// eslint-disable-next-line no-unsanitized/method -- Site-specified plugin
|
|
150
151
|
const app = (await import(userParams.expressServer)).default();
|
|
151
152
|
|
|
152
153
|
if (userParams.httpServer && (!app._router || !app._router.stack.some(({regexp}) => {
|
|
153
154
|
// Hack to ignore middleware like jsonParser (and hopefully
|
|
154
155
|
// not get any other)
|
|
155
|
-
return regexp.source !==
|
|
156
|
+
return regexp.source !== String.raw`^\/?(?=\\/|$)` && regexp.test(req.url);
|
|
156
157
|
}))) {
|
|
157
158
|
await runHttpServer();
|
|
158
159
|
|
|
@@ -182,7 +183,8 @@ const srv = http.createServer(async (req, res) => {
|
|
|
182
183
|
*/
|
|
183
184
|
return;
|
|
184
185
|
}
|
|
185
|
-
const languages = (req.headers['accept-language']?.replace(/;q
|
|
186
|
+
const languages = (req.headers['accept-language']?.replace(/;q=.*$/, '') ?? 'en-US').split(',');
|
|
187
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- Polyglot reasons
|
|
186
188
|
global.navigator = {
|
|
187
189
|
language: languages[0],
|
|
188
190
|
languages
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: ['ash-nazg/sauron-node-overrides'],
|
|
5
|
-
parser: '@babel/eslint-parser',
|
|
6
|
-
parserOptions: {
|
|
7
|
-
requireConfigFile: false
|
|
8
|
-
},
|
|
9
|
-
settings: {
|
|
10
|
-
jsdoc: {
|
|
11
|
-
mode: 'typescript'
|
|
12
|
-
},
|
|
13
|
-
polyfills: [
|
|
14
|
-
'Array.isArray',
|
|
15
|
-
'Blob',
|
|
16
|
-
'caches',
|
|
17
|
-
'console',
|
|
18
|
-
'Date.now',
|
|
19
|
-
'document.dir',
|
|
20
|
-
'document.querySelector',
|
|
21
|
-
'document.querySelectorAll',
|
|
22
|
-
'document.title',
|
|
23
|
-
'DOMParser',
|
|
24
|
-
'Error',
|
|
25
|
-
'fetch',
|
|
26
|
-
'history',
|
|
27
|
-
'history.replaceState',
|
|
28
|
-
'IDBKeyRange',
|
|
29
|
-
'indexedDB',
|
|
30
|
-
'JSON',
|
|
31
|
-
'location.hash',
|
|
32
|
-
'location.href',
|
|
33
|
-
'location.host',
|
|
34
|
-
'location.protocol',
|
|
35
|
-
'navigator',
|
|
36
|
-
'navigator.clipboard',
|
|
37
|
-
'navigator.serviceWorker',
|
|
38
|
-
'Notification.requestPermission',
|
|
39
|
-
'Number.isNaN',
|
|
40
|
-
'Number.parseInt',
|
|
41
|
-
'Object.entries',
|
|
42
|
-
'Object.keys',
|
|
43
|
-
'Object.values',
|
|
44
|
-
'Promise',
|
|
45
|
-
'Request',
|
|
46
|
-
'ServiceWorker',
|
|
47
|
-
'Set',
|
|
48
|
-
'Symbol.iterator',
|
|
49
|
-
'URL',
|
|
50
|
-
'URLSearchParams',
|
|
51
|
-
'XMLSerializer'
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
overrides: [{
|
|
55
|
-
files: ['resources/user-sample.js'],
|
|
56
|
-
rules: {
|
|
57
|
-
'node/no-missing-import': 0,
|
|
58
|
-
'import/no-unresolved': 0
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
files: ['sw-sample.js'],
|
|
62
|
-
rules: {
|
|
63
|
-
'import/no-unresolved': 0,
|
|
64
|
-
'import/unambiguous': 0,
|
|
65
|
-
strict: 0
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
files: ['test/index.html'],
|
|
69
|
-
extends: ['ash-nazg/sauron-node-overrides'],
|
|
70
|
-
globals: {
|
|
71
|
-
mocha: false
|
|
72
|
-
},
|
|
73
|
-
rules: {
|
|
74
|
-
'import/unambiguous': 0
|
|
75
|
-
}
|
|
76
|
-
}, {
|
|
77
|
-
files: ['test/textbrowserTests.js'],
|
|
78
|
-
extends: ['ash-nazg/sauron-node-overrides']
|
|
79
|
-
}, {
|
|
80
|
-
files: ['server/**', 'resources/utils/WorkInfo.js'],
|
|
81
|
-
globals: {
|
|
82
|
-
require: true
|
|
83
|
-
}
|
|
84
|
-
}],
|
|
85
|
-
rules: {
|
|
86
|
-
// Disable for now
|
|
87
|
-
'array-bracket-newline': 0,
|
|
88
|
-
'no-console': 0,
|
|
89
|
-
'require-unicode-regexp': 0,
|
|
90
|
-
'@stylistic/max-len': 0,
|
|
91
|
-
'no-shadow': 0,
|
|
92
|
-
'implicit-arrow-linebreak': 0,
|
|
93
|
-
'function-paren-newline': 0,
|
|
94
|
-
'class-methods-use-this': 0,
|
|
95
|
-
'callback-return': 0,
|
|
96
|
-
'multiline-ternary': 0,
|
|
97
|
-
'consistent-return': 0,
|
|
98
|
-
'arrow-parens': 0,
|
|
99
|
-
'require-await': 0,
|
|
100
|
-
'prefer-named-capture-group': 0,
|
|
101
|
-
'jsdoc/require-jsdoc': 0,
|
|
102
|
-
'promise/avoid-new': 0,
|
|
103
|
-
'promise/prefer-await-to-callbacks': 0,
|
|
104
|
-
'import/no-anonymous-default-export': 0,
|
|
105
|
-
'unicorn/no-array-callback-reference': 0,
|
|
106
|
-
'eslint-comments/require-description': 0
|
|
107
|
-
}
|
|
108
|
-
};
|