@lwrjs/everywhere 0.11.0-alpha.4 → 0.11.0-alpha.7

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.
Files changed (23) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/78b653169a5192c4659563d9bb43ccad/config.js +11 -0
  2. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7/s/625ff96e920182ae7ef5b87f02964e6c/@lwrjs_app-service_amd-bootstrap_module_amd.js +18 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{3_1_3/s/5ecae4481a6009197f93d4b83392ccba → 3_2_0/s/ab8f5848cd7c307feeeb8a995ab42add}/lwc.js +84 -32
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_11_0-alpha_4 → 0_11_0-alpha_7}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_11_0-alpha_4/s/5e6db37af51f0d23be4893abe5eeb913 → 0_11_0-alpha_7/s/f30361ad8ff7af505bf4d465c8499181}/lwr_init.js +23 -23
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_11_0-alpha_4/s/9157743ef20db59d5719497d0e030f2c → 0_11_0-alpha_7/s/db2848f0cffe03ff0c6a3124c73dc736}/lwr_loader.js +52 -18
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_11_0-alpha_4/s/7a802ee7a2430244c1f66bce2c2eafef → 0_11_0-alpha_7/s/274c8343f810353bbad085a79709395f}/lwr_metrics.js +5 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_11_0-alpha_4 → 0_11_0-alpha_7}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_11_0-alpha_4 → 0_11_0-alpha_7}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_11_0-alpha_4 → 0_11_0-alpha_7}/lwr-error-shim.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_11_0-alpha_4 → 0_11_0-alpha_7}/lwr-loader-shim.bundle.js +82 -49
  12. package/build/assets/amd/lwr-everywhere-debug.js +82 -49
  13. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  14. package/build/assets/amd/lwr-everywhere.js +82 -49
  15. package/build/assets/core/lwr-everywhere-debug.js +78 -45
  16. package/build/assets/core/lwr-everywhere-min.js +2 -2
  17. package/build/assets/core/lwr-everywhere.js +78 -45
  18. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  19. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  20. package/build/assets/esm/lwr-everywhere.js +1 -1
  21. package/package.json +11 -9
  22. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/cb9e50b5ee47462a86c0eac92c706258/config.js +0 -11
  23. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_4/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -18
@@ -0,0 +1,11 @@
1
+ /* This script is generated */
2
+ /* Client Bootstrap configuration */
3
+ globalThis.LWR = globalThis.LWR || {};
4
+ Object.assign(globalThis.LWR, {"appId":"amd-bootstrap","bootstrapModule":"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_11_0-alpha_7/s/625ff96e920182ae7ef5b87f02964e6c/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_11_0-alpha_7/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js":["lwr/init/v/0_11_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_11_0-alpha_7/s/274c8343f810353bbad085a79709395f/lwr_metrics.js":["lwr/metrics/v/0_11_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_11_0-alpha_7/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js":["lwr/profiler/v/0_11_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F3_2_0/s/ab8f5848cd7c307feeeb8a995ab42add/lwc.js":["lwc/v/3_2_0"],"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_11_0-alpha_7/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_11_0-alpha_7"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_11_0-alpha_7/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_11_0-alpha_7"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_11_0-alpha_7/s/625ff96e920182ae7ef5b87f02964e6c/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/init/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_11_0-alpha_7/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js","lwr/metrics/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_11_0-alpha_7/s/274c8343f810353bbad085a79709395f/lwr_metrics.js","lwr/profiler/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_11_0-alpha_7/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js","lwc/v/3_2_0":"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F3_2_0/s/ab8f5848cd7c307feeeb8a995ab42add/lwc.js","lwr/everywhereAmd/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_11_0-alpha_7/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js","lwr/vault/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_11_0-alpha_7/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_11_0-alpha_7","lwr/everywhereAmd/v/0_11_0-alpha_7"],"serverData":{},"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7"],"preloadModules":["lwr/init/v/0_11_0-alpha_7","lwr/metrics/v/0_11_0-alpha_7","lwc/v/3_2_0","lwr/everywhereAmd/v/0_11_0-alpha_7","lwr/everywhereAmd/v/0_11_0-alpha_7"],"endpoints":{"uris":{"mapping":"/1/mapping/amd/1/l/en-US/mp/"}}});
5
+ globalThis.process = { env: { NODE_ENV: "compat", SSR: false } };
6
+ globalThis.lwcRuntimeFlags = { ENABLE_MIXED_SHADOW_MODE: false };
7
+ // Appended by Static Site Generator
8
+ if (!globalThis.LWR.imports) { globalThis.LWR.imports = {}; }
9
+ Object.assign(globalThis.LWR.imports, {"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_11_0-alpha_7/s/db2848f0cffe03ff0c6a3124c73dc736/lwr_loader.js":["lwr/loader/v/0_11_0-alpha_7"]})
10
+ if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
11
+ Object.assign(globalThis.LWR.index, {"lwr/loader/v/0_11_0-alpha_7":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_11_0-alpha_7/s/db2848f0cffe03ff0c6a3124c73dc736/lwr_loader.js"})
@@ -0,0 +1,18 @@
1
+ LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7', ['lwr/loader/v/0_11_0-alpha_7', 'lwr/init/v/0_11_0-alpha_7'], (function (_0_11_0Alpha_7$1, _0_11_0Alpha_7) { 'use strict';
2
+
3
+ const clientBootstrapConfig = globalThis.LWR;
4
+
5
+ // initialize additional non-configured root components
6
+ const { rootComponents, serverData } = clientBootstrapConfig;
7
+ Promise.all(rootComponents.map(async (rootSpecifier) => {
8
+ const element = _0_11_0Alpha_7.toKebabCase(rootSpecifier);
9
+ return _0_11_0Alpha_7$1.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_7').then(({default: Ctor}) => {
10
+ _0_11_0Alpha_7.init([[element, Ctor]], serverData);
11
+ });
12
+ }));
13
+
14
+ globalThis.LWR = Object.freeze({
15
+ define: globalThis.LWR.define,
16
+ });
17
+
18
+ }));
@@ -1,4 +1,4 @@
1
- LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwc/v/3_2_0', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  /**
4
4
  * Copyright (C) 2023 salesforce.com, inc.
