textbrowser 0.54.0 → 0.54.2
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/CHANGES.md +8 -0
- package/dist/WorkInfo-es.js +172 -355
- package/dist/activateCallback-es.js +0 -1
- package/dist/index-es.js +3294 -3414
- package/dist/index-es.min.js +4 -4
- package/eslint.config.js +2 -2
- package/package.json +44 -38
- package/resources/activateCallback.js +0 -1
- package/resources/index.js +0 -1
- package/resources/resultsDisplay.js +1 -9
- package/resources/templates/workDisplay.js +0 -1
- package/resources/utils/Plugin.js +2 -5
- package/resources/utils/WorkInfo.js +7 -15
- package/resources/workDisplay.js +0 -1
- package/resources/workSelect.js +0 -1
- package/server/main.js +15 -7
- package/sw-sample.js +0 -2
- package/tsconfig.json +2 -1
- package/dist/assets/index-_11XnUty.css +0 -9
- package/dist/assets/languages-1sAACTKG.json +0 -67
- package/dist/dist/WorkInfo-es.d.ts +0 -331
- package/dist/dist/WorkInfo-es.d.ts.map +0 -1
- package/dist/dist/activateCallback-es.d.ts +0 -17
- package/dist/dist/activateCallback-es.d.ts.map +0 -1
- package/dist/dist/index-es.d.ts +0 -619
- package/dist/dist/index-es.d.ts.map +0 -1
- package/dist/dist/sw-helper.d.ts +0 -3
- package/dist/dist/sw-helper.d.ts.map +0 -1
- package/dist/eslint.config.d.ts +0 -126
- package/dist/eslint.config.d.ts.map +0 -1
- package/dist/resources/activateCallback.d.ts +0 -23
- package/dist/resources/activateCallback.d.ts.map +0 -1
- package/dist/resources/index.d.ts +0 -128
- package/dist/resources/index.d.ts.map +0 -1
- package/dist/resources/resultsDisplay.d.ts +0 -110
- package/dist/resources/resultsDisplay.d.ts.map +0 -1
- package/dist/resources/templates/index.d.ts +0 -59
- package/dist/resources/templates/index.d.ts.map +0 -1
- package/dist/resources/templates/languageSelect.d.ts +0 -18
- package/dist/resources/templates/languageSelect.d.ts.map +0 -1
- package/dist/resources/templates/resultsDisplayClient.d.ts +0 -26
- package/dist/resources/templates/resultsDisplayClient.d.ts.map +0 -1
- package/dist/resources/templates/resultsDisplayServerOrClient.d.ts +0 -131
- package/dist/resources/templates/resultsDisplayServerOrClient.d.ts.map +0 -1
- package/dist/resources/templates/utils/dom.d.ts +0 -15
- package/dist/resources/templates/utils/dom.d.ts.map +0 -1
- package/dist/resources/templates/utils/html.d.ts +0 -3
- package/dist/resources/templates/utils/html.d.ts.map +0 -1
- package/dist/resources/templates/workDisplay.d.ts +0 -183
- package/dist/resources/templates/workDisplay.d.ts.map +0 -1
- package/dist/resources/templates/workSelect.d.ts +0 -18
- package/dist/resources/templates/workSelect.d.ts.map +0 -1
- package/dist/resources/user-sample.d.ts +0 -2
- package/dist/resources/user-sample.d.ts.map +0 -1
- package/dist/resources/user.d.ts +0 -2
- package/dist/resources/user.d.ts.map +0 -1
- package/dist/resources/utils/IntlURLSearchParams.d.ts +0 -56
- package/dist/resources/utils/IntlURLSearchParams.d.ts.map +0 -1
- package/dist/resources/utils/Languages.d.ts +0 -81
- package/dist/resources/utils/Languages.d.ts.map +0 -1
- package/dist/resources/utils/Metadata.d.ts +0 -133
- package/dist/resources/utils/Metadata.d.ts.map +0 -1
- package/dist/resources/utils/Params.d.ts +0 -30
- package/dist/resources/utils/Params.d.ts.map +0 -1
- package/dist/resources/utils/Plugin.d.ts +0 -278
- package/dist/resources/utils/Plugin.d.ts.map +0 -1
- package/dist/resources/utils/ServiceWorker.d.ts +0 -26
- package/dist/resources/utils/ServiceWorker.d.ts.map +0 -1
- package/dist/resources/utils/WorkInfo.d.ts +0 -104
- package/dist/resources/utils/WorkInfo.d.ts.map +0 -1
- package/dist/resources/utils/dialogs.d.ts +0 -155
- package/dist/resources/utils/dialogs.d.ts.map +0 -1
- package/dist/resources/utils/getLocaleFallbackResults.d.ts +0 -19
- package/dist/resources/utils/getLocaleFallbackResults.d.ts.map +0 -1
- package/dist/resources/utils/sanitize.d.ts +0 -6
- package/dist/resources/utils/sanitize.d.ts.map +0 -1
- package/dist/resources/vendor/json-refs-min.d.ts +0 -3
- package/dist/resources/vendor/json-refs-min.d.ts.map +0 -1
- package/dist/resources/workDisplay.d.ts +0 -81
- package/dist/resources/workDisplay.d.ts.map +0 -1
- package/dist/resources/workSelect.d.ts +0 -17
- package/dist/resources/workSelect.d.ts.map +0 -1
- package/dist/rollup.config.d.ts +0 -19
- package/dist/rollup.config.d.ts.map +0 -1
- package/dist/server/main.d.ts +0 -47
- package/dist/server/main.d.ts.map +0 -1
- package/dist/sw-helper.d.ts +0 -3
- package/dist/sw-helper.d.ts.map +0 -1
- package/dist/sw-helper.js +0 -355
- package/dist/sw-sample.d.ts +0 -2
- package/dist/sw-sample.d.ts.map +0 -1
package/eslint.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ashNazg from 'eslint-config-ash-nazg';
|
|
2
2
|
|
|
3
|
-
export default [
|
|
3
|
+
export default /** @type {import('eslint').Linter.Config} */ ([
|
|
4
4
|
{
|
|
5
5
|
ignores: [
|
|
6
6
|
'resources/vendor',
|
|
@@ -66,4 +66,4 @@ export default [
|
|
|
66
66
|
'unicorn/no-array-callback-reference': 0
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
];
|
|
69
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textbrowser",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.2",
|
|
4
4
|
"description": "Multilinear text browser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index-es.min.js",
|
|
@@ -14,6 +14,19 @@
|
|
|
14
14
|
"bin": {
|
|
15
15
|
"textbrowser": "./server/main.js"
|
|
16
16
|
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"tsc": "tsc",
|
|
19
|
+
"server": "./server/main.js --allowPlugins --namespace=test",
|
|
20
|
+
"start": "static -p 8081",
|
|
21
|
+
"rollup": "rollup -c",
|
|
22
|
+
"lint": "npm run eslint",
|
|
23
|
+
"eslint": "eslint .",
|
|
24
|
+
"mocha": "node_modules/.bin/_mocha --require test/bootstrap/node.js --require chai/register-assert.js test/textbrowserTests.js",
|
|
25
|
+
"node": "npm run eslint && npm run rollup && npm run mocha",
|
|
26
|
+
"open-test": "open-cli http://127.0.0.1:8081/test/",
|
|
27
|
+
"start-open-test": "run-p start open-test",
|
|
28
|
+
"test": "npm run eslint && npm run rollup && npm run start-open-test"
|
|
29
|
+
},
|
|
17
30
|
"browserslist": [
|
|
18
31
|
"defaults, not op_mini all"
|
|
19
32
|
],
|
|
@@ -35,62 +48,55 @@
|
|
|
35
48
|
"text"
|
|
36
49
|
],
|
|
37
50
|
"dependencies": {
|
|
38
|
-
"@babel/core": "^7.
|
|
39
|
-
"command-line-args": "^6.0.
|
|
51
|
+
"@babel/core": "^7.29.0",
|
|
52
|
+
"command-line-args": "^6.0.2",
|
|
40
53
|
"dom-parser": "^1.1.5",
|
|
41
54
|
"form-serialization": "^0.11.0",
|
|
42
55
|
"indexeddbshim": "^12.0.0",
|
|
43
56
|
"intl-dom": "^0.20.0",
|
|
44
57
|
"intl-locale-textinfo-polyfill": "^3.0.0",
|
|
45
|
-
"jamilih": "0.
|
|
46
|
-
"jsdom": "^
|
|
58
|
+
"jamilih": "0.63.1",
|
|
59
|
+
"jsdom": "^29.1.1",
|
|
47
60
|
"json-refs": "^3.0.15",
|
|
48
|
-
"load-stylesheets": "0.
|
|
61
|
+
"load-stylesheets": "0.13.0",
|
|
49
62
|
"node-fetch": "^3.3.2",
|
|
50
|
-
"serve-static": "^2.2.
|
|
51
|
-
"simple-get-json": "^
|
|
63
|
+
"serve-static": "^2.2.1",
|
|
64
|
+
"simple-get-json": "^11.0.0"
|
|
52
65
|
},
|
|
53
66
|
"devDependencies": {
|
|
54
67
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
55
|
-
"@babel/preset-env": "^7.
|
|
56
|
-
"@rollup/plugin-babel": "^
|
|
57
|
-
"@rollup/plugin-commonjs": "^
|
|
68
|
+
"@babel/preset-env": "^7.29.2",
|
|
69
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
70
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
58
71
|
"@rollup/plugin-json": "^6.1.0",
|
|
59
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
60
|
-
"@rollup/plugin-terser": "^0.
|
|
72
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
73
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
61
74
|
"@stadtlandnetz/rollup-plugin-postprocess": "^1.1.0",
|
|
62
|
-
"@types/chai": "^5.2.
|
|
63
|
-
"@types/express": "^5.0.
|
|
75
|
+
"@types/chai": "^5.2.3",
|
|
76
|
+
"@types/express": "^5.0.6",
|
|
64
77
|
"@types/json-schema": "^7.0.15",
|
|
65
78
|
"@types/mocha": "^10.0.10",
|
|
66
|
-
"@types/node": "^
|
|
67
|
-
"@web/rollup-plugin-import-meta-assets": "^2.3.
|
|
68
|
-
"ajv": "8.
|
|
79
|
+
"@types/node": "^26.1.0",
|
|
80
|
+
"@web/rollup-plugin-import-meta-assets": "^2.3.3",
|
|
81
|
+
"ajv": "8.20.0",
|
|
69
82
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
70
|
-
"chai": "^6.2.
|
|
71
|
-
"eslint": "^9.
|
|
72
|
-
"eslint-config-ash-nazg": "^39.
|
|
83
|
+
"chai": "^6.2.2",
|
|
84
|
+
"eslint": "^9.39.4",
|
|
85
|
+
"eslint-config-ash-nazg": "^39.11.1",
|
|
73
86
|
"json-metaschema": "1.3.0",
|
|
74
87
|
"json-schema": "^0.4.0",
|
|
75
|
-
"mocha": "^11.7.
|
|
88
|
+
"mocha": "^11.7.6",
|
|
76
89
|
"npm-run-all": "^4.1.5",
|
|
77
|
-
"open-cli": "^
|
|
78
|
-
"rollup": "^4.
|
|
90
|
+
"open-cli": "^9.0.0",
|
|
91
|
+
"rollup": "^4.62.2",
|
|
79
92
|
"rollup-plugin-re": "^1.0.7",
|
|
80
93
|
"textbrowser-data-schemas": "^0.2.0",
|
|
81
|
-
"typescript": "^
|
|
94
|
+
"typescript": "^6.0.3"
|
|
82
95
|
},
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"lint": "npm run eslint",
|
|
89
|
-
"eslint": "eslint .",
|
|
90
|
-
"mocha": "node_modules/.bin/_mocha --require test/bootstrap/node.js --require chai/register-assert.js test/textbrowserTests.js",
|
|
91
|
-
"node": "npm run eslint && npm run rollup && npm run mocha",
|
|
92
|
-
"open-test": "open-cli http://127.0.0.1:8081/test/",
|
|
93
|
-
"start-open-test": "run-p start open-test",
|
|
94
|
-
"test": "npm run eslint && npm run rollup && npm run start-open-test"
|
|
96
|
+
"allowScripts": {
|
|
97
|
+
"fsevents@2.3.2": true,
|
|
98
|
+
"canvas@2.11.2": true,
|
|
99
|
+
"sqlite3@5.1.7": true,
|
|
100
|
+
"unrs-resolver@1.11.1": true
|
|
95
101
|
}
|
|
96
|
-
}
|
|
102
|
+
}
|
package/resources/index.js
CHANGED
|
@@ -211,8 +211,8 @@ export const resultsDisplayClient = async function resultsDisplayClient (args) {
|
|
|
211
211
|
};
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
* @this {import('../server/main.js').ResultsDisplayServerContext}
|
|
215
214
|
* This is server-only code, but kept here as the function is similar.
|
|
215
|
+
* @this {import('../server/main.js').ResultsDisplayServerContext}
|
|
216
216
|
* @param {ResultsDisplayServerOrClientArg & {
|
|
217
217
|
* serverOutput?: "jamilih"|"html"|"json"|null
|
|
218
218
|
* }} args
|
|
@@ -563,7 +563,6 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
|
|
|
563
563
|
return undefined;
|
|
564
564
|
}
|
|
565
565
|
const {preferAlias, fieldValueAliasMap} = getFieldNameAndValueAliases({
|
|
566
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
567
566
|
field: /** @type {string} */ (field),
|
|
568
567
|
schemaItems, metadataObj, getFieldAliasOrName, lang
|
|
569
568
|
});
|
|
@@ -746,7 +745,6 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
|
|
|
746
745
|
);
|
|
747
746
|
if (plugin.getTargetLanguage) {
|
|
748
747
|
targetLanguage = plugin.getTargetLanguage({
|
|
749
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
750
748
|
applicableField: /** @type {string} */ (applicableField),
|
|
751
749
|
targetLanguage,
|
|
752
750
|
// Default lang for plug-in (from files.json)
|
|
@@ -773,13 +771,10 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
|
|
|
773
771
|
? plugin.getFieldAliasOrName({
|
|
774
772
|
locales: lang,
|
|
775
773
|
workI18n,
|
|
776
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
777
774
|
targetLanguage: /** @type {string} */ (targetLanguage),
|
|
778
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
779
775
|
applicableField: /** @type {string} */ (applicableField),
|
|
780
776
|
applicableFieldI18N,
|
|
781
777
|
meta,
|
|
782
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
783
778
|
metaApplicableField: /** @type {{[key: string]: string }} */ (
|
|
784
779
|
metaApplicableField
|
|
785
780
|
),
|
|
@@ -791,13 +786,10 @@ export const resultsDisplayServerOrClient = async function resultsDisplayServerO
|
|
|
791
786
|
pluginName,
|
|
792
787
|
// locales: lang,
|
|
793
788
|
workI18n,
|
|
794
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
795
789
|
targetLanguage: /** @type {string} */ (targetLanguage),
|
|
796
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
797
790
|
applicableFieldI18N: /** @type {string|string[]} */ (applicableFieldI18N),
|
|
798
791
|
// Todo: Should have formal way to i18nize meta
|
|
799
792
|
meta,
|
|
800
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
801
793
|
metaApplicableField: /** @type {{[key: string]: string }} */ (
|
|
802
794
|
metaApplicableField
|
|
803
795
|
)
|
|
@@ -120,11 +120,8 @@ export const escapePlugin = ({pluginName, applicableField, targetLanguage}) => {
|
|
|
120
120
|
* onByDefault: boolean,
|
|
121
121
|
* meta: {
|
|
122
122
|
* [key: string]: string
|
|
123
|
-
* }
|
|
124
|
-
* [args: string]: {}
|
|
123
|
+
* }
|
|
125
124
|
* }
|
|
126
|
-
* },
|
|
127
|
-
* [fieldArgs: string]: {
|
|
128
125
|
* }
|
|
129
126
|
* }} PluginFieldMappingForWork
|
|
130
127
|
*/
|
|
@@ -169,7 +166,7 @@ export class PluginsForWork {
|
|
|
169
166
|
* pluginName: string,
|
|
170
167
|
* pluginLang: string,
|
|
171
168
|
* onByDefaultDefault: boolean,
|
|
172
|
-
* meta:
|
|
169
|
+
* meta: MetaValue
|
|
173
170
|
* }) => void} cb
|
|
174
171
|
* @returns {void}
|
|
175
172
|
*/
|
|
@@ -61,7 +61,9 @@ import {PluginsForWork, escapePlugin} from './Plugin.js';
|
|
|
61
61
|
* INCOMPLETE typing.
|
|
62
62
|
* @typedef {{
|
|
63
63
|
* "localization-strings": {
|
|
64
|
-
* [key: string]: {
|
|
64
|
+
* [key: string]: {
|
|
65
|
+
* [key: string]: string
|
|
66
|
+
* }
|
|
65
67
|
* }
|
|
66
68
|
* groups: FileGroup[],
|
|
67
69
|
* plugins: {[key: string]: import('./Plugin.js').PluginInfo},
|
|
@@ -167,7 +169,9 @@ export const getWorkData = async function ({
|
|
|
167
169
|
/**
|
|
168
170
|
* @type {{
|
|
169
171
|
* "localization-strings": {
|
|
170
|
-
* [key: string]: {
|
|
172
|
+
* [key: string]: {
|
|
173
|
+
* [key: string]: string
|
|
174
|
+
* }
|
|
171
175
|
* }
|
|
172
176
|
* }}
|
|
173
177
|
*/ (
|
|
@@ -189,7 +193,6 @@ export const getWorkData = async function ({
|
|
|
189
193
|
return language in localizationStrings;
|
|
190
194
|
});
|
|
191
195
|
return {
|
|
192
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
193
196
|
locale: /** @type {string} */ (locale),
|
|
194
197
|
strings: {
|
|
195
198
|
head: {},
|
|
@@ -309,7 +312,7 @@ export const getWorkData = async function ({
|
|
|
309
312
|
getPlugins
|
|
310
313
|
? Promise.all(
|
|
311
314
|
pluginPaths.map(async (pluginPath) => {
|
|
312
|
-
//
|
|
315
|
+
// eslint-disable-next-line no-unsanitized/method -- Through trusted plugins
|
|
313
316
|
return /** @type {import('./Plugin.js').PluginObject} */ await (import(
|
|
314
317
|
cwd +
|
|
315
318
|
pluginPath
|
|
@@ -373,22 +376,18 @@ export const getWorkData = async function ({
|
|
|
373
376
|
);
|
|
374
377
|
if (plugin.getTargetLanguage) {
|
|
375
378
|
targetLanguage = plugin.getTargetLanguage({
|
|
376
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
377
379
|
applicableField: /** @type {string} */ (applicableField),
|
|
378
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
379
380
|
targetLanguage: /** @type {string} */ (targetLanguage),
|
|
380
381
|
// Default lang for plug-in (from files.json)
|
|
381
382
|
pluginLang,
|
|
382
383
|
// Default lang when no target language or
|
|
383
384
|
// plugin lang; using the lang of the applicable
|
|
384
385
|
// field
|
|
385
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
386
386
|
applicableFieldLang: /** @type {string} */ (applicableFieldLang)
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
389
|
const field = escapePlugin({
|
|
390
390
|
pluginName,
|
|
391
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
392
391
|
applicableField: /** @type {string} */ (applicableField),
|
|
393
392
|
targetLanguage: /** @type {string} */ (targetLanguage || pluginLang ||
|
|
394
393
|
applicableFieldLang)
|
|
@@ -403,13 +402,10 @@ export const getWorkData = async function ({
|
|
|
403
402
|
? plugin.getFieldAliasOrName({
|
|
404
403
|
locales: lang,
|
|
405
404
|
workI18n,
|
|
406
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
407
405
|
targetLanguage: /** @type {string} */ (targetLanguage),
|
|
408
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
409
406
|
applicableField: /** @type {string} */ (applicableField),
|
|
410
407
|
applicableFieldI18N,
|
|
411
408
|
meta,
|
|
412
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
413
409
|
metaApplicableField:
|
|
414
410
|
/**
|
|
415
411
|
* @type {{
|
|
@@ -425,13 +421,10 @@ export const getWorkData = async function ({
|
|
|
425
421
|
pluginName,
|
|
426
422
|
// locales: lang,
|
|
427
423
|
workI18n,
|
|
428
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
429
424
|
targetLanguage: /** @type {string} */ (targetLanguage),
|
|
430
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
431
425
|
applicableFieldI18N: /** @type {string|string[]} */ (applicableFieldI18N),
|
|
432
426
|
// Todo: Should have formal way to i18nize meta
|
|
433
427
|
meta,
|
|
434
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
435
428
|
metaApplicableField:
|
|
436
429
|
/**
|
|
437
430
|
* @type {{
|
|
@@ -470,7 +463,6 @@ export const getWorkData = async function ({
|
|
|
470
463
|
}
|
|
471
464
|
return {
|
|
472
465
|
// @ts-expect-error Ok
|
|
473
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
474
466
|
fileData: /** @type {FileData} */ (fileData),
|
|
475
467
|
workI18n, getFieldAliasOrName, metadataObj,
|
|
476
468
|
schemaObj, schemaItems, fieldInfo,
|
package/resources/workDisplay.js
CHANGED
|
@@ -170,7 +170,6 @@ export default async function workDisplay ({
|
|
|
170
170
|
const fieldMatchesLocale = metadata.getFieldMatchesLocale({
|
|
171
171
|
namespace: this.namespace,
|
|
172
172
|
preferredLocale, schemaItems,
|
|
173
|
-
// eslint-disable-next-line object-shorthand -- TS
|
|
174
173
|
pluginsForWork: /** @type {import('./utils/Plugin.js').PluginsForWork} */ (
|
|
175
174
|
pluginsForWork
|
|
176
175
|
)
|
package/resources/workSelect.js
CHANGED
package/server/main.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
/* eslint-env node -- Environment here */
|
|
4
3
|
import http from 'node:http';
|
|
5
4
|
|
|
6
5
|
import statik from 'serve-static';
|
|
@@ -224,6 +223,7 @@ const srv = http.createServer(async (req, res) => {
|
|
|
224
223
|
* @returns {Promise<void>}
|
|
225
224
|
*/
|
|
226
225
|
const runHttpServer = async function () {
|
|
226
|
+
// eslint-disable-next-line no-unsanitized/method -- CLI
|
|
227
227
|
const server = (await import(userParams.httpServer)).default();
|
|
228
228
|
return await server(
|
|
229
229
|
req,
|
|
@@ -239,6 +239,7 @@ const srv = http.createServer(async (req, res) => {
|
|
|
239
239
|
};
|
|
240
240
|
if (userParams.expressServer) {
|
|
241
241
|
/** @type {import('express').Application} */
|
|
242
|
+
// eslint-disable-next-line no-unsanitized/method -- CLI
|
|
242
243
|
const app = (await import(userParams.expressServer)).default();
|
|
243
244
|
|
|
244
245
|
if (userParams.httpServer && (!app._router || !app._router.stack.some(
|
|
@@ -281,12 +282,19 @@ const srv = http.createServer(async (req, res) => {
|
|
|
281
282
|
return;
|
|
282
283
|
}
|
|
283
284
|
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
// @ts-expect-error Ok
|
|
286
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- Polyglot reasons
|
|
287
|
+
delete globalThis.navigator;
|
|
288
|
+
const languages = (req.headers['accept-language']?.replace(/;q=.*$/, '') ?? 'en-US').split(',');
|
|
289
|
+
Object.defineProperty(globalThis, 'navigator', {
|
|
290
|
+
value: {
|
|
291
|
+
language: languages[0],
|
|
292
|
+
languages
|
|
293
|
+
},
|
|
294
|
+
writable: true,
|
|
295
|
+
configurable: true,
|
|
296
|
+
enumerable: false
|
|
297
|
+
});
|
|
290
298
|
|
|
291
299
|
const $p = new IntlURLSearchParams({
|
|
292
300
|
params: search
|
package/sw-sample.js
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"localeFileBasePath": "node_modules/textbrowser/locales/",
|
|
3
|
-
"localization-strings": {
|
|
4
|
-
"en-US": {
|
|
5
|
-
"chooselanguage": "Your interface language",
|
|
6
|
-
"all-langs": "All languages",
|
|
7
|
-
"languages": {
|
|
8
|
-
"en-US": "English",
|
|
9
|
-
"ar": "Arabic",
|
|
10
|
-
"fa": "Persian",
|
|
11
|
-
"ru": "Russian"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"fa": {
|
|
15
|
-
"chooselanguage": "زبان انتخاب شده",
|
|
16
|
-
"all-langs": "All languages",
|
|
17
|
-
"languages": {
|
|
18
|
-
"en-US": "English",
|
|
19
|
-
"ar": "Arabic",
|
|
20
|
-
"fa": "فارسي",
|
|
21
|
-
"ru": "Russian"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"ar": {
|
|
25
|
-
"chooselanguage": "لغتك",
|
|
26
|
-
"all-langs": "All languages",
|
|
27
|
-
"languages": {
|
|
28
|
-
"en-US": "English",
|
|
29
|
-
"ar": "عربي",
|
|
30
|
-
"fa": "Persian",
|
|
31
|
-
"ru": "Russian"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"ru": {
|
|
35
|
-
"chooselanguage": "Your interface language",
|
|
36
|
-
"all-langs": "Все языки",
|
|
37
|
-
"languages": {
|
|
38
|
-
"en-US": "Английский",
|
|
39
|
-
"ar": "Arabic",
|
|
40
|
-
"fa": "Persian",
|
|
41
|
-
"ru": "русский"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"languages": [
|
|
46
|
-
{
|
|
47
|
-
"code": "en-US",
|
|
48
|
-
"direction": "ltr",
|
|
49
|
-
"locale": {"$ref": "../locales/en-US.json"}
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"code": "fa",
|
|
53
|
-
"direction": "rtl",
|
|
54
|
-
"locale": {"$ref": "../locales/fa.json"}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"code": "ar",
|
|
58
|
-
"direction": "rtl",
|
|
59
|
-
"locale": {"$ref": "../locales/ar.json"}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"code": "ru",
|
|
63
|
-
"direction": "ltr",
|
|
64
|
-
"locale": {"$ref": "../locales/ru.json"}
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|