feat:初始化Tauri应用。
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
{
|
||||
".svelte-kit/generated/server/internal.js": {
|
||||
"file": "internal.js",
|
||||
"name": "internal",
|
||||
"src": ".svelte-kit/generated/server/internal.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_root.js",
|
||||
"_environment.js",
|
||||
"_internal.js"
|
||||
]
|
||||
},
|
||||
"_attributes.js": {
|
||||
"file": "chunks/attributes.js",
|
||||
"name": "attributes"
|
||||
},
|
||||
"_environment.js": {
|
||||
"file": "chunks/environment.js",
|
||||
"name": "environment"
|
||||
},
|
||||
"_exports.js": {
|
||||
"file": "chunks/exports.js",
|
||||
"name": "exports",
|
||||
"imports": [
|
||||
"_attributes.js",
|
||||
"_root.js"
|
||||
]
|
||||
},
|
||||
"_false.js": {
|
||||
"file": "chunks/false.js",
|
||||
"name": "false"
|
||||
},
|
||||
"_internal.js": {
|
||||
"file": "chunks/internal.js",
|
||||
"name": "internal",
|
||||
"imports": [
|
||||
"_root.js",
|
||||
"_environment.js"
|
||||
]
|
||||
},
|
||||
"_root.js": {
|
||||
"file": "chunks/root.js",
|
||||
"name": "root",
|
||||
"imports": [
|
||||
"_false.js",
|
||||
"_attributes.js"
|
||||
]
|
||||
},
|
||||
"_shared.js": {
|
||||
"file": "chunks/shared.js",
|
||||
"name": "shared",
|
||||
"imports": [
|
||||
"_utils.js"
|
||||
]
|
||||
},
|
||||
"_utils.js": {
|
||||
"file": "chunks/utils.js",
|
||||
"name": "utils"
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js": {
|
||||
"file": "remote-entry.js",
|
||||
"name": "remote-entry",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/app/server/remote/index.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_shared.js",
|
||||
"_false.js",
|
||||
"_environment.js"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte": {
|
||||
"file": "entries/fallbacks/error.svelte.js",
|
||||
"name": "entries/fallbacks/error.svelte",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/components/svelte-5/error.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_attributes.js",
|
||||
"_exports.js",
|
||||
"_root.js",
|
||||
"_utils.js"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/components/svelte-5/layout.svelte": {
|
||||
"file": "entries/fallbacks/layout.svelte.js",
|
||||
"name": "entries/fallbacks/layout.svelte",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/components/svelte-5/layout.svelte",
|
||||
"isEntry": true
|
||||
},
|
||||
"node_modules/@sveltejs/kit/src/runtime/server/index.js": {
|
||||
"file": "index.js",
|
||||
"name": "index",
|
||||
"src": "node_modules/@sveltejs/kit/src/runtime/server/index.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_false.js",
|
||||
"_environment.js",
|
||||
"_shared.js",
|
||||
"_exports.js",
|
||||
"_utils.js",
|
||||
"_internal.js"
|
||||
]
|
||||
},
|
||||
"src/routes/+layout.ts": {
|
||||
"file": "entries/pages/_layout.ts.js",
|
||||
"name": "entries/pages/_layout.ts",
|
||||
"src": "src/routes/+layout.ts",
|
||||
"isEntry": true
|
||||
},
|
||||
"src/routes/+page.svelte": {
|
||||
"file": "entries/pages/_page.svelte.js",
|
||||
"name": "entries/pages/_page.svelte",
|
||||
"src": "src/routes/+page.svelte",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_attributes.js"
|
||||
],
|
||||
"css": [
|
||||
"_app/immutable/assets/_page.COJFZ_SK.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.logo.vite.svelte-1uha8ag:hover{filter:drop-shadow(0 0 2em #747bff)}.logo.svelte-kit.svelte-1uha8ag:hover{filter:drop-shadow(0 0 2em #ff3e00)}:root{color:#0f0f0f;font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;background-color:#f6f6f6;font-family:Inter,Avenir,Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:24px}.container.svelte-1uha8ag{text-align:center;flex-direction:column;justify-content:center;margin:0;padding-top:10vh;display:flex}.logo.svelte-1uha8ag{will-change:filter;height:6em;padding:1.5em;transition:all .75s}.logo.tauri.svelte-1uha8ag:hover{filter:drop-shadow(0 0 2em #24c8db)}.row.svelte-1uha8ag{justify-content:center;display:flex}a.svelte-1uha8ag{color:#646cff;-webkit-text-decoration:inherit;text-decoration:inherit;font-weight:500}a.svelte-1uha8ag:hover{color:#535bf2}h1.svelte-1uha8ag{text-align:center}input.svelte-1uha8ag,button.svelte-1uha8ag{color:#0f0f0f;background-color:#fff;border:1px solid #0000;border-radius:8px;padding:.6em 1.2em;font-family:inherit;font-size:1em;font-weight:500;transition:border-color .25s;box-shadow:0 2px 2px #0003}button.svelte-1uha8ag{cursor:pointer}button.svelte-1uha8ag:hover{border-color:#396cd8}button.svelte-1uha8ag:active{background-color:#e8e8e8;border-color:#396cd8}input.svelte-1uha8ag,button.svelte-1uha8ag{outline:none}#greet-input.svelte-1uha8ag{margin-right:5px}@media(prefers-color-scheme:dark){:root{color:#f6f6f6;background-color:#2f2f2f}a.svelte-1uha8ag:hover{color:#24c8db}input.svelte-1uha8ag,button.svelte-1uha8ag{color:#fff;background-color:#0f0f0f98}button.svelte-1uha8ag:active{background-color:#0f0f0f69}}
|
||||
@@ -0,0 +1,206 @@
|
||||
import { clsx as clsx$1 } from "clsx";
|
||||
var is_array = Array.isArray;
|
||||
var index_of = Array.prototype.indexOf;
|
||||
var includes = Array.prototype.includes;
|
||||
var array_from = Array.from;
|
||||
var define_property = Object.defineProperty;
|
||||
var get_descriptor = Object.getOwnPropertyDescriptor;
|
||||
var object_prototype = Object.prototype;
|
||||
var array_prototype = Array.prototype;
|
||||
var get_prototype_of = Object.getPrototypeOf;
|
||||
var is_extensible = Object.isExtensible;
|
||||
var has_own_property = Object.prototype.hasOwnProperty;
|
||||
const noop = () => {
|
||||
};
|
||||
function run_all(arr) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
arr[i]();
|
||||
}
|
||||
}
|
||||
function deferred() {
|
||||
var resolve;
|
||||
var reject;
|
||||
var promise = new Promise((res, rej) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
const ATTR_REGEX = /[&"<]/g;
|
||||
const CONTENT_REGEX = /[&<]/g;
|
||||
function escape_html(value, is_attr) {
|
||||
const str = String(value ?? "");
|
||||
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
|
||||
pattern.lastIndex = 0;
|
||||
let escaped = "";
|
||||
let last = 0;
|
||||
while (pattern.test(str)) {
|
||||
const i = pattern.lastIndex - 1;
|
||||
const ch = str[i];
|
||||
escaped += str.substring(last, i) + (ch === "&" ? "&" : ch === '"' ? """ : "<");
|
||||
last = i + 1;
|
||||
}
|
||||
return escaped + str.substring(last);
|
||||
}
|
||||
const replacements = {
|
||||
translate: /* @__PURE__ */ new Map([
|
||||
[true, "yes"],
|
||||
[false, "no"]
|
||||
])
|
||||
};
|
||||
function attr(name, value, is_boolean = false) {
|
||||
if (name === "hidden" && value !== "until-found") {
|
||||
is_boolean = true;
|
||||
}
|
||||
if (value == null || !value && is_boolean) return "";
|
||||
const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
|
||||
const assignment = is_boolean ? `=""` : `="${escape_html(normalized, true)}"`;
|
||||
return ` ${name}${assignment}`;
|
||||
}
|
||||
function clsx(value) {
|
||||
if (typeof value === "object") {
|
||||
return clsx$1(value);
|
||||
} else {
|
||||
return value ?? "";
|
||||
}
|
||||
}
|
||||
const whitespace = [..." \n\r\f \v\uFEFF"];
|
||||
function to_class(value, hash, directives) {
|
||||
var classname = value == null ? "" : "" + value;
|
||||
if (hash) {
|
||||
classname = classname ? classname + " " + hash : hash;
|
||||
}
|
||||
if (directives) {
|
||||
for (var key of Object.keys(directives)) {
|
||||
if (directives[key]) {
|
||||
classname = classname ? classname + " " + key : key;
|
||||
} else if (classname.length) {
|
||||
var len = key.length;
|
||||
var a = 0;
|
||||
while ((a = classname.indexOf(key, a)) >= 0) {
|
||||
var b = a + len;
|
||||
if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
|
||||
classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
|
||||
} else {
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return classname === "" ? null : classname;
|
||||
}
|
||||
function append_styles(styles, important = false) {
|
||||
var separator = important ? " !important;" : ";";
|
||||
var css = "";
|
||||
for (var key of Object.keys(styles)) {
|
||||
var value = styles[key];
|
||||
if (value != null && value !== "") {
|
||||
css += " " + key + ": " + value + separator;
|
||||
}
|
||||
}
|
||||
return css;
|
||||
}
|
||||
function to_css_name(name) {
|
||||
if (name[0] !== "-" || name[1] !== "-") {
|
||||
return name.toLowerCase();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
function to_style(value, styles) {
|
||||
if (styles) {
|
||||
var new_style = "";
|
||||
var normal_styles;
|
||||
var important_styles;
|
||||
if (Array.isArray(styles)) {
|
||||
normal_styles = styles[0];
|
||||
important_styles = styles[1];
|
||||
} else {
|
||||
normal_styles = styles;
|
||||
}
|
||||
if (value) {
|
||||
value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
|
||||
var in_str = false;
|
||||
var in_apo = 0;
|
||||
var in_comment = false;
|
||||
var reserved_names = [];
|
||||
if (normal_styles) {
|
||||
reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
|
||||
}
|
||||
if (important_styles) {
|
||||
reserved_names.push(...Object.keys(important_styles).map(to_css_name));
|
||||
}
|
||||
var start_index = 0;
|
||||
var name_index = -1;
|
||||
const len = value.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var c = value[i];
|
||||
if (in_comment) {
|
||||
if (c === "/" && value[i - 1] === "*") {
|
||||
in_comment = false;
|
||||
}
|
||||
} else if (in_str) {
|
||||
if (in_str === c) {
|
||||
in_str = false;
|
||||
}
|
||||
} else if (c === "/" && value[i + 1] === "*") {
|
||||
in_comment = true;
|
||||
} else if (c === '"' || c === "'") {
|
||||
in_str = c;
|
||||
} else if (c === "(") {
|
||||
in_apo++;
|
||||
} else if (c === ")") {
|
||||
in_apo--;
|
||||
}
|
||||
if (!in_comment && in_str === false && in_apo === 0) {
|
||||
if (c === ":" && name_index === -1) {
|
||||
name_index = i;
|
||||
} else if (c === ";" || i === len - 1) {
|
||||
if (name_index !== -1) {
|
||||
var name = to_css_name(value.substring(start_index, name_index).trim());
|
||||
if (!reserved_names.includes(name)) {
|
||||
if (c !== ";") {
|
||||
i++;
|
||||
}
|
||||
var property = value.substring(start_index, i).trim();
|
||||
new_style += " " + property + ";";
|
||||
}
|
||||
}
|
||||
start_index = i + 1;
|
||||
name_index = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (normal_styles) {
|
||||
new_style += append_styles(normal_styles);
|
||||
}
|
||||
if (important_styles) {
|
||||
new_style += append_styles(important_styles, true);
|
||||
}
|
||||
new_style = new_style.trim();
|
||||
return new_style === "" ? null : new_style;
|
||||
}
|
||||
return value == null ? null : String(value);
|
||||
}
|
||||
export {
|
||||
array_prototype as a,
|
||||
get_prototype_of as b,
|
||||
is_array as c,
|
||||
deferred as d,
|
||||
escape_html as e,
|
||||
is_extensible as f,
|
||||
get_descriptor as g,
|
||||
index_of as h,
|
||||
includes as i,
|
||||
define_property as j,
|
||||
array_from as k,
|
||||
has_own_property as l,
|
||||
clsx as m,
|
||||
noop as n,
|
||||
object_prototype as o,
|
||||
to_class as p,
|
||||
attr as q,
|
||||
run_all as r,
|
||||
to_style as t
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
let base = "";
|
||||
let assets = base;
|
||||
const app_dir = "_app";
|
||||
const relative = true;
|
||||
const initial = { base, assets };
|
||||
function override(paths) {
|
||||
base = paths.base;
|
||||
assets = paths.assets;
|
||||
}
|
||||
function reset() {
|
||||
base = initial.base;
|
||||
assets = initial.assets;
|
||||
}
|
||||
function set_assets(path) {
|
||||
assets = initial.assets = path;
|
||||
}
|
||||
let prerendering = false;
|
||||
function set_building() {
|
||||
}
|
||||
function set_prerendering() {
|
||||
prerendering = true;
|
||||
}
|
||||
export {
|
||||
assets as a,
|
||||
base as b,
|
||||
app_dir as c,
|
||||
reset as d,
|
||||
set_building as e,
|
||||
set_prerendering as f,
|
||||
override as o,
|
||||
prerendering as p,
|
||||
relative as r,
|
||||
set_assets as s
|
||||
};
|
||||
@@ -0,0 +1,231 @@
|
||||
import { n as noop } from "./attributes.js";
|
||||
import { s as safe_not_equal } from "./root.js";
|
||||
const SCHEME = /^[a-z][a-z\d+\-.]+:/i;
|
||||
const internal = new URL("sveltekit-internal://");
|
||||
function resolve(base, path) {
|
||||
if (path[0] === "/" && path[1] === "/") return path;
|
||||
let url = new URL(base, internal);
|
||||
url = new URL(path, url);
|
||||
return url.protocol === internal.protocol ? url.pathname + url.search + url.hash : url.href;
|
||||
}
|
||||
function normalize_path(path, trailing_slash) {
|
||||
if (path === "/" || trailing_slash === "ignore") return path;
|
||||
if (trailing_slash === "never") {
|
||||
return path.endsWith("/") ? path.slice(0, -1) : path;
|
||||
} else if (trailing_slash === "always" && !path.endsWith("/")) {
|
||||
return path + "/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
function decode_pathname(pathname) {
|
||||
return pathname.split("%25").map(decodeURI).join("%25");
|
||||
}
|
||||
function decode_params(params) {
|
||||
for (const key in params) {
|
||||
params[key] = decodeURIComponent(params[key]);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
function make_trackable(url, callback, search_params_callback, allow_hash = false) {
|
||||
const tracked = new URL(url);
|
||||
Object.defineProperty(tracked, "searchParams", {
|
||||
value: new Proxy(tracked.searchParams, {
|
||||
get(obj, key) {
|
||||
if (key === "get" || key === "getAll" || key === "has") {
|
||||
return (param, ...rest) => {
|
||||
search_params_callback(param);
|
||||
return obj[key](param, ...rest);
|
||||
};
|
||||
}
|
||||
callback();
|
||||
const value = Reflect.get(obj, key);
|
||||
return typeof value === "function" ? value.bind(obj) : value;
|
||||
}
|
||||
}),
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
const tracked_url_properties = ["href", "pathname", "search", "toString", "toJSON"];
|
||||
if (allow_hash) tracked_url_properties.push("hash");
|
||||
for (const property of tracked_url_properties) {
|
||||
Object.defineProperty(tracked, property, {
|
||||
get() {
|
||||
callback();
|
||||
return url[property];
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
{
|
||||
tracked[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(url, opts);
|
||||
};
|
||||
tracked.searchParams[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(url.searchParams, opts);
|
||||
};
|
||||
}
|
||||
if (!allow_hash) {
|
||||
disable_hash(tracked);
|
||||
}
|
||||
return tracked;
|
||||
}
|
||||
function disable_hash(url) {
|
||||
allow_nodejs_console_log(url);
|
||||
Object.defineProperty(url, "hash", {
|
||||
get() {
|
||||
throw new Error(
|
||||
"Cannot access event.url.hash. Consider using `page.url.hash` inside a component instead"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
function disable_search(url) {
|
||||
allow_nodejs_console_log(url);
|
||||
for (const property of ["search", "searchParams"]) {
|
||||
Object.defineProperty(url, property, {
|
||||
get() {
|
||||
throw new Error(`Cannot access url.${property} on a page with prerendering enabled`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function allow_nodejs_console_log(url) {
|
||||
{
|
||||
url[Symbol.for("nodejs.util.inspect.custom")] = (depth, opts, inspect) => {
|
||||
return inspect(new URL(url), opts);
|
||||
};
|
||||
}
|
||||
}
|
||||
const subscriber_queue = [];
|
||||
function readable(value, start) {
|
||||
return {
|
||||
subscribe: writable(value, start).subscribe
|
||||
};
|
||||
}
|
||||
function writable(value, start = noop) {
|
||||
let stop = null;
|
||||
const subscribers = /* @__PURE__ */ new Set();
|
||||
function set(new_value) {
|
||||
if (safe_not_equal(value, new_value)) {
|
||||
value = new_value;
|
||||
if (stop) {
|
||||
const run_queue = !subscriber_queue.length;
|
||||
for (const subscriber of subscribers) {
|
||||
subscriber[1]();
|
||||
subscriber_queue.push(subscriber, value);
|
||||
}
|
||||
if (run_queue) {
|
||||
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
||||
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
||||
}
|
||||
subscriber_queue.length = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function update(fn) {
|
||||
set(fn(
|
||||
/** @type {T} */
|
||||
value
|
||||
));
|
||||
}
|
||||
function subscribe(run, invalidate = noop) {
|
||||
const subscriber = [run, invalidate];
|
||||
subscribers.add(subscriber);
|
||||
if (subscribers.size === 1) {
|
||||
stop = start(set, update) || noop;
|
||||
}
|
||||
run(
|
||||
/** @type {T} */
|
||||
value
|
||||
);
|
||||
return () => {
|
||||
subscribers.delete(subscriber);
|
||||
if (subscribers.size === 0 && stop) {
|
||||
stop();
|
||||
stop = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
return { set, update, subscribe };
|
||||
}
|
||||
function validator(expected) {
|
||||
function validate(module, file) {
|
||||
if (!module) return;
|
||||
for (const key in module) {
|
||||
if (key[0] === "_" || expected.has(key)) continue;
|
||||
const values = [...expected.values()];
|
||||
const hint = hint_for_supported_files(key, file?.slice(file.lastIndexOf("."))) ?? `valid exports are ${values.join(", ")}, or anything with a '_' prefix`;
|
||||
throw new Error(`Invalid export '${key}'${file ? ` in ${file}` : ""} (${hint})`);
|
||||
}
|
||||
}
|
||||
return validate;
|
||||
}
|
||||
function hint_for_supported_files(key, ext = ".js") {
|
||||
const supported_files = [];
|
||||
if (valid_layout_exports.has(key)) {
|
||||
supported_files.push(`+layout${ext}`);
|
||||
}
|
||||
if (valid_page_exports.has(key)) {
|
||||
supported_files.push(`+page${ext}`);
|
||||
}
|
||||
if (valid_layout_server_exports.has(key)) {
|
||||
supported_files.push(`+layout.server${ext}`);
|
||||
}
|
||||
if (valid_page_server_exports.has(key)) {
|
||||
supported_files.push(`+page.server${ext}`);
|
||||
}
|
||||
if (valid_server_exports.has(key)) {
|
||||
supported_files.push(`+server${ext}`);
|
||||
}
|
||||
if (supported_files.length > 0) {
|
||||
return `'${key}' is a valid export in ${supported_files.slice(0, -1).join(", ")}${supported_files.length > 1 ? " or " : ""}${supported_files.at(-1)}`;
|
||||
}
|
||||
}
|
||||
const valid_layout_exports = /* @__PURE__ */ new Set([
|
||||
"load",
|
||||
"prerender",
|
||||
"csr",
|
||||
"ssr",
|
||||
"trailingSlash",
|
||||
"config"
|
||||
]);
|
||||
const valid_page_exports = /* @__PURE__ */ new Set([...valid_layout_exports, "entries"]);
|
||||
const valid_layout_server_exports = /* @__PURE__ */ new Set([...valid_layout_exports]);
|
||||
const valid_page_server_exports = /* @__PURE__ */ new Set([...valid_layout_server_exports, "actions", "entries"]);
|
||||
const valid_server_exports = /* @__PURE__ */ new Set([
|
||||
"GET",
|
||||
"POST",
|
||||
"PATCH",
|
||||
"PUT",
|
||||
"DELETE",
|
||||
"OPTIONS",
|
||||
"HEAD",
|
||||
"fallback",
|
||||
"prerender",
|
||||
"trailingSlash",
|
||||
"config",
|
||||
"entries"
|
||||
]);
|
||||
const validate_layout_exports = validator(valid_layout_exports);
|
||||
const validate_page_exports = validator(valid_page_exports);
|
||||
const validate_layout_server_exports = validator(valid_layout_server_exports);
|
||||
const validate_page_server_exports = validator(valid_page_server_exports);
|
||||
const validate_server_exports = validator(valid_server_exports);
|
||||
export {
|
||||
SCHEME as S,
|
||||
decode_params as a,
|
||||
validate_layout_exports as b,
|
||||
validate_page_server_exports as c,
|
||||
disable_search as d,
|
||||
validate_page_exports as e,
|
||||
resolve as f,
|
||||
decode_pathname as g,
|
||||
validate_server_exports as h,
|
||||
make_trackable as m,
|
||||
normalize_path as n,
|
||||
readable as r,
|
||||
validate_layout_server_exports as v,
|
||||
writable as w
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
const BROWSER = false;
|
||||
export {
|
||||
BROWSER as B
|
||||
};
|
||||
@@ -0,0 +1,134 @@
|
||||
import { r as root } from "./root.js";
|
||||
import "./environment.js";
|
||||
let public_env = {};
|
||||
function set_private_env(environment) {
|
||||
}
|
||||
function set_public_env(environment) {
|
||||
public_env = environment;
|
||||
}
|
||||
let read_implementation = null;
|
||||
function set_read_implementation(fn) {
|
||||
read_implementation = fn;
|
||||
}
|
||||
function set_manifest(_) {
|
||||
}
|
||||
const options = {
|
||||
app_template_contains_nonce: false,
|
||||
async: false,
|
||||
csp: { "mode": "auto", "directives": { "upgrade-insecure-requests": false, "block-all-mixed-content": false }, "reportOnly": { "upgrade-insecure-requests": false, "block-all-mixed-content": false } },
|
||||
csrf_check_origin: true,
|
||||
csrf_trusted_origins: [],
|
||||
embedded: false,
|
||||
env_public_prefix: "PUBLIC_",
|
||||
env_private_prefix: "",
|
||||
hash_routing: false,
|
||||
hooks: null,
|
||||
// added lazily, via `get_hooks`
|
||||
preload_strategy: "modulepreload",
|
||||
root,
|
||||
service_worker: false,
|
||||
service_worker_options: void 0,
|
||||
server_error_boundaries: false,
|
||||
templates: {
|
||||
app: ({ head, body, assets, nonce, env }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="' + assets + '/favicon.png" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <title>Tauri + SvelteKit + Typescript App</title>\n ' + head + '\n </head>\n <body data-sveltekit-preload-data="hover">\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
|
||||
error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
--bg: white;
|
||||
--fg: #222;
|
||||
--divider: #ccc;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Oxygen,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
'Open Sans',
|
||||
'Helvetica Neue',
|
||||
sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-width: 32rem;
|
||||
margin: 0 1rem;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-weight: 200;
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
top: -0.05rem;
|
||||
}
|
||||
|
||||
.message {
|
||||
border-left: 1px solid var(--divider);
|
||||
padding: 0 0 0 1rem;
|
||||
margin: 0 0 0 1rem;
|
||||
min-height: 2.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.message h1 {
|
||||
font-weight: 400;
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body {
|
||||
--bg: #222;
|
||||
--fg: #ddd;
|
||||
--divider: #666;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="error">
|
||||
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
||||
},
|
||||
version_hash: "1duwkc9"
|
||||
};
|
||||
async function get_hooks() {
|
||||
let handle;
|
||||
let handleFetch;
|
||||
let handleError;
|
||||
let handleValidationError;
|
||||
let init;
|
||||
let reroute;
|
||||
let transport;
|
||||
return {
|
||||
handle,
|
||||
handleFetch,
|
||||
handleError,
|
||||
handleValidationError,
|
||||
init,
|
||||
reroute,
|
||||
transport
|
||||
};
|
||||
}
|
||||
export {
|
||||
set_public_env as a,
|
||||
set_read_implementation as b,
|
||||
set_manifest as c,
|
||||
get_hooks as g,
|
||||
options as o,
|
||||
public_env as p,
|
||||
read_implementation as r,
|
||||
set_private_env as s
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,789 @@
|
||||
import { json, text } from "@sveltejs/kit";
|
||||
import { SvelteKitError, HttpError } from "@sveltejs/kit/internal";
|
||||
import { with_request_store } from "@sveltejs/kit/internal/server";
|
||||
import * as devalue from "devalue";
|
||||
import { t as text_decoder, b as base64_encode, c as base64_decode } from "./utils.js";
|
||||
const SVELTE_KIT_ASSETS = "/_svelte_kit_assets";
|
||||
const ENDPOINT_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
|
||||
const MUTATIVE_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
|
||||
const PAGE_METHODS = ["GET", "POST", "HEAD"];
|
||||
function set_nested_value(object, path_string, value) {
|
||||
if (path_string.startsWith("n:")) {
|
||||
path_string = path_string.slice(2);
|
||||
value = value === "" ? void 0 : parseFloat(value);
|
||||
} else if (path_string.startsWith("b:")) {
|
||||
path_string = path_string.slice(2);
|
||||
value = value === "on";
|
||||
}
|
||||
deep_set(object, split_path(path_string), value);
|
||||
}
|
||||
function convert_formdata(data) {
|
||||
const result = {};
|
||||
for (let key of data.keys()) {
|
||||
const is_array = key.endsWith("[]");
|
||||
let values = data.getAll(key);
|
||||
if (is_array) key = key.slice(0, -2);
|
||||
if (values.length > 1 && !is_array) {
|
||||
throw new Error(`Form cannot contain duplicated keys — "${key}" has ${values.length} values`);
|
||||
}
|
||||
values = values.filter(
|
||||
(entry) => typeof entry === "string" || entry.name !== "" || entry.size > 0
|
||||
);
|
||||
if (key.startsWith("n:")) {
|
||||
key = key.slice(2);
|
||||
values = values.map((v) => v === "" ? void 0 : parseFloat(
|
||||
/** @type {string} */
|
||||
v
|
||||
));
|
||||
} else if (key.startsWith("b:")) {
|
||||
key = key.slice(2);
|
||||
values = values.map((v) => v === "on");
|
||||
}
|
||||
set_nested_value(result, key, is_array ? values : values[0]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
const BINARY_FORM_CONTENT_TYPE = "application/x-sveltekit-formdata";
|
||||
const BINARY_FORM_VERSION = 0;
|
||||
const HEADER_BYTES = 1 + 4 + 2;
|
||||
async function deserialize_binary_form(request) {
|
||||
if (request.headers.get("content-type") !== BINARY_FORM_CONTENT_TYPE) {
|
||||
const form_data = await request.formData();
|
||||
return { data: convert_formdata(form_data), meta: {}, form_data };
|
||||
}
|
||||
if (!request.body) {
|
||||
throw deserialize_error("no body");
|
||||
}
|
||||
const content_length = parseInt(request.headers.get("content-length") ?? "");
|
||||
if (Number.isNaN(content_length)) {
|
||||
throw deserialize_error("invalid Content-Length header");
|
||||
}
|
||||
const reader = request.body.getReader();
|
||||
const chunks = [];
|
||||
function get_chunk(index) {
|
||||
if (index in chunks) return chunks[index];
|
||||
let i = chunks.length;
|
||||
while (i <= index) {
|
||||
chunks[i] = reader.read().then((chunk) => chunk.value);
|
||||
i++;
|
||||
}
|
||||
return chunks[index];
|
||||
}
|
||||
async function get_buffer(offset, length) {
|
||||
let start_chunk;
|
||||
let chunk_start = 0;
|
||||
let chunk_index;
|
||||
for (chunk_index = 0; ; chunk_index++) {
|
||||
const chunk = await get_chunk(chunk_index);
|
||||
if (!chunk) return null;
|
||||
const chunk_end = chunk_start + chunk.byteLength;
|
||||
if (offset >= chunk_start && offset < chunk_end) {
|
||||
start_chunk = chunk;
|
||||
break;
|
||||
}
|
||||
chunk_start = chunk_end;
|
||||
}
|
||||
if (offset + length <= chunk_start + start_chunk.byteLength) {
|
||||
return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
|
||||
}
|
||||
const chunks2 = [start_chunk.subarray(offset - chunk_start)];
|
||||
let cursor = start_chunk.byteLength - offset + chunk_start;
|
||||
while (cursor < length) {
|
||||
chunk_index++;
|
||||
let chunk = await get_chunk(chunk_index);
|
||||
if (!chunk) return null;
|
||||
if (chunk.byteLength > length - cursor) {
|
||||
chunk = chunk.subarray(0, length - cursor);
|
||||
}
|
||||
chunks2.push(chunk);
|
||||
cursor += chunk.byteLength;
|
||||
}
|
||||
const buffer = new Uint8Array(length);
|
||||
cursor = 0;
|
||||
for (const chunk of chunks2) {
|
||||
buffer.set(chunk, cursor);
|
||||
cursor += chunk.byteLength;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
const header = await get_buffer(0, HEADER_BYTES);
|
||||
if (!header) throw deserialize_error("too short");
|
||||
if (header[0] !== BINARY_FORM_VERSION) {
|
||||
throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
||||
}
|
||||
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
||||
const data_length = header_view.getUint32(1, true);
|
||||
if (HEADER_BYTES + data_length > content_length) {
|
||||
throw deserialize_error("data overflow");
|
||||
}
|
||||
const file_offsets_length = header_view.getUint16(5, true);
|
||||
if (HEADER_BYTES + data_length + file_offsets_length > content_length) {
|
||||
throw deserialize_error("file offset table overflow");
|
||||
}
|
||||
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
||||
if (!data_buffer) throw deserialize_error("data too short");
|
||||
let file_offsets;
|
||||
let files_start_offset;
|
||||
if (file_offsets_length > 0) {
|
||||
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
||||
if (!file_offsets_buffer) throw deserialize_error("file offset table too short");
|
||||
const parsed_offsets = JSON.parse(text_decoder.decode(file_offsets_buffer));
|
||||
if (!Array.isArray(parsed_offsets) || parsed_offsets.some((n) => typeof n !== "number" || !Number.isInteger(n) || n < 0)) {
|
||||
throw deserialize_error("invalid file offset table");
|
||||
}
|
||||
file_offsets = /** @type {Array<number>} */
|
||||
parsed_offsets;
|
||||
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
||||
}
|
||||
const file_spans = [];
|
||||
const [data, meta] = devalue.parse(text_decoder.decode(data_buffer), {
|
||||
File: ([name, type, size, last_modified, index]) => {
|
||||
if (typeof name !== "string" || typeof type !== "string" || typeof size !== "number" || typeof last_modified !== "number" || typeof index !== "number") {
|
||||
throw deserialize_error("invalid file metadata");
|
||||
}
|
||||
let offset = file_offsets[index];
|
||||
if (offset === void 0) {
|
||||
throw deserialize_error("duplicate file offset table index");
|
||||
}
|
||||
file_offsets[index] = void 0;
|
||||
offset += files_start_offset;
|
||||
if (offset + size > content_length) {
|
||||
throw deserialize_error("file data overflow");
|
||||
}
|
||||
file_spans.push({ offset, size });
|
||||
return new Proxy(new LazyFile(name, type, size, last_modified, get_chunk, offset), {
|
||||
getPrototypeOf() {
|
||||
return File.prototype;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
file_spans.sort((a, b) => a.offset - b.offset || a.size - b.size);
|
||||
for (let i = 1; i < file_spans.length; i++) {
|
||||
const previous = file_spans[i - 1];
|
||||
const current = file_spans[i];
|
||||
const previous_end = previous.offset + previous.size;
|
||||
if (previous_end < current.offset) {
|
||||
throw deserialize_error("gaps in file data");
|
||||
}
|
||||
if (previous_end > current.offset) {
|
||||
throw deserialize_error("overlapping file data");
|
||||
}
|
||||
}
|
||||
void (async () => {
|
||||
let has_more = true;
|
||||
while (has_more) {
|
||||
const chunk = await get_chunk(chunks.length);
|
||||
has_more = !!chunk;
|
||||
}
|
||||
})();
|
||||
return { data, meta, form_data: null };
|
||||
}
|
||||
function deserialize_error(message) {
|
||||
return new SvelteKitError(400, "Bad Request", `Could not deserialize binary form: ${message}`);
|
||||
}
|
||||
class LazyFile {
|
||||
/** @type {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} */
|
||||
#get_chunk;
|
||||
/** @type {number} */
|
||||
#offset;
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {string} type
|
||||
* @param {number} size
|
||||
* @param {number} last_modified
|
||||
* @param {(index: number) => Promise<Uint8Array<ArrayBuffer> | undefined>} get_chunk
|
||||
* @param {number} offset
|
||||
*/
|
||||
constructor(name, type, size, last_modified, get_chunk, offset) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.size = size;
|
||||
this.lastModified = last_modified;
|
||||
this.webkitRelativePath = "";
|
||||
this.#get_chunk = get_chunk;
|
||||
this.#offset = offset;
|
||||
this.arrayBuffer = this.arrayBuffer.bind(this);
|
||||
this.bytes = this.bytes.bind(this);
|
||||
this.slice = this.slice.bind(this);
|
||||
this.stream = this.stream.bind(this);
|
||||
this.text = this.text.bind(this);
|
||||
}
|
||||
/** @type {ArrayBuffer | undefined} */
|
||||
#buffer;
|
||||
async arrayBuffer() {
|
||||
this.#buffer ??= await new Response(this.stream()).arrayBuffer();
|
||||
return this.#buffer;
|
||||
}
|
||||
async bytes() {
|
||||
return new Uint8Array(await this.arrayBuffer());
|
||||
}
|
||||
/**
|
||||
* @param {number=} start
|
||||
* @param {number=} end
|
||||
* @param {string=} contentType
|
||||
*/
|
||||
slice(start = 0, end = this.size, contentType = this.type) {
|
||||
if (start < 0) {
|
||||
start = Math.max(this.size + start, 0);
|
||||
} else {
|
||||
start = Math.min(start, this.size);
|
||||
}
|
||||
if (end < 0) {
|
||||
end = Math.max(this.size + end, 0);
|
||||
} else {
|
||||
end = Math.min(end, this.size);
|
||||
}
|
||||
const size = Math.max(end - start, 0);
|
||||
const file = new LazyFile(
|
||||
this.name,
|
||||
contentType,
|
||||
size,
|
||||
this.lastModified,
|
||||
this.#get_chunk,
|
||||
this.#offset + start
|
||||
);
|
||||
return file;
|
||||
}
|
||||
stream() {
|
||||
let cursor = 0;
|
||||
let chunk_index = 0;
|
||||
return new ReadableStream({
|
||||
start: async (controller) => {
|
||||
let chunk_start = 0;
|
||||
let start_chunk;
|
||||
for (chunk_index = 0; ; chunk_index++) {
|
||||
const chunk = await this.#get_chunk(chunk_index);
|
||||
if (!chunk) return null;
|
||||
const chunk_end = chunk_start + chunk.byteLength;
|
||||
if (this.#offset >= chunk_start && this.#offset < chunk_end) {
|
||||
start_chunk = chunk;
|
||||
break;
|
||||
}
|
||||
chunk_start = chunk_end;
|
||||
}
|
||||
if (this.#offset + this.size <= chunk_start + start_chunk.byteLength) {
|
||||
controller.enqueue(
|
||||
start_chunk.subarray(this.#offset - chunk_start, this.#offset + this.size - chunk_start)
|
||||
);
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(start_chunk.subarray(this.#offset - chunk_start));
|
||||
cursor = start_chunk.byteLength - this.#offset + chunk_start;
|
||||
}
|
||||
},
|
||||
pull: async (controller) => {
|
||||
chunk_index++;
|
||||
let chunk = await this.#get_chunk(chunk_index);
|
||||
if (!chunk) {
|
||||
controller.error("incomplete file data");
|
||||
controller.close();
|
||||
return;
|
||||
}
|
||||
if (chunk.byteLength > this.size - cursor) {
|
||||
chunk = chunk.subarray(0, this.size - cursor);
|
||||
}
|
||||
controller.enqueue(chunk);
|
||||
cursor += chunk.byteLength;
|
||||
if (cursor >= this.size) {
|
||||
controller.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
async text() {
|
||||
return text_decoder.decode(await this.arrayBuffer());
|
||||
}
|
||||
}
|
||||
const path_regex = /^[a-zA-Z_$]\w*(\.[a-zA-Z_$]\w*|\[\d+\])*$/;
|
||||
function split_path(path) {
|
||||
if (!path_regex.test(path)) {
|
||||
throw new Error(`Invalid path ${path}`);
|
||||
}
|
||||
return path.split(/\.|\[|\]/).filter(Boolean);
|
||||
}
|
||||
function check_prototype_pollution(key) {
|
||||
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
||||
throw new Error(
|
||||
`Invalid key "${key}"`
|
||||
);
|
||||
}
|
||||
}
|
||||
function deep_set(object, keys, value) {
|
||||
let current = object;
|
||||
for (let i = 0; i < keys.length - 1; i += 1) {
|
||||
const key = keys[i];
|
||||
check_prototype_pollution(key);
|
||||
const is_array = /^\d+$/.test(keys[i + 1]);
|
||||
const exists = Object.hasOwn(current, key);
|
||||
const inner = current[key];
|
||||
if (exists && is_array !== Array.isArray(inner)) {
|
||||
throw new Error(`Invalid array key ${keys[i + 1]}`);
|
||||
}
|
||||
if (!exists) {
|
||||
current[key] = is_array ? [] : {};
|
||||
}
|
||||
current = current[key];
|
||||
}
|
||||
const final_key = keys[keys.length - 1];
|
||||
check_prototype_pollution(final_key);
|
||||
current[final_key] = value;
|
||||
}
|
||||
function normalize_issue(issue, server = false) {
|
||||
const normalized = { name: "", path: [], message: issue.message, server };
|
||||
if (issue.path !== void 0) {
|
||||
let name = "";
|
||||
for (const segment of issue.path) {
|
||||
const key = (
|
||||
/** @type {string | number} */
|
||||
typeof segment === "object" ? segment.key : segment
|
||||
);
|
||||
normalized.path.push(key);
|
||||
if (typeof key === "number") {
|
||||
name += `[${key}]`;
|
||||
} else if (typeof key === "string") {
|
||||
name += name === "" ? key : "." + key;
|
||||
}
|
||||
}
|
||||
normalized.name = name;
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
function flatten_issues(issues) {
|
||||
const result = {};
|
||||
for (const issue of issues) {
|
||||
(result.$ ??= []).push(issue);
|
||||
let name = "";
|
||||
if (issue.path !== void 0) {
|
||||
for (const key of issue.path) {
|
||||
if (typeof key === "number") {
|
||||
name += `[${key}]`;
|
||||
} else if (typeof key === "string") {
|
||||
name += name === "" ? key : "." + key;
|
||||
}
|
||||
(result[name] ??= []).push(issue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function deep_get(object, path) {
|
||||
let current = object;
|
||||
for (const key of path) {
|
||||
if (current == null || typeof current !== "object") {
|
||||
return current;
|
||||
}
|
||||
current = current[key];
|
||||
}
|
||||
return current;
|
||||
}
|
||||
function create_field_proxy(target, get_input, set_input, get_issues, path = []) {
|
||||
const get_value = () => {
|
||||
return deep_get(get_input(), path);
|
||||
};
|
||||
return new Proxy(target, {
|
||||
get(target2, prop) {
|
||||
if (typeof prop === "symbol") return target2[prop];
|
||||
if (/^\d+$/.test(prop)) {
|
||||
return create_field_proxy({}, get_input, set_input, get_issues, [
|
||||
...path,
|
||||
parseInt(prop, 10)
|
||||
]);
|
||||
}
|
||||
const key = build_path_string(path);
|
||||
if (prop === "set") {
|
||||
const set_func = function(newValue) {
|
||||
set_input(path, newValue);
|
||||
return newValue;
|
||||
};
|
||||
return create_field_proxy(set_func, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
if (prop === "value") {
|
||||
return create_field_proxy(get_value, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
if (prop === "issues" || prop === "allIssues") {
|
||||
const issues_func = () => {
|
||||
const all_issues = get_issues()[key === "" ? "$" : key];
|
||||
if (prop === "allIssues") {
|
||||
return all_issues?.map((issue) => ({
|
||||
path: issue.path,
|
||||
message: issue.message
|
||||
}));
|
||||
}
|
||||
return all_issues?.filter((issue) => issue.name === key)?.map((issue) => ({
|
||||
path: issue.path,
|
||||
message: issue.message
|
||||
}));
|
||||
};
|
||||
return create_field_proxy(issues_func, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
if (prop === "as") {
|
||||
const as_func = (type, input_value) => {
|
||||
const is_array = type === "file multiple" || type === "select multiple" || type === "checkbox" && typeof input_value === "string";
|
||||
const prefix = type === "number" || type === "range" ? "n:" : type === "checkbox" && !is_array ? "b:" : "";
|
||||
const base_props = {
|
||||
name: prefix + key + (is_array ? "[]" : ""),
|
||||
get "aria-invalid"() {
|
||||
const issues = get_issues();
|
||||
return key in issues ? "true" : void 0;
|
||||
}
|
||||
};
|
||||
if (type !== "text" && type !== "select" && type !== "select multiple") {
|
||||
base_props.type = type === "file multiple" ? "file" : type;
|
||||
}
|
||||
if (type === "submit" || type === "hidden") {
|
||||
return Object.defineProperties(base_props, {
|
||||
value: { value: input_value, enumerable: true }
|
||||
});
|
||||
}
|
||||
if (type === "select" || type === "select multiple") {
|
||||
return Object.defineProperties(base_props, {
|
||||
multiple: { value: is_array, enumerable: true },
|
||||
value: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return get_value();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === "checkbox" || type === "radio") {
|
||||
return Object.defineProperties(base_props, {
|
||||
value: { value: input_value ?? "on", enumerable: true },
|
||||
checked: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
const value = get_value();
|
||||
if (type === "radio") {
|
||||
return value === input_value;
|
||||
}
|
||||
if (is_array) {
|
||||
return (value ?? []).includes(input_value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type === "file" || type === "file multiple") {
|
||||
return Object.defineProperties(base_props, {
|
||||
multiple: { value: is_array, enumerable: true },
|
||||
files: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
const value = get_value();
|
||||
if (value instanceof File) {
|
||||
if (typeof DataTransfer !== "undefined") {
|
||||
const fileList = new DataTransfer();
|
||||
fileList.items.add(value);
|
||||
return fileList.files;
|
||||
}
|
||||
return { 0: value, length: 1 };
|
||||
}
|
||||
if (Array.isArray(value) && value.every((f) => f instanceof File)) {
|
||||
if (typeof DataTransfer !== "undefined") {
|
||||
const fileList = new DataTransfer();
|
||||
value.forEach((file) => fileList.items.add(file));
|
||||
return fileList.files;
|
||||
}
|
||||
const fileListLike = { length: value.length };
|
||||
value.forEach((file, index) => {
|
||||
fileListLike[index] = file;
|
||||
});
|
||||
return fileListLike;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return Object.defineProperties(base_props, {
|
||||
value: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
const value = get_value();
|
||||
return value != null ? String(value) : "";
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
return create_field_proxy(as_func, get_input, set_input, get_issues, [...path, "as"]);
|
||||
}
|
||||
return create_field_proxy({}, get_input, set_input, get_issues, [...path, prop]);
|
||||
}
|
||||
});
|
||||
}
|
||||
function build_path_string(path) {
|
||||
let result = "";
|
||||
for (const segment of path) {
|
||||
if (typeof segment === "number") {
|
||||
result += `[${segment}]`;
|
||||
} else {
|
||||
result += result === "" ? segment : "." + segment;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function negotiate(accept, types) {
|
||||
const parts = [];
|
||||
accept.split(",").forEach((str, i) => {
|
||||
const match = /([^/ \t]+)\/([^; \t]+)[ \t]*(?:;[ \t]*q=([0-9.]+))?/.exec(str);
|
||||
if (match) {
|
||||
const [, type, subtype, q = "1"] = match;
|
||||
parts.push({ type, subtype, q: +q, i });
|
||||
}
|
||||
});
|
||||
parts.sort((a, b) => {
|
||||
if (a.q !== b.q) {
|
||||
return b.q - a.q;
|
||||
}
|
||||
if (a.subtype === "*" !== (b.subtype === "*")) {
|
||||
return a.subtype === "*" ? 1 : -1;
|
||||
}
|
||||
if (a.type === "*" !== (b.type === "*")) {
|
||||
return a.type === "*" ? 1 : -1;
|
||||
}
|
||||
return a.i - b.i;
|
||||
});
|
||||
let accepted;
|
||||
let min_priority = Infinity;
|
||||
for (const mimetype of types) {
|
||||
const [type, subtype] = mimetype.split("/");
|
||||
const priority = parts.findIndex(
|
||||
(part) => (part.type === type || part.type === "*") && (part.subtype === subtype || part.subtype === "*")
|
||||
);
|
||||
if (priority !== -1 && priority < min_priority) {
|
||||
accepted = mimetype;
|
||||
min_priority = priority;
|
||||
}
|
||||
}
|
||||
return accepted;
|
||||
}
|
||||
function is_content_type(request, ...types) {
|
||||
const type = request.headers.get("content-type")?.split(";", 1)[0].trim() ?? "";
|
||||
return types.includes(type.toLowerCase());
|
||||
}
|
||||
function is_form_content_type(request) {
|
||||
return is_content_type(
|
||||
request,
|
||||
"application/x-www-form-urlencoded",
|
||||
"multipart/form-data",
|
||||
"text/plain",
|
||||
BINARY_FORM_CONTENT_TYPE
|
||||
);
|
||||
}
|
||||
function coalesce_to_error(err) {
|
||||
return err instanceof Error || err && /** @type {any} */
|
||||
err.name && /** @type {any} */
|
||||
err.message ? (
|
||||
/** @type {Error} */
|
||||
err
|
||||
) : new Error(JSON.stringify(err));
|
||||
}
|
||||
function normalize_error(error) {
|
||||
return (
|
||||
/** @type {import('../exports/internal/index.js').Redirect | HttpError | SvelteKitError | Error} */
|
||||
error
|
||||
);
|
||||
}
|
||||
function get_status(error) {
|
||||
return error instanceof HttpError || error instanceof SvelteKitError ? error.status : 500;
|
||||
}
|
||||
function get_message(error) {
|
||||
return error instanceof SvelteKitError ? error.text : "Internal Error";
|
||||
}
|
||||
const escape_html_attr_dict = {
|
||||
"&": "&",
|
||||
'"': """
|
||||
// Svelte also escapes < because the escape function could be called inside a `noscript` there
|
||||
// https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c
|
||||
// However, that doesn't apply in SvelteKit
|
||||
};
|
||||
const escape_html_dict = {
|
||||
"&": "&",
|
||||
"<": "<"
|
||||
};
|
||||
const surrogates = (
|
||||
// high surrogate without paired low surrogate
|
||||
"[\\ud800-\\udbff](?![\\udc00-\\udfff])|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\udc00-\\udfff]"
|
||||
);
|
||||
const escape_html_attr_regex = new RegExp(
|
||||
`[${Object.keys(escape_html_attr_dict).join("")}]|` + surrogates,
|
||||
"g"
|
||||
);
|
||||
const escape_html_regex = new RegExp(
|
||||
`[${Object.keys(escape_html_dict).join("")}]|` + surrogates,
|
||||
"g"
|
||||
);
|
||||
function escape_html(str, is_attr) {
|
||||
const dict = is_attr ? escape_html_attr_dict : escape_html_dict;
|
||||
const escaped_str = str.replace(is_attr ? escape_html_attr_regex : escape_html_regex, (match) => {
|
||||
if (match.length === 2) {
|
||||
return match;
|
||||
}
|
||||
return dict[match] ?? `&#${match.charCodeAt(0)};`;
|
||||
});
|
||||
return escaped_str;
|
||||
}
|
||||
function method_not_allowed(mod, method) {
|
||||
return text(`${method} method not allowed`, {
|
||||
status: 405,
|
||||
headers: {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
|
||||
// "The server must generate an Allow header field in a 405 status code response"
|
||||
allow: allowed_methods(mod).join(", ")
|
||||
}
|
||||
});
|
||||
}
|
||||
function allowed_methods(mod) {
|
||||
const allowed = ENDPOINT_METHODS.filter((method) => method in mod);
|
||||
if ("GET" in mod && !("HEAD" in mod)) {
|
||||
allowed.push("HEAD");
|
||||
}
|
||||
return allowed;
|
||||
}
|
||||
function get_global_name(options) {
|
||||
return `__sveltekit_${options.version_hash}`;
|
||||
}
|
||||
function static_error_page(options, status, message) {
|
||||
let page = options.templates.error({ status, message: escape_html(message) });
|
||||
return text(page, {
|
||||
headers: { "content-type": "text/html; charset=utf-8" },
|
||||
status
|
||||
});
|
||||
}
|
||||
async function handle_fatal_error(event, state, options, error) {
|
||||
error = error instanceof HttpError ? error : coalesce_to_error(error);
|
||||
const status = get_status(error);
|
||||
const body = await handle_error_and_jsonify(event, state, options, error);
|
||||
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
||||
"application/json",
|
||||
"text/html"
|
||||
]);
|
||||
if (event.isDataRequest || type === "application/json") {
|
||||
return json(body, {
|
||||
status
|
||||
});
|
||||
}
|
||||
return static_error_page(options, status, body.message);
|
||||
}
|
||||
async function handle_error_and_jsonify(event, state, options, error) {
|
||||
if (error instanceof HttpError) {
|
||||
return { message: "Unknown Error", ...error.body };
|
||||
}
|
||||
const status = get_status(error);
|
||||
const message = get_message(error);
|
||||
return await with_request_store(
|
||||
{ event, state },
|
||||
() => options.hooks.handleError({ error, event, status, message })
|
||||
) ?? { message };
|
||||
}
|
||||
function redirect_response(status, location) {
|
||||
const response = new Response(void 0, {
|
||||
status,
|
||||
headers: { location }
|
||||
});
|
||||
return response;
|
||||
}
|
||||
function clarify_devalue_error(event, error) {
|
||||
if (error.path) {
|
||||
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`;
|
||||
}
|
||||
if (error.path === "") {
|
||||
return `Data returned from \`load\` while rendering ${event.route.id} is not a plain object`;
|
||||
}
|
||||
return error.message;
|
||||
}
|
||||
function serialize_uses(node) {
|
||||
const uses = {};
|
||||
if (node.uses && node.uses.dependencies.size > 0) {
|
||||
uses.dependencies = Array.from(node.uses.dependencies);
|
||||
}
|
||||
if (node.uses && node.uses.search_params.size > 0) {
|
||||
uses.search_params = Array.from(node.uses.search_params);
|
||||
}
|
||||
if (node.uses && node.uses.params.size > 0) {
|
||||
uses.params = Array.from(node.uses.params);
|
||||
}
|
||||
if (node.uses?.parent) uses.parent = 1;
|
||||
if (node.uses?.route) uses.route = 1;
|
||||
if (node.uses?.url) uses.url = 1;
|
||||
return uses;
|
||||
}
|
||||
function has_prerendered_path(manifest, pathname) {
|
||||
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
||||
}
|
||||
function format_server_error(status, error, event) {
|
||||
const formatted_text = `
|
||||
\x1B[1;31m[${status}] ${event.request.method} ${event.url.pathname}\x1B[0m`;
|
||||
if (status === 404) {
|
||||
return formatted_text;
|
||||
}
|
||||
return `${formatted_text}
|
||||
${error.stack}`;
|
||||
}
|
||||
function get_node_type(node_id) {
|
||||
const parts = node_id?.split("/");
|
||||
const filename = parts?.at(-1);
|
||||
if (!filename) return "unknown";
|
||||
const dot_parts = filename.split(".");
|
||||
return dot_parts.slice(0, -1).join(".");
|
||||
}
|
||||
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
||||
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
||||
function stringify(data, transport) {
|
||||
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
||||
return devalue.stringify(data, encoders);
|
||||
}
|
||||
function stringify_remote_arg(value, transport) {
|
||||
if (value === void 0) return "";
|
||||
const json_string = stringify(value, transport);
|
||||
const bytes = new TextEncoder().encode(json_string);
|
||||
return base64_encode(bytes).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
|
||||
}
|
||||
function parse_remote_arg(string, transport) {
|
||||
if (!string) return void 0;
|
||||
const json_string = text_decoder.decode(
|
||||
// no need to add back `=` characters, atob can handle it
|
||||
base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
|
||||
);
|
||||
const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
|
||||
return devalue.parse(json_string, decoders);
|
||||
}
|
||||
function create_remote_key(id, payload) {
|
||||
return id + "/" + payload;
|
||||
}
|
||||
export {
|
||||
ENDPOINT_METHODS as E,
|
||||
INVALIDATED_PARAM as I,
|
||||
MUTATIVE_METHODS as M,
|
||||
PAGE_METHODS as P,
|
||||
SVELTE_KIT_ASSETS as S,
|
||||
TRAILING_SLASH_PARAM as T,
|
||||
normalize_error as a,
|
||||
get_global_name as b,
|
||||
clarify_devalue_error as c,
|
||||
get_node_type as d,
|
||||
escape_html as e,
|
||||
create_remote_key as f,
|
||||
get_status as g,
|
||||
handle_error_and_jsonify as h,
|
||||
is_form_content_type as i,
|
||||
static_error_page as j,
|
||||
stringify as k,
|
||||
deserialize_binary_form as l,
|
||||
method_not_allowed as m,
|
||||
negotiate as n,
|
||||
has_prerendered_path as o,
|
||||
parse_remote_arg as p,
|
||||
handle_fatal_error as q,
|
||||
redirect_response as r,
|
||||
serialize_uses as s,
|
||||
format_server_error as t,
|
||||
stringify_remote_arg as u,
|
||||
create_field_proxy as v,
|
||||
normalize_issue as w,
|
||||
set_nested_value as x,
|
||||
flatten_issues as y,
|
||||
deep_set as z
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
const text_encoder = new TextEncoder();
|
||||
const text_decoder = new TextDecoder();
|
||||
function get_relative_path(from, to) {
|
||||
const from_parts = from.split(/[/\\]/);
|
||||
const to_parts = to.split(/[/\\]/);
|
||||
from_parts.pop();
|
||||
while (from_parts[0] === to_parts[0]) {
|
||||
from_parts.shift();
|
||||
to_parts.shift();
|
||||
}
|
||||
let i = from_parts.length;
|
||||
while (i--) from_parts[i] = "..";
|
||||
return from_parts.concat(to_parts).join("/");
|
||||
}
|
||||
function base64_encode(bytes) {
|
||||
if (globalThis.Buffer) {
|
||||
return globalThis.Buffer.from(bytes).toString("base64");
|
||||
}
|
||||
let binary = "";
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
binary += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return btoa(binary);
|
||||
}
|
||||
function base64_decode(encoded) {
|
||||
if (globalThis.Buffer) {
|
||||
const buffer = globalThis.Buffer.from(encoded, "base64");
|
||||
return new Uint8Array(buffer);
|
||||
}
|
||||
const binary = atob(encoded);
|
||||
const bytes = new Uint8Array(binary.length);
|
||||
for (let i = 0; i < binary.length; i++) {
|
||||
bytes[i] = binary.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
export {
|
||||
text_encoder as a,
|
||||
base64_encode as b,
|
||||
base64_decode as c,
|
||||
get_relative_path as g,
|
||||
text_decoder as t
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
import { n as noop, e as escape_html } from "../../chunks/attributes.js";
|
||||
import "clsx";
|
||||
import { w as writable } from "../../chunks/exports.js";
|
||||
import "@sveltejs/kit/internal/server";
|
||||
import { g as getContext } from "../../chunks/root.js";
|
||||
import "@sveltejs/kit/internal";
|
||||
import "../../chunks/utils.js";
|
||||
function create_updated_store() {
|
||||
const { set, subscribe } = writable(false);
|
||||
{
|
||||
return {
|
||||
subscribe,
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
check: async () => false
|
||||
};
|
||||
}
|
||||
}
|
||||
const is_legacy = noop.toString().includes("$$") || /function \w+\(\) \{\}/.test(noop.toString());
|
||||
const placeholder_url = "a:";
|
||||
if (is_legacy) {
|
||||
({
|
||||
data: {},
|
||||
form: null,
|
||||
error: null,
|
||||
params: {},
|
||||
route: { id: null },
|
||||
state: {},
|
||||
status: -1,
|
||||
url: new URL(placeholder_url)
|
||||
});
|
||||
}
|
||||
const stores = {
|
||||
updated: /* @__PURE__ */ create_updated_store()
|
||||
};
|
||||
({
|
||||
check: stores.updated.check
|
||||
});
|
||||
function context() {
|
||||
return getContext("__request__");
|
||||
}
|
||||
const page$1 = {
|
||||
get error() {
|
||||
return context().page.error;
|
||||
},
|
||||
get status() {
|
||||
return context().page.status;
|
||||
}
|
||||
};
|
||||
const page = page$1;
|
||||
function Error$1($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
$$renderer2.push(`<h1>${escape_html(page.status)}</h1> <p>${escape_html(page.error?.message)}</p>`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
Error$1 as default
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import "clsx";
|
||||
function Layout($$renderer, $$props) {
|
||||
let { children } = $$props;
|
||||
children($$renderer);
|
||||
$$renderer.push(`<!---->`);
|
||||
}
|
||||
export {
|
||||
Layout as default
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
const ssr = false;
|
||||
export {
|
||||
ssr
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { q as attr, e as escape_html } from "../../chunks/attributes.js";
|
||||
import "@tauri-apps/api/core";
|
||||
function _page($$renderer, $$props) {
|
||||
$$renderer.component(($$renderer2) => {
|
||||
let name = "";
|
||||
let greetMsg = "";
|
||||
$$renderer2.push(`<main class="container svelte-1uha8ag"><h1 class="svelte-1uha8ag">Welcome to Tauri + Svelte</h1> <div class="row svelte-1uha8ag"><a href="https://vite.dev" target="_blank" class="svelte-1uha8ag"><img src="/vite.svg" class="logo vite svelte-1uha8ag" alt="Vite Logo"/></a> <a href="https://tauri.app" target="_blank" class="svelte-1uha8ag"><img src="/tauri.svg" class="logo tauri svelte-1uha8ag" alt="Tauri Logo"/></a> <a href="https://svelte.dev" target="_blank" class="svelte-1uha8ag"><img src="/svelte.svg" class="logo svelte-kit svelte-1uha8ag" alt="SvelteKit Logo"/></a></div> <p>Click on the Tauri, Vite, and SvelteKit logos to learn more.</p> <form class="row svelte-1uha8ag"><input id="greet-input" placeholder="Enter a name..."${attr("value", name)} class="svelte-1uha8ag"/> <button type="submit" class="svelte-1uha8ag">Greet</button></form> <p>${escape_html(greetMsg)}</p></main>`);
|
||||
});
|
||||
}
|
||||
export {
|
||||
_page as default
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
import "./chunks/root.js";
|
||||
import { s, e, f } from "./chunks/environment.js";
|
||||
import { g, o, c, s as s2, a, b } from "./chunks/internal.js";
|
||||
export {
|
||||
g as get_hooks,
|
||||
o as options,
|
||||
s as set_assets,
|
||||
e as set_building,
|
||||
c as set_manifest,
|
||||
f as set_prerendering,
|
||||
s2 as set_private_env,
|
||||
a as set_public_env,
|
||||
b as set_read_implementation
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set(["favicon.png","svelte.svg","tauri.svg","vite.svg"]),
|
||||
mimeTypes: {".png":"image/png",".svg":"image/svg+xml"},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.DXEWCeTR.js",app:"_app/immutable/entry/app.CBndQoGT.js",imports:["_app/immutable/entry/start.DXEWCeTR.js","_app/immutable/chunks/BRJNrpWH.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/V4GKpPu4.js","_app/immutable/entry/app.CBndQoGT.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/E-DQD4vt.js","_app/immutable/chunks/VCsPq5MH.js","_app/immutable/chunks/V4GKpPu4.js","_app/immutable/chunks/L6H5smAl.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js'))
|
||||
],
|
||||
remotes: {
|
||||
|
||||
},
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,39 @@
|
||||
export const manifest = (() => {
|
||||
function __memo(fn) {
|
||||
let value;
|
||||
return () => value ??= (value = fn());
|
||||
}
|
||||
|
||||
return {
|
||||
appDir: "_app",
|
||||
appPath: "_app",
|
||||
assets: new Set(["favicon.png","svelte.svg","tauri.svg","vite.svg"]),
|
||||
mimeTypes: {".png":"image/png",".svg":"image/svg+xml"},
|
||||
_: {
|
||||
client: {start:"_app/immutable/entry/start.DXEWCeTR.js",app:"_app/immutable/entry/app.CBndQoGT.js",imports:["_app/immutable/entry/start.DXEWCeTR.js","_app/immutable/chunks/BRJNrpWH.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/V4GKpPu4.js","_app/immutable/entry/app.CBndQoGT.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/E-DQD4vt.js","_app/immutable/chunks/VCsPq5MH.js","_app/immutable/chunks/V4GKpPu4.js","_app/immutable/chunks/L6H5smAl.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
||||
nodes: [
|
||||
__memo(() => import('./nodes/0.js')),
|
||||
__memo(() => import('./nodes/1.js')),
|
||||
__memo(() => import('./nodes/2.js'))
|
||||
],
|
||||
remotes: {
|
||||
|
||||
},
|
||||
routes: [
|
||||
{
|
||||
id: "/",
|
||||
pattern: /^\/$/,
|
||||
params: [],
|
||||
page: { layouts: [0,], errors: [1,], leaf: 2 },
|
||||
endpoint: null
|
||||
}
|
||||
],
|
||||
prerendered_routes: new Set([]),
|
||||
matchers: async () => {
|
||||
|
||||
return { };
|
||||
},
|
||||
server_assets: {}
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
export const index = 0;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/fallbacks/layout.svelte.js')).default;
|
||||
export const universal = {
|
||||
"ssr": false
|
||||
};
|
||||
export const universal_id = "src/routes/+layout.ts";
|
||||
export const imports = ["_app/immutable/nodes/0.DCFqwZUk.js","_app/immutable/chunks/VCsPq5MH.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/L6H5smAl.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 1;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/fallbacks/error.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/1.Ck9HYfT_.js","_app/immutable/chunks/VCsPq5MH.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/E-DQD4vt.js","_app/immutable/chunks/BRJNrpWH.js","_app/immutable/chunks/V4GKpPu4.js"];
|
||||
export const stylesheets = [];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
export const index = 2;
|
||||
let component_cache;
|
||||
export const component = async () => component_cache ??= (await import('../entries/pages/_page.svelte.js')).default;
|
||||
export const imports = ["_app/immutable/nodes/2.C6jgA3H7.js","_app/immutable/chunks/VCsPq5MH.js","_app/immutable/chunks/QnfpkG_Q.js","_app/immutable/chunks/E-DQD4vt.js"];
|
||||
export const stylesheets = ["_app/immutable/assets/2.COJFZ_SK.css"];
|
||||
export const fonts = [];
|
||||
@@ -0,0 +1,557 @@
|
||||
import { get_request_store, with_request_store } from "@sveltejs/kit/internal/server";
|
||||
import { parse } from "devalue";
|
||||
import { error, json } from "@sveltejs/kit";
|
||||
import { u as stringify_remote_arg, M as MUTATIVE_METHODS, v as create_field_proxy, w as normalize_issue, x as set_nested_value, y as flatten_issues, z as deep_set, k as stringify, f as create_remote_key, h as handle_error_and_jsonify } from "./chunks/shared.js";
|
||||
import { ValidationError, HttpError, SvelteKitError } from "@sveltejs/kit/internal";
|
||||
import { B as BROWSER } from "./chunks/false.js";
|
||||
import { b as base, c as app_dir, p as prerendering } from "./chunks/environment.js";
|
||||
function create_validator(validate_or_fn, maybe_fn) {
|
||||
if (!maybe_fn) {
|
||||
return (arg) => {
|
||||
if (arg !== void 0) {
|
||||
error(400, "Bad Request");
|
||||
}
|
||||
};
|
||||
}
|
||||
if (validate_or_fn === "unchecked") {
|
||||
return (arg) => arg;
|
||||
}
|
||||
if ("~standard" in validate_or_fn) {
|
||||
return async (arg) => {
|
||||
const { event, state } = get_request_store();
|
||||
const result = await validate_or_fn["~standard"].validate(arg);
|
||||
if (result.issues) {
|
||||
error(
|
||||
400,
|
||||
await state.handleValidationError({
|
||||
issues: result.issues,
|
||||
event
|
||||
})
|
||||
);
|
||||
}
|
||||
return result.value;
|
||||
};
|
||||
}
|
||||
throw new Error(
|
||||
'Invalid validator passed to remote function. Expected "unchecked" or a Standard Schema (https://standardschema.dev)'
|
||||
);
|
||||
}
|
||||
async function get_response(info, arg, state, get_result) {
|
||||
await 0;
|
||||
const cache = get_cache(info, state);
|
||||
return cache[stringify_remote_arg(arg, state.transport)] ??= get_result();
|
||||
}
|
||||
function parse_remote_response(data, transport) {
|
||||
const revivers = {};
|
||||
for (const key in transport) {
|
||||
revivers[key] = transport[key].decode;
|
||||
}
|
||||
return parse(data, revivers);
|
||||
}
|
||||
async function run_remote_function(event, state, allow_cookies, get_input, fn) {
|
||||
const store = {
|
||||
event: {
|
||||
...event,
|
||||
setHeaders: () => {
|
||||
throw new Error("setHeaders is not allowed in remote functions");
|
||||
},
|
||||
cookies: {
|
||||
...event.cookies,
|
||||
set: (name, value, opts) => {
|
||||
if (!allow_cookies) {
|
||||
throw new Error("Cannot set cookies in `query` or `prerender` functions");
|
||||
}
|
||||
if (opts.path && !opts.path.startsWith("/")) {
|
||||
throw new Error("Cookies set in remote functions must have an absolute path");
|
||||
}
|
||||
return event.cookies.set(name, value, opts);
|
||||
},
|
||||
delete: (name, opts) => {
|
||||
if (!allow_cookies) {
|
||||
throw new Error("Cannot delete cookies in `query` or `prerender` functions");
|
||||
}
|
||||
if (opts.path && !opts.path.startsWith("/")) {
|
||||
throw new Error("Cookies deleted in remote functions must have an absolute path");
|
||||
}
|
||||
return event.cookies.delete(name, opts);
|
||||
}
|
||||
}
|
||||
},
|
||||
state: {
|
||||
...state,
|
||||
is_in_remote_function: true
|
||||
}
|
||||
};
|
||||
const input = await with_request_store(store, get_input);
|
||||
return with_request_store(store, () => fn(input));
|
||||
}
|
||||
function get_cache(info, state = get_request_store().state) {
|
||||
let cache = state.remote_data?.get(info);
|
||||
if (cache === void 0) {
|
||||
cache = {};
|
||||
(state.remote_data ??= /* @__PURE__ */ new Map()).set(info, cache);
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function command(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = { type: "command", id: "", name: "" };
|
||||
const wrapper = (arg) => {
|
||||
const { event, state } = get_request_store();
|
||||
if (!state.allows_commands) {
|
||||
const disallowed_method = !MUTATIVE_METHODS.includes(event.request.method);
|
||||
throw new Error(
|
||||
`Cannot call a command (\`${__.name}(${maybe_fn ? "..." : ""})\`) ${disallowed_method ? `from a ${event.request.method} handler or ` : ""}during server-side rendering`
|
||||
);
|
||||
}
|
||||
state.refreshes ??= {};
|
||||
const promise = Promise.resolve(
|
||||
run_remote_function(event, state, true, () => validate(arg), fn)
|
||||
);
|
||||
promise.updates = () => {
|
||||
throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {ReturnType<RemoteCommand<Input, Output>>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
Object.defineProperty(wrapper, "pending", {
|
||||
get: () => 0
|
||||
});
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function form(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const schema = !maybe_fn || validate_or_fn === "unchecked" ? null : (
|
||||
/** @type {any} */
|
||||
validate_or_fn
|
||||
);
|
||||
function create_instance(key) {
|
||||
const instance = {};
|
||||
instance.method = "POST";
|
||||
Object.defineProperty(instance, "enhance", {
|
||||
value: () => {
|
||||
return { action: instance.action, method: instance.method };
|
||||
}
|
||||
});
|
||||
const __ = {
|
||||
type: "form",
|
||||
name: "",
|
||||
id: "",
|
||||
fn: async (data, meta, form_data) => {
|
||||
const output = {};
|
||||
output.submission = true;
|
||||
const { event, state } = get_request_store();
|
||||
const validated = await schema?.["~standard"].validate(data);
|
||||
if (meta.validate_only) {
|
||||
return validated?.issues?.map((issue) => normalize_issue(issue, true)) ?? [];
|
||||
}
|
||||
if (validated?.issues !== void 0) {
|
||||
handle_issues(output, validated.issues, form_data);
|
||||
} else {
|
||||
if (validated !== void 0) {
|
||||
data = validated.value;
|
||||
}
|
||||
state.refreshes ??= {};
|
||||
const issue = create_issues();
|
||||
try {
|
||||
output.result = await run_remote_function(
|
||||
event,
|
||||
state,
|
||||
true,
|
||||
() => data,
|
||||
(data2) => !maybe_fn ? fn() : fn(data2, issue)
|
||||
);
|
||||
} catch (e) {
|
||||
if (e instanceof ValidationError) {
|
||||
handle_issues(output, e.issues, form_data);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!event.isRemoteRequest) {
|
||||
get_cache(__, state)[""] ??= output;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
Object.defineProperty(instance, "__", { value: __ });
|
||||
Object.defineProperty(instance, "action", {
|
||||
get: () => `?/remote=${__.id}`,
|
||||
enumerable: true
|
||||
});
|
||||
Object.defineProperty(instance, "fields", {
|
||||
get() {
|
||||
return create_field_proxy(
|
||||
{},
|
||||
() => get_cache(__)?.[""]?.input ?? {},
|
||||
(path, value) => {
|
||||
const cache = get_cache(__);
|
||||
const data = cache[""];
|
||||
if (data?.submission) {
|
||||
return;
|
||||
}
|
||||
if (path.length === 0) {
|
||||
(cache[""] ??= {}).input = value;
|
||||
return;
|
||||
}
|
||||
const input = data?.input ?? {};
|
||||
deep_set(input, path.map(String), value);
|
||||
(cache[""] ??= {}).input = input;
|
||||
},
|
||||
() => flatten_issues(get_cache(__)?.[""]?.issues ?? [])
|
||||
);
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "result", {
|
||||
get() {
|
||||
try {
|
||||
return get_cache(__)?.[""]?.result;
|
||||
} catch {
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
Object.defineProperty(instance, "pending", {
|
||||
get: () => 0
|
||||
});
|
||||
Object.defineProperty(instance, "preflight", {
|
||||
// preflight is a noop on the server
|
||||
value: () => instance
|
||||
});
|
||||
Object.defineProperty(instance, "validate", {
|
||||
value: () => {
|
||||
throw new Error("Cannot call validate() on the server");
|
||||
}
|
||||
});
|
||||
if (key == void 0) {
|
||||
Object.defineProperty(instance, "for", {
|
||||
/** @type {RemoteForm<any, any>['for']} */
|
||||
value: (key2) => {
|
||||
const { state } = get_request_store();
|
||||
const cache_key = __.id + "|" + JSON.stringify(key2);
|
||||
let instance2 = (state.form_instances ??= /* @__PURE__ */ new Map()).get(cache_key);
|
||||
if (!instance2) {
|
||||
instance2 = create_instance(key2);
|
||||
instance2.__.id = `${__.id}/${encodeURIComponent(JSON.stringify(key2))}`;
|
||||
instance2.__.name = __.name;
|
||||
state.form_instances.set(cache_key, instance2);
|
||||
}
|
||||
return instance2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
return create_instance();
|
||||
}
|
||||
function handle_issues(output, issues, form_data) {
|
||||
output.issues = issues.map((issue) => normalize_issue(issue, true));
|
||||
if (form_data) {
|
||||
output.input = {};
|
||||
for (let key of form_data.keys()) {
|
||||
if (/^[.\]]?_/.test(key)) continue;
|
||||
const is_array = key.endsWith("[]");
|
||||
const values = form_data.getAll(key).filter((value) => typeof value === "string");
|
||||
if (is_array) key = key.slice(0, -2);
|
||||
set_nested_value(
|
||||
/** @type {Record<string, any>} */
|
||||
output.input,
|
||||
key,
|
||||
is_array ? values : values[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
function create_issues() {
|
||||
return (
|
||||
/** @type {InvalidField<any>} */
|
||||
new Proxy(
|
||||
/** @param {string} message */
|
||||
(message) => {
|
||||
if (typeof message !== "string") {
|
||||
throw new Error(
|
||||
"`invalid` should now be imported from `@sveltejs/kit` to throw validation issues. The second parameter provided to the form function (renamed to `issue`) is still used to construct issues, e.g. `invalid(issue.field('message'))`. For more info see https://github.com/sveltejs/kit/pulls/14768"
|
||||
);
|
||||
}
|
||||
return create_issue(message);
|
||||
},
|
||||
{
|
||||
get(target, prop) {
|
||||
if (typeof prop === "symbol") return (
|
||||
/** @type {any} */
|
||||
target[prop]
|
||||
);
|
||||
return create_issue_proxy(prop, []);
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
function create_issue(message, path = []) {
|
||||
return {
|
||||
message,
|
||||
path
|
||||
};
|
||||
}
|
||||
function create_issue_proxy(key, path) {
|
||||
const new_path = [...path, key];
|
||||
const issue_func = (message) => create_issue(message, new_path);
|
||||
return new Proxy(issue_func, {
|
||||
get(target, prop) {
|
||||
if (typeof prop === "symbol") return (
|
||||
/** @type {any} */
|
||||
target[prop]
|
||||
);
|
||||
if (/^\d+$/.test(prop)) {
|
||||
return create_issue_proxy(parseInt(prop, 10), new_path);
|
||||
}
|
||||
return create_issue_proxy(prop, new_path);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function prerender(validate_or_fn, fn_or_options, maybe_options) {
|
||||
const maybe_fn = typeof fn_or_options === "function" ? fn_or_options : void 0;
|
||||
const options = maybe_options ?? (maybe_fn ? void 0 : fn_or_options);
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = {
|
||||
type: "prerender",
|
||||
id: "",
|
||||
name: "",
|
||||
has_arg: !!maybe_fn,
|
||||
inputs: options?.inputs,
|
||||
dynamic: options?.dynamic
|
||||
};
|
||||
const wrapper = (arg) => {
|
||||
const promise = (async () => {
|
||||
const { event, state } = get_request_store();
|
||||
const payload = stringify_remote_arg(arg, state.transport);
|
||||
const id = __.id;
|
||||
const url = `${base}/${app_dir}/remote/${id}${payload ? `/${payload}` : ""}`;
|
||||
if (!state.prerendering && !BROWSER && !event.isRemoteRequest) {
|
||||
try {
|
||||
return await get_response(__, arg, state, async () => {
|
||||
const key = stringify_remote_arg(arg, state.transport);
|
||||
const cache = get_cache(__, state);
|
||||
const promise3 = cache[key] ??= fetch(new URL(url, event.url.origin).href).then(
|
||||
async (response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("Prerendered response not found");
|
||||
}
|
||||
const prerendered = await response.json();
|
||||
if (prerendered.type === "error") {
|
||||
error(prerendered.status, prerendered.error);
|
||||
}
|
||||
return prerendered.result;
|
||||
}
|
||||
);
|
||||
return parse_remote_response(await promise3, state.transport);
|
||||
});
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
if (state.prerendering?.remote_responses.has(url)) {
|
||||
return (
|
||||
/** @type {Promise<any>} */
|
||||
state.prerendering.remote_responses.get(url)
|
||||
);
|
||||
}
|
||||
const promise2 = get_response(
|
||||
__,
|
||||
arg,
|
||||
state,
|
||||
() => run_remote_function(event, state, false, () => validate(arg), fn)
|
||||
);
|
||||
if (state.prerendering) {
|
||||
state.prerendering.remote_responses.set(url, promise2);
|
||||
}
|
||||
const result = await promise2;
|
||||
if (state.prerendering) {
|
||||
const body = { type: "result", result: stringify(result, state.transport) };
|
||||
state.prerendering.dependencies.set(url, {
|
||||
body: JSON.stringify(body),
|
||||
response: json(body)
|
||||
});
|
||||
}
|
||||
return result;
|
||||
})();
|
||||
promise.catch(() => {
|
||||
});
|
||||
return (
|
||||
/** @type {RemoteResource<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function query(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = { type: "query", id: "", name: "" };
|
||||
const wrapper = (arg) => {
|
||||
if (prerendering) {
|
||||
throw new Error(
|
||||
`Cannot call query '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
|
||||
);
|
||||
}
|
||||
const { event, state } = get_request_store();
|
||||
const get_remote_function_result = () => run_remote_function(event, state, false, () => validate(arg), fn);
|
||||
const promise = get_response(__, arg, state, get_remote_function_result);
|
||||
promise.catch(() => {
|
||||
});
|
||||
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
|
||||
promise.refresh = () => {
|
||||
const refresh_context = get_refresh_context(__, "refresh", arg);
|
||||
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
|
||||
const value = is_immediate_refresh ? promise : get_remote_function_result();
|
||||
return update_refresh_value(refresh_context, value, is_immediate_refresh);
|
||||
};
|
||||
promise.withOverride = () => {
|
||||
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {RemoteQuery<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
// @__NO_SIDE_EFFECTS__
|
||||
function batch(validate_or_fn, maybe_fn) {
|
||||
const fn = maybe_fn ?? validate_or_fn;
|
||||
const validate = create_validator(validate_or_fn, maybe_fn);
|
||||
const __ = {
|
||||
type: "query_batch",
|
||||
id: "",
|
||||
name: "",
|
||||
run: async (args, options) => {
|
||||
const { event, state } = get_request_store();
|
||||
return run_remote_function(
|
||||
event,
|
||||
state,
|
||||
false,
|
||||
async () => Promise.all(args.map(validate)),
|
||||
async (input) => {
|
||||
const get_result = await fn(input);
|
||||
return Promise.all(
|
||||
input.map(async (arg, i) => {
|
||||
try {
|
||||
return { type: "result", data: get_result(arg, i) };
|
||||
} catch (error2) {
|
||||
return {
|
||||
type: "error",
|
||||
error: await handle_error_and_jsonify(event, state, options, error2),
|
||||
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
|
||||
};
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
let batching = { args: [], resolvers: [] };
|
||||
const wrapper = (arg) => {
|
||||
if (prerendering) {
|
||||
throw new Error(
|
||||
`Cannot call query.batch '${__.name}' while prerendering, as prerendered pages need static data. Use 'prerender' from $app/server instead`
|
||||
);
|
||||
}
|
||||
const { event, state } = get_request_store();
|
||||
const get_remote_function_result = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
batching.args.push(arg);
|
||||
batching.resolvers.push({ resolve, reject });
|
||||
if (batching.args.length > 1) return;
|
||||
setTimeout(async () => {
|
||||
const batched = batching;
|
||||
batching = { args: [], resolvers: [] };
|
||||
try {
|
||||
return await run_remote_function(
|
||||
event,
|
||||
state,
|
||||
false,
|
||||
async () => Promise.all(batched.args.map(validate)),
|
||||
async (input) => {
|
||||
const get_result = await fn(input);
|
||||
for (let i = 0; i < batched.resolvers.length; i++) {
|
||||
try {
|
||||
batched.resolvers[i].resolve(get_result(input[i], i));
|
||||
} catch (error2) {
|
||||
batched.resolvers[i].reject(error2);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (error2) {
|
||||
for (const resolver of batched.resolvers) {
|
||||
resolver.reject(error2);
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
};
|
||||
const promise = get_response(__, arg, state, get_remote_function_result);
|
||||
promise.catch(() => {
|
||||
});
|
||||
promise.set = (value) => update_refresh_value(get_refresh_context(__, "set", arg), value);
|
||||
promise.refresh = () => {
|
||||
const refresh_context = get_refresh_context(__, "refresh", arg);
|
||||
const is_immediate_refresh = !refresh_context.cache[refresh_context.cache_key];
|
||||
const value = is_immediate_refresh ? promise : get_remote_function_result();
|
||||
return update_refresh_value(refresh_context, value, is_immediate_refresh);
|
||||
};
|
||||
promise.withOverride = () => {
|
||||
throw new Error(`Cannot call '${__.name}.withOverride()' on the server`);
|
||||
};
|
||||
return (
|
||||
/** @type {RemoteQuery<Output>} */
|
||||
promise
|
||||
);
|
||||
};
|
||||
Object.defineProperty(wrapper, "__", { value: __ });
|
||||
return wrapper;
|
||||
}
|
||||
Object.defineProperty(query, "batch", { value: batch, enumerable: true });
|
||||
function get_refresh_context(__, action, arg) {
|
||||
const { state } = get_request_store();
|
||||
const { refreshes } = state;
|
||||
if (!refreshes) {
|
||||
const name = __.type === "query_batch" ? `query.batch '${__.name}'` : `query '${__.name}'`;
|
||||
throw new Error(
|
||||
`Cannot call ${action} on ${name} because it is not executed in the context of a command/form remote function`
|
||||
);
|
||||
}
|
||||
const cache = get_cache(__, state);
|
||||
const cache_key = stringify_remote_arg(arg, state.transport);
|
||||
const refreshes_key = create_remote_key(__.id, cache_key);
|
||||
return { __, state, refreshes, refreshes_key, cache, cache_key };
|
||||
}
|
||||
function update_refresh_value({ __, refreshes, refreshes_key, cache, cache_key }, value, is_immediate_refresh = false) {
|
||||
const promise = Promise.resolve(value);
|
||||
if (!is_immediate_refresh) {
|
||||
cache[cache_key] = promise;
|
||||
}
|
||||
if (__.id) {
|
||||
refreshes[refreshes_key] = promise;
|
||||
}
|
||||
return promise.then(() => {
|
||||
});
|
||||
}
|
||||
export {
|
||||
command,
|
||||
form,
|
||||
prerender,
|
||||
query
|
||||
};
|
||||
Reference in New Issue
Block a user