@@ -291,9 +291,9 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
291
291
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
292
292
  */
293
293
  // Increment whenever the LWC template compiler changes
294
- const LWC_VERSION = "3.1.3";
294
+ const LWC_VERSION = "3.2.0";
295
295
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
296
- /** version: 3.1.3 */
296
+ /** version: 3.2.0 */
297
297
 
298
298
  /**
299
299
  * Copyright (C) 2023 salesforce.com, inc.
@@ -372,7 +372,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
372
372
  setFeatureFlag(name, value);
373
373
  }
374
374
  }
375
- /** version: 3.1.3 */
375
+ /** version: 3.2.0 */
376
376
 
377
377
  /**
378
378
  * Copyright (C) 2023 salesforce.com, inc.
@@ -435,7 +435,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
435
435
  }
436
436
  }
437
437
  }
438
- /** version: 3.1.3 */
438
+ /** version: 3.2.0 */
439
439
 
440
440
  /*
441
441
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1527,7 +1527,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
1527
1527
  valueMutated(originalTarget, key);
1528
1528
  return true;
1529
1529
  }
1530
- /*LWC compiler v3.1.3*/
1530
+ /*LWC compiler v3.2.0*/
1531
1531
  }
1532
1532
  const getterMap = new WeakMap();
1533
1533
  const setterMap = new WeakMap();
@@ -1620,7 +1620,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
1620
1620
  /* istanbul ignore next */
1621
1621
  return false;
1622
1622
  }
1623
- /*LWC compiler v3.1.3*/
1623
+ /*LWC compiler v3.2.0*/
1624
1624
  }
1625
1625
  function extract(objectOrArray) {
1626
1626
  if (isArray(objectOrArray)) {
@@ -1987,6 +1987,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
1987
1987
  logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
1988
1988
  }
1989
1989
  }
1990
+ const supportsElementInternals = typeof ElementInternals !== 'undefined';
1990
1991
  // @ts-ignore
1991
1992
  LightningElement.prototype = {
1992
1993
  constructor: LightningElement,
@@ -2136,6 +2137,23 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
2136
2137
  }
2137
2138
  return getBoundingClientRect(elm);
2138
2139
  },
