ipx 4.0.0-alpha.1 → 4.0.0-alpha.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/README.md +3 -1
- package/dist/THIRD-PARTY-LICENSES.md +539 -0
- package/dist/_chunks/libs/@fastify/accept-negotiator.mjs +71 -1
- package/dist/_chunks/libs/boolbase.mjs +12 -1
- package/dist/_chunks/libs/css-select.mjs +4136 -3
- package/dist/_chunks/libs/css-tree.mjs +31083 -51
- package/dist/_chunks/libs/csso.mjs +1834 -3
- package/dist/_chunks/libs/etag.mjs +25 -1
- package/dist/_chunks/libs/h3.mjs +267 -2
- package/dist/_chunks/libs/image-meta.d.mts +12 -0
- package/dist/_chunks/libs/image-meta.mjs +557 -2
- package/dist/_chunks/libs/sax.mjs +836 -10
- package/dist/_chunks/libs/svgo.mjs +5851 -11
- package/dist/_chunks/libs/ufo.mjs +41 -1
- package/dist/_chunks/node-fs.mjs +66 -104
- package/dist/_chunks/rolldown-runtime.mjs +24 -28
- package/dist/_chunks/svgo-node.mjs +2 -10
- package/dist/cli.mjs +3 -13
- package/dist/index.d.mts +1 -14
- package/dist/index.mjs +3 -19
- package/package.json +17 -17
|
@@ -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 ? !0 : 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,267 @@
|
|
|
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`);
|
|
10
|
+
var c = class {
|
|
11
|
+
app;
|
|
12
|
+
req;
|
|
13
|
+
url;
|
|
14
|
+
context;
|
|
15
|
+
static __is_event__ = !0;
|
|
16
|
+
constructor(e, i, a) {
|
|
17
|
+
this.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
|
+
s.pathname.includes(`%`) && (s.pathname = r(s.pathname)), this.url = s;
|
|
20
|
+
}
|
|
21
|
+
get res() {
|
|
22
|
+
return this[a] ||= new l();
|
|
23
|
+
}
|
|
24
|
+
get runtime() {
|
|
25
|
+
return this.req.runtime;
|
|
26
|
+
}
|
|
27
|
+
waitUntil(e) {
|
|
28
|
+
this.req.waitUntil?.(e);
|
|
29
|
+
}
|
|
30
|
+
toString() {
|
|
31
|
+
return `[${this.req.method}] ${this.req.url}`;
|
|
32
|
+
}
|
|
33
|
+
toJSON() {
|
|
34
|
+
return this.toString();
|
|
35
|
+
}
|
|
36
|
+
get node() {
|
|
37
|
+
return this.req.runtime?.node;
|
|
38
|
+
}
|
|
39
|
+
get headers() {
|
|
40
|
+
return this.req.headers;
|
|
41
|
+
}
|
|
42
|
+
get path() {
|
|
43
|
+
return this.url.pathname + this.url.search;
|
|
44
|
+
}
|
|
45
|
+
get method() {
|
|
46
|
+
return this.req.method;
|
|
47
|
+
}
|
|
48
|
+
}, l = class {
|
|
49
|
+
status;
|
|
50
|
+
statusText;
|
|
51
|
+
get headers() {
|
|
52
|
+
return this[o] ||= new Headers();
|
|
53
|
+
}
|
|
54
|
+
get errHeaders() {
|
|
55
|
+
return this[s] ||= new Headers();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const u = /[^\u0009\u0020-\u007E]/g;
|
|
59
|
+
function d(e = ``) {
|
|
60
|
+
return e.replace(u, ``);
|
|
61
|
+
}
|
|
62
|
+
function f(e, t = 200) {
|
|
63
|
+
return !e || (typeof e == `string` && (e = +e), e < 100 || e > 599) ? t : e;
|
|
64
|
+
}
|
|
65
|
+
var p = class e extends Error {
|
|
66
|
+
get name() {
|
|
67
|
+
return `HTTPError`;
|
|
68
|
+
}
|
|
69
|
+
status;
|
|
70
|
+
statusText;
|
|
71
|
+
headers;
|
|
72
|
+
cause;
|
|
73
|
+
data;
|
|
74
|
+
body;
|
|
75
|
+
unhandled;
|
|
76
|
+
static isError(e) {
|
|
77
|
+
return e instanceof Error && e?.name === `HTTPError`;
|
|
78
|
+
}
|
|
79
|
+
static status(t, n, r) {
|
|
80
|
+
return new e({
|
|
81
|
+
...r,
|
|
82
|
+
statusText: n,
|
|
83
|
+
status: t
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
constructor(e, t) {
|
|
87
|
+
let n, r;
|
|
88
|
+
typeof e == `string` ? (n = e, r = t) : r = e;
|
|
89
|
+
let i = f(r?.status || r?.statusCode || r?.cause?.status || r?.cause?.statusCode, 500), a = d(r?.statusText || r?.statusMessage || r?.cause?.statusText || r?.cause?.statusMessage), o = n || r?.message || r?.cause?.message || r?.statusText || r?.statusMessage || [
|
|
90
|
+
`HTTPError`,
|
|
91
|
+
i,
|
|
92
|
+
a
|
|
93
|
+
].filter(Boolean).join(` `);
|
|
94
|
+
super(o, { cause: r }), this.cause = r, this.status = i, this.statusText = a || void 0;
|
|
95
|
+
let s = r?.headers || r?.cause?.headers;
|
|
96
|
+
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;
|
|
97
|
+
}
|
|
98
|
+
get statusCode() {
|
|
99
|
+
return this.status;
|
|
100
|
+
}
|
|
101
|
+
get statusMessage() {
|
|
102
|
+
return this.statusText;
|
|
103
|
+
}
|
|
104
|
+
toJSON() {
|
|
105
|
+
let e = this.unhandled;
|
|
106
|
+
return {
|
|
107
|
+
status: this.status,
|
|
108
|
+
statusText: this.statusText,
|
|
109
|
+
unhandled: e,
|
|
110
|
+
message: e ? `HTTPError` : this.message,
|
|
111
|
+
data: e ? void 0 : this.data,
|
|
112
|
+
...e ? void 0 : this.body
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
function m(e, t) {
|
|
117
|
+
if (e == null) return !0;
|
|
118
|
+
if (t !== `object`) return t === `boolean` || t === `number` || t === `string`;
|
|
119
|
+
if (typeof e.toJSON == `function` || Array.isArray(e)) return !0;
|
|
120
|
+
if (typeof e.pipe == `function` || typeof e.pipeTo == `function`) return !1;
|
|
121
|
+
if (e instanceof n) return !0;
|
|
122
|
+
let r = Object.getPrototypeOf(e);
|
|
123
|
+
return r === Object.prototype || r === null;
|
|
124
|
+
}
|
|
125
|
+
const h = Symbol.for(`h3.notFound`), g = Symbol.for(`h3.handled`);
|
|
126
|
+
function _(e, t, n = {}) {
|
|
127
|
+
if (typeof e?.then == `function`) return e.then((e) => _(e, t, n), (e) => _(typeof e == `number` ? new p({ status: e }) : e, t, n));
|
|
128
|
+
let r = y(e, t, n);
|
|
129
|
+
if (typeof r?.then == `function`) return _(r, t, n);
|
|
130
|
+
let { onResponse: i } = n;
|
|
131
|
+
return i ? Promise.resolve(i(r, t)).then(() => r) : r;
|
|
132
|
+
}
|
|
133
|
+
var v = class {
|
|
134
|
+
#headers;
|
|
135
|
+
#init;
|
|
136
|
+
body;
|
|
137
|
+
constructor(e, t) {
|
|
138
|
+
this.body = e, this.#init = t;
|
|
139
|
+
}
|
|
140
|
+
get status() {
|
|
141
|
+
return this.#init?.status || 200;
|
|
142
|
+
}
|
|
143
|
+
get statusText() {
|
|
144
|
+
return this.#init?.statusText || `OK`;
|
|
145
|
+
}
|
|
146
|
+
get headers() {
|
|
147
|
+
return this.#headers ||= new Headers(this.#init?.headers);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
function y(t, n, r, i) {
|
|
151
|
+
if (t === g) return new e(null);
|
|
152
|
+
if (t === h && (t = new p({
|
|
153
|
+
status: 404,
|
|
154
|
+
message: `Cannot find any route matching [${n.req.method}] ${n.url}`
|
|
155
|
+
})), t && t instanceof Error) {
|
|
156
|
+
let e = p.isError(t), o = e ? t : new p(t);
|
|
157
|
+
e || (o.unhandled = !0, t?.stack && (o.stack = t.stack)), o.unhandled && !r.silent && console.error(o);
|
|
158
|
+
let { onError: c } = r, l = n[a]?.[s];
|
|
159
|
+
return c && !i ? Promise.resolve(c(o, n)).catch((e) => e).then((e) => y(e ?? t, n, r, !0)) : D(o, r.debug, l);
|
|
160
|
+
}
|
|
161
|
+
let c = n[a], l = c?.[o];
|
|
162
|
+
if (n[a] = void 0, !(t instanceof Response)) {
|
|
163
|
+
let i = T(t, n, r), a = i.status || c?.status;
|
|
164
|
+
return new e(E(n.req.method, a) ? null : i.body, {
|
|
165
|
+
status: a,
|
|
166
|
+
statusText: i.statusText || c?.statusText,
|
|
167
|
+
headers: i.headers && l ? b(i.headers, l) : i.headers || l
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (!l || i || !t.ok) return t;
|
|
171
|
+
try {
|
|
172
|
+
return b(t.headers, l, t.headers), t;
|
|
173
|
+
} catch {
|
|
174
|
+
return new e(E(n.req.method, t.status) ? null : t.body, {
|
|
175
|
+
status: t.status,
|
|
176
|
+
statusText: t.statusText,
|
|
177
|
+
headers: b(t.headers, l)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function b(e, t, n = new Headers(e)) {
|
|
182
|
+
for (let [e, r] of t) e === `set-cookie` ? n.append(e, r) : n.set(e, r);
|
|
183
|
+
return n;
|
|
184
|
+
}
|
|
185
|
+
const x = (e) => (...t) => {
|
|
186
|
+
throw Error(`Headers are frozen (${e} ${t.join(`, `)})`);
|
|
187
|
+
};
|
|
188
|
+
var S = class extends Headers {
|
|
189
|
+
set = x(`set`);
|
|
190
|
+
append = x(`append`);
|
|
191
|
+
delete = x(`delete`);
|
|
192
|
+
};
|
|
193
|
+
const C = new S({ "content-length": `0` }), w = new S({ "content-type": `application/json;charset=UTF-8` });
|
|
194
|
+
function T(e, t, n) {
|
|
195
|
+
if (e == null) return {
|
|
196
|
+
body: ``,
|
|
197
|
+
headers: C
|
|
198
|
+
};
|
|
199
|
+
let r = typeof e;
|
|
200
|
+
if (r === `string`) return { body: e };
|
|
201
|
+
if (e instanceof Uint8Array) return t.res.headers.set(`content-length`, e.byteLength.toString()), { body: e };
|
|
202
|
+
if (e instanceof v || e?.constructor?.name === `HTTPResponse`) return e;
|
|
203
|
+
if (m(e, r)) return {
|
|
204
|
+
body: JSON.stringify(e, void 0, n.debug ? 2 : void 0),
|
|
205
|
+
headers: w
|
|
206
|
+
};
|
|
207
|
+
if (r === `bigint`) return {
|
|
208
|
+
body: e.toString(),
|
|
209
|
+
headers: w
|
|
210
|
+
};
|
|
211
|
+
if (e instanceof Blob) {
|
|
212
|
+
let t = new Headers({
|
|
213
|
+
"content-type": e.type,
|
|
214
|
+
"content-length": e.size.toString()
|
|
215
|
+
}), n = e.name;
|
|
216
|
+
return n && (n = encodeURIComponent(n), t.set(`content-disposition`, `filename="${n}"; filename*=UTF-8''${n}`)), {
|
|
217
|
+
body: e.stream(),
|
|
218
|
+
headers: t
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
return r === `symbol` ? { body: e.toString() } : r === `function` ? { body: `${e.name}()` } : { body: e };
|
|
222
|
+
}
|
|
223
|
+
function E(e, t) {
|
|
224
|
+
return e === `HEAD` || t === 100 || t === 101 || t === 102 || t === 204 || t === 205 || t === 304;
|
|
225
|
+
}
|
|
226
|
+
function D(t, n, r) {
|
|
227
|
+
let i = t.headers ? b(w, t.headers) : new Headers(w);
|
|
228
|
+
return r && (i = b(i, r)), new e(JSON.stringify({
|
|
229
|
+
...t.toJSON(),
|
|
230
|
+
stack: n && t.stack ? t.stack.split(`
|
|
231
|
+
`).map((e) => e.trim()) : void 0
|
|
232
|
+
}, void 0, n ? 2 : void 0), {
|
|
233
|
+
status: t.status,
|
|
234
|
+
statusText: t.statusText,
|
|
235
|
+
headers: i
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function O(e, t, n, r = 0) {
|
|
239
|
+
if (r === t.length) return n(e);
|
|
240
|
+
let i = t[r], a, o, s = () => a ? o : (a = !0, o = O(e, t, n, r + 1), o), c = i(e, s);
|
|
241
|
+
return k(c) ? s() : typeof c?.then == `function` ? c.then((e) => k(e) ? s() : e) : c;
|
|
242
|
+
}
|
|
243
|
+
function k(e) {
|
|
244
|
+
return e === void 0 || e === h;
|
|
245
|
+
}
|
|
246
|
+
function A(e) {
|
|
247
|
+
if (typeof e == `function`) return j(e);
|
|
248
|
+
let t = e.handler || (e.fetch ? function(t) {
|
|
249
|
+
return e.fetch(t.req);
|
|
250
|
+
} : M);
|
|
251
|
+
return Object.assign(j(e.middleware?.length ? function(n) {
|
|
252
|
+
return O(n, e.middleware, t);
|
|
253
|
+
} : t), e);
|
|
254
|
+
}
|
|
255
|
+
function j(e) {
|
|
256
|
+
return `fetch` in e ? e : Object.assign(e, { fetch: (t) => {
|
|
257
|
+
typeof t == `string` && (t = new URL(t, `http://_`)), t instanceof URL && (t = new Request(t));
|
|
258
|
+
let n = new c(t);
|
|
259
|
+
try {
|
|
260
|
+
return Promise.resolve(_(e(n), n));
|
|
261
|
+
} catch (e) {
|
|
262
|
+
return Promise.resolve(_(e, n));
|
|
263
|
+
}
|
|
264
|
+
} });
|
|
265
|
+
}
|
|
266
|
+
const M = () => h, N = A;
|
|
267
|
+
export { p as HTTPError, N as defineEventHandler };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type e = {
|
|
2
|
+
images?: Omit<e, "images">[];
|
|
3
|
+
width: number | undefined;
|
|
4
|
+
height: number | undefined;
|
|
5
|
+
orientation?: number;
|
|
6
|
+
type?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @param {Uint8Array|string} input - Uint8Array or relative/absolute path of the image file
|
|
10
|
+
* @param {Function=} [callback] - optional function for async detection
|
|
11
|
+
*/
|
|
12
|
+
export type { e as ImageMeta };
|