create-x4 1.0.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.
@@ -0,0 +1,180 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "node:module";
3
+ const require = __createRequire(import.meta.url);
4
+ import {
5
+ require_node,
6
+ require_node_fetch_native_DhEqb06g
7
+ } from "./chunk-SXUTSSIX.mjs";
8
+ import {
9
+ __commonJS,
10
+ __require
11
+ } from "./chunk-VL4BT7E7.mjs";
12
+
13
+ // node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs
14
+ var require_multipart_parser = __commonJS({
15
+ "node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs"(exports) {
16
+ var y = Object.defineProperty;
17
+ var c = (R, o) => y(R, "name", { value: o, configurable: true });
18
+ var node = require_node();
19
+ __require("http"), __require("https"), __require("zlib"), __require("stream"), __require("buffer"), __require("util"), require_node_fetch_native_DhEqb06g(), __require("url"), __require("net"), __require("fs"), __require("path");
20
+ var s = 0;
21
+ var S = { START_BOUNDARY: s++, HEADER_FIELD_START: s++, HEADER_FIELD: s++, HEADER_VALUE_START: s++, HEADER_VALUE: s++, HEADER_VALUE_ALMOST_DONE: s++, HEADERS_ALMOST_DONE: s++, PART_DATA_START: s++, PART_DATA: s++, END: s++ };
22
+ var f = 1;
23
+ var F = { PART_BOUNDARY: f, LAST_BOUNDARY: f *= 2 };
24
+ var LF = 10;
25
+ var CR = 13;
26
+ var SPACE = 32;
27
+ var HYPHEN = 45;
28
+ var COLON = 58;
29
+ var A = 97;
30
+ var Z = 122;
31
+ var lower = c((R) => R | 32, "lower");
32
+ var noop = c(() => {
33
+ }, "noop");
34
+ var g = class g {
35
+ constructor(o) {
36
+ this.index = 0, this.flags = 0, this.onHeaderEnd = noop, this.onHeaderField = noop, this.onHeadersEnd = noop, this.onHeaderValue = noop, this.onPartBegin = noop, this.onPartData = noop, this.onPartEnd = noop, this.boundaryChars = {}, o = `\r
37
+ --` + o;
38
+ const t = new Uint8Array(o.length);
39
+ for (let n = 0; n < o.length; n++) t[n] = o.charCodeAt(n), this.boundaryChars[t[n]] = true;
40
+ this.boundary = t, this.lookbehind = new Uint8Array(this.boundary.length + 8), this.state = S.START_BOUNDARY;
41
+ }
42
+ write(o) {
43
+ let t = 0;
44
+ const n = o.length;
45
+ let E = this.index, { lookbehind: l, boundary: h, boundaryChars: H, index: e, state: a, flags: d } = this;
46
+ const b = this.boundary.length, m = b - 1, O = o.length;
47
+ let r, P;
48
+ const u = c((D) => {
49
+ this[D + "Mark"] = t;
50
+ }, "mark"), i = c((D) => {
51
+ delete this[D + "Mark"];
52
+ }, "clear"), T = c((D, p, _, N) => {
53
+ (p === void 0 || p !== _) && this[D](N && N.subarray(p, _));
54
+ }, "callback"), L = c((D, p) => {
55
+ const _ = D + "Mark";
56
+ _ in this && (p ? (T(D, this[_], t, o), delete this[_]) : (T(D, this[_], o.length, o), this[_] = 0));
57
+ }, "dataCallback");
58
+ for (t = 0; t < n; t++) switch (r = o[t], a) {
59
+ case S.START_BOUNDARY:
60
+ if (e === h.length - 2) {
61
+ if (r === HYPHEN) d |= F.LAST_BOUNDARY;
62
+ else if (r !== CR) return;
63
+ e++;
64
+ break;
65
+ } else if (e - 1 === h.length - 2) {
66
+ if (d & F.LAST_BOUNDARY && r === HYPHEN) a = S.END, d = 0;
67
+ else if (!(d & F.LAST_BOUNDARY) && r === LF) e = 0, T("onPartBegin"), a = S.HEADER_FIELD_START;
68
+ else return;
69
+ break;
70
+ }
71
+ r !== h[e + 2] && (e = -2), r === h[e + 2] && e++;
72
+ break;
73
+ case S.HEADER_FIELD_START:
74
+ a = S.HEADER_FIELD, u("onHeaderField"), e = 0;
75
+ case S.HEADER_FIELD:
76
+ if (r === CR) {
77
+ i("onHeaderField"), a = S.HEADERS_ALMOST_DONE;
78
+ break;
79
+ }
80
+ if (e++, r === HYPHEN) break;
81
+ if (r === COLON) {
82
+ if (e === 1) return;
83
+ L("onHeaderField", true), a = S.HEADER_VALUE_START;
84
+ break;
85
+ }
86
+ if (P = lower(r), P < A || P > Z) return;
87
+ break;
88
+ case S.HEADER_VALUE_START:
89
+ if (r === SPACE) break;
90
+ u("onHeaderValue"), a = S.HEADER_VALUE;
91
+ case S.HEADER_VALUE:
92
+ r === CR && (L("onHeaderValue", true), T("onHeaderEnd"), a = S.HEADER_VALUE_ALMOST_DONE);
93
+ break;
94
+ case S.HEADER_VALUE_ALMOST_DONE:
95
+ if (r !== LF) return;
96
+ a = S.HEADER_FIELD_START;
97
+ break;
98
+ case S.HEADERS_ALMOST_DONE:
99
+ if (r !== LF) return;
100
+ T("onHeadersEnd"), a = S.PART_DATA_START;
101
+ break;
102
+ case S.PART_DATA_START:
103
+ a = S.PART_DATA, u("onPartData");
104
+ case S.PART_DATA:
105
+ if (E = e, e === 0) {
106
+ for (t += m; t < O && !(o[t] in H); ) t += b;
107
+ t -= m, r = o[t];
108
+ }
109
+ if (e < h.length) h[e] === r ? (e === 0 && L("onPartData", true), e++) : e = 0;
110
+ else if (e === h.length) e++, r === CR ? d |= F.PART_BOUNDARY : r === HYPHEN ? d |= F.LAST_BOUNDARY : e = 0;
111
+ else if (e - 1 === h.length) if (d & F.PART_BOUNDARY) {
112
+ if (e = 0, r === LF) {
113
+ d &= ~F.PART_BOUNDARY, T("onPartEnd"), T("onPartBegin"), a = S.HEADER_FIELD_START;
114
+ break;
115
+ }
116
+ } else d & F.LAST_BOUNDARY && r === HYPHEN ? (T("onPartEnd"), a = S.END, d = 0) : e = 0;
117
+ if (e > 0) l[e - 1] = r;
118
+ else if (E > 0) {
119
+ const D = new Uint8Array(l.buffer, l.byteOffset, l.byteLength);
120
+ T("onPartData", 0, E, D), E = 0, u("onPartData"), t--;
121
+ }
122
+ break;
123
+ case S.END:
124
+ break;
125
+ default:
126
+ throw new Error(`Unexpected state entered: ${a}`);
127
+ }
128
+ L("onHeaderField"), L("onHeaderValue"), L("onPartData"), this.index = e, this.state = a, this.flags = d;
129
+ }
130
+ end() {
131
+ if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) this.onPartEnd();
132
+ else if (this.state !== S.END) throw new Error("MultipartParser.end(): stream ended unexpectedly");
133
+ }
134
+ };
135
+ c(g, "MultipartParser");
136
+ var MultipartParser = g;
137
+ function _fileName(R) {
138
+ const o = R.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
139
+ if (!o) return;
140
+ const t = o[2] || o[3] || "";
141
+ let n = t.slice(t.lastIndexOf("\\") + 1);
142
+ return n = n.replace(/%22/g, '"'), n = n.replace(/&#(\d{4});/g, (E, l) => String.fromCharCode(l)), n;
143
+ }
144
+ c(_fileName, "_fileName");
145
+ async function toFormData(R, o) {
146
+ if (!/multipart/i.test(o)) throw new TypeError("Failed to fetch");
147
+ const t = o.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
148
+ if (!t) throw new TypeError("no or bad content-type header, no multipart boundary");
149
+ const n = new MultipartParser(t[1] || t[2]);
150
+ let E, l, h, H, e, a;
151
+ const d = [], b = new node.FormData(), m = c((i) => {
152
+ h += u.decode(i, { stream: true });
153
+ }, "onPartData"), O = c((i) => {
154
+ d.push(i);
155
+ }, "appendToFile"), r = c(() => {
156
+ const i = new node.File(d, a, { type: e });
157
+ b.append(H, i);
158
+ }, "appendFileToFormData"), P = c(() => {
159
+ b.append(H, h);
160
+ }, "appendEntryToFormData"), u = new TextDecoder("utf-8");
161
+ u.decode(), n.onPartBegin = function() {
162
+ n.onPartData = m, n.onPartEnd = P, E = "", l = "", h = "", H = "", e = "", a = null, d.length = 0;
163
+ }, n.onHeaderField = function(i) {
164
+ E += u.decode(i, { stream: true });
165
+ }, n.onHeaderValue = function(i) {
166
+ l += u.decode(i, { stream: true });
167
+ }, n.onHeaderEnd = function() {
168
+ if (l += u.decode(), E = E.toLowerCase(), E === "content-disposition") {
169
+ const i = l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
170
+ i && (H = i[2] || i[3] || ""), a = _fileName(l), a && (n.onPartData = O, n.onPartEnd = r);
171
+ } else E === "content-type" && (e = l);
172
+ l = "", E = "";
173
+ };
174
+ for await (const i of R) n.write(i);
175
+ return n.end(), b;
176
+ }
177
+ c(toFormData, "toFormData"), exports.toFormData = toFormData;
178
+ }
179
+ });
180
+ export default require_multipart_parser();
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "node:module";
3
+ const require = __createRequire(import.meta.url);
4
+ import {
5
+ PRESETS,
6
+ PRESET_NAMES
7
+ } from "./chunk-YI5RU5DZ.mjs";
8
+ import "./chunk-VL4BT7E7.mjs";
9
+ export {
10
+ PRESETS,
11
+ PRESET_NAMES
12
+ };