🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

View file

@ -0,0 +1 @@
export declare const isObjectEmpty: (o: any) => boolean;

View file

@ -0,0 +1,12 @@
const isObjectEmpty = (o) => {
if (!o) {
return true;
}
if (Array.isArray(o)) {
return o.length === 0;
}
return Object.keys(o).length === 0 && Object.getPrototypeOf(o) === Object.prototype;
};
export {
isObjectEmpty
};

View file

@ -0,0 +1 @@
export declare const isValidUrl: (s: any) => boolean;

View file

@ -0,0 +1,14 @@
const isValidUrl = (s) => {
if (typeof s !== "string" || !s) {
return false;
}
try {
const dummy = new URL(s);
return true;
} catch {
return false;
}
};
export {
isValidUrl
};

16
node_modules/@astrojs/sitemap/dist/utils/logger.d.ts generated vendored Normal file
View file

@ -0,0 +1,16 @@
export interface ILogger {
info(msg: string): void;
success(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
}
export declare class Logger implements ILogger {
private colors;
private packageName;
constructor(packageName: string);
private log;
info(msg: string): void;
success(msg: string): void;
warn(msg: string): void;
error(msg: string): void;
}

34
node_modules/@astrojs/sitemap/dist/utils/logger.js generated vendored Normal file
View file

@ -0,0 +1,34 @@
class Logger {
constructor(packageName) {
this.colors = {
reset: "\x1B[0m",
fg: {
red: "\x1B[31m",
green: "\x1B[32m",
yellow: "\x1B[33m"
}
};
this.packageName = packageName;
}
log(msg, prefix = "") {
console.log(`%s${this.packageName}:%s ${msg}
`, prefix, prefix ? this.colors.reset : "");
}
info(msg) {
this.log(msg);
}
success(msg) {
this.log(msg, this.colors.fg.green);
}
warn(msg) {
this.log(`Skipped!
${msg}`, this.colors.fg.yellow);
}
error(msg) {
this.log(`Failed!
${msg}`, this.colors.fg.red);
}
}
export {
Logger
};

View file

@ -0,0 +1,4 @@
export declare const parseUrl: (url: string, defaultLocale: string, localeCodes: string[], base: string) => {
locale: string;
path: string;
} | undefined;

31
node_modules/@astrojs/sitemap/dist/utils/parse-url.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
const parseUrl = (url, defaultLocale, localeCodes, base) => {
if (!url || !defaultLocale || localeCodes.length === 0 || localeCodes.some((key) => !key) || !base) {
throw new Error("parseUrl: some parameters are empty");
}
if (url.indexOf(base) !== 0) {
return void 0;
}
let s = url.replace(base, "");
if (!s || s === "/") {
return { locale: defaultLocale, path: "/" };
}
if (!s.startsWith("/")) {
s = "/" + s;
}
const a = s.split("/");
const locale = a[1];
if (localeCodes.some((key) => key === locale)) {
let path = a.slice(2).join("/");
if (path === "//") {
path = "/";
}
if (path !== "/" && !path.startsWith("/")) {
path = "/" + path;
}
return { locale, path };
}
return { locale: defaultLocale, path: s };
};
export {
parseUrl
};