textbrowser 0.52.0 → 0.53.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.53.0
4
+
5
+ - fix: switch to serve-static to avoid headers problem
6
+
7
+ ## 0.52.1
8
+
9
+ - fix: proper use of node-static fork
10
+
3
11
  ## 0.52.0
4
12
 
5
13
  - chore: switch to @node-static/node-static
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "textbrowser",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "Multilinear text browser",
5
5
  "type": "module",
6
6
  "main": "dist/index-es.min.js",
@@ -26,7 +26,7 @@
26
26
  "url": "git+https://github.com/bahaidev/textbrowser.git"
27
27
  },
28
28
  "engines": {
29
- "node": ">=14.19.1"
29
+ "node": ">=22.16.0"
30
30
  },
31
31
  "author": "Brett Zamir",
32
32
  "contributors": [],
@@ -36,7 +36,6 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@babel/core": "^7.28.4",
39
- "@node-static/node-static": "^0.8.0",
40
39
  "command-line-args": "^6.0.1",
41
40
  "dom-parser": "^1.1.5",
42
41
  "form-serialization": "^0.11.0",
@@ -48,6 +47,7 @@
48
47
  "json-refs": "^3.0.15",
49
48
  "load-stylesheets": "0.12.5",
50
49
  "node-fetch": "^3.3.2",
50
+ "serve-static": "^2.2.0",
51
51
  "simple-get-json": "^10.0.0"
52
52
  },
53
53
  "devDependencies": {
package/server/main.js CHANGED
@@ -3,8 +3,7 @@
3
3
  /* eslint-env node -- Environment here */
4
4
  import http from 'node:http';
5
5
 
6
- // @ts-expect-error Todo: Needs Types
7
- import statik from '@brettz9/node-static';
6
+ import statik from 'serve-static';
8
7
  import fetch from 'node-fetch';
9
8
  // @ts-expect-error Todo: Needs Types
10
9
  import commandLineArgs from 'command-line-args';
@@ -154,7 +153,6 @@ setGlobalVars(null, {
154
153
 
155
154
  if (userParams.nodeActivate) {
156
155
  // @ts-expect-error Ok
157
- // eslint-disable-next-line n/no-unsupported-features/node-builtins -- node-fetch
158
156
  globalThis.fetch = /** @type {fetch} */ (fetch);
159
157
  setTimeout(async () => {
160
158
  await activateCallback({...userParamsWithDefaults, basePath});
@@ -166,8 +164,6 @@ console.log('past activate check');
166
164
  // @ts-expect-error Ok
167
165
  globalThis.DOMParser = DOMParser; // potentially used within resultsDisplay.js
168
166
 
169
- const fileServer = new statik.Server(); // Pass path; otherwise uses current directory
170
-
171
167
  /**
172
168
  * @typedef {{
173
169
  * code: string,
@@ -200,6 +196,8 @@ let langData;
200
196
  /** @type {Languages} */
201
197
  let languagesInstance;
202
198
 
199
+ const fileServer = statik(import.meta.dirname);
200
+
203
201
  const srv = http.createServer(async (req, res) => {
204
202
  // console.log('URL::', new URL(req.url));
205
203
  const {pathname, search} = new URL(/** @type {string} */ (req.url), basePath);
@@ -208,7 +206,7 @@ const srv = http.createServer(async (req, res) => {
208
206
  if (pathname.includes('.git')) {
209
207
  req.url = '/index.html';
210
208
  }
211
- fileServer.serve(req, res);
209
+ fileServer(req, res, next);
212
210
  };
213
211
 
214
212
  const next = function () {