write-language 0.1.174 → 0.1.176
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/dist/utils/prism-global.d.ts +2 -0
- package/dist/utils/prism.d.ts +1 -1
- package/dist/write-language.cjs.js +1 -1
- package/dist/write-language.cjs.js.map +1 -1
- package/dist/write-language.es.js +1 -1
- package/dist/write-language.es.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/prism-global.ts +21 -0
- package/src/utils/prism.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "write-language",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.176",
|
|
4
4
|
"description": "Multi-provider language generation toolkit using Vercel AI SDK - generate responses with 10+ LLM providers including OpenAI, Anthropic, Google, and more.",
|
|
5
5
|
"author": "vtempest <grokthiscontact@gmail.com>",
|
|
6
6
|
"license": "rights.institute/PROSPER",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Publishes Prism on `globalThis` so the `prismjs/components/*`
|
|
3
|
+
* grammar scripts can find it.
|
|
4
|
+
*
|
|
5
|
+
* Those grammar files are plain browser scripts, not modules — `prism-markup.js`
|
|
6
|
+
* literally opens with `Prism.languages.markup = {...}`, resolving `Prism` as a
|
|
7
|
+
* free variable off the global object. Prism's core only publishes that global
|
|
8
|
+
* when it can see `window` (browser), a `WorkerGlobalScope` `self`, or Node's
|
|
9
|
+
* `global`. On Cloudflare Workers / edge runtimes none of the three exist, so
|
|
10
|
+
* the first grammar file throws `ReferenceError: Prism is not defined` while the
|
|
11
|
+
* module graph is still evaluating, taking the whole SSR render down with it.
|
|
12
|
+
*
|
|
13
|
+
* Import this module *before* any `prismjs/components/*` import. ES modules are
|
|
14
|
+
* evaluated in import order, so this file's body runs — and the global lands —
|
|
15
|
+
* before the grammars reference it.
|
|
16
|
+
*/
|
|
17
|
+
import Prism from "prismjs";
|
|
18
|
+
|
|
19
|
+
(globalThis as typeof globalThis & { Prism?: unknown }).Prism ??= Prism;
|
|
20
|
+
|
|
21
|
+
export default Prism;
|
package/src/utils/prism.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* a small `highlightCode` helper used by markdown-to-html.ts for code-block syntax
|
|
4
4
|
* highlighting.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
// Must precede every `prismjs/components/*` import: the grammar scripts read
|
|
7
|
+
// `Prism` off the global object, which this module publishes (see its docs).
|
|
8
|
+
import Prism from "./prism-global";
|
|
7
9
|
import "prismjs/components/prism-markup";
|
|
8
10
|
import "prismjs/components/prism-css";
|
|
9
11
|
import "prismjs/components/prism-javascript";
|