extract-webpage 1.2.299 → 1.2.301

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.
@@ -0,0 +1,2 @@
1
+ import { default as Prism } from 'prismjs';
2
+ export default Prism;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extract-webpage",
3
- "version": "1.2.299",
3
+ "version": "1.2.301",
4
4
  "module": "./dist/extract-webpage.es.js",
5
5
  "description": "Search, extract, cite, and outline the web for a topic with AI Research Agent.",
6
6
  "author": "vtempest <grokthiscontact@gmail.com>",
@@ -74,11 +74,11 @@
74
74
  "dependencies": {
75
75
  "@huggingface/transformers": "^4.2.0",
76
76
  "ai": "^7.0.94",
77
- "chat-agent-toolkit": "^1.2.304",
77
+ "chat-agent-toolkit": "^1.2.306",
78
78
  "chrono-node": "^2.10.1",
79
79
  "drizzle-orm": "^0.45.2",
80
- "extract-pdf": "^0.1.288",
81
- "extract-youtube": "^1.0.292",
80
+ "extract-pdf": "^0.1.290",
81
+ "extract-youtube": "^1.0.294",
82
82
  "html-entities": "^2.6.0",
83
83
  "js-yaml": "^5.4.1",
84
84
  "jsdom": "^30.0.1",
@@ -139,7 +139,9 @@ export function convertURLToAbsoluteURL(base, relative) {
139
139
  }
140
140
 
141
141
  import { marked } from "marked";
142
- import Prism from "prismjs";
142
+ // Must precede every `prismjs/components/*` import: the grammar scripts read
143
+ // `Prism` off the global object, which this module publishes (see its docs).
144
+ import Prism from "./prism-global";
143
145
  import "prismjs/components/prism-markup.js";
144
146
  import "prismjs/components/prism-css.js";
145
147
  import "prismjs/components/prism-javascript.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module html-to-content/prism-global
3
+ * @description Publishes Prism on `globalThis` so the `prismjs/components/*`
4
+ * grammar scripts can find it.
5
+ *
6
+ * Those grammar files are plain browser scripts, not modules — `prism-markup.js`
7
+ * literally opens with `Prism.languages.markup = {...}`, resolving `Prism` as a
8
+ * free variable off the global object. Prism's core only publishes that global
9
+ * when it can see `window` (browser), a `WorkerGlobalScope` `self`, or Node's
10
+ * `global`. On Cloudflare Workers / edge runtimes none of the three exist, so
11
+ * the first grammar file throws `ReferenceError: Prism is not defined` while the
12
+ * module graph is still evaluating, taking the whole SSR render down with it.
13
+ *
14
+ * Import this module *before* any `prismjs/components/*` import. ES modules are
15
+ * evaluated in import order, so this file's body runs — and the global lands —
16
+ * before the grammars reference it.
17
+ */
18
+ import Prism from "prismjs";
19
+
20
+ (globalThis as typeof globalThis & { Prism?: unknown }).Prism ??= Prism;
21
+
22
+ export default Prism;