@lwrjs/client-modules 0.10.0-alpha.0 → 0.10.0-alpha.10
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/bundle/prod/lwr/init/init.js +1 -1
- package/build/bundle/prod/lwr/lockerDefine/lockerDefine.js +1 -1
- package/build/modules/lwr/init/init.js +43 -21
- package/build/modules/lwr/lockerDefine/lockerDefine.js +1863 -3371
- package/build/modules/lwr/lockerSandbox/lockerSandbox.js +1790 -3357
- package/build/modules/lwr/profiler/profiler.js +3 -3
- package/package.json +16 -8
- package/build/modules/lwr/initSsr/initSsr.js +0 -31
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var Phase
|
|
2
|
-
(function (Phase) {
|
|
1
|
+
var Phase = /*#__PURE__*/function (Phase) {
|
|
3
2
|
Phase[Phase["Start"] = 0] = "Start";
|
|
4
3
|
Phase[Phase["End"] = 1] = "End";
|
|
5
|
-
|
|
4
|
+
return Phase;
|
|
5
|
+
}(Phase || {});
|
|
6
6
|
// Attach a custom dispatcher
|
|
7
7
|
let customDispatcher;
|
|
8
8
|
export function attachDispatcher(dispatcher) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.10.0-alpha.
|
|
7
|
+
"version": "0.10.0-alpha.10",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -26,16 +26,22 @@
|
|
|
26
26
|
"build/**/*.d.ts"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "
|
|
29
|
+
"build:ts": "tsc -b",
|
|
30
|
+
"build": "yarn build:ts && node ../../../bin/pack-lwc --dir modules build/modules && yarn build:locker && yarn build:bundle",
|
|
30
31
|
"build:locker": "rollup --config ./scripts/rollup.config.locker.js",
|
|
31
|
-
"build:bundle": "rollup --config scripts/rollup.moduleBundle.config.cjs"
|
|
32
|
+
"build:bundle": "rollup --config scripts/rollup.moduleBundle.config.cjs",
|
|
33
|
+
"build:platform": "node scripts/strip-for-core.js"
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
|
-
"@locker/sandbox": "0.
|
|
35
|
-
"@lwrjs/shared-utils": "0.10.0-alpha.
|
|
36
|
+
"@locker/sandbox": "0.19.0",
|
|
37
|
+
"@lwrjs/shared-utils": "0.10.0-alpha.10"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
|
-
"rollup
|
|
40
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
41
|
+
"@rollup/plugin-sucrase": "^5.0.1",
|
|
42
|
+
"@rollup/plugin-terser": "^0.4.1",
|
|
43
|
+
"fs-extra": "^9.1.0",
|
|
44
|
+
"rollup": "^2.78.0"
|
|
39
45
|
},
|
|
40
46
|
"lwc": {
|
|
41
47
|
"modules": [
|
|
@@ -47,7 +53,6 @@
|
|
|
47
53
|
"lwr/hmr",
|
|
48
54
|
"lwr/preInit",
|
|
49
55
|
"lwr/init",
|
|
50
|
-
"lwr/initSsr",
|
|
51
56
|
"lwr/servicesESM",
|
|
52
57
|
"lwr/lockerDefine",
|
|
53
58
|
"lwr/lockerSandbox",
|
|
@@ -58,5 +63,8 @@
|
|
|
58
63
|
"engines": {
|
|
59
64
|
"node": ">=16.0.0 <20"
|
|
60
65
|
},
|
|
61
|
-
"
|
|
66
|
+
"volta": {
|
|
67
|
+
"extends": "../../../package.json"
|
|
68
|
+
},
|
|
69
|
+
"gitHead": "81dd6125be1023415344b59c4dcd977c8dbaf7f5"
|
|
62
70
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// TODO: This is a temporal workaround until https://github.com/salesforce/lwc/pull/2564 is sorted
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import { hydrateComponent } from 'lwc';
|
|
5
|
-
export function toKebabCase(specifier) {
|
|
6
|
-
return specifier.replace(/\/v\/[a-zA-Z0-9-_.]+$/, '').replace('/', '-').replace(/([A-Z])/g, c => `-${c.toLowerCase()}`);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Hydrate the given component(s) which were server-side rendered (see the lwc-ssr/viewTransformer).
|
|
11
|
-
* @param components - An array of arrays, each one holding:
|
|
12
|
-
* 0. a bare specifier
|
|
13
|
-
* 1. the corresponding LightningElement constructor
|
|
14
|
-
* @param ssrProps - map of properties to set on each component
|
|
15
|
-
* @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
|
|
16
|
-
*/
|
|
17
|
-
export function init(components, ssrProps = {}) {
|
|
18
|
-
if (typeof document !== 'undefined') {
|
|
19
|
-
components.forEach(([moduleSpecifier, ctor]) => {
|
|
20
|
-
// Kebab-case the specifier
|
|
21
|
-
const elementName = toKebabCase(moduleSpecifier);
|
|
22
|
-
// Find all instances of the component in the document, and hydrate them all
|
|
23
|
-
const customElements = document.querySelectorAll(elementName);
|
|
24
|
-
customElements.forEach(customElement => {
|
|
25
|
-
const propsId = customElement.dataset.lwrPropsId;
|
|
26
|
-
const props = ssrProps[propsId] || {};
|
|
27
|
-
hydrateComponent(customElement, ctor, props);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|