astro-integration-kit
Advanced tools
Comparing version 0.15.0 to 0.16.0
import { AstroIntegration } from 'astro'; | ||
import { z } from 'astro/zod'; | ||
import { Prettify } from '../internal/types.js'; | ||
import { ExtendedPrettify } from '../internal/types.js'; | ||
import { Hooks } from './types.js'; | ||
type AstroIntegrationSetupFn<Options extends z.ZodTypeAny> = (params: { | ||
type AstroIntegrationSetupFn<Options extends z.ZodTypeAny, TApi> = (params: { | ||
name: string; | ||
options: z.output<Options>; | ||
}) => Omit<AstroIntegration, "name" | "hooks"> & { | ||
}) => Omit<AstroIntegration, "name" | "hooks"> & TApi & { | ||
hooks: Partial<Hooks>; | ||
@@ -32,11 +32,11 @@ }; | ||
*/ | ||
declare const defineIntegration: <TOptionsSchema extends z.ZodTypeAny = z.ZodNever, TSetup extends AstroIntegrationSetupFn<TOptionsSchema> = AstroIntegrationSetupFn<TOptionsSchema>>({ name, optionsSchema, setup, }: { | ||
declare const defineIntegration: <TApiBase, TApi extends ExtendedPrettify<Omit<TApiBase, keyof AstroIntegration>>, TOptionsSchema extends z.ZodTypeAny = z.ZodNever>({ name, optionsSchema, setup, }: { | ||
name: string; | ||
optionsSchema?: TOptionsSchema; | ||
setup: TSetup; | ||
setup: AstroIntegrationSetupFn<TOptionsSchema, TApiBase>; | ||
}) => ((...args: [z.input<TOptionsSchema>] extends [ | ||
never | ||
] ? [ | ||
] : undefined extends z.input<TOptionsSchema> ? [options?: z.input<TOptionsSchema>] : [options: z.input<TOptionsSchema>]) => AstroIntegration & Prettify<Omit<ReturnType<TSetup>, keyof AstroIntegration>>); | ||
] : undefined extends z.input<TOptionsSchema> ? [options?: z.input<TOptionsSchema>] : [options: z.input<TOptionsSchema>]) => AstroIntegration & TApi); | ||
export { defineIntegration }; |
import{AstroError as y}from"astro/errors";import{z as g}from"astro/zod";var u=(e,n)=>{let o=c(e.path);if(e.code==="invalid_union"){let r=new Map;for(let t of e.unionErrors.flatMap(i=>i.errors))if(t.code==="invalid_type"||t.code==="invalid_literal"){let i=c(t.path);r.has(i)?r.get(i).expected.push(t.expected):r.set(i,{code:t.code,received:t.received,expected:[t.expected]})}return{message:[s(o,r.size?"Did not match union:":"Did not match union.")].concat([...r.entries()].filter(([,t])=>t.expected.length===e.unionErrors.length).map(([t,i])=>t===o?`> ${a(i)}`:`> ${s(t,a(i))}`)).join(` | ||
`)}}return e.code==="invalid_literal"||e.code==="invalid_type"?{message:s(o,a({code:e.code,received:e.received,expected:[e.expected]}))}:e.message?{message:s(o,e.message)}:{message:s(o,n.defaultError)}},a=e=>{if(e.received==="undefined")return"Required";let n=new Set(e.expected);switch(e.code){case"invalid_type":return`Expected type \`${d(n)}\`, received ${JSON.stringify(e.received)}`;case"invalid_literal":return`Expected \`${d(n)}\`, received ${JSON.stringify(e.received)}`}},s=(e,n)=>e.length?`**${e}**: ${n}`:n,d=e=>[...e].map((n,o)=>o===0?JSON.stringify(n):` | ${JSON.stringify(n)}`).join(""),c=e=>e.join(".");var v=({name:e,optionsSchema:n,setup:o})=>(...r)=>{let p=(n??g.never().optional()).safeParse(r[0],{errorMap:u});if(!p.success)throw new y(`Invalid options passed to "${e}" integration | ||
`,p.error.issues.map(m=>m.message).join(` | ||
`));let t=p.data,i=o({name:e,options:t});return{name:e,...i}};export{v as defineIntegration}; | ||
`)}}return e.code==="invalid_literal"||e.code==="invalid_type"?{message:s(o,a({code:e.code,received:e.received,expected:[e.expected]}))}:e.message?{message:s(o,e.message)}:{message:s(o,n.defaultError)}},a=e=>{if(e.received==="undefined")return"Required";let n=new Set(e.expected);switch(e.code){case"invalid_type":return`Expected type \`${d(n)}\`, received ${JSON.stringify(e.received)}`;case"invalid_literal":return`Expected \`${d(n)}\`, received ${JSON.stringify(e.received)}`}},s=(e,n)=>e.length?`**${e}**: ${n}`:n,d=e=>[...e].map((n,o)=>o===0?JSON.stringify(n):` | ${JSON.stringify(n)}`).join(""),c=e=>e.join(".");var T=({name:e,optionsSchema:n,setup:o})=>(...r)=>{let p=(n??g.never().optional()).safeParse(r[0],{errorMap:u});if(!p.success)throw new y(`Invalid options passed to "${e}" integration | ||
`,p.error.issues.map(l=>l.message).join(` | ||
`));let t=p.data,{hooks:i,...m}=o({name:e,options:t});return{...m,hooks:i,name:e}};export{T as defineIntegration}; | ||
//# sourceMappingURL=define-integration.js.map |
import { HookParameters } from 'astro'; | ||
import { Hooks } from './types.js'; | ||
import '../internal/types.js'; | ||
/** | ||
* A utility to be used on an Astro hook. | ||
* | ||
* @see defineUtility | ||
*/ | ||
type HookUtility<THook extends keyof Hooks, TArgs extends Array<any>, TReturn> = (params: HookParameters<THook>, ...args: TArgs) => TReturn; | ||
/** | ||
* Allows defining a type-safe function requiring all the params of a given hook. | ||
@@ -18,4 +26,4 @@ * It uses currying to make TypeScript happy. | ||
*/ | ||
declare const defineUtility: <THook extends keyof Astro.IntegrationHooks>(_hook: THook) => <TArgs extends any[], T>(fn: (params: HookParameters<THook>, ...args: TArgs) => T) => (params: HookParameters<THook>, ...args: TArgs) => T; | ||
declare const defineUtility: <THook extends keyof Astro.IntegrationHooks>(_hook: THook) => <TArgs extends any[], T>(fn: HookUtility<THook, TArgs, T>) => HookUtility<THook, TArgs, T>; | ||
export { defineUtility }; | ||
export { type HookUtility, defineUtility }; |
@@ -1,2 +0,2 @@ | ||
var e=r=>o=>o;export{e as defineUtility}; | ||
var e=t=>o=>o;export{e as defineUtility}; | ||
//# sourceMappingURL=define-utility.js.map |
@@ -5,3 +5,3 @@ export { createResolver } from './create-resolver.js'; | ||
export { defineAllHooksPlugin } from './define-all-hooks-plugin.js'; | ||
export { defineUtility } from './define-utility.js'; | ||
export { HookUtility, defineUtility } from './define-utility.js'; | ||
export { withPlugins } from './with-plugins.js'; | ||
@@ -20,3 +20,2 @@ export { AddedParam, AnyPlugin, DevToolbarFrameworkAppProps, ExtendedHooks, Hooks, Plugin, PluginHooksConstraint } from './types.js'; | ||
import '../internal/types.js'; | ||
import '../type-utils.d-CSknV27i.js'; | ||
import 'vite'; |
@@ -1,7 +0,7 @@ | ||
import{fileURLToPath as j}from"node:url";import{dirname as $,resolve as E}from"pathe";var N=e=>{let t=e;return t.startsWith("file://")&&(t=$(j(t))),{resolve:(...n)=>E(t,...n)}};import{AstroError as b}from"astro/errors";import{z as U}from"astro/zod";var I=(e,t)=>{let n=A(e.path);if(e.code==="invalid_union"){let o=new Map;for(let i of e.unionErrors.flatMap(s=>s.errors))if(i.code==="invalid_type"||i.code==="invalid_literal"){let s=A(i.path);o.has(s)?o.get(s).expected.push(i.expected):o.set(s,{code:i.code,received:i.received,expected:[i.expected]})}return{message:[u(n,o.size?"Did not match union:":"Did not match union.")].concat([...o.entries()].filter(([,i])=>i.expected.length===e.unionErrors.length).map(([i,s])=>i===n?`> ${h(s)}`:`> ${u(i,h(s))}`)).join(` | ||
`)}}return e.code==="invalid_literal"||e.code==="invalid_type"?{message:u(n,h({code:e.code,received:e.received,expected:[e.expected]}))}:e.message?{message:u(n,e.message)}:{message:u(n,t.defaultError)}},h=e=>{if(e.received==="undefined")return"Required";let t=new Set(e.expected);switch(e.code){case"invalid_type":return`Expected type \`${k(t)}\`, received ${JSON.stringify(e.received)}`;case"invalid_literal":return`Expected \`${k(t)}\`, received ${JSON.stringify(e.received)}`}},u=(e,t)=>e.length?`**${e}**: ${t}`:t,k=e=>[...e].map((t,n)=>n===0?JSON.stringify(t):` | ${JSON.stringify(t)}`).join(""),A=e=>e.join(".");var D=({name:e,optionsSchema:t,setup:n})=>(...o)=>{let r=(t??U.never().optional()).safeParse(o[0],{errorMap:I});if(!r.success)throw new b(`Invalid options passed to "${e}" integration | ||
`,r.error.issues.map(a=>a.message).join(` | ||
`));let i=r.data,s=n({name:e,options:i});return{name:e,...s}};var P=e=>e;var V=e=>P({...e,setup:(...t)=>{let n=e.setup(...t);return new Proxy(Object.freeze({}),{has:(o,r)=>typeof r=="string",get:(o,r)=>n(r)})}});var p=e=>t=>t;var L=e=>{let{name:t,plugins:n,hooks:o,...r}=e,i=n.filter((c,f,l)=>l.findLastIndex(d=>d.name===c.name)===f).map(c=>c.setup({name:t})),s=[...Object.keys(o),...i.flatMap(Object.keys)].filter((c,f,l)=>l.indexOf(c)===f);return{hooks:Object.fromEntries(s.map(c=>[c,f=>{let l=i.filter(g=>c in g&&!!g[c]),d={};for(let g of l)Object.assign(d,g[c](f));return o[c]?.({...d,...f})}])),...r}};import{mkdirSync as z,readFileSync as _,writeFileSync as w}from"node:fs";import{dirname as C,relative as M}from"node:path";import{fileURLToPath as y}from"node:url";import{parse as F,prettyPrint as W}from"recast";import B from"recast/parsers/typescript.js";var Z=({srcDir:e,logger:t,specifier:n})=>{let o=y(new URL("env.d.ts",e));n instanceof URL&&(n=y(n),n=M(y(e),n),n=n.replaceAll("\\","/"));let r=_(o,"utf8");if(r.includes(`/// <reference types='${n}' />`)||r.includes(`/// <reference types="${n}" />`))return;let i=r.replace("/// <reference types='astro/client' />",`/// <reference types='astro/client' /> | ||
import{fileURLToPath as E}from"node:url";import{dirname as j,resolve as $}from"pathe";var U=e=>{let t=e;return t.startsWith("file://")&&(t=j(E(t))),{resolve:(...n)=>$(t,...n)}};import{AstroError as N}from"astro/errors";import{z as b}from"astro/zod";var H=(e,t)=>{let n=v(e.path);if(e.code==="invalid_union"){let o=new Map;for(let i of e.unionErrors.flatMap(s=>s.errors))if(i.code==="invalid_type"||i.code==="invalid_literal"){let s=v(i.path);o.has(s)?o.get(s).expected.push(i.expected):o.set(s,{code:i.code,received:i.received,expected:[i.expected]})}return{message:[m(n,o.size?"Did not match union:":"Did not match union.")].concat([...o.entries()].filter(([,i])=>i.expected.length===e.unionErrors.length).map(([i,s])=>i===n?`> ${h(s)}`:`> ${m(i,h(s))}`)).join(` | ||
`)}}return e.code==="invalid_literal"||e.code==="invalid_type"?{message:m(n,h({code:e.code,received:e.received,expected:[e.expected]}))}:e.message?{message:m(n,e.message)}:{message:m(n,t.defaultError)}},h=e=>{if(e.received==="undefined")return"Required";let t=new Set(e.expected);switch(e.code){case"invalid_type":return`Expected type \`${k(t)}\`, received ${JSON.stringify(e.received)}`;case"invalid_literal":return`Expected \`${k(t)}\`, received ${JSON.stringify(e.received)}`}},m=(e,t)=>e.length?`**${e}**: ${t}`:t,k=e=>[...e].map((t,n)=>n===0?JSON.stringify(t):` | ${JSON.stringify(t)}`).join(""),v=e=>e.join(".");var D=({name:e,optionsSchema:t,setup:n})=>(...o)=>{let r=(t??b.never().optional()).safeParse(o[0],{errorMap:H});if(!r.success)throw new N(`Invalid options passed to "${e}" integration | ||
`,r.error.issues.map(c=>c.message).join(` | ||
`));let i=r.data,{hooks:s,...a}=n({name:e,options:i});return{...a,hooks:s,name:e}};var P=e=>e;var V=e=>P({...e,setup:(...t)=>{let n=e.setup(...t);return new Proxy(Object.freeze({}),{has:(o,r)=>typeof r=="string",get:(o,r)=>n(r)})}});var p=e=>t=>t;var L=e=>{let{name:t,plugins:n,hooks:o,...r}=e,i=n.filter((c,l,f)=>f.findLastIndex(d=>d.name===c.name)===l).map(c=>c.setup({name:t})),s=[...Object.keys(o),...i.flatMap(Object.keys)].filter((c,l,f)=>f.indexOf(c)===l);return{hooks:Object.fromEntries(s.map(c=>[c,l=>{let f=i.filter(g=>c in g&&!!g[c]),d={};for(let g of f)Object.assign(d,g[c](l));return o[c]?.({...d,...l})}])),...r}};import{mkdirSync as z,readFileSync as _,writeFileSync as I}from"node:fs";import{dirname as C,relative as M}from"node:path";import{fileURLToPath as y}from"node:url";import{parse as W,prettyPrint as F}from"recast";import B from"recast/parsers/typescript.js";var Z=({srcDir:e,logger:t,specifier:n})=>{let o=y(new URL("env.d.ts",e));n instanceof URL&&(n=y(n),n=M(y(e),n),n=n.replaceAll("\\","/"));let r=_(o,"utf8");if(r.includes(`/// <reference types='${n}' />`)||r.includes(`/// <reference types="${n}" />`))return;let i=r.replace("/// <reference types='astro/client' />",`/// <reference types='astro/client' /> | ||
/// <reference types='${n}' />`).replace('/// <reference types="astro/client" />',`/// <reference types="astro/client" /> | ||
/// <reference types="${n}" />`);i!==r&&(w(o,i),t.info("Updated env.d.ts types"))},J=p("astro:config:setup")(({config:{root:e,srcDir:t},logger:n},{name:o,content:r})=>{let i=new URL(`.astro/${o}.d.ts`,e),s=y(i);Z({srcDir:t,logger:n,specifier:i}),z(C(s),{recursive:!0}),w(s,W(F(r,{parser:B}),{tabWidth:4}).code,"utf-8")});import{AstroError as O}from"astro/errors";function x(e){let t=[];if(e){for(let n of e)if(n){if(Array.isArray(n)){t.push(...x(n));continue}n instanceof Promise||t.push(n.name)}}return t}var m=p("astro:config:setup")(({config:e},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let n=new Set(x(e?.vite?.plugins)),o=new Set;if(typeof t=="string"&&o.add(t),typeof t=="object")if(Array.isArray(t)){let r=new Set(x(t));for(let i of r)o.add(i)}else o.add(t.name);return[...o].some(r=>n.has(r))});var T=p("astro:config:setup")((e,{plugin:t,warnDuplicated:n=!0})=>{let{updateConfig:o,logger:r}=e;n&&m(e,{plugin:t})&&r.warn(`The Vite plugin "${t.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),o({vite:{plugins:[t]}})});var q=e=>{let t=1;return`${e.replace(/-(\d+)$/,(n,o)=>(t=parseInt(o)+1,""))}-${t}`},H=e=>`\0${e}`,Y=(e,t,n)=>{let o=Array.isArray(t)?t:Object.entries(t).map(([s,a])=>({id:s,content:a,context:void 0})),r={};for(let{id:s,context:a}of o)r[s]??=[],r[s]?.push(...a===void 0?["server","client"]:[a]);for(let[s,a]of Object.entries(r))if(a.length!==[...new Set(a)].length)throw new O(`Virtual import with id "${s}" has been registered several times with conflicting contexts.`);let i=Object.fromEntries(o.map(({id:s})=>{if(!n&&s.startsWith("astro:"))throw new O(`Virtual import name prefix can't be "astro:" (for "${s}") because it's reserved for Astro core.`);return[H(s),s]}));return{name:e,resolveId(s){if(o.find(a=>a.id===s))return H(s)},load(s,a){let c=i[s];if(c){let f=a?.ssr?"server":"client",l=o.find(d=>d.id===c&&(d.context===void 0||d.context===f));if(l)return l.content}}}},G=p("astro:config:setup")((e,{name:t,imports:n,__enableCorePowerDoNotUseOrYouWillBeFired:o=!1})=>{let r=`vite-plugin-${t}`;for(;m(e,{plugin:r});)r=q(r);T(e,{warnDuplicated:!1,plugin:Y(r,n,o)})});import{AstroError as S}from"astro/errors";var v=p("astro:config:setup")(({config:e},{name:t,position:n,relativeTo:o})=>{let r=e.integrations.findIndex(s=>s.name===t);if(r===-1)return!1;if(n===void 0)return!0;if(o===void 0)throw new S("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let i=e.integrations.findIndex(s=>s.name===o);if(i===-1)throw new S("Cannot check relative position against an absent integration.");return n==="before"?r<i:r>i});var K=p("astro:config:setup")(({command:e,injectRoute:t},n)=>{e==="dev"&&t(n)});import{readdirSync as Q,statSync as X}from"node:fs";import{join as ee,relative as te,resolve as ne}from"pathe";var R=(e,t=e)=>{let n=Q(e),o=[];for(let r of n){let i=ee(e,r);if(X(i).isDirectory()){let a=R(i,t);o=o.concat(a)}else{let a=te(t,i);o.push(a)}}return o},oe=p("astro:config:setup")(({addWatchFile:e,command:t,updateConfig:n},o)=>{if(t!=="dev")return;let r=R(o).map(i=>ne(o,i));for(let i of r)e(i);n({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let i of r)this.addWatchFile(i)}}]}})});import"astro";var re=p("astro:config:setup")((e,{integration:t,ensureUnique:n})=>{let{logger:o,updateConfig:r}=e;if(n&&v(e,{name:t.name})){o.warn(`Integration "${t.name}" has already been added by the user or another integration. Skipping.`);return}r({integrations:[t]})});export{J as addDts,re as addIntegration,G as addVirtualImports,T as addVitePlugin,N as createResolver,V as defineAllHooksPlugin,D as defineIntegration,P as definePlugin,p as defineUtility,v as hasIntegration,m as hasVitePlugin,K as injectDevRoute,oe as watchDirectory,L as withPlugins}; | ||
/// <reference types="${n}" />`);i!==r&&(I(o,i),t.info("Updated env.d.ts types"))},J=p("astro:config:setup")(({config:{root:e,srcDir:t},logger:n},{name:o,content:r})=>{let i=new URL(`.astro/${o}.d.ts`,e),s=y(i);Z({srcDir:t,logger:n,specifier:i}),z(C(s),{recursive:!0}),I(s,F(W(r,{parser:B}),{tabWidth:4}).code,"utf-8")});import{AstroError as w}from"astro/errors";function x(e){let t=[];if(e){for(let n of e)if(n){if(Array.isArray(n)){t.push(...x(n));continue}n instanceof Promise||t.push(n.name)}}return t}var u=p("astro:config:setup")(({config:e},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let n=new Set(x(e?.vite?.plugins)),o=new Set;if(typeof t=="string"&&o.add(t),typeof t=="object")if(Array.isArray(t)){let r=new Set(x(t));for(let i of r)o.add(i)}else o.add(t.name);return[...o].some(r=>n.has(r))});var A=p("astro:config:setup")((e,{plugin:t,warnDuplicated:n=!0})=>{let{updateConfig:o,logger:r}=e;n&&u(e,{plugin:t})&&r.warn(`The Vite plugin "${t.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),o({vite:{plugins:[t]}})});var q=e=>{let t=1;return`${e.replace(/-(\d+)$/,(n,o)=>(t=parseInt(o)+1,""))}-${t}`},O=e=>`\0${e}`,Y=(e,t,n)=>{let o=Array.isArray(t)?t:Object.entries(t).map(([s,a])=>({id:s,content:a,context:void 0})),r={};for(let{id:s,context:a}of o)r[s]??=[],r[s]?.push(...a===void 0?["server","client"]:[a]);for(let[s,a]of Object.entries(r))if(a.length!==[...new Set(a)].length)throw new w(`Virtual import with id "${s}" has been registered several times with conflicting contexts.`);let i=Object.fromEntries(o.map(({id:s})=>{if(!n&&s.startsWith("astro:"))throw new w(`Virtual import name prefix can't be "astro:" (for "${s}") because it's reserved for Astro core.`);return[O(s),s]}));return{name:e,resolveId(s){if(o.find(a=>a.id===s))return O(s)},load(s,a){let c=i[s];if(c){let l=a?.ssr?"server":"client",f=o.find(d=>d.id===c&&(d.context===void 0||d.context===l));if(f)return f.content}}}},G=p("astro:config:setup")((e,{name:t,imports:n,__enableCorePowerDoNotUseOrYouWillBeFired:o=!1})=>{let r=`vite-plugin-${t}`;for(;u(e,{plugin:r});)r=q(r);A(e,{warnDuplicated:!1,plugin:Y(r,n,o)})});import{AstroError as R}from"astro/errors";var T=p("astro:config:setup")(({config:e},{name:t,position:n,relativeTo:o})=>{let r=e.integrations.findIndex(s=>s.name===t);if(r===-1)return!1;if(n===void 0)return!0;if(o===void 0)throw new R("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let i=e.integrations.findIndex(s=>s.name===o);if(i===-1)throw new R("Cannot check relative position against an absent integration.");return n==="before"?r<i:r>i});var K=p("astro:config:setup")(({command:e,injectRoute:t},n)=>{e==="dev"&&t(n)});import{readdirSync as Q,statSync as X}from"node:fs";import{join as ee,relative as te,resolve as ne}from"pathe";var S=(e,t=e)=>{let n=Q(e),o=[];for(let r of n){let i=ee(e,r);if(X(i).isDirectory()){let a=S(i,t);o=o.concat(a)}else{let a=te(t,i);o.push(a)}}return o},oe=p("astro:config:setup")(({addWatchFile:e,command:t,updateConfig:n},o)=>{if(t!=="dev")return;let r=S(o).map(i=>ne(o,i));for(let i of r)e(i);n({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let i of r)this.addWatchFile(i)}}]}})});import"astro";var re=p("astro:config:setup")((e,{integration:t,ensureUnique:n})=>{let{logger:o,updateConfig:r}=e;if(n&&T(e,{name:t.name})){o.warn(`Integration "${t.name}" has already been added by the user or another integration. Skipping.`);return}r({integrations:[t]})});export{J as addDts,re as addIntegration,G as addVirtualImports,A as addVitePlugin,U as createResolver,V as defineAllHooksPlugin,D as defineIntegration,P as definePlugin,p as defineUtility,T as hasIntegration,u as hasVitePlugin,K as injectDevRoute,oe as watchDirectory,L as withPlugins}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,5 @@ | ||
import{z as h}from"astro/zod";import{AstroError as T}from"astro/errors";import{z as v}from"astro/zod";var u=(t,n)=>{let r=m(t.path);if(t.code==="invalid_union"){let o=new Map;for(let e of t.unionErrors.flatMap(i=>i.errors))if(e.code==="invalid_type"||e.code==="invalid_literal"){let i=m(e.path);o.has(i)?o.get(i).expected.push(e.expected):o.set(i,{code:e.code,received:e.received,expected:[e.expected]})}return{message:[p(r,o.size?"Did not match union:":"Did not match union.")].concat([...o.entries()].filter(([,e])=>e.expected.length===t.unionErrors.length).map(([e,i])=>e===r?`> ${c(i)}`:`> ${p(e,c(i))}`)).join(` | ||
`)}}return t.code==="invalid_literal"||t.code==="invalid_type"?{message:p(r,c({code:t.code,received:t.received,expected:[t.expected]}))}:t.message?{message:p(r,t.message)}:{message:p(r,n.defaultError)}},c=t=>{if(t.received==="undefined")return"Required";let n=new Set(t.expected);switch(t.code){case"invalid_type":return`Expected type \`${d(n)}\`, received ${JSON.stringify(t.received)}`;case"invalid_literal":return`Expected \`${d(n)}\`, received ${JSON.stringify(t.received)}`}},p=(t,n)=>t.length?`**${t}**: ${n}`:n,d=t=>[...t].map((n,r)=>r===0?JSON.stringify(n):` | ${JSON.stringify(n)}`).join(""),m=t=>t.join(".");var f=({name:t,optionsSchema:n,setup:r})=>(...o)=>{let s=(n??v.never().optional()).safeParse(o[0],{errorMap:u});if(!s.success)throw new T(`Invalid options passed to "${t}" integration | ||
`,s.error.issues.map(a=>a.message).join(` | ||
`));let e=s.data,i=r({name:t,options:e});return{name:t,...i}};import{readdirSync as S,statSync as x}from"node:fs";import{join as O,relative as k,resolve as A}from"pathe";var y=t=>n=>n;var l=(t,n=t)=>{let r=S(t),o=[];for(let s of r){let e=O(t,s);if(x(e).isDirectory()){let a=l(e,n);o=o.concat(a)}else{let a=k(n,e);o.push(a)}}return o},g=y("astro:config:setup")(({addWatchFile:t,command:n,updateConfig:r},o)=>{if(n!=="dev")return;let s=l(o).map(e=>A(o,e));for(let e of s)t(e);r({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let e of s)this.addWatchFile(e)}}]}})});var N=f({name:"astro-integration-kit/hmr",optionsSchema:h.object({directory:h.string()}),setup({options:t}){return{hooks:{"astro:config:setup":n=>{g(n,t.directory)}}}}});export{N as hmrIntegration}; | ||
import{z as h}from"astro/zod";import{AstroError as x}from"astro/errors";import{z as v}from"astro/zod";var f=(t,o)=>{let r=m(t.path);if(t.code==="invalid_union"){let n=new Map;for(let e of t.unionErrors.flatMap(i=>i.errors))if(e.code==="invalid_type"||e.code==="invalid_literal"){let i=m(e.path);n.has(i)?n.get(i).expected.push(e.expected):n.set(i,{code:e.code,received:e.received,expected:[e.expected]})}return{message:[p(r,n.size?"Did not match union:":"Did not match union.")].concat([...n.entries()].filter(([,e])=>e.expected.length===t.unionErrors.length).map(([e,i])=>e===r?`> ${c(i)}`:`> ${p(e,c(i))}`)).join(` | ||
`)}}return t.code==="invalid_literal"||t.code==="invalid_type"?{message:p(r,c({code:t.code,received:t.received,expected:[t.expected]}))}:t.message?{message:p(r,t.message)}:{message:p(r,o.defaultError)}},c=t=>{if(t.received==="undefined")return"Required";let o=new Set(t.expected);switch(t.code){case"invalid_type":return`Expected type \`${d(o)}\`, received ${JSON.stringify(t.received)}`;case"invalid_literal":return`Expected \`${d(o)}\`, received ${JSON.stringify(t.received)}`}},p=(t,o)=>t.length?`**${t}**: ${o}`:o,d=t=>[...t].map((o,r)=>r===0?JSON.stringify(o):` | ${JSON.stringify(o)}`).join(""),m=t=>t.join(".");var y=({name:t,optionsSchema:o,setup:r})=>(...n)=>{let s=(o??v.never().optional()).safeParse(n[0],{errorMap:f});if(!s.success)throw new x(`Invalid options passed to "${t}" integration | ||
`,s.error.issues.map(T=>T.message).join(` | ||
`));let e=s.data,{hooks:i,...a}=r({name:t,options:e});return{...a,hooks:i,name:t}};import{readdirSync as k,statSync as A}from"node:fs";import{join as O,relative as S,resolve as H}from"pathe";var l=t=>o=>o;var u=(t,o=t)=>{let r=k(t),n=[];for(let s of r){let e=O(t,s);if(A(e).isDirectory()){let a=u(e,o);n=n.concat(a)}else{let a=S(o,e);n.push(a)}}return n},g=l("astro:config:setup")(({addWatchFile:t,command:o,updateConfig:r},n)=>{if(o!=="dev")return;let s=u(n).map(e=>H(n,e));for(let e of s)t(e);r({vite:{plugins:[{name:`rollup-aik-watch-directory-${n}`,buildStart(){for(let e of s)this.addWatchFile(e)}}]}})});var N=y({name:"astro-integration-kit/hmr",optionsSchema:h.object({directory:h.string()}),setup({options:t}){return{hooks:{"astro:config:setup":o=>{g(o,t.directory)}}}}});export{N as hmrIntegration}; | ||
//# sourceMappingURL=hmr-integration.js.map |
@@ -1,5 +0,5 @@ | ||
import{z as h}from"astro/zod";import{AstroError as T}from"astro/errors";import{z as v}from"astro/zod";var u=(t,n)=>{let r=m(t.path);if(t.code==="invalid_union"){let o=new Map;for(let e of t.unionErrors.flatMap(i=>i.errors))if(e.code==="invalid_type"||e.code==="invalid_literal"){let i=m(e.path);o.has(i)?o.get(i).expected.push(e.expected):o.set(i,{code:e.code,received:e.received,expected:[e.expected]})}return{message:[p(r,o.size?"Did not match union:":"Did not match union.")].concat([...o.entries()].filter(([,e])=>e.expected.length===t.unionErrors.length).map(([e,i])=>e===r?`> ${c(i)}`:`> ${p(e,c(i))}`)).join(` | ||
`)}}return t.code==="invalid_literal"||t.code==="invalid_type"?{message:p(r,c({code:t.code,received:t.received,expected:[t.expected]}))}:t.message?{message:p(r,t.message)}:{message:p(r,n.defaultError)}},c=t=>{if(t.received==="undefined")return"Required";let n=new Set(t.expected);switch(t.code){case"invalid_type":return`Expected type \`${d(n)}\`, received ${JSON.stringify(t.received)}`;case"invalid_literal":return`Expected \`${d(n)}\`, received ${JSON.stringify(t.received)}`}},p=(t,n)=>t.length?`**${t}**: ${n}`:n,d=t=>[...t].map((n,r)=>r===0?JSON.stringify(n):` | ${JSON.stringify(n)}`).join(""),m=t=>t.join(".");var f=({name:t,optionsSchema:n,setup:r})=>(...o)=>{let s=(n??v.never().optional()).safeParse(o[0],{errorMap:u});if(!s.success)throw new T(`Invalid options passed to "${t}" integration | ||
`,s.error.issues.map(a=>a.message).join(` | ||
`));let e=s.data,i=r({name:t,options:e});return{name:t,...i}};import{readdirSync as S,statSync as x}from"node:fs";import{join as O,relative as k,resolve as A}from"pathe";var y=t=>n=>n;var l=(t,n=t)=>{let r=S(t),o=[];for(let s of r){let e=O(t,s);if(x(e).isDirectory()){let a=l(e,n);o=o.concat(a)}else{let a=k(n,e);o.push(a)}}return o},g=y("astro:config:setup")(({addWatchFile:t,command:n,updateConfig:r},o)=>{if(n!=="dev")return;let s=l(o).map(e=>A(o,e));for(let e of s)t(e);r({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let e of s)this.addWatchFile(e)}}]}})});var P=f({name:"astro-integration-kit/hmr",optionsSchema:h.object({directory:h.string()}),setup({options:t}){return{hooks:{"astro:config:setup":n=>{g(n,t.directory)}}}}});export{P as hmrIntegration}; | ||
import{z as h}from"astro/zod";import{AstroError as x}from"astro/errors";import{z as v}from"astro/zod";var f=(t,o)=>{let r=m(t.path);if(t.code==="invalid_union"){let n=new Map;for(let e of t.unionErrors.flatMap(i=>i.errors))if(e.code==="invalid_type"||e.code==="invalid_literal"){let i=m(e.path);n.has(i)?n.get(i).expected.push(e.expected):n.set(i,{code:e.code,received:e.received,expected:[e.expected]})}return{message:[p(r,n.size?"Did not match union:":"Did not match union.")].concat([...n.entries()].filter(([,e])=>e.expected.length===t.unionErrors.length).map(([e,i])=>e===r?`> ${c(i)}`:`> ${p(e,c(i))}`)).join(` | ||
`)}}return t.code==="invalid_literal"||t.code==="invalid_type"?{message:p(r,c({code:t.code,received:t.received,expected:[t.expected]}))}:t.message?{message:p(r,t.message)}:{message:p(r,o.defaultError)}},c=t=>{if(t.received==="undefined")return"Required";let o=new Set(t.expected);switch(t.code){case"invalid_type":return`Expected type \`${d(o)}\`, received ${JSON.stringify(t.received)}`;case"invalid_literal":return`Expected \`${d(o)}\`, received ${JSON.stringify(t.received)}`}},p=(t,o)=>t.length?`**${t}**: ${o}`:o,d=t=>[...t].map((o,r)=>r===0?JSON.stringify(o):` | ${JSON.stringify(o)}`).join(""),m=t=>t.join(".");var y=({name:t,optionsSchema:o,setup:r})=>(...n)=>{let s=(o??v.never().optional()).safeParse(n[0],{errorMap:f});if(!s.success)throw new x(`Invalid options passed to "${t}" integration | ||
`,s.error.issues.map(T=>T.message).join(` | ||
`));let e=s.data,{hooks:i,...a}=r({name:t,options:e});return{...a,hooks:i,name:t}};import{readdirSync as k,statSync as A}from"node:fs";import{join as O,relative as S,resolve as H}from"pathe";var l=t=>o=>o;var u=(t,o=t)=>{let r=k(t),n=[];for(let s of r){let e=O(t,s);if(A(e).isDirectory()){let a=u(e,o);n=n.concat(a)}else{let a=S(o,e);n.push(a)}}return n},g=l("astro:config:setup")(({addWatchFile:t,command:o,updateConfig:r},n)=>{if(o!=="dev")return;let s=u(n).map(e=>H(n,e));for(let e of s)t(e);r({vite:{plugins:[{name:`rollup-aik-watch-directory-${n}`,buildStart(){for(let e of s)this.addWatchFile(e)}}]}})});var P=y({name:"astro-integration-kit/hmr",optionsSchema:h.object({directory:h.string()}),setup({options:t}){return{hooks:{"astro:config:setup":o=>{g(o,t.directory)}}}}});export{P as hmrIntegration}; | ||
//# sourceMappingURL=index.js.map |
@@ -9,4 +9,5 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | ||
} & {}; | ||
type ExtendedPrettify<T> = T extends infer U ? Prettify<U> : never; | ||
type NonEmptyArray<T> = [T, ...Array<T>]; | ||
export type { NonEmptyArray, Prettify, UnionToArray, UnionToIntersection }; | ||
export type { ExtendedPrettify, NonEmptyArray, Prettify, UnionToArray, UnionToIntersection }; |
@@ -1,2 +0,2 @@ | ||
var f=o=>o;var u=o=>t=>t;function r(o){let t=[];if(o){for(let n of o)if(n){if(Array.isArray(n)){t.push(...r(n));continue}n instanceof Promise||t.push(n.name)}}return t}var a=u("astro:config:setup")(({config:o},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let n=new Set(r(o?.vite?.plugins)),e=new Set;if(typeof t=="string"&&e.add(t),typeof t=="object")if(Array.isArray(t)){let i=new Set(r(t));for(let g of i)e.add(g)}else e.add(t.name);return[...e].some(i=>n.has(i))});function s(o,t){if(t){for(let n of t)if(n){if(Array.isArray(n)){s(o,n);continue}n instanceof Promise||o.add(n)}}return o}var d=f({name:"hasVitePlugin",setup(){return{"astro:config:setup":o=>{let t=s(new Set,o.config.vite?.plugins),{updateConfig:n,config:e}=o;return o.updateConfig=i=>(e.vite.plugins=Array.from(s(t,i.vite?.plugins)),n(i)),{hasVitePlugin:i=>a(o,{plugin:i})}}}}});export{d as hasVitePluginPlugin}; | ||
var f=t=>t;var u=t=>o=>o;function r(t){let o=[];if(t){for(let n of t)if(n){if(Array.isArray(n)){o.push(...r(n));continue}n instanceof Promise||o.push(n.name)}}return o}var a=u("astro:config:setup")(({config:t},{plugin:o})=>{if(!o||o instanceof Promise)return!1;let n=new Set(r(t?.vite?.plugins)),e=new Set;if(typeof o=="string"&&e.add(o),typeof o=="object")if(Array.isArray(o)){let i=new Set(r(o));for(let g of i)e.add(g)}else e.add(o.name);return[...e].some(i=>n.has(i))});function s(t,o){if(o){for(let n of o)if(n){if(Array.isArray(n)){s(t,n);continue}n instanceof Promise||t.add(n)}}return t}var k=f({name:"hasVitePlugin",setup(){return{"astro:config:setup":t=>{let o=s(new Set,t.config.vite?.plugins),{updateConfig:n,config:e}=t;return t.updateConfig=i=>(e.vite.plugins=Array.from(s(o,i.vite?.plugins)),n(i)),{hasVitePlugin:i=>a(t,{plugin:i})}}}}});export{k as hasVitePluginPlugin}; | ||
//# sourceMappingURL=has-vite-plugin.js.map |
@@ -1,2 +0,2 @@ | ||
var f=o=>o;var u=o=>t=>t;function r(o){let t=[];if(o){for(let n of o)if(n){if(Array.isArray(n)){t.push(...r(n));continue}n instanceof Promise||t.push(n.name)}}return t}var a=u("astro:config:setup")(({config:o},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let n=new Set(r(o?.vite?.plugins)),e=new Set;if(typeof t=="string"&&e.add(t),typeof t=="object")if(Array.isArray(t)){let i=new Set(r(t));for(let g of i)e.add(g)}else e.add(t.name);return[...e].some(i=>n.has(i))});function s(o,t){if(t){for(let n of t)if(n){if(Array.isArray(n)){s(o,n);continue}n instanceof Promise||o.add(n)}}return o}var p=f({name:"hasVitePlugin",setup(){return{"astro:config:setup":o=>{let t=s(new Set,o.config.vite?.plugins),{updateConfig:n,config:e}=o;return o.updateConfig=i=>(e.vite.plugins=Array.from(s(t,i.vite?.plugins)),n(i)),{hasVitePlugin:i=>a(o,{plugin:i})}}}}});export{p as hasVitePluginPlugin}; | ||
var f=t=>t;var u=t=>o=>o;function r(t){let o=[];if(t){for(let n of t)if(n){if(Array.isArray(n)){o.push(...r(n));continue}n instanceof Promise||o.push(n.name)}}return o}var g=u("astro:config:setup")(({config:t},{plugin:o})=>{if(!o||o instanceof Promise)return!1;let n=new Set(r(t?.vite?.plugins)),e=new Set;if(typeof o=="string"&&e.add(o),typeof o=="object")if(Array.isArray(o)){let i=new Set(r(o));for(let a of i)e.add(a)}else e.add(o.name);return[...e].some(i=>n.has(i))});function s(t,o){if(o){for(let n of o)if(n){if(Array.isArray(n)){s(t,n);continue}n instanceof Promise||t.add(n)}}return t}var p=f({name:"hasVitePlugin",setup(){return{"astro:config:setup":t=>{let o=s(new Set,t.config.vite?.plugins),{updateConfig:n,config:e}=t;return t.updateConfig=i=>(e.vite.plugins=Array.from(s(o,i.vite?.plugins)),n(i)),{hasVitePlugin:i=>g(t,{plugin:i})}}}}});export{p as hasVitePluginPlugin}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,5 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { AstroIntegrationLogger } from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -24,21 +25,7 @@ /** | ||
*/ | ||
declare const addDts: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: AstroIntegrationLogger; | ||
}, args_0: { | ||
declare const addDts: HookUtility<"astro:config:setup", [{ | ||
name: string; | ||
content: string; | ||
}) => void; | ||
}], void>; | ||
export { addDts }; |
@@ -1,4 +0,4 @@ | ||
import{mkdirSync as f,readFileSync as m,writeFileSync as p}from"node:fs";import{dirname as y,relative as d}from"node:path";import{fileURLToPath as a}from"node:url";import{parse as l,prettyPrint as g}from"recast";import T from"recast/parsers/typescript.js";var c=r=>o=>o;var k=({srcDir:r,logger:o,specifier:e})=>{let s=a(new URL("env.d.ts",r));e instanceof URL&&(e=a(e),e=d(a(r),e),e=e.replaceAll("\\","/"));let t=m(s,"utf8");if(t.includes(`/// <reference types='${e}' />`)||t.includes(`/// <reference types="${e}" />`))return;let n=t.replace("/// <reference types='astro/client' />",`/// <reference types='astro/client' /> | ||
import{mkdirSync as c,readFileSync as f,writeFileSync as p}from"node:fs";import{dirname as m,relative as l}from"node:path";import{fileURLToPath as a}from"node:url";import{parse as d,prettyPrint as T}from"recast";import g from"recast/parsers/typescript.js";var y=r=>o=>o;var k=({srcDir:r,logger:o,specifier:e})=>{let s=a(new URL("env.d.ts",r));e instanceof URL&&(e=a(e),e=l(a(r),e),e=e.replaceAll("\\","/"));let t=f(s,"utf8");if(t.includes(`/// <reference types='${e}' />`)||t.includes(`/// <reference types="${e}" />`))return;let n=t.replace("/// <reference types='astro/client' />",`/// <reference types='astro/client' /> | ||
/// <reference types='${e}' />`).replace('/// <reference types="astro/client" />',`/// <reference types="astro/client" /> | ||
/// <reference types="${e}" />`);n!==t&&(p(s,n),o.info("Updated env.d.ts types"))},A=c("astro:config:setup")(({config:{root:r,srcDir:o},logger:e},{name:s,content:t})=>{let n=new URL(`.astro/${s}.d.ts`,r),i=a(n);k({srcDir:o,logger:e,specifier:n}),f(y(i),{recursive:!0}),p(i,g(l(t,{parser:T}),{tabWidth:4}).code,"utf-8")});export{A as addDts}; | ||
/// <reference types="${e}" />`);n!==t&&(p(s,n),o.info("Updated env.d.ts types"))},x=y("astro:config:setup")(({config:{root:r,srcDir:o},logger:e},{name:s,content:t})=>{let n=new URL(`.astro/${s}.d.ts`,r),i=a(n);k({srcDir:o,logger:e,specifier:n}),c(m(i),{recursive:!0}),p(i,T(d(t,{parser:g}),{tabWidth:4}).code,"utf-8")});export{x as addDts}; | ||
//# sourceMappingURL=add-dts.js.map |
@@ -1,4 +0,5 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import { AstroIntegration } from 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -29,18 +30,4 @@ type AddIntegrationParams = { | ||
*/ | ||
declare const addIntegration: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, args_0: AddIntegrationParams) => void; | ||
declare const addIntegration: HookUtility<"astro:config:setup", [AddIntegrationParams], void>; | ||
export { type AddIntegrationParams, addIntegration }; |
@@ -1,2 +0,2 @@ | ||
import"astro";var i=t=>e=>e;import{AstroError as f}from"astro/errors";var g=i("astro:config:setup")(({config:t},{name:e,position:n,relativeTo:r})=>{let o=t.integrations.findIndex(s=>s.name===e);if(o===-1)return!1;if(n===void 0)return!0;if(r===void 0)throw new f("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let a=t.integrations.findIndex(s=>s.name===r);if(a===-1)throw new f("Cannot check relative position against an absent integration.");return n==="before"?o<a:o>a});var c=i("astro:config:setup")((t,{integration:e,ensureUnique:n})=>{let{logger:r,updateConfig:o}=t;if(n&&g(t,{name:e.name})){r.warn(`Integration "${e.name}" has already been added by the user or another integration. Skipping.`);return}o({integrations:[e]})});export{c as addIntegration}; | ||
import"astro";var i=e=>t=>t;import{AstroError as g}from"astro/errors";var f=i("astro:config:setup")(({config:e},{name:t,position:n,relativeTo:r})=>{let o=e.integrations.findIndex(s=>s.name===t);if(o===-1)return!1;if(n===void 0)return!0;if(r===void 0)throw new g("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let a=e.integrations.findIndex(s=>s.name===r);if(a===-1)throw new g("Cannot check relative position against an absent integration.");return n==="before"?o<a:o>a});var T=i("astro:config:setup")((e,{integration:t,ensureUnique:n})=>{let{logger:r,updateConfig:o}=e;if(n&&f(e,{name:t.name})){r.warn(`Integration "${t.name}" has already been added by the user or another integration. Skipping.`);return}o({integrations:[t]})});export{T as addIntegration}; | ||
//# sourceMappingURL=add-integration.js.map |
@@ -1,3 +0,5 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -43,22 +45,8 @@ type VirtualImport = { | ||
*/ | ||
declare const addVirtualImports: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, args_0: { | ||
declare const addVirtualImports: HookUtility<"astro:config:setup", [{ | ||
name: string; | ||
imports: Imports; | ||
__enableCorePowerDoNotUseOrYouWillBeFired?: boolean; | ||
}) => void; | ||
}], void>; | ||
export { addVirtualImports }; |
@@ -1,2 +0,2 @@ | ||
import{AstroError as d}from"astro/errors";var a=e=>t=>t;function c(e){let t=[];if(e){for(let n of e)if(n){if(Array.isArray(n)){t.push(...c(n));continue}n instanceof Promise||t.push(n.name)}}return t}var l=a("astro:config:setup")(({config:e},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let n=new Set(c(e?.vite?.plugins)),o=new Set;if(typeof t=="string"&&o.add(t),typeof t=="object")if(Array.isArray(t)){let i=new Set(c(t));for(let u of i)o.add(u)}else o.add(t.name);return[...o].some(i=>n.has(i))});var g=a("astro:config:setup")((e,{plugin:t,warnDuplicated:n=!0})=>{let{updateConfig:o,logger:i}=e;n&&l(e,{plugin:t})&&i.warn(`The Vite plugin "${t.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),o({vite:{plugins:[t]}})});var h=e=>{let t=1;return`${e.replace(/-(\d+)$/,(n,o)=>(t=parseInt(o)+1,""))}-${t}`},y=e=>`\0${e}`,A=(e,t,n)=>{let o=Array.isArray(t)?t:Object.entries(t).map(([r,s])=>({id:r,content:s,context:void 0})),i={};for(let{id:r,context:s}of o)i[r]??=[],i[r]?.push(...s===void 0?["server","client"]:[s]);for(let[r,s]of Object.entries(i))if(s.length!==[...new Set(s)].length)throw new d(`Virtual import with id "${r}" has been registered several times with conflicting contexts.`);let u=Object.fromEntries(o.map(({id:r})=>{if(!n&&r.startsWith("astro:"))throw new d(`Virtual import name prefix can't be "astro:" (for "${r}") because it's reserved for Astro core.`);return[y(r),r]}));return{name:e,resolveId(r){if(o.find(s=>s.id===r))return y(r)},load(r,s){let p=u[r];if(p){let P=s?.ssr?"server":"client",m=o.find(f=>f.id===p&&(f.context===void 0||f.context===P));if(m)return m.content}}}},H=a("astro:config:setup")((e,{name:t,imports:n,__enableCorePowerDoNotUseOrYouWillBeFired:o=!1})=>{let i=`vite-plugin-${t}`;for(;l(e,{plugin:i});)i=h(i);g(e,{warnDuplicated:!1,plugin:A(i,n,o)})});export{H as addVirtualImports}; | ||
import{AstroError as d}from"astro/errors";var a=e=>t=>t;function c(e){let t=[];if(e){for(let n of e)if(n){if(Array.isArray(n)){t.push(...c(n));continue}n instanceof Promise||t.push(n.name)}}return t}var l=a("astro:config:setup")(({config:e},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let n=new Set(c(e?.vite?.plugins)),o=new Set;if(typeof t=="string"&&o.add(t),typeof t=="object")if(Array.isArray(t)){let i=new Set(c(t));for(let u of i)o.add(u)}else o.add(t.name);return[...o].some(i=>n.has(i))});var m=a("astro:config:setup")((e,{plugin:t,warnDuplicated:n=!0})=>{let{updateConfig:o,logger:i}=e;n&&l(e,{plugin:t})&&i.warn(`The Vite plugin "${t.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),o({vite:{plugins:[t]}})});var P=e=>{let t=1;return`${e.replace(/-(\d+)$/,(n,o)=>(t=parseInt(o)+1,""))}-${t}`},y=e=>`\0${e}`,h=(e,t,n)=>{let o=Array.isArray(t)?t:Object.entries(t).map(([r,s])=>({id:r,content:s,context:void 0})),i={};for(let{id:r,context:s}of o)i[r]??=[],i[r]?.push(...s===void 0?["server","client"]:[s]);for(let[r,s]of Object.entries(i))if(s.length!==[...new Set(s)].length)throw new d(`Virtual import with id "${r}" has been registered several times with conflicting contexts.`);let u=Object.fromEntries(o.map(({id:r})=>{if(!n&&r.startsWith("astro:"))throw new d(`Virtual import name prefix can't be "astro:" (for "${r}") because it's reserved for Astro core.`);return[y(r),r]}));return{name:e,resolveId(r){if(o.find(s=>s.id===r))return y(r)},load(r,s){let p=u[r];if(p){let A=s?.ssr?"server":"client",g=o.find(f=>f.id===p&&(f.context===void 0||f.context===A));if(g)return g.content}}}},O=a("astro:config:setup")((e,{name:t,imports:n,__enableCorePowerDoNotUseOrYouWillBeFired:o=!1})=>{let i=`vite-plugin-${t}`;for(;l(e,{plugin:i});)i=P(i);m(e,{warnDuplicated:!1,plugin:h(i,n,o)})});export{O as addVirtualImports}; | ||
//# sourceMappingURL=add-virtual-imports.js.map |
@@ -1,4 +0,6 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import { PluginOption } from 'vite'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -24,21 +26,7 @@ /** | ||
*/ | ||
declare const addVitePlugin: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, args_0: { | ||
declare const addVitePlugin: HookUtility<"astro:config:setup", [{ | ||
plugin: PluginOption; | ||
warnDuplicated?: boolean; | ||
}) => void; | ||
}], void>; | ||
export { addVitePlugin }; |
@@ -1,2 +0,2 @@ | ||
var r=e=>o=>o;function s(e){let o=[];if(e){for(let t of e)if(t){if(Array.isArray(t)){o.push(...s(t));continue}t instanceof Promise||o.push(t.name)}}return o}var a=r("astro:config:setup")(({config:e},{plugin:o})=>{if(!o||o instanceof Promise)return!1;let t=new Set(s(e?.vite?.plugins)),i=new Set;if(typeof o=="string"&&i.add(o),typeof o=="object")if(Array.isArray(o)){let n=new Set(s(o));for(let f of n)i.add(f)}else i.add(o.name);return[...i].some(n=>t.has(n))});var c=r("astro:config:setup")((e,{plugin:o,warnDuplicated:t=!0})=>{let{updateConfig:i,logger:n}=e;t&&a(e,{plugin:o})&&n.warn(`The Vite plugin "${o.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),i({vite:{plugins:[o]}})});export{c as addVitePlugin}; | ||
var r=e=>o=>o;function s(e){let o=[];if(e){for(let t of e)if(t){if(Array.isArray(t)){o.push(...s(t));continue}t instanceof Promise||o.push(t.name)}}return o}var a=r("astro:config:setup")(({config:e},{plugin:o})=>{if(!o||o instanceof Promise)return!1;let t=new Set(s(e?.vite?.plugins)),i=new Set;if(typeof o=="string"&&i.add(o),typeof o=="object")if(Array.isArray(o)){let n=new Set(s(o));for(let f of n)i.add(f)}else i.add(o.name);return[...i].some(n=>t.has(n))});var l=r("astro:config:setup")((e,{plugin:o,warnDuplicated:t=!0})=>{let{updateConfig:i,logger:n}=e;t&&a(e,{plugin:o})&&n.warn(`The Vite plugin "${o.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),i({vite:{plugins:[o]}})});export{l as addVitePlugin}; | ||
//# sourceMappingURL=add-vite-plugin.js.map |
@@ -1,3 +0,5 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -38,18 +40,4 @@ type HasIntegrationParams = ({ | ||
*/ | ||
declare const hasIntegration: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, args_0: HasIntegrationParams) => boolean; | ||
declare const hasIntegration: HookUtility<"astro:config:setup", [HasIntegrationParams], boolean>; | ||
export { hasIntegration }; |
@@ -1,2 +0,2 @@ | ||
import{AstroError as f}from"astro/errors";var s=e=>o=>o;var d=s("astro:config:setup")(({config:e},{name:o,position:i,relativeTo:a})=>{let t=e.integrations.findIndex(n=>n.name===o);if(t===-1)return!1;if(i===void 0)return!0;if(a===void 0)throw new f("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let r=e.integrations.findIndex(n=>n.name===a);if(r===-1)throw new f("Cannot check relative position against an absent integration.");return i==="before"?t<r:t>r});export{d as hasIntegration}; | ||
import{AstroError as f}from"astro/errors";var s=o=>t=>t;var m=s("astro:config:setup")(({config:o},{name:t,position:i,relativeTo:a})=>{let e=o.integrations.findIndex(n=>n.name===t);if(e===-1)return!1;if(i===void 0)return!0;if(a===void 0)throw new f("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let r=o.integrations.findIndex(n=>n.name===a);if(r===-1)throw new f("Cannot check relative position against an absent integration.");return i==="before"?e<r:e>r});export{m as hasIntegration}; | ||
//# sourceMappingURL=has-integration.js.map |
@@ -1,5 +0,6 @@ | ||
import * as astro from 'astro'; | ||
import { AstroConfig } from 'astro'; | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import { PluginOption } from 'vite'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -22,20 +23,6 @@ /** | ||
*/ | ||
declare const hasVitePlugin: (params: { | ||
config: AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<AstroConfig>) => AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, args_0: { | ||
declare const hasVitePlugin: HookUtility<"astro:config:setup", [{ | ||
plugin: string | PluginOption; | ||
}) => boolean; | ||
}], boolean>; | ||
export { hasVitePlugin }; |
@@ -1,2 +0,2 @@ | ||
var i=e=>o=>o;function s(e){let o=[];if(e){for(let t of e)if(t){if(Array.isArray(t)){o.push(...s(t));continue}t instanceof Promise||o.push(t.name)}}return o}var p=i("astro:config:setup")(({config:e},{plugin:o})=>{if(!o||o instanceof Promise)return!1;let t=new Set(s(e?.vite?.plugins)),n=new Set;if(typeof o=="string"&&n.add(o),typeof o=="object")if(Array.isArray(o)){let r=new Set(s(o));for(let a of r)n.add(a)}else n.add(o.name);return[...n].some(r=>t.has(r))});export{p as hasVitePlugin}; | ||
var i=e=>o=>o;function n(e){let o=[];if(e){for(let t of e)if(t){if(Array.isArray(t)){o.push(...n(t));continue}t instanceof Promise||o.push(t.name)}}return o}var m=i("astro:config:setup")(({config:e},{plugin:o})=>{if(!o||o instanceof Promise)return!1;let t=new Set(n(e?.vite?.plugins)),r=new Set;if(typeof o=="string"&&r.add(o),typeof o=="object")if(Array.isArray(o)){let s=new Set(n(o));for(let a of s)r.add(a)}else r.add(o.name);return[...r].some(s=>t.has(s))});export{m as hasVitePlugin}; | ||
//# sourceMappingURL=has-vite-plugin.js.map |
@@ -9,4 +9,6 @@ export { addDts } from './add-dts.js'; | ||
export { addIntegration } from './add-integration.js'; | ||
import '../type-utils.d-CSknV27i.js'; | ||
import '../core/define-utility.js'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
import 'vite'; |
@@ -1,4 +0,4 @@ | ||
import{mkdirSync as A,readFileSync as b,writeFileSync as h}from"node:fs";import{dirname as U,relative as T}from"node:path";import{fileURLToPath as p}from"node:url";import{parse as V,prettyPrint as $}from"recast";import k from"recast/parsers/typescript.js";var a=r=>t=>t;var D=({srcDir:r,logger:t,specifier:e})=>{let n=p(new URL("env.d.ts",r));e instanceof URL&&(e=p(e),e=T(p(r),e),e=e.replaceAll("\\","/"));let o=b(n,"utf8");if(o.includes(`/// <reference types='${e}' />`)||o.includes(`/// <reference types="${e}" />`))return;let s=o.replace("/// <reference types='astro/client' />",`/// <reference types='astro/client' /> | ||
import{mkdirSync as w,readFileSync as T,writeFileSync as h}from"node:fs";import{dirname as b,relative as k}from"node:path";import{fileURLToPath as p}from"node:url";import{parse as U,prettyPrint as V}from"recast";import H from"recast/parsers/typescript.js";var a=r=>t=>t;var R=({srcDir:r,logger:t,specifier:e})=>{let o=p(new URL("env.d.ts",r));e instanceof URL&&(e=p(e),e=k(p(r),e),e=e.replaceAll("\\","/"));let n=T(o,"utf8");if(n.includes(`/// <reference types='${e}' />`)||n.includes(`/// <reference types="${e}" />`))return;let s=n.replace("/// <reference types='astro/client' />",`/// <reference types='astro/client' /> | ||
/// <reference types='${e}' />`).replace('/// <reference types="astro/client" />',`/// <reference types="astro/client" /> | ||
/// <reference types="${e}" />`);s!==o&&(h(n,s),t.info("Updated env.d.ts types"))},R=a("astro:config:setup")(({config:{root:r,srcDir:t},logger:e},{name:n,content:o})=>{let s=new URL(`.astro/${n}.d.ts`,r),i=p(s);D({srcDir:t,logger:e,specifier:s}),A(U(i),{recursive:!0}),h(i,$(V(o,{parser:k}),{tabWidth:4}).code,"utf-8")});import{AstroError as v}from"astro/errors";function m(r){let t=[];if(r){for(let e of r)if(e){if(Array.isArray(e)){t.push(...m(e));continue}e instanceof Promise||t.push(e.name)}}return t}var c=a("astro:config:setup")(({config:r},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let e=new Set(m(r?.vite?.plugins)),n=new Set;if(typeof t=="string"&&n.add(t),typeof t=="object")if(Array.isArray(t)){let o=new Set(m(t));for(let s of o)n.add(s)}else n.add(t.name);return[...n].some(o=>e.has(o))});var u=a("astro:config:setup")((r,{plugin:t,warnDuplicated:e=!0})=>{let{updateConfig:n,logger:o}=r;e&&c(r,{plugin:t})&&o.warn(`The Vite plugin "${t.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),n({vite:{plugins:[t]}})});var S=r=>{let t=1;return`${r.replace(/-(\d+)$/,(e,n)=>(t=parseInt(n)+1,""))}-${t}`},P=r=>`\0${r}`,j=(r,t,e)=>{let n=Array.isArray(t)?t:Object.entries(t).map(([i,f])=>({id:i,content:f,context:void 0})),o={};for(let{id:i,context:f}of n)o[i]??=[],o[i]?.push(...f===void 0?["server","client"]:[f]);for(let[i,f]of Object.entries(o))if(f.length!==[...new Set(f)].length)throw new v(`Virtual import with id "${i}" has been registered several times with conflicting contexts.`);let s=Object.fromEntries(n.map(({id:i})=>{if(!e&&i.startsWith("astro:"))throw new v(`Virtual import name prefix can't be "astro:" (for "${i}") because it's reserved for Astro core.`);return[P(i),i]}));return{name:r,resolveId(i){if(n.find(f=>f.id===i))return P(i)},load(i,f){let g=s[i];if(g){let w=f?.ssr?"server":"client",y=n.find(l=>l.id===g&&(l.context===void 0||l.context===w));if(y)return y.content}}}},C=a("astro:config:setup")((r,{name:t,imports:e,__enableCorePowerDoNotUseOrYouWillBeFired:n=!1})=>{let o=`vite-plugin-${t}`;for(;c(r,{plugin:o});)o=S(o);u(r,{warnDuplicated:!1,plugin:j(o,e,n)})});import{AstroError as x}from"astro/errors";var d=a("astro:config:setup")(({config:r},{name:t,position:e,relativeTo:n})=>{let o=r.integrations.findIndex(i=>i.name===t);if(o===-1)return!1;if(e===void 0)return!0;if(n===void 0)throw new x("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let s=r.integrations.findIndex(i=>i.name===n);if(s===-1)throw new x("Cannot check relative position against an absent integration.");return e==="before"?o<s:o>s});var H=a("astro:config:setup")(({command:r,injectRoute:t},e)=>{r==="dev"&&t(e)});import{readdirSync as L,statSync as O}from"node:fs";import{join as F,relative as N,resolve as E}from"pathe";var I=(r,t=r)=>{let e=L(r),n=[];for(let o of e){let s=F(r,o);if(O(s).isDirectory()){let f=I(s,t);n=n.concat(f)}else{let f=N(t,s);n.push(f)}}return n},W=a("astro:config:setup")(({addWatchFile:r,command:t,updateConfig:e},n)=>{if(t!=="dev")return;let o=I(n).map(s=>E(n,s));for(let s of o)r(s);e({vite:{plugins:[{name:`rollup-aik-watch-directory-${n}`,buildStart(){for(let s of o)this.addWatchFile(s)}}]}})});import"astro";var M=a("astro:config:setup")((r,{integration:t,ensureUnique:e})=>{let{logger:n,updateConfig:o}=r;if(e&&d(r,{name:t.name})){n.warn(`Integration "${t.name}" has already been added by the user or another integration. Skipping.`);return}o({integrations:[t]})});export{R as addDts,M as addIntegration,C as addVirtualImports,u as addVitePlugin,d as hasIntegration,c as hasVitePlugin,H as injectDevRoute,W as watchDirectory}; | ||
/// <reference types="${e}" />`);s!==n&&(h(o,s),t.info("Updated env.d.ts types"))},$=a("astro:config:setup")(({config:{root:r,srcDir:t},logger:e},{name:o,content:n})=>{let s=new URL(`.astro/${o}.d.ts`,r),i=p(s);R({srcDir:t,logger:e,specifier:s}),w(b(i),{recursive:!0}),h(i,V(U(n,{parser:H}),{tabWidth:4}).code,"utf-8")});import{AstroError as v}from"astro/errors";function u(r){let t=[];if(r){for(let e of r)if(e){if(Array.isArray(e)){t.push(...u(e));continue}e instanceof Promise||t.push(e.name)}}return t}var c=a("astro:config:setup")(({config:r},{plugin:t})=>{if(!t||t instanceof Promise)return!1;let e=new Set(u(r?.vite?.plugins)),o=new Set;if(typeof t=="string"&&o.add(t),typeof t=="object")if(Array.isArray(t)){let n=new Set(u(t));for(let s of n)o.add(s)}else o.add(t.name);return[...o].some(n=>e.has(n))});var m=a("astro:config:setup")((r,{plugin:t,warnDuplicated:e=!0})=>{let{updateConfig:o,logger:n}=r;e&&c(r,{plugin:t})&&n.warn(`The Vite plugin "${t.name}" is already present in your Vite configuration, this plugin may not behave correctly.`),o({vite:{plugins:[t]}})});var D=r=>{let t=1;return`${r.replace(/-(\d+)$/,(e,o)=>(t=parseInt(o)+1,""))}-${t}`},P=r=>`\0${r}`,S=(r,t,e)=>{let o=Array.isArray(t)?t:Object.entries(t).map(([i,f])=>({id:i,content:f,context:void 0})),n={};for(let{id:i,context:f}of o)n[i]??=[],n[i]?.push(...f===void 0?["server","client"]:[f]);for(let[i,f]of Object.entries(n))if(f.length!==[...new Set(f)].length)throw new v(`Virtual import with id "${i}" has been registered several times with conflicting contexts.`);let s=Object.fromEntries(o.map(({id:i})=>{if(!e&&i.startsWith("astro:"))throw new v(`Virtual import name prefix can't be "astro:" (for "${i}") because it's reserved for Astro core.`);return[P(i),i]}));return{name:r,resolveId(i){if(o.find(f=>f.id===i))return P(i)},load(i,f){let g=s[i];if(g){let A=f?.ssr?"server":"client",y=o.find(l=>l.id===g&&(l.context===void 0||l.context===A));if(y)return y.content}}}},j=a("astro:config:setup")((r,{name:t,imports:e,__enableCorePowerDoNotUseOrYouWillBeFired:o=!1})=>{let n=`vite-plugin-${t}`;for(;c(r,{plugin:n});)n=D(n);m(r,{warnDuplicated:!1,plugin:S(n,e,o)})});import{AstroError as x}from"astro/errors";var d=a("astro:config:setup")(({config:r},{name:t,position:e,relativeTo:o})=>{let n=r.integrations.findIndex(i=>i.name===t);if(n===-1)return!1;if(e===void 0)return!0;if(o===void 0)throw new x("Cannot perform a relative integration check without a relative reference.","Pass `relativeTo` on your call to `hasIntegration` or remove the `position` option.");let s=r.integrations.findIndex(i=>i.name===o);if(s===-1)throw new x("Cannot check relative position against an absent integration.");return e==="before"?n<s:n>s});var C=a("astro:config:setup")(({command:r,injectRoute:t},e)=>{r==="dev"&&t(e)});import{readdirSync as L,statSync as O}from"node:fs";import{join as F,relative as N,resolve as E}from"pathe";var I=(r,t=r)=>{let e=L(r),o=[];for(let n of e){let s=F(r,n);if(O(s).isDirectory()){let f=I(s,t);o=o.concat(f)}else{let f=N(t,s);o.push(f)}}return o},W=a("astro:config:setup")(({addWatchFile:r,command:t,updateConfig:e},o)=>{if(t!=="dev")return;let n=I(o).map(s=>E(o,s));for(let s of n)r(s);e({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let s of n)this.addWatchFile(s)}}]}})});import"astro";var M=a("astro:config:setup")((r,{integration:t,ensureUnique:e})=>{let{logger:o,updateConfig:n}=r;if(e&&d(r,{name:t.name})){o.warn(`Integration "${t.name}" has already been added by the user or another integration. Skipping.`);return}n({integrations:[t]})});export{$ as addDts,M as addIntegration,j as addVirtualImports,m as addVitePlugin,d as hasIntegration,c as hasVitePlugin,C as injectDevRoute,W as watchDirectory}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,5 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import { InjectedRoute } from 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -22,18 +23,4 @@ /** | ||
*/ | ||
declare const injectDevRoute: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, injectedRoute: InjectedRoute) => void; | ||
declare const injectDevRoute: HookUtility<"astro:config:setup", [injectedRoute: InjectedRoute], void>; | ||
export { injectDevRoute }; |
@@ -1,2 +0,2 @@ | ||
var t=e=>o=>o;var a=t("astro:config:setup")(({command:e,injectRoute:o},r)=>{e==="dev"&&o(r)});export{a as injectDevRoute}; | ||
var e=t=>o=>o;var k=e("astro:config:setup")(({command:t,injectRoute:o},r)=>{t==="dev"&&o(r)});export{k as injectDevRoute}; | ||
//# sourceMappingURL=inject-dev-route.js.map |
@@ -1,3 +0,5 @@ | ||
import { D as DeepPartial } from '../type-utils.d-CSknV27i.js'; | ||
import * as astro from 'astro'; | ||
import { HookUtility } from '../core/define-utility.js'; | ||
import 'astro'; | ||
import '../core/types.js'; | ||
import '../internal/types.js'; | ||
@@ -18,18 +20,4 @@ /** | ||
*/ | ||
declare const watchDirectory: (params: { | ||
config: astro.AstroConfig; | ||
command: "dev" | "build" | "preview"; | ||
isRestart: boolean; | ||
updateConfig: (newConfig: DeepPartial<astro.AstroConfig>) => astro.AstroConfig; | ||
addRenderer: (renderer: astro.AstroRenderer) => void; | ||
addWatchFile: (path: string | URL) => void; | ||
injectScript: (stage: astro.InjectedScriptStage, content: string) => void; | ||
injectRoute: (injectRoute: astro.InjectedRoute) => void; | ||
addClientDirective: (directive: astro.ClientDirectiveConfig) => void; | ||
addDevOverlayPlugin: (entrypoint: string) => void; | ||
addDevToolbarApp: (entrypoint: string | astro.DevToolbarAppEntry) => void; | ||
addMiddleware: (mid: astro.AstroIntegrationMiddleware) => void; | ||
logger: astro.AstroIntegrationLogger; | ||
}, directory: string) => void; | ||
declare const watchDirectory: HookUtility<"astro:config:setup", [directory: string], void>; | ||
export { watchDirectory }; |
@@ -1,2 +0,2 @@ | ||
import{readdirSync as f,statSync as p}from"node:fs";import{join as l,relative as m,resolve as y}from"pathe";var n=e=>r=>r;var c=(e,r=e)=>{let i=f(e),o=[];for(let s of i){let t=l(e,s);if(p(t).isDirectory()){let a=c(t,r);o=o.concat(a)}else{let a=m(r,t);o.push(a)}}return o},H=n("astro:config:setup")(({addWatchFile:e,command:r,updateConfig:i},o)=>{if(r!=="dev")return;let s=c(o).map(t=>y(o,t));for(let t of s)e(t);i({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let t of s)this.addWatchFile(t)}}]}})});export{H as watchDirectory}; | ||
import{readdirSync as p,statSync as f}from"node:fs";import{join as l,relative as y,resolve as k}from"pathe";var n=e=>r=>r;var c=(e,r=e)=>{let i=p(e),o=[];for(let s of i){let t=l(e,s);if(f(t).isDirectory()){let a=c(t,r);o=o.concat(a)}else{let a=y(r,t);o.push(a)}}return o},u=n("astro:config:setup")(({addWatchFile:e,command:r,updateConfig:i},o)=>{if(r!=="dev")return;let s=c(o).map(t=>k(o,t));for(let t of s)e(t);i({vite:{plugins:[{name:`rollup-aik-watch-directory-${o}`,buildStart(){for(let t of s)this.addWatchFile(t)}}]}})});export{u as watchDirectory}; | ||
//# sourceMappingURL=watch-directory.js.map |
{ | ||
"name": "astro-integration-kit", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"description": "A package that contains utilities to help you build Astro integrations.", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
239218
72
656