@lwrjs/markdown-view-provider 0.11.0-alpha.3 → 0.11.0-alpha.6
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 +5 -4
- package/build/es/index.js +5 -4
- package/package.json +4 -4
package/build/cjs/index.cjs
CHANGED
|
@@ -65,15 +65,16 @@ var MarkdownViewProvider = class {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
async getView(viewId) {
|
|
68
|
-
|
|
68
|
+
const sourcePath = viewId.contentTemplate;
|
|
69
|
+
if (!sourcePath || !canResolve(viewId)) {
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
if (!this.markdown) {
|
|
72
73
|
throw new Error("Markdown View Provider must be initialized");
|
|
73
74
|
}
|
|
74
|
-
const viewSource = (0, import_shared_utils.getViewSourceFromFile)(
|
|
75
|
+
const viewSource = (0, import_shared_utils.getViewSourceFromFile)(sourcePath);
|
|
75
76
|
const {content, data: viewMetadata} = (0, import_gray_matter.default)(viewSource.originalSource);
|
|
76
|
-
const vFile = (0, import_vfile.default)({path:
|
|
77
|
+
const vFile = (0, import_vfile.default)({path: sourcePath, contents: content});
|
|
77
78
|
const {html, metadata: markdownMetadata} = await this.markdown.render(vFile);
|
|
78
79
|
const {layoutTemplate, ...nonLwrManagedMetadata} = viewMetadata;
|
|
79
80
|
const compiledView = {
|
|
@@ -90,7 +91,7 @@ var MarkdownViewProvider = class {
|
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
|
-
const fullPath = import_path.default.resolve(
|
|
94
|
+
const fullPath = import_path.default.resolve(sourcePath);
|
|
94
95
|
if (this.watcher && !this.cachedViews.has(fullPath)) {
|
|
95
96
|
this.cachedViews.set(fullPath, {compiledView, viewId});
|
|
96
97
|
this.watcher.add(fullPath);
|
package/build/es/index.js
CHANGED
|
@@ -38,17 +38,18 @@ export default class MarkdownViewProvider {
|
|
|
38
38
|
}
|
|
39
39
|
async getView(viewId) {
|
|
40
40
|
// This View Provider can't handle SPAs
|
|
41
|
-
|
|
41
|
+
const sourcePath = viewId.contentTemplate;
|
|
42
|
+
if (!sourcePath || !canResolve(viewId)) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
45
|
if (!this.markdown) {
|
|
45
46
|
throw new Error('Markdown View Provider must be initialized');
|
|
46
47
|
}
|
|
47
48
|
// Retrieve the file contents and create the Compiled View
|
|
48
|
-
const viewSource = getViewSourceFromFile(
|
|
49
|
+
const viewSource = getViewSourceFromFile(sourcePath);
|
|
49
50
|
const { content, data: viewMetadata } = grayMatter(viewSource.originalSource);
|
|
50
51
|
// Keeping this information in vfile which will be passed to plugins.
|
|
51
|
-
const vFile = vfile({ path:
|
|
52
|
+
const vFile = vfile({ path: sourcePath, contents: content });
|
|
52
53
|
const { html, metadata: markdownMetadata } = await this.markdown.render(vFile);
|
|
53
54
|
const { layoutTemplate, ...nonLwrManagedMetadata } = viewMetadata;
|
|
54
55
|
const compiledView = {
|
|
@@ -66,7 +67,7 @@ export default class MarkdownViewProvider {
|
|
|
66
67
|
},
|
|
67
68
|
};
|
|
68
69
|
// Watch for changes
|
|
69
|
-
const fullPath = path.resolve(
|
|
70
|
+
const fullPath = path.resolve(sourcePath);
|
|
70
71
|
if (this.watcher && !this.cachedViews.has(fullPath)) {
|
|
71
72
|
this.cachedViews.set(fullPath, { compiledView, viewId });
|
|
72
73
|
this.watcher.add(fullPath);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.0-alpha.
|
|
7
|
+
"version": "0.11.0-alpha.6",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/shared-utils": "0.11.0-alpha.
|
|
33
|
+
"@lwrjs/shared-utils": "0.11.0-alpha.6",
|
|
34
34
|
"gray-matter": "^4.0.2",
|
|
35
35
|
"hast-util-has-property": "^1.0.4",
|
|
36
36
|
"hast-util-heading-rank": "^1.0.1",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"vfile": "^4.2.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@lwrjs/types": "0.11.0-alpha.
|
|
49
|
+
"@lwrjs/types": "0.11.0-alpha.6"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=16.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "571d4bac5650765aa818bcb9d5ed752a8cf041af"
|
|
55
55
|
}
|