@lwc/dev-server-plugin-lex 7.0.0-6.6.3 → 7.0.2-6.6.3

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.
@@ -56,7 +56,7 @@ if (__lwc_hmr_hot) {
56
56
  __lwc_hmr_hot.accept('${hmrModuleContext.modulePath}', (mod) => {
57
57
  const { __lwc_hmr_context: __new__lwc_hmr_context, default: __new_styles } = mod;
58
58
  if (__lwc_hmr_context.moduleHash !== __new__lwc_hmr_context.moduleHash) {
59
- if(newStyles) { // __new_styles can be undefined when the stylesheet contains only imports
59
+ if(__new_styles) { // __new_styles can be undefined when the stylesheet contains only imports
60
60
  __lwc_hmr_swapStyle(${STYLESHEET_IDENTIFIER}, __new_styles.at(-1)); // the default stylesheet is the last element
61
61
  }
62
62
  }
@@ -22,19 +22,17 @@ function templateTransformer(src, id, options, hmrModuleContext) {
22
22
  const code = `import { hot as __lwc_hmr_hot, swapTemplate as __lwc_hmr_swapTemplate } from 'lwc';
23
23
 
24
24
  ${src}
25
-
26
- if(typeof tmpl === 'function') {
27
- tmpl.moduleHash = '${hmrModuleContext.moduleHash}';
28
- if (__lwc_hmr_hot) {
29
- __lwc_hmr_hot.register('${hmrModuleContext.modulePath}', '${hmrModuleContext.moduleHash}', ${JSON.stringify(options)});
30
- __lwc_hmr_hot.accept('${hmrModuleContext.modulePath}', (mod) => {
31
- if (tmpl.moduleHash !== mod.moduleHash) {
32
- // Transfer the stylesheets from the old template to the hot template.
33
- mod.stylesheets = tmpl.stylesheets;
34
- __lwc_hmr_swapTemplate(tmpl, mod);
35
- }
36
- });
37
- }
25
+ export const __lwc_hmr_context = { moduleHash : '${hmrModuleContext.moduleHash}' };
26
+ if(typeof tmpl === 'function' && __lwc_hmr_hot) {
27
+ __lwc_hmr_hot.register('${hmrModuleContext.modulePath}', '${hmrModuleContext.moduleHash}', ${JSON.stringify(options)});
28
+ __lwc_hmr_hot.accept('${hmrModuleContext.modulePath}', (mod) => {
29
+ const { __lwc_hmr_context: __new__lwc_hmr_context, default: __new_template } = mod;
30
+ if (__lwc_hmr_context.moduleHash !== __new__lwc_hmr_context.moduleHash) {
31
+ // Transfer the stylesheets from the old template to the hot template.
32
+ __new_template.stylesheets = tmpl.stylesheets;
33
+ __lwc_hmr_swapTemplate(tmpl, __new_template);
34
+ }
35
+ });
38
36
  }
39
37
  `;
40
38
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/transformers/template.ts"],"names":[],"mappings":";;;AAAA,wCAA0E;AAK1E;;;;;;;;;;;GAWG;AACH,SAAgB,mBAAmB,CAC/B,GAAW,EACX,EAAU,EACV,OAAyB,EACzB,gBAAkC;IAElC,IAAI,CAAC;QACD,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACpB,OAAO;QACX,CAAC;QACD,MAAM,IAAI,GAAG;;EAEnB,GAAG;;;yBAGoB,gBAAgB,CAAC,UAAU;;kCAElB,gBAAgB,CAAC,UAAU,OAAO,gBAAgB,CAAC,UAAU,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gCAC5F,gBAAgB,CAAC,UAAU;;;;;;;;;CAS1D,CAAC;QACM,OAAO;YACH,IAAI;YACJ,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;SACxB,CAAC;IACN,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAA,iCAAwB,EAAC,0BAAiB,CAAC,sBAAsB,EAAE,CAAC,EAAE;YACxE,QAAQ,EAAE,EAAE;SACf,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AArCD,kDAqCC"}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/transformers/template.ts"],"names":[],"mappings":";;;AAAA,wCAA0E;AAK1E;;;;;;;;;;;GAWG;AACH,SAAgB,mBAAmB,CAC/B,GAAW,EACX,EAAU,EACV,OAAyB,EACzB,gBAAkC;IAElC,IAAI,CAAC;QACD,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACpB,OAAO;QACX,CAAC;QACD,MAAM,IAAI,GAAG;;EAEnB,GAAG;mDAC8C,gBAAgB,CAAC,UAAU;;8BAEhD,gBAAgB,CAAC,UAAU,OAAO,gBAAgB,CAAC,UAAU,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;4BAC5F,gBAAgB,CAAC,UAAU;;;;;;;;;CAStD,CAAC;QACM,OAAO;YACH,IAAI;YACJ,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;SACxB,CAAC;IACN,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAA,iCAAwB,EAAC,0BAAiB,CAAC,sBAAsB,EAAE,CAAC,EAAE;YACxE,QAAQ,EAAE,EAAE;SACf,CAAC,CAAC;IACP,CAAC;AACL,CAAC;AAnCD,kDAmCC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lwc/dev-server-plugin-lex",
3
3
  "description": "A rollup plugin to add Hot Module Replacement transformation to LWC components used in LEX.",
4
- "version": "7.0.0-6.6.3",
4
+ "version": "7.0.2-6.6.3",
5
5
  "keywords": [
6
6
  "lwc dev server",
7
7
  "lwc hmr plugin"
@@ -14,7 +14,8 @@
14
14
  ],
15
15
  "license": "SEE LICENSE IN LICENSE.txt",
16
16
  "scripts": {
17
- "build": "tsc"
17
+ "build": "tsc",
18
+ "clean": "rimraf dist/ && rimraf node_modules/"
18
19
  },
19
20
  "dependencies": {
20
21
  "@lwc/errors": "6.6.3",