@aparte/plugin-marked 0.7.0 → 0.8.0

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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type AparteConfig } from '@aparte/core';
1
2
  import { type MarkedExtension } from 'marked';
2
3
  /**
3
4
  * Register [marked](https://marked.js.org) as aparté's one-shot Markdown
@@ -13,5 +14,5 @@ import { type MarkedExtension } from 'marked';
13
14
  * import { setupMarkedProvider } from '@aparte/plugin-marked';
14
15
  * setupMarkedProvider({ gfm: true, breaks: true });
15
16
  */
16
- export declare function setupMarkedProvider(options?: MarkedExtension): void;
17
+ export declare function setupMarkedProvider(options?: MarkedExtension, config?: AparteConfig): void;
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAMnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,YAAY,EAAC,MAAM,cAAc,CAAC;AACrE,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,MAAM,GAAE,YAAiC,GAAG,IAAI,CAoB9G"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { AparteConfig } from "@aparte/core";
2
- import { marked } from "marked";
3
- function setupMarkedProvider(options) {
4
- if (options) marked.use(options);
5
- AparteConfig.setMarkdownProvider((raw) => marked.parse(raw, { async: false }));
1
+ import { aparteGlobalConfig } from "@aparte/core";
2
+ import { Marked, marked } from "marked";
3
+ function setupMarkedProvider(options, config = aparteGlobalConfig) {
4
+ const parser = options ? new Marked(options) : marked;
5
+ config.setMarkdownProvider((raw) => parser.parse(raw, { async: false }));
6
6
  }
7
7
  export {
8
8
  setupMarkedProvider
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { AparteConfig } from '@aparte/core';\nimport { marked, type MarkedExtension } from 'marked';\n\n/**\n * Register [marked](https://marked.js.org) as aparté's one-shot Markdown\n * provider — the renderer used for finished / re-rendered message bubbles.\n * (For token-by-token incremental rendering, add `@aparte/plugin-streaming-markdown`.)\n *\n * Call once at application startup.\n *\n * @param options Optional marked extension(s) — custom renderer, `gfm`/`breaks`\n * flags, hooks, etc. Applied via `marked.use()`.\n *\n * @example\n * import { setupMarkedProvider } from '@aparte/plugin-marked';\n * setupMarkedProvider({ gfm: true, breaks: true });\n */\nexport function setupMarkedProvider(options?: MarkedExtension): void {\n if (options) marked.use(options);\n\n // aparté's markdown provider is synchronous `(raw) => string`; `async: false`\n // makes marked return a string rather than a Promise.\n AparteConfig.setMarkdownProvider((raw) => marked.parse(raw, { async: false }) as string);\n}\n"],"names":[],"mappings":";;AAiBO,SAAS,oBAAoB,SAAiC;AACjE,MAAI,QAAS,QAAO,IAAI,OAAO;AAI/B,eAAa,oBAAoB,CAAC,QAAQ,OAAO,MAAM,KAAK,EAAE,OAAO,MAAA,CAAO,CAAW;AAC3F;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { aparteGlobalConfig , type AparteConfig} from '@aparte/core';\nimport { Marked, marked, type MarkedExtension } from 'marked';\n\n/**\n * Register [marked](https://marked.js.org) as aparté's one-shot Markdown\n * provider — the renderer used for finished / re-rendered message bubbles.\n * (For token-by-token incremental rendering, add `@aparte/plugin-streaming-markdown`.)\n *\n * Call once at application startup.\n *\n * @param options Optional marked extension(s) — custom renderer, `gfm`/`breaks`\n * flags, hooks, etc. Applied via `marked.use()`.\n *\n * @example\n * import { setupMarkedProvider } from '@aparte/plugin-marked';\n * setupMarkedProvider({ gfm: true, breaks: true });\n */\nexport function setupMarkedProvider(options?: MarkedExtension, config: AparteConfig = aparteGlobalConfig): void {\n /*\n * A PRIVATE marked instance per call when options are given, not\n * `marked.use()`.\n *\n * `marked` is a module-level singleton and `use()` mutates it cumulatively with\n * no undo — so the `config` parameter scoped WHICH config got the provider\n * while the options went page-wide. Two chats could have marked-vs-none, but\n * never two different marked configurations, and setting up the second chat\n * retroactively changed the first chat's rendering. A test covered the provider\n * scoping and could not see that half.\n *\n * With no options there is nothing to scope, so the shared singleton is used —\n * one parser instead of one per chat.\n */\n const parser = options ? new Marked(options) : marked;\n\n // aparté's markdown provider is synchronous `(raw) => string`; `async: false`\n // makes marked return a string rather than a Promise.\n config.setMarkdownProvider((raw) => parser.parse(raw, { async: false }) as string);\n}\n"],"names":[],"mappings":";;AAiBO,SAAS,oBAAoB,SAA2B,SAAuB,oBAA0B;AAe5G,QAAM,SAAS,UAAU,IAAI,OAAO,OAAO,IAAI;AAI/C,SAAO,oBAAoB,CAAC,QAAQ,OAAO,MAAM,KAAK,EAAE,OAAO,MAAA,CAAO,CAAW;AACrF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aparte/plugin-marked",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Markdown rendering for aparté via marked — register it as the one-shot Markdown provider.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -24,15 +24,14 @@
24
24
  "node": ">=18"
25
25
  },
26
26
  "peerDependencies": {
27
- "@aparte/core": ">=0.5.0-alpha.0 <1.0.0",
28
- "marked": ">=12"
27
+ "@aparte/core": ">=0.7.0 <1.0.0",
28
+ "marked": "^18.0.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "marked": "^18.0.0",
32
32
  "typescript": "^5.4.0",
33
33
  "vite": "^6.0.0",
34
- "vite-plugin-dts": "^4.5.4",
35
- "@aparte/core": "0.7.0"
34
+ "@aparte/core": "0.8.0"
36
35
  },
37
36
  "keywords": [
38
37
  "aparte",