@lwrjs/everywhere 0.10.0-alpha.8 → 0.10.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/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/ad26178e2b6a712bafbd34bfa576d557/config.js +10 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/{0_10_0-alpha_8 → 0_10_0}/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +4 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{2_45_2/s/97b809a5745ddedba3acd0433f339b58 → 2_50_0/s/b40440e2e29d782101f05d6085a324e9}/lwc.js +119 -164
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_10_0-alpha_8/s/c538071acf5bde58e816967a14c465c3 → 0_10_0/s/cb931ebef2b89dcf8ab51456e3a68864}/lwr_everywhereAmd.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/0_10_0/s/5e6db37af51f0d23be4893abe5eeb913/lwr_init.js +163 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_10_0-alpha_8/s/7c38605af6fc9549feac455828d00bdd → 0_10_0/s/1344670ea0a1514a4e8da5ca7f382e45}/lwr_loader.js +73 -5
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_10_0-alpha_8/s/3426e42c3e22ce07ab2adc62c4c523a0 → 0_10_0/s/7a802ee7a2430244c1f66bce2c2eafef}/lwr_metrics.js +13 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_10_0/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +102 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_10_0-alpha_8 → 0_10_0}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_10_0-alpha_8 → 0_10_0}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_10_0-alpha_8 → 0_10_0}/lwr-loader-shim.bundle.js +122 -19
- package/build/assets/amd/lwr-everywhere-debug.js +81 -10
- package/build/assets/amd/lwr-everywhere-min.js +5 -1
- package/build/assets/amd/lwr-everywhere.js +81 -10
- package/build/assets/core/lwr-everywhere-debug.js +77 -6
- package/build/assets/core/lwr-everywhere-min.js +5 -1
- package/build/assets/core/lwr-everywhere.js +77 -6
- package/build/assets/esm/lwr-everywhere-debug.js +1 -1
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +1 -1
- package/build/generate.js +1 -1
- package/build/index.js +1 -1
- package/build/modules/lwr/everywhereAmd/everywhereAmd.d.ts +1 -1
- package/build/modules/lwr/host/host.html +1 -1
- package/build/modules/lwr/host/host.js +1 -1
- package/package.json +11 -10
- package/src/generate.ts +1 -1
- package/src/index.ts +4 -1
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/02b9b4ac7ae3860b355955245154923a/config.js +0 -10
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/0_10_0-alpha_8/s/8199fbc1a33dffe14973c3ee0a3f6aa3/lwr_init.js +0 -118
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_10_0-alpha_8/s/4e65d4b97b3cc3d2f06a4cc284f3dd68/lwr_profiler.js +0 -68
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
LWR.define('lwr/init/v/0_10_0', ['exports', 'lwr/metrics/v/0_10_0', 'lwr/profiler/v/0_10_0', 'lwc/v/2_50_0'], (function (exports, _0_10_0$1, _0_10_0, _2_50_0) { 'use strict';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
|
|
5
|
+
// <hydrateComponentProxy> - This code is removed in core
|
|
6
|
+
|
|
7
|
+
function hydrateComponentProxy(customElement, Ctor, props) {
|
|
8
|
+
_2_50_0.hydrateComponent(customElement, Ctor, props);
|
|
9
|
+
}
|
|
10
|
+
// </hydrateComponentProxy>
|
|
11
|
+
|
|
12
|
+
function initializeWebComponent(elementName, Ctor) {
|
|
13
|
+
return _2_50_0.createElement(elementName, {
|
|
14
|
+
is: Ctor
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Convert a module specifier into a valid CustomElement registry name:
|
|
20
|
+
* - remove any version linking
|
|
21
|
+
* - change / to -
|
|
22
|
+
* - convert uppercase letters into "-${lowercase}"
|
|
23
|
+
* eg: "c/app" => "c-app"
|
|
24
|
+
* eg: "my/helloWorld" => "my-hello-world"
|
|
25
|
+
* eg: "lwr/example/v/1.0.0" => "lwr-example"
|
|
26
|
+
* @param specifier The bare specifier to convert
|
|
27
|
+
*/
|
|
28
|
+
function toKebabCase(specifier) {
|
|
29
|
+
return specifier.replace(/\/v\/[a-zA-Z0-9-_.]+$/, '').replace('/', '-').replace(/([A-Z])/g, c => `-${c.toLowerCase()}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This method maps between attribute names
|
|
34
|
+
* and the corresponding props name.
|
|
35
|
+
*/
|
|
36
|
+
const CAMEL_REGEX = /-([a-z])/g;
|
|
37
|
+
function getPropFromAttrName(propName) {
|
|
38
|
+
return propName.replace(CAMEL_REGEX, g => g[1].toUpperCase());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Import any requested static application dependencies, define the root
|
|
43
|
+
* application component(s) into the CustomElement registry, and inject them.
|
|
44
|
+
* @param rootModules - An array of arrays, each one holding a pair of
|
|
45
|
+
* bare specifier and corresponding LightningElement constructor
|
|
46
|
+
* @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
|
|
47
|
+
*/
|
|
48
|
+
function init(rootModules, ssrProps = {}) {
|
|
49
|
+
if (typeof customElements === 'undefined' || typeof document === 'undefined') {
|
|
50
|
+
_0_10_0.logOperationStart({
|
|
51
|
+
id: _0_10_0$1.BOOTSTRAP_END
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
_0_10_0.logOperationStart({
|
|
56
|
+
id: _0_10_0$1.INIT
|
|
57
|
+
});
|
|
58
|
+
let index = 0;
|
|
59
|
+
for (const [specifier, ctor] of rootModules) {
|
|
60
|
+
const elementName = toKebabCase(specifier);
|
|
61
|
+
|
|
62
|
+
// initialize and inject the root module into the LWR Root or DOM if it is missing
|
|
63
|
+
if (!document.body.querySelector(elementName)) {
|
|
64
|
+
_0_10_0.logOperationStart({
|
|
65
|
+
id: _0_10_0$1.INIT_MODULE,
|
|
66
|
+
specifier,
|
|
67
|
+
specifierIndex: ++index
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// this is for SPA like routes (one component at the root level) utilizing the lwr-root directive
|
|
71
|
+
const component = initializeWebComponent(elementName, ctor);
|
|
72
|
+
const container = document.querySelector('[lwr-root]');
|
|
73
|
+
container ? container.appendChild(component) : document.body.appendChild(component);
|
|
74
|
+
_0_10_0.logOperationEnd({
|
|
75
|
+
id: _0_10_0$1.INIT_MODULE,
|
|
76
|
+
specifier,
|
|
77
|
+
specifierIndex: index,
|
|
78
|
+
metadata: {
|
|
79
|
+
renderMode: 'spa'
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// the page has been rendered or SSR'd, and each component needs to initialized(or hydrated)
|
|
86
|
+
const elements = document.querySelectorAll(elementName);
|
|
87
|
+
for (const element of elements) {
|
|
88
|
+
_0_10_0.logOperationStart({
|
|
89
|
+
id: _0_10_0$1.INIT_MODULE,
|
|
90
|
+
specifier,
|
|
91
|
+
specifierIndex: ++index
|
|
92
|
+
});
|
|
93
|
+
const propsId = element.dataset.lwrPropsId;
|
|
94
|
+
|
|
95
|
+
// hydrate SSR'd components
|
|
96
|
+
if (propsId) {
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
hydrateComponentProxy(element, ctor, ssrProps[propsId] || {});
|
|
100
|
+
_0_10_0.logOperationEnd({
|
|
101
|
+
id: _0_10_0$1.INIT_MODULE,
|
|
102
|
+
specifier,
|
|
103
|
+
specifierIndex: index,
|
|
104
|
+
metadata: {
|
|
105
|
+
renderMode: 'ssr'
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Note: due to the bug described at the top of this file, each CSR'd custom element
|
|
112
|
+
// must be replaced with the new synthetic constructor. Attributes and children are
|
|
113
|
+
// copied over to the new component.
|
|
114
|
+
const component = initializeWebComponent(elementName, ctor);
|
|
115
|
+
|
|
116
|
+
// copy the attributes
|
|
117
|
+
for (const {
|
|
118
|
+
name,
|
|
119
|
+
value
|
|
120
|
+
} of element.attributes) {
|
|
121
|
+
component.setAttribute(name, value);
|
|
122
|
+
const prop = getPropFromAttrName(name);
|
|
123
|
+
if (prop in component) {
|
|
124
|
+
// set attributes as properties for reactivity
|
|
125
|
+
component[prop] = value;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// save the children
|
|
130
|
+
while (element.childNodes.length > 0) {
|
|
131
|
+
component.appendChild(element.childNodes[0]);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// swap the element out with the initialized component
|
|
135
|
+
const parent = element.parentElement;
|
|
136
|
+
if (parent) {
|
|
137
|
+
parent.replaceChild(component, element);
|
|
138
|
+
}
|
|
139
|
+
_0_10_0.logOperationEnd({
|
|
140
|
+
id: _0_10_0$1.INIT_MODULE,
|
|
141
|
+
specifier,
|
|
142
|
+
specifierIndex: index,
|
|
143
|
+
metadata: {
|
|
144
|
+
renderMode: 'csr'
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
_0_10_0.logOperationEnd({
|
|
150
|
+
id: _0_10_0$1.INIT
|
|
151
|
+
});
|
|
152
|
+
_0_10_0.logOperationStart({
|
|
153
|
+
id: _0_10_0$1.BOOTSTRAP_END
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
exports.getPropFromAttrName = getPropFromAttrName;
|
|
158
|
+
exports.init = init;
|
|
159
|
+
exports.toKebabCase = toKebabCase;
|
|
160
|
+
|
|
161
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
162
|
+
|
|
163
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/loader/v/0_10_0
|
|
1
|
+
LWR.define('lwr/loader/v/0_10_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) 2021, salesforce.com, inc.
|
|
@@ -6,7 +6,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
6
6
|
* SPDX-License-Identifier: MIT
|
|
7
7
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8
8
|
*/
|
|
9
|
-
/* LWR Module Loader v0.10.0
|
|
9
|
+
/* LWR Module Loader v0.10.0 */
|
|
10
10
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
function templateString(template, args) {
|
|
@@ -25,7 +25,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
25
25
|
super();
|
|
26
26
|
this.message = generateErrorMessage(errorInfo, errorArgs);
|
|
27
27
|
}
|
|
28
|
-
/*LWC compiler v2.
|
|
28
|
+
/*LWC compiler v2.50.0*/
|
|
29
29
|
}
|
|
30
30
|
function invariant(condition, errorInfo) {
|
|
31
31
|
if (!condition) {
|
|
@@ -541,7 +541,69 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
const MODULE_LOAD_TIMEOUT_TIMER =
|
|
544
|
+
const MODULE_LOAD_TIMEOUT_TIMER = 60 * 1000; // 1m
|
|
545
|
+
|
|
546
|
+
/*!
|
|
547
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
548
|
+
*/
|
|
549
|
+
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
|
|
550
|
+
const SUPPORTS_TRUSTED_TYPES = typeof trustedTypes !== 'undefined';
|
|
551
|
+
function createTrustedTypesPolicy(name, options) {
|
|
552
|
+
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
|
|
553
|
+
return trustedTypes.createPolicy(name, options);
|
|
554
|
+
}
|
|
555
|
+
function createFallbackPolicy(_name, options) {
|
|
556
|
+
return options;
|
|
557
|
+
}
|
|
558
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
|
|
559
|
+
const createPolicy = SUPPORTS_TRUSTED_TYPES ? createTrustedTypesPolicy : createFallbackPolicy;
|
|
560
|
+
const policyOptions = {
|
|
561
|
+
createHTML(value) {
|
|
562
|
+
return value;
|
|
563
|
+
},
|
|
564
|
+
createScript(value) {
|
|
565
|
+
return value;
|
|
566
|
+
},
|
|
567
|
+
createScriptURL(value) {
|
|
568
|
+
return value;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
// Temporarily surround in try-catch until migration to AMD run.
|
|
572
|
+
try {
|
|
573
|
+
createPolicy('default', {
|
|
574
|
+
createHTML(dirty) {
|
|
575
|
+
// Treat null & undefined separately
|
|
576
|
+
if (dirty === 'null' || dirty === 'undefined') {
|
|
577
|
+
return dirty;
|
|
578
|
+
}
|
|
579
|
+
return dirty;
|
|
580
|
+
},
|
|
581
|
+
// Ignore typescript type validation for this policy.
|
|
582
|
+
// Returning `undefined` from a TT policy blocks usages
|
|
583
|
+
// of specific DOM sinks affected by this hook.
|
|
584
|
+
// We want to block eval and inline scripts.
|
|
585
|
+
// @ts-ignore
|
|
586
|
+
createScript(dirty) {
|
|
587
|
+
// Treat null & undefined separately
|
|
588
|
+
if (dirty === 'null' || dirty === 'undefined') {
|
|
589
|
+
return dirty;
|
|
590
|
+
}
|
|
591
|
+
// Block script evaluation
|
|
592
|
+
return undefined;
|
|
593
|
+
},
|
|
594
|
+
createScriptURL(dirty) {
|
|
595
|
+
// Treat null & undefined separately
|
|
596
|
+
if (dirty === 'null' || dirty === 'undefined') {
|
|
597
|
+
return dirty;
|
|
598
|
+
}
|
|
599
|
+
return dirty;
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
} catch (_unused) {
|
|
603
|
+
// swallow
|
|
604
|
+
}
|
|
605
|
+
const trusted = createPolicy('trusted', policyOptions);
|
|
606
|
+
/*! version: 0.19.10 */
|
|
545
607
|
|
|
546
608
|
/* global console,process */
|
|
547
609
|
|
|
@@ -591,7 +653,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
591
653
|
code = `${code}\n//# sourceURL=${id}`; // append sourceURL for debugging
|
|
592
654
|
try {
|
|
593
655
|
// TODO eval source maps for debugging
|
|
594
|
-
eval(code);
|
|
656
|
+
eval(trusted.createScript(code));
|
|
595
657
|
} catch (e) {
|
|
596
658
|
throw new LoaderError(FAIL_LOAD, [id]);
|
|
597
659
|
}
|
|
@@ -661,6 +723,9 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
661
723
|
// eslint-disable-next-line no-await-in-loop
|
|
662
724
|
result = isResponseAPromise(response) ? await response : response;
|
|
663
725
|
}
|
|
726
|
+
if (!this.isValidResolveResponse(result)) {
|
|
727
|
+
throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
|
|
728
|
+
}
|
|
664
729
|
|
|
665
730
|
// if result is not null, attempt resolution
|
|
666
731
|
if (result !== null) {
|
|
@@ -1157,6 +1222,9 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
1157
1222
|
this.handleStaleModuleHook = [handleStaleModule];
|
|
1158
1223
|
}
|
|
1159
1224
|
}
|
|
1225
|
+
isValidResolveResponse(res) {
|
|
1226
|
+
return res === null || typeof res === 'string' || res && typeof res.url === 'string';
|
|
1227
|
+
}
|
|
1160
1228
|
}
|
|
1161
1229
|
|
|
1162
1230
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/metrics/v/0_10_0
|
|
1
|
+
LWR.define('lwr/metrics/v/0_10_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// Bootstrap / shim
|
|
4
4
|
const BOOTSTRAP_PREFIX = 'lwr.bootstrap.';
|
|
@@ -7,6 +7,13 @@ LWR.define('lwr/metrics/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'u
|
|
|
7
7
|
const BOOTSTRAP_ERROR_COUNT = `${BOOTSTRAP_ERROR}.count`;
|
|
8
8
|
const BOOTSTRAP_DURATION = `${BOOTSTRAP_PREFIX}duration`;
|
|
9
9
|
|
|
10
|
+
// Initialization
|
|
11
|
+
const INIT = 'lwr.bootstrap.init';
|
|
12
|
+
const INIT_DURATION = `${INIT}.duration`;
|
|
13
|
+
const INIT_MODULE = `lwr.bootstrap.init.module`;
|
|
14
|
+
const INIT_MODULE_DURATION = `${INIT_MODULE}.duration`;
|
|
15
|
+
const INIT_MODULE_COUNT = `${INIT_MODULE}.count`;
|
|
16
|
+
|
|
10
17
|
// Loader: modules
|
|
11
18
|
const LOADER_PREFIX = 'lwr.loader.';
|
|
12
19
|
const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
|
|
@@ -39,6 +46,11 @@ LWR.define('lwr/metrics/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'u
|
|
|
39
46
|
exports.BOOTSTRAP_ERROR = BOOTSTRAP_ERROR;
|
|
40
47
|
exports.BOOTSTRAP_ERROR_COUNT = BOOTSTRAP_ERROR_COUNT;
|
|
41
48
|
exports.BOOTSTRAP_PREFIX = BOOTSTRAP_PREFIX;
|
|
49
|
+
exports.INIT = INIT;
|
|
50
|
+
exports.INIT_DURATION = INIT_DURATION;
|
|
51
|
+
exports.INIT_MODULE = INIT_MODULE;
|
|
52
|
+
exports.INIT_MODULE_COUNT = INIT_MODULE_COUNT;
|
|
53
|
+
exports.INIT_MODULE_DURATION = INIT_MODULE_DURATION;
|
|
42
54
|
exports.LOADER_PREFIX = LOADER_PREFIX;
|
|
43
55
|
exports.MAPPINGS_ERROR = MAPPINGS_ERROR;
|
|
44
56
|
exports.MAPPINGS_ERROR_COUNT = MAPPINGS_ERROR_COUNT;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
LWR.define('lwr/profiler/v/0_10_0', ['exports'], (function (exports) { 'use strict';
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
var Phase = /*#__PURE__*/function (Phase) {
|
|
9
|
+
Phase[Phase["Start"] = 0] = "Start";
|
|
10
|
+
Phase[Phase["End"] = 1] = "End";
|
|
11
|
+
return Phase;
|
|
12
|
+
}(Phase || {});
|
|
13
|
+
// Attach a custom dispatcher
|
|
14
|
+
let customDispatcher;
|
|
15
|
+
function attachDispatcher(dispatcher) {
|
|
16
|
+
customDispatcher = dispatcher;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Check if the Performance API is available
|
|
20
|
+
// e.g. JSDom (used in Jest) doesn't implement these
|
|
21
|
+
const perf = globalThis.performance;
|
|
22
|
+
const isPerfSupported = typeof perf !== 'undefined' && typeof perf.mark === 'function' && typeof perf.clearMarks === 'function' && typeof perf.measure === 'function' && typeof perf.clearMeasures === 'function';
|
|
23
|
+
function getMeasureName(id, specifier) {
|
|
24
|
+
return specifier ? `${id}-${specifier}` : id;
|
|
25
|
+
}
|
|
26
|
+
function getMarkName(id, specifier, specifierIndex) {
|
|
27
|
+
const measureName = getMeasureName(id, specifier);
|
|
28
|
+
return specifier && specifierIndex ? `${measureName}_${specifierIndex}` : measureName;
|
|
29
|
+
}
|
|
30
|
+
function getDetail(specifier, metadata) {
|
|
31
|
+
const detail = specifier || metadata ? _objectSpread({}, metadata) : null;
|
|
32
|
+
if (detail && specifier) {
|
|
33
|
+
detail['specifier'] = specifier;
|
|
34
|
+
}
|
|
35
|
+
return detail;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// For marking request metrics
|
|
39
|
+
// Fallback to the Performance API if there is no custom dispatcher
|
|
40
|
+
function logOperationStart({
|
|
41
|
+
id,
|
|
42
|
+
specifier,
|
|
43
|
+
specifierIndex,
|
|
44
|
+
metadata
|
|
45
|
+
}) {
|
|
46
|
+
if (customDispatcher) {
|
|
47
|
+
customDispatcher({
|
|
48
|
+
id,
|
|
49
|
+
phase: Phase.Start,
|
|
50
|
+
specifier,
|
|
51
|
+
metadata
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (isPerfSupported) {
|
|
56
|
+
const markName = getMarkName(id, specifier, specifierIndex);
|
|
57
|
+
const detail = getDetail(specifier, metadata);
|
|
58
|
+
perf.mark(markName, {
|
|
59
|
+
detail
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// For measuring duration metrics
|
|
65
|
+
// Fallback to the Performance API if there is no custom dispatcher
|
|
66
|
+
/* istanbul ignore next */
|
|
67
|
+
function logOperationEnd({
|
|
68
|
+
id,
|
|
69
|
+
specifier,
|
|
70
|
+
specifierIndex,
|
|
71
|
+
metadata
|
|
72
|
+
}) {
|
|
73
|
+
if (customDispatcher) {
|
|
74
|
+
customDispatcher({
|
|
75
|
+
id,
|
|
76
|
+
phase: Phase.End,
|
|
77
|
+
specifier,
|
|
78
|
+
metadata
|
|
79
|
+
});
|
|
80
|
+
} else if (isPerfSupported) {
|
|
81
|
+
const markName = getMarkName(id, specifier, specifierIndex);
|
|
82
|
+
const measureName = getMeasureName(id, specifier);
|
|
83
|
+
const detail = getDetail(specifier, metadata);
|
|
84
|
+
perf.measure(measureName, {
|
|
85
|
+
start: markName,
|
|
86
|
+
detail
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Clear the created mark and measure to avoid filling the performance entry buffer
|
|
90
|
+
// Even if they get deleted, existing PerformanceObservers preserve copies of the entries
|
|
91
|
+
perf.clearMarks(markName);
|
|
92
|
+
perf.clearMeasures(measureName);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
exports.attachDispatcher = attachDispatcher;
|
|
97
|
+
exports.logOperationEnd = logOperationEnd;
|
|
98
|
+
exports.logOperationStart = logOperationStart;
|
|
99
|
+
|
|
100
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
101
|
+
|
|
102
|
+
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwr/vault/v/0_10_0
|
|
1
|
+
LWR.define('lwr/vault/v/0_10_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
// Credential vault for storing setters and subscribers for OAuth info
|
|
4
4
|
// This module is a SINGLETON and must be excluded from ESM bundling
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR Error Shim v0.10.0
|
|
7
|
+
/* LWR Error Shim v0.10.0 */
|
|
8
8
|
!function(){"use strict";if(!(globalThis.LWR&&globalThis.LWR.define)){const o=new Error("The LWR application failed to bootstrap");if(!globalThis.LWR||!globalThis.LWR.onError)throw o;globalThis.LWR.onError(o)}}();
|
|
9
9
|
//# sourceMappingURL=lwr-error-shim.js.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR Module Loader Shim v0.10.0
|
|
7
|
+
/* LWR Module Loader Shim v0.10.0 */
|
|
8
8
|
(function () {
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -27,21 +27,46 @@
|
|
|
27
27
|
// e.g. JSDom (used in Jest) doesn't implement these
|
|
28
28
|
const perf = globalThis.performance;
|
|
29
29
|
const isPerfSupported = typeof perf !== 'undefined' && typeof perf.mark === 'function' && typeof perf.clearMarks === 'function' && typeof perf.measure === 'function' && typeof perf.clearMeasures === 'function';
|
|
30
|
+
function getMeasureName(id, specifier) {
|
|
31
|
+
return specifier ? `${id}-${specifier}` : id;
|
|
32
|
+
}
|
|
33
|
+
function getMarkName(id, specifier, specifierIndex) {
|
|
34
|
+
const measureName = getMeasureName(id, specifier);
|
|
35
|
+
return specifier && specifierIndex ? `${measureName}_${specifierIndex}` : measureName;
|
|
36
|
+
}
|
|
37
|
+
function getDetail(specifier, metadata) {
|
|
38
|
+
const detail = specifier || metadata ? {
|
|
39
|
+
...metadata
|
|
40
|
+
} : null;
|
|
41
|
+
if (detail && specifier) {
|
|
42
|
+
detail['specifier'] = specifier;
|
|
43
|
+
}
|
|
44
|
+
return detail;
|
|
45
|
+
}
|
|
30
46
|
|
|
31
47
|
// For marking request metrics
|
|
32
48
|
// Fallback to the Performance API if there is no custom dispatcher
|
|
33
49
|
function logOperationStart({
|
|
34
50
|
id,
|
|
35
|
-
specifier
|
|
51
|
+
specifier,
|
|
52
|
+
specifierIndex,
|
|
53
|
+
metadata
|
|
36
54
|
}) {
|
|
37
55
|
if (customDispatcher) {
|
|
38
56
|
customDispatcher({
|
|
39
57
|
id,
|
|
40
58
|
phase: Phase.Start,
|
|
41
|
-
specifier
|
|
59
|
+
specifier,
|
|
60
|
+
metadata
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (isPerfSupported) {
|
|
65
|
+
const markName = getMarkName(id, specifier, specifierIndex);
|
|
66
|
+
const detail = getDetail(specifier, metadata);
|
|
67
|
+
perf.mark(markName, {
|
|
68
|
+
detail
|
|
42
69
|
});
|
|
43
|
-
} else if (isPerfSupported) {
|
|
44
|
-
perf.mark(id + (specifier ? `.${specifier}` : ''));
|
|
45
70
|
}
|
|
46
71
|
}
|
|
47
72
|
|
|
@@ -50,19 +75,25 @@
|
|
|
50
75
|
/* istanbul ignore next */
|
|
51
76
|
function logOperationEnd({
|
|
52
77
|
id,
|
|
53
|
-
specifier
|
|
78
|
+
specifier,
|
|
79
|
+
specifierIndex,
|
|
80
|
+
metadata
|
|
54
81
|
}) {
|
|
55
82
|
if (customDispatcher) {
|
|
56
83
|
customDispatcher({
|
|
57
84
|
id,
|
|
58
85
|
phase: Phase.End,
|
|
59
|
-
specifier
|
|
86
|
+
specifier,
|
|
87
|
+
metadata
|
|
60
88
|
});
|
|
61
89
|
} else if (isPerfSupported) {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
perf.measure(measureName,
|
|
90
|
+
const markName = getMarkName(id, specifier, specifierIndex);
|
|
91
|
+
const measureName = getMeasureName(id, specifier);
|
|
92
|
+
const detail = getDetail(specifier, metadata);
|
|
93
|
+
perf.measure(measureName, {
|
|
94
|
+
start: markName,
|
|
95
|
+
detail
|
|
96
|
+
});
|
|
66
97
|
|
|
67
98
|
// Clear the created mark and measure to avoid filling the performance entry buffer
|
|
68
99
|
// Even if they get deleted, existing PerformanceObservers preserve copies of the entries
|
|
@@ -104,7 +135,7 @@
|
|
|
104
135
|
return loader;
|
|
105
136
|
}
|
|
106
137
|
|
|
107
|
-
const REQUIRED_MODULES_TIMEOUT =
|
|
138
|
+
const REQUIRED_MODULES_TIMEOUT = 60 * 1000; // 2m
|
|
108
139
|
|
|
109
140
|
// Check for errors with autoBoot and customInit
|
|
110
141
|
function validatePreInit(autoBoot, customInit) {
|
|
@@ -174,7 +205,7 @@
|
|
|
174
205
|
// Parse configuration
|
|
175
206
|
this.global = global;
|
|
176
207
|
this.config = global.LWR ;
|
|
177
|
-
this.loaderSpecifier = 'lwr/loader/v/0_10_0
|
|
208
|
+
this.loaderSpecifier = 'lwr/loader/v/0_10_0';
|
|
178
209
|
|
|
179
210
|
// Set up error handler
|
|
180
211
|
this.errorHandler = this.config.onError;
|
|
@@ -294,7 +325,7 @@
|
|
|
294
325
|
const exporter = (exports) => {
|
|
295
326
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
|
296
327
|
};
|
|
297
|
-
globalLWR.define('lwr/profiler/v/0_10_0
|
|
328
|
+
globalLWR.define('lwr/profiler/v/0_10_0', ['exports'], exporter);
|
|
298
329
|
}
|
|
299
330
|
|
|
300
331
|
// Set up the application globals, import map, root custom element...
|
|
@@ -366,15 +397,15 @@
|
|
|
366
397
|
// The loader module is ALWAYS required
|
|
367
398
|
const GLOBAL = globalThis ;
|
|
368
399
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
|
369
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_10_0
|
|
370
|
-
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_10_0
|
|
400
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_10_0') < 0) {
|
|
401
|
+
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_10_0');
|
|
371
402
|
}
|
|
372
403
|
new LoaderShim(GLOBAL);
|
|
373
404
|
|
|
374
405
|
})();
|
|
375
406
|
//# sourceMappingURL=lwr-loader-shim.js.map
|
|
376
407
|
|
|
377
|
-
LWR.define('lwr/loader/v/0_10_0
|
|
408
|
+
LWR.define('lwr/loader/v/0_10_0', ['exports'], (function (exports) { 'use strict';
|
|
378
409
|
|
|
379
410
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
380
411
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -948,7 +979,69 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
948
979
|
}
|
|
949
980
|
}
|
|
950
981
|
|
|
951
|
-
const MODULE_LOAD_TIMEOUT_TIMER =
|
|
982
|
+
const MODULE_LOAD_TIMEOUT_TIMER = 60 * 1000; // 1m
|
|
983
|
+
|
|
984
|
+
/*!
|
|
985
|
+
* Copyright (C) 2023 salesforce.com, inc.
|
|
986
|
+
*/
|
|
987
|
+
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
|
|
988
|
+
const SUPPORTS_TRUSTED_TYPES = typeof trustedTypes !== 'undefined';
|
|
989
|
+
function createTrustedTypesPolicy(name, options) {
|
|
990
|
+
// @ts-ignore: Prevent cannot find name 'trustedTypes' error.
|
|
991
|
+
return trustedTypes.createPolicy(name, options);
|
|
992
|
+
}
|
|
993
|
+
function createFallbackPolicy(_name, options) {
|
|
994
|
+
return options;
|
|
995
|
+
}
|
|
996
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/trusted-types
|
|
997
|
+
const createPolicy = SUPPORTS_TRUSTED_TYPES ? createTrustedTypesPolicy : createFallbackPolicy;
|
|
998
|
+
const policyOptions = {
|
|
999
|
+
createHTML(value) {
|
|
1000
|
+
return value;
|
|
1001
|
+
},
|
|
1002
|
+
createScript(value) {
|
|
1003
|
+
return value;
|
|
1004
|
+
},
|
|
1005
|
+
createScriptURL(value) {
|
|
1006
|
+
return value;
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
// Temporarily surround in try-catch until migration to AMD run.
|
|
1010
|
+
try {
|
|
1011
|
+
createPolicy('default', {
|
|
1012
|
+
createHTML(dirty) {
|
|
1013
|
+
// Treat null & undefined separately
|
|
1014
|
+
if (dirty === 'null' || dirty === 'undefined') {
|
|
1015
|
+
return dirty;
|
|
1016
|
+
}
|
|
1017
|
+
return dirty;
|
|
1018
|
+
},
|
|
1019
|
+
// Ignore typescript type validation for this policy.
|
|
1020
|
+
// Returning `undefined` from a TT policy blocks usages
|
|
1021
|
+
// of specific DOM sinks affected by this hook.
|
|
1022
|
+
// We want to block eval and inline scripts.
|
|
1023
|
+
// @ts-ignore
|
|
1024
|
+
createScript(dirty) {
|
|
1025
|
+
// Treat null & undefined separately
|
|
1026
|
+
if (dirty === 'null' || dirty === 'undefined') {
|
|
1027
|
+
return dirty;
|
|
1028
|
+
}
|
|
1029
|
+
// Block script evaluation
|
|
1030
|
+
return undefined;
|
|
1031
|
+
},
|
|
1032
|
+
createScriptURL(dirty) {
|
|
1033
|
+
// Treat null & undefined separately
|
|
1034
|
+
if (dirty === 'null' || dirty === 'undefined') {
|
|
1035
|
+
return dirty;
|
|
1036
|
+
}
|
|
1037
|
+
return dirty;
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
} catch (_unused) {
|
|
1041
|
+
// swallow
|
|
1042
|
+
}
|
|
1043
|
+
const trusted = createPolicy('trusted', policyOptions);
|
|
1044
|
+
/*! version: 0.19.10 */
|
|
952
1045
|
|
|
953
1046
|
/* global console,process */
|
|
954
1047
|
|
|
@@ -1017,7 +1110,7 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
1017
1110
|
code = `${code}\n//# sourceURL=${id}`; // append sourceURL for debugging
|
|
1018
1111
|
try {
|
|
1019
1112
|
// TODO eval source maps for debugging
|
|
1020
|
-
eval(code);
|
|
1113
|
+
eval(trusted.createScript(code));
|
|
1021
1114
|
} catch (e) {
|
|
1022
1115
|
throw new LoaderError(FAIL_LOAD, [id]);
|
|
1023
1116
|
}
|
|
@@ -1141,6 +1234,9 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
1141
1234
|
// eslint-disable-next-line no-await-in-loop
|
|
1142
1235
|
result = isResponseAPromise(response) ? await response : response;
|
|
1143
1236
|
}
|
|
1237
|
+
if (!this.isValidResolveResponse(result)) {
|
|
1238
|
+
throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
|
|
1239
|
+
}
|
|
1144
1240
|
|
|
1145
1241
|
// if result is not null, attempt resolution
|
|
1146
1242
|
if (result !== null) {
|
|
@@ -1669,6 +1765,12 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
1669
1765
|
this.handleStaleModuleHook = [handleStaleModule];
|
|
1670
1766
|
}
|
|
1671
1767
|
}
|
|
1768
|
+
|
|
1769
|
+
isValidResolveResponse(res) {
|
|
1770
|
+
return (
|
|
1771
|
+
res === null || typeof res === 'string' || (res && typeof (res ).url === 'string')
|
|
1772
|
+
);
|
|
1773
|
+
}
|
|
1672
1774
|
}
|
|
1673
1775
|
|
|
1674
1776
|
/**
|
|
@@ -1809,3 +1911,4 @@ LWR.define('lwr/loader/v/0_10_0-alpha_8', ['exports'], (function (exports) { 'us
|
|
|
1809
1911
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1810
1912
|
|
|
1811
1913
|
}));
|
|
1914
|
+
//# sourceMappingURL=lwr-loader-shim.bundle.js.map
|