Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
4 changes: 2 additions & 2 deletions blog-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"dependencies": {
"@astrojs/cloudflare": "^14.0.0",
"@astrojs/react": "^6.0.0",
"@emdash-cms/cloudflare": "^0.35.0",
"@emdash-cms/cloudflare": "^0.36.0",
"@emdash-cms/plugin-forms": "^0.2.5",
"@emdash-cms/plugin-webhook-notifier": "^0.2.0",
"astro": "^7.0.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion blog-cloudflare/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
allowBuilds:
esbuild: true
workerd: true
better-sqlite3: false
sharp: false

# Supply-chain hardening: cooldown on brand-new releases (EmDash exempt)
Expand Down
2 changes: 1 addition & 1 deletion blog-cloudflare/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export { PluginBridge };
export default {
...handler,
scheduled: createScheduledHandler(),
};
} satisfies ExportedHandler;
2 changes: 1 addition & 1 deletion blog-cloudflare/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"types": ["node"]
},
"include": ["src", ".astro/types.d.ts", "emdash-env.d.ts"]
"include": ["src", ".astro/types.d.ts", "emdash-env.d.ts", "worker-configuration.d.ts"]
}
4 changes: 2 additions & 2 deletions blog-cloudflare/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"binding": "LOADER",
},
],
// General maintenance plus the bounded Media Usage lane (see src/worker.ts)
// General maintenance cron trigger
"triggers": {
"crons": ["* * * * *", "*/2 * * * *"],
"crons": ["* * * * *"],
},
}
8 changes: 2 additions & 6 deletions blog/.agents/skills/creating-plugins/references/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
3 changes: 1 addition & 2 deletions blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"@astrojs/react": "^6.0.0",
"@emdash-cms/plugin-audit-log": "^0.2.0",
"astro": "^7.0.0",
"better-sqlite3": "^12.8.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion blog/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# strictDepBuilds (pnpm >=10.26 / 11) passes.
allowBuilds:
esbuild: true
better-sqlite3: true
sharp: true
workerd: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
4 changes: 2 additions & 2 deletions marketing-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"dependencies": {
"@astrojs/cloudflare": "^14.0.0",
"@astrojs/react": "^6.0.0",
"@emdash-cms/cloudflare": "^0.35.0",
"@emdash-cms/cloudflare": "^0.36.0",
"@iconify-json/ph": "^1.2.2",
"astro": "^7.0.0",
"astro-iconset": "^0.0.4",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion marketing-cloudflare/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
allowBuilds:
esbuild: true
workerd: true
better-sqlite3: false
sharp: false

# Supply-chain hardening: cooldown on brand-new releases (EmDash exempt)
Expand Down
2 changes: 1 addition & 1 deletion marketing-cloudflare/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export { PluginBridge };
export default {
...handler,
scheduled: createScheduledHandler(),
};
} satisfies ExportedHandler;
4 changes: 2 additions & 2 deletions marketing-cloudflare/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"binding": "LOADER",
},
],
// General maintenance plus the bounded Media Usage lane (see src/worker.ts)
// General maintenance cron trigger
"triggers": {
"crons": ["* * * * *", "*/2 * * * *"],
"crons": ["* * * * *"],
},
}
8 changes: 2 additions & 6 deletions marketing/.agents/skills/creating-plugins/references/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
3 changes: 1 addition & 2 deletions marketing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"@iconify-json/ph": "^1.2.2",
"astro": "^7.0.0",
"astro-iconset": "^0.0.4",
"better-sqlite3": "^12.8.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion marketing/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# strictDepBuilds (pnpm >=10.26 / 11) passes.
allowBuilds:
esbuild: true
better-sqlite3: true
sharp: true
workerd: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
4 changes: 2 additions & 2 deletions portfolio-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"dependencies": {
"@astrojs/cloudflare": "^14.0.0",
"@astrojs/react": "^6.0.0",
"@emdash-cms/cloudflare": "^0.35.0",
"@emdash-cms/cloudflare": "^0.36.0",
"astro": "^7.0.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion portfolio-cloudflare/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
allowBuilds:
esbuild: true
workerd: true
better-sqlite3: false
sharp: false

# Supply-chain hardening: cooldown on brand-new releases (EmDash exempt)
Expand Down
2 changes: 1 addition & 1 deletion portfolio-cloudflare/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export { PluginBridge };
export default {
...handler,
scheduled: createScheduledHandler(),
};
} satisfies ExportedHandler;
4 changes: 2 additions & 2 deletions portfolio-cloudflare/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"binding": "LOADER",
},
],
// General maintenance plus the bounded Media Usage lane (see src/worker.ts)
// General maintenance cron trigger
"triggers": {
"crons": ["* * * * *", "*/2 * * * *"],
"crons": ["* * * * *"],
},
}
8 changes: 2 additions & 6 deletions portfolio/.agents/skills/creating-plugins/references/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
3 changes: 1 addition & 2 deletions portfolio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"@astrojs/node": "^11.0.0",
"@astrojs/react": "^6.0.0",
"astro": "^7.0.0",
"better-sqlite3": "^12.8.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion portfolio/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# strictDepBuilds (pnpm >=10.26 / 11) passes.
allowBuilds:
esbuild: true
better-sqlite3: true
sharp: true
workerd: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
4 changes: 2 additions & 2 deletions starter-cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"dependencies": {
"@astrojs/cloudflare": "^14.0.0",
"@astrojs/react": "^6.0.0",
"@emdash-cms/cloudflare": "^0.35.0",
"@emdash-cms/cloudflare": "^0.36.0",
"astro": "^7.0.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion starter-cloudflare/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
allowBuilds:
esbuild: true
workerd: true
better-sqlite3: false
sharp: false

# Supply-chain hardening: cooldown on brand-new releases (EmDash exempt)
Expand Down
2 changes: 1 addition & 1 deletion starter-cloudflare/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export { PluginBridge };
export default {
...handler,
scheduled: createScheduledHandler(),
};
} satisfies ExportedHandler;
2 changes: 1 addition & 1 deletion starter-cloudflare/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"types": ["node"]
},
"include": ["src", ".astro/types.d.ts", "emdash-env.d.ts"]
"include": ["src", ".astro/types.d.ts", "emdash-env.d.ts", "worker-configuration.d.ts"]
}
4 changes: 2 additions & 2 deletions starter-cloudflare/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"binding": "LOADER",
},
],
// General maintenance plus the bounded Media Usage lane (see src/worker.ts)
// General maintenance cron trigger
"triggers": {
"crons": ["* * * * *", "*/2 * * * *"],
"crons": ["* * * * *"],
},
}
8 changes: 2 additions & 6 deletions starter/.agents/skills/creating-plugins/references/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,11 @@ Returns: `void`

### `content:beforeSave`

Runs before save. Return modified content, void to keep unchanged, or throw to cancel.
Runs before save. Return modified content, or void to keep it unchanged. A plugin running in the sandbox cannot cancel a save: the sandbox logs the thrown error and the save continues. From the host process — a native plugin, or a sandboxed plugin moved to `plugins: []` — throw `ContentSaveRejectedError` (exported from `emdash`) to cancel with a message the admin shows to the editor; any other thrown error cancels with a generic message.

```typescript
"content:beforeSave": async (event, ctx) => {
const { content, collection, isNew } = event;

if (collection === "posts" && !content.title) {
throw new Error("Posts require a title");
}
const { content } = event;

// Transform
if (content.slug) {
Expand Down
3 changes: 1 addition & 2 deletions starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"@astrojs/node": "^11.0.0",
"@astrojs/react": "^6.0.0",
"astro": "^7.0.0",
"better-sqlite3": "^12.8.0",
"emdash": "^0.35.0",
"emdash": "^0.36.0",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
1 change: 0 additions & 1 deletion starter/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# strictDepBuilds (pnpm >=10.26 / 11) passes.
allowBuilds:
esbuild: true
better-sqlite3: true
sharp: true
workerd: false

Expand Down
Loading