🎉 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

30
node_modules/astro/dist/events/error.d.ts generated vendored Normal file
View file

@ -0,0 +1,30 @@
import type { ZodError } from 'zod';
import { type ErrorWithMetadata } from '../core/errors/index.js';
interface ErrorEventPayload {
name: string;
isFatal: boolean;
plugin?: string | undefined;
cliCommand: string;
anonymousMessageHint?: string | undefined;
}
interface ConfigErrorEventPayload extends ErrorEventPayload {
isConfig: true;
configErrorPaths: string[];
}
export declare function eventConfigError({ err, cmd, isFatal, }: {
err: ZodError;
cmd: string;
isFatal: boolean;
}): {
eventName: string;
payload: ConfigErrorEventPayload;
}[];
export declare function eventError({ cmd, err, isFatal, }: {
err: ErrorWithMetadata;
cmd: string;
isFatal: boolean;
}): {
eventName: string;
payload: ErrorEventPayload;
}[];
export {};

59
node_modules/astro/dist/events/error.js generated vendored Normal file
View file

@ -0,0 +1,59 @@
import { AstroError, AstroErrorData } from "../core/errors/index.js";
const EVENT_ERROR = "ASTRO_CLI_ERROR";
const ANONYMIZE_MESSAGE_REGEX = /^(\w| )+/;
function anonymizeErrorMessage(msg) {
const matchedMessage = msg.match(ANONYMIZE_MESSAGE_REGEX);
if (!(matchedMessage == null ? void 0 : matchedMessage[0])) {
return void 0;
}
return matchedMessage[0].trim().substring(0, 20);
}
function eventConfigError({
err,
cmd,
isFatal
}) {
const payload = {
name: "ZodError",
isFatal,
isConfig: true,
cliCommand: cmd,
configErrorPaths: err.issues.map((issue) => issue.path.join("."))
};
return [{ eventName: EVENT_ERROR, payload }];
}
function eventError({
cmd,
err,
isFatal
}) {
const errorData = AstroError.is(err) && AstroErrorData[err.name];
const payload = {
name: err.name,
plugin: err.plugin,
cliCommand: cmd,
isFatal,
anonymousMessageHint: errorData && errorData.message ? getSafeErrorMessage(errorData.message) : anonymizeErrorMessage(err.message)
};
return [{ eventName: EVENT_ERROR, payload }];
}
function getSafeErrorMessage(message) {
if (typeof message === "string") {
return message;
} else {
return String.raw({
raw: extractStringFromFunction(message.toString())
});
}
function extractStringFromFunction(func) {
const arrowIndex = func.indexOf("=>") + "=>".length;
return func.slice(arrowIndex).trim().slice(1, -1).replace(
/\${([^}]+)}/gm,
(str, match1) => `${match1.split(/\.?(?=[A-Z])/).join("_").toUpperCase()}`
).replace(/\\`/g, "`");
}
}
export {
eventConfigError,
eventError
};

4
node_modules/astro/dist/events/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,4 @@
import { AstroTelemetry } from '@astrojs/telemetry';
export declare const telemetry: AstroTelemetry;
export * from './error.js';
export * from './session.js';

12
node_modules/astro/dist/events/index.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
import { AstroTelemetry } from "@astrojs/telemetry";
import { version as viteVersion } from "vite";
import { ASTRO_VERSION } from "../core/constants.js";
const telemetry = new AstroTelemetry({
astroVersion: ASTRO_VERSION,
viteVersion
});
export * from "./error.js";
export * from "./session.js";
export {
telemetry
};

26
node_modules/astro/dist/events/session.d.ts generated vendored Normal file
View file

@ -0,0 +1,26 @@
import type { AstroUserConfig } from '../@types/astro';
interface ConfigInfo {
markdownPlugins: string[];
adapter: string | null;
integrations: string[];
trailingSlash: undefined | 'always' | 'never' | 'ignore';
build: undefined | {
format: undefined | 'file' | 'directory';
};
markdown: undefined | {
drafts: undefined | boolean;
syntaxHighlight: undefined | 'shiki' | 'prism' | false;
};
}
interface EventPayload {
cliCommand: string;
config?: ConfigInfo;
configKeys?: string[];
flags?: string[];
optionalIntegrations?: number;
}
export declare function eventCliSession(cliCommand: string, userConfig?: AstroUserConfig, flags?: Record<string, any>): {
eventName: string;
payload: EventPayload;
}[];
export {};

68
node_modules/astro/dist/events/session.js generated vendored Normal file
View file

@ -0,0 +1,68 @@
const EVENT_SESSION = "ASTRO_CLI_SESSION_STARTED";
const multiLevelKeys = /* @__PURE__ */ new Set([
"build",
"markdown",
"markdown.shikiConfig",
"server",
"vite",
"vite.resolve",
"vite.css",
"vite.json",
"vite.server",
"vite.server.fs",
"vite.build",
"vite.preview",
"vite.optimizeDeps",
"vite.ssr",
"vite.worker"
]);
function configKeys(obj, parentKey) {
if (!obj) {
return [];
}
return Object.entries(obj).map(([key, value]) => {
if (typeof value === "object" && !Array.isArray(value)) {
const localKey = parentKey ? parentKey + "." + key : key;
if (multiLevelKeys.has(localKey)) {
let keys = configKeys(value, localKey).map((subkey) => key + "." + subkey);
keys.unshift(key);
return keys;
}
}
return key;
}).flat(1);
}
function eventCliSession(cliCommand, userConfig, flags) {
var _a, _b, _c, _d, _e, _f, _g, _h;
const configValues = userConfig ? {
markdownPlugins: [
...((_b = (_a = userConfig == null ? void 0 : userConfig.markdown) == null ? void 0 : _a.remarkPlugins) == null ? void 0 : _b.map(
(p) => typeof p === "string" ? p : typeof p
)) ?? [],
...((_d = (_c = userConfig == null ? void 0 : userConfig.markdown) == null ? void 0 : _c.rehypePlugins) == null ? void 0 : _d.map(
(p) => typeof p === "string" ? p : typeof p
)) ?? []
],
adapter: ((_e = userConfig == null ? void 0 : userConfig.adapter) == null ? void 0 : _e.name) ?? null,
integrations: ((userConfig == null ? void 0 : userConfig.integrations) ?? []).filter(Boolean).flat().map((i) => i == null ? void 0 : i.name),
trailingSlash: userConfig == null ? void 0 : userConfig.trailingSlash,
build: (userConfig == null ? void 0 : userConfig.build) ? {
format: (_f = userConfig == null ? void 0 : userConfig.build) == null ? void 0 : _f.format
} : void 0,
markdown: (userConfig == null ? void 0 : userConfig.markdown) ? {
drafts: (_g = userConfig.markdown) == null ? void 0 : _g.drafts,
syntaxHighlight: (_h = userConfig.markdown) == null ? void 0 : _h.syntaxHighlight
} : void 0
} : void 0;
const cliFlags = flags ? Object.keys(flags).filter((name) => name != "_") : void 0;
const payload = {
cliCommand,
configKeys: userConfig ? configKeys(userConfig, "") : void 0,
config: configValues,
flags: cliFlags
};
return [{ eventName: EVENT_SESSION, payload }];
}
export {
eventCliSession
};