textbrowser 0.53.0 → 0.54.0

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGES to `textbrowser`
2
2
 
3
+ ## 0.54.0
4
+
5
+ - fix: avoid defining `navigator.languages` as reserved now by Node
6
+
7
+ ## 0.53.1
8
+
9
+ - fix: broken escaping of regex and dirname issue
10
+
3
11
  ## 0.53.0
4
12
 
5
13
  - fix: switch to serve-static to avoid headers problem
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../server/main.js"],"names":[],"mappings":";0BAoCa;IACR,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,EAAE,OAAO,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;uBA2CS,GAAG;0CAKH,OAAO,qCAAqC,EAAE,mBAAmB,GACzE,WAAW,GAAG;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACnC,YAAY,CAAC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iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACnC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,KAAK,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC;CAClB;2BAwDO;IACR,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,GAAC,KAAK,CAAC;IACvB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;CACF;kCAIS;IACZ,CAAK,GAAG,EAAE,MAAM,GAAG,MAAM,GAAC,MAAM,EAAE,GAAC,mBAAmB,CAAA;CACnD;4BAIS;IACR,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAA0B,EAAE,mBAAmB,CAAA;CAC5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textbrowser",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Multilinear text browser",
5
5
  "type": "module",
6
6
  "main": "dist/index-es.min.js",
package/server/main.js CHANGED
@@ -4,6 +4,9 @@
4
4
  import http from 'node:http';
5
5
 
6
6
  import statik from 'serve-static';
7
+ import {fileURLToPath} from 'url';
8
+ import {dirname} from 'path';
9
+
7
10
  import fetch from 'node-fetch';
8
11
  // @ts-expect-error Todo: Needs Types
9
12
  import commandLineArgs from 'command-line-args';
@@ -196,7 +199,11 @@ let langData;
196
199
  /** @type {Languages} */
197
200
  let languagesInstance;
198
201
 
199
- const fileServer = statik(import.meta.dirname);
202
+ // `import.meta.dirname` not working on server despite hosting high enough
203
+ // version of Node and being `type: "module"`
204
+ const __filename = fileURLToPath(import.meta.url);
205
+ const dir = dirname(__filename);
206
+ const fileServer = statik(import.meta.dirname ?? dir);
200
207
 
201
208
  const srv = http.createServer(async (req, res) => {
202
209
  // console.log('URL::', new URL(req.url));
@@ -239,7 +246,7 @@ const srv = http.createServer(async (req, res) => {
239
246
  ({regexp}) => {
240
247
  // Hack to ignore middleware like jsonParser (and hopefully
241
248
  // not get any other)
242
- return regexp.source !== String.raw`^\/?(?=\\/|$)` &&
249
+ return regexp.source !== String.raw`^\/?(?=\/|$)` &&
243
250
  regexp.test(/** @type {string} */ (req.url));
244
251
  }
245
252
  ))) {
@@ -273,13 +280,14 @@ const srv = http.createServer(async (req, res) => {
273
280
  */
274
281
  return;
275
282
  }
276
- const languages = (req.headers['accept-language']?.replace(/;q=.*$/, '') ?? 'en-US').split(',');
277
- // @ts-expect-error Polyglot reasons
278
- // eslint-disable-next-line n/no-unsupported-features/node-builtins -- Polyglot reasons
279
- globalThis.navigator = {
280
- language: languages[0],
281
- languages
282
- };
283
+
284
+ // const languages = (req.headers['accept-language']?.replace(/;q=.*$/, '') ?? 'en-US').split(',');
285
+ // // eslint-disable-next-line n/no-unsupported-features/node-builtins -- Polyglot reasons
286
+ // globalThis.navigator = {
287
+ // language: languages[0],
288
+ // languages
289
+ // };
290
+
283
291
  const $p = new IntlURLSearchParams({
284
292
  params: search
285
293
  });