@lwrjs/everywhere 0.12.0-alpha.17 → 0.12.0-alpha.19
Sign up to get free protection for your applications and to get access to all the features.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/08723ea0a65554c7a931779934247206/config.js +12 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_19/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{6_2_0/s/99eeb2c6eef76200d6f77e8a9895ea90 → 6_2_1/s/2670f5386c68fa67ae710174187505e9}/lwc.js +252 -53
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/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_12_0-alpha_17 → 0_12_0-alpha_19}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +21 -21
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_12_0-alpha_17/s/7d88cdd63afd9a8457f758efa6852edc → 0_12_0-alpha_19/s/bfa35394789428d30613fedf7507d1fd}/lwr_loader.js +132 -126
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/s/274c8343f810353bbad085a79709395f/lwr_metrics.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/s/ec0fad0e38a96bb0b88c9f4553460347/lwr_preInit.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_12_0-alpha_17 → 0_12_0-alpha_19}/lwr-loader-shim.bundle.js +163 -131
- package/build/assets/amd/lwr-everywhere-debug.js +165 -133
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +165 -133
- package/build/assets/core/lwr-everywhere-debug.js +161 -129
- package/build/assets/core/lwr-everywhere-min.js +1 -1
- package/build/assets/core/lwr-everywhere.js +161 -129
- 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/package.json +7 -7
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/34c06e93feddef614c5592d6a251f1e1/config.js +0 -12
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_17/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
@@ -1,10 +1,10 @@
|
|
1
|
-
LWR.define('lwr/everywhereAmd/v/0_12_0-
|
1
|
+
LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_19', ['exports', 'lwr/vault/v/0_12_0-alpha_19'], (function (exports, _0_12_0Alpha_19) { 'use strict';
|
2
2
|
|
3
3
|
// IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
|
4
4
|
|
5
5
|
// Do an OAuthed fetch
|
6
6
|
async function authFetch(url, accept = 'javascript') {
|
7
|
-
const authInfo =
|
7
|
+
const authInfo = _0_12_0Alpha_19.getAuthInfo();
|
8
8
|
if (authInfo) {
|
9
9
|
return fetch(url, {
|
10
10
|
headers: {
|
@@ -53,7 +53,7 @@ LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_17', ['exports', 'lwr/vault/v/0_12_
|
|
53
53
|
function authenticate(authInfo) {
|
54
54
|
// Put OAuth info into the vault
|
55
55
|
if (authInfo) {
|
56
|
-
|
56
|
+
_0_12_0Alpha_19.setAuthInfo(authInfo);
|
57
57
|
}
|
58
58
|
}
|
59
59
|
|
@@ -1,16 +1,16 @@
|
|
1
|
-
LWR.define('lwr/init/v/0_12_0-
|
1
|
+
LWR.define('lwr/init/v/0_12_0-alpha_19', ['exports', 'lwr/metrics/v/0_12_0-alpha_19', 'lwr/profiler/v/0_12_0-alpha_19', 'lwc/v/6_2_1'], (function (exports, _0_12_0Alpha_19$1, _0_12_0Alpha_19, _6_2_1) { 'use strict';
|
2
2
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
4
4
|
|
5
5
|
// <hydrateComponentProxy> - This code is removed in core
|
6
6
|
|
7
7
|
function hydrateComponentProxy(customElement, Ctor, props) {
|
8
|
-
|
8
|
+
_6_2_1.hydrateComponent(customElement, Ctor, props);
|
9
9
|
}
|
10
10
|
// </hydrateComponentProxy>
|
11
11
|
|
12
12
|
function initializeWebComponent(elementName, Ctor) {
|
13
|
-
return
|
13
|
+
return _6_2_1.createElement(elementName, {
|
14
14
|
is: Ctor
|
15
15
|
});
|
16
16
|
}
|
@@ -47,13 +47,13 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
47
47
|
*/
|
48
48
|
function init(rootModules, serverData = {}) {
|
49
49
|
if (typeof customElements === 'undefined' || typeof document === 'undefined') {
|
50
|
-
|
51
|
-
id:
|
50
|
+
_0_12_0Alpha_19.logOperationStart({
|
51
|
+
id: _0_12_0Alpha_19$1.BOOTSTRAP_END
|
52
52
|
});
|
53
53
|
return;
|
54
54
|
}
|
55
|
-
|
56
|
-
id:
|
55
|
+
_0_12_0Alpha_19.logOperationStart({
|
56
|
+
id: _0_12_0Alpha_19$1.INIT
|
57
57
|
});
|
58
58
|
let index = 0;
|
59
59
|
for (const [specifier, ctor] of rootModules) {
|
@@ -61,8 +61,8 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
61
61
|
|
62
62
|
// initialize and inject the root module into the LWR Root or DOM if it is missing
|
63
63
|
if (!document.body.querySelector(elementName)) {
|
64
|
-
|
65
|
-
id:
|
64
|
+
_0_12_0Alpha_19.logOperationStart({
|
65
|
+
id: _0_12_0Alpha_19$1.INIT_MODULE,
|
66
66
|
specifier,
|
67
67
|
specifierIndex: ++index
|
68
68
|
});
|
@@ -71,8 +71,8 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
71
71
|
const component = initializeWebComponent(elementName, ctor);
|
72
72
|
const container = document.querySelector('[lwr-root]');
|
73
73
|
container ? container.appendChild(component) : document.body.appendChild(component);
|
74
|
-
|
75
|
-
id:
|
74
|
+
_0_12_0Alpha_19.logOperationEnd({
|
75
|
+
id: _0_12_0Alpha_19$1.INIT_MODULE,
|
76
76
|
specifier,
|
77
77
|
specifierIndex: index,
|
78
78
|
metadata: {
|
@@ -85,8 +85,8 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
85
85
|
// the page has been rendered or SSR'd, and each component needs to initialized(or hydrated)
|
86
86
|
const elements = document.querySelectorAll(elementName);
|
87
87
|
for (const element of elements) {
|
88
|
-
|
89
|
-
id:
|
88
|
+
_0_12_0Alpha_19.logOperationStart({
|
89
|
+
id: _0_12_0Alpha_19$1.INIT_MODULE,
|
90
90
|
specifier,
|
91
91
|
specifierIndex: ++index
|
92
92
|
});
|
@@ -97,8 +97,8 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
97
97
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
98
98
|
// @ts-ignore
|
99
99
|
hydrateComponentProxy(element, ctor, serverData[propsId] || {});
|
100
|
-
|
101
|
-
id:
|
100
|
+
_0_12_0Alpha_19.logOperationEnd({
|
101
|
+
id: _0_12_0Alpha_19$1.INIT_MODULE,
|
102
102
|
specifier,
|
103
103
|
specifierIndex: index,
|
104
104
|
metadata: {
|
@@ -136,8 +136,8 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
136
136
|
if (parent) {
|
137
137
|
parent.replaceChild(component, element);
|
138
138
|
}
|
139
|
-
|
140
|
-
id:
|
139
|
+
_0_12_0Alpha_19.logOperationEnd({
|
140
|
+
id: _0_12_0Alpha_19$1.INIT_MODULE,
|
141
141
|
specifier,
|
142
142
|
specifierIndex: index,
|
143
143
|
metadata: {
|
@@ -146,11 +146,11 @@ LWR.define('lwr/init/v/0_12_0-alpha_17', ['exports', 'lwr/metrics/v/0_12_0-alpha
|
|
146
146
|
});
|
147
147
|
}
|
148
148
|
}
|
149
|
-
|
150
|
-
id:
|
149
|
+
_0_12_0Alpha_19.logOperationEnd({
|
150
|
+
id: _0_12_0Alpha_19$1.INIT
|
151
151
|
});
|
152
|
-
|
153
|
-
id:
|
152
|
+
_0_12_0Alpha_19.logOperationStart({
|
153
|
+
id: _0_12_0Alpha_19$1.BOOTSTRAP_END
|
154
154
|
});
|
155
155
|
}
|
156
156
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/loader/v/0_12_0-
|
1
|
+
LWR.define('lwr/loader/v/0_12_0-alpha_19', ['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_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
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.12.0-alpha.
|
9
|
+
/* LWR Module Loader v0.12.0-alpha.19 */
|
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_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
25
25
|
super();
|
26
26
|
this.message = generateErrorMessage(errorInfo, errorArgs);
|
27
27
|
}
|
28
|
-
/*LWC compiler v6.2.
|
28
|
+
/*LWC compiler v6.2.1*/
|
29
29
|
}
|
30
30
|
function invariant(condition, errorInfo) {
|
31
31
|
if (!condition) {
|
@@ -697,18 +697,6 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
697
697
|
/* global console,process */
|
698
698
|
|
699
699
|
class ModuleRegistry {
|
700
|
-
// A registry for named AMD defines containing the *metadata* of AMD module
|
701
|
-
__init() {
|
702
|
-
this.namedDefineRegistry = new Map();
|
703
|
-
}
|
704
|
-
// The evaluated module registry where the module identifier (name or URL?) is the key
|
705
|
-
__init2() {
|
706
|
-
this.moduleRegistry = new Map();
|
707
|
-
}
|
708
|
-
// Aliases of modules in the registry
|
709
|
-
__init3() {
|
710
|
-
this.aliases = new Map();
|
711
|
-
}
|
712
700
|
constructor(config) {
|
713
701
|
ModuleRegistry.prototype.__init.call(this);
|
714
702
|
ModuleRegistry.prototype.__init2.call(this);
|
@@ -716,10 +704,6 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
716
704
|
this.profiler = config.profiler;
|
717
705
|
this.resolver = new ImportMetadataResolver(config, this.importMetadataInvalidationCallback.bind(this));
|
718
706
|
}
|
719
|
-
|
720
|
-
/**
|
721
|
-
* Module import
|
722
|
-
*/
|
723
707
|
async load(id, importer) {
|
724
708
|
const metadata = importer ? {
|
725
709
|
importer
|
@@ -730,20 +714,16 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
730
714
|
metadata
|
731
715
|
});
|
732
716
|
const resolvedId = await this.resolve(id, importer);
|
733
|
-
const moduleRecord = this.getModuleRecord(resolvedId, id);
|
717
|
+
const moduleRecord = await this.getModuleRecord(resolvedId, id);
|
734
718
|
if (moduleRecord.evaluated) {
|
735
719
|
return moduleRecord.module;
|
736
720
|
} else {
|
737
721
|
if (!moduleRecord.evaluationPromise) {
|
738
|
-
moduleRecord.evaluationPromise = this.
|
722
|
+
moduleRecord.evaluationPromise = this.topLevelEvaluation(moduleRecord);
|
739
723
|
}
|
740
724
|
return moduleRecord.evaluationPromise;
|
741
725
|
}
|
742
726
|
}
|
743
|
-
|
744
|
-
/**
|
745
|
-
* Resolve id for a module
|
746
|
-
*/
|
747
727
|
async resolve(id, importer) {
|
748
728
|
const parentUrl = this.resolver.getBaseUrl(); // only support baseUrl for now
|
749
729
|
|
@@ -761,7 +741,7 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
761
741
|
// eslint-disable-next-line no-await-in-loop
|
762
742
|
result = isResponseAPromise(response) ? await response : response;
|
763
743
|
}
|
764
|
-
if (!isValidResolveResponse(result)) {
|
744
|
+
if (!this.isValidResolveResponse(result)) {
|
765
745
|
throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
|
766
746
|
}
|
767
747
|
|
@@ -836,10 +816,6 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
836
816
|
has(id) {
|
837
817
|
return this.moduleRegistry.has(id);
|
838
818
|
}
|
839
|
-
|
840
|
-
/**
|
841
|
-
* Module entry point LWR.define()
|
842
|
-
*/
|
843
819
|
define(name, dependencies, exporter) {
|
844
820
|
const mod = this.namedDefineRegistry.get(name);
|
845
821
|
// Don't allow redefining a module.
|
@@ -906,6 +882,21 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
906
882
|
}
|
907
883
|
});
|
908
884
|
}
|
885
|
+
|
886
|
+
// A registry for named AMD defines containing the *metadata* of AMD module
|
887
|
+
__init() {
|
888
|
+
this.namedDefineRegistry = new Map();
|
889
|
+
}
|
890
|
+
|
891
|
+
// The evaluated module registry where the module identifier (name or URL?) is the key
|
892
|
+
__init2() {
|
893
|
+
this.moduleRegistry = new Map();
|
894
|
+
}
|
895
|
+
|
896
|
+
// Aliases of modules in the registry
|
897
|
+
__init3() {
|
898
|
+
this.aliases = new Map();
|
899
|
+
}
|
909
900
|
getImportMetadataResolver() {
|
910
901
|
return this.resolver;
|
911
902
|
}
|
@@ -930,23 +921,41 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
930
921
|
}
|
931
922
|
return moduleRecord;
|
932
923
|
}
|
933
|
-
getModuleRecord(resolvedId, id) {
|
924
|
+
async getModuleRecord(resolvedId, id) {
|
934
925
|
// Look for an existing record
|
935
926
|
const existingRecord = this.getExistingModuleRecord(resolvedId, id);
|
936
927
|
if (existingRecord) {
|
937
928
|
// return existing
|
938
929
|
return existingRecord;
|
939
930
|
}
|
931
|
+
|
932
|
+
// Create a new Module Record
|
933
|
+
const instantiation = this.getModuleDef(resolvedId, id);
|
934
|
+
const dependencyRecords = instantiation.then(moduleDef => {
|
935
|
+
const dependencies = moduleDef.dependencies || [];
|
936
|
+
// get dep and filter out exports
|
937
|
+
const filtered = dependencies.map(dep => {
|
938
|
+
if (dep === 'exports') {
|
939
|
+
return;
|
940
|
+
}
|
941
|
+
invariant(dep !== 'require', NO_AMD_REQUIRE);
|
942
|
+
return this.getModuleDependencyRecord.call(this, dep);
|
943
|
+
}).filter(depRecord => depRecord !== undefined);
|
944
|
+
return Promise.all(filtered);
|
945
|
+
});
|
940
946
|
const newModuleRecord = {
|
941
947
|
id: resolvedId,
|
942
948
|
module: Object.create(null),
|
943
|
-
|
949
|
+
dependencyRecords,
|
950
|
+
instantiation,
|
944
951
|
evaluated: false,
|
945
952
|
evaluationPromise: null
|
946
953
|
};
|
947
954
|
this.moduleRegistry.set(resolvedId, newModuleRecord);
|
948
955
|
this.storeModuleAlias(id, resolvedId);
|
949
|
-
|
956
|
+
|
957
|
+
// Wait for the dependencies to resolve the return the moduleRecord
|
958
|
+
return dependencyRecords.then(() => newModuleRecord);
|
950
959
|
}
|
951
960
|
storeModuleAlias(aliasId, resolvedId) {
|
952
961
|
if (aliasId !== resolvedId) {
|
@@ -965,87 +974,82 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
965
974
|
}
|
966
975
|
}
|
967
976
|
}
|
977
|
+
async getModuleDependencyRecord(dependency) {
|
978
|
+
const resolvedDepId = await this.resolve(dependency);
|
979
|
+
return this.getModuleRecord(resolvedDepId, dependency);
|
980
|
+
}
|
968
981
|
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
const exports = {};
|
974
|
-
const promiseArray = [];
|
975
|
-
if (dependencies) {
|
976
|
-
for (const dep of dependencies) {
|
977
|
-
if (dep === 'exports') {
|
978
|
-
promiseArray.push(Promise.resolve(exports));
|
979
|
-
} else {
|
980
|
-
invariant(dep !== 'require', NO_AMD_REQUIRE);
|
981
|
-
promiseArray.push(this.evaluateDependent(dep, evaluationMap));
|
982
|
-
}
|
983
|
-
}
|
984
|
-
}
|
985
|
-
return Promise.all(promiseArray).then(results => {
|
986
|
-
const depsMapped = results.filter(result => result !== undefined);
|
987
|
-
return {
|
988
|
-
depsMapped,
|
989
|
-
exports
|
990
|
-
};
|
991
|
-
});
|
982
|
+
// execute the "top-level code" (the code outside of functions) of a module
|
983
|
+
async topLevelEvaluation(moduleRecord) {
|
984
|
+
await this.instantiateAll(moduleRecord, {});
|
985
|
+
return this.evaluateModule(moduleRecord, {});
|
992
986
|
}
|
993
|
-
async evaluateDependent(dep, evaluationMap) {
|
994
|
-
const resolvedDepId = await this.resolve(dep);
|
995
|
-
const depModuleRecord = this.getModuleRecord(resolvedDepId, dep);
|
996
|
-
let module = depModuleRecord.module;
|
997
|
-
const handleReturn = module => {
|
998
|
-
if (module) {
|
999
|
-
return module.__defaultInterop ? module.default : module;
|
1000
|
-
}
|
1001
|
-
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
1002
|
-
};
|
1003
987
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
// If we have not started dependency evaluation kick it off
|
1016
|
-
if (!depModuleRecord.evaluationPromise) {
|
1017
|
-
depModuleRecord.evaluationPromise = this.evaluateModule(depModuleRecord, evaluationMap);
|
988
|
+
// Returns a promise when a module and all of it's dependencies have finished instantiation
|
989
|
+
async instantiateAll(moduleRecord, instantiatedMap) {
|
990
|
+
if (!instantiatedMap[moduleRecord.id]) {
|
991
|
+
instantiatedMap[moduleRecord.id] = true;
|
992
|
+
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
993
|
+
if (dependencyModuleRecords) {
|
994
|
+
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
995
|
+
const depRecord = dependencyModuleRecords[i];
|
996
|
+
// eslint-disable-next-line no-await-in-loop
|
997
|
+
await this.instantiateAll(depRecord, instantiatedMap);
|
998
|
+
}
|
1018
999
|
}
|
1019
|
-
return depModuleRecord.evaluationPromise.then(module => {
|
1020
|
-
return handleReturn(module);
|
1021
|
-
});
|
1022
|
-
} else {
|
1023
|
-
// Otherwise return a dummy circular module wrapper
|
1024
|
-
module = getCircularDependencyWrapper(module);
|
1025
1000
|
}
|
1026
|
-
return handleReturn(module);
|
1027
1001
|
}
|
1028
1002
|
async evaluateModule(moduleRecord, evaluationMap) {
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
// Wait for load to finish
|
1003
|
+
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
1004
|
+
if (dependencyModuleRecords.length > 0) {
|
1005
|
+
evaluationMap[moduleRecord.id] = true;
|
1006
|
+
// evaluate dependencies first
|
1007
|
+
await this.evaluateModuleDependencies(dependencyModuleRecords, evaluationMap);
|
1008
|
+
}
|
1036
1009
|
const {
|
1037
1010
|
exporter,
|
1038
1011
|
dependencies
|
1039
1012
|
} = await moduleRecord.instantiation;
|
1013
|
+
// The exports object automatically gets filled in by the exporter evaluation
|
1014
|
+
const exports = {};
|
1015
|
+
const depsMapped = dependencies ? await Promise.all(dependencies.map(async dep => {
|
1016
|
+
if (dep === 'exports') {
|
1017
|
+
return exports;
|
1018
|
+
}
|
1019
|
+
const resolvedDepId = await this.resolve(dep);
|
1020
|
+
const moduleRecord = this.moduleRegistry.get(resolvedDepId);
|
1021
|
+
if (!moduleRecord) {
|
1022
|
+
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
1023
|
+
}
|
1024
|
+
const module = moduleRecord.module;
|
1040
1025
|
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1026
|
+
/**
|
1027
|
+
* Circular dependencies are handled properly when named exports are used,
|
1028
|
+
* however, for default exports there is a bug: https://github.com/rollup/rollup/issues/3384
|
1029
|
+
*
|
1030
|
+
* The workaround below applies for circular dependencies (!moduleRecord.evaluated)
|
1031
|
+
*/
|
1032
|
+
if (!moduleRecord.evaluated) {
|
1033
|
+
return this.getCircularDependencyWrapper(module);
|
1034
|
+
}
|
1035
|
+
if (module) {
|
1036
|
+
return module.__defaultInterop ? module.default : module;
|
1037
|
+
}
|
1038
|
+
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
1039
|
+
})) : [];
|
1040
|
+
|
1041
|
+
// W-10029836 - In the case where we could be instantiating multiple graphs at the same time lets make sure the module have not already been evaluated
|
1042
|
+
if (moduleRecord.evaluated) {
|
1043
|
+
return moduleRecord.module;
|
1044
|
+
}
|
1046
1045
|
|
1047
1046
|
// evaluates the module function
|
1048
|
-
let moduleDefault
|
1047
|
+
let moduleDefault;
|
1048
|
+
try {
|
1049
|
+
moduleDefault = exporter(...depsMapped);
|
1050
|
+
} catch (e) {
|
1051
|
+
throw new LoaderError(EXPORTER_ERROR, [moduleRecord.id, e.message || e]);
|
1052
|
+
}
|
1049
1053
|
// value is returned from exporter, then we are not using named exports
|
1050
1054
|
if (moduleDefault !== undefined) {
|
1051
1055
|
moduleDefault = {
|
@@ -1061,7 +1065,7 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
1061
1065
|
// if no return value, then we are using the exports object
|
1062
1066
|
else {
|
1063
1067
|
// handle only default export with Rollup forced named exports
|
1064
|
-
if (isNamedExportDefaultOnly(exports)) {
|
1068
|
+
if (this.isNamedExportDefaultOnly(exports)) {
|
1065
1069
|
Object.defineProperty(exports, '__useDefault', {
|
1066
1070
|
value: true
|
1067
1071
|
});
|
@@ -1099,16 +1103,33 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
1099
1103
|
value: true
|
1100
1104
|
});
|
1101
1105
|
}
|
1102
|
-
Object.freeze(moduleRecord.module);
|
1103
1106
|
moduleRecord.evaluated = true;
|
1104
|
-
moduleRecord.
|
1107
|
+
Object.freeze(moduleRecord.module);
|
1105
1108
|
return moduleRecord.module;
|
1106
1109
|
}
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1110
|
+
|
1111
|
+
// Determines if named exports module has only default export
|
1112
|
+
isNamedExportDefaultOnly(exports) {
|
1113
|
+
return exports !== undefined && Object.getOwnPropertyNames(exports).length === 2 && Object.prototype.hasOwnProperty.call(exports, 'default') && Object.prototype.hasOwnProperty.call(exports, '__esModule');
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
1117
|
+
// The LWC engine checks for __circular__ to detect circular dependencies.
|
1118
|
+
getCircularDependencyWrapper(module) {
|
1119
|
+
const tmp = () => {
|
1120
|
+
return module.__useDefault || module.__defaultInterop ? module.default : module;
|
1121
|
+
};
|
1122
|
+
tmp.__circular__ = true;
|
1123
|
+
return tmp;
|
1124
|
+
}
|
1125
|
+
async evaluateModuleDependencies(dependencyModuleRecords, evaluationMap) {
|
1126
|
+
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
1127
|
+
const depRecord = dependencyModuleRecords[i];
|
1128
|
+
if (!depRecord.evaluated && !evaluationMap[depRecord.id]) {
|
1129
|
+
evaluationMap[depRecord.id] = true;
|
1130
|
+
// eslint-disable-next-line no-await-in-loop
|
1131
|
+
await this.evaluateModule(depRecord, evaluationMap);
|
1132
|
+
}
|
1112
1133
|
}
|
1113
1134
|
}
|
1114
1135
|
async getModuleDef(resolvedId, originalId) {
|
@@ -1235,24 +1256,9 @@ LWR.define('lwr/loader/v/0_12_0-alpha_17', ['exports'], (function (exports) { 'u
|
|
1235
1256
|
this.handleStaleModuleHook = [handleStaleModule];
|
1236
1257
|
}
|
1237
1258
|
}
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
function isNamedExportDefaultOnly(exports) {
|
1242
|
-
return exports !== undefined && Object.getOwnPropertyNames(exports).length === 2 && Object.prototype.hasOwnProperty.call(exports, 'default') && Object.prototype.hasOwnProperty.call(exports, '__esModule');
|
1243
|
-
}
|
1244
|
-
|
1245
|
-
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
1246
|
-
// The LWC engine checks for __circular__ to detect circular dependencies.
|
1247
|
-
function getCircularDependencyWrapper(module) {
|
1248
|
-
const tmp = () => {
|
1249
|
-
return module.__useDefault || module.__defaultInterop ? module.default : module;
|
1250
|
-
};
|
1251
|
-
tmp.__circular__ = true;
|
1252
|
-
return tmp;
|
1253
|
-
}
|
1254
|
-
function isValidResolveResponse(res) {
|
1255
|
-
return res === null || typeof res === 'string' || res && typeof res.url === 'string';
|
1259
|
+
isValidResolveResponse(res) {
|
1260
|
+
return res === null || typeof res === 'string' || res && typeof res.url === 'string';
|
1261
|
+
}
|
1256
1262
|
}
|
1257
1263
|
|
1258
1264
|
/**
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/preInit/v/0_12_0-
|
1
|
+
LWR.define('lwr/preInit/v/0_12_0-alpha_19', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* This module is called in the ABS module (app bootstrap module) to perform neccesary pre initialization steps for an LWR app.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/profiler/v/0_12_0-
|
1
|
+
LWR.define('lwr/profiler/v/0_12_0-alpha_19', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
var Phase = /*#__PURE__*/function (Phase) {
|
4
4
|
Phase[Phase["Start"] = 0] = "Start";
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LWR.define('lwr/vault/v/0_12_0-
|
1
|
+
LWR.define('lwr/vault/v/0_12_0-alpha_19', ['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,5 +4,5 @@
|
|
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.12.0-alpha.
|
7
|
+
/* LWR Error Shim v0.12.0-alpha.19 */
|
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)}}();
|