@lwrjs/markdown-view-provider 0.9.0-alpha.8 → 0.9.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/build/cjs/index.cjs
CHANGED
|
@@ -42,10 +42,11 @@ var MarkdownViewProvider = class {
|
|
|
42
42
|
this.name = "lwr-markdown-view-provider";
|
|
43
43
|
this.emitter = providerConfig.appEmitter;
|
|
44
44
|
const {
|
|
45
|
-
runtimeEnvironment: {watchFiles}
|
|
45
|
+
runtimeEnvironment: {watchFiles},
|
|
46
|
+
watcherFactory
|
|
46
47
|
} = providerConfig;
|
|
47
|
-
if (watchFiles) {
|
|
48
|
-
this.watcher =
|
|
48
|
+
if (watchFiles && watcherFactory) {
|
|
49
|
+
this.watcher = watcherFactory.setupWatcher(this.onModuleChange.bind(this));
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
async onModuleChange(fileChanged) {
|
|
@@ -32,8 +32,7 @@ var import_unist_util_visit = __toModule(require("unist-util-visit"));
|
|
|
32
32
|
var Shiki = __toModule(require("shiki"));
|
|
33
33
|
async function getHtmlHighlighter({theme}) {
|
|
34
34
|
const highlighter = await Shiki.getHighlighter({
|
|
35
|
-
theme
|
|
36
|
-
langs: ["javascript"]
|
|
35
|
+
theme
|
|
37
36
|
});
|
|
38
37
|
const languageRegistry = {
|
|
39
38
|
loaded: new Set(highlighter.getLoadedLanguages()),
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getViewSourceFromFile, canResolveView
|
|
1
|
+
import { getViewSourceFromFile, canResolveView } from '@lwrjs/shared-utils';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import grayMatter from 'gray-matter';
|
|
4
4
|
import createMarkdownParser from './markdown-parser/markdown-parser.js';
|
|
@@ -14,9 +14,9 @@ export default class MarkdownViewProvider {
|
|
|
14
14
|
this.name = 'lwr-markdown-view-provider';
|
|
15
15
|
this.emitter = providerConfig.appEmitter;
|
|
16
16
|
// Setup watcher
|
|
17
|
-
const { runtimeEnvironment: { watchFiles }, } = providerConfig;
|
|
18
|
-
if (watchFiles) {
|
|
19
|
-
this.watcher = setupWatcher(this.onModuleChange.bind(this));
|
|
17
|
+
const { runtimeEnvironment: { watchFiles }, watcherFactory, } = providerConfig;
|
|
18
|
+
if (watchFiles && watcherFactory) {
|
|
19
|
+
this.watcher = watcherFactory.setupWatcher(this.onModuleChange.bind(this));
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
async onModuleChange(fileChanged) {
|
|
@@ -8,14 +8,8 @@ import * as Shiki from 'shiki';
|
|
|
8
8
|
* @returns An unified Plugin with the HTML Transformer.
|
|
9
9
|
*/
|
|
10
10
|
export async function getHtmlHighlighter({ theme }) {
|
|
11
|
-
// By default the Shiki highlighter loads all the languages upfront, which can take up to 500 ms.
|
|
12
|
-
//
|
|
13
|
-
// It's currently impossible to create a `Highlighter` without preloading only language
|
|
14
|
-
// (https://github.com/shikijs/shiki/issues/326). In the mean time, we forcing the highlighter
|
|
15
|
-
// to only load JavaScript.
|
|
16
11
|
const highlighter = await Shiki.getHighlighter({
|
|
17
12
|
theme,
|
|
18
|
-
langs: ['javascript'],
|
|
19
13
|
});
|
|
20
14
|
const languageRegistry = {
|
|
21
15
|
loaded: new Set(highlighter.getLoadedLanguages()),
|
package/package.json
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.9.0
|
|
7
|
+
"version": "0.9.0",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/salesforce/lwr.git",
|
|
11
|
+
"url": "https://github.com/salesforce-experience-platform-emu/lwr.git",
|
|
12
12
|
"directory": "packages/@lwrjs/markdown-view-provider"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/salesforce/lwr/issues"
|
|
15
|
+
"url": "https://github.com/salesforce-experience-platform-emu/lwr/issues"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"types": "build/es/index.d.ts",
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/
|
|
34
|
-
"@lwrjs/shared-utils": "0.9.0-alpha.8",
|
|
33
|
+
"@lwrjs/shared-utils": "0.9.0",
|
|
35
34
|
"gray-matter": "^4.0.2",
|
|
36
35
|
"hast-util-has-property": "^1.0.4",
|
|
37
36
|
"hast-util-heading-rank": "^1.0.1",
|
|
@@ -42,15 +41,15 @@
|
|
|
42
41
|
"remark-gfm": "^1.0.0",
|
|
43
42
|
"remark-parse": "^9.0.0",
|
|
44
43
|
"remark-rehype": "^8.0.0",
|
|
45
|
-
"shiki": "^0.
|
|
44
|
+
"shiki": "^0.13.0",
|
|
46
45
|
"unified": "^9.2.0",
|
|
47
46
|
"vfile": "^4.2.1"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@lwrjs/types": "0.9.0
|
|
49
|
+
"@lwrjs/types": "0.9.0"
|
|
51
50
|
},
|
|
52
51
|
"engines": {
|
|
53
|
-
"node": ">=
|
|
52
|
+
"node": ">=16.0.0 <20"
|
|
54
53
|
},
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "4e42b0dc5453f92b36b42aa8132c5bc281e616b7"
|
|
56
55
|
}
|