ipx 4.0.0-alpha.1 → 4.0.0-beta.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/README.md +495 -78
- package/dist/THIRD-PARTY-LICENSES.md +593 -0
- package/dist/_chunks/libs/@fastify/accept-negotiator.mjs +71 -1
- package/dist/_chunks/libs/boolbase.mjs +12 -1
- package/dist/_chunks/libs/crossws.d.mts +1 -0
- package/dist/_chunks/libs/css-select.mjs +4136 -3
- package/dist/_chunks/libs/css-tree.mjs +31045 -51
- package/dist/_chunks/libs/csso.mjs +1821 -3
- package/dist/_chunks/libs/etag.mjs +25 -1
- package/dist/_chunks/libs/h3.d.mts +3 -0
- package/dist/_chunks/libs/h3.mjs +309 -2
- package/dist/_chunks/libs/image-meta.d.mts +8 -0
- package/dist/_chunks/libs/image-meta.mjs +557 -2
- package/dist/_chunks/libs/sax.mjs +837 -10
- package/dist/_chunks/libs/svgo.mjs +5883 -11
- package/dist/_chunks/libs/ufo.mjs +34 -1
- package/dist/_chunks/node-fs.mjs +1031 -245
- package/dist/_chunks/rolldown-runtime.mjs +24 -28
- package/dist/_chunks/svgo-node.mjs +2 -10
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +3 -13
- package/dist/index.d.mts +185 -30
- package/dist/index.mjs +3 -19
- package/package.json +24 -21
|
@@ -1 +1,25 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { __commonJSMin as e, __require as t } from "../rolldown-runtime.mjs";
|
|
2
|
+
var n = e(((e, n) => {
|
|
3
|
+
n.exports = s;
|
|
4
|
+
var r = t(`crypto`), i = t(`fs`).Stats, a = Object.prototype.toString;
|
|
5
|
+
function o(e) {
|
|
6
|
+
if (e.length === 0) return `"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"`;
|
|
7
|
+
var t = r.createHash(`sha1`).update(e, `utf8`).digest(`base64`).substring(0, 27);
|
|
8
|
+
return `"` + (typeof e == `string` ? Buffer.byteLength(e, `utf8`) : e.length).toString(16) + `-` + t + `"`;
|
|
9
|
+
}
|
|
10
|
+
function s(e, t) {
|
|
11
|
+
if (e == null) throw TypeError(`argument entity is required`);
|
|
12
|
+
var n = c(e), r = t && typeof t.weak == `boolean` ? t.weak : n;
|
|
13
|
+
if (!n && typeof e != `string` && !Buffer.isBuffer(e)) throw TypeError(`argument entity must be string, Buffer, or fs.Stats`);
|
|
14
|
+
var i = n ? l(e) : o(e);
|
|
15
|
+
return r ? `W/` + i : i;
|
|
16
|
+
}
|
|
17
|
+
function c(e) {
|
|
18
|
+
return typeof i == `function` && e instanceof i || e && typeof e == `object` && `ctime` in e && a.call(e.ctime) === `[object Date]` && `mtime` in e && a.call(e.mtime) === `[object Date]` && `ino` in e && typeof e.ino == `number` && `size` in e && typeof e.size == `number`;
|
|
19
|
+
}
|
|
20
|
+
function l(e) {
|
|
21
|
+
var t = e.mtime.getTime().toString(16);
|
|
22
|
+
return `"` + e.size.toString(16) + `-` + t + `"`;
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
export { n as require_etag };
|
package/dist/_chunks/libs/h3.mjs
CHANGED
|
@@ -1,2 +1,309 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { FastResponse as e, FastURL as t } from "srvx";
|
|
2
|
+
const n = (() => {
|
|
3
|
+
let e = function() {};
|
|
4
|
+
return e.prototype = Object.create(null), Object.freeze(e.prototype), e;
|
|
5
|
+
})();
|
|
6
|
+
function r(e) {
|
|
7
|
+
return decodeURI(e.includes(`%25`) ? e.replace(/%25/g, `%2525`) : e);
|
|
8
|
+
}
|
|
9
|
+
const i = `h3.internal.event.`, a = Symbol.for(`${i}res`), o = Symbol.for(`${i}res.headers`), s = Symbol.for(`${i}res.err.headers`), c = Symbol.for(`${i}malformed`);
|
|
10
|
+
var l = class {
|
|
11
|
+
app;
|
|
12
|
+
req;
|
|
13
|
+
url;
|
|
14
|
+
context;
|
|
15
|
+
static __is_event__ = !0;
|
|
16
|
+
constructor(e, i, a) {
|
|
17
|
+
this.context = e.context = i || e.context || new n(), this.req = e, this.app = a;
|
|
18
|
+
let o = e._url, s = o && o instanceof URL ? o : new t(e.url);
|
|
19
|
+
if (s.pathname.includes(`%`)) try {
|
|
20
|
+
let e = r(s.pathname);
|
|
21
|
+
e !== s.pathname && (s = new t(`${s.protocol}//${s.host}${e}${s.search}`));
|
|
22
|
+
} catch {
|
|
23
|
+
this[c] = !0;
|
|
24
|
+
}
|
|
25
|
+
this.url = s;
|
|
26
|
+
}
|
|
27
|
+
get res() {
|
|
28
|
+
return this[a] ||= new u();
|
|
29
|
+
}
|
|
30
|
+
get runtime() {
|
|
31
|
+
return this.req.runtime;
|
|
32
|
+
}
|
|
33
|
+
waitUntil(e) {
|
|
34
|
+
this.req.waitUntil?.(e);
|
|
35
|
+
}
|
|
36
|
+
toString() {
|
|
37
|
+
return `[${this.req.method}] ${this.req.url}`;
|
|
38
|
+
}
|
|
39
|
+
toJSON() {
|
|
40
|
+
return this.toString();
|
|
41
|
+
}
|
|
42
|
+
get node() {
|
|
43
|
+
return this.req.runtime?.node;
|
|
44
|
+
}
|
|
45
|
+
get headers() {
|
|
46
|
+
return this.req.headers;
|
|
47
|
+
}
|
|
48
|
+
get path() {
|
|
49
|
+
return this.url.pathname + this.url.search;
|
|
50
|
+
}
|
|
51
|
+
get method() {
|
|
52
|
+
return this.req.method;
|
|
53
|
+
}
|
|
54
|
+
}, u = class {
|
|
55
|
+
status;
|
|
56
|
+
statusText;
|
|
57
|
+
get headers() {
|
|
58
|
+
return this[o] ||= new Headers();
|
|
59
|
+
}
|
|
60
|
+
get errHeaders() {
|
|
61
|
+
return this[s] ||= new Headers();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const d = /[^\u0009\u0020-\u007E]/g;
|
|
65
|
+
function f(e = ``) {
|
|
66
|
+
return e.replace(d, ``);
|
|
67
|
+
}
|
|
68
|
+
function p(e, t = 200) {
|
|
69
|
+
return !e || (typeof e == `string` && (e = +e), !Number.isInteger(e) || e < 100 || e > 599) ? t : e;
|
|
70
|
+
}
|
|
71
|
+
var m = class e extends Error {
|
|
72
|
+
get name() {
|
|
73
|
+
return `HTTPError`;
|
|
74
|
+
}
|
|
75
|
+
status;
|
|
76
|
+
statusText;
|
|
77
|
+
headers;
|
|
78
|
+
cause;
|
|
79
|
+
data;
|
|
80
|
+
body;
|
|
81
|
+
unhandled;
|
|
82
|
+
static isError(e) {
|
|
83
|
+
return e instanceof Error && e?.name === `HTTPError`;
|
|
84
|
+
}
|
|
85
|
+
static status(t, n, r) {
|
|
86
|
+
return new e({
|
|
87
|
+
...r,
|
|
88
|
+
statusText: n,
|
|
89
|
+
status: t
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
constructor(e, t) {
|
|
93
|
+
let n, r;
|
|
94
|
+
typeof e == `string` ? (n = e, r = t) : r = e;
|
|
95
|
+
let i = p(r?.status || r?.statusCode || r?.cause?.status || r?.cause?.statusCode, 500), a = f(r?.statusText || r?.statusMessage || r?.cause?.statusText || r?.cause?.statusMessage), o = n || r?.message || r?.cause?.message || r?.statusText || r?.statusMessage || [
|
|
96
|
+
`HTTPError`,
|
|
97
|
+
i,
|
|
98
|
+
a
|
|
99
|
+
].filter(Boolean).join(` `);
|
|
100
|
+
super(o, { cause: r }), this.cause = r, this.status = i, this.statusText = a || void 0;
|
|
101
|
+
let s = r?.headers || r?.cause?.headers;
|
|
102
|
+
this.headers = s ? new Headers(s) : void 0, this.unhandled = r?.unhandled ?? r?.cause?.unhandled ?? void 0, this.data = r?.data, this.body = r?.body;
|
|
103
|
+
}
|
|
104
|
+
get statusCode() {
|
|
105
|
+
return this.status;
|
|
106
|
+
}
|
|
107
|
+
get statusMessage() {
|
|
108
|
+
return this.statusText;
|
|
109
|
+
}
|
|
110
|
+
toJSON() {
|
|
111
|
+
let e = this.unhandled;
|
|
112
|
+
return {
|
|
113
|
+
status: this.status,
|
|
114
|
+
statusText: this.statusText,
|
|
115
|
+
unhandled: e,
|
|
116
|
+
message: e ? `HTTPError` : this.message,
|
|
117
|
+
data: e ? void 0 : this.data,
|
|
118
|
+
...e ? void 0 : this.body
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function h(e, t) {
|
|
123
|
+
if (e == null) return !0;
|
|
124
|
+
if (t !== `object`) return t === `boolean` || t === `number` || t === `string`;
|
|
125
|
+
if (typeof e.toJSON == `function` || Array.isArray(e)) return !0;
|
|
126
|
+
if (typeof e.pipe == `function` || typeof e.pipeTo == `function`) return !1;
|
|
127
|
+
if (e instanceof n) return !0;
|
|
128
|
+
let r = Object.getPrototypeOf(e);
|
|
129
|
+
return r === Object.prototype || r === null;
|
|
130
|
+
}
|
|
131
|
+
const g = Symbol.for(`h3.internal.event.dispose`), _ = Symbol.for(`h3.notFound`), v = Symbol.for(`h3.handled`);
|
|
132
|
+
function y(e, t, n = {}) {
|
|
133
|
+
if (typeof e?.then == `function`) return e.then((e) => y(e, t, n), (e) => y(b(e), t, n));
|
|
134
|
+
let r;
|
|
135
|
+
try {
|
|
136
|
+
r = S(e, t, n);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
return y(b(e), t, n);
|
|
139
|
+
}
|
|
140
|
+
if (typeof r?.then == `function`) return y(r, t, n);
|
|
141
|
+
let { onResponse: i } = n;
|
|
142
|
+
return i ? Promise.resolve().then(() => i(r, t)).catch((e) => {
|
|
143
|
+
n.silent || console.error(e);
|
|
144
|
+
}).then(() => t[g]?.observe(r, e) ?? r) : t[g]?.observe(r, e) ?? r;
|
|
145
|
+
}
|
|
146
|
+
function b(e) {
|
|
147
|
+
if (e === _ || e === v || e instanceof Error) return e;
|
|
148
|
+
if (typeof e == `number`) return new m({ status: e });
|
|
149
|
+
let t = new m({
|
|
150
|
+
status: 500,
|
|
151
|
+
unhandled: !0
|
|
152
|
+
});
|
|
153
|
+
return t.cause = e, t;
|
|
154
|
+
}
|
|
155
|
+
var x = class {
|
|
156
|
+
#headers;
|
|
157
|
+
#init;
|
|
158
|
+
body;
|
|
159
|
+
constructor(e, t) {
|
|
160
|
+
this.body = e, this.#init = t;
|
|
161
|
+
}
|
|
162
|
+
get status() {
|
|
163
|
+
return this.#init?.status;
|
|
164
|
+
}
|
|
165
|
+
get statusText() {
|
|
166
|
+
return this.#init?.statusText;
|
|
167
|
+
}
|
|
168
|
+
get headers() {
|
|
169
|
+
return this.#headers ||= new Headers(this.#init?.headers);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function S(t, n, r, i) {
|
|
173
|
+
if (t === v) return new e(null);
|
|
174
|
+
if (t === _ && (t = new m({
|
|
175
|
+
status: 404,
|
|
176
|
+
message: `Cannot find any route matching [${n.req.method}] ${n.url}`
|
|
177
|
+
})), t && t instanceof Error) {
|
|
178
|
+
let e = m.isError(t), o = e ? t : new m(t);
|
|
179
|
+
e || (o.unhandled = !0, t?.stack && (o.stack = t.stack)), o.unhandled && !r.silent && console.error(o);
|
|
180
|
+
let { onError: c } = r, l = n[a]?.[s];
|
|
181
|
+
return c && !i ? Promise.resolve().then(() => c(o, n)).catch((e) => e).then((e) => S(e ?? t, n, r, !0)) : A(o, r.debug, l);
|
|
182
|
+
}
|
|
183
|
+
let c = n[a], l = c?.[o];
|
|
184
|
+
if (n[a] = void 0, !(t instanceof Response)) {
|
|
185
|
+
let i = O(t, n, r), a = i.status || c?.status;
|
|
186
|
+
return new e(k(n.req.method, a) ? null : i.body, {
|
|
187
|
+
status: a,
|
|
188
|
+
statusText: i.statusText || c?.statusText,
|
|
189
|
+
headers: i.headers && l ? C(i.headers, l) : i.headers || l
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (t.status >= 400 && (l = c?.[s]), l && !i) try {
|
|
193
|
+
C(t.headers, l, t.headers);
|
|
194
|
+
} catch {
|
|
195
|
+
return new e(k(n.req.method, t.status) ? null : t.body, {
|
|
196
|
+
status: t.status,
|
|
197
|
+
statusText: t.statusText,
|
|
198
|
+
headers: C(t.headers, l)
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return n.req.method === `HEAD` && t.body !== null ? new e(null, {
|
|
202
|
+
status: t.status,
|
|
203
|
+
statusText: t.statusText,
|
|
204
|
+
headers: t.headers
|
|
205
|
+
}) : t;
|
|
206
|
+
}
|
|
207
|
+
function C(e, t, n = new Headers(e)) {
|
|
208
|
+
for (let [e, r] of t) e === `set-cookie` ? n.append(e, r) : n.set(e, r);
|
|
209
|
+
return n;
|
|
210
|
+
}
|
|
211
|
+
const w = (e) => (...t) => {
|
|
212
|
+
throw Error(`Headers are frozen (${e} ${t.join(`, `)})`);
|
|
213
|
+
};
|
|
214
|
+
var T = class extends Headers {
|
|
215
|
+
set = w(`set`);
|
|
216
|
+
append = w(`append`);
|
|
217
|
+
delete = w(`delete`);
|
|
218
|
+
};
|
|
219
|
+
const E = new T({ "content-length": `0` }), D = new T({ "content-type": `application/json;charset=UTF-8` });
|
|
220
|
+
function O(e, t, n) {
|
|
221
|
+
if (e == null) return {
|
|
222
|
+
body: ``,
|
|
223
|
+
headers: E
|
|
224
|
+
};
|
|
225
|
+
let r = typeof e;
|
|
226
|
+
if (r === `string`) return { body: e };
|
|
227
|
+
if (e instanceof Uint8Array) return {
|
|
228
|
+
body: e,
|
|
229
|
+
headers: new Headers({ "content-length": e.byteLength.toString() })
|
|
230
|
+
};
|
|
231
|
+
if (e instanceof x || e?.constructor?.name === `HTTPResponse`) return e;
|
|
232
|
+
if (h(e, r)) return {
|
|
233
|
+
body: JSON.stringify(e, void 0, n.debug ? 2 : void 0),
|
|
234
|
+
headers: D
|
|
235
|
+
};
|
|
236
|
+
if (r === `bigint`) return {
|
|
237
|
+
body: e.toString(),
|
|
238
|
+
headers: D
|
|
239
|
+
};
|
|
240
|
+
if (e instanceof Blob) {
|
|
241
|
+
let t = new Headers({
|
|
242
|
+
"content-type": e.type,
|
|
243
|
+
"content-length": e.size.toString()
|
|
244
|
+
}), n = e.name;
|
|
245
|
+
return n && (n = encodeURIComponent(n), t.set(`content-disposition`, `filename="${n}"; filename*=UTF-8''${n}`)), {
|
|
246
|
+
body: e.stream(),
|
|
247
|
+
headers: t
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
return r === `symbol` ? { body: e.toString() } : r === `function` ? { body: `${e.name}()` } : { body: e };
|
|
251
|
+
}
|
|
252
|
+
function k(e, t) {
|
|
253
|
+
return e === `HEAD` || t === 100 || t === 101 || t === 102 || t === 204 || t === 205 || t === 304;
|
|
254
|
+
}
|
|
255
|
+
function A(t, n, r) {
|
|
256
|
+
let i = t.headers ? C(D, t.headers) : new Headers(D);
|
|
257
|
+
return r && (i = C(i, r)), new e(JSON.stringify({
|
|
258
|
+
...t.toJSON(),
|
|
259
|
+
stack: n && t.stack ? t.stack.split(`
|
|
260
|
+
`).map((e) => e.trim()) : void 0
|
|
261
|
+
}, void 0, n ? 2 : void 0), {
|
|
262
|
+
status: t.status,
|
|
263
|
+
statusText: t.statusText,
|
|
264
|
+
headers: i
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function j(e) {
|
|
268
|
+
let t = (e, t) => t(e);
|
|
269
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
270
|
+
let r = e[n], i = t;
|
|
271
|
+
t = (e, t) => N(r, e, t, i);
|
|
272
|
+
}
|
|
273
|
+
return t;
|
|
274
|
+
}
|
|
275
|
+
function M(e, t) {
|
|
276
|
+
let n = j(e);
|
|
277
|
+
return function(e) {
|
|
278
|
+
return n(e, t);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function N(e, t, n, r) {
|
|
282
|
+
let i, a, o = () => i ? a : (i = !0, a = r(t, n), a), s = e(t, o);
|
|
283
|
+
return P(s) ? o() : typeof s?.then == `function` ? s.then((e) => P(e) ? o() : e) : s;
|
|
284
|
+
}
|
|
285
|
+
function P(e) {
|
|
286
|
+
return e === void 0 || e === _;
|
|
287
|
+
}
|
|
288
|
+
function F(e) {
|
|
289
|
+
if (typeof e == `function`) return I(e);
|
|
290
|
+
let t = e.handler || (e.fetch ? function(t) {
|
|
291
|
+
return e.fetch(t.req);
|
|
292
|
+
} : L);
|
|
293
|
+
return Object.assign(I(e.middleware?.length ? M(e.middleware, t) : t), e);
|
|
294
|
+
}
|
|
295
|
+
function I(e) {
|
|
296
|
+
return `fetch` in e ? e : Object.assign(e, { fetch: (t) => {
|
|
297
|
+
typeof t == `string` && (t = new URL(t, `http://_`)), t instanceof URL && (t = new Request(t));
|
|
298
|
+
let n = new l(t);
|
|
299
|
+
try {
|
|
300
|
+
return Promise.resolve(y(e(n), n));
|
|
301
|
+
} catch (e) {
|
|
302
|
+
return Promise.resolve(y(b(e), n));
|
|
303
|
+
}
|
|
304
|
+
} });
|
|
305
|
+
}
|
|
306
|
+
const L = () => _;
|
|
307
|
+
String.raw`(?:^|/)(?:\.|%(?:25)*2e){1,2}(?:/|$)`, String.raw`%(?:25)*(?:2f|5c)`;
|
|
308
|
+
const R = F;
|
|
309
|
+
export { m as HTTPError, R as defineEventHandler };
|