diff --git a/packages/astro/src/content/vite-plugin-content-imports.ts b/packages/astro/src/content/vite-plugin-content-imports.ts index b051905f497a..e734282de6b3 100644 --- a/packages/astro/src/content/vite-plugin-content-imports.ts +++ b/packages/astro/src/content/vite-plugin-content-imports.ts @@ -3,7 +3,7 @@ import { extname } from 'node:path'; import { pathToFileURL } from 'node:url'; import * as devalue from 'devalue'; import type { PluginContext } from 'rollup'; -import { isRunnableDevEnvironment, type Plugin, type RunnableDevEnvironment } from 'vite'; +import type { Plugin, RunnableDevEnvironment } from 'vite'; import { getProxyCode } from '../assets/utils/proxy.js'; import { AstroError } from '../core/errors/errors.js'; import { AstroErrorData } from '../core/errors/index.js'; @@ -158,9 +158,6 @@ export const _internal = { } }, configureServer(viteServer) { - if (!isRunnableDevEnvironment(viteServer.environments.ssr)) { - return; - } viteServer.watcher.on('all', async (event, entry) => { if (CHOKIDAR_MODIFIED_EVENTS.includes(event)) { const environment = viteServer.environments.ssr; diff --git a/packages/astro/src/core/dev/dev.ts b/packages/astro/src/core/dev/dev.ts index b3a5e629a1bb..2a0a75fa355a 100644 --- a/packages/astro/src/core/dev/dev.ts +++ b/packages/astro/src/core/dev/dev.ts @@ -5,7 +5,6 @@ import { performance } from 'node:perf_hooks'; import { green } from 'kleur/colors'; import { gt, major, minor, patch } from 'semver'; import type * as vite from 'vite'; -import { isRunnableDevEnvironment } from 'vite'; import { getDataStoreFile, globalContentLayer } from '../../content/content-layer.js'; import { attachContentServerListeners } from '../../content/index.js'; import { MutableDataStore } from '../../content/mutable-data-store.js'; @@ -96,9 +95,7 @@ export default async function dev(inlineConfig: AstroInlineConfig): Promise - + }: Pick, ) { const pipeline = new AstroServerPipeline(loader, logger, manifest, settings); pipeline.routesList = manifestData; diff --git a/packages/astro/src/vite-plugin-head/index.ts b/packages/astro/src/vite-plugin-head/index.ts index df9fd6388cd5..6d5686dca1fb 100644 --- a/packages/astro/src/vite-plugin-head/index.ts +++ b/packages/astro/src/vite-plugin-head/index.ts @@ -1,6 +1,6 @@ import type { ModuleInfo } from 'rollup'; import type * as vite from 'vite'; -import { type DevEnvironment, isRunnableDevEnvironment } from 'vite'; +import type { DevEnvironment } from 'vite'; import { getParentModuleInfos, getTopLevelPageModuleInfos } from '../core/build/graph.js'; import type { BuildInternals } from '../core/build/internal.js'; import type { AstroBuildPlugin } from '../core/build/plugin.js'; @@ -48,9 +48,6 @@ export default function configHeadVitePlugin(): vite.Plugin { enforce: 'pre', apply: 'serve', configureServer(server) { - if (!isRunnableDevEnvironment(server.environments.ssr)) { - return; - } environment = server.environments.ssr; }, resolveId(source, importer) { @@ -63,7 +60,7 @@ export default function configHeadVitePlugin(): vite.Plugin { if (result) { let info = this.getModuleInfo(result.id); const astro = info && getAstroMetadata(info); - if (astro && isRunnableDevEnvironment(environment)) { + if (astro) { if (astro.propagation === 'self' || astro.propagation === 'in-tree') { propagateMetadata.call(this, importer, 'propagation', 'in-tree'); } @@ -77,9 +74,6 @@ export default function configHeadVitePlugin(): vite.Plugin { } }, transform(source, id) { - if (!isRunnableDevEnvironment(environment)) { - return; - } // TODO This could probably be removed now that this is handled in resolveId let info = this.getModuleInfo(id); if (info && getAstroMetadata(info)?.containsHead) { diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/astro.config.mjs b/packages/integrations/cloudflare/test/fixtures/vite-plugin/astro.config.mjs index a7c5b0c419f3..cfd7b8d9af0e 100644 --- a/packages/integrations/cloudflare/test/fixtures/vite-plugin/astro.config.mjs +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/astro.config.mjs @@ -2,11 +2,22 @@ import cloudflare from '@astrojs/cloudflare'; import { defineConfig } from 'astro/config'; +import mdx from '@astrojs/mdx'; +import { fileURLToPath } from 'node:url'; export default defineConfig({ adapter: cloudflare({ workerEntryPoint: { path: 'src/worker.ts', - } + }, + imageService: 'cloudflare', }), + vite: { + resolve: { + alias: { + '@images': fileURLToPath(new URL('./images', import.meta.url)), + }, + }, + }, + integrations: [mdx()], }); diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/I'm back.jpg b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/I'm back.jpg new file mode 100644 index 000000000000..7455a726ef13 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/I'm back.jpg differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/atlantis.avif b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/atlantis.avif new file mode 100644 index 000000000000..6b9f6d5a5913 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/atlantis.avif differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/launch.webp b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/launch.webp new file mode 100644 index 000000000000..144ded978ad2 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/launch.webp differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/lunar-module.jpg b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/lunar-module.jpg new file mode 100644 index 000000000000..9b8cee764271 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/lunar-module.jpg differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/shuttle.jpg b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/shuttle.jpg new file mode 100644 index 000000000000..80b8ea67b8e4 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/images/shuttle.jpg differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/package.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/package.json index 614ff01c68db..d3f8d08dac20 100644 --- a/packages/integrations/cloudflare/test/fixtures/vite-plugin/package.json +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@astrojs/cloudflare": "workspace:*", + "@astrojs/mdx": "^4.3.5", "astro": "workspace:*" } } diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/public/buzz.jpg b/packages/integrations/cloudflare/test/fixtures/vite-plugin/public/buzz.jpg new file mode 100644 index 000000000000..34c544bb7e4d Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/public/buzz.jpg differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/H2.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/H2.astro new file mode 100644 index 000000000000..d1ad359c2ee1 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/H2.astro @@ -0,0 +1,4 @@ +--- +--- + +

diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/H3.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/H3.astro new file mode 100644 index 000000000000..fa476e929eae --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/H3.astro @@ -0,0 +1,2 @@ + +

\ No newline at end of file diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/LayoutProp.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/LayoutProp.astro new file mode 100644 index 000000000000..a2954162a396 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/LayoutProp.astro @@ -0,0 +1,39 @@ +--- +import { CollectionEntry, getCollection } from 'astro:content'; +import H3 from './H3.astro' +// Test for recursive `getCollection()` calls +const blog = await getCollection('blog'); + +type Props = { + content: CollectionEntry<'blog'>['data']; +}; + +const { + content: { title }, +} = Astro.props; +--- + + + + + + + + With Layout Prop + + +

{title}

+

H3 inserted in the layout

+ + + + + diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/WithScripts.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/WithScripts.astro new file mode 100644 index 000000000000..7f674c705bfb --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/components/WithScripts.astro @@ -0,0 +1,11 @@ +

Script didn't update me :(

+ +

Inline script didn't update me :(

+ + + + diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content.config.ts b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content.config.ts new file mode 100644 index 000000000000..386555b767a9 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content.config.ts @@ -0,0 +1,275 @@ +import { defineCollection, z, reference } from 'astro:content'; +import { file, glob } from 'astro/loaders'; +import { loader } from './loaders/post-loader.js'; +import { readFile } from 'fs/promises'; + +const blog = defineCollection({ + loader: loader({ url: 'https://jsonplaceholder.typicode.com/posts' }), +}); + +const dogs = defineCollection({ + loader: file('src/data/dogs.json'), + schema: z.object({ + breed: z.string(), + id: z.string(), + size: z.string(), + origin: z.string(), + lifespan: z.string(), + temperament: z.array(z.string()), + }), +}); + +const rodents = defineCollection({ + loader: () => ({ + capybara: { + name: 'Capybara', + scientificName: 'Hydrochoerus hydrochaeris', + lifespan: 10, + weight: 50000, + diet: ['grass', 'aquatic plants', 'bark', 'fruits'], + nocturnal: false, + }, + hamster: { + name: 'Golden Hamster', + scientificName: 'Mesocricetus auratus', + lifespan: 2, + weight: 120, + diet: ['seeds', 'nuts', 'insects'], + nocturnal: true, + }, + rat: { + name: 'Brown Rat', + scientificName: 'Rattus norvegicus', + lifespan: 2, + weight: 350, + diet: ['grains', 'fruits', 'vegetables', 'meat'], + nocturnal: true, + }, + mouse: { + name: 'House Mouse', + scientificName: 'Mus musculus', + lifespan: 1, + weight: 20, + diet: ['seeds', 'grains', 'fruits'], + nocturnal: true, + }, + guineaPig: { + name: 'Guinea Pig', + scientificName: 'Cavia porcellus', + lifespan: 5, + weight: 1000, + diet: ['hay', 'vegetables', 'fruits'], + nocturnal: false, + }, + }), + schema: z.object({ + name: z.string(), + scientificName: z.string(), + lifespan: z.number().int().positive(), + weight: z.number().positive(), + diet: z.array(z.string()), + nocturnal: z.boolean(), + }), +}); +// Absolute paths should also work +const absoluteRoot = new URL('content/space', import.meta.url); + +const spacecraft = defineCollection({ + loader: glob({ pattern: '*.md', base: absoluteRoot }), + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string(), + publishedDate: z.coerce.date(), + tags: z.array(z.string()), + heroImage: image().optional(), + cat: reference('cats').default('siamese'), + something: z + .string() + .optional() + .transform((str) => ({ type: 'test', content: str })), + }), +}); + + +const cats = defineCollection({ + loader: async function () { + const file = new URL('data/cats.json', import.meta.url); + const data = await readFile(file, 'utf-8'); + return JSON.parse(data); + }, + schema: z.object({ + breed: z.string(), + id: z.string(), + size: z.string(), + origin: z.string(), + lifespan: z.string(), + temperament: z.array(z.string()), + }), +}); + +const fish = defineCollection({ + loader: file('src/data/fish.yaml'), + schema: z.object({ + name: z.string(), + breed: z.string(), + age: z.number(), + }), +}); + +const birds = defineCollection({ + loader: file('src/data/birds.json', { + parser: (text) => JSON.parse(text).birds, + }), + schema: z.object({ + id: z.string(), + name: z.string(), + breed: z.string(), + age: z.number(), + }), +}); + +const plants = defineCollection({ + loader: file('src/data/plants.csv', { + parser: (text) => { + const [headers = '', ...rows] = text.trim().split('\n'); + return rows.map(row => Object.fromEntries( + headers.split(',').map((h, i) => [h, row.split(',')[i]]) + )); + }, + }), + schema: z.object({ + id: z.string(), + common_name: z.string(), + scientific_name: z.string(), + color: z.string(), + }), +}); + +const probes = defineCollection({ + loader: glob({ pattern: ['*.md', '!voyager-*'], base: 'src/data/space-probes' }), + schema: z.object({ + name: z.string(), + type: z.enum(['Space Probe', 'Mars Rover', 'Comet Lander']), + launch_date: z.date(), + status: z.enum(['Active', 'Inactive', 'Decommissioned']), + destination: z.string(), + operator: z.string(), + notable_discoveries: z.array(z.string()), + }), +}); + +const numbers = defineCollection({ + loader: glob({ pattern: 'src/data/glob-data/*', base: '.' }), +}); + +const numbersYaml = defineCollection({ + loader: glob({ pattern: 'src/data/glob-yaml/*', base: '.' }), +}); + +const numbersToml = defineCollection({ + loader: glob({ pattern: 'src/data/glob-toml/*', base: '.' }), +}); + +const notADirectory = defineCollection({ + loader: glob({ pattern: '*', base: 'src/nonexistent' }), +}); + +const nothingMatches = defineCollection({ + loader: glob({ pattern: 'nothingmatches/*', base: 'src/data' }), +}); +const images = defineCollection({ + loader: () => [ + { + id: '1', + image: '@images/shuttle.jpg', + }, + { + id: '2', + image: 'https://images.unsplash.com/photo-1457364887197-9150188c107b?w=800&fm=jpg&fit=crop', + }, + ], + schema: ({ image }) => + z.object({ + id: z.string(), + image: image(), + }), +}); + +const markdownContent = ` +# heading 1 +hello +## heading 2 +![image](./image.png) +![image 2](https://example.com/image.png) +` + +const increment = defineCollection({ + loader: { + name: 'increment-loader', + load: async ({ store, refreshContextData, parseData, renderMarkdown }) => { + const entry = store.get<{ lastValue: number }>('value'); + const lastValue = entry?.data.lastValue ?? 0; + const raw = { + id: 'value', + data: { + lastValue: lastValue + 1, + lastUpdated: new Date(), + refreshContextData, + slug: 'slimy' + }, + } + const parsed = await parseData(raw) + store.set({ + id: raw.id, + data: parsed, + rendered: await renderMarkdown(markdownContent) + }); + }, + // Example of a loader that returns an async schema function + schema: async () => + z.object({ + lastValue: z.number(), + lastUpdated: z.date(), + refreshContextData: z.record(z.unknown()).optional(), + slug: z.string().optional(), + }), + }, +}); + +const artists = defineCollection({ + loader: file('src/data/artists.toml'), + schema: z.object({ + name: z.string(), + genre: z.string().array(), + }), +}); + +const songs = defineCollection({ + loader: file('src/data/songs.toml'), + schema: z.object({ + name: z.string(), + artists: z.array(reference('artists')), + }), +}); + +export const collections = { + blog, + dogs, + cats, + fish, + birds, + plants, + numbers, + numbersToml, + numbersYaml, + spacecraft, + increment, + images, + artists, + songs, + probes, + rodents, + notADirectory, + nothingMatches +}; diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/atlantis.JPG b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/atlantis.JPG new file mode 100644 index 000000000000..8468822f8eaa Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/atlantis.JPG differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/atlantis.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/atlantis.md new file mode 100644 index 000000000000..81f4352da179 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/atlantis.md @@ -0,0 +1,11 @@ +--- +title: Atlantis +description: 'Learn about the Atlantis NASA space shuttle.' +publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)' +tags: [space, 90s] +heroImage: "./atlantis.JPG" +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Atlantis) + +Space Shuttle Atlantis (Orbiter Vehicle Designation: OV-104) is a Space Shuttle orbiter vehicle belonging to the National Aeronautics and Space Administration (NASA), the spaceflight and space exploration agency of the United States. Constructed by the Rockwell International company in Southern California and delivered to the Kennedy Space Center in Eastern Florida in April 1985, Atlantis is the fourth operational and the second-to-last Space Shuttle built. Its maiden flight was STS-51-J from 3 to 7 October 1985. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/columbia-copy.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/columbia-copy.md new file mode 100644 index 000000000000..fba81378ee29 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/columbia-copy.md @@ -0,0 +1,18 @@ +--- +title: More Columbia +description: 'Learn about the Columbia NASA space shuttle.' +publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)' +tags: [space, 90s] +cat: tabby +heroImage: "./shuttle.jpg" +something: "transform me" +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Endeavour) + +Space Shuttle Endeavour (Orbiter Vehicle Designation: OV-105) is a retired orbiter from NASA's Space Shuttle program and the fifth and final operational Shuttle built. It embarked on its first mission, STS-49, in May 1992 and its 25th and final mission, STS-134, in May 2011. STS-134 was expected to be the final mission of the Space Shuttle program, but with the authorization of STS-135, Atlantis became the last shuttle to fly. + +The United States Congress approved the construction of Endeavour in 1987 to replace the Space Shuttle Challenger, which was destroyed in 1986. + +NASA chose, on cost grounds, to build much of Endeavour from spare parts rather than refitting the Space Shuttle Enterprise, and used structural spares built during the construction of Discovery and Atlantis in its assembly. +Space Shuttle Endeavour (Orbiter Vehicle Designation: OV-105) is a retired orbiter from NASA's Space Shuttle program and the fifth and final operational Shuttle built. It embarked on its first mission, STS-49, in May 1992 and its 25th and final mission, STS-134, in May 2011. STS-134 was expected to be the final mission of the Space Shuttle program, but with the authorization of STS-135, Atlantis became the last shuttle to fly. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/columbia.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/columbia.md new file mode 100644 index 000000000000..e8a7bf248647 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/columbia.md @@ -0,0 +1,22 @@ +--- +title: Columbia +description: 'Learn about the Columbia NASA space shuttle.' +publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)' +tags: [space, 90s] +heroImage: "@images/launch.webp" +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Endeavour) + +![columbia bare](shuttle.jpg) +![columbia relative](./shuttle.jpg) +![atlantis alias](@images/atlantis.avif) +![columbia relative 2](./shuttle.jpg) + +## Columbia + +Space Shuttle Columbia (Orbiter Vehicle Designation: OV-102) was the first space-rated orbiter in NASA's Space Shuttle fleet. It launched for the first time on mission STS-1 on April 12, 1981, the first flight of the Space Shuttle program. Over 22 years of service, it completed 27 missions before disintegrating during re-entry near the end of its 28th mission, STS-107 on February 1, 2003, resulting in the deaths of all seven crew members. + +Columbia was named after the American sloop Columbia Rediviva which, from 1787 to 1793, under the command of Captain Robert Gray, explored the US Pacific Northwest and became the first American vessel to circumnavigate the globe. It is also named after the Command Module of Apollo 11, the first crewed landing on another celestial body. Columbia + +Columbia was the first space shuttle to reach space, on mission STS-1. It was also the first space shuttle to be launched more than once, with a total of 28 missions flown over 22 years. In 2003, Columbia was destroyed as it re-entered Earth's atmosphere, killing all seven crew members. The disaster led to the grounding of the space shuttle fleet for over two years, and the eventual retirement of the remaining orbiters. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/endeavour.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/endeavour.md new file mode 100644 index 000000000000..43dfd97a1ffd --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/endeavour.md @@ -0,0 +1,16 @@ +--- +title: Endeavour +description: 'Learn about the Endeavour NASA space shuttle.' +publishedDate: 'Sun Jul 11 2021 00:00:00 GMT-0400 (Eastern Daylight Time)' +tags: [space, 90s] +heroImage: "@images/I'm back.jpg" + +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Endeavour) + +Space Shuttle Endeavour (Orbiter Vehicle Designation: OV-105) is a retired orbiter from NASA's Space Shuttle program and the fifth and final operational Shuttle built. It embarked on its first mission, STS-49, in May 1992 and its 25th and final mission, STS-134, in May 2011. STS-134 was expected to be the final mission of the Space Shuttle program, but with the authorization of STS-135, Atlantis became the last shuttle to fly. + +The United States Congress approved the construction of Endeavour in 1987 to replace the Space Shuttle Challenger, which was destroyed in 1986. + +NASA chose, on cost grounds, to build much of Endeavour from spare parts rather than refitting the Space Shuttle Enterprise, and used structural spares built during the construction of Discovery and Atlantis in its assembly. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/enterprise.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/enterprise.md new file mode 100644 index 000000000000..3131e6d5df3a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/enterprise.md @@ -0,0 +1,14 @@ +--- +title: 'Enterprise' +description: 'Learn about the Enterprise NASA space shuttle.' +publishedDate: 'Tue Jun 08 2021 00:00:00 GMT-0400 (Eastern Daylight Time)' +tags: [space, 70s] +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Enterprise) + +Space Shuttle Enterprise (Orbiter Vehicle Designation: OV-101) was the first orbiter of the Space Shuttle system. Rolled out on September 17, 1976, it was built for NASA as part of the Space Shuttle program to perform atmospheric test flights after being launched from a modified Boeing 747. It was constructed without engines or a functional heat shield. As a result, it was not capable of spaceflight. + +Originally, Enterprise had been intended to be refitted for orbital flight to become the second space-rated orbiter in service. However, during the construction of Space Shuttle Columbia, details of the final design changed, making it simpler and less costly to build Challenger around a body frame that had been built as a test article. Similarly, Enterprise was considered for refit to replace Challenger after the latter was destroyed, but Endeavour was built from structural spares instead. + +Enterprise was restored and placed on display in 2003 at the Smithsonian's new Steven F. Udvar-Hazy Center in Virginia. Following the retirement of the Space Shuttle fleet, Discovery replaced Enterprise at the Udvar-Hazy Center, and Enterprise was transferred to the Intrepid Sea, Air & Space Museum in New York City, where it has been on display since July 2012. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/exomars.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/exomars.md new file mode 100644 index 000000000000..ea0ac6023689 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/exomars.md @@ -0,0 +1,10 @@ +--- +title: Rosalind Franklin Rover +description: 'Learn about the Rosalind Franklin Rover.' +publishedDate: '2022-09-19' +tags: [space, 2020s] +# slug: rosalind-franklin-rover +--- +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Rosalind_Franklin_(rover)) + +The Rosalind Franklin rover is a planned robotic Mars rover, part of the ExoMars mission led by the European Space Agency and the Russian space agency Roscosmos. The mission is scheduled to launch in September 2022, and the rover is expected to land on Mars in June 2023. The rover is named after the British biophysicist Rosalind Franklin, who made key contributions to the discovery of the structure of DNA. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/index.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/index.md new file mode 100644 index 000000000000..4971108e36ed --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/index.md @@ -0,0 +1,15 @@ +--- +title: Columbia +description: 'Learn about the Columbia NASA space shuttle.' +publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)' +tags: [space, 90s] +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Endeavour) + +Space Shuttle Endeavour (Orbiter Vehicle Designation: OV-105) is a retired orbiter from NASA's Space Shuttle program and the fifth and final operational Shuttle built. It embarked on its first mission, STS-49, in May 1992 and its 25th and final mission, STS-134, in May 2011. STS-134 was expected to be the final mission of the Space Shuttle program, but with the authorization of STS-135, Atlantis became the last shuttle to fly. + +The United States Congress approved the construction of Endeavour in 1987 to replace the Space Shuttle Challenger, which was destroyed in 1986. + +NASA chose, on cost grounds, to build much of Endeavour from spare parts rather than refitting the Space Shuttle Enterprise, and used structural spares built during the construction of Discovery and Atlantis in its assembly. +Space Shuttle Endeavour (Orbiter Vehicle Designation: OV-105) is a retired orbiter from NASA's Space Shuttle program and the fifth and final operational Shuttle built. It embarked on its first mission, STS-49, in May 1992 and its 25th and final mission, STS-134, in May 2011. STS-134 was expected to be the final mission of the Space Shuttle program, but with the authorization of STS-135, Atlantis became the last shuttle to fly. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/lunar-module.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/lunar-module.md new file mode 100644 index 000000000000..2d6d23853f7e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/lunar-module.md @@ -0,0 +1,17 @@ +--- +title: Lunar Module +description: 'Learn about the Lunar Module.' +publishedDate: '2024-09-19' +tags: [space, 60s] +heroImage: "/images/lunar-module.jpg" +--- + +**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Apollo_Lunar_Module) + +The Lunar Module (LM, pronounced "Lem"), originally designated the Lunar Excursion Module (LEM), was the lander spacecraft that was flown between lunar orbit and the Moon's surface during the U.S. Apollo program. It was the first crewed spacecraft to operate exclusively in the airless vacuum of space, and remains the only crewed vehicle to land anywhere beyond Earth. + +![buzz](/buzz.jpg) + +![shuttle](shuttle.jpg) + +![xss ">](./shuttle.jpg) diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/shuttle.jpg b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/shuttle.jpg new file mode 100644 index 000000000000..80b8ea67b8e4 Binary files /dev/null and b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/content/space/shuttle.jpg differ diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/artists.toml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/artists.toml new file mode 100644 index 000000000000..0416db01083f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/artists.toml @@ -0,0 +1,39 @@ +[kendrick-lamar] +name = "Kendrick Lamar" +genre = ["Hip-Hop", "Rap"] + +[mac-miller] +name = "Mac Miller" +genre = ["Hip-Hop", "Rap"] + +[jid] +name = "JID" +genre = ["Hip-Hop", "Rap"] + +[yasiin-bey] +name = "Yasiin Bey" +genre = ["Hip-Hop", "Rap"] + +[kanye-west] +name = "Kanye West" +genre = ["Hip-Hop", "Rap"] + +[jay-z] +name = "JAY-Z" +genre = ["Hip-Hop", "Rap"] + +[j-ivy] +name = "J. Ivy" +genre = ["Spoken Word", "Rap"] + +[frank-ocean] +name = "Frank Ocean" +genre = ["R&B", "Hip-Hop"] + +[the-dream] +name = "The-Dream" +genre = ["R&B", "Hip-Hop"] + +[baby-keem] +name = "Baby Keem" +genre = ["Hip-Hop", "Rap"] diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/birds.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/birds.json new file mode 100644 index 000000000000..3e7d83795a12 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/birds.json @@ -0,0 +1,34 @@ +{ + "birds": [ + { + "id": "bluejay", + "name": "Blue Jay", + "breed": "Cyanocitta cristata", + "age": 3 + }, + { + "id": "robin", + "name": "Robin", + "breed": "Turdus migratorius", + "age": 2 + }, + { + "id": "sparrow", + "name": "Sparrow", + "breed": "Passer domesticus", + "age": 1 + }, + { + "id": "cardinal", + "name": "Cardinal", + "breed": "Cardinalis cardinalis", + "age": 4 + }, + { + "id": "goldfinch", + "name": "Goldfinch", + "breed": "Spinus tristis", + "age": 2 + } + ] +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/cats.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/cats.json new file mode 100644 index 000000000000..cf44e70b73b6 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/cats.json @@ -0,0 +1,51 @@ +[ + { + "breed": "Siamese", + "id": "siamese", + "size": "Medium", + "origin": "Thailand", + "lifespan": "15 years", + "temperament": [ + "Active", + "Affectionate", + "Social", + "Playful" + ] + }, + { + "breed": "Persian", + "id": "persian", + "size": "Medium", + "origin": "Iran", + "lifespan": "15 years", + "temperament": [ + "Calm", + "Affectionate", + "Social" + ] + }, + { + "breed": "Tabby", + "id": "tabby", + "size": "Medium", + "origin": "Egypt", + "lifespan": "15 years", + "temperament": [ + "Curious", + "Playful", + "Independent" + ] + }, + { + "breed": "Ragdoll", + "id": "ragdoll", + "size": "Medium", + "origin": "United States", + "lifespan": "15 years", + "temperament": [ + "Calm", + "Affectionate", + "Social" + ] + } +] diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/dogs.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/dogs.json new file mode 100644 index 000000000000..e9e907110f27 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/dogs.json @@ -0,0 +1,314 @@ +[ + { + "breed": "Labrador Retriever", + "id": "labrador-retriever", + "size": "Large", + "origin": "Canada", + "lifespan": "10-12 years", + "temperament": [ + "Friendly", + "Active", + "Outgoing" + ] + }, + { + "breed": "German Shepherd", + "id": "german-shepherd", + "size": "Large", + "origin": "Germany", + "lifespan": "9-13 years", + "temperament": [ + "Loyal", + "Intelligent", + "Confident" + ] + }, + { + "breed": "Alsatian", + "id": "german-shepherd", + "size": "Large", + "origin": "Germany", + "lifespan": "9-13 years", + "temperament": [ + "Loyal", + "Intelligent", + "Confident" + ] + }, + { + "breed": "Golden Retriever", + "id": "golden-retriever", + "size": "Large", + "origin": "Scotland", + "lifespan": "10-12 years", + "temperament": [ + "Intelligent", + "Friendly", + "Devoted" + ] + }, + { + "breed": "French Bulldog", + "id": "french-bulldog", + "size": "Small", + "origin": "France", + "lifespan": "10-12 years", + "temperament": [ + "Playful", + "Adaptable", + "Sociable" + ] + }, + { + "breed": "Bulldog", + "id": "bulldog", + "size": "Medium", + "origin": "England", + "lifespan": "8-10 years", + "temperament": [ + "Docile", + "Willful", + "Friendly" + ] + }, + { + "breed": "Beagle", + "id": "beagle", + "size": "Small to Medium", + "origin": "England", + "lifespan": "12-15 years", + "temperament": [ + "Friendly", + "Curious", + "Merry" + ] + }, + { + "breed": "Poodle", + "id": "poodle", + "size": "Toy, Miniature, or Standard", + "origin": "Germany", + "lifespan": "12-15 years", + "temperament": [ + "Intelligent", + "Active", + "Alert" + ] + }, + { + "breed": "Rottweiler", + "id": "rottweiler", + "size": "Large", + "origin": "Germany", + "lifespan": "8-10 years", + "temperament": [ + "Loyal", + "Confident", + "Courageous" + ] + }, + { + "breed": "German Shorthaired Pointer", + "id": "german-shorthaired-pointer", + "size": "Medium to Large", + "origin": "Germany", + "lifespan": "10-12 years", + "temperament": [ + "Friendly", + "Intelligent", + "Willing to Please" + ] + }, + { + "breed": "Yorkshire Terrier", + "id": "yorkshire-terrier", + "size": "Toy", + "origin": "England", + "lifespan": "13-16 years", + "temperament": [ + "Affectionate", + "Sprightly", + "Tomboyish" + ] + }, + { + "breed": "Boxer", + "id": "boxer", + "size": "Medium to Large", + "origin": "Germany", + "lifespan": "10-12 years", + "temperament": [ + "Playful", + "Energetic", + "Loyal" + ] + }, + { + "breed": "Dachshund", + "id": "dachshund", + "size": "Small", + "origin": "Germany", + "lifespan": "12-16 years", + "temperament": [ + "Clever", + "Stubborn", + "Devoted" + ] + }, + { + "breed": "Siberian Husky", + "id": "siberian-husky", + "size": "Medium", + "origin": "Siberia", + "lifespan": "12-14 years", + "temperament": [ + "Outgoing", + "Mischievous", + "Loyal" + ] + }, + { + "breed": "Great Dane", + "id": "great-dane", + "size": "Large", + "origin": "Germany", + "lifespan": "7-10 years", + "temperament": [ + "Friendly", + "Patient", + "Dependable" + ] + }, + { + "breed": "Doberman Pinscher", + "id": "doberman-pinscher", + "size": "Large", + "origin": "Germany", + "lifespan": "10-12 years", + "temperament": [ + "Loyal", + "Fearless", + "Alert" + ] + }, + { + "breed": "Australian Shepherd", + "id": "australian-shepherd", + "size": "Medium", + "origin": "United States", + "lifespan": "12-15 years", + "temperament": [ + "Intelligent", + "Work-oriented", + "Exuberant" + ] + }, + { + "breed": "Miniature Schnauzer", + "id": "miniature-schnauzer", + "size": "Small", + "origin": "Germany", + "lifespan": "12-15 years", + "temperament": [ + "Friendly", + "Smart", + "Obedient" + ] + }, + { + "breed": "Cavalier King Charles Spaniel", + "id": "cavalier-king-charles-spaniel", + "size": "Small", + "origin": "United Kingdom", + "lifespan": "9-14 years", + "temperament": [ + "Affectionate", + "Gentle", + "Graceful" + ] + }, + { + "breed": "Shih Tzu", + "id": "shih-tzu", + "size": "Small", + "origin": "China", + "lifespan": "10-18 years", + "temperament": [ + "Affectionate", + "Playful", + "Outgoing" + ] + }, + { + "breed": "Boston Terrier", + "id": "boston-terrier", + "size": "Small", + "origin": "United States", + "lifespan": "11-13 years", + "temperament": [ + "Friendly", + "Lively", + "Intelligent" + ] + }, + { + "breed": "Bernese Mountain Dog", + "id": "bernese-mountain-dog", + "size": "Large", + "origin": "Switzerland", + "lifespan": "7-10 years", + "temperament": [ + "Good-natured", + "Calm", + "Strong" + ] + }, + { + "breed": "Pomeranian", + "id": "pomeranian", + "size": "Toy", + "origin": "Germany", + "lifespan": "12-16 years", + "temperament": [ + "Lively", + "Bold", + "Inquisitive" + ] + }, + { + "breed": "Havanese", + "id": "havanese", + "size": "Small", + "origin": "Cuba", + "lifespan": "14-16 years", + "temperament": [ + "Playful", + "Intelligent", + "Outgoing" + ] + }, + { + "breed": "English Springer Spaniel", + "id": "english-springer-spaniel", + "size": "Medium", + "origin": "England", + "lifespan": "12-14 years", + "temperament": [ + "Friendly", + "Playful", + "Obedient" + ] + }, + { + "breed": "Shetland Sheepdog", + "id": "shetland-sheepdog", + "size": "Small", + "origin": "Scotland", + "lifespan": "12-14 years", + "temperament": [ + "Playful", + "Energetic", + "Intelligent" + ] + } +] diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/fish.yaml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/fish.yaml new file mode 100644 index 000000000000..a9ac4e4352b4 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/fish.yaml @@ -0,0 +1,42 @@ +# map of ids to data +bubbles: + name: "Bubbles" + breed: "Goldfish" + age: 2 +finn: + name: "Finn" + breed: "Betta" + age: 1 +shadow: + name: "Shadow" + breed: "Catfish" + age: 3 +spark: + name: "Spark" + breed: "Tetra" + age: 1 +splash: + name: "Splash" + breed: "Guppy" + age: 2 +nemo: + name: "Nemo" + breed: "Clownfish" + age: 3 +angel-fish: + name: "Angel Fish" + breed: "Angelfish" + age: 4 +gold-stripe: + name: "Gold Stripe" + breed: "Molly" + age: 1 +blue-tail: + name: "Blue Tail" + breed: "Swordtail" + age: 2 +bubble-buddy: + name: "Bubble Buddy" + breed: "Betta" + age: 3 + diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/index.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/index.json new file mode 100644 index 000000000000..efc60137d68e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/index.json @@ -0,0 +1,3 @@ +{ + "title": "One" +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/one.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/one.json new file mode 100644 index 000000000000..efc60137d68e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/one.json @@ -0,0 +1,3 @@ +{ + "title": "One" +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/three.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/three.json new file mode 100644 index 000000000000..7d028e937a71 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/three.json @@ -0,0 +1,3 @@ +{ + "title": "Three" +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/two.json b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/two.json new file mode 100644 index 000000000000..1a8215509b0a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-data/two.json @@ -0,0 +1,3 @@ +{ + "title": "Two" +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/one.toml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/one.toml new file mode 100644 index 000000000000..ed1091c715de --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/one.toml @@ -0,0 +1 @@ +title = "One" diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/three.toml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/three.toml new file mode 100644 index 000000000000..0d5b539a695d --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/three.toml @@ -0,0 +1 @@ +title = "Three" diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/two.toml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/two.toml new file mode 100644 index 000000000000..c0b3a2daa6f9 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-toml/two.toml @@ -0,0 +1 @@ +title = "Two" diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/one.yaml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/one.yaml new file mode 100644 index 000000000000..5284a5e4030a --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/one.yaml @@ -0,0 +1 @@ +title: "One" diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/three.yaml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/three.yaml new file mode 100644 index 000000000000..ee252ce4c9c3 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/three.yaml @@ -0,0 +1 @@ +title: "Three" diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/two.yaml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/two.yaml new file mode 100644 index 000000000000..0592298c91ab --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/glob-yaml/two.yaml @@ -0,0 +1 @@ +title: "Two" diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/plants.csv b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/plants.csv new file mode 100644 index 000000000000..89e66b9426f1 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/plants.csv @@ -0,0 +1,11 @@ +id,common_name,scientific_name,color +lavender,Lavender,Lavandula,Purple +rose,Rose,Rosa,Red +sunflower,Sunflower,Helianthus annuus,Yellow +basil,Basil,Ocimum,Green +thyme,Thyme,Thymus vulgaris,Green +sage,Sage,Salvia officinalis,Gray-Green +daisy,Daisy,Bellis,White +marigold,Marigold,Tagetes,Orange +chamomile,Chamomile,Matricaria chamomilla,White-Yellow +fern,Fern,Tracheophyta,Green diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/songs.toml b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/songs.toml new file mode 100644 index 000000000000..2aae72868a2e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/songs.toml @@ -0,0 +1,31 @@ +[crown] +name = "Crown" +artists = ["kendrick-lamar"] + +[nikes-on-my-feet] +name = "Nikes on My Feet" +artists = ["mac-miller"] + +[stars] +name = "Stars" +artists = ["jid", "yasiin-bey"] + +[never-let-me-down] +name = "Never Let Me Down" +artists = ["kanye-west", "jay-z", "j-ivy"] + +[no-church-in-the-wild] +name = "No Church In The Wild" +artists = ["jay-z", "kanye-west", "frank-ocean", "the-dream"] + +[family-ties] +name = "family ties" +artists = ["kendrick-lamar", "baby-keem"] + +[somebody] +name = "Somebody" +artists = ["jid"] + +[honest] +name = "HONEST" +artists = ["baby-keem"] diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/cassini.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/cassini.md new file mode 100644 index 000000000000..cb4eee96d9d0 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/cassini.md @@ -0,0 +1,14 @@ +--- +name: Cassini +type: Space Probe +launch_date: 1997-10-15 +status: Decommissioned +destination: Saturn +operator: NASA/ESA/ASI +notable_discoveries: + - Liquid methane seas on Titan + - Enceladus' subsurface ocean + - New Saturn rings and moons +--- + +The Cassini-Huygens mission was a collaboration between NASA, ESA, and ASI to study Saturn and its system. Launched in 1997, it arrived at Saturn in 2004 and operated until 2017. The mission dramatically improved our understanding of Saturn, its rings, and its moons, particularly Titan and Enceladus. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/curiosity-rover.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/curiosity-rover.md new file mode 100644 index 000000000000..8a9e94f2615f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/curiosity-rover.md @@ -0,0 +1,14 @@ +--- +name: Curiosity Rover +type: Mars Rover +launch_date: 2011-11-26 +status: Active +destination: Mars +operator: NASA +notable_discoveries: + - Evidence of ancient streambeds + - Organic molecules in rocks + - Methane fluctuations in atmosphere +--- + +The Curiosity rover, part of NASA's Mars Science Laboratory mission, landed on Mars in 2012. Its primary goal is to determine if Mars could have supported microbial life. The rover has made significant discoveries about Mars' geology and climate, and continues to explore the Gale crater. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/juno.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/juno.md new file mode 100644 index 000000000000..4aeab957bba4 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/juno.md @@ -0,0 +1,14 @@ +--- +name: Juno +type: Space Probe +launch_date: 2011-08-05 +status: Active +destination: Jupiter +operator: NASA +notable_discoveries: + - Jupiter's deep atmospheric dynamics + - Complex magnetic field structure + - Insights into Jupiter's core structure +--- + +Juno is a NASA space probe orbiting Jupiter. It was launched in 2011 and entered Jupiter's orbit in 2016. The spacecraft's mission is to measure Jupiter's composition, gravity field, magnetic field, and polar magnetosphere. Juno has provided new insights into Jupiter's interior structure and the processes that drive its intense magnetic fields and aurorae. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/new-horizons.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/new-horizons.md new file mode 100644 index 000000000000..06bf23c9cd76 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/new-horizons.md @@ -0,0 +1,14 @@ +--- +name: New Horizons +type: Space Probe +launch_date: 2006-01-19 +status: Active +destination: Pluto and Kuiper Belt +operator: NASA +notable_discoveries: + - Pluto's heart-shaped glacier + - Pluto's thin atmosphere + - Kuiper Belt Object Arrokoth's unusual shape +--- + +New Horizons is an interplanetary space probe launched as part of NASA's New Frontiers program. It performed the first flyby of Pluto in 2015, providing unprecedented data about the dwarf planet. After its Pluto mission, New Horizons continued into the Kuiper Belt, where it encountered the object Arrokoth in 2019, the most distant object in the Solar System visited by a spacecraft. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/philae-lander.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/philae-lander.md new file mode 100644 index 000000000000..10a394239dbe --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/philae-lander.md @@ -0,0 +1,14 @@ +--- +name: Philae Lander +type: Comet Lander +launch_date: 2004-03-02 +status: Inactive +destination: Comet 67P/Churyumov-Gerasimenko +operator: ESA +notable_discoveries: + - Organic molecules on the comet's surface + - Comet's surface hardness + - Presence of water ice +--- + +Philae was a robotic European Space Agency lander that accompanied the Rosetta spacecraft. It achieved the first-ever soft landing on a comet nucleus when it touched down on comet 67P/Churyumov-Gerasimenko in November 2014. Despite its short operational life, Philae provided unique data about the comet's composition and structure. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/voyager-1.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/voyager-1.md new file mode 100644 index 000000000000..7a7fa88c8e45 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/voyager-1.md @@ -0,0 +1,14 @@ +--- +name: Voyager 1 +type: Space Probe +launch_date: 1977-09-05 +status: Active +destination: Interstellar space +operator: NASA +notable_discoveries: + - Jupiter's complex cloud structures + - Active volcanoes on Io + - Saturn's ring structure +--- + +Voyager 1 is NASA's farthest and fastest-traveling space probe. Launched in 1977, it has been operating for over 45 years and entered interstellar space in 2012. The probe has provided invaluable data about the outer planets and the boundary between the Sun's influence and interstellar space. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/voyager-2.md b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/voyager-2.md new file mode 100644 index 000000000000..c5d405aa07b3 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/data/space-probes/voyager-2.md @@ -0,0 +1,16 @@ +--- +name: Voyager 2 +type: Space Probe +launch_date: 1977-08-20 +status: Active +destination: Interstellar space +operator: NASA +notable_discoveries: + - Neptune's Great Dark Spot + - Uranus' tilted magnetic field + - Active geysers on Neptune's moon Triton + - Jupiter's complex storm systems + - Saturn's intricate ring structure +--- + +Voyager 2 is a space probe launched by NASA as part of the Voyager program to study the outer Solar System and interstellar space. Despite being launched 16 days before Voyager 1, it's named Voyager 2 due to its slower trajectory. It's the only spacecraft to have visited all four gas giant planets: Jupiter, Saturn, Uranus, and Neptune. After completing its planetary mission, Voyager 2 continued on to study the outer reaches of the Solar System and entered interstellar space in 2018, becoming the second human-made object to do so after Voyager 1. diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/loaders/post-loader.ts b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/loaders/post-loader.ts new file mode 100644 index 000000000000..b03c1442227e --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/loaders/post-loader.ts @@ -0,0 +1,45 @@ +import { z } from 'astro:content'; +import type { Loader } from "astro/loaders" + +export interface PostLoaderConfig { + url: string; +} + +export function loader(config:PostLoaderConfig): Loader { + return { + name: "post-loader", + load: async ({ + store, meta, logger + }) => { + logger.info('Loading posts'); + + const lastSynced = meta.get('lastSynced'); + + // Don't sync more than once a minute + if (lastSynced && (Date.now() - Number(lastSynced) < 1000 * 60)) { + logger.info('Skipping sync'); + return; + } + + const posts = await fetch(config.url) + .then((res) => res.json()); + + store.clear(); + + for (const data of posts) { + store.set({id: data.id, data}); + } + meta.set('lastSynced', String(Date.now())); + }, + schema: async () => { + // Simulate a delay + await new Promise((resolve) => setTimeout(resolve, 1000)); + return z.object({ + title: z.string(), + body: z.string(), + userId: z.number(), + id: z.number(), + }); + } + }; +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/blog/[id].astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/blog/[id].astro new file mode 100644 index 000000000000..850833907ba7 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/blog/[id].astro @@ -0,0 +1,29 @@ +--- +import type { GetStaticPaths } from "astro"; +import { getCollection } from "astro:content" +export const getStaticPaths = (async () => { + const collection = await getCollection("blog"); + if(!collection) return [] + return collection.map((post) => ({ + params: { + id: post.id + }, + props: { + post: post.data + } + })); +}) satisfies GetStaticPaths; + +interface Props { + post: { + title: string; + body: string; + } +} + +const { post } = Astro.props + +--- + +

{post.title}

+

{post.body}

diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/collections.json.js b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/collections.json.js new file mode 100644 index 000000000000..1eda4dddab61 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/collections.json.js @@ -0,0 +1,68 @@ +import { getCollection, getEntry } from 'astro:content'; +import * as devalue from 'devalue'; + +export async function GET() { + const customLoader = await getCollection('blog', (entry) => { + return entry.data.id < 6; + }); + const jsonLoader = await getCollection('dogs'); + + const dataEntry = await getEntry('dogs', 'beagle'); + + const simpleLoader = await getCollection('cats'); + + const entryWithReference = await getEntry('spacecraft', 'columbia-copy'); + const atlantis = await getEntry('spacecraft', 'atlantis'); + const referencedEntry = await getEntry(entryWithReference.data.cat); + + const spacecraft = await getCollection('spacecraft'); + + const entryWithImagePath = await getEntry('spacecraft', 'lunar-module'); + + const increment = await getEntry('increment', 'value'); + + const images = await getCollection('images'); + + const simpleLoaderObject = await getCollection('rodents') + + const probes = await getCollection('probes'); + + const yamlLoader = await getCollection('fish'); + + const tomlLoader = await getCollection('songs'); + + const nestedJsonLoader = await getCollection('birds'); + + const csvLoader = await getCollection('plants'); + + const numbers = await getCollection('numbers'); + + const numbersYaml = await getCollection('numbersYaml'); + + const numbersToml = await getCollection('numbersToml'); + + return new Response( + devalue.stringify({ + customLoader, + jsonLoader, + dataEntry, + simpleLoader, + simpleLoaderObject, + entryWithReference, + entryWithImagePath, + referencedEntry, + increment, + numbers, + numbersYaml, + numbersToml, + images, + probes, + yamlLoader, + tomlLoader, + nestedJsonLoader, + csvLoader, + atlantis, + spacecraft: spacecraft.map(({id}) => id).sort((a, b) => a.localeCompare(b)), + }) + ); +} diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/dogs/[slug].astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/dogs/[slug].astro new file mode 100644 index 000000000000..977ae6efa167 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/dogs/[slug].astro @@ -0,0 +1,40 @@ +--- +import type { GetStaticPaths } from "astro"; +import { getCollection } from "astro:content" +export const getStaticPaths = (async () => { + const collection = await getCollection("dogs"); + if(!collection) return [] + return collection.map((dog) => ({ + params: { + slug: dog.id + }, + props: { + dog: dog.data + } + })); +}) satisfies GetStaticPaths; + + +interface Props { + dog: { + breed: string; + id: string; + size: string; + origin: string; + lifespan: string; + temperament: string[]; + } +} + +const { dog } = Astro.props + + +--- + +

{dog.breed}

+
    +
  • Size: {dog.size}
  • +
  • Origin: {dog.origin}
  • +
  • Lifespan: {dog.lifespan}
  • +
  • Temperament: {dog.temperament.join(", ")}
  • +
diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/index.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/index.astro index a6d0bc084dab..1a890fedba66 100644 --- a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/index.astro +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/index.astro @@ -1,13 +1,40 @@ --- -const workerRuntime = globalThis.navigator?.userAgent export const prerender = false +import { getCollection, getEntry, render } from 'astro:content'; + +const workerRuntime = globalThis.navigator?.userAgent +const blog = await getCollection('blog'); +const first = await getEntry('blog', 1); +const dogs = await getCollection('dogs'); +const increment = await getEntry('increment', 'value'); +const { Content } = await render(increment); --- - - astro-cloudflare-custom-entryfile - - -

astro-cloudflare-custom-entryfile

-

Runtime: {workerRuntime}

- + + Index + + +

Last updated: {increment.data.lastUpdated.toLocaleTimeString()}

+ +

Dogs

+

Running on: {workerRuntime ?? 'unknown runtime'}

+ +
+ +
+

Blog Posts

+ +

{first.data.title}

+ + + + diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/missing.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/missing.astro new file mode 100644 index 000000000000..f0e65d1bcbe7 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/missing.astro @@ -0,0 +1,14 @@ +--- +import { getEntry, render } from "astro:content" +// Skipping the broken page in production so the build doesn't fail +if(import.meta.env.PROD || import.meta.env.MODE === "production") { + return new Response(null, { status: 404 }) +} + +const entry = await getEntry("spacecraft", "missing") + +const { Content } = await render(entry) + +--- + + diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/spacecraft/[slug].astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/spacecraft/[slug].astro new file mode 100644 index 000000000000..80314606f96f --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/spacecraft/[slug].astro @@ -0,0 +1,35 @@ +--- +import type { GetStaticPaths } from "astro"; +import { getCollection, getEntry, render } from "astro:content" +import { Image } from "astro:assets" + +export const getStaticPaths = (async () => { + const collection = await getCollection("spacecraft"); + if(!collection) return [] + return collection.map((craft) => ({ + params: { + slug: `/${craft.id}` + }, + props: { + craft + } + })); +}) satisfies GetStaticPaths; + + + + +const { craft } = Astro.props as any + +let cat = craft.data.cat ? await getEntry(craft.data.cat) : undefined +const { Content, headings } = await render(craft) + +--- + +

{craft.data.title}

+ +{cat?

🐈: {cat.data.breed}

: undefined} +{craft.data.heroImage ? {craft.data.title} : undefined} + diff --git a/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/spacecraft/index.astro b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/spacecraft/index.astro new file mode 100644 index 000000000000..38bbb08f7f66 --- /dev/null +++ b/packages/integrations/cloudflare/test/fixtures/vite-plugin/src/pages/spacecraft/index.astro @@ -0,0 +1,17 @@ +--- +import { getCollection } from "astro:content"; +const collection = await getCollection("spacecraft"); +--- + + + Spacecraft + + +

Spacecraft

+ + + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2fd68b3239c..09f43122e8d6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4871,6 +4871,9 @@ importers: '@astrojs/cloudflare': specifier: workspace:* version: link:../../.. + '@astrojs/mdx': + specifier: ^4.3.5 + version: 4.3.5(astro@packages+astro) astro: specifier: workspace:* version: link:../../../../../astro @@ -6483,6 +6486,9 @@ packages: '@astrojs/compiler@2.12.2': resolution: {integrity: sha512-w2zfvhjNCkNMmMMOn5b0J8+OmUaBL1o40ipMvqcG6NRpdC+lKxmTi48DT8Xw0SzJ3AfmeFLB45zXZXtmbsjcgw==} + '@astrojs/internal-helpers@0.7.2': + resolution: {integrity: sha512-KCkCqR3Goym79soqEtbtLzJfqhTWMyVaizUi35FLzgGSzBotSw8DB1qwsu7U96ihOJgYhDk2nVPz+3LnXPeX6g==} + '@astrojs/language-server@2.15.4': resolution: {integrity: sha512-JivzASqTPR2bao9BWsSc/woPHH7OGSGc9aMxXL4U6egVTqBycB3ZHdBJPuOCVtcGLrzdWTosAqVPz1BVoxE0+A==} hasBin: true @@ -6495,6 +6501,19 @@ packages: prettier-plugin-astro: optional: true + '@astrojs/markdown-remark@6.3.6': + resolution: {integrity: sha512-bwylYktCTsLMVoCOEHbn2GSUA3c5KT/qilekBKA3CBng0bo1TYjNZPr761vxumRk9kJGqTOtU+fgCAp5Vwokug==} + + '@astrojs/mdx@4.3.5': + resolution: {integrity: sha512-YB3Hhsvl1BxyY0ARe1OrnVzLNKDPXAz9epYvmL+MQ8A85duSsSLQaO3GHB6/qZJKNoLmP6PptOtCONCKkbhPeQ==} + engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0} + peerDependencies: + astro: ^5.0.0 + + '@astrojs/prism@3.3.0': + resolution: {integrity: sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ==} + engines: {node: 18.20.8 || ^20.3.0 || >=22.0.0} + '@astrojs/yaml2ts@0.2.2': resolution: {integrity: sha512-GOfvSr5Nqy2z5XiwqTouBBpy5FyI6DEe+/g/Mk5am9SjILN1S5fOEvYK0GuWHg98yS/dobP4m8qyqw/URW35fQ==} @@ -11376,6 +11395,7 @@ packages: libsql@0.5.22: resolution: {integrity: sha512-NscWthMQt7fpU8lqd7LXMvT9pi+KhhmTHAJWUB/Lj6MWa0MKFv0F2V4C6WKKpjCVZl0VwcDz4nOI3CyaT1DDiA==} + cpu: [x64, arm64, wasm32, arm] os: [darwin, linux, win32] lightningcss-darwin-arm64@1.30.1: @@ -14253,6 +14273,8 @@ snapshots: '@astrojs/compiler@2.12.2': {} + '@astrojs/internal-helpers@0.7.2': {} + '@astrojs/language-server@2.15.4(prettier-plugin-astro@0.14.1)(prettier@3.6.2)(typescript@5.9.2)': dependencies: '@astrojs/compiler': 2.12.2 @@ -14279,6 +14301,55 @@ snapshots: transitivePeerDependencies: - typescript + '@astrojs/markdown-remark@6.3.6': + dependencies: + '@astrojs/internal-helpers': 0.7.2 + '@astrojs/prism': 3.3.0 + github-slugger: 2.0.0 + hast-util-from-html: 2.0.3 + hast-util-to-text: 4.0.2 + import-meta-resolve: 4.2.0 + js-yaml: 4.1.0 + mdast-util-definitions: 6.0.0 + rehype-raw: 7.0.0 + rehype-stringify: 10.0.1 + remark-gfm: 4.0.1 + remark-parse: 11.0.0 + remark-rehype: 11.1.2 + remark-smartypants: 3.0.2 + shiki: 3.12.2 + smol-toml: 1.4.2 + unified: 11.0.5 + unist-util-remove-position: 5.0.0 + unist-util-visit: 5.0.0 + unist-util-visit-parents: 6.0.1 + vfile: 6.0.3 + transitivePeerDependencies: + - supports-color + + '@astrojs/mdx@4.3.5(astro@packages+astro)': + dependencies: + '@astrojs/markdown-remark': 6.3.6 + '@mdx-js/mdx': 3.1.1 + acorn: 8.15.0 + astro: link:packages/astro + es-module-lexer: 1.7.0 + estree-util-visit: 2.0.0 + hast-util-to-html: 9.0.5 + kleur: 4.1.5 + rehype-raw: 7.0.0 + remark-gfm: 4.0.1 + remark-smartypants: 3.0.2 + source-map: 0.7.6 + unist-util-visit: 5.0.0 + vfile: 6.0.3 + transitivePeerDependencies: + - supports-color + + '@astrojs/prism@3.3.0': + dependencies: + prismjs: 1.30.0 + '@astrojs/yaml2ts@0.2.2': dependencies: yaml: 2.8.1