@lwrjs/everywhere 0.12.0-alpha.18 → 0.12.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/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/lwr/everywhereAmd/v/{0_12_0-alpha_18 → 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_18 → 0_12_0-alpha_19}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +19 -19
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_12_0-alpha_18/s/4d339c68d153d7a65ee9aeda30e5c3d9 → 0_12_0-alpha_19/s/bfa35394789428d30613fedf7507d1fd}/lwr_loader.js +131 -125
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_12_0-alpha_18 → 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_18 → 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_18 → 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_18 → 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_18 → 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_18 → 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 +6 -6
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/521bc583cb94284201a80c65daad2264/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_18/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR Module Loader Shim v0.12.0-alpha.
|
|
7
|
+
/* LWR Module Loader Shim v0.12.0-alpha.19 */
|
|
8
8
|
(function () {
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
// Parse configuration
|
|
206
206
|
this.global = global;
|
|
207
207
|
this.config = global.LWR ;
|
|
208
|
-
this.loaderSpecifier = 'lwr/loader/v/0_12_0-
|
|
208
|
+
this.loaderSpecifier = 'lwr/loader/v/0_12_0-alpha_19';
|
|
209
209
|
|
|
210
210
|
// Set up error handler
|
|
211
211
|
this.errorHandler = this.config.onError;
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
const exporter = (exports) => {
|
|
327
327
|
Object.assign(exports, { logOperationStart, logOperationEnd });
|
|
328
328
|
};
|
|
329
|
-
globalLWR.define('lwr/profiler/v/0_12_0-
|
|
329
|
+
globalLWR.define('lwr/profiler/v/0_12_0-alpha_19', ['exports'], exporter);
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// Set up the application globals, import map, root custom element...
|
|
@@ -399,14 +399,14 @@
|
|
|
399
399
|
// The loader module is ALWAYS required
|
|
400
400
|
const GLOBAL = globalThis ;
|
|
401
401
|
GLOBAL.LWR.requiredModules = GLOBAL.LWR.requiredModules || [];
|
|
402
|
-
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_12_0-
|
|
403
|
-
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_12_0-
|
|
402
|
+
if (GLOBAL.LWR.requiredModules.indexOf('lwr/loader/v/0_12_0-alpha_19') < 0) {
|
|
403
|
+
GLOBAL.LWR.requiredModules.push('lwr/loader/v/0_12_0-alpha_19');
|
|
404
404
|
}
|
|
405
405
|
new LoaderShim(GLOBAL);
|
|
406
406
|
|
|
407
407
|
})();
|
|
408
408
|
|
|
409
|
-
LWR.define('lwr/loader/v/0_12_0-
|
|
409
|
+
LWR.define('lwr/loader/v/0_12_0-alpha_19', ['exports'], (function (exports) { 'use strict';
|
|
410
410
|
|
|
411
411
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
412
412
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1201,22 +1201,13 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1201
1201
|
|
|
1202
1202
|
|
|
1203
1203
|
|
|
1204
|
+
|
|
1205
|
+
|
|
1204
1206
|
|
|
1205
1207
|
|
|
1206
1208
|
|
|
1207
1209
|
class ModuleRegistry {
|
|
1208
1210
|
|
|
1209
|
-
|
|
1210
|
-
// A registry for named AMD defines containing the *metadata* of AMD module
|
|
1211
|
-
__init() {this.namedDefineRegistry = new Map();}
|
|
1212
|
-
// The evaluated module registry where the module identifier (name or URL?) is the key
|
|
1213
|
-
__init2() {this.moduleRegistry = new Map();}
|
|
1214
|
-
// Aliases of modules in the registry
|
|
1215
|
-
__init3() {this.aliases = new Map();}
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
1211
|
|
|
1221
1212
|
constructor(config) {ModuleRegistry.prototype.__init.call(this);ModuleRegistry.prototype.__init2.call(this);ModuleRegistry.prototype.__init3.call(this);
|
|
1222
1213
|
this.profiler = config.profiler;
|
|
@@ -1226,9 +1217,6 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1226
1217
|
);
|
|
1227
1218
|
}
|
|
1228
1219
|
|
|
1229
|
-
/**
|
|
1230
|
-
* Module import
|
|
1231
|
-
*/
|
|
1232
1220
|
async load(id, importer) {
|
|
1233
1221
|
const metadata = importer ? { importer } : {};
|
|
1234
1222
|
this.profiler.logOperationStart({
|
|
@@ -1236,23 +1224,18 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1236
1224
|
specifier: id,
|
|
1237
1225
|
metadata,
|
|
1238
1226
|
});
|
|
1239
|
-
|
|
1240
1227
|
const resolvedId = await this.resolve(id, importer);
|
|
1241
|
-
const moduleRecord = this.getModuleRecord(resolvedId, id);
|
|
1242
|
-
|
|
1228
|
+
const moduleRecord = await this.getModuleRecord(resolvedId, id);
|
|
1243
1229
|
if (moduleRecord.evaluated) {
|
|
1244
1230
|
return moduleRecord.module;
|
|
1245
1231
|
} else {
|
|
1246
1232
|
if (!moduleRecord.evaluationPromise) {
|
|
1247
|
-
moduleRecord.evaluationPromise = this.
|
|
1233
|
+
moduleRecord.evaluationPromise = this.topLevelEvaluation(moduleRecord);
|
|
1248
1234
|
}
|
|
1249
1235
|
return moduleRecord.evaluationPromise;
|
|
1250
1236
|
}
|
|
1251
1237
|
}
|
|
1252
1238
|
|
|
1253
|
-
/**
|
|
1254
|
-
* Resolve id for a module
|
|
1255
|
-
*/
|
|
1256
1239
|
async resolve(id, importer) {
|
|
1257
1240
|
const parentUrl = this.resolver.getBaseUrl(); // only support baseUrl for now
|
|
1258
1241
|
|
|
@@ -1268,7 +1251,7 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1268
1251
|
// eslint-disable-next-line no-await-in-loop
|
|
1269
1252
|
result = isResponseAPromise(response) ? await response : response;
|
|
1270
1253
|
}
|
|
1271
|
-
if (!isValidResolveResponse(result)) {
|
|
1254
|
+
if (!this.isValidResolveResponse(result)) {
|
|
1272
1255
|
throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
|
|
1273
1256
|
}
|
|
1274
1257
|
|
|
@@ -1354,9 +1337,6 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1354
1337
|
return this.moduleRegistry.has(id);
|
|
1355
1338
|
}
|
|
1356
1339
|
|
|
1357
|
-
/**
|
|
1358
|
-
* Module entry point LWR.define()
|
|
1359
|
-
*/
|
|
1360
1340
|
define(name, dependencies, exporter) {
|
|
1361
1341
|
const mod = this.namedDefineRegistry.get(name);
|
|
1362
1342
|
// Don't allow redefining a module.
|
|
@@ -1423,6 +1403,19 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1423
1403
|
});
|
|
1424
1404
|
}
|
|
1425
1405
|
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
// A registry for named AMD defines containing the *metadata* of AMD module
|
|
1409
|
+
__init() {this.namedDefineRegistry = new Map();}
|
|
1410
|
+
|
|
1411
|
+
// The evaluated module registry where the module identifier (name or URL?) is the key
|
|
1412
|
+
__init2() {this.moduleRegistry = new Map();}
|
|
1413
|
+
|
|
1414
|
+
// Aliases of modules in the registry
|
|
1415
|
+
__init3() {this.aliases = new Map();}
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1426
1419
|
getImportMetadataResolver() {
|
|
1427
1420
|
return this.resolver;
|
|
1428
1421
|
}
|
|
@@ -1448,7 +1441,7 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1448
1441
|
return moduleRecord;
|
|
1449
1442
|
}
|
|
1450
1443
|
|
|
1451
|
-
getModuleRecord(resolvedId, id) {
|
|
1444
|
+
async getModuleRecord(resolvedId, id) {
|
|
1452
1445
|
// Look for an existing record
|
|
1453
1446
|
const existingRecord = this.getExistingModuleRecord(resolvedId, id);
|
|
1454
1447
|
if (existingRecord) {
|
|
@@ -1456,10 +1449,29 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1456
1449
|
return existingRecord;
|
|
1457
1450
|
}
|
|
1458
1451
|
|
|
1452
|
+
// Create a new Module Record
|
|
1453
|
+
const instantiation = this.getModuleDef(resolvedId, id);
|
|
1454
|
+
const dependencyRecords = instantiation.then((moduleDef) => {
|
|
1455
|
+
const dependencies = moduleDef.dependencies || [];
|
|
1456
|
+
// get dep and filter out exports
|
|
1457
|
+
const filtered = dependencies
|
|
1458
|
+
.map((dep) => {
|
|
1459
|
+
if (dep === 'exports') {
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
invariant(dep !== 'require', NO_AMD_REQUIRE);
|
|
1463
|
+
return this.getModuleDependencyRecord.call(this, dep);
|
|
1464
|
+
})
|
|
1465
|
+
.filter((depRecord) => depRecord !== undefined) ;
|
|
1466
|
+
|
|
1467
|
+
return Promise.all(filtered);
|
|
1468
|
+
});
|
|
1469
|
+
|
|
1459
1470
|
const newModuleRecord = {
|
|
1460
1471
|
id: resolvedId,
|
|
1461
1472
|
module: Object.create(null),
|
|
1462
|
-
|
|
1473
|
+
dependencyRecords,
|
|
1474
|
+
instantiation,
|
|
1463
1475
|
evaluated: false,
|
|
1464
1476
|
evaluationPromise: null,
|
|
1465
1477
|
};
|
|
@@ -1467,7 +1479,8 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1467
1479
|
this.moduleRegistry.set(resolvedId, newModuleRecord);
|
|
1468
1480
|
this.storeModuleAlias(id, resolvedId);
|
|
1469
1481
|
|
|
1470
|
-
return
|
|
1482
|
+
// Wait for the dependencies to resolve the return the moduleRecord
|
|
1483
|
+
return dependencyRecords.then(() => newModuleRecord);
|
|
1471
1484
|
}
|
|
1472
1485
|
|
|
1473
1486
|
storeModuleAlias(aliasId, resolvedId) {
|
|
@@ -1488,87 +1501,95 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1488
1501
|
}
|
|
1489
1502
|
}
|
|
1490
1503
|
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
async evaluateDependencies(
|
|
1495
|
-
dependencies,
|
|
1496
|
-
evaluationMap,
|
|
1497
|
-
) {
|
|
1498
|
-
const exports = {};
|
|
1499
|
-
const promiseArray = [];
|
|
1500
|
-
|
|
1501
|
-
if (dependencies) {
|
|
1502
|
-
for (const dep of dependencies) {
|
|
1503
|
-
if (dep === 'exports') {
|
|
1504
|
-
promiseArray.push(Promise.resolve(exports));
|
|
1505
|
-
} else {
|
|
1506
|
-
invariant(dep !== 'require', NO_AMD_REQUIRE);
|
|
1507
|
-
promiseArray.push(this.evaluateDependent(dep, evaluationMap));
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
return Promise.all(promiseArray).then((results) => {
|
|
1513
|
-
const depsMapped = results.filter((result) => result !== undefined);
|
|
1514
|
-
return { depsMapped, exports };
|
|
1515
|
-
});
|
|
1504
|
+
async getModuleDependencyRecord(dependency) {
|
|
1505
|
+
const resolvedDepId = await this.resolve(dependency);
|
|
1506
|
+
return this.getModuleRecord(resolvedDepId, dependency);
|
|
1516
1507
|
}
|
|
1517
1508
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
const handleReturn = (module) => {
|
|
1525
|
-
if (module) {
|
|
1526
|
-
return module.__defaultInterop ? module.default : module;
|
|
1527
|
-
}
|
|
1528
|
-
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
|
1529
|
-
};
|
|
1509
|
+
// execute the "top-level code" (the code outside of functions) of a module
|
|
1510
|
+
async topLevelEvaluation(moduleRecord) {
|
|
1511
|
+
await this.instantiateAll(moduleRecord, {});
|
|
1512
|
+
return this.evaluateModule(moduleRecord, {});
|
|
1513
|
+
}
|
|
1530
1514
|
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1515
|
+
// Returns a promise when a module and all of it's dependencies have finished instantiation
|
|
1516
|
+
async instantiateAll(
|
|
1517
|
+
moduleRecord,
|
|
1518
|
+
instantiatedMap,
|
|
1519
|
+
) {
|
|
1520
|
+
if (!instantiatedMap[moduleRecord.id]) {
|
|
1521
|
+
instantiatedMap[moduleRecord.id] = true;
|
|
1522
|
+
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
|
1523
|
+
if (dependencyModuleRecords) {
|
|
1524
|
+
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
|
1525
|
+
const depRecord = dependencyModuleRecords[i];
|
|
1526
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1527
|
+
await this.instantiateAll(depRecord, instantiatedMap);
|
|
1528
|
+
}
|
|
1545
1529
|
}
|
|
1546
|
-
return depModuleRecord.evaluationPromise.then((module) => {
|
|
1547
|
-
return handleReturn(module);
|
|
1548
|
-
});
|
|
1549
|
-
} else {
|
|
1550
|
-
// Otherwise return a dummy circular module wrapper
|
|
1551
|
-
module = getCircularDependencyWrapper(module);
|
|
1552
1530
|
}
|
|
1553
|
-
return handleReturn(module);
|
|
1554
1531
|
}
|
|
1555
1532
|
|
|
1556
1533
|
async evaluateModule(
|
|
1557
1534
|
moduleRecord,
|
|
1558
1535
|
evaluationMap,
|
|
1559
1536
|
) {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1537
|
+
const dependencyModuleRecords = await moduleRecord.dependencyRecords;
|
|
1538
|
+
if (dependencyModuleRecords.length > 0) {
|
|
1539
|
+
evaluationMap[moduleRecord.id] = true;
|
|
1540
|
+
// evaluate dependencies first
|
|
1541
|
+
await this.evaluateModuleDependencies(dependencyModuleRecords, evaluationMap);
|
|
1542
|
+
}
|
|
1563
1543
|
|
|
1564
|
-
// Wait for load to finish
|
|
1565
1544
|
const { exporter, dependencies } = await moduleRecord.instantiation;
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
const
|
|
1545
|
+
// The exports object automatically gets filled in by the exporter evaluation
|
|
1546
|
+
const exports = {};
|
|
1547
|
+
const depsMapped = dependencies
|
|
1548
|
+
? await Promise.all(
|
|
1549
|
+
dependencies.map(async (dep) => {
|
|
1550
|
+
if (dep === 'exports') {
|
|
1551
|
+
return exports;
|
|
1552
|
+
}
|
|
1553
|
+
const resolvedDepId = await this.resolve(dep);
|
|
1554
|
+
|
|
1555
|
+
const moduleRecord = this.moduleRegistry.get(resolvedDepId) ;
|
|
1556
|
+
if (!moduleRecord) {
|
|
1557
|
+
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
const module = moduleRecord.module;
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Circular dependencies are handled properly when named exports are used,
|
|
1564
|
+
* however, for default exports there is a bug: https://github.com/rollup/rollup/issues/3384
|
|
1565
|
+
*
|
|
1566
|
+
* The workaround below applies for circular dependencies (!moduleRecord.evaluated)
|
|
1567
|
+
*/
|
|
1568
|
+
if (!moduleRecord.evaluated) {
|
|
1569
|
+
return this.getCircularDependencyWrapper(module);
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
if (module) {
|
|
1573
|
+
return module.__defaultInterop ? module.default : module;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
throw new LoaderError(FAILED_DEP, [resolvedDepId]);
|
|
1577
|
+
}),
|
|
1578
|
+
)
|
|
1579
|
+
: [];
|
|
1580
|
+
|
|
1581
|
+
// 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
|
|
1582
|
+
if (moduleRecord.evaluated) {
|
|
1583
|
+
return moduleRecord.module;
|
|
1584
|
+
}
|
|
1569
1585
|
|
|
1570
1586
|
// evaluates the module function
|
|
1571
|
-
let moduleDefault
|
|
1587
|
+
let moduleDefault;
|
|
1588
|
+
try {
|
|
1589
|
+
moduleDefault = exporter(...depsMapped);
|
|
1590
|
+
} catch (e) {
|
|
1591
|
+
throw new LoaderError(EXPORTER_ERROR, [moduleRecord.id, e.message || e]);
|
|
1592
|
+
}
|
|
1572
1593
|
// value is returned from exporter, then we are not using named exports
|
|
1573
1594
|
if (moduleDefault !== undefined) {
|
|
1574
1595
|
moduleDefault = { default: moduleDefault };
|
|
@@ -1580,7 +1601,7 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1580
1601
|
// if no return value, then we are using the exports object
|
|
1581
1602
|
else {
|
|
1582
1603
|
// handle only default export with Rollup forced named exports
|
|
1583
|
-
if (isNamedExportDefaultOnly(exports)) {
|
|
1604
|
+
if (this.isNamedExportDefaultOnly(exports)) {
|
|
1584
1605
|
Object.defineProperty(exports, '__useDefault', { value: true });
|
|
1585
1606
|
}
|
|
1586
1607
|
}
|
|
@@ -1612,17 +1633,42 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1612
1633
|
Object.defineProperty(moduleRecord.module, '__esModule', { value: true });
|
|
1613
1634
|
}
|
|
1614
1635
|
|
|
1615
|
-
Object.freeze(moduleRecord.module);
|
|
1616
1636
|
moduleRecord.evaluated = true;
|
|
1617
|
-
moduleRecord.
|
|
1637
|
+
Object.freeze(moduleRecord.module);
|
|
1618
1638
|
return moduleRecord.module;
|
|
1619
1639
|
}
|
|
1620
1640
|
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1641
|
+
// Determines if named exports module has only default export
|
|
1642
|
+
isNamedExportDefaultOnly(exports) {
|
|
1643
|
+
return (
|
|
1644
|
+
exports !== undefined &&
|
|
1645
|
+
Object.getOwnPropertyNames(exports).length === 2 &&
|
|
1646
|
+
Object.prototype.hasOwnProperty.call(exports, 'default') &&
|
|
1647
|
+
Object.prototype.hasOwnProperty.call(exports, '__esModule')
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
|
1652
|
+
// The LWC engine checks for __circular__ to detect circular dependencies.
|
|
1653
|
+
getCircularDependencyWrapper(module) {
|
|
1654
|
+
const tmp = () => {
|
|
1655
|
+
return module.__useDefault || module.__defaultInterop ? module.default : module;
|
|
1656
|
+
};
|
|
1657
|
+
tmp.__circular__ = true;
|
|
1658
|
+
return tmp;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
async evaluateModuleDependencies(
|
|
1662
|
+
dependencyModuleRecords,
|
|
1663
|
+
evaluationMap,
|
|
1664
|
+
) {
|
|
1665
|
+
for (let i = 0; i < dependencyModuleRecords.length; i++) {
|
|
1666
|
+
const depRecord = dependencyModuleRecords[i];
|
|
1667
|
+
if (!depRecord.evaluated && !evaluationMap[depRecord.id]) {
|
|
1668
|
+
evaluationMap[depRecord.id] = true;
|
|
1669
|
+
// eslint-disable-next-line no-await-in-loop
|
|
1670
|
+
await this.evaluateModule(depRecord, evaluationMap);
|
|
1671
|
+
}
|
|
1626
1672
|
}
|
|
1627
1673
|
}
|
|
1628
1674
|
|
|
@@ -1702,6 +1748,9 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1702
1748
|
});
|
|
1703
1749
|
}
|
|
1704
1750
|
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
|
|
1705
1754
|
addLoaderPlugin(hooks) {
|
|
1706
1755
|
if (typeof hooks !== 'object') {
|
|
1707
1756
|
throw new LoaderError(INVALID_HOOK);
|
|
@@ -1743,6 +1792,7 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1743
1792
|
}
|
|
1744
1793
|
}
|
|
1745
1794
|
|
|
1795
|
+
|
|
1746
1796
|
registerHandleStaleModuleHook(handleStaleModule) {
|
|
1747
1797
|
if (this.handleStaleModuleHook) {
|
|
1748
1798
|
this.handleStaleModuleHook.push(handleStaleModule);
|
|
@@ -1750,30 +1800,12 @@ LWR.define('lwr/loader/v/0_12_0-alpha_18', ['exports'], (function (exports) { 'u
|
|
|
1750
1800
|
this.handleStaleModuleHook = [handleStaleModule];
|
|
1751
1801
|
}
|
|
1752
1802
|
}
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
// Determines if named exports module has only default export
|
|
1756
|
-
function isNamedExportDefaultOnly(exports) {
|
|
1757
|
-
return (
|
|
1758
|
-
exports !== undefined &&
|
|
1759
|
-
Object.getOwnPropertyNames(exports).length === 2 &&
|
|
1760
|
-
Object.prototype.hasOwnProperty.call(exports, 'default') &&
|
|
1761
|
-
Object.prototype.hasOwnProperty.call(exports, '__esModule')
|
|
1762
|
-
);
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
// Wrap the dependency in a function that can be called and detected by __circular__ property.
|
|
1766
|
-
// The LWC engine checks for __circular__ to detect circular dependencies.
|
|
1767
|
-
function getCircularDependencyWrapper(module) {
|
|
1768
|
-
const tmp = () => {
|
|
1769
|
-
return module.__useDefault || module.__defaultInterop ? module.default : module;
|
|
1770
|
-
};
|
|
1771
|
-
tmp.__circular__ = true;
|
|
1772
|
-
return tmp;
|
|
1773
|
-
}
|
|
1774
1803
|
|
|
1775
|
-
|
|
1776
|
-
|
|
1804
|
+
isValidResolveResponse(res) {
|
|
1805
|
+
return (
|
|
1806
|
+
res === null || typeof res === 'string' || (res && typeof (res ).url === 'string')
|
|
1807
|
+
);
|
|
1808
|
+
}
|
|
1777
1809
|
}
|
|
1778
1810
|
|
|
1779
1811
|
/**
|