repl-sdk 1.2.0 → 1.4.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/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repl-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./src/index.d.ts",
|
|
8
8
|
"default": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./markdown/parse": {
|
|
11
|
+
"types": "./src/compilers/markdown/parse.d.ts",
|
|
12
|
+
"default": "./src/compilers/markdown/parse.js"
|
|
9
13
|
}
|
|
10
14
|
},
|
|
11
15
|
"ember-addon": {
|
|
@@ -86,9 +90,9 @@
|
|
|
86
90
|
"unified": "^11.0.5",
|
|
87
91
|
"unist-util-visit": "^5.0.0",
|
|
88
92
|
"vfile": "^6.0.3",
|
|
93
|
+
"codemirror-lang-glimmer": "^2.0.3",
|
|
89
94
|
"codemirror-lang-glimdown": "^2.0.3",
|
|
90
|
-
"codemirror-lang-glimmer-js": "^2.0.3"
|
|
91
|
-
"codemirror-lang-glimmer": "^2.0.3"
|
|
95
|
+
"codemirror-lang-glimmer-js": "^2.0.3"
|
|
92
96
|
},
|
|
93
97
|
"volta": {
|
|
94
98
|
"extends": "../../package.json"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InternalOptions } from './types';
|
|
2
|
+
|
|
3
|
+
export function parseMarkdown(
|
|
4
|
+
input: string,
|
|
5
|
+
options: InternalOptions
|
|
6
|
+
): Promise<{
|
|
7
|
+
text: string;
|
|
8
|
+
codeBlocks: Array<{
|
|
9
|
+
lang: string;
|
|
10
|
+
format: string;
|
|
11
|
+
code: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}>;
|
|
14
|
+
}>;
|
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
import { buildCompiler } from './build-compiler.js';
|
|
16
16
|
|
|
17
|
+
export { buildCompiler } from './build-compiler.js';
|
|
18
|
+
|
|
17
19
|
/**
|
|
18
20
|
* @param {string} input
|
|
19
21
|
* @param {import('./types').InternalOptions} options
|
|
20
22
|
* @returns {Promise<ParseResult>}
|
|
21
23
|
*/
|
|
22
24
|
export async function parseMarkdown(input, options) {
|
|
23
|
-
const markdownCompiler = buildCompiler(options);
|
|
25
|
+
const markdownCompiler = options?.compiler ?? buildCompiler(options);
|
|
24
26
|
const processed = await markdownCompiler.process(input);
|
|
25
27
|
const liveCode = /** @type {CodeBlock[]} */ (processed.data.liveCode || []);
|
|
26
28
|
// @ts-ignore - processed is typed as unknown due to unified processor complexity
|
|
@@ -16,6 +16,7 @@ export interface PublicOptions {
|
|
|
16
16
|
};
|
|
17
17
|
remarkPlugins?: unknown[];
|
|
18
18
|
rehypePlugins?: unknown[];
|
|
19
|
+
compiler?: { process: (text: string) => Promise<{ data: { liveCode: Array<string> } }> };
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export type InternalOptions = PublicOptions & LiveCodeExtractionOptions;
|