diff --git a/.changeset/strange-pigs-train.md b/.changeset/strange-pigs-train.md new file mode 100644 index 0000000..72c2492 --- /dev/null +++ b/.changeset/strange-pigs-train.md @@ -0,0 +1,5 @@ +--- +"@matthiesenxyz/astro-gists": patch +--- + +NEW: we now have a virtual import available to use instead! to use this new import simply do `import { GetGist, GetGistGroup } from "astro-gists:components"` and you'll be good to go at the first boot of your dev server! diff --git a/package/README.md b/package/README.md index 1e52514..6ab3500 100644 --- a/package/README.md +++ b/package/README.md @@ -85,9 +85,7 @@ This Utility is meant to display a single Gist as Codeblocks using ExpressiveCod ```astro --- -import { GetGist } from "@matthiesenxyz/astro-gists/components" -// OR -import GetGist from "@matthiesenxyz/astro-gists/GetGist" +import { GetGist } from "astro-gists:components" --- { logger.info("Setting up Astro Gists Integration.") const configSetup = logger.fork("astro-gists/config:setup") @@ -29,8 +30,14 @@ export default defineIntegration({ // Add virtual imports addVirtualImports({ "virtual:astro-gists/config": `export default ${JSON.stringify(options)}`, + "astro-gists:components": `export * from "@matthiesenxyz/astro-gists/components";` }); + addDts({ + name: "astro-gists", + content: readFileSync(resolve("./stubs/astro-gists.d.ts"), "utf-8") + }) + }, "astro:config:done": ({ logger }) => { const configDone = logger.fork("astro-gists/config:done") diff --git a/package/src/stubs/astro-gists.d.ts b/package/src/stubs/astro-gists.d.ts new file mode 100644 index 0000000..21facf1 --- /dev/null +++ b/package/src/stubs/astro-gists.d.ts @@ -0,0 +1,3 @@ +declare module "astro-gists:components" { + export * from "@matthiesenxyz/astro-gists/components"; +} \ No newline at end of file diff --git a/playground/astro.config.mts b/playground/astro.config.mjs similarity index 81% rename from playground/astro.config.mts rename to playground/astro.config.mjs index b356ea7..aa66aa3 100644 --- a/playground/astro.config.mts +++ b/playground/astro.config.mjs @@ -4,5 +4,6 @@ import mdx from "@astrojs/mdx" // https://astro.build/config export default defineConfig({ - integrations: [astroGist(),mdx()] -}); \ No newline at end of file + integrations: [astroGist(), mdx()] +}); + diff --git a/playground/src/env.d.ts b/playground/src/env.d.ts index f964fe0..101d7b9 100644 --- a/playground/src/env.d.ts +++ b/playground/src/env.d.ts @@ -1 +1,3 @@ +/// /// +/// diff --git a/playground/src/pages/virtual.astro b/playground/src/pages/virtual.astro new file mode 100644 index 0000000..0052815 --- /dev/null +++ b/playground/src/pages/virtual.astro @@ -0,0 +1,14 @@ +--- +import { GetGist, GetGistGroup } from "astro-gists:components" + +--- +

Dev: Playground (Virtual Imports)

+ + + + \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7128b3f..afc3eb5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,7 +33,7 @@ importers: specifier: ^0.33.4 version: 0.33.4 hast-util-to-html: - specifier: ^8.0.4 + specifier: 8.0.4 version: 8.0.4 octokit: specifier: ^3.1.2