@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
@@ -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-alpha_19`;
|
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-alpha.
|
55
|
+
/* LWR Module Loader v0.12.0-alpha.19 */
|
56
56
|
const templateRegex = /\{([0-9]+)\}/g;
|
57
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
58
58
|
function templateString(template, args) {
|
@@ -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
|
|
@@ -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-alpha_19', ['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-alpha_19', ['exports', 'lwr/vault/v/0_12_0-alpha_19'], (function (exports, _0_12_0Alpha_19) {
|
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_0Alpha_19.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_17', ['exports', 'lwr/vault/v/0_12_
|
|
1630
1662
|
function authenticate(authInfo) {
|
1631
1663
|
// Put OAuth info into the vault
|
1632
1664
|
if (authInfo) {
|
1633
|
-
|
1665
|
+
_0_12_0Alpha_19.setAuthInfo(authInfo);
|
1634
1666
|
}
|
1635
1667
|
}
|
1636
1668
|
|
@@ -1640,7 +1672,7 @@ LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_17', ['exports', 'lwr/vault/v/0_12_
|
|
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-alpha_19', ['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_17', ['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-alpha_19');
|
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
|
@@ -1,5 +1,5 @@
|
|
1
|
-
function getConfiguration(e){const{format:t,server:r,apiVersion:o,apiPrefix:n,locale:i,bundle:s,debug:a}=e,l=new URL(import.meta.url),d=r||l.origin||"",c=`${n}/${o}`,p="0"+(i?`/l/${i}`:""),u="/bi/3_A,B,O,S,EG,JLMT,C,D,F,H,I,K,N,P,Q,R",
|
1
|
+
function getConfiguration(e){const{format:t,server:r,apiVersion:o,apiPrefix:n,locale:i,bundle:s,debug:a}=e,l=new URL(import.meta.url),d=r||l.origin||"",c=`${n}/${o}`,p="0"+(i?`/l/${i}`:""),u="/bi/3_A,B,O,S,EG,JLMT,C,D,F,H,I,K,N,P,Q,R",h=s?`${d}${c}/bundle/${t}/${p}${u}-0/module/mi/`:`${d}${c}/module/${t}/${p}/mi/`,f=`lwr/everywhere${"esm"===t?"Esm":"Amd"}/v/0_12_0-alpha_19`,g=`${h}${encodeURIComponent(f)}/latest${a?"?debug":""}`,E={appId:"lwre",autoBoot:!0,bootstrapModule:f,baseUrl:d,imports:{[g]:[f]},index:{[f]:g},endpoints:{uris:{module:h,mapping:`${d}${c}/mapping/${t}/${p}${s?u:""}/mp/`}}};return a&&E.endpoints&&(E.endpoints.modifiers={debug:"true"}),E}globalThis.process={env:{NODE_ENV:"production"}};const templateRegex=/\{([0-9]+)\}/g;function templateString(e,t){return e.replace(templateRegex,((e,r)=>t[r]))}function generateErrorMessage(e,t){const r=Array.isArray(t)?templateString(e.message,t):e.message;return`LWR${e.code}: ${r}`}class LoaderError extends Error{constructor(e,t){super(),this.message=generateErrorMessage(e,t)}}function invariant(e,t){if(!e)throw new LoaderError(t)}const MISSING_NAME=Object.freeze({code:3e3,message:"A module name is required.",level:0}),FAIL_INSTANTIATE=Object.freeze({code:3004,message:"Failed to instantiate module: {0}",level:0}),NO_AMD_REQUIRE=Object.freeze({code:3005,message:"AMD require not supported.",level:0}),FAILED_DEP=Object.freeze({code:3006,level:0,message:"Failed to load dependency: {0}"}),INVALID_DEPS=Object.freeze({code:3007,message:"Unexpected value received for dependencies argument; expected an array.",level:0}),FAIL_LOAD=Object.freeze({code:3008,level:0,message:"Error loading {0}"}),UNRESOLVED=Object.freeze({code:3009,level:0,message:"Unable to resolve bare specifier: {0}"}),NO_BASE_URL=Object.freeze({code:3010,level:0,message:"baseUrl not set"});Object.freeze({code:3011,level:0,message:"Cannot set a loader service multiple times"});const INVALID_HOOK=Object.freeze({code:3012,level:0,message:"Invalid hook received"}),INVALID_LOADER_SERVICE_RESPONSE=Object.freeze({code:3013,level:0,message:"Invalid response received from hook"}),MODULE_LOAD_TIMEOUT=Object.freeze({code:3014,level:0,message:"Error loading {0} - timed out"}),HTTP_FAIL_LOAD=Object.freeze({code:3015,level:0,message:"Error loading {0}, status code {1}"}),STALE_HOOK_ERROR=Object.freeze({code:3016,level:0,message:"An error occurred handling module conflict"}),MODULE_ALREADY_LOADED=Object.freeze({code:3017,level:0,message:"Marking module(s) as externally loaded, but they are already loaded:"}),FAIL_HOOK_LOAD=Object.freeze({code:3018,level:0,message:'Error loading "{0}" from hook'}),NO_MAPPING_URL=Object.freeze({code:3019,level:0,message:"Mapping endpoint not set"}),BAD_IMPORT_METADATA=Object.freeze({code:3020,level:0,message:"Invalid import metadata: {0} {1}"}),EXPORTER_ERROR=Object.freeze({code:3021,level:0,message:'Error evaluating module "{0}", error was "{1}"'});Object.freeze({code:3011,level:0,message:"import map is not valid"});const hasDocument="undefined"!=typeof document,hasSetTimeout="function"==typeof setTimeout,hasConsole="undefined"!=typeof console;function getBaseUrl(){let e;if(hasDocument){const t=document.querySelector("base[href]");e=t&&t.href}if(!e&&"undefined"!=typeof location){e=location.href.split("#")[0].split("?")[0];const t=e.lastIndexOf("/");-1!==t&&(e=e.slice(0,t+1))}return e}function isUrl(e){return-1!==e.indexOf("://")}function resolveIfNotPlainOrUrl(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(/\\/g,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const r=t.slice(0,t.indexOf(":")+1);let o;if("/"===t[r.length+1]?"file:"!==r?(o=t.slice(r.length+2),o=o.slice(o.indexOf("/")+1)):o=t.slice(8):o=t.slice(r.length+("/"===t[r.length]?1:0)),"/"===e[0])return t.slice(0,t.length-o.length-1)+e;const n=o.slice(0,o.lastIndexOf("/")+1)+e,i=[];let s=-1;for(let e=0;e<n.length;e++)-1!==s?"/"===n[e]&&(i.push(n.slice(s,e+1)),s=-1):"."===n[e]?"."!==n[e+1]||"/"!==n[e+2]&&e+2!==n.length?"/"===n[e+1]||e+1===n.length?e+=1:s=e:(i.pop(),e+=2):s=e;return-1!==s&&i.push(n.slice(s)),t.slice(0,t.length-o.length)+i.join("")}}function resolveUrl(e,t){return resolveIfNotPlainOrUrl(e,t)||(isUrl(e)?e:resolveIfNotPlainOrUrl("./"+e,t))}function createScript(e){const t=document.createElement("script");return t.async=!0,t.crossOrigin="anonymous",t.src=e,t}let lastWindowError$1,lastWindowErrorUrl;function loadModuleDef(e){return new Promise((function(t,r){if(hasDocument){const o=createScript(e);o.addEventListener("error",(()=>{r(new LoaderError(FAIL_LOAD,[e]))})),o.addEventListener("load",(()=>{document.head.removeChild(o),lastWindowErrorUrl===e?r(lastWindowError$1):t()})),document.head.appendChild(o)}}))}hasDocument&&window.addEventListener("error",(e=>{lastWindowErrorUrl=e.filename,lastWindowError$1=e.error}));const LOADER_PREFIX="lwr.loader.",MODULE_DEFINE=`${LOADER_PREFIX}module.define`,MODULE_DYNAMIC_LOAD=`${LOADER_PREFIX}moduleRegistry.dynamicLoad`,MODULE_FETCH=`${LOADER_PREFIX}module.fetch`,MODULE_ERROR=`${LOADER_PREFIX}module.error`,MAPPINGS_FETCH=`${LOADER_PREFIX}mappings.fetch`,MAPPINGS_ERROR=`${LOADER_PREFIX}mappings.error`;class ImportMetadataResolver{__init(){this.importURICache=new Map}__init2(){this.pendingURICache=new Map}__init3(){this.loadMappingHooks=[]}constructor(e,t){ImportMetadataResolver.prototype.__init.call(this),ImportMetadataResolver.prototype.__init2.call(this),ImportMetadataResolver.prototype.__init3.call(this),this.config=e,this.invalidationCallback=t}addLoadMappingHook(e){this.loadMappingHooks.push(e)}getMappingEndpoint(){return this.config.endpoints&&this.config.endpoints.uris?this.config.endpoints.uris.mapping:void 0}getModifiersAsUrlParams(){const e=this.config.endpoints?this.config.endpoints.modifiers:void 0;if(e){return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}`}return""}buildMappingUrl(e){return`${this.getMappingEndpoint()}${encodeURIComponent(e)}${this.getModifiersAsUrlParams()}`}getBaseUrl(){return this.config.baseUrl}registerImportMappings(e,t){if(!t||0===t.length){const r=e?JSON.stringify(e):"undefined";throw new LoaderError(BAD_IMPORT_METADATA,[r,t?"[]":"undefined"])}if(!e)throw new LoaderError(BAD_IMPORT_METADATA,["undefined",JSON.stringify(t)]);if(!e.imports||0===Object.keys(e.imports).length)throw new LoaderError(BAD_IMPORT_METADATA,[JSON.stringify(e),JSON.stringify(t)]);const r=e.index||{};for(const[o,n]of Object.entries(e.imports))n.forEach((e=>{const n=r[e],i=this.importURICache.get(e);if(i){const t=n||o,r=i.identity||i.uri;r!==t&&this.invalidationCallback({name:e,oldUrl:r,newUrl:t})}else this.saveImportURIRecord(e,o,n,t.includes(e))}))}getURI(e){return this.importURICache.has(e)?resolveUrl(this.importURICache.get(e).uri,this.getBaseUrl()):void 0}resolveLocal(e){const t=this.getURI(e);return t||(isUrl(e)||e.startsWith("/")?e:void 0)}async resolve(e){let t=this.getURI(e);if(t)return t;if(isUrl(e)||e.startsWith("/"))return e;{const r=this.pendingURICache.get(e);if(r)return r;this.config.profiler.logOperationStart({id:MAPPINGS_FETCH,specifier:e});const o=(this.hasMappingHooks()?this.evaluateMappingHooks:this.fetchNewMappings).bind(this)(e).then((r=>{if(!r||!r.imports)throw new LoaderError(UNRESOLVED,[e]);if(this.registerImportMappings(r,[e]),t=this.getURI(e),!t)throw new LoaderError(UNRESOLVED,[e]);return this.config.profiler.logOperationEnd({id:MAPPINGS_FETCH,specifier:e}),t})).finally((()=>{this.pendingURICache.delete(e)}));return this.pendingURICache.set(e,o),o}}hasMappingHooks(){return this.loadMappingHooks.length>0}async evaluateMappingHooks(e){const t=this.loadMappingHooks;if(t.length){const r=Array.from(this.importURICache.keys());for(let o=0;o<t.length;o++){const n=t[o],i=await n(e,{knownModules:r});if(i||void 0===i)return i}}return this.fetchNewMappings(e)}async fetchNewMappings(e){if("function"!=typeof globalThis.fetch)throw new LoaderError(UNRESOLVED,[e]);const t=resolveUrl(this.buildMappingUrl(e),this.getBaseUrl());return globalThis.fetch(t).then((t=>{if(!t.ok)throw this.config.profiler.logOperationStart({id:MAPPINGS_ERROR,specifier:e}),new LoaderError(UNRESOLVED,[e]);return t.json().then((e=>e)).catch((t=>{throw new LoaderError(UNRESOLVED,[e])}))}))}saveImportURIRecord(e,t,r,o){r&&t!==r?this.importURICache.set(e,{uri:t,identity:r,isRoot:o}):this.importURICache.set(e,{uri:t,isRoot:o})}}function reportError(e){hasConsole&&console.error(e)}function evaluateHandleStaleModuleHooks(e,t){const{name:r,oldUrl:o,newUrl:n}=t;for(let t=0;t<e.length;t++){const i=e[t];try{if(null!==i({name:r,oldUrl:o,newUrl:n}))break}catch(e){reportError(new LoaderError(STALE_HOOK_ERROR))}}}const MODULE_LOAD_TIMEOUT_TIMER=6e4,SUPPORTS_TRUSTED_TYPES="undefined"!=typeof trustedTypes;
|
2
2
|
/*!
|
3
3
|
* Copyright (C) 2023 salesforce.com, inc.
|
4
4
|
*/function createTrustedTypesPolicy(e,t){return trustedTypes.createPolicy(e,t)}function createFallbackPolicy(e,t){return t}const createPolicy=SUPPORTS_TRUSTED_TYPES?createTrustedTypesPolicy:createFallbackPolicy,policyOptions={createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e};try{createPolicy("default",{createHTML:e=>e,createScript(e){if("null"===e||"undefined"===e)return e},createScriptURL:e=>e})}catch(e){}const trusted=createPolicy("trusted",policyOptions);
|
5
|
-
/*! version: 0.21.3 */let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response||!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw"production"!==process.env.NODE_ENV&&hasConsole&&console.error(e),new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const n=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(n)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),"production"!==process.env.NODE_ENV&&!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");class ModuleRegistry{__init(){this.namedDefineRegistry=new Map}__init2(){this.moduleRegistry=new Map}__init3(){this.aliases=new Map}constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this))}async load(e,t){const r=t?{importer:t}:{};this.profiler.logOperationStart({id:MODULE_DYNAMIC_LOAD,specifier:e,metadata:r});const o=await this.resolve(e,t),n=this.getModuleRecord(o,e);return n.evaluated?n.module:(n.evaluationPromise||(n.evaluationPromise=this.evaluateModule(n,{})),n.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,n=e;const i=this.resolveHook;if(i){for(let e=0;e<i.length;e++){const t=(0,i[e])(n,{parentUrl:r});let s;if((t||null===t)&&(s=isResponseAPromise(t)?await t:t),!isValidResolveResponse(s))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(null!==s){if("string"==typeof s){if(resolveIfNotPlainOrUrl(s,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);n=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(n!==e){if(!o&&this.namedDefineRegistry.has(n))return n;e=n}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;const n=this.resolver.resolveLocal(t);if(n){if(this.namedDefineRegistry.has(t)){const e=this.namedDefineRegistry.get(t);if(e.external||e.defined){if(!this.moduleRegistry.get(n)||!this.aliases.has(t))return t}}return n}if(this.namedDefineRegistry.has(t))return t;try{o=await this.resolver.resolve(t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`Module redefine attempted: ${e}`),void(this.lastDefine=o);const n={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(n),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,n),this.lastDefine=n}registerExternalModules(e){e.map((e=>{if(this.namedDefineRegistry.has(e))"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(MODULE_ALREADY_LOADED.message,e);else{let t,r;const o=new Promise(((o,n)=>{t=o,r=setTimeout((()=>{n(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),n={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,n)}}))}getImportMetadataResolver(){return this.resolver}getExistingModuleRecord(e,t){const r=this.moduleRegistry.get(e);if(r)return this.storeModuleAlias(t,e),r;if(e!==t){const e=this.aliases.get(t);if(e){const t=this.moduleRegistry.get(e);if(t)return t}}return r}getModuleRecord(e,t){const r=this.getExistingModuleRecord(e,t);if(r)return r;const o={id:e,module:Object.create(null),instantiation:this.getModuleDef(e,t),evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,o),this.storeModuleAlias(t,e),o}storeModuleAlias(e,t){if(e!==t)if(this.aliases.has(e)){if("production"!==process.env.NODE_ENV&&hasConsole){const r=this.aliases.get(e);r!==t&&"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`Alias update attempt: ${e}=>${r}, ${t}`)}}else this.aliases.set(e,t)}async evaluateDependencies(e,t){const r={},o=[];if(e)for(const n of e)"exports"===n?o.push(Promise.resolve(r)):(invariant("require"!==n,NO_AMD_REQUIRE),o.push(this.evaluateDependent(n,t)));return Promise.all(o).then((e=>({depsMapped:e.filter((e=>void 0!==e)),exports:r})))}async evaluateDependent(e,t){const r=await this.resolve(e),o=this.getModuleRecord(r,e);let n=o.module;const i=e=>{if(e)return e.__defaultInterop?e.default:e;throw new LoaderError(FAILED_DEP,[r])};return o.evaluated?i(n):t[o.id]?(n=getCircularDependencyWrapper(n),i(n)):(o.evaluationPromise||(o.evaluationPromise=this.evaluateModule(o,t)),o.evaluationPromise.then((e=>i(e))))}async evaluateModule(e,t){const r={...t};r[e.id]=!0;const{exporter:o,dependencies:n}=await e.instantiation,{depsMapped:i,exports:s}=await this.evaluateDependencies(n,r);let a=this.evaluateModuleCode(o,i,e);void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):isNamedExportDefaultOnly(s)&&Object.defineProperty(s,"__useDefault",{value:!0});const l=a||s;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),Object.freeze(e.module),e.evaluated=!0,e.evaluationPromise=null,e.module}evaluateModuleCode(e,t,r){try{return e(...t)}catch(e){throw new LoaderError(EXPORTER_ERROR,[r.id,e.message||e])}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const n=this.resolver.getBaseUrl(),i=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:i}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,n),i=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===i)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(i&&null!==i)return evaluateLoadHookResponse(i,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:i}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:i}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o?evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r}):"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`stale module detected ${e}, current URL:${t}, new URL:${r}`)}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}}function isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}function getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}function isValidResolveResponse(e){return null===e||"string"==typeof e||e&&"string"==typeof e.url}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata,serverData:e.serverData||{}})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,n=t;"function"==typeof n&&(o=t,n=[]),invariant(Array.isArray(n),INVALID_DEPS),this.registry.define(e,n,o)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e,t){this.registry.getImportMetadataResolver().registerImportMappings(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}const configOptions={format:"amd",apiVersion:"1",apiPrefix:"",bundle:!0,debug:!1},configuration=getConfiguration(configOptions),{bootstrapModule:bootstrapModule,endpoints:endpoints,baseUrl:baseUrl,imports:imports,index:index}=configuration,loader=new Loader({endpoints:endpoints,baseUrl:baseUrl});loader.define("lwr/loader/v/0_12_0-alpha_17",["exports"],(e=>{Object.assign(e,{define:loader.define.bind(loader),load:loader.load.bind(loader)})})),await loader.registerImportMappings({imports:imports,index:index},[bootstrapModule]),globalThis.LWR=Object.freeze({define:loader.define.bind(loader)}),LWR.define("lwr/everywhereAmd/v/0_12_0-alpha_17",["exports","lwr/vault/v/0_12_0-alpha_17"],(function(e,t){async function r(e,r="javascript"){const o=t.getAuthInfo();return o?fetch(e,{headers:{Accept:`application/${r}`,Authorization:`Bearer ${o.access_token}`}}):null}e.authenticate=function(e){e&&t.setAuthInfo(e)},e.initAmd=function(e,t,o){t.match(/\/v5\d\.0\//)&&function(e,t,o){e.addLoaderPlugin({loadModule:async e=>r(e),loadMapping:async e=>{const o=await r(`${t}${encodeURIComponent(e)}`,"json");return o&&o.ok?o.json():null},resolveModule:e=>e&&!/\/v\/[^/]+?$/.test(e)?`${e}/v/${o}`:null})}(e,t,o)},Object.defineProperty(e,"__esModule",{value:!0})})),LWR.define("lwr/vault/v/0_12_0-alpha_17",["exports"],(function(e){let t;e.getAuthInfo=function(){return t},e.setAuthInfo=function(e){t=e},Object.defineProperty(e,"__esModule",{value:!0})}));const{initAmd:initAmd,authenticate:authenticate}=await loader.load(bootstrapModule);async function createComponent(e,t,r={},o){const{createComponent:n}=await loader.load(bootstrapModule.replace("Amd",""));return n(e,t,r,o)}initAmd(loader.services,_optionalChain([endpoints,"optionalAccess",e=>e.uris,"access",e=>e.mapping]),"0_12_0-alpha_17");export{authenticate,createComponent};
|
5
|
+
/*! version: 0.21.3 */let lastWindowError;function isCustomResponse(e){return Object.prototype.hasOwnProperty.call(e,"data")&&!Object.prototype.hasOwnProperty.call(e,"blob")}function isFetchResponse(e){return"function"==typeof e.blob}function isResponseAPromise(e){return!(!e||!e.then)}async function evaluateLoadHookResponse(response,id){return Promise.resolve().then((async()=>{if(!response||!response.status)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(200!==response.status)throw new LoaderError(HTTP_FAIL_LOAD,[id,`${response.status}`]);const isResponse=isFetchResponse(response);let code;if(isCustomResponse(response))code=response.data;else{if(!isResponse)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);code=await response.text()}if(!code)throw new LoaderError(FAIL_LOAD,[id]);code=`${code}\n//# sourceURL=${id}`;try{eval(trusted.createScript(code))}catch(e){throw"production"!==process.env.NODE_ENV&&hasConsole&&console.error(e),new LoaderError(FAIL_LOAD,[id])}if(lastWindowError)throw new LoaderError(FAIL_LOAD,[id]);return!0}))}async function evaluateLoadHook(e,t){return hasSetTimeout?new Promise(((r,o)=>{const n=setTimeout((()=>{o(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER);t.then((e=>{r(e)})).catch((()=>{o(new LoaderError(FAIL_HOOK_LOAD,[e]))})).finally((()=>{clearTimeout(n)}))})):t}hasDocument&&globalThis.addEventListener("error",(e=>{lastWindowError=e.error})),"production"!==process.env.NODE_ENV&&!hasSetTimeout&&hasConsole&&console.warn("setTimeout API is not available, watchdog timer on load hook will not be set");class ModuleRegistry{constructor(e){ModuleRegistry.prototype.__init.call(this),ModuleRegistry.prototype.__init2.call(this),ModuleRegistry.prototype.__init3.call(this),this.profiler=e.profiler,this.resolver=new ImportMetadataResolver(e,this.importMetadataInvalidationCallback.bind(this))}async load(e,t){const r=t?{importer:t}:{};this.profiler.logOperationStart({id:MODULE_DYNAMIC_LOAD,specifier:e,metadata:r});const o=await this.resolve(e,t),n=await this.getModuleRecord(o,e);return n.evaluated?n.module:(n.evaluationPromise||(n.evaluationPromise=this.topLevelEvaluation(n)),n.evaluationPromise)}async resolve(e,t){const r=this.resolver.getBaseUrl();let o,n=e;const i=this.resolveHook;if(i){for(let e=0;e<i.length;e++){const t=(0,i[e])(n,{parentUrl:r});let s;if((t||null===t)&&(s=isResponseAPromise(t)?await t:t),!this.isValidResolveResponse(s))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(null!==s){if("string"==typeof s){if(resolveIfNotPlainOrUrl(s,r))throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);n=s;continue}if(o=s&&s.url&&(resolveIfNotPlainOrUrl(s.url,r)||s.url),!o)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);break}}if(n!==e){if(!o&&this.namedDefineRegistry.has(n))return n;e=n}}if(!o){const t=resolveIfNotPlainOrUrl(e,r)||e;if(this.moduleRegistry.has(t))return t;const n=this.resolver.resolveLocal(t);if(n){if(this.namedDefineRegistry.has(t)){const e=this.namedDefineRegistry.get(t);if(e.external||e.defined){if(!this.moduleRegistry.get(n)||!this.aliases.has(t))return t}}return n}if(this.namedDefineRegistry.has(t))return t;try{o=await this.resolver.resolve(t)}catch(e){}}if(!o||!isUrl(o)){if(this.namedDefineRegistry.has(e))return e;throw new LoaderError(UNRESOLVED,[e])}return t&&isUrl(o)&&(o+=`?importer=${encodeURIComponent(t)}`),o}has(e){return this.moduleRegistry.has(e)}define(e,t,r){const o=this.namedDefineRegistry.get(e);if(o&&o.defined)return"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`Module redefine attempted: ${e}`),void(this.lastDefine=o);const n={name:e,dependencies:t,exporter:r,defined:!0};o&&o.external&&o.external.resolveExternal(n),this.profiler.logOperationStart({id:MODULE_DEFINE,specifier:e}),this.namedDefineRegistry.set(e,n),this.lastDefine=n}registerExternalModules(e){e.map((e=>{if(this.namedDefineRegistry.has(e))"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(MODULE_ALREADY_LOADED.message,e);else{let t,r;const o=new Promise(((o,n)=>{t=o,r=setTimeout((()=>{n(new LoaderError(MODULE_LOAD_TIMEOUT,[e]))}),MODULE_LOAD_TIMEOUT_TIMER)})).finally((()=>{clearTimeout(r)})),n={name:e,defined:!1,external:{resolveExternal:t,moduleDefPromise:o}};this.namedDefineRegistry.set(e,n)}}))}__init(){this.namedDefineRegistry=new Map}__init2(){this.moduleRegistry=new Map}__init3(){this.aliases=new Map}getImportMetadataResolver(){return this.resolver}getExistingModuleRecord(e,t){const r=this.moduleRegistry.get(e);if(r)return this.storeModuleAlias(t,e),r;if(e!==t){const e=this.aliases.get(t);if(e){const t=this.moduleRegistry.get(e);if(t)return t}}return r}async getModuleRecord(e,t){const r=this.getExistingModuleRecord(e,t);if(r)return r;const o=this.getModuleDef(e,t),n=o.then((e=>{const t=(e.dependencies||[]).map((e=>{if("exports"!==e)return invariant("require"!==e,NO_AMD_REQUIRE),this.getModuleDependencyRecord.call(this,e)})).filter((e=>void 0!==e));return Promise.all(t)})),i={id:e,module:Object.create(null),dependencyRecords:n,instantiation:o,evaluated:!1,evaluationPromise:null};return this.moduleRegistry.set(e,i),this.storeModuleAlias(t,e),n.then((()=>i))}storeModuleAlias(e,t){if(e!==t)if(this.aliases.has(e)){if("production"!==process.env.NODE_ENV&&hasConsole){const r=this.aliases.get(e);r!==t&&"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`Alias update attempt: ${e}=>${r}, ${t}`)}}else this.aliases.set(e,t)}async getModuleDependencyRecord(e){const t=await this.resolve(e);return this.getModuleRecord(t,e)}async topLevelEvaluation(e){return await this.instantiateAll(e,{}),this.evaluateModule(e,{})}async instantiateAll(e,t){if(!t[e.id]){t[e.id]=!0;const r=await e.dependencyRecords;if(r)for(let e=0;e<r.length;e++){const o=r[e];await this.instantiateAll(o,t)}}}async evaluateModule(e,t){const r=await e.dependencyRecords;r.length>0&&(t[e.id]=!0,await this.evaluateModuleDependencies(r,t));const{exporter:o,dependencies:n}=await e.instantiation,i={},s=n?await Promise.all(n.map((async e=>{if("exports"===e)return i;const t=await this.resolve(e),r=this.moduleRegistry.get(t);if(!r)throw new LoaderError(FAILED_DEP,[t]);const o=r.module;if(!r.evaluated)return this.getCircularDependencyWrapper(o);if(o)return o.__defaultInterop?o.default:o;throw new LoaderError(FAILED_DEP,[t])}))):[];if(e.evaluated)return e.module;let a;try{a=o(...s)}catch(t){throw new LoaderError(EXPORTER_ERROR,[e.id,t.message||t])}void 0!==a?(a={default:a},Object.defineProperty(a,"__defaultInterop",{value:!0})):this.isNamedExportDefaultOnly(i)&&Object.defineProperty(i,"__useDefault",{value:!0});const l=a||i;for(const t in l)Object.defineProperty(e.module,t,{enumerable:!0,set(e){l[t]=e},get:()=>l[t]});return l.__useDefault&&Object.defineProperty(e.module,"__useDefault",{value:!0}),l.__defaultInterop&&Object.defineProperty(e.module,"__defaultInterop",{value:!0}),l.__esModule&&Object.defineProperty(e.module,"__esModule",{value:!0}),e.evaluated=!0,Object.freeze(e.module),e.module}isNamedExportDefaultOnly(e){return void 0!==e&&2===Object.getOwnPropertyNames(e).length&&Object.prototype.hasOwnProperty.call(e,"default")&&Object.prototype.hasOwnProperty.call(e,"__esModule")}getCircularDependencyWrapper(e){const t=()=>e.__useDefault||e.__defaultInterop?e.default:e;return t.__circular__=!0,t}async evaluateModuleDependencies(e,t){for(let r=0;r<e.length;r++){const o=e[r];o.evaluated||t[o.id]||(t[o.id]=!0,await this.evaluateModule(o,t))}}async getModuleDef(e,t){this.lastDefine=void 0;const r=isUrl(e)?t!==e?t:void 0:e;let o=r&&this.namedDefineRegistry.get(r);if(o&&o.external)return o.external.moduleDefPromise;if(o&&o.defined)return o;const n=this.resolver.getBaseUrl(),i=r||t;return this.profiler.logOperationStart({id:MODULE_FETCH,specifier:i}),Promise.resolve().then((async()=>{const t=this.loadHook;if(t)for(let r=0;r<t.length;r++){const o=(0,t[r])(e,n),i=isResponseAPromise(o)?await evaluateLoadHook(e,o):o;if(void 0===i)throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);if(i&&null!==i)return evaluateLoadHookResponse(i,e)}return!1})).then((t=>{if(!0!==t&&hasDocument)return loadModuleDef(e)})).then((()=>{if(o=r&&this.namedDefineRegistry.get(r),o||(o=this.lastDefine),!o)throw new LoaderError(FAIL_INSTANTIATE,[e]);return this.profiler.logOperationEnd({id:MODULE_FETCH,specifier:i}),o})).catch((e=>{throw e instanceof LoaderError||this.profiler.logOperationStart({id:MODULE_ERROR,specifier:i}),e}))}addLoaderPlugin(e){if("object"!=typeof e)throw new LoaderError(INVALID_HOOK);const{loadModule:t,resolveModule:r,loadMapping:o}=e;r&&(this.resolveHook?this.resolveHook.push(r):this.resolveHook=[r]),t&&(this.loadHook?this.loadHook.push(t):this.loadHook=[t]),o&&this.resolver.addLoadMappingHook(o)}importMetadataInvalidationCallback({name:e,oldUrl:t,newUrl:r}){const o=this.handleStaleModuleHook;o?evaluateHandleStaleModuleHooks(o,{name:e,oldUrl:t,newUrl:r}):"production"!==process.env.NODE_ENV&&hasConsole&&console.warn(`stale module detected ${e}, current URL:${t}, new URL:${r}`)}registerHandleStaleModuleHook(e){this.handleStaleModuleHook?this.handleStaleModuleHook.push(e):this.handleStaleModuleHook=[e]}isValidResolveResponse(e){return null===e||"string"==typeof e||e&&"string"==typeof e.url}}class Loader{constructor(e){let t=e.baseUrl;const r=e.endpoints?e.endpoints.uris.mapping:void 0;let o=e.profiler;if(!r)throw new LoaderError(NO_MAPPING_URL);if(e.endpoints.uris.mapping=r.replace(/\/?$/,"/"),t&&(t=t.replace(/\/?$/,"/")),t||(t=getBaseUrl()),!t)throw new LoaderError(NO_BASE_URL);if(o||(o={logOperationStart:()=>{},logOperationEnd:()=>{}}),this.registry=new ModuleRegistry(Object.freeze({endpoints:e.endpoints,baseUrl:t,profiler:o})),e.appMetadata&&!e.appMetadata.appId){const t=e.appMetadata.bootstrapModule.match(/@lwr-bootstrap\/(.+)\/v\/.+/),r=t&&t[1];e.appMetadata.appId=r}this.services=Object.freeze({addLoaderPlugin:this.registry.addLoaderPlugin.bind(this.registry),handleStaleModule:this.registry.registerHandleStaleModuleHook.bind(this.registry),appMetadata:e.appMetadata,serverData:e.serverData||{}})}define(e,t,r){invariant("string"==typeof e,MISSING_NAME);let o=r,n=t;"function"==typeof n&&(o=t,n=[]),invariant(Array.isArray(n),INVALID_DEPS),this.registry.define(e,n,o)}async load(e,t){return this.registry.load(e,t)}has(e){return this.registry.has(e)}async resolve(e,t){return this.registry.resolve(e,t)}async registerImportMappings(e,t){this.registry.getImportMetadataResolver().registerImportMappings(e,t)}registerExternalModules(e){this.registry.registerExternalModules(e)}}function _optionalChain(e){let t,r=e[0],o=1;for(;o<e.length;){const n=e[o],i=e[o+1];if(o+=2,("optionalAccess"===n||"optionalCall"===n)&&null==r)return;"access"===n||"optionalAccess"===n?(t=r,r=i(r)):"call"!==n&&"optionalCall"!==n||(r=i(((...e)=>r.call(t,...e))),t=void 0)}return r}const configOptions={format:"amd",apiVersion:"1",apiPrefix:"",bundle:!0,debug:!1},configuration=getConfiguration(configOptions),{bootstrapModule:bootstrapModule,endpoints:endpoints,baseUrl:baseUrl,imports:imports,index:index}=configuration,loader=new Loader({endpoints:endpoints,baseUrl:baseUrl});loader.define("lwr/loader/v/0_12_0-alpha_19",["exports"],(e=>{Object.assign(e,{define:loader.define.bind(loader),load:loader.load.bind(loader)})})),await loader.registerImportMappings({imports:imports,index:index},[bootstrapModule]),globalThis.LWR=Object.freeze({define:loader.define.bind(loader)}),LWR.define("lwr/everywhereAmd/v/0_12_0-alpha_19",["exports","lwr/vault/v/0_12_0-alpha_19"],(function(e,t){async function r(e,r="javascript"){const o=t.getAuthInfo();return o?fetch(e,{headers:{Accept:`application/${r}`,Authorization:`Bearer ${o.access_token}`}}):null}e.authenticate=function(e){e&&t.setAuthInfo(e)},e.initAmd=function(e,t,o){t.match(/\/v5\d\.0\//)&&function(e,t,o){e.addLoaderPlugin({loadModule:async e=>r(e),loadMapping:async e=>{const o=await r(`${t}${encodeURIComponent(e)}`,"json");return o&&o.ok?o.json():null},resolveModule:e=>e&&!/\/v\/[^/]+?$/.test(e)?`${e}/v/${o}`:null})}(e,t,o)},Object.defineProperty(e,"__esModule",{value:!0})})),LWR.define("lwr/vault/v/0_12_0-alpha_19",["exports"],(function(e){let t;e.getAuthInfo=function(){return t},e.setAuthInfo=function(e){t=e},Object.defineProperty(e,"__esModule",{value:!0})}));const{initAmd:initAmd,authenticate:authenticate}=await loader.load(bootstrapModule);async function createComponent(e,t,r={},o){const{createComponent:n}=await loader.load(bootstrapModule.replace("Amd",""));return n(e,t,r,o)}initAmd(loader.services,_optionalChain([endpoints,"optionalAccess",e=>e.uris,"access",e=>e.mapping]),"0_12_0-alpha_19");export{authenticate,createComponent};
|