2140
+ attachInternals() {
2141
+ const vm = getAssociatedVM(this);
2142
+ const {
2143
+ elm,
2144
+ renderer: {
2145
+ attachInternals
2146
+ }
2147
+ } = vm;
2148
+ if (isFalse(supportsElementInternals)) {
2149
+ // Browsers that don't support attachInternals will need to be polyfilled before LWC is loaded.
2150
+ throw new Error('attachInternals API is not supported in this browser environment.');
2151
+ }
2152
+ if (vm.renderMode === 0 /* RenderMode.Light */ || vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
2153
+ throw new Error('attachInternals API is not supported in light DOM or synthetic shadow.');
2154
+ }
2155
+ return attachInternals(elm);
2156
+ },
2139
2157
  get isConnected() {
2140
2158
  const vm = getAssociatedVM(this);
2141
2159
  const {
@@ -3207,7 +3225,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
3207
3225
  }
3208
3226
  function HTMLBridgeElementFactory(SuperClass, props, methods) {
3209
3227
  const HTMLBridgeElement = class extends SuperClass {
3210
- /*LWC compiler v3.1.3*/
3228
+ /*LWC compiler v3.2.0*/
3211
3229
  };
3212
3230
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
3213
3231
  // and false positives in case of inheritance.
@@ -3246,6 +3264,14 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
3246
3264
  descriptors.attributeChangedCallback = {
3247
3265
  value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
3248
3266
  };
3267
+ // To avoid leaking private component details, accessing internals from outside a component is not allowed.
3268
+ descriptors.attachInternals = {
3269
+ get() {
3270
+ if (process.env.NODE_ENV !== 'production') {
3271
+ logError('attachInternals cannot be accessed outside of a component. Use this.attachInternals instead.');
3272
+ }
3273
+ }
3274
+ };
3249
3275
  // Specify attributes for which we want to reflect changes back to their corresponding
3250
3276
  // properties via attributeChangedCallback.
3251
3277
  defineProperty(HTMLBridgeElement, 'observedAttributes', {
@@ -6249,8 +6275,8 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
6249
6275
  }
6250
6276
  resetComponentStateWhenRemoved(vm);
6251
6277
  }
6252
- function getNearestShadowAncestor(vm) {
6253
- let ancestor = vm.owner;
6278
+ function getNearestShadowAncestor(owner) {
6279
+ let ancestor = owner;
6254
6280
  while (!isNull(ancestor) && ancestor.renderMode === 0 /* RenderMode.Light */) {
6255
6281
  ancestor = ancestor.owner;
6256
6282
  }
@@ -6313,15 +6339,12 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
6313
6339
  vm.debugInfo = create(null);
6314
6340
  }
6315
6341
  vm.stylesheets = computeStylesheets(vm, def.ctor);
6316
- vm.shadowMode = computeShadowMode(vm, renderer);
6342
+ vm.shadowMode = computeShadowMode(def, vm.owner, renderer);
6317
6343
  vm.tro = getTemplateReactiveObserver(vm);
6318
6344
  if (process.env.NODE_ENV !== 'production') {
6319
6345
  vm.toString = () => {
6320
6346
  return `[object:vm ${def.name} (${vm.idx})]`;
6321
6347
  };
6322
- if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6323
- vm.shadowMode = 0 /* ShadowMode.Native */;
6324
- }
6325
6348
  }
6326
6349
  // Create component instance associated to the vm and the element.
6327
6350
  invokeComponentConstructor(vm, def.ctor);
@@ -6384,10 +6407,26 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
6384
6407
  });
6385
6408
  }
6386
6409
  }
6387
- function computeShadowMode(vm, renderer) {
6410
+ // Compute the shadowMode/renderMode without creating a VM. This is used in some scenarios like hydration.
6411
+ function computeShadowAndRenderMode(Ctor, renderer) {
6412
+ const def = getComponentInternalDef(Ctor);
6388
6413
  const {
6389
- def
6390
- } = vm;
6414
+ renderMode
6415
+ } = def;
6416
+ // Assume null `owner` - this is what happens in hydration cases anyway
6417
+ const shadowMode = computeShadowMode(def, /* owner */null, renderer);
6418
+ return {
6419
+ renderMode,
6420
+ shadowMode
6421
+ };
6422
+ }
6423
+ function computeShadowMode(def, owner, renderer) {
6424
+ // Force the shadow mode to always be native. Used for running tests with synthetic shadow patches
6425
+ // on, but components running in actual native shadow mode
6426
+ if (process.env.NODE_ENV !== 'production' && lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
6427
+ return 0 /* ShadowMode.Native */;
6428
+ }
6429
+
6391
6430
  const {
6392
6431
  isSyntheticShadowDefined
6393
6432
  } = renderer;
@@ -6401,7 +6440,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
6401
6440
  if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
6402
6441
  shadowMode = 0 /* ShadowMode.Native */;
6403
6442
  } else {
6404
- const shadowAncestor = getNearestShadowAncestor(vm);
6443
+ const shadowAncestor = getNearestShadowAncestor(owner);
6405
6444
  if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6406
6445
  // Transitive support for native Shadow DOM. A component in native mode
6407
6446
  // transitively opts all of its descendants into native.
@@ -7802,7 +7841,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
7802
7841
  }
