squalid-singularity 0.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/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +11 -0
- package/.wrangler/tmp/pages-pHhhPx/_routes-0.7693472831665579.json +9 -0
- package/.wrangler/tmp/pages-pHhhPx/functions-filepath-routing-config-0.7436749681606077.json +21 -0
- package/.wrangler/tmp/pages-pHhhPx/functionsRoutes-0.14872757927825653.mjs +19 -0
- package/.wrangler/tmp/pages-pHhhPx/functionsWorker-0.7091847872345003.js +491 -0
- package/.wrangler/tmp/pages-yKW4pG/_routes-0.6780167228686584.json +9 -0
- package/.wrangler/tmp/pages-yKW4pG/functions-filepath-routing-config-0.6268818876758142.json +21 -0
- package/.wrangler/tmp/pages-yKW4pG/functionsRoutes-0.016215448179317304.mjs +19 -0
- package/.wrangler/tmp/pages-yKW4pG/functionsWorker-0.29714428274758986.js +491 -0
- package/README.md +43 -0
- package/astro.config.mjs +26 -0
- package/functions/agent/[[path]].ts +9 -0
- package/functions/starlight/[[path]].ts +9 -0
- package/functions/task/[[path]].ts +9 -0
- package/index.html.bak +1755 -0
- package/package.json +24 -0
- package/public/_redirects +1 -0
- package/public/art/hero.webp +0 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +5 -0
- package/public/images/generated/01-red-cube-editorial.png +0 -0
- package/public/images/generated/02-hero-network.png +0 -0
- package/public/images/generated/03-protocol-vault.png +0 -0
- package/public/images/generated/04-token-flow.png +0 -0
- package/public/images/generated/05-how-escrow.png +0 -0
- package/public/images/generated/06-agent-robot.png +0 -0
- package/public/images/generated/video-final/music-v1.mp3 +0 -0
- package/public/images/generated/video-final/music.mp3 +0 -0
- package/public/images/hero-bg.png +0 -0
- package/public/images/hero-bg.webp +0 -0
- package/public/logo-white-bg.png +0 -0
- package/public/logo-white-bg.svg +5 -0
- package/public/logo-white.png +0 -0
- package/public/logo-white.svg +4 -0
- package/public/logo.png +0 -0
- package/public/og/agents.png +0 -0
- package/public/og/blog-final-chapter.png +0 -0
- package/public/og/blog-mandate-vs-virtuals.png +0 -0
- package/public/og/blog.png +0 -0
- package/public/og/dashboard.png +0 -0
- package/public/og/docs.png +0 -0
- package/public/og/home.png +0 -0
- package/public/og/how.png +0 -0
- package/public/og/leaderboard.png +0 -0
- package/public/og/protocol.png +0 -0
- package/public/og/tasks.png +0 -0
- package/public/og/token.png +0 -0
- package/public/og/updates.png +0 -0
- package/public/skill.md +427 -0
- package/public/skills/conway.md +311 -0
- package/public/twitter-header.png +0 -0
- package/public/twitter-header.svg +51 -0
- package/src/components/AgentGridCard.astro +99 -0
- package/src/components/AgentRow.astro +57 -0
- package/src/components/ColorBends.tsx +306 -0
- package/src/components/Footer.astro +45 -0
- package/src/components/GigCard.astro +36 -0
- package/src/components/Navbar.astro +244 -0
- package/src/components/ReviewCard.astro +29 -0
- package/src/components/SkillPill.astro +19 -0
- package/src/components/StarlightChat.tsx +359 -0
- package/src/components/StatusBadge.astro +28 -0
- package/src/components/TaskEntry.astro +98 -0
- package/src/layouts/Layout.astro +233 -0
- package/src/lib/api.ts +365 -0
- package/src/pages/404.astro +33 -0
- package/src/pages/admin.astro +495 -0
- package/src/pages/agent/[...id].astro +1055 -0
- package/src/pages/agents/index.astro +309 -0
- package/src/pages/blog/conway-automaton.astro +192 -0
- package/src/pages/blog/index.astro +49 -0
- package/src/pages/blog/mandate-vs-virtuals.astro +542 -0
- package/src/pages/blog/the-final-chapter.astro +329 -0
- package/src/pages/bounties/index.astro +260 -0
- package/src/pages/dashboard.astro +364 -0
- package/src/pages/docs.astro +220 -0
- package/src/pages/gigs/index.astro +215 -0
- package/src/pages/how.astro +172 -0
- package/src/pages/index.astro +513 -0
- package/src/pages/leaderboard.astro +228 -0
- package/src/pages/og/home.astro +65 -0
- package/src/pages/protocol/stats.astro +845 -0
- package/src/pages/protocol.astro +422 -0
- package/src/pages/starlight.astro +13 -0
- package/src/pages/task/[...id].astro +1656 -0
- package/src/pages/tasks.astro +12 -0
- package/src/pages/terms.astro +133 -0
- package/src/pages/token.astro +268 -0
- package/src/pages/updates.astro +180 -0
- package/src/styles/global.css +128 -0
- package/tailwind.config.mjs +51 -0
- package/tsconfig.json +14 -0
- package/wrangler.toml +5 -0
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// agent/[[path]].ts
|
|
5
|
+
var onRequest = /* @__PURE__ */ __name(async (context) => {
|
|
6
|
+
const url = new URL(context.request.url);
|
|
7
|
+
url.pathname = "/agent/index.html";
|
|
8
|
+
const asset = await context.env.ASSETS.fetch(url.toString());
|
|
9
|
+
return new Response(asset.body, {
|
|
10
|
+
status: 200,
|
|
11
|
+
headers: { "content-type": "text/html; charset=utf-8" }
|
|
12
|
+
});
|
|
13
|
+
}, "onRequest");
|
|
14
|
+
|
|
15
|
+
// task/[[path]].ts
|
|
16
|
+
var onRequest2 = /* @__PURE__ */ __name(async (context) => {
|
|
17
|
+
const url = new URL(context.request.url);
|
|
18
|
+
url.pathname = "/task/index.html";
|
|
19
|
+
const asset = await context.env.ASSETS.fetch(url.toString());
|
|
20
|
+
return new Response(asset.body, {
|
|
21
|
+
status: 200,
|
|
22
|
+
headers: { "content-type": "text/html; charset=utf-8" }
|
|
23
|
+
});
|
|
24
|
+
}, "onRequest");
|
|
25
|
+
|
|
26
|
+
// ../.wrangler/tmp/pages-yKW4pG/functionsRoutes-0.016215448179317304.mjs
|
|
27
|
+
var routes = [
|
|
28
|
+
{
|
|
29
|
+
routePath: "/agent/:path*",
|
|
30
|
+
mountPath: "/agent",
|
|
31
|
+
method: "",
|
|
32
|
+
middlewares: [],
|
|
33
|
+
modules: [onRequest]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
routePath: "/task/:path*",
|
|
37
|
+
mountPath: "/task",
|
|
38
|
+
method: "",
|
|
39
|
+
middlewares: [],
|
|
40
|
+
modules: [onRequest2]
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
// ../../../../../../opt/homebrew/lib/node_modules/wrangler/node_modules/path-to-regexp/dist.es2015/index.js
|
|
45
|
+
function lexer(str) {
|
|
46
|
+
var tokens = [];
|
|
47
|
+
var i = 0;
|
|
48
|
+
while (i < str.length) {
|
|
49
|
+
var char = str[i];
|
|
50
|
+
if (char === "*" || char === "+" || char === "?") {
|
|
51
|
+
tokens.push({ type: "MODIFIER", index: i, value: str[i++] });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (char === "\\") {
|
|
55
|
+
tokens.push({ type: "ESCAPED_CHAR", index: i++, value: str[i++] });
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (char === "{") {
|
|
59
|
+
tokens.push({ type: "OPEN", index: i, value: str[i++] });
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (char === "}") {
|
|
63
|
+
tokens.push({ type: "CLOSE", index: i, value: str[i++] });
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (char === ":") {
|
|
67
|
+
var name = "";
|
|
68
|
+
var j = i + 1;
|
|
69
|
+
while (j < str.length) {
|
|
70
|
+
var code = str.charCodeAt(j);
|
|
71
|
+
if (
|
|
72
|
+
// `0-9`
|
|
73
|
+
code >= 48 && code <= 57 || // `A-Z`
|
|
74
|
+
code >= 65 && code <= 90 || // `a-z`
|
|
75
|
+
code >= 97 && code <= 122 || // `_`
|
|
76
|
+
code === 95
|
|
77
|
+
) {
|
|
78
|
+
name += str[j++];
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
if (!name)
|
|
84
|
+
throw new TypeError("Missing parameter name at ".concat(i));
|
|
85
|
+
tokens.push({ type: "NAME", index: i, value: name });
|
|
86
|
+
i = j;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (char === "(") {
|
|
90
|
+
var count = 1;
|
|
91
|
+
var pattern = "";
|
|
92
|
+
var j = i + 1;
|
|
93
|
+
if (str[j] === "?") {
|
|
94
|
+
throw new TypeError('Pattern cannot start with "?" at '.concat(j));
|
|
95
|
+
}
|
|
96
|
+
while (j < str.length) {
|
|
97
|
+
if (str[j] === "\\") {
|
|
98
|
+
pattern += str[j++] + str[j++];
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (str[j] === ")") {
|
|
102
|
+
count--;
|
|
103
|
+
if (count === 0) {
|
|
104
|
+
j++;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
} else if (str[j] === "(") {
|
|
108
|
+
count++;
|
|
109
|
+
if (str[j + 1] !== "?") {
|
|
110
|
+
throw new TypeError("Capturing groups are not allowed at ".concat(j));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
pattern += str[j++];
|
|
114
|
+
}
|
|
115
|
+
if (count)
|
|
116
|
+
throw new TypeError("Unbalanced pattern at ".concat(i));
|
|
117
|
+
if (!pattern)
|
|
118
|
+
throw new TypeError("Missing pattern at ".concat(i));
|
|
119
|
+
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
|
120
|
+
i = j;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
tokens.push({ type: "CHAR", index: i, value: str[i++] });
|
|
124
|
+
}
|
|
125
|
+
tokens.push({ type: "END", index: i, value: "" });
|
|
126
|
+
return tokens;
|
|
127
|
+
}
|
|
128
|
+
__name(lexer, "lexer");
|
|
129
|
+
function parse(str, options) {
|
|
130
|
+
if (options === void 0) {
|
|
131
|
+
options = {};
|
|
132
|
+
}
|
|
133
|
+
var tokens = lexer(str);
|
|
134
|
+
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b;
|
|
135
|
+
var result = [];
|
|
136
|
+
var key = 0;
|
|
137
|
+
var i = 0;
|
|
138
|
+
var path = "";
|
|
139
|
+
var tryConsume = /* @__PURE__ */ __name(function(type) {
|
|
140
|
+
if (i < tokens.length && tokens[i].type === type)
|
|
141
|
+
return tokens[i++].value;
|
|
142
|
+
}, "tryConsume");
|
|
143
|
+
var mustConsume = /* @__PURE__ */ __name(function(type) {
|
|
144
|
+
var value2 = tryConsume(type);
|
|
145
|
+
if (value2 !== void 0)
|
|
146
|
+
return value2;
|
|
147
|
+
var _a2 = tokens[i], nextType = _a2.type, index = _a2.index;
|
|
148
|
+
throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
|
|
149
|
+
}, "mustConsume");
|
|
150
|
+
var consumeText = /* @__PURE__ */ __name(function() {
|
|
151
|
+
var result2 = "";
|
|
152
|
+
var value2;
|
|
153
|
+
while (value2 = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR")) {
|
|
154
|
+
result2 += value2;
|
|
155
|
+
}
|
|
156
|
+
return result2;
|
|
157
|
+
}, "consumeText");
|
|
158
|
+
var isSafe = /* @__PURE__ */ __name(function(value2) {
|
|
159
|
+
for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {
|
|
160
|
+
var char2 = delimiter_1[_i];
|
|
161
|
+
if (value2.indexOf(char2) > -1)
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
}, "isSafe");
|
|
166
|
+
var safePattern = /* @__PURE__ */ __name(function(prefix2) {
|
|
167
|
+
var prev = result[result.length - 1];
|
|
168
|
+
var prevText = prefix2 || (prev && typeof prev === "string" ? prev : "");
|
|
169
|
+
if (prev && !prevText) {
|
|
170
|
+
throw new TypeError('Must have text between two parameters, missing text after "'.concat(prev.name, '"'));
|
|
171
|
+
}
|
|
172
|
+
if (!prevText || isSafe(prevText))
|
|
173
|
+
return "[^".concat(escapeString(delimiter), "]+?");
|
|
174
|
+
return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?");
|
|
175
|
+
}, "safePattern");
|
|
176
|
+
while (i < tokens.length) {
|
|
177
|
+
var char = tryConsume("CHAR");
|
|
178
|
+
var name = tryConsume("NAME");
|
|
179
|
+
var pattern = tryConsume("PATTERN");
|
|
180
|
+
if (name || pattern) {
|
|
181
|
+
var prefix = char || "";
|
|
182
|
+
if (prefixes.indexOf(prefix) === -1) {
|
|
183
|
+
path += prefix;
|
|
184
|
+
prefix = "";
|
|
185
|
+
}
|
|
186
|
+
if (path) {
|
|
187
|
+
result.push(path);
|
|
188
|
+
path = "";
|
|
189
|
+
}
|
|
190
|
+
result.push({
|
|
191
|
+
name: name || key++,
|
|
192
|
+
prefix,
|
|
193
|
+
suffix: "",
|
|
194
|
+
pattern: pattern || safePattern(prefix),
|
|
195
|
+
modifier: tryConsume("MODIFIER") || ""
|
|
196
|
+
});
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
var value = char || tryConsume("ESCAPED_CHAR");
|
|
200
|
+
if (value) {
|
|
201
|
+
path += value;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (path) {
|
|
205
|
+
result.push(path);
|
|
206
|
+
path = "";
|
|
207
|
+
}
|
|
208
|
+
var open = tryConsume("OPEN");
|
|
209
|
+
if (open) {
|
|
210
|
+
var prefix = consumeText();
|
|
211
|
+
var name_1 = tryConsume("NAME") || "";
|
|
212
|
+
var pattern_1 = tryConsume("PATTERN") || "";
|
|
213
|
+
var suffix = consumeText();
|
|
214
|
+
mustConsume("CLOSE");
|
|
215
|
+
result.push({
|
|
216
|
+
name: name_1 || (pattern_1 ? key++ : ""),
|
|
217
|
+
pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,
|
|
218
|
+
prefix,
|
|
219
|
+
suffix,
|
|
220
|
+
modifier: tryConsume("MODIFIER") || ""
|
|
221
|
+
});
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
mustConsume("END");
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
__name(parse, "parse");
|
|
229
|
+
function match(str, options) {
|
|
230
|
+
var keys = [];
|
|
231
|
+
var re = pathToRegexp(str, keys, options);
|
|
232
|
+
return regexpToFunction(re, keys, options);
|
|
233
|
+
}
|
|
234
|
+
__name(match, "match");
|
|
235
|
+
function regexpToFunction(re, keys, options) {
|
|
236
|
+
if (options === void 0) {
|
|
237
|
+
options = {};
|
|
238
|
+
}
|
|
239
|
+
var _a = options.decode, decode = _a === void 0 ? function(x) {
|
|
240
|
+
return x;
|
|
241
|
+
} : _a;
|
|
242
|
+
return function(pathname) {
|
|
243
|
+
var m = re.exec(pathname);
|
|
244
|
+
if (!m)
|
|
245
|
+
return false;
|
|
246
|
+
var path = m[0], index = m.index;
|
|
247
|
+
var params = /* @__PURE__ */ Object.create(null);
|
|
248
|
+
var _loop_1 = /* @__PURE__ */ __name(function(i2) {
|
|
249
|
+
if (m[i2] === void 0)
|
|
250
|
+
return "continue";
|
|
251
|
+
var key = keys[i2 - 1];
|
|
252
|
+
if (key.modifier === "*" || key.modifier === "+") {
|
|
253
|
+
params[key.name] = m[i2].split(key.prefix + key.suffix).map(function(value) {
|
|
254
|
+
return decode(value, key);
|
|
255
|
+
});
|
|
256
|
+
} else {
|
|
257
|
+
params[key.name] = decode(m[i2], key);
|
|
258
|
+
}
|
|
259
|
+
}, "_loop_1");
|
|
260
|
+
for (var i = 1; i < m.length; i++) {
|
|
261
|
+
_loop_1(i);
|
|
262
|
+
}
|
|
263
|
+
return { path, index, params };
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
__name(regexpToFunction, "regexpToFunction");
|
|
267
|
+
function escapeString(str) {
|
|
268
|
+
return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
269
|
+
}
|
|
270
|
+
__name(escapeString, "escapeString");
|
|
271
|
+
function flags(options) {
|
|
272
|
+
return options && options.sensitive ? "" : "i";
|
|
273
|
+
}
|
|
274
|
+
__name(flags, "flags");
|
|
275
|
+
function regexpToRegexp(path, keys) {
|
|
276
|
+
if (!keys)
|
|
277
|
+
return path;
|
|
278
|
+
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
279
|
+
var index = 0;
|
|
280
|
+
var execResult = groupsRegex.exec(path.source);
|
|
281
|
+
while (execResult) {
|
|
282
|
+
keys.push({
|
|
283
|
+
// Use parenthesized substring match if available, index otherwise
|
|
284
|
+
name: execResult[1] || index++,
|
|
285
|
+
prefix: "",
|
|
286
|
+
suffix: "",
|
|
287
|
+
modifier: "",
|
|
288
|
+
pattern: ""
|
|
289
|
+
});
|
|
290
|
+
execResult = groupsRegex.exec(path.source);
|
|
291
|
+
}
|
|
292
|
+
return path;
|
|
293
|
+
}
|
|
294
|
+
__name(regexpToRegexp, "regexpToRegexp");
|
|
295
|
+
function arrayToRegexp(paths, keys, options) {
|
|
296
|
+
var parts = paths.map(function(path) {
|
|
297
|
+
return pathToRegexp(path, keys, options).source;
|
|
298
|
+
});
|
|
299
|
+
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
|
|
300
|
+
}
|
|
301
|
+
__name(arrayToRegexp, "arrayToRegexp");
|
|
302
|
+
function stringToRegexp(path, keys, options) {
|
|
303
|
+
return tokensToRegexp(parse(path, options), keys, options);
|
|
304
|
+
}
|
|
305
|
+
__name(stringToRegexp, "stringToRegexp");
|
|
306
|
+
function tokensToRegexp(tokens, keys, options) {
|
|
307
|
+
if (options === void 0) {
|
|
308
|
+
options = {};
|
|
309
|
+
}
|
|
310
|
+
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function(x) {
|
|
311
|
+
return x;
|
|
312
|
+
} : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
|
|
313
|
+
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
|
|
314
|
+
var delimiterRe = "[".concat(escapeString(delimiter), "]");
|
|
315
|
+
var route = start ? "^" : "";
|
|
316
|
+
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
317
|
+
var token = tokens_1[_i];
|
|
318
|
+
if (typeof token === "string") {
|
|
319
|
+
route += escapeString(encode(token));
|
|
320
|
+
} else {
|
|
321
|
+
var prefix = escapeString(encode(token.prefix));
|
|
322
|
+
var suffix = escapeString(encode(token.suffix));
|
|
323
|
+
if (token.pattern) {
|
|
324
|
+
if (keys)
|
|
325
|
+
keys.push(token);
|
|
326
|
+
if (prefix || suffix) {
|
|
327
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
328
|
+
var mod = token.modifier === "*" ? "?" : "";
|
|
329
|
+
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
|
|
330
|
+
} else {
|
|
331
|
+
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
335
|
+
throw new TypeError('Can not repeat "'.concat(token.name, '" without a prefix and suffix'));
|
|
336
|
+
}
|
|
337
|
+
route += "(".concat(token.pattern, ")").concat(token.modifier);
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (end) {
|
|
345
|
+
if (!strict)
|
|
346
|
+
route += "".concat(delimiterRe, "?");
|
|
347
|
+
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
|
|
348
|
+
} else {
|
|
349
|
+
var endToken = tokens[tokens.length - 1];
|
|
350
|
+
var isEndDelimited = typeof endToken === "string" ? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1 : endToken === void 0;
|
|
351
|
+
if (!strict) {
|
|
352
|
+
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
|
|
353
|
+
}
|
|
354
|
+
if (!isEndDelimited) {
|
|
355
|
+
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return new RegExp(route, flags(options));
|
|
359
|
+
}
|
|
360
|
+
__name(tokensToRegexp, "tokensToRegexp");
|
|
361
|
+
function pathToRegexp(path, keys, options) {
|
|
362
|
+
if (path instanceof RegExp)
|
|
363
|
+
return regexpToRegexp(path, keys);
|
|
364
|
+
if (Array.isArray(path))
|
|
365
|
+
return arrayToRegexp(path, keys, options);
|
|
366
|
+
return stringToRegexp(path, keys, options);
|
|
367
|
+
}
|
|
368
|
+
__name(pathToRegexp, "pathToRegexp");
|
|
369
|
+
|
|
370
|
+
// ../../../../../../opt/homebrew/lib/node_modules/wrangler/templates/pages-template-worker.ts
|
|
371
|
+
var escapeRegex = /[.+?^${}()|[\]\\]/g;
|
|
372
|
+
function* executeRequest(request) {
|
|
373
|
+
const requestPath = new URL(request.url).pathname;
|
|
374
|
+
for (const route of [...routes].reverse()) {
|
|
375
|
+
if (route.method && route.method !== request.method) {
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
const routeMatcher = match(route.routePath.replace(escapeRegex, "\\$&"), {
|
|
379
|
+
end: false
|
|
380
|
+
});
|
|
381
|
+
const mountMatcher = match(route.mountPath.replace(escapeRegex, "\\$&"), {
|
|
382
|
+
end: false
|
|
383
|
+
});
|
|
384
|
+
const matchResult = routeMatcher(requestPath);
|
|
385
|
+
const mountMatchResult = mountMatcher(requestPath);
|
|
386
|
+
if (matchResult && mountMatchResult) {
|
|
387
|
+
for (const handler of route.middlewares.flat()) {
|
|
388
|
+
yield {
|
|
389
|
+
handler,
|
|
390
|
+
params: matchResult.params,
|
|
391
|
+
path: mountMatchResult.path
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
for (const route of routes) {
|
|
397
|
+
if (route.method && route.method !== request.method) {
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
const routeMatcher = match(route.routePath.replace(escapeRegex, "\\$&"), {
|
|
401
|
+
end: true
|
|
402
|
+
});
|
|
403
|
+
const mountMatcher = match(route.mountPath.replace(escapeRegex, "\\$&"), {
|
|
404
|
+
end: false
|
|
405
|
+
});
|
|
406
|
+
const matchResult = routeMatcher(requestPath);
|
|
407
|
+
const mountMatchResult = mountMatcher(requestPath);
|
|
408
|
+
if (matchResult && mountMatchResult && route.modules.length) {
|
|
409
|
+
for (const handler of route.modules.flat()) {
|
|
410
|
+
yield {
|
|
411
|
+
handler,
|
|
412
|
+
params: matchResult.params,
|
|
413
|
+
path: matchResult.path
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
__name(executeRequest, "executeRequest");
|
|
421
|
+
var pages_template_worker_default = {
|
|
422
|
+
async fetch(originalRequest, env, workerContext) {
|
|
423
|
+
let request = originalRequest;
|
|
424
|
+
const handlerIterator = executeRequest(request);
|
|
425
|
+
let data = {};
|
|
426
|
+
let isFailOpen = false;
|
|
427
|
+
const next = /* @__PURE__ */ __name(async (input, init) => {
|
|
428
|
+
if (input !== void 0) {
|
|
429
|
+
let url = input;
|
|
430
|
+
if (typeof input === "string") {
|
|
431
|
+
url = new URL(input, request.url).toString();
|
|
432
|
+
}
|
|
433
|
+
request = new Request(url, init);
|
|
434
|
+
}
|
|
435
|
+
const result = handlerIterator.next();
|
|
436
|
+
if (result.done === false) {
|
|
437
|
+
const { handler, params, path } = result.value;
|
|
438
|
+
const context = {
|
|
439
|
+
request: new Request(request.clone()),
|
|
440
|
+
functionPath: path,
|
|
441
|
+
next,
|
|
442
|
+
params,
|
|
443
|
+
get data() {
|
|
444
|
+
return data;
|
|
445
|
+
},
|
|
446
|
+
set data(value) {
|
|
447
|
+
if (typeof value !== "object" || value === null) {
|
|
448
|
+
throw new Error("context.data must be an object");
|
|
449
|
+
}
|
|
450
|
+
data = value;
|
|
451
|
+
},
|
|
452
|
+
env,
|
|
453
|
+
waitUntil: workerContext.waitUntil.bind(workerContext),
|
|
454
|
+
passThroughOnException: /* @__PURE__ */ __name(() => {
|
|
455
|
+
isFailOpen = true;
|
|
456
|
+
}, "passThroughOnException")
|
|
457
|
+
};
|
|
458
|
+
const response = await handler(context);
|
|
459
|
+
if (!(response instanceof Response)) {
|
|
460
|
+
throw new Error("Your Pages function should return a Response");
|
|
461
|
+
}
|
|
462
|
+
return cloneResponse(response);
|
|
463
|
+
} else if ("ASSETS") {
|
|
464
|
+
const response = await env["ASSETS"].fetch(request);
|
|
465
|
+
return cloneResponse(response);
|
|
466
|
+
} else {
|
|
467
|
+
const response = await fetch(request);
|
|
468
|
+
return cloneResponse(response);
|
|
469
|
+
}
|
|
470
|
+
}, "next");
|
|
471
|
+
try {
|
|
472
|
+
return await next();
|
|
473
|
+
} catch (error) {
|
|
474
|
+
if (isFailOpen) {
|
|
475
|
+
const response = await env["ASSETS"].fetch(request);
|
|
476
|
+
return cloneResponse(response);
|
|
477
|
+
}
|
|
478
|
+
throw error;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
var cloneResponse = /* @__PURE__ */ __name((response) => (
|
|
483
|
+
// https://fetch.spec.whatwg.org/#null-body-status
|
|
484
|
+
new Response(
|
|
485
|
+
[101, 204, 205, 304].includes(response.status) ? null : response.body,
|
|
486
|
+
response
|
|
487
|
+
)
|
|
488
|
+
), "cloneResponse");
|
|
489
|
+
export {
|
|
490
|
+
pages_template_worker_default as default
|
|
491
|
+
};
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Astro Starter Kit: Minimal
|
|
2
|
+
|
|
3
|
+
```sh
|
|
4
|
+
npm create astro@latest -- --template minimal
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
|
8
|
+
|
|
9
|
+
## 🚀 Project Structure
|
|
10
|
+
|
|
11
|
+
Inside of your Astro project, you'll see the following folders and files:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
/
|
|
15
|
+
├── public/
|
|
16
|
+
├── src/
|
|
17
|
+
│ └── pages/
|
|
18
|
+
│ └── index.astro
|
|
19
|
+
└── package.json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
|
23
|
+
|
|
24
|
+
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
|
|
25
|
+
|
|
26
|
+
Any static assets, like images, can be placed in the `public/` directory.
|
|
27
|
+
|
|
28
|
+
## 🧞 Commands
|
|
29
|
+
|
|
30
|
+
All commands are run from the root of the project, from a terminal:
|
|
31
|
+
|
|
32
|
+
| Command | Action |
|
|
33
|
+
| :------------------------ | :----------------------------------------------- |
|
|
34
|
+
| `npm install` | Installs dependencies |
|
|
35
|
+
| `npm run dev` | Starts local dev server at `localhost:4321` |
|
|
36
|
+
| `npm run build` | Build your production site to `./dist/` |
|
|
37
|
+
| `npm run preview` | Preview your build locally, before deploying |
|
|
38
|
+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
|
39
|
+
| `npm run astro -- --help` | Get help using the Astro CLI |
|
|
40
|
+
|
|
41
|
+
## 👀 Want to learn more?
|
|
42
|
+
|
|
43
|
+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
|
package/astro.config.mjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { defineConfig } from 'astro/config';
|
|
3
|
+
import tailwind from '@astrojs/tailwind';
|
|
4
|
+
|
|
5
|
+
import react from '@astrojs/react';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
integrations: [tailwind(), react()],
|
|
9
|
+
output: 'static',
|
|
10
|
+
vite: {
|
|
11
|
+
plugins: [{
|
|
12
|
+
name: 'task-rewrite',
|
|
13
|
+
configureServer(server) {
|
|
14
|
+
server.middlewares.use((req, _res, next) => {
|
|
15
|
+
if (req.url?.startsWith('/task/') && req.url !== '/task/index.html') {
|
|
16
|
+
req.url = '/task/index.html';
|
|
17
|
+
}
|
|
18
|
+
if (req.url?.startsWith('/agent/') && req.url !== '/agent/index.html') {
|
|
19
|
+
req.url = '/agent/index.html';
|
|
20
|
+
}
|
|
21
|
+
next();
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
}],
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const onRequest: PagesFunction = async (context) => {
|
|
2
|
+
const url = new URL(context.request.url);
|
|
3
|
+
url.pathname = '/agent/index.html';
|
|
4
|
+
const asset = await context.env.ASSETS.fetch(url.toString());
|
|
5
|
+
return new Response(asset.body, {
|
|
6
|
+
status: 200,
|
|
7
|
+
headers: { 'content-type': 'text/html; charset=utf-8' },
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const onRequest: PagesFunction = async (context) => {
|
|
2
|
+
const url = new URL(context.request.url);
|
|
3
|
+
url.pathname = '/starlight/index.html';
|
|
4
|
+
const asset = await context.env.ASSETS.fetch(url.toString());
|
|
5
|
+
return new Response(asset.body, {
|
|
6
|
+
status: 200,
|
|
7
|
+
headers: { 'content-type': 'text/html; charset=utf-8' },
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const onRequest: PagesFunction = async (context) => {
|
|
2
|
+
const url = new URL(context.request.url);
|
|
3
|
+
url.pathname = '/task/index.html';
|
|
4
|
+
const asset = await context.env.ASSETS.fetch(url.toString());
|
|
5
|
+
return new Response(asset.body, {
|
|
6
|
+
status: 200,
|
|
7
|
+
headers: { 'content-type': 'text/html; charset=utf-8' },
|
|
8
|
+
});
|
|
9
|
+
};
|