Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
35
node_modules/@astrojs/db/dist/runtime/utils.js
generated
vendored
Normal file
35
node_modules/@astrojs/db/dist/runtime/utils.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { LibsqlError } from "@libsql/client";
|
||||
import { AstroError } from "astro/errors";
|
||||
function hasPrimaryKey(column) {
|
||||
return "primaryKey" in column.schema && !!column.schema.primaryKey;
|
||||
}
|
||||
const isWindows = process?.platform === "win32";
|
||||
class AstroDbError extends AstroError {
|
||||
name = "Astro DB Error";
|
||||
}
|
||||
function isDbError(err) {
|
||||
return err instanceof LibsqlError || err instanceof Error && err.libsqlError === true;
|
||||
}
|
||||
function slash(path) {
|
||||
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
||||
if (isExtendedLengthPath) {
|
||||
return path;
|
||||
}
|
||||
return path.replace(/\\/g, "/");
|
||||
}
|
||||
function pathToFileURL(path) {
|
||||
if (isWindows) {
|
||||
let slashed = slash(path);
|
||||
if (!slashed.startsWith("/")) {
|
||||
slashed = "/" + slashed;
|
||||
}
|
||||
return new URL("file://" + slashed);
|
||||
}
|
||||
return new URL("file://" + path);
|
||||
}
|
||||
export {
|
||||
AstroDbError,
|
||||
hasPrimaryKey,
|
||||
isDbError,
|
||||
pathToFileURL
|
||||
};
|
||||
Reference in New Issue
Block a user