emdash-plugin-r2-variants 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +14 -0
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/plugin.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# emdash-plugin-r2-variants
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- Docs only, no code changes. The README now lists the declared capability
|
|
6
|
+
(`media:read`) and explains the native trust boundary, as EmDash's guide to
|
|
7
|
+
distributing native plugins asks.
|
|
8
|
+
|
|
3
9
|
## 0.1.0
|
|
4
10
|
|
|
5
11
|
- First release: `Image` component, Portable Text `image` block, dark-mode
|
|
@@ -10,3 +16,5 @@
|
|
|
10
16
|
points and colours from content, skip originals over 25 MB, validate options.
|
|
11
17
|
- Uses EmDash's exported helpers and constants instead of copies. Removed the
|
|
12
18
|
`prefix` option.
|
|
19
|
+
- Capabilities: declares `media:read`, which EmDash requires for the
|
|
20
|
+
`media:afterUpload` hook that schedules cleanup. No allowed hosts.
|
package/README.md
CHANGED
|
@@ -153,6 +153,20 @@ import { Image } from "emdash-plugin-r2-variants/astro";
|
|
|
153
153
|
3. Add a cron trigger to `wrangler.jsonc` so EmDash's scheduled handler runs plugin
|
|
154
154
|
jobs, for example `"triggers": { "crons": ["* * * * *"] }`.
|
|
155
155
|
|
|
156
|
+
## Capabilities
|
|
157
|
+
|
|
158
|
+
| Capability | Used by |
|
|
159
|
+
| ------------ | ----------------------------------------------------------------------------------------- |
|
|
160
|
+
| `media:read` | The `media:afterUpload` hook, which schedules the daily cleanup job. EmDash requires this capability for that hook. |
|
|
161
|
+
|
|
162
|
+
The plugin declares no allowed hosts and makes no network requests.
|
|
163
|
+
|
|
164
|
+
Capabilities gate only the `ctx` APIs that EmDash passes to the plugin. As a
|
|
165
|
+
native plugin, this code also has access to everything the site's Worker has,
|
|
166
|
+
including all bindings and environment variables. That access is why the
|
|
167
|
+
plugin can read and write R2 directly. Review it as you would the site's own
|
|
168
|
+
code.
|
|
169
|
+
|
|
156
170
|
## Security
|
|
157
171
|
|
|
158
172
|
- Storage keys are read from content, so the plugin accepts only keys that
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export function r2Variants(options = {}) {
|
|
|
12
12
|
validate(options);
|
|
13
13
|
return {
|
|
14
14
|
id: "r2-variants",
|
|
15
|
-
version: "0.1.
|
|
15
|
+
version: "0.1.1",
|
|
16
16
|
format: "native",
|
|
17
17
|
entrypoint: "emdash-plugin-r2-variants/plugin",
|
|
18
18
|
componentsEntry: "emdash-plugin-r2-variants/astro",
|
package/src/plugin.js
CHANGED
|
@@ -16,7 +16,7 @@ export function createPlugin(options = {}) {
|
|
|
16
16
|
configure(options);
|
|
17
17
|
return definePlugin({
|
|
18
18
|
id: "r2-variants",
|
|
19
|
-
version: "0.1.
|
|
19
|
+
version: "0.1.1",
|
|
20
20
|
// media:read is what EmDash requires for media:afterUpload.
|
|
21
21
|
capabilities: ["media:read"],
|
|
22
22
|
hooks: {
|