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

crs-modules

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crs-modules - npm Package Compare versions

Comparing version 1.0.10 to 1.0.11

2

crs-modules.js

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

export class Modules{constructor(){this.registry={}}async dispose(){await this.clear(),this.registry=null}async clear(){const t=Object.keys(this.registry);for(let e of t)delete this.registry[e]}async add(t,e){null==this.registry[t]&&(this.registry[t]=e)}async remove(t){delete this.registry[t]}async get(t){let e=this.registry[t];return"string"==typeof e&&(e=await import(e),this.registry[t]=e),e}async getDefault(t){return(await this.get(t))?.default}async getPrototype(t,e){return(await this.get(t))?.[e||t]}async getInstanceOf(t,e,...s){const a=await this.getPrototype(t,e||t);return a?new a(...s):null}async getInstanceOfDefault(t,...e){const s=await this.getDefault(t);return s?new s(...e):null}async call(t,e,s,...a){const r=(await this.get(t))?.[s||t];return await(r?.call(e,...a))}async callDefault(t,e,...s){const a=await this.getDefault(t);return await(a?.call(e,...s))}}globalThis.crs=globalThis.crs||{},globalThis.crs.modules=new Modules;
export class Modules{constructor(){this.registry={}}async dispose(){await this.clear(),this.registry=null}async clear(){const s=Object.keys(this.registry);for(let t of s)delete this.registry[t]}async add(s,t){null==this.registry[s]&&(this.registry[s]=t)}async remove(s){delete this.registry[s]}async get(s){if(null==this.registry[s])return;let t=this.registry[s];return"string"==typeof t&&(t=await import(t),this.registry[s]=t),t}async getDefault(s){return(await this.get(s))?.default}async getPrototype(s,t){return(await this.get(s))?.[t||s]}async getInstanceOf(s,t,...e){const a=await this.getPrototype(s,t||s);return a?new a(...e):null}async getInstanceOfDefault(s,...t){const e=await this.getDefault(s);return e?new e(...t):null}async call(s,t,e,...a){const l=(await this.get(s))?.[e||s];return await(l?.call(t,...a))}async callDefault(s,t,...e){const a=await this.getDefault(s);return await(a?.call(t,...e))}}globalThis.crs=globalThis.crs||{},globalThis.crs.modules=new Modules,globalThis.crs.modules.enableBinding=async s=>{for(let t of s||[])await globalThis.crs.modules.add(t[0],t[1]);null!=globalThis.crsbinding&&(globalThis.crs.modules._parseElement=globalThis.crsbinding.parsers.parseElement,globalThis.crsbinding.parsers.parseElement=async(s,t,e)=>{await globalThis.crs.modules._parseElement(s,t,e),globalThis.crs.modules.get(s.nodeName.toLowerCase())})};
{
"name": "crs-modules",
"version": "1.0.10",
"version": "1.0.11",
"description": "",

@@ -30,3 +30,6 @@ "main": "index.js",

"terser": "^5.6.1"
},
"dependencies": {
"crs-binding": "0.0.217"
}
}

@@ -12,2 +12,13 @@ # CRS Modules

If you are using crs-binding you can extend the binding engine to auto load modules for web components when it parses the dom elements.
```js
await crs.modules.enableBinding([
["my-component", "/components/my-component.js"],
["other-component", "/components/other-components.js"]
]);
```
The parameter is an array of module registries.
## Functions

@@ -14,0 +25,0 @@

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