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
489
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-alpha7 to 0.0.2-alpha8

7

build/modules/lwr/init/init.js

@@ -16,5 +16,6 @@ /**

* Import any requested static application dependencies, define the root
* application component into the CustomElement registry, and inject it.
* @param rootAppSpecifier - The bare specifier for the component, eg: 'x/appRoot'
* @param rootApp - A reference to the Constructor (extended from LightningElement)
* application component(s) into the CustomElement registry, and inject them.
* @param rootModules - An array of arrays, each one holding a pair of
* bare specifier and corresponding LightningElement constructor
* @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
*/

@@ -21,0 +22,0 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -6,5 +6,5 @@ # Lightning Web Runtime :: Application Initialization

- importing static application dependencies
- defining the _root application component_ into the [`CustomElementRegistry`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry)
- defining the _root application component(s)_ into the [`CustomElementRegistry`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry)
This results in the _root application component_ being renderable by the DOM on first page load.
This results in the _root application component(s)_ being renderable by the DOM on first page load.

@@ -15,3 +15,3 @@ ## Definition

interface InitAPI {
init(rootAppSpecifier: string, rootApp: LightningElement): void;
init(rootModules: [string, LightningElement][]): void;
}

@@ -25,4 +25,8 @@ ```

import xAppRoot from 'x/appRoot';
import xNav from 'x/nav';
init('x/appRoot', xAppRoot);
init([
['x/appRoot', xAppRoot],
['x/nav', xNav],
]);
```

@@ -38,9 +42,11 @@

// src/modules/example/init/init.js
export function init(rootAppSpecifier, rootApp) {
const elementName = rootAppSpecifier.replace(/\//, '-');
customElements.define(elementName, rootApp.CustomElementConstructor);
export function init(rootModules) {
rootModules.forEach(([moduleSpecifier, ctor]) => {
const elementName = toKebabCase(moduleSpecifier);
customElements.define(elementName, ctor.CustomElementConstructor);
});
}
```
2. Configure the module specifier in _lwr.config.json_:
2. Configure the `init` module specifier in _lwr.config.json_:

@@ -47,0 +53,0 @@ ```json

@@ -0,1 +1,3 @@

import type { LightningElement } from 'lwc/types';
/**

@@ -20,8 +22,9 @@ * Convert a module specifier into a valid CustomElement registry name:

* Import any requested static application dependencies, define the root
* application component into the CustomElement registry, and inject it.
* @param rootAppSpecifier - The bare specifier for the component, eg: 'x/appRoot'
* @param rootApp - A reference to the Constructor (extended from LightningElement)
* application component(s) into the CustomElement registry, and inject them.
* @param rootModules - An array of arrays, each one holding a pair of
* bare specifier and corresponding LightningElement constructor
* @example - [['x/appRoot', appCtor], ['x/nav', navCtor]]
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function init(rootModules: any[][]): void {
export function init(rootModules: [string, LightningElement][]): void {
if (typeof customElements !== 'undefined' && typeof document !== 'undefined') {

@@ -28,0 +31,0 @@ const uniqueRoot = rootModules.length === 1;

@@ -6,5 +6,5 @@ # Lightning Web Runtime :: Application Initialization

- importing static application dependencies
- defining the _root application component_ into the [`CustomElementRegistry`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry)
- defining the _root application component(s)_ into the [`CustomElementRegistry`](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry)
This results in the _root application component_ being renderable by the DOM on first page load.
This results in the _root application component(s)_ being renderable by the DOM on first page load.

@@ -15,3 +15,3 @@ ## Definition

interface InitAPI {
init(rootAppSpecifier: string, rootApp: LightningElement): void;
init(rootModules: [string, LightningElement][]): void;
}

@@ -25,4 +25,8 @@ ```

import xAppRoot from 'x/appRoot';
import xNav from 'x/nav';
init('x/appRoot', xAppRoot);
init([
['x/appRoot', xAppRoot],
['x/nav', xNav],
]);
```

@@ -38,9 +42,11 @@

// src/modules/example/init/init.js
export function init(rootAppSpecifier, rootApp) {
const elementName = rootAppSpecifier.replace(/\//, '-');
customElements.define(elementName, rootApp.CustomElementConstructor);
export function init(rootModules) {
rootModules.forEach(([moduleSpecifier, ctor]) => {
const elementName = toKebabCase(moduleSpecifier);
customElements.define(elementName, ctor.CustomElementConstructor);
});
}
```
2. Configure the module specifier in _lwr.config.json_:
2. Configure the `init` module specifier in _lwr.config.json_:

@@ -47,0 +53,0 @@ ```json

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

},
"version": "0.0.2-alpha7",
"version": "0.0.2-alpha8",
"homepage": "https://lwr.dev/",

@@ -29,2 +29,8 @@ "repository": {

},
"dependencies": {
"@lwrjs/shared-utils": "0.0.2-alpha8"
},
"devDependencies": {
"lwc": "1.6.3"
},
"lwc": {

@@ -47,3 +53,3 @@ "modules": [

},
"gitHead": "fc1ad7545232af461fb9e2602a311ee39e0bae82"
"gitHead": "c010a3b75892789968c39442644bf333a59529c9"
}
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