New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lwrjs/client-modules

Package Overview
Dependencies
Maintainers
7
Versions
490
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwrjs/client-modules - npm Package Compare versions

Comparing version 0.0.2-alpha17 to 0.0.2-alpha18

build/modules/lwr/lockerDefine/lockerDefine.js

49

build/modules/lwr/hmr/hmr.js
import { updateStaleModule } from './util/swap';
async function moduleUpdate(payload) {
const {
oldUri,
newUri,
module: { specifier },
} = payload;
const oldModule = await import(oldUri);
const newModule = await import(newUri);
updateStaleModule({
oldModule,
newModule,
specifier,
});
}
async function viewUpdate(payload) {
const pathName = window.location.pathname;
const requestPath = payload.viewId.requestPath;
if (requestPath === pathName) {
window.location.reload();
}
}
export function initHMR() {
const socket = new WebSocket(`ws://${location.host}`);
socket.addEventListener('message', async ({ data }) => {
const event = JSON.parse(data);
if (event.eventType === 'moduleUpdate') {
const {
oldUri,
newUri,
module: { specifier },
} = event.payload;
const oldModule = await import(oldUri);
const newModule = await import(newUri);
updateStaleModule({
oldModule,
newModule,
specifier,
});
const { eventType, payload } = JSON.parse(data);
switch (eventType) {
case 'moduleUpdate':
return moduleUpdate(payload);
case 'viewUpdate':
return viewUpdate(payload);
default:
return;
}
});
}
import { updateStaleModule } from './util/swap';
async function moduleUpdate(payload) {
const {
oldUri,
newUri,
module: { specifier },
} = payload;
const oldModule = await import(oldUri);
const newModule = await import(newUri);
updateStaleModule({
oldModule,
newModule,
specifier,
});
}
async function viewUpdate(payload) {
const pathName = window.location.pathname;
const requestPath = payload.viewId.requestPath;
if (requestPath === pathName) {
window.location.reload();
}
}
export function initHMR() {
const socket = new WebSocket(`ws://${location.host}`);
socket.addEventListener('message', async ({ data }) => {
const event = JSON.parse(data);
if (event.eventType === 'moduleUpdate') {
const {
oldUri,
newUri,
module: { specifier },
} = event.payload;
const oldModule = await import(oldUri);
const newModule = await import(newUri);
updateStaleModule({
oldModule,
newModule,
specifier,
});
const { eventType, payload } = JSON.parse(data);
switch (eventType) {
case 'moduleUpdate':
return moduleUpdate(payload);
case 'viewUpdate':
return viewUpdate(payload);
default:
return;
}
});
}

@@ -7,3 +7,3 @@ {

},
"version": "0.0.2-alpha17",
"version": "0.0.2-alpha18",
"homepage": "https://lwr.dev/",

@@ -27,9 +27,11 @@ "repository": {

"scripts": {
"build": "node ../../../bin/pack-lwc --dir modules build/modules"
"build": "node ../../../bin/pack-lwc --dir modules build/modules && yarn build:locker",
"build:locker": "rollup --config ./scripts/rollup.config.locker.js"
},
"dependencies": {
"@lwrjs/shared-utils": "0.0.2-alpha17"
"@locker/sandbox": "0.11.7",
"@lwrjs/shared-utils": "0.0.2-alpha18"
},
"devDependencies": {
"lwc": "1.6.3"
"lwc": "1.8.3"
},

@@ -53,3 +55,3 @@ "lwc": {

},
"gitHead": "462556b16ca6b92f24becb361e510aa1a805e28b"
"gitHead": "9cf922f2e624d3255ab89d39a019be4e88793c61"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc