@aeptus/aexeo-emdash 0.8.7 → 0.8.8

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 CHANGED
@@ -6,6 +6,51 @@ and the project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.8] - 2026-05-04
10
+
11
+ ### Fixed
12
+
13
+ - **Astro dev mode no longer 500s on every request.** v0.8.7's
14
+ configured runtime relied on a synchronous default `.wasm`
15
+ import that Cloudflare Workers resolved to a
16
+ `WebAssembly.Module`, but Node ESM (Astro 6.1.3 + Vite 7.3.1
17
+ SSR runner) rejected at parse time with
18
+ `SyntaxError: The requested module ... does not provide an
19
+ export named 'default'`. The static import is gone; the plugin
20
+ now uses a dual-path runtime loader:
21
+ - Path A (Cloudflare Workers): dynamic `import()` of the
22
+ `.wasm` resolves to `{ default: WebAssembly.Module }` via
23
+ Wrangler's bundler integration; we use it synchronously.
24
+ - Path B (Node / Astro dev / Vite SSR): when Path A throws or
25
+ yields something that isn't a Module, fall back to
26
+ `node:fs/promises` `readFile` + `WebAssembly.compile`.
27
+ - Path C (browser-like edges): `fetch` + `compileStreaming` as
28
+ a last resort.
29
+
30
+ Production deploys to Cloudflare were unaffected by the v0.8.7
31
+ bug — only `pnpm dev` / `astro dev` workflows hit it. The fix
32
+ preserves the synchronous-Module path on Workers (Path A) so
33
+ there's no production regression.
34
+
35
+ ### Changed
36
+
37
+ - **`vite-plugin-wasm` is no longer required.** With the dual-path
38
+ loader, Vite hosts can drop `vite-plugin-wasm` from dev deps and
39
+ `plugins: [wasm()]` from `vite.plugins`. INSTALL.md updated. The
40
+ plugins remain harmless if left in place — backwards-compatible.
41
+ - **`optimizeDeps: { exclude: ["@aeptus/aexeo-emdash"] }`** is
42
+ still recommended (avoids Vite optimizer churn on dev start) but
43
+ no longer load-bearing.
44
+
45
+ ### Notes for hosts upgrading from 0.8.7
46
+
47
+ - No code changes required for the fix to take effect; just bump
48
+ the package version. Astro dev should work on the next
49
+ `pnpm dev` / `astro dev` run.
50
+ - If you want to clean up after the upgrade: `pnpm remove
51
+ vite-plugin-wasm` and remove `plugins: [wasm()]` + the
52
+ `wasm()` import from `astro.config.mjs`.
53
+
9
54
  ## [0.8.7] - 2026-05-04
10
55
 
11
56
  Picks up upstream aexeo-core 0.0.13 — three quality fixes from
@@ -822,7 +867,8 @@ First public release.
822
867
  `astro.config.mjs` for the WASM import to resolve to a
823
868
  precompiled `WebAssembly.Module`. Not optional.
824
869
 
825
- [Unreleased]: https://github.com/schiste/Aexeo/compare/aexeo-emdash-v0.8.7...HEAD
870
+ [Unreleased]: https://github.com/schiste/Aexeo/compare/aexeo-emdash-v0.8.8...HEAD
871
+ [0.8.8]: https://github.com/schiste/Aexeo/compare/aexeo-emdash-v0.8.7...aexeo-emdash-v0.8.8
826
872
  [0.8.7]: https://github.com/schiste/Aexeo/compare/aexeo-emdash-v0.8.6...aexeo-emdash-v0.8.7
827
873
  [0.8.6]: https://github.com/schiste/Aexeo/compare/aexeo-emdash-v0.8.5...aexeo-emdash-v0.8.6
828
874
  [0.8.5]: https://github.com/schiste/Aexeo/compare/aexeo-emdash-v0.8.4...aexeo-emdash-v0.8.5
package/INSTALL.md CHANGED
@@ -36,14 +36,16 @@ when it's actually needed.
36
36
  ### Install