7803
7842
  return getReadOnlyProxy(obj);
7804
7843
  }
7805
- /** version: 3.1.3 */
7844
+ /** version: 3.2.0 */
7806
7845
 
7807
7846
  /*
7808
7847
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7893,12 +7932,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
7893
7932
  // This check for constructable style sheets is similar to Fast's:
7894
7933
  // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
7895
7934
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
7896
- const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets) &&
7897
- // The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
7898
- // Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
7899
- // (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
7900
- // TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
7901
- isTrue(getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable);
7935
+ const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
7902
7936
  const stylesheetCache = new Map();
7903
7937
  //
7904
7938
  // Test utilities
@@ -8048,7 +8082,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8048
8082
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
8049
8083
  }
8050
8084
  }
8051
- /*LWC compiler v3.1.3*/
8085
+ /*LWC compiler v3.2.0*/
8052
8086
  }
8053
8087
  // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
8054
8088
  // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
@@ -8145,7 +8179,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8145
8179
  function isNull(obj) {
8146
8180
  return obj === null;
8147
8181
  }
8148
- /** version: 3.1.3 */
8182
+ /** version: 3.2.0 */
8149
8183
 
8150
8184
  /*
8151
8185
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8165,7 +8199,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8165
8199
  this.setNewContext = setNewContext;
8166
8200
  this.setDisconnectedCallback = setDisconnectedCallback;
8167
8201
  }
8168
- /*LWC compiler v3.1.3*/
8202
+ /*LWC compiler v3.2.0*/
8169
8203
  }
8170
8204
  function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
8171
8205
  dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
@@ -8311,8 +8345,16 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8311
8345
  function getTagName(elm) {
8312
8346
  return elm.tagName;
8313
8347
  }
8348
+ // Use the attachInternals method from HTMLElement.prototype because access to it is removed
8349
+ // in HTMLBridgeElement, ie: elm.attachInternals is undefined.
8350
+ // Additionally, cache the attachInternals method to protect against 3rd party monkey-patching.
8351
+ const attachInternalsFunc = HTMLElement.prototype.attachInternals;
8352
+ function attachInternals(elm) {
8353
+ return attachInternalsFunc.call(elm);
8354
+ }
8314
8355
  exports.addEventListener = addEventListener;
8315
8356
  exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
8357
+ exports.attachInternals = attachInternals;
8316
8358
  exports.attachShadow = attachShadow;
8317
8359
  exports.cloneNode = cloneNode;
8318
8360
  exports.createComment = createComment;
@@ -8493,10 +8535,20 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8493
8535
  }
8494
8536
  clearNode(this.shadowRoot);
8495
8537
  }
8496
- if (this.childNodes.length > 0) {
8538
+ // Compute renderMode/shadowMode in advance. This must be done before `createVM` because `createVM` may
8539
+ // mutate the element.
8540
+ const {
8541
+ shadowMode,
8542
+ renderMode
8543
+ } = computeShadowAndRenderMode(Ctor, renderer);
8544
+ // Native shadow components are allowed to have pre-existing `childNodes` before upgrade. This supports
8545
+ // use cases where a custom element has declaratively-defined slotted content, e.g.:
8546
+ // https://github.com/salesforce/lwc/issues/3639
8547
+ const isNativeShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 0 /* ShadowMode.Native */;
8548
+ if (!isNativeShadow && this.childNodes.length > 0) {
8497
8549
  if (process.env.NODE_ENV !== 'production') {
8498
8550
  // eslint-disable-next-line no-console
8499
- console.warn(`Custom elements cannot have child nodes. Ensure the element is empty, including whitespace.`);
8551
+ console.warn(`Light DOM and synthetic shadow custom elements cannot have child nodes. ` + `Ensure the element is empty, including whitespace.`);
8500
8552
  }
8501
8553
  clearNode(this);
8502
8554
  }
@@ -8515,7 +8567,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8515
8567
  attributeChangedCallback(name, oldValue, newValue) {
8516
8568
  attributeChangedCallback.call(this, name, oldValue, newValue);
8517
8569
  }
8518
- /*LWC compiler v3.1.3*/
8570
+ /*LWC compiler v3.2.0*/
8519
8571
  }, _a.observedAttributes = observedAttributes, _a;
