@lwrjs/client-modules 0.10.0-alpha.12 → 0.10.0-alpha.13
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 +2 -1
- package/build/bundle/prod/lwr/lockerDefine/lockerDefine.js +2 -1
- package/build/bundle/prod/lwr/servicesESM/servicesESM.js +1 -0
- package/build/modules/lwr/environment/environment.js +1 -0
- package/build/modules/lwr/init/init.js +97 -52
- package/build/modules/lwr/lockerDefine/lockerDefine.js +2091 -2230
- package/build/modules/lwr/lockerSandbox/lockerSandbox.js +2096 -2234
- package/build/modules/lwr/metrics/metrics.js +7 -0
- package/build/modules/lwr/profiler/profiler.js +41 -10
- package/package.json +9 -6
|
@@ -5,6 +5,13 @@ export const BOOTSTRAP_ERROR = `${BOOTSTRAP_PREFIX}error`;
|
|
|
5
5
|
export const BOOTSTRAP_ERROR_COUNT = `${BOOTSTRAP_ERROR}.count`;
|
|
6
6
|
export const BOOTSTRAP_DURATION = `${BOOTSTRAP_PREFIX}duration`;
|
|
7
7
|
|
|
8
|
+
// Initialization
|
|
9
|
+
export const INIT = 'lwr.bootstrap.init';
|
|
10
|
+
export const INIT_DURATION = `${INIT}.duration`;
|
|
11
|
+
export const INIT_MODULE = `lwr.bootstrap.init.module`;
|
|
12
|
+
export const INIT_MODULE_DURATION = `${INIT_MODULE}.duration`;
|
|
13
|
+
export const INIT_MODULE_COUNT = `${INIT_MODULE}.count`;
|
|
14
|
+
|
|
8
15
|
// Loader: modules
|
|
9
16
|
export const LOADER_PREFIX = 'lwr.loader.';
|
|
10
17
|
export const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
|
|
@@ -13,21 +13,46 @@ export function attachDispatcher(dispatcher) {
|
|
|
13
13
|
// e.g. JSDom (used in Jest) doesn't implement these
|
|
14
14
|
const perf = globalThis.performance;
|
|
15
15
|
const isPerfSupported = typeof perf !== 'undefined' && typeof perf.mark === 'function' && typeof perf.clearMarks === 'function' && typeof perf.measure === 'function' && typeof perf.clearMeasures === 'function';
|
|
16
|
+
function getMeasureName(id, specifier) {
|
|
17
|
+
return specifier ? `${id}-${specifier}` : id;
|
|
18
|
+
}
|
|
19
|
+
function getMarkName(id, specifier, specifierIndex) {
|
|
20
|
+
const measureName = getMeasureName(id, specifier);
|
|
21
|
+
return specifier && specifierIndex ? `${measureName}_${specifierIndex}` : measureName;
|
|
22
|
+
}
|
|
23
|
+
function getDetail(specifier, metadata) {
|
|
24
|
+
const detail = specifier || metadata ? {
|
|
25
|
+
...metadata
|
|
26
|
+
} : null;
|
|
27
|
+
if (detail && specifier) {
|
|
28
|
+
detail['specifier'] = specifier;
|
|
29
|
+
}
|
|
30
|
+
return detail;
|
|
31
|
+
}
|
|
16
32
|
|
|
17
33
|
// For marking request metrics
|
|
18
34
|
// Fallback to the Performance API if there is no custom dispatcher
|
|
19
35
|
export function logOperationStart({
|
|
20
36
|
id,
|
|
21
|
-
specifier
|
|
37
|
+
specifier,
|
|
38
|
+
specifierIndex,
|
|
39
|
+
metadata
|
|
22
40
|
}) {
|
|
23
41
|
if (customDispatcher) {
|
|
24
42
|
customDispatcher({
|
|
25
43
|
id,
|
|
26
44
|
phase: Phase.Start,
|
|
27
|
-
specifier
|
|
45
|
+
specifier,
|
|
46
|
+
metadata
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (isPerfSupported) {
|
|
51
|
+
const markName = getMarkName(id, specifier, specifierIndex);
|
|
52
|
+
const detail = getDetail(specifier, metadata);
|
|
53
|
+
perf.mark(markName, {
|
|
54
|
+
detail
|
|
28
55
|
});
|
|
29
|
-
} else if (isPerfSupported) {
|
|
30
|
-
perf.mark(id + (specifier ? `.${specifier}` : ''));
|
|
31
56
|
}
|
|
32
57
|
}
|
|
33
58
|
|
|
@@ -36,19 +61,25 @@ export function logOperationStart({
|
|
|
36
61
|
/* istanbul ignore next */
|
|
37
62
|
export function logOperationEnd({
|
|
38
63
|
id,
|
|
39
|
-
specifier
|
|
64
|
+
specifier,
|
|
65
|
+
specifierIndex,
|
|
66
|
+
metadata
|
|
40
67
|
}) {
|
|
41
68
|
if (customDispatcher) {
|
|
42
69
|
customDispatcher({
|
|
43
70
|
id,
|
|
44
71
|
phase: Phase.End,
|
|
45
|
-
specifier
|
|
72
|
+
specifier,
|
|
73
|
+
metadata
|
|
46
74
|
});
|
|
47
75
|
} else if (isPerfSupported) {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
perf.measure(measureName,
|
|
76
|
+
const markName = getMarkName(id, specifier, specifierIndex);
|
|
77
|
+
const measureName = getMeasureName(id, specifier);
|
|
78
|
+
const detail = getDetail(specifier, metadata);
|
|
79
|
+
perf.measure(measureName, {
|
|
80
|
+
start: markName,
|
|
81
|
+
detail
|
|
82
|
+
});
|
|
52
83
|
|
|
53
84
|
// Clear the created mark and measure to avoid filling the performance entry buffer
|
|
54
85
|
// Even if they get deleted, existing PerformanceObservers preserve copies of the entries
|
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.13",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,15 +33,17 @@
|
|
|
33
33
|
"build:platform": "node scripts/strip-for-core.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@locker/sandbox": "0.19.
|
|
37
|
-
"@lwrjs/shared-utils": "0.10.0-alpha.
|
|
36
|
+
"@locker/sandbox": "0.19.5",
|
|
37
|
+
"@lwrjs/shared-utils": "0.10.0-alpha.13"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@lwrjs/types": "0.10.0-alpha.13",
|
|
40
41
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
41
42
|
"@rollup/plugin-sucrase": "^5.0.1",
|
|
42
43
|
"@rollup/plugin-terser": "^0.4.1",
|
|
43
|
-
"fs-extra": "^
|
|
44
|
-
"rollup": "^2.78.0"
|
|
44
|
+
"fs-extra": "^11.1.1",
|
|
45
|
+
"rollup": "^2.78.0",
|
|
46
|
+
"typescript": "~4.3.5"
|
|
45
47
|
},
|
|
46
48
|
"lwc": {
|
|
47
49
|
"modules": [
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
}
|
|
51
53
|
],
|
|
52
54
|
"expose": [
|
|
55
|
+
"lwr/environment",
|
|
53
56
|
"lwr/hmr",
|
|
54
57
|
"lwr/preInit",
|
|
55
58
|
"lwr/init",
|
|
@@ -66,5 +69,5 @@
|
|
|
66
69
|
"volta": {
|
|
67
70
|
"extends": "../../../package.json"
|
|
68
71
|
},
|
|
69
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "f6d142d5a027554cb1685389e0b173734149683d"
|
|
70
73
|
}
|