37
37
 
38
38
  ```bash
39
- npm install @aeptus/aexeo-emdash vite-plugin-wasm
39
+ npm install @aeptus/aexeo-emdash
40
40
  ```
41
41
 
42
- `vite-plugin-wasm` is required because Vite's defaults treat `.wasm`
43
- imports as static-asset URLs, but Cloudflare Workers can only run
44
- WASM as precompiled `WebAssembly.Module` instances. The plugin
45
- bridges the two; without it, the Aexeo plugin's first call throws
46
- "WASM module did not resolve to a WebAssembly.Module."
42
+ Starting in v0.8.8 the plugin loads its WASM internally with a
43
+ dual-path runtime that tries the bundler-resolved import first
44
+ (Cloudflare Workers) and falls back to `node:fs/promises` +
45
+ `WebAssembly.compile` (Astro dev / Node ESM / Vite SSR runner).
46
+ Earlier versions required `vite-plugin-wasm` because the plugin's
47
+ single static `.wasm` import broke Astro dev mode with a
48
+ SyntaxError; that's no longer needed.
47
49
 
48
50
  > **If installing from a private git remote or as a vendored
49
51
  > directory** — see the "Alternative install sources" section at the
@@ -57,19 +59,15 @@ import { d1, r2 } from "@emdash-cms/cloudflare";
57
59
  import { aexeoPlugin } from "@aeptus/aexeo-emdash";
58
60
  import { defineConfig } from "astro/config";
59
61
  import emdash from "emdash/astro";
60
- import wasm from "vite-plugin-wasm";
61
62
 