8520
8572
  }
8521
8573
 
@@ -8729,7 +8781,7 @@ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
8729
8781
  });
8730
8782
  });
8731
8783
  }
8732
- /** version: 3.1.3 */
8784
+ /** version: 3.2.0 */
8733
8785
 
8734
8786
  exports.LightningElement = LightningElement;
8735
8787
  exports.__unstable__ProfilerControl = profilerControl;
@@ -1,10 +1,10 @@
1
- LWR.define('lwr/everywhereAmd/v/0_11_0-alpha_4', ['exports', 'lwr/vault/v/0_11_0-alpha_4'], (function (exports, _0_11_0Alpha_4) { 'use strict';
1
+ LWR.define('lwr/everywhereAmd/v/0_11_0-alpha_7', ['exports', 'lwr/vault/v/0_11_0-alpha_7'], (function (exports, _0_11_0Alpha_7) { 'use strict';
2
2
 
3
3
  // IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
4
4
 
5
5
  // Do an OAuthed fetch
6
6
  async function authFetch(url, accept = 'javascript') {
7
- const authInfo = _0_11_0Alpha_4.getAuthInfo();
7
+ const authInfo = _0_11_0Alpha_7.getAuthInfo();
8
8
  if (authInfo) {
9
9
  return fetch(url, {
10
10
  headers: {
@@ -54,7 +54,7 @@ LWR.define('lwr/everywhereAmd/v/0_11_0-alpha_4', ['exports', 'lwr/vault/v/0_11_0
54
54
  function authenticate(authInfo) {
55
55
  // Put OAuth info into the vault
56
56
  if (authInfo) {
57
- _0_11_0Alpha_4.setAuthInfo(authInfo);
57
+ _0_11_0Alpha_7.setAuthInfo(authInfo);
58
58
  }
59
59
  }
60
60
 
@@ -1,16 +1,16 @@
1
- LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_4', 'lwr/profiler/v/0_11_0-alpha_4', 'lwc/v/3_1_3'], (function (exports, _0_11_0Alpha_4$1, _0_11_0Alpha_4, _3_1_3) { 'use strict';
1
+ LWR.define('lwr/init/v/0_11_0-alpha_7', ['exports', 'lwr/metrics/v/0_11_0-alpha_7', 'lwr/profiler/v/0_11_0-alpha_7', 'lwc/v/3_2_0'], (function (exports, _0_11_0Alpha_7$1, _0_11_0Alpha_7, _3_2_0) { 'use strict';
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
4
 
5
5
  // <hydrateComponentProxy> - This code is removed in core
6
6
 
7
7
  function hydrateComponentProxy(customElement, Ctor, props) {
8
- _3_1_3.hydrateComponent(customElement, Ctor, props);
8
+ _3_2_0.hydrateComponent(customElement, Ctor, props);
9
9
  }
10
10
  // </hydrateComponentProxy>
11
11
 
12
12
  function initializeWebComponent(elementName, Ctor) {
13
- return _3_1_3.createElement(elementName, {
13
+ return _3_2_0.createElement(elementName, {
14
14
  is: Ctor
15
15
  });
16
16
  }
@@ -45,15 +45,15 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
45
45
  * bare specifier and corresponding LightningElement constructor
46
46
  * @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
47
47
  */
48
- function init(rootModules, ssrProps = {}) {
48
+ function init(rootModules, serverData = {}) {
49
49
  if (typeof customElements === 'undefined' || typeof document === 'undefined') {
50
- _0_11_0Alpha_4.logOperationStart({
51
- id: _0_11_0Alpha_4$1.BOOTSTRAP_END
50
+ _0_11_0Alpha_7.logOperationStart({
51
+ id: _0_11_0Alpha_7$1.BOOTSTRAP_END
52
52
  });
53
53
  return;
54
54
  }
55
- _0_11_0Alpha_4.logOperationStart({
56
- id: _0_11_0Alpha_4$1.INIT
55
+ _0_11_0Alpha_7.logOperationStart({
56
+ id: _0_11_0Alpha_7$1.INIT
57
57
  });
58
58
  let index = 0;
59
59
  for (const [specifier, ctor] of rootModules) {
@@ -61,8 +61,8 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
61
61
 
62
62
  // initialize and inject the root module into the LWR Root or DOM if it is missing
63
63
  if (!document.body.querySelector(elementName)) {
64
- _0_11_0Alpha_4.logOperationStart({
65
- id: _0_11_0Alpha_4$1.INIT_MODULE,
64
+ _0_11_0Alpha_7.logOperationStart({
65
+ id: _0_11_0Alpha_7$1.INIT_MODULE,
66
66
  specifier,
67
67
  specifierIndex: ++index
68
68
  });
@@ -71,8 +71,8 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
71
71
  const component = initializeWebComponent(elementName, ctor);
72
72
  const container = document.querySelector('[lwr-root]');
73
73
  container ? container.appendChild(component) : document.body.appendChild(component);
74
- _0_11_0Alpha_4.logOperationEnd({
75
- id: _0_11_0Alpha_4$1.INIT_MODULE,
74
+ _0_11_0Alpha_7.logOperationEnd({
75
+ id: _0_11_0Alpha_7$1.INIT_MODULE,
76
76
  specifier,
77
77
  specifierIndex: index,
78
78
  metadata: {
@@ -85,8 +85,8 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
85
85
  // the page has been rendered or SSR'd, and each component needs to initialized(or hydrated)
86
86
  const elements = document.querySelectorAll(elementName);
87
87
  for (const element of elements) {
88
- _0_11_0Alpha_4.logOperationStart({
89
- id: _0_11_0Alpha_4$1.INIT_MODULE,
88
+ _0_11_0Alpha_7.logOperationStart({
89
+ id: _0_11_0Alpha_7$1.INIT_MODULE,
90
90
  specifier,
91
91
  specifierIndex: ++index
92
92
  });
@@ -96,9 +96,9 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
96
96
  if (propsId) {
97
97
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
98
98
  // @ts-ignore
99
- hydrateComponentProxy(element, ctor, ssrProps[propsId] || {});
100
- _0_11_0Alpha_4.logOperationEnd({
101
- id: _0_11_0Alpha_4$1.INIT_MODULE,
99
+ hydrateComponentProxy(element, ctor, serverData[propsId] || {});
100
+ _0_11_0Alpha_7.logOperationEnd({
101
+ id: _0_11_0Alpha_7$1.INIT_MODULE,
102
102
  specifier,
103
103
  specifierIndex: index,
104
104
  metadata: {
@@ -136,8 +136,8 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
136
136
  if (parent) {
137
137
  parent.replaceChild(component, element);
138
138
  }
139
- _0_11_0Alpha_4.logOperationEnd({
140
- id: _0_11_0Alpha_4$1.INIT_MODULE,
139
+ _0_11_0Alpha_7.logOperationEnd({
140
+ id: _0_11_0Alpha_7$1.INIT_MODULE,
141
141
  specifier,
142
142
  specifierIndex: index,
143
143
  metadata: {
@@ -146,11 +146,11 @@ LWR.define('lwr/init/v/0_11_0-alpha_4', ['exports', 'lwr/metrics/v/0_11_0-alpha_
146
146
  });
147
147
  }
148
148
  }
149
- _0_11_0Alpha_4.logOperationEnd({
150
- id: _0_11_0Alpha_4$1.INIT
149
+ _0_11_0Alpha_7.logOperationEnd({
150
+ id: _0_11_0Alpha_7$1.INIT
151
151
  });
152
- _0_11_0Alpha_4.logOperationStart({
153
- id: _0_11_0Alpha_4$1.BOOTSTRAP_END
152
+ _0_11_0Alpha_7.logOperationStart({
153
+ id: _0_11_0Alpha_7$1.BOOTSTRAP_END
154
154
  });
155
155
  }
156
156
 
@@ -1,4 +1,4 @@
1
- LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwr/loader/v/0_11_0-alpha_7', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  /**
4
4
  * Copyright (c) 2021, salesforce.com, inc.
@@ -6,7 +6,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
6
6
  * SPDX-License-Identifier: MIT
7
7
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8
8
  */
9
- /* LWR Module Loader v0.11.0-alpha.4 */
9
+ /* LWR Module Loader v0.11.0-alpha.7 */
10
10
  const templateRegex = /\{([0-9]+)\}/g;
11
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  function templateString(template, args) {
@@ -25,7 +25,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
25
25
  super();
26
26
  this.message = generateErrorMessage(errorInfo, errorArgs);
27
27
  }
28
- /*LWC compiler v3.1.3*/
28
+ /*LWC compiler v3.2.0*/
29
29
  }
30
30
  function invariant(condition, errorInfo) {
31
31
  if (!condition) {
@@ -122,6 +122,11 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
122
122
  level: 0,
123
123
  message: 'Invalid import metadata: {0} {1}'
124
124
  });
125
+ const EXPORTER_ERROR = Object.freeze({
126
+ code: 3021,
127
+ level: 0,
128
+ message: 'Error evaluating module "{0}", error was "{1}"'
129
+ });
125
130
 
126
131
  /* importMap errors */
127
132
  Object.freeze({
@@ -300,6 +305,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
300
305
  // Loader: modules
301
306
  const LOADER_PREFIX = 'lwr.loader.';
302
307
  const MODULE_DEFINE = `${LOADER_PREFIX}module.define`;
308
+ const MODULE_DYNAMIC_LOAD = `${LOADER_PREFIX}moduleRegistry.dynamicLoad`;
303
309
  const MODULE_FETCH = `${LOADER_PREFIX}module.fetch`;
304
310
  const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
305
311
 
@@ -632,7 +638,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
632
638
  }
633
639
  async function evaluateLoadHookResponse(response, id) {
634
640
  return Promise.resolve().then(async () => {
635
- if (!response.status) {
641
+ if (!response || !response.status) {
636
642
  throw new LoaderError(INVALID_LOADER_SERVICE_RESPONSE);
637
643
  }
638
644
  if (response.status !== 200) {
@@ -656,6 +662,10 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
656
662
  // TODO eval source maps for debugging
657
663
  eval(trusted.createScript(code));
658
664
  } catch (e) {
665
+ if (process.env.NODE_ENV !== 'production' && hasConsole) {
666
+ // eslint-disable-next-line lwr/no-unguarded-apis
667
+ console.error(e);
668
+ }
659
669
  throw new LoaderError(FAIL_LOAD, [id]);
660
670
  }
661
671
  if (lastWindowError) {
@@ -696,8 +706,16 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
696
706
  this.resolver = new ImportMetadataResolver(config, this.importMetadataInvalidationCallback.bind(this));
697
707
  }
698
708
  async load(id, importer) {
709
+ const metadata = importer ? {
710
+ importer
711
+ } : {};
712
+ this.profiler.logOperationStart({
713
+ id: MODULE_DYNAMIC_LOAD,
714
+ specifier: id,
715
+ metadata
716
+ });
699
717
  const resolvedId = await this.resolve(id, importer);
700
- const moduleRecord = this.getModuleRecord(resolvedId, id);
718
+ const moduleRecord = await this.getModuleRecord(resolvedId, id);
701
719
  if (moduleRecord.evaluated) {
702
720
  return moduleRecord.module;
703
721
  } else {
@@ -765,7 +783,10 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
765
783
  const resolvedUrl = this.resolver.resolveLocal(resolvedOrPlain);
766
784
  if (resolvedUrl) {
767
785
  // return the plain id if it is already defined && the resolvedUrl is NOT already in the module registry
768
- if (this.namedDefineRegistry.has(resolvedOrPlain) && this.namedDefineRegistry.get(resolvedOrPlain).defined) {
786
+ if (this.namedDefineRegistry.has(resolvedOrPlain) &&
787
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
788
+ // @ts-ignore has check right above
789
+ this.namedDefineRegistry.get(resolvedOrPlain).defined) {
769
790
  const record = this.moduleRegistry.get(resolvedUrl);
770
791
  if (!record || !this.aliases.has(resolvedOrPlain)) {
771
792
  return resolvedOrPlain;
@@ -901,7 +922,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
901
922
  }
902
923
  return moduleRecord;
903
924
  }
904
- getModuleRecord(resolvedId, id) {
925
+ async getModuleRecord(resolvedId, id) {
905
926
  // Look for an existing record
906
927
  const existingRecord = this.getExistingModuleRecord(resolvedId, id);
907
928
  if (existingRecord) {
@@ -912,7 +933,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
912
933
  // Create a new Module Record
913
934
  const instantiation = this.getModuleDef(resolvedId, id);
914
935
  const dependencyRecords = instantiation.then(moduleDef => {
915
- const dependencies = moduleDef.dependencies;
936
+ const dependencies = moduleDef.dependencies || [];
916
937
  // get dep and filter out exports
917
938
  const filtered = dependencies.map(dep => {
918
939
  if (dep === 'exports') {
@@ -933,7 +954,9 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
933
954
  };
934
955
  this.moduleRegistry.set(resolvedId, newModuleRecord);
935
956
  this.storeModuleAlias(id, resolvedId);
936
- return newModuleRecord;
957
+
958
+ // Wait for the dependencies to resolve the return the moduleRecord
959
+ return dependencyRecords.then(() => newModuleRecord);
937
960
  }
938
961
  storeModuleAlias(aliasId, resolvedId) {
939
962
  if (aliasId !== resolvedId) {
@@ -944,7 +967,10 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
944
967
  const currentResolvedId = this.aliases.get(aliasId);
945
968
  if (currentResolvedId !== resolvedId) {
946
969
  // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
947
- console.warn(`Alias update attempt: ${aliasId}=>${currentResolvedId}, ${resolvedId}`);
970
+ if (process.env.NODE_ENV !== 'production' && hasConsole) {
971
+ // eslint-disable-next-line lwr/no-unguarded-apis, no-undef
972
+ console.warn(`Alias update attempt: ${aliasId}=>${currentResolvedId}, ${resolvedId}`);
973
+ }
948
974
  }
949
975
  }
950
976
  }
@@ -987,7 +1013,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
987
1013
  } = await moduleRecord.instantiation;
988
1014
  // The exports object automatically gets filled in by the exporter evaluation
989
1015
  const exports = {};
990
- const depsMapped = await Promise.all(dependencies.map(async dep => {
1016
+ const depsMapped = dependencies ? await Promise.all(dependencies.map(async dep => {
991
1017
  if (dep === 'exports') {
992
1018
  return exports;
993
1019
  }
@@ -1011,7 +1037,7 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
1011
1037
  return module.__defaultInterop ? module.default : module;
1012
1038
  }
1013
1039
  throw new LoaderError(FAILED_DEP, [resolvedDepId]);
1014
- }));
1040
+ })) : [];
1015
1041
 
1016
1042
  // 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
1017
1043
  if (moduleRecord.evaluated) {
@@ -1019,8 +1045,12 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
1019
1045
  }
1020
1046
 
1021
1047
  // evaluates the module function
1022
- let moduleDefault = exporter(...depsMapped);
1023
-
1048
+ let moduleDefault;
1049
+ try {
1050
+ moduleDefault = exporter(...depsMapped);
1051
+ } catch (e) {
1052
+ throw new LoaderError(EXPORTER_ERROR, [moduleRecord.id, e.message || e]);
1053
+ }
1024
1054
  // value is returned from exporter, then we are not using named exports
1025
1055
  if (moduleDefault !== undefined) {
1026
1056
  moduleDefault = {
@@ -1163,10 +1193,14 @@ LWR.define('lwr/loader/v/0_11_0-alpha_4', ['exports'], (function (exports) { 'us
1163
1193
  });
1164
1194
  return moduleDef;
1165
1195
  }).catch(e => {
1166
- this.profiler.logOperationStart({
1167
- id: MODULE_ERROR,
1168
- specifier
1169
- });
1196
+ // Create module error marks for all errors caused by the loader
1197
+ // Note: these marks do not include errors caused by invalid server responses or loader hooks
1198
+ if (!(e instanceof LoaderError)) {
1199
+ this.profiler.logOperationStart({
1200
+ id: MODULE_ERROR,
1201
+ specifier
1202
+ });
1203
+ }
1170
1204
  throw e;
1171
1205
  });
1172
1206
  }