Fix scope

This commit is contained in:
Matt Kane
2026-04-01 10:58:32 +01:00
parent 482a442f60
commit 2e863566b3
264 changed files with 578 additions and 578 deletions

View File

@@ -1,5 +1,5 @@
{
"name": "@emdashcms/cloudflare",
"name": "@emdash-cms/cloudflare",
"version": "0.0.0",
"description": "Cloudflare adapters for EmDash - D1, R2, Access, and Worker Loader sandbox",
"type": "module",

View File

@@ -4,7 +4,7 @@
* This module is loaded at runtime when authenticating requests.
* It exports the `authenticate` function required by the auth provider interface.
*
* For config-time usage, import { access } from "@emdashcms/cloudflare" instead.
* For config-time usage, import { access } from "@emdash-cms/cloudflare" instead.
*/
export { authenticate } from "./cloudflare-access.js";

View File

@@ -4,7 +4,7 @@
* This is the config-time helper. Import it in your astro.config.mjs:
*
* ```ts
* import { cloudflareCache } from "@emdashcms/cloudflare";
* import { cloudflareCache } from "@emdash-cms/cloudflare";
*
* export default defineConfig({
* experimental: {
@@ -49,7 +49,7 @@ export type { CloudflareCacheConfig };
* ```ts
* import { defineConfig } from "astro/config";
* import cloudflare from "@astrojs/cloudflare";
* import { cloudflareCache } from "@emdashcms/cloudflare";
* import { cloudflareCache } from "@emdash-cms/cloudflare";
*
* export default defineConfig({
* adapter: cloudflare(),
@@ -75,7 +75,7 @@ export function cloudflareCache(
): CacheProviderConfig<CloudflareCacheConfig> {
return {
// Resolved by Vite/Astro at build time — points to the runtime module
entrypoint: "@emdashcms/cloudflare/cache",
entrypoint: "@emdash-cms/cloudflare/cache",
config,
};
}

View File

@@ -15,7 +15,7 @@
* headers from the response that next() returns.
*
* Do NOT import this at config time. Use cloudflareCache() from
* "@emdashcms/cloudflare" or "@emdashcms/cloudflare/cache/config" instead.
* "@emdash-cms/cloudflare" or "@emdash-cms/cloudflare/cache/config" instead.
*/
import type { CacheProviderFactory } from "astro";
@@ -41,7 +41,7 @@ const SWR_REGEX = /stale-while-revalidate=(\d+)/;
/** Internal headers to strip before returning responses to the client */
const INTERNAL_HEADERS = [STORED_AT_HEADER, MAX_AGE_HEADER, SWR_HEADER];
/** Default D1 bookmark cookie name (from @emdashcms/cloudflare d1 config) */
/** Default D1 bookmark cookie name (from @emdash-cms/cloudflare d1 config) */
const DEFAULT_BOOKMARK_COOKIE = "__ec_d1_bookmark";
export interface CloudflareCacheConfig {

View File

@@ -5,7 +5,7 @@
* Loaded at runtime via virtual module when database queries are needed.
*
* This module imports directly from cloudflare:workers to access the D1 binding.
* Do NOT import this at config time - use { d1 } from "@emdashcms/cloudflare" instead.
* Do NOT import this at config time - use { d1 } from "@emdash-cms/cloudflare" instead.
*/
import { env } from "cloudflare:workers";

View File

@@ -11,7 +11,7 @@
* @example
* ```ts
* // src/middleware.ts (in the preview Worker)
* import { createPreviewMiddleware } from "@emdashcms/cloudflare/db/do";
* import { createPreviewMiddleware } from "@emdash-cms/cloudflare/db/do";
*
* export const onRequest = createPreviewMiddleware({
* binding: "PREVIEW_DB",

View File

@@ -320,7 +320,7 @@ export const onRequest = defineMiddleware(async (context, next) => {
// Stash the DO database and user on locals so downstream middleware
// (runtime init, request-context) can use them. We can't use ALS directly
// because this middleware is in @emdashcms/cloudflare and resolves to a
// because this middleware is in @emdash-cms/cloudflare and resolves to a
// different AsyncLocalStorage instance than the emdash core package
// (workerd loads dist modules separately from Vite's source modules).
// The request-context middleware (same module context as the loader)

View File

@@ -1,5 +1,5 @@
/**
* @emdashcms/cloudflare
* @emdash-cms/cloudflare
*
* Cloudflare adapters for EmDash:
* - D1 database adapter
@@ -12,13 +12,13 @@
*
* For runtime exports (PluginBridge, authenticate), import from the specific
* runtime entrypoints:
* - @emdashcms/cloudflare/sandbox (PluginBridge, createSandboxRunner)
* - @emdashcms/cloudflare/auth (authenticate)
* - @emdash-cms/cloudflare/sandbox (PluginBridge, createSandboxRunner)
* - @emdash-cms/cloudflare/auth (authenticate)
*
* @example
* ```ts
* import emdash from "emdash/astro";
* import { d1, r2, access, sandbox } from "@emdashcms/cloudflare";
* import { d1, r2, access, sandbox } from "@emdash-cms/cloudflare";
*
* export default defineConfig({
* integrations: [
@@ -160,7 +160,7 @@ export interface AccessConfig {
*/
export function d1(config: D1Config): DatabaseDescriptor {
return {
entrypoint: "@emdashcms/cloudflare/db/d1",
entrypoint: "@emdash-cms/cloudflare/db/d1",
config,
type: "sqlite",
};
@@ -183,7 +183,7 @@ export type { PreviewDOConfig } from "./db/do-types.js";
*/
export function previewDatabase(config: PreviewDOConfig): DatabaseDescriptor {
return {
entrypoint: "@emdashcms/cloudflare/db/do",
entrypoint: "@emdash-cms/cloudflare/db/do",
config,
type: "sqlite",
};
@@ -205,7 +205,7 @@ export function previewDatabase(config: PreviewDOConfig): DatabaseDescriptor {
*/
export function playgroundDatabase(config: PreviewDOConfig): DatabaseDescriptor {
return {
entrypoint: "@emdashcms/cloudflare/db/playground",
entrypoint: "@emdash-cms/cloudflare/db/playground",
config,
type: "sqlite",
};
@@ -231,7 +231,7 @@ export function playgroundDatabase(config: PreviewDOConfig): DatabaseDescriptor
*/
export function r2(config: R2StorageConfig): StorageDescriptor {
return {
entrypoint: "@emdashcms/cloudflare/storage/r2",
entrypoint: "@emdash-cms/cloudflare/storage/r2",
config: { binding: config.binding, publicUrl: config.publicUrl },
};
}
@@ -257,7 +257,7 @@ export function r2(config: R2StorageConfig): StorageDescriptor {
export function access(config: AccessConfig): AuthDescriptor {
return {
type: "cloudflare-access",
entrypoint: "@emdashcms/cloudflare/auth",
entrypoint: "@emdash-cms/cloudflare/auth",
config,
};
}
@@ -274,7 +274,7 @@ export function access(config: AccessConfig): AuthDescriptor {
* ```
*/
export function sandbox(): string {
return "@emdashcms/cloudflare/sandbox";
return "@emdash-cms/cloudflare/sandbox";
}
// Re-export media providers (config-time)

View File

@@ -79,7 +79,7 @@ const IMAGES_ICON = `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http:/
*
* @example
* ```ts
* import { cloudflareImages } from "@emdashcms/cloudflare";
* import { cloudflareImages } from "@emdash-cms/cloudflare";
*
* emdash({
* mediaProviders: [
@@ -102,7 +102,7 @@ export function cloudflareImages(
id: "cloudflare-images",
name: "Cloudflare Images",
icon: IMAGES_ICON,
entrypoint: "@emdashcms/cloudflare/media/images-runtime",
entrypoint: "@emdash-cms/cloudflare/media/images-runtime",
capabilities: {
browse: true,
search: false, // Images API doesn't support search

View File

@@ -83,7 +83,7 @@ const STREAM_ICON = `data:image/svg+xml,${encodeURIComponent('<svg xmlns="http:/
*
* @example
* ```ts
* import { cloudflareStream } from "@emdashcms/cloudflare";
* import { cloudflareStream } from "@emdash-cms/cloudflare";
*
* emdash({
* mediaProviders: [
@@ -106,7 +106,7 @@ export function cloudflareStream(
id: "cloudflare-stream",
name: "Cloudflare Stream",
icon: STREAM_ICON,
entrypoint: "@emdashcms/cloudflare/media/stream-runtime",
entrypoint: "@emdash-cms/cloudflare/media/stream-runtime",
capabilities: {
browse: true,
search: true,

View File

@@ -14,7 +14,7 @@
* ```typescript
* // astro.config.mjs
* import emdash from "emdash/astro";
* import { vectorizeSearch } from "@emdashcms/cloudflare/plugins";
* import { vectorizeSearch } from "@emdash-cms/cloudflare/plugins";
*
* export default defineConfig({
* integrations: [

View File

@@ -4,7 +4,7 @@
* This module is loaded at runtime when plugins need to be sandboxed.
* It imports cloudflare:workers and should NOT be imported at config time.
*
* For config-time usage, import { sandbox } from "@emdashcms/cloudflare" instead.
* For config-time usage, import { sandbox } from "@emdash-cms/cloudflare" instead.
*
*/

View File

@@ -7,7 +7,7 @@
*
* This module imports directly from cloudflare:workers to access
* the LOADER binding and PluginBridge export. It's only loaded
* when the user configures `sandboxRunner: "@emdashcms/cloudflare/sandbox"`.
* when the user configures `sandboxRunner: "@emdash-cms/cloudflare/sandbox"`.
*
*/

View File

@@ -39,7 +39,7 @@ export function generatePluginWrapper(manifest: PluginManifest, options?: Wrappe
return `
// =============================================================================
// Sandboxed Plugin Wrapper
// Generated by @emdashcms/cloudflare
// Generated by @emdash-cms/cloudflare
// Plugin: ${sanitizeComment(manifest.id)}@${sanitizeComment(manifest.version)}
// =============================================================================

View File

@@ -5,7 +5,7 @@
* This avoids the AWS SDK overhead and works with the native R2 API.
*
* This module imports directly from cloudflare:workers to access R2 bindings.
* Do NOT import this at config time - use { r2 } from "@emdashcms/cloudflare" instead.
* Do NOT import this at config time - use { r2 } from "@emdash-cms/cloudflare" instead.
*
* For Astro 6 / Cloudflare adapter v13+:
* - Bindings are accessed via `import { env } from 'cloudflare:workers'`

View File

@@ -6,7 +6,7 @@ describe("previewDatabase()", () => {
it("returns a sqlite DatabaseDescriptor with the DO entrypoint", () => {
const result = previewDatabase({ binding: "PREVIEW_DB" });
expect(result).toEqual({
entrypoint: "@emdashcms/cloudflare/db/do",
entrypoint: "@emdash-cms/cloudflare/db/do",
config: { binding: "PREVIEW_DB" },
type: "sqlite",
});
@@ -22,7 +22,7 @@ describe("playgroundDatabase()", () => {
it("returns a sqlite DatabaseDescriptor with the playground entrypoint", () => {
const result = playgroundDatabase({ binding: "PLAYGROUND_DB" });
expect(result).toEqual({
entrypoint: "@emdashcms/cloudflare/db/playground",
entrypoint: "@emdash-cms/cloudflare/db/playground",
config: { binding: "PLAYGROUND_DB" },
type: "sqlite",
});