@lwrjs/html-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 +8 -6
- package/build/es/index.d.ts +2 -1
- package/build/es/index.js +8 -7
- package/package.json +7 -8
package/build/cjs/index.cjs
CHANGED
|
@@ -28,20 +28,22 @@ __export(exports, {
|
|
|
28
28
|
});
|
|
29
29
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
30
30
|
var import_path = __toModule(require("path"));
|
|
31
|
-
var
|
|
31
|
+
var import_base_view_provider = __toModule(require("@lwrjs/base-view-provider"));
|
|
32
32
|
var import_gray_matter = __toModule(require("gray-matter"));
|
|
33
|
-
var HtmlViewProvider = class {
|
|
33
|
+
var HtmlViewProvider = class extends import_base_view_provider.default {
|
|
34
34
|
constructor(pluginConfig, providerConfig) {
|
|
35
|
+
super();
|
|
35
36
|
this.cachedViews = new Map();
|
|
36
37
|
this.contentDir = providerConfig.config.contentDir;
|
|
37
38
|
this.layoutsDir = providerConfig.config.layoutsDir;
|
|
38
39
|
this.emitter = providerConfig.appEmitter;
|
|
39
40
|
this.name = "lwr-html-view-provider";
|
|
40
41
|
const {
|
|
41
|
-
runtimeEnvironment: {watchFiles}
|
|
42
|
+
runtimeEnvironment: {watchFiles},
|
|
43
|
+
watcherFactory
|
|
42
44
|
} = providerConfig;
|
|
43
|
-
if (watchFiles) {
|
|
44
|
-
this.watcher =
|
|
45
|
+
if (watchFiles && watcherFactory) {
|
|
46
|
+
this.watcher = watcherFactory.setupWatcher(this.onModuleChange.bind(this));
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
async onModuleChange(fileChanged) {
|
|
@@ -78,7 +80,7 @@ var HtmlViewProvider = class {
|
|
|
78
80
|
},
|
|
79
81
|
render: async (context) => {
|
|
80
82
|
return {
|
|
81
|
-
renderedView:
|
|
83
|
+
renderedView: this.renderView(content, context || {})
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
};
|
package/build/es/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ViewProvider, ProviderContext, CompiledView, ViewIdentity, Watcher } from '@lwrjs/types';
|
|
2
|
-
|
|
2
|
+
import BaseViewProvider from '@lwrjs/base-view-provider';
|
|
3
|
+
export default class HtmlViewProvider extends BaseViewProvider implements ViewProvider {
|
|
3
4
|
name: string;
|
|
4
5
|
contentDir: string;
|
|
5
6
|
layoutsDir: string;
|
package/build/es/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { getViewSourceFromFile, canResolveView
|
|
1
|
+
import { getViewSourceFromFile, canResolveView } from '@lwrjs/shared-utils';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import
|
|
3
|
+
import BaseViewProvider from '@lwrjs/base-view-provider';
|
|
4
4
|
import grayMatter from 'gray-matter';
|
|
5
|
-
export default class HtmlViewProvider {
|
|
5
|
+
export default class HtmlViewProvider extends BaseViewProvider {
|
|
6
6
|
constructor(pluginConfig, providerConfig) {
|
|
7
|
+
super();
|
|
7
8
|
this.cachedViews = new Map();
|
|
8
9
|
this.contentDir = providerConfig.config.contentDir;
|
|
9
10
|
this.layoutsDir = providerConfig.config.layoutsDir;
|
|
10
11
|
this.emitter = providerConfig.appEmitter;
|
|
11
12
|
this.name = 'lwr-html-view-provider';
|
|
12
13
|
// Setup watcher
|
|
13
|
-
const { runtimeEnvironment: { watchFiles }, } = providerConfig;
|
|
14
|
-
if (watchFiles) {
|
|
15
|
-
this.watcher = setupWatcher(this.onModuleChange.bind(this));
|
|
14
|
+
const { runtimeEnvironment: { watchFiles }, watcherFactory, } = providerConfig;
|
|
15
|
+
if (watchFiles && watcherFactory) {
|
|
16
|
+
this.watcher = watcherFactory.setupWatcher(this.onModuleChange.bind(this));
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
async onModuleChange(fileChanged) {
|
|
@@ -54,7 +55,7 @@ export default class HtmlViewProvider {
|
|
|
54
55
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
56
|
render: async (context) => {
|
|
56
57
|
return {
|
|
57
|
-
renderedView:
|
|
58
|
+
renderedView: this.renderView(content, context || {}),
|
|
58
59
|
};
|
|
59
60
|
},
|
|
60
61
|
};
|
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/html-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,16 +30,15 @@
|
|
|
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
|
"parse5-sax-parser": "^6.0.1"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@lwrjs/types": "0.9.0
|
|
38
|
+
"@lwrjs/types": "0.9.0"
|
|
40
39
|
},
|
|
41
40
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
41
|
+
"node": ">=16.0.0 <20"
|
|
43
42
|
},
|
|
44
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "4e42b0dc5453f92b36b42aa8132c5bc281e616b7"
|
|
45
44
|
}
|