Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@universal-packages/module-loader

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universal-packages/module-loader - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

LICENSE.md

2

loadModules.d.ts
import { LoadModulesOptions, ModuleRegistry } from './loadModules.types';
/**
*
* Starts importing recusively until it finds a package, index file or just a file in that order
* Starts importing recursively until it finds a package, index file or just a file in that order
*

@@ -6,0 +6,0 @@ * If it finds a package.json it will just import the main file in the package

@@ -34,3 +34,3 @@ "use strict";

*
* Starts importing recusively until it finds a package, index file or just a file in that order
* Starts importing recursively until it finds a package, index file or just a file in that order
*

@@ -88,3 +88,3 @@ * If it finds a package.json it will just import the main file in the package

}
/** Creates a registry in the current redult packed with an error if any */
/** Creates a registry in the current result packed with an error if any */
async function importAndRegister(location, type, options) {

@@ -91,0 +91,0 @@ try {

{
"name": "@universal-packages/module-loader",
"version": "1.0.0",
"version": "1.0.1",
"description": "Imports deeply all modules in a directory as a list to use later",

@@ -13,6 +13,7 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",

"test": "jest --watch",
"test:full": "jest --coverage --verbose"
"test:full": "jest --coverage --verbose",
"test:clear": "jest --clearCache"
},
"dependencies": {
"@universal-packages/directory-traversal": "^1.2.0"
"@universal-packages/directory-traversal": "1.2.1"
},

@@ -19,0 +20,0 @@ "devDependencies": {

@@ -7,3 +7,3 @@ # Module Loader

Imports deeply all modules in a directory as a list to use later, this is useful when you are expecting a arbitrary amount of modules that behaves the same and can be used without the need of importing them manually or even importing them manually will be a hasel, it can also be useful to activate modules (probably with decorators) that need to be activated before being imported manually later.
Imports deeply all modules in a directory as a list to use later, this is useful when you are expecting a arbitrary amount of modules that behaves the same and can be used without the need of importing them manually or even importing them manually will be a hazel, it can also be useful to activate modules (probably with decorators) that need to be activated before being imported manually later.

@@ -16,6 +16,8 @@ ## Install

## loadModules()
## Global methods
Load recusively a directory until it finds a package, index file or just a file in that order, If it finds a package.json it will just import the main file in the package, If it find and index file it will just import that index file, If any of above it will just import files deep in the hierarchy.
#### **`loadModules(location: string, [options])`**
Load recursively a directory until it finds a package, index file or just a file in that order, If it finds a package.json it will just import the main file in the package, If it find and index file it will just import that index file, If any of above it will just import files deep in the hierarchy.
```js

@@ -25,3 +27,3 @@ import { loadModules } from '@universal-packages/module-loader'

async function test() {
const modules = await loadconfig('./modules')
const modules = await loadModules('./modules')

@@ -40,6 +42,6 @@ console.log(modules)

## Options
### Options
- **`onlyDefault`** `boolean`
When loading the module directly only set `exports` as the `exports.default`, usefull if you are importing classes or components that predominate in the module.
When loading the module directly only set `exports` as the `exports.default`, useful if you are importing classes or components that predominate in the module.

@@ -53,3 +55,3 @@ - **`conventionPrefix`** `string`

async function test() {
const modules = await loadconfig('./modules', { conventionPrefix: })
const modules = await loadModules('./modules', { conventionPrefix: })

@@ -74,3 +76,3 @@ console.log(modules)

The development of this library in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

@@ -83,5 +85,1 @@ - [Code of Conduct](./CODE_OF_CONDUCT.md)

[MIT licensed](./LICENSE).
```
```

Sorry, the diff of this file is not supported yet

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