gabeefran.co-blog/.vercel/output/_functions/chunks/compiler_DiXpMM4i.mjs

47 lines
1.5 KiB
JavaScript

import { Z as AstroError, y as InvalidComponentArgs } from "./errors-data_zYnyWRO_.mjs";
import "./jsx-runtime_DseUv9uh.mjs";
//#region \0rolldown/runtime.js
var __defProp = Object.defineProperty;
var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
return target;
};
//#endregion
//#region node_modules/astro/dist/runtime/server/astro-component.js
function validateArgs(args) {
if (args.length !== 3) return false;
if (!args[0] || typeof args[0] !== "object") return false;
return true;
}
function baseCreateComponent(cb, moduleId, propagation) {
const name = moduleId?.split("/").pop()?.replace(".astro", "") ?? "";
const fn = (...args) => {
if (!validateArgs(args)) throw new AstroError({
...InvalidComponentArgs,
message: InvalidComponentArgs.message(name)
});
return cb(...args);
};
Object.defineProperty(fn, "name", {
value: name,
writable: false
});
fn.isAstroComponentFactory = true;
fn.moduleId = moduleId;
fn.propagation = propagation;
return fn;
}
function createComponentWithOptions(opts) {
return baseCreateComponent(opts.factory, opts.moduleId, opts.propagation);
}
function createComponent(arg1, moduleId, propagation) {
if (typeof arg1 === "function") return baseCreateComponent(arg1, moduleId, propagation);
else return createComponentWithOptions(arg1);
}
//#endregion
export { __exportAll as n, createComponent as t };