foxts 4.6.0 → 5.0.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/dist/fast-string-array-join/index.d.ts +1 -1
- package/package.json +10 -32
- package/dist/escape-html/index.d.ts +0 -2
- package/dist/escape-html/index.js +0 -1
- package/dist/escape-html/index.mjs +0 -1
- package/dist/escape-string-regexp/index.d.ts +0 -1
- package/dist/escape-string-regexp/index.js +0 -1
- package/dist/escape-string-regexp/index.mjs +0 -1
- package/dist/simple-cors/index.d.ts +0 -29
- package/dist/simple-cors/index.js +0 -1
- package/dist/simple-cors/index.mjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A 200% faster join than the native `Array.prototype.join` for string arrays and string separator.
|
|
3
3
|
*/
|
|
4
|
-
declare function fastStringArrayJoin(arr: string[], sep: string): string;
|
|
4
|
+
declare function fastStringArrayJoin(arr: string[] | readonly string[], sep: string): string;
|
|
5
5
|
|
|
6
6
|
export { fastStringArrayJoin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Opinionated collection of common TypeScript utils by @SukkaW",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/SukkaW/foxts"
|
|
@@ -112,18 +112,6 @@
|
|
|
112
112
|
"require": "./dist/empty-node/index.js",
|
|
113
113
|
"default": "./dist/empty-node/index.js"
|
|
114
114
|
},
|
|
115
|
-
"./escape-html": {
|
|
116
|
-
"types": "./dist/escape-html/index.d.ts",
|
|
117
|
-
"import": "./dist/escape-html/index.mjs",
|
|
118
|
-
"require": "./dist/escape-html/index.js",
|
|
119
|
-
"default": "./dist/escape-html/index.js"
|
|
120
|
-
},
|
|
121
|
-
"./escape-string-regexp": {
|
|
122
|
-
"types": "./dist/escape-string-regexp/index.d.ts",
|
|
123
|
-
"import": "./dist/escape-string-regexp/index.mjs",
|
|
124
|
-
"require": "./dist/escape-string-regexp/index.js",
|
|
125
|
-
"default": "./dist/escape-string-regexp/index.js"
|
|
126
|
-
},
|
|
127
115
|
"./extract-error-message": {
|
|
128
116
|
"types": "./dist/extract-error-message/index.d.ts",
|
|
129
117
|
"import": "./dist/extract-error-message/index.mjs",
|
|
@@ -268,12 +256,6 @@
|
|
|
268
256
|
"require": "./dist/shuffle-array/index.js",
|
|
269
257
|
"default": "./dist/shuffle-array/index.js"
|
|
270
258
|
},
|
|
271
|
-
"./simple-cors": {
|
|
272
|
-
"types": "./dist/simple-cors/index.d.ts",
|
|
273
|
-
"import": "./dist/simple-cors/index.mjs",
|
|
274
|
-
"require": "./dist/simple-cors/index.js",
|
|
275
|
-
"default": "./dist/simple-cors/index.js"
|
|
276
|
-
},
|
|
277
259
|
"./simple-string-hash": {
|
|
278
260
|
"types": "./dist/simple-string-hash/index.d.ts",
|
|
279
261
|
"import": "./dist/simple-string-hash/index.mjs",
|
|
@@ -331,13 +313,9 @@
|
|
|
331
313
|
],
|
|
332
314
|
"author": "SukkaW <https://skk.moe>",
|
|
333
315
|
"license": "MIT",
|
|
334
|
-
"dependencies": {
|
|
335
|
-
"fast-escape-html": "^1.1.0",
|
|
336
|
-
"fast-escape-regexp": "^1.0.1"
|
|
337
|
-
},
|
|
338
316
|
"devDependencies": {
|
|
339
|
-
"@eslint-sukka/node": "^
|
|
340
|
-
"@happy-dom/global-registrator": "^20.0.
|
|
317
|
+
"@eslint-sukka/node": "^8.0.0-beta.1",
|
|
318
|
+
"@happy-dom/global-registrator": "^20.0.8",
|
|
341
319
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
342
320
|
"@mitata/counters": "^0.0.8",
|
|
343
321
|
"@monyone/aho-corasick": "^1.0.4",
|
|
@@ -345,23 +323,23 @@
|
|
|
345
323
|
"@swc-node/register": "^1.11.1",
|
|
346
324
|
"@swc/core": "^1.13.20",
|
|
347
325
|
"@types/mocha": "^10.0.10",
|
|
348
|
-
"@types/node": "^22.18.
|
|
326
|
+
"@types/node": "^22.18.12",
|
|
349
327
|
"@types/sinon": "^17.0.4",
|
|
350
328
|
"bumpp": "^10.3.1",
|
|
351
|
-
"devalue": "^5.
|
|
352
|
-
"eslint": "^9.
|
|
353
|
-
"eslint-config-sukka": "^
|
|
354
|
-
"eslint-formatter-sukka": "^
|
|
329
|
+
"devalue": "^5.4.2",
|
|
330
|
+
"eslint": "^9.38.0",
|
|
331
|
+
"eslint-config-sukka": "^8.0.0-beta.1",
|
|
332
|
+
"eslint-formatter-sukka": "^8.0.0-beta.1",
|
|
355
333
|
"expect": "^30.2.0",
|
|
356
334
|
"fastscan": "^1.0.6",
|
|
357
|
-
"happy-dom": "^20.0.
|
|
335
|
+
"happy-dom": "^20.0.8",
|
|
358
336
|
"is-ci": "^4.1.0",
|
|
359
337
|
"is-network-error": "^1.3.0",
|
|
360
338
|
"mitata": "^1.0.34",
|
|
361
339
|
"mocha": "^11.7.4",
|
|
362
340
|
"modern-ahocorasick": "^2.0.4",
|
|
363
341
|
"nyc": "^17.1.0",
|
|
364
|
-
"rollup": "^4.52.
|
|
342
|
+
"rollup": "^4.52.5",
|
|
365
343
|
"rollup-plugin-dts": "^6.2.3",
|
|
366
344
|
"rollup-plugin-oxc-resolve": "^0.0.5",
|
|
367
345
|
"rollup-plugin-swc3": "^0.12.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("fast-escape-html");Object.keys(e).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(exports,t)||Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"fast-escape-html";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { escapeRegexp as escapeStringRegexp } from 'fast-escape-regexp';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("fast-escape-regexp");Object.defineProperty(exports,"escapeStringRegexp",{enumerable:!0,get:function(){return e.escapeRegexp}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{escapeRegexp as escapeStringRegexp}from"fast-escape-regexp";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
interface SimpleCorsOptions {
|
|
2
|
-
origin: string | string[] | ((origin: string) => Promise<string | undefined | null> | string | undefined | null);
|
|
3
|
-
allowMethods?: string[] | ((origin: string) => Promise<string[]> | string[]);
|
|
4
|
-
allowHeaders?: string[];
|
|
5
|
-
maxAge?: number;
|
|
6
|
-
credentials?: boolean;
|
|
7
|
-
exposeHeaders?: string[];
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* A very simple CORS implementation for using in simple serverless workers
|
|
11
|
-
*
|
|
12
|
-
* Example usage:
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* const simpleCors = createSimpleCors({});
|
|
16
|
-
*
|
|
17
|
-
* export function fetch(req: Request) {
|
|
18
|
-
* if (req.method === 'OPTIONS') {
|
|
19
|
-
* return simpleCors(req, new Response(null, { status: 204 });
|
|
20
|
-
* }
|
|
21
|
-
* const resp = Response.json({ message: 'Hello, world!' });
|
|
22
|
-
* return simpleCors(req, resp);
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
declare function createSimpleCors(options?: SimpleCorsOptions): (request: Request, response: Response) => Promise<Response>;
|
|
27
|
-
|
|
28
|
-
export { createSimpleCors };
|
|
29
|
-
export type { SimpleCorsOptions };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("../fast-string-array-join/index.js");exports.createSimpleCors=function(s){let t,r;const n={origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[],...s},o=n.origin;if("string"==typeof o)t="*"===o?()=>"*":e=>o===e?e:null;else if("function"==typeof o)t=o;else{const e=new Set(o);t=s=>e.has(s)?s:null}const a=n.allowMethods;r="function"==typeof a?a:Array.isArray(a)?()=>a:()=>[];const l="*"!==o;return async function(s,o){let a=t(s.headers.get("Origin")||"");if(a&&"object"==typeof a&&"then"in a&&(a=await a),a&&o.headers.set("Access-Control-Allow-Origin",a),l){const e=s.headers.get("Vary");e?o.headers.set("Vary",e):o.headers.set("Vary","Origin")}n.credentials&&o.headers.set("Access-Control-Allow-Credentials","true"),n.exposeHeaders?.length&&o.headers.set("Access-Control-Expose-Headers",e.fastStringArrayJoin(n.exposeHeaders,","));let i=r(s.headers.get("origin")||"");if("then"in i&&(i=await i),i.length&&o.headers.set("Access-Control-Allow-Methods",e.fastStringArrayJoin(i,",")),"OPTIONS"===s.method){null!=n.maxAge&&o.headers.set("Access-Control-Max-Age",n.maxAge.toString());let t=n.allowHeaders;if(!t?.length){const e=s.headers.get("Access-Control-Request-Headers");e&&(t=e.split(/\s*,\s*/))}t?.length&&(o.headers.set("Access-Control-Allow-Headers",e.fastStringArrayJoin(t,",")),o.headers.append("Vary","Access-Control-Request-Headers"))}return o}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fastStringArrayJoin as e}from"../fast-string-array-join/index.mjs";function s(s){let t,r;const o={origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH"],allowHeaders:[],exposeHeaders:[],...s},n=o.origin;if("string"==typeof n)t="*"===n?()=>"*":e=>n===e?e:null;else if("function"==typeof n)t=n;else{const e=new Set(n);t=s=>e.has(s)?s:null}const a=o.allowMethods;r="function"==typeof a?a:Array.isArray(a)?()=>a:()=>[];const l="*"!==n;return async function(s,n){let a=t(s.headers.get("Origin")||"");if(a&&"object"==typeof a&&"then"in a&&(a=await a),a&&n.headers.set("Access-Control-Allow-Origin",a),l){const e=s.headers.get("Vary");e?n.headers.set("Vary",e):n.headers.set("Vary","Origin")}o.credentials&&n.headers.set("Access-Control-Allow-Credentials","true"),o.exposeHeaders?.length&&n.headers.set("Access-Control-Expose-Headers",e(o.exposeHeaders,","));let i=r(s.headers.get("origin")||"");if("then"in i&&(i=await i),i.length&&n.headers.set("Access-Control-Allow-Methods",e(i,",")),"OPTIONS"===s.method){null!=o.maxAge&&n.headers.set("Access-Control-Max-Age",o.maxAge.toString());let t=o.allowHeaders;if(!t?.length){const e=s.headers.get("Access-Control-Request-Headers");e&&(t=e.split(/\s*,\s*/))}t?.length&&(n.headers.set("Access-Control-Allow-Headers",e(t,",")),n.headers.append("Vary","Access-Control-Request-Headers"))}return n}}export{s as createSimpleCors};
|