@sealpixel/astro 1.0.0-rc.12 → 1.0.0-rc.13

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # @sealpixel/astro
2
2
 
3
- `astro add @sealpixel/astro`, then `<SealpixelEditor src="/photo.jpg" />` from `@sealpixel/astro/SealpixelEditor.astro`, or use the React, Vue or Svelte bindings inside an island. `sealpixel({ renderRoute: true })` injects `/api/sealpixel/render` (needs an SSR adapter).
3
+ `astro add @sealpixel/astro`, then `<SealpixelEditor src="/photo.jpg" />` from `@sealpixel/astro/SealpixelEditor.astro`, or use the React, Vue or Svelte bindings inside an island.
package/dist/index.d.ts CHANGED
@@ -1,24 +1,8 @@
1
1
  import type { AstroIntegration } from 'astro';
2
- export interface SealpixelAstroOptions {
3
- /**
4
- * Inject `POST /api/sealpixel/render` backed by `@sealpixel/server` with the
5
- * first-party plugins and inline sources. Requires an SSR adapter.
6
- *
7
- * The object form sets the route `path`, the handler's `cors` and
8
- * `limits.maxMegapixels`. Without `cors` the handler's own default applies:
9
- * no CORS headers, so only the same origin can call the route. Without
10
- * `maxMegapixels` the route reads `SEALPIXEL_MAX_MEGAPIXELS`, then uses 40.
11
- */
12
- renderRoute?: boolean | {
13
- path?: string;
14
- cors?: string[] | '*';
15
- maxMegapixels?: number;
16
- };
17
- }
18
2
  /**
19
3
  * `astro add @sealpixel/astro`. Keeps the Sealpixel packages out of Vite's
20
4
  * dependency pre-bundling so `new URL(..., import.meta.url)` for the wasm and
21
- * the worker keep working, and optionally injects the render endpoint.
5
+ * the worker keep working.
22
6
  */
23
- export default function sealpixel(options?: SealpixelAstroOptions): AstroIntegration;
7
+ export default function sealpixel(): AstroIntegration;
24
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAK9C,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1F;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,OAAO,GAAE,qBAA0B,GAAG,gBAAgB,CA8CvF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,IAAI,gBAAgB,CAyBpD"}
package/dist/index.js CHANGED
@@ -1,21 +1,13 @@
1
- /** Carries the object form of `renderRoute` into the injected route. */
2
- const ROUTE_CONFIG_ID = 'virtual:sealpixel/render-route-config';
3
1
  /**
4
2
  * `astro add @sealpixel/astro`. Keeps the Sealpixel packages out of Vite's
5
3
  * dependency pre-bundling so `new URL(..., import.meta.url)` for the wasm and
6
- * the worker keep working, and optionally injects the render endpoint.
4
+ * the worker keep working.
7
5
  */
