@lwrjs/everywhere 0.12.0-alpha.8 → 0.12.0
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/df4f11f4c507d2642c60586ccecb3925/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/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_1_1/s/97cfd3dd664529265351b5d32d878542 → 6_3_4/s/5c26ade60a97bb24c64d3829320b13f6}/lwc.js +594 -284
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_12_0-alpha_8 → 0_12_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_12_0-alpha_8 → 0_12_0}/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_8/s/defdc8250ae07a7f1997e7288f4130fa → 0_12_0/s/54d81ef8f325e2cee9def25bdf12bfe8}/lwr_loader.js +133 -127
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_12_0-alpha_8 → 0_12_0}/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_8/s/f3a204ef43fb3057d910f80d7e9f9ba7 → 0_12_0/s/ec0fad0e38a96bb0b88c9f4553460347}/lwr_preInit.js +4 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_12_0-alpha_8 → 0_12_0}/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_8 → 0_12_0}/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_8 → 0_12_0}/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_8 → 0_12_0}/lwr-loader-shim.bundle.js +167 -134
- package/build/assets/amd/lwr-everywhere-debug.js +168 -136
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +168 -136
- package/build/assets/core/lwr-everywhere-debug.js +164 -132
- package/build/assets/core/lwr-everywhere-min.js +1 -1
- package/build/assets/core/lwr-everywhere.js +164 -132
- 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 +9 -9
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/e050122262c9c7eb0f9fb8b85f52e5b3/config.js +0 -11
- 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_8/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
@@ -20,7 +20,7 @@ function getConfiguration(options) {
|
|
20
20
|
: `${ORIGIN}${PREFIX}/module/${format}/${POSTFIX}/mi/`;
|
21
21
|
|
22
22
|
// Component specifiers and URIs
|
23
|
-
const BOOT_MODULE = `lwr/everywhere${format === 'esm' ? 'Esm' : 'Amd'}/v/0_12_0
|
23
|
+
const BOOT_MODULE = `lwr/everywhere${format === 'esm' ? 'Esm' : 'Amd'}/v/0_12_0`;
|
24
24
|
const BOOT_URI = `${ENDPOINT}${encodeURIComponent(BOOT_MODULE)}/latest${debug ? '?debug' : ''}`;
|
25
25
|
|
26
26
|
// Client Bootstrap Config
|
@@ -52,7 +52,7 @@ function getConfiguration(options) {
|
|
52
52
|
* SPDX-License-Identifier: MIT
|
53
53
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
54
54
|
*/
|
55
|
-
/* LWR Module Loader v0.12.0
|
55
|
+
/* LWR Module Loader v0.12.0 */
|
56
56
|
const templateRegex = /\{([0-9]+)\}/g;
|
57
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
58
58
|
function templateString(template, args) {
|
@@ -694,7 +694,7 @@ try {
|
|
694
694
|
// swallow
|
695
695
|
}
|
696
696
|
const trusted = createPolicy('trusted', policyOptions);
|
697
|
-
/*! version: 0.21.
|
697
|
+
/*! version: 0.21.4 */
|
698
698
|
|
699
699
|
/* global console,process */
|
700
700
|
|
@@ -846,22 +846,13 @@ async function evaluateLoadHook(
|
|
846
846
|
|
847
847
|
|
848
848
|
|
849
|
+
|
850
|
+
|
849
851
|
|
850
852
|
|
851
853
|
|
852
854
|
class ModuleRegistry {
|
853
855
|
|
854
|
-
|
855
|
-
// A registry for named AMD defines containing the *metadata* of AMD module
|
856
|
-
__init() {this.namedDefineRegistry = new Map();}
|
857
|
-
// The evaluated module registry where the module identifier (name or URL?) is the key
|
858
|
-
__init2() {this.moduleRegistry = new Map();}
|
859
|
-
// Aliases of modules in the registry
|
860
|
-
__init3() {this.aliases = new Map();}
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
856
|
|
866
857
|
constructor(config) {ModuleRegistry.prototype.__init.call(this);ModuleRegistry.prototype.__init2.call(this);ModuleRegistry.prototype.__init3.call(this);
|
867
858
|
this.profiler = config.profiler;
|
@@ -871,9 +862,6 @@ class ModuleRegistry {
|
|
871
862
|
);
|
872
863
|
}
|
873
864
|
|
874
|
-
/**
|
875
|
-
* Module import
|
876
|
-
*/
|
877
865
|
async load(id, importer) {
|
878
866
|
const metadata = importer ? { importer } : {};
|
879
867
|
this.profiler.logOperationStart({
|
@@ -881,23 +869,18 @@ class ModuleRegistry {
|
|
881
869
|
specifier: id,
|
882
870
|
metadata,
|
883
871
|
});
|
884
|
-
|
885
872
|
const resolvedId = await this.resolve(id, importer);
|
886
|
-
const moduleRecord = this.getModuleRecord(resolvedId, id);
|
887
|
-
|
873
|
+
const moduleRecord = await this.getModuleRecord(resolvedId, id);
|
888
874
|
if (moduleRecord.evaluated) {
|
889
875
|
return moduleRecord.module;
|
890
876
|
} else {
|
891
877
|
if (!moduleRecord.evaluationPromise) {
|
892
|
-
moduleRecord.evaluationPromise = this.
|
878
|
+
moduleRecord.evaluationPromise = this.topLevelEvaluation(moduleRecord);
|
893
879
|
}
|
894
880
|
return moduleRecord.evaluationPromise;
|
895
881
|
}
|
896
882
|
}
|
897
883
|
|
898
|
-
/**
|
899
|
-
* Resolve id for a module
|
900
|
-
*/
|
901
884
|
async resolve(id, importer) {
|
902
885
|
const parentUrl = this.resolver.getBaseUrl(); // only support baseUrl for now
|
903
886
|
|
@@ -913,7 +896,7 @@ class ModuleRegistry {
|
|
913
896
|
// eslint-disable-next-line no-await-in-loop
|
914
897
|
result = isResponseAPromise(response) ? await response : response;
|
915
898
|
}
|
916
|
-
if (!isValidResolveResponse(result)) {
|
899
|
+
if (!this.isValidResolveResponse(result)) {
|
917
900
|
throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
|
918
901
|
}
|
919
902
|
|
@@ -999,9 +982,6 @@ class ModuleRegistry {
|
|
999
982
|
return this.moduleRegistry.has(id);
|
1000
983
|
}
|
1001
984
|
|
1002
|
-
/**
|
1003
|
-
* Module entry point LWR.define()
|
1004
|
-
*/
|
1005
985
|
define(name, dependencies, exporter) {
|
1006
986
|
const mod = this.namedDefineRegistry.get(name);
|
1007
987
|
// Don't allow redefining a module.
|
@@ -1068,6 +1048,19 @@ class ModuleRegistry {
|
|
1068
1048
|
});
|
1069
1049
|
}
|
1070
1050
|
|
1051
|
+
|
1052
|
+
|
1053
|
+
// A registry for named AMD defines containing the *metadata* of AMD module
|
1054
|
+
__init() {this.namedDefineRegistry = new Map();}
|
1055
|
+
|
1056
|
+
// The evaluated module registry where the module identifier (name or URL?) is the key
|
1057
|
+
__init2() {this.moduleRegistry = new Map();}
|
1058
|
+
|
1059
|
+
// Aliases of modules in the registry
|
1060
|
+
__init3() {this.aliases = new Map();}
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1071
1064
|
getImportMetadataResolver() {
|
1072
1065
|
return this.resolver;
|
1073
1066
|
}
|
@@ -1093,7 +1086,7 @@ class ModuleRegistry {
|
|
1093
1086
|
return moduleRecord;
|
1094
1087
|
}
|
1095
1088
|
|
1096
|
-
getModuleRecord(resolvedId, id) {
|
1089
|
+
async getModuleRecord(resolvedId, id) {
|
1097
1090
|
// Look for an existing record
|
1098
1091
|
const existingRecord = this.getExistingModuleRecord(resolvedId, id);
|
1099
1092
|
if (existingRecord) {
|
@@ -1101,10 +1094,29 @@ class ModuleRegistry {
|
|
1101
1094
|
return existingRecord;
|
1102
1095
|
}
|
1103
1096
|
|
1097
|
+
// Create a new Module Record
|
1098
|
+
const instantiation = this.getModuleDef(resolvedId, id);
|
1099
|
+
const dependencyRecords = instantiation.then((moduleDef) => {
|
1100
|
+
const dependencies = moduleDef.dependencies || [];
|
1101
|
+
// get dep and filter out exports
|
1102
|
+
const filtered = dependencies
|
1103
|
+
.map((dep) => {
|
1104
|
+
if (dep === 'exports') {
|
1105
|
+
return;
|
1106
|
+
}
|
1107
|
+
invariant(dep !== 'require', NO_AMD_REQUIRE);
|
1108
|
+
return this.getModuleDependencyRecord.call(this, dep);
|
1109
|
+
})
|
1110
|
+
.filter((depRecord) => depRecord !== undefined) ;
|
1111
|
+
|
1112
|
+
return Promise.all(filtered);
|
1113
|
+
});
|
1114
|
+
|
1104
1115
|
const newModuleRecord = {
|
1105
1116
|
id: resolvedId,
|
1106
1117
|
module: Object.create(null),
|
1107
|
-
|
1118
|
+
dependencyRecords,
|
1119
|
+
instantiation,
|
1108
1120
|
evaluated: false,
|
1109
1121
|
evaluationPromise: null,
|
1110
1122
|
};
|
@@ -1112,7 +1124,8 @@ class ModuleRegistry {
|
|
1112
1124
|
this.moduleRegistry.set(resolvedId, newModuleRecord);
|
1113
1125
|
this.storeModuleAlias(id, resolvedId);
|
1114
1126
|
|
1115
|
-
return
|
1127
|
+
// Wait for the dependencies to resolve the return the moduleRecord
|
1128
|
+
return dependencyRecords.then(() => newModuleRecord);
|
1116
1129
|
}
|
1117
1130
|
|
1118
1131
|
storeModuleAlias(aliasId, resolvedId) {
|
@@ -1133,87 +1146,95 @@ class ModuleRegistry {
|
|
1133
1146
|
}
|
1134
1147
|
}
|
1135
1148
|
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
async evaluateDependencies(
|
1140
|
-
dependencies,
|
1141
|
-
evaluationMap,
|
1142
|
-
) {
|
1143
|
-
const exports = {};
|
1144
|
-
const promiseArray = [];
|
1145
|
-
|
1146
|
-
if (dependencies) {
|
1147
|
-
for (const dep of dependencies) {
|
1148
|
-
if (dep === 'exports') {
|
1149
|
-
promiseArray.push(Promise.resolve(exports));
|
1150
|
-
} else {
|
1151
|
-
invariant(dep !== 'require', NO_AMD_REQUIRE);
|
1152
|
-
promiseArray.push(this.evaluateDependent(dep, evaluationMap));
|
1153
|
-
}
|
1154
|
-
}
|
1155
|
-
}
|
1156
|
-
|
1157
|
-
return Promise.all(promiseArray).then((results) => {
|
1158
|
-
const depsMapped = results.filter((result) => result !== undefined);
|
1159
|
-
return { depsMapped, exports };
|
1160
|
-
});
|
1149
|
+
async getModuleDependencyRecord(dependency) {
|
1150
|
+
const resolvedDepId = await this.resolve(dependency);
|
1151
|
+
return this.getModuleRecord(resolvedDepId, dependency);
|
1161
1152
|
}
|
1162
1153
|
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
const handleReturn = (module) => {
|
1170
|
-
if (module) {
|
1171
|
-
return module.__defaultInterop ? module.default : module;
|
1172
|
-
}
|
1173
|
-
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
1174
|
-
};
|
1154
|
+
// execute the "top-level code" (the code outside of functions) of a module
|
1155
|
+
async topLevelEvaluation(moduleRecord) {
|
1156
|
+
await this.instantiateAll(moduleRecord, {});
|
1157
|
+
return this.evaluateModule(moduleRecord, {});
|
1158
|
+
}
|
1175
1159
|
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1160
|
+
// Returns a promise when a module and all of it's dependencies have finished instantiation
|
1161
|
+
async instantiateAll(
|
1162
|
+
moduleRecord,
|
1163
|
+
instantiatedMap,
|
1164
|
+
) {
|
1165
|
+
if (!instantiatedMap[moduleRecord.id]) {
|
1166
|
+
instantiatedMap[moduleRecord.id] = true;
|
1167
|
+
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
1168
|
+
if (dependencyModuleRecords) {
|
1169
|
+
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
1170
|
+
const depRecord = dependencyModuleRecords[i];
|
1171
|
+
// eslint-disable-next-line no-await-in-loop
|
1172
|
+
await this.instantiateAll(depRecord, instantiatedMap);
|
1173
|
+
}
|
1190
1174
|
}
|
1191
|
-
return depModuleRecord.evaluationPromise.then((module) => {
|
1192
|
-
return handleReturn(module);
|
1193
|
-
});
|
1194
|
-
} else {
|
1195
|
-
// Otherwise return a dummy circular module wrapper
|
1196
|
-
module = getCircularDependencyWrapper(module);
|
1197
1175
|
}
|
1198
|
-
return handleReturn(module);
|
1199
1176
|
}
|
1200
1177
|
|
1201
1178
|
async evaluateModule(
|
1202
1179
|
moduleRecord,
|
1203
1180
|
evaluationMap,
|
1204
1181
|
) {
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1182
|
+
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
1183
|
+
if (dependencyModuleRecords.length > 0) {
|
1184
|
+
evaluationMap[moduleRecord.id] = true;
|
1185
|
+
// evaluate dependencies first
|
1186
|
+
await this.evaluateModuleDependencies(dependencyModuleRecords, evaluationMap);
|
1187
|
+
}
|
1208
1188
|
|
1209
|
-
// Wait for load to finish
|
1210
1189
|
const { exporter, dependencies } = await moduleRecord.instantiation;
|
1211
|
-
|
1212
|
-
|
1213
|
-
const
|
1190
|
+
// The exports object automatically gets filled in by the exporter evaluation
|
1191
|
+
const exports = {};
|
1192
|
+
const depsMapped = dependencies
|
1193
|
+
? await Promise.all(
|
1194
|
+
dependencies.map(async (dep) => {
|
1195
|
+
if (dep === 'exports') {
|
1196
|
+
return exports;
|
1197
|
+
}
|
1198
|
+
const resolvedDepId = await this.resolve(dep);
|
1199
|
+
|
1200
|
+
const moduleRecord = this.moduleRegistry.get(resolvedDepId) ;
|
1201
|
+
if (!moduleRecord) {
|
1202
|
+
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
const module = moduleRecord.module;
|
1206
|
+
|
1207
|
+
/**
|
1208
|
+
* Circular dependencies are handled properly when named exports are used,
|
1209
|
+
* however, for default exports there is a bug: https://github.com/rollup/rollup/issues/3384
|
1210
|
+
*
|
1211
|
+
* The workaround below applies for circular dependencies (!moduleRecord.evaluated)
|
1212
|
+
*/
|
1213
|
+
if (!moduleRecord.evaluated) {
|
1214
|
+
return this.getCircularDependencyWrapper(module);
|
1215
|
+
}
|
1216
|
+
|
1217
|
+
if (module) {
|
1218
|
+
return module.__defaultInterop ? module.default : module;
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
1222
|
+
}),
|
1223
|
+
)
|
1224
|
+
: [];
|
1225
|
+
|
1226
|
+
// 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
|
1227
|
+
if (moduleRecord.evaluated) {
|
1228
|
+
return moduleRecord.module;
|
1229
|
+
}
|
1214
1230
|
|
1215
1231
|
// evaluates the module function
|
1216
|
-
let moduleDefault
|
1232
|
+
let moduleDefault;
|
1233
|
+
try {
|
1234
|
+
moduleDefault = exporter(...depsMapped);
|
1235
|
+
} catch (e) {
|
1236
|
+
throw new LoaderError(EXPORTER_ERROR, [moduleRecord.id, e.message || e]);
|
1237
|
+
}
|
1217
1238
|
// value is returned from exporter, then we are not using named exports
|
1218
1239
|
if (moduleDefault !== undefined) {
|
1219
1240
|
moduleDefault = { default: moduleDefault };
|
@@ -1225,7 +1246,7 @@ class ModuleRegistry {
|
|
1225
1246
|
// if no return value, then we are using the exports object
|
1226
1247
|
else {
|
1227
1248
|
// handle only default export with Rollup forced named exports
|
1228
|
-
if (isNamedExportDefaultOnly(exports)) {
|
1249
|
+
if (this.isNamedExportDefaultOnly(exports)) {
|
1229
1250
|
Object.defineProperty(exports, '__useDefault', { value: true });
|
1230
1251
|
}
|
1231
1252
|
}
|
@@ -1257,17 +1278,42 @@ class ModuleRegistry {
|
|
1257
1278
|
Object.defineProperty(moduleRecord.module, '__esModule', { value: true });
|
1258
1279
|
}
|
1259
1280
|
|
1260
|
-
Object.freeze(moduleRecord.module);
|
1261
1281
|
moduleRecord.evaluated = true;
|
1262
|
-
moduleRecord.
|
1282
|
+
Object.freeze(moduleRecord.module);
|
1263
1283
|
return moduleRecord.module;
|
1264
1284
|
}
|
1265
1285
|
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1286
|
+
// Determines if named exports module has only default export
|
1287
|
+
isNamedExportDefaultOnly(exports) {
|
1288
|
+
return (
|
1289
|
+
exports !== undefined &&
|
1290
|
+
Object.getOwnPropertyNames(exports).length === 2 &&
|
1291
|
+
Object.prototype.hasOwnProperty.call(exports, 'default') &&
|
1292
|
+
Object.prototype.hasOwnProperty.call(exports, '__esModule')
|
1293
|
+
);
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
1297
|
+
// The LWC engine checks for __circular__ to detect circular dependencies.
|
1298
|
+
getCircularDependencyWrapper(module) {
|
1299
|
+
const tmp = () => {
|
1300
|
+
return module.__useDefault || module.__defaultInterop ? module.default : module;
|
1301
|
+
};
|
1302
|
+
tmp.__circular__ = true;
|
1303
|
+
return tmp;
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
async evaluateModuleDependencies(
|
1307
|
+
dependencyModuleRecords,
|
1308
|
+
evaluationMap,
|
1309
|
+
) {
|
1310
|
+
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
1311
|
+
const depRecord = dependencyModuleRecords[i];
|
1312
|
+
if (!depRecord.evaluated && !evaluationMap[depRecord.id]) {
|
1313
|
+
evaluationMap[depRecord.id] = true;
|
1314
|
+
// eslint-disable-next-line no-await-in-loop
|
1315
|
+
await this.evaluateModule(depRecord, evaluationMap);
|
1316
|
+
}
|
1271
1317
|
}
|
1272
1318
|
}
|
1273
1319
|
|
@@ -1279,8 +1325,8 @@ class ModuleRegistry {
|
|
1279
1325
|
const moduleName = !isUrl(resolvedId)
|
1280
1326
|
? resolvedId
|
1281
1327
|
: originalId !== resolvedId
|
1282
|
-
|
1283
|
-
|
1328
|
+
? originalId
|
1329
|
+
: undefined;
|
1284
1330
|
let moduleDef = moduleName && this.namedDefineRegistry.get(moduleName);
|
1285
1331
|
if (moduleDef && moduleDef.external) {
|
1286
1332
|
return moduleDef.external.moduleDefPromise;
|
@@ -1347,6 +1393,9 @@ class ModuleRegistry {
|
|
1347
1393
|
});
|
1348
1394
|
}
|
1349
1395
|
|
1396
|
+
|
1397
|
+
|
1398
|
+
|
1350
1399
|
addLoaderPlugin(hooks) {
|
1351
1400
|
if (typeof hooks !== 'object') {
|
1352
1401
|
throw new LoaderError(INVALID_HOOK);
|
@@ -1388,6 +1437,7 @@ class ModuleRegistry {
|
|
1388
1437
|
}
|
1389
1438
|
}
|
1390
1439
|
|
1440
|
+
|
1391
1441
|
registerHandleStaleModuleHook(handleStaleModule) {
|
1392
1442
|
if (this.handleStaleModuleHook) {
|
1393
1443
|
this.handleStaleModuleHook.push(handleStaleModule);
|
@@ -1395,30 +1445,12 @@ class ModuleRegistry {
|
|
1395
1445
|
this.handleStaleModuleHook = [handleStaleModule];
|
1396
1446
|
}
|
1397
1447
|
}
|
1398
|
-
}
|
1399
1448
|
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
Object.prototype.hasOwnProperty.call(exports, 'default') &&
|
1406
|
-
Object.prototype.hasOwnProperty.call(exports, '__esModule')
|
1407
|
-
);
|
1408
|
-
}
|
1409
|
-
|
1410
|
-
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
1411
|
-
// The LWC engine checks for __circular__ to detect circular dependencies.
|
1412
|
-
function getCircularDependencyWrapper(module) {
|
1413
|
-
const tmp = () => {
|
1414
|
-
return module.__useDefault || module.__defaultInterop ? module.default : module;
|
1415
|
-
};
|
1416
|
-
tmp.__circular__ = true;
|
1417
|
-
return tmp;
|
1418
|
-
}
|
1419
|
-
|
1420
|
-
function isValidResolveResponse(res) {
|
1421
|
-
return res === null || typeof res === 'string' || (res && typeof (res ).url === 'string');
|
1449
|
+
isValidResolveResponse(res) {
|
1450
|
+
return (
|
1451
|
+
res === null || typeof res === 'string' || (res && typeof (res ).url === 'string')
|
1452
|
+
);
|
1453
|
+
}
|
1422
1454
|
}
|
1423
1455
|
|
1424
1456
|
/**
|
@@ -1566,7 +1598,7 @@ const { bootstrapModule, endpoints, baseUrl, imports, index } = configuration;
|
|
1566
1598
|
|
1567
1599
|
// Initialize the AMD loader (its code is bundled into the LWR Everywhere module)
|
1568
1600
|
const loader = new Loader({ endpoints, baseUrl });
|
1569
|
-
loader.define('lwr/loader/v/0_12_0
|
1601
|
+
loader.define('lwr/loader/v/0_12_0', ['exports'], (exports) => {
|
1570
1602
|
Object.assign(exports, {
|
1571
1603
|
define: loader.define.bind(loader),
|
1572
1604
|
load: loader.load.bind(loader),
|
@@ -1576,12 +1608,12 @@ await loader.registerImportMappings({ imports, index }, [bootstrapModule]);
|
|
1576
1608
|
(globalThis ).LWR = Object.freeze({ define: loader.define.bind(loader) });
|
1577
1609
|
|
1578
1610
|
// Define preload modules (ie: ABS, vault, etc) BEFORE loading them
|
1579
|
-
LWR.define('lwr/everywhereAmd/v/0_12_0
|
1611
|
+
LWR.define('lwr/everywhereAmd/v/0_12_0', ['exports', 'lwr/vault/v/0_12_0'], (function (exports, _0_12_0) {
|
1580
1612
|
// IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
|
1581
1613
|
|
1582
1614
|
// Do an OAuthed fetch
|
1583
1615
|
async function authFetch(url, accept = 'javascript') {
|
1584
|
-
const authInfo =
|
1616
|
+
const authInfo = _0_12_0.getAuthInfo();
|
1585
1617
|
if (authInfo) {
|
1586
1618
|
return fetch(url, {
|
1587
1619
|
headers: {
|
@@ -1630,7 +1662,7 @@ LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_8', ['exports', 'lwr/vault/v/0_12_0
|
|
1630
1662
|
function authenticate(authInfo) {
|
1631
1663
|
// Put OAuth info into the vault
|
1632
1664
|
if (authInfo) {
|
1633
|
-
|
1665
|
+
_0_12_0.setAuthInfo(authInfo);
|
1634
1666
|
}
|
1635
1667
|
}
|
1636
1668
|
|
@@ -1640,7 +1672,7 @@ LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_8', ['exports', 'lwr/vault/v/0_12_0
|
|
1640
1672
|
Object.defineProperty(exports, '__esModule', { value: true });
|
1641
1673
|
|
1642
1674
|
}));
|
1643
|
-
LWR.define('lwr/vault/v/0_12_0
|
1675
|
+
LWR.define('lwr/vault/v/0_12_0', ['exports'], (function (exports) {
|
1644
1676
|
// Credential vault for storing setters and subscribers for OAuth info
|
1645
1677
|
// This module is a SINGLETON and must be excluded from ESM bundling
|
1646
1678
|
|
@@ -1664,7 +1696,7 @@ LWR.define('lwr/vault/v/0_12_0-alpha_8', ['exports'], (function (exports) {
|
|
1664
1696
|
|
1665
1697
|
// Set up the AMD loader hooks for OAuth
|
1666
1698
|
const { initAmd, authenticate } = await loader.load(bootstrapModule);
|
1667
|
-
initAmd(loader.services, _optionalChain([endpoints, 'optionalAccess', _ => _.uris, 'access', _2 => _2.mapping]), '0_12_0
|
1699
|
+
initAmd(loader.services, _optionalChain([endpoints, 'optionalAccess', _ => _.uris, 'access', _2 => _2.mapping]), '0_12_0');
|
1668
1700
|
|
1669
1701
|
// Wrap the createComponent API to allow proper ordering of module definitions:
|
1670
1702
|
// 1. LWRE module bundle (this): lwr/loader, lwr/everywhereAmd, lwr/vault
|