62
63
  export default defineConfig({
63
64
  output: "server",
64
65
  adapter: cloudflare(),
65
66
  vite: {
66
- // Required: makes `import x from "./foo.wasm"` resolve to a
67
- // precompiled WebAssembly.Module. Cloudflare Workers /
68
- // workerd disallow runtime WebAssembly.instantiate from raw
69
- // bytes, so the bundler has to do the compilation.
70
- plugins: [wasm()],
71
- // The Aexeo plugin's WASM import confuses Vite's dep
72
- // optimizer when it tries to pre-bundle the package.
67
+ // Recommended: prevents Vite's dep optimizer from trying to
68
+ // pre-bundle the package, which churns on every dev start.
69
+ // The plugin itself works without this — but the optimizer
70
+ // chatter is annoying.
73
71
  optimizeDeps: { exclude: ["@aeptus/aexeo-emdash"] },
74
72
  },
75
73
  integrations: [
@@ -82,6 +80,12 @@ export default defineConfig({
82
80
  });
83
81
  ```
84
82
 
83
+ > **Upgrading from 0.8.7 or earlier?** You can drop `vite-plugin-wasm`
84
+ > from your dev dependencies and `plugins: [wasm()]` from the Vite
85
+ > config; the new dual-path loader handles both runtimes internally.
86
+ > Leaving them in place is harmless if you'd rather not touch the
87
+ > config right away.
88
+
85
89
  That's it for code. No environment variables, no secrets to manage,
86
90
  no sidecar to deploy.
87
91
 
@@ -423,17 +423,40 @@ function __wbg_set_wasm(val) {
423
423
  }
424
424
 
425
425
  // src/wasm-init.ts
426
- import bridgeModule from "../wasm/aexeo_emdash_bridge_bg.wasm";
426
+ var WASM_SPECIFIER = "../wasm/aexeo_emdash_bridge_bg.wasm";
427
427
  var initialized = false;
428
- function ensureInitialized() {
428
+ var cachedModule = null;
429
+ async function loadBridgeModule() {
430
+ if (cachedModule !== null) {
431
+ return cachedModule;
432
+ }
433
+ try {
434
+ const mod = await import(WASM_SPECIFIER);
435
+ if (mod.default instanceof WebAssembly.Module) {
436
+ cachedModule = mod.default;
437
+ return cachedModule;
438
+ }
439
+ } catch {
440
+ }
441
+ const wasmUrl = new URL(WASM_SPECIFIER, import.meta.url);
442
+ if (wasmUrl.protocol === "file:") {
443
+ const [{ readFile }, { fileURLToPath }] = await Promise.all([
444
+ import("node:fs/promises"),
445
+ import("node:url")
446
+ ]);
447
+ const bytes = await readFile(fileURLToPath(wasmUrl));
448
+ cachedModule = await WebAssembly.compile(bytes);
449
+ return cachedModule;
450
+ }
451
+ const response = await fetch(wasmUrl);
452
+ cachedModule = await WebAssembly.compileStreaming(response);
453
+ return cachedModule;
454
+ }
455
+ async function ensureInitialized() {
429
456
  if (initialized) {
430
457
  return;
431
458
  }
432
- if (!(bridgeModule instanceof WebAssembly.Module)) {
433
- throw new Error(
434
- "aexeo: WASM module did not resolve to a WebAssembly.Module \u2014 the consumer's bundler isn't configured for .wasm imports. Add the .wasm loader to your Vite/wrangler config; see @aeptus/aexeo-emdash INSTALL.md for the recipe."
435
- );
436
- }
459
+ const bridgeModule = await loadBridgeModule();
437
460
  const instance = new WebAssembly.Instance(bridgeModule, {
438
461
  "./aexeo_emdash_bridge_bg.js": aexeo_emdash_bridge_bg_exports
439
462
  });
@@ -442,19 +465,19 @@ function ensureInitialized() {
442
465
  initialized = true;
443
466
  }
444
467
  async function evaluateDocuments2(documentsJson, configJson) {
445
- ensureInitialized();
468
+ await ensureInitialized();
446
469
  return evaluateDocuments(documentsJson, configJson);
447
470
  }
448
471
  async function scoreIntelligence2(documentsJson, manifestJson) {
449
- ensureInitialized();
472
+ await ensureInitialized();
450
473
  return scoreIntelligence(documentsJson, manifestJson ?? void 0);
451
474
  }
452
475
  async function generateFactsPrompt2(documentsJson) {
453
- ensureInitialized();
476
+ await ensureInitialized();
454
477
  return generateFactsPrompt(documentsJson);
455
478
  }
456
479
  async function validateFactsManifest2(manifestJson, documentsJson) {
457
- ensureInitialized();
480
+ await ensureInitialized();
458
481
  return validateFactsManifest(manifestJson, documentsJson);
459
482
  }
460
483
 
@@ -1160,7 +1183,7 @@ function globToMatcher(pattern) {
1160
1183
  }
1161
1184
 
1162
1185
  // src/version.ts
1163
- var PACKAGE_VERSION = "0.8.7";
1186
+ var PACKAGE_VERSION = "0.8.8";
1164
1187
 
1165
1188
  // src/configured.ts
1166
1189
  import { definePlugin } from "emdash";
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ function buildAllowedHosts(evaluatorHost) {
23
23
  }
24
24
 
25
25
  // src/version.ts
26
- var PACKAGE_VERSION = "0.8.7";
26
+ var PACKAGE_VERSION = "0.8.8";
27
27
 
28
28
  // src/sandbox.ts
29
29
  function aexeoPluginSandboxed(options = {}) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PACKAGE_VERSION = "0.8.7";
1
+ export declare const PACKAGE_VERSION = "0.8.8";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-init.d.ts","sourceRoot":"","sources":["../src/wasm-init.ts"],"names":[],"mappings":"AAmDA,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAID,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAGjB;AAKD,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAGjB"}
1
+ {"version":3,"file":"wasm-init.d.ts","sourceRoot":"","sources":["../src/wasm-init.ts"],"names":[],"mappings":"AA0GA,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAID,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAGjB;AAKD,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAGjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeptus/aexeo-emdash",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "description": "Aexeo SEO/GEO content evaluator as an emdash plugin",
5
5
  "license": "MIT",
6
6
  "author": "Aeptus",