8
- export default function sealpixel(options = {}) {
6
+ export default function sealpixel() {
9
7
  return {
10
8
  name: '@sealpixel/astro',
11
9
  hooks: {
12
- 'astro:config:setup': ({ updateConfig, injectRoute }) => {
13
- const route = typeof options.renderRoute === 'object' ? options.renderRoute : {};
14
- const routeConfig = {
15
- ...(route.cors === undefined ? {} : { cors: route.cors }),
16
- ...(route.maxMegapixels === undefined ? {} : { maxMegapixels: route.maxMegapixels }),
17
- };
18
- const resolvedId = `\0${ROUTE_CONFIG_ID}`;
10
+ 'astro:config:setup': ({ updateConfig }) => {
19
11
  updateConfig({
20
12
  vite: {
21
13
  optimizeDeps: {
@@ -31,22 +23,8 @@ export default function sealpixel(options = {}) {
31
23
  ],
32
24
  },
33
25
  worker: { format: 'es' },
34
- plugins: [
35
- {
36
- name: '@sealpixel/astro:render-route-config',
37
- resolveId: (id) => (id === ROUTE_CONFIG_ID ? resolvedId : undefined),
38
- load: (id) => id === resolvedId ? `export default ${JSON.stringify(routeConfig)};` : undefined,
39
- },
40
- ],
41
26
  },
42
27
  });
43
- if (options.renderRoute) {
44
- injectRoute({
45
- pattern: route.path ?? '/api/sealpixel/render',
46
- entrypoint: '@sealpixel/astro/render-route',
47
- prerender: false,
48
- });
49
- }
50
28
  },
51
29
  },
52
30
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,MAAM,eAAe,GAAG,uCAAuC,CAAC;AAehE;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,UAAiC,EAAE;IACnE,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE;YACL,oBAAoB,EAAE,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,EAAE;gBACtD,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjF,MAAM,WAAW,GAAG;oBAClB,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;oBACzD,GAAG,CAAC,KAAK,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;iBACrF,CAAC;gBACF,MAAM,UAAU,GAAG,KAAK,eAAe,EAAE,CAAC;gBAC1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pB,oBAAoB;gCACpB,kBAAkB;gCAClB,gBAAgB;gCAChB,mBAAmB;6BACpB;yBACF;wBACD,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;qBACzB;iBACF,CAAC,CAAC;YACL,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sealpixel/astro",
3
- "version": "1.0.0-rc.12",
4
- "description": "Astro integration for the Sealpixel image editor: Vite config for the wasm and worker, a <SealpixelEditor /> component, and an optional /api/sealpixel/render endpoint.",
3
+ "version": "1.0.0-rc.13",
4
+ "description": "Astro integration for the Sealpixel image editor: Vite config for the wasm and worker, and a <SealpixelEditor /> component.",
5
5
  "license": "BUSL-1.1",
6
6
  "repository": {
7
7
  "type": "git",
@@ -23,19 +23,14 @@
23
23
  "default": "./dist/index.js"
24
24
  },
25
25
  "./SealpixelEditor.astro": "./src/components/SealpixelEditor.astro",
26
- "./render-route": {
27
- "types": "./dist/render-route.d.ts",
28
- "default": "./dist/render-route.js"
29
- },
30
26
  "./package.json": "./package.json"
31
27
  },
32
28
  "dependencies": {
33
- "@sealpixel/core": "1.0.0-rc.12",
34
- "@sealpixel/element": "1.0.0-rc.12",
35
- "@sealpixel/plugins": "1.0.0-rc.12",
36
- "@sealpixel/server": "1.0.0-rc.12",
37
- "@sealpixel/ui": "1.0.0-rc.12",
38
- "@sealpixel/wasm": "1.0.0-rc.12"
29
+ "@sealpixel/core": "1.0.0-rc.13",
30
+ "@sealpixel/element": "1.0.0-rc.13",
31
+ "@sealpixel/plugins": "1.0.0-rc.13",
32
+ "@sealpixel/ui": "1.0.0-rc.13",
33
+ "@sealpixel/wasm": "1.0.0-rc.13"
39
34
  },
40
35
  "peerDependencies": {
41
36
  "astro": ">=5.0.0"
@@ -51,6 +46,6 @@
51
46
  "scripts": {
52
47
  "build": "tsc -p tsconfig.build.json",
53
48
  "typecheck": "tsc -p tsconfig.json --noEmit",
54
- "test": "vitest run && node --test test/*.node.test.mjs"
49
+ "test": "vitest run"
55
50
  }
56
51
  }
@@ -1,14 +1,13 @@
1
1
  ---
2
2
  /**
3
3
  * Client-only editor. Props that are plain data (`src` url, `theme`, `locale`,
4
- * `serverEndpoint`, `editLog`) travel as attributes; complex options belong in
5
- * an island using @sealpixel/react, @sealpixel/vue or @sealpixel/svelte.
4
+ * `editLog`) travel as attributes; complex options belong in an island using
5
+ * @sealpixel/react, @sealpixel/vue or @sealpixel/svelte.
6
6
  */
7
7
  interface Props {
8
8
  src?: string;
9
9
  theme?: 'dark' | 'light' | 'auto';
10
10
  locale?: string;
11
- serverEndpoint?: string;
12
11
  editLog?: unknown;
13
12
  /** `{ pluginId: partialOptions }`, serialised into the `plugin-options` attribute. */
14
13
  pluginOptions?: Record<string, unknown>;
@@ -23,7 +22,6 @@ const {
23
22
  src,
24
23
  theme = 'dark',
25
24
  locale = 'en',
26
- serverEndpoint,
27
25
  editLog,
28
26
  pluginOptions,
29
27
  showExport,
@@ -43,7 +41,6 @@ const id = `sealpixel-${Math.random().toString(36).slice(2, 10)}`;
43
41
  style={style}
44
42
  data-src={src}
45
43
  data-locale={locale}
46
- data-server-endpoint={serverEndpoint}
47
44
  data-edit-log={editLog === undefined ? undefined : JSON.stringify(editLog)}
48
45
  plugin-options={pluginOptions === undefined ? undefined : JSON.stringify(pluginOptions)}
49
46
  show-export={showExport}
@@ -7,7 +7,6 @@
7
7
  type EditorElement = HTMLElement & {
8
8
  src: unknown;
9
9
  locale: string;
10
- serverEndpoint: string | null;
11
10
  defaultEditLog: unknown;
12
11
  };
13
12
 
@@ -19,8 +18,6 @@ function hydrateEditors(): void {
19
18
  if (el.hasAttribute('data-hydrated')) continue;
20
19
  el.setAttribute('data-hydrated', '1');
21
20
  el.locale = el.getAttribute('data-locale') ?? 'en';
22
- const serverEndpoint = el.getAttribute('data-server-endpoint');
23
- if (serverEndpoint) el.serverEndpoint = serverEndpoint;
24
21
  const editLog = el.getAttribute('data-edit-log');
25
22
  if (editLog) el.defaultEditLog = JSON.parse(editLog);
26
23
  const src = el.getAttribute('data-src');
@@ -1,16 +0,0 @@
1
- /**
2
- * Astro API route running `@sealpixel/server` in the SSR runtime (Node, Deno,
3
- * Bun, Cloudflare via the fetch handler). Inline sources only; hosts wanting
4
- * S3 sources write their own route with `createSealpixelHandler`.
5
- */
6
- export declare const prerender = false;
7
- export declare function POST({ request }: {
8
- request: Request;
9
- }): Promise<Response>;
10
- export declare function GET({ request }: {
11
- request: Request;
12
- }): Promise<Response>;
13
- export declare function OPTIONS({ request }: {
14
- request: Request;
15
- }): Promise<Response>;
16
- //# sourceMappingURL=render-route.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-route.d.ts","sourceRoot":"","sources":["../src/render-route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,eAAO,MAAM,SAAS,QAAQ,CAAC;AAE/B,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEzE;AAED,wBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAExE;AAED,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE5E"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Astro API route running `@sealpixel/server` in the SSR runtime (Node, Deno,
3
- * Bun, Cloudflare via the fetch handler). Inline sources only; hosts wanting
4
- * S3 sources write their own route with `createSealpixelHandler`.
5
- */
6
- import config from 'virtual:sealpixel/render-route-config';
7
- import { defaultPlugins } from '@sealpixel/plugins';
8
- import { createSealpixelHandler, inlineSource } from '@sealpixel/server';
9
- const handler = createSealpixelHandler({
10
- plugins: defaultPlugins,
11
- sources: [inlineSource()],
12
- ...(config.cors === undefined ? {} : { cors: config.cors }),
13
- limits: {
14
- maxMegapixels: config.maxMegapixels ?? Number(process.env['SEALPIXEL_MAX_MEGAPIXELS'] ?? 40),
15
- },
16
- });
17
- export const prerender = false;
18
- export function POST({ request }) {
19
- return handler(request);
20
- }
21
- export function GET({ request }) {
22
- return handler(request);
23
- }
24
- export function OPTIONS({ request }) {
25
- return handler(request);
26
- }
27
- //# sourceMappingURL=render-route.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-route.js","sourceRoot":"","sources":["../src/render-route.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,uCAAuC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEzE,MAAM,OAAO,GAAG,sBAAsB,CAAC;IACrC,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,CAAC,YAAY,EAAE,CAAC;IACzB,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3D,MAAM,EAAE;QACN,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC;KAC7F;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAE/B,MAAM,UAAU,IAAI,CAAC,EAAE,OAAO,EAAwB;IACpD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAAwB;IACnD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAE,OAAO,EAAwB;IACvD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}