npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ys-loader

v1.0.3

Published

ys support utils for loader

Downloads

21

Readme

ys-loader

YS 架构之基础辅助加载模块。

Install

npm i --save ys-loader

Usage

const { FileLoader, ContextLoader, util } = require('ys-loader')

FileLoaderContextLoader都具有如下的属性特征:

| 属性 | 类型 | 默认值 | 说明 | | :---: | :---: | :---: | :---: | | directory | string | null | 需要解析文件的文件夹 | | match | array | ['**/*.js'] | 匹配规则,规则详见 npm:globby 模块 | | ignore | array | [] | 过滤某种规则的文件,规则详见 npm:globby 模块 | | lowercaseFirst | boolean | true | 解析出来文件变量的首字母是否小写 | | caseStyle | string | camel | 变量规则模式,支持 lower upper camel 三种 | | initializer | function | null | 初始化自定义变量以及内容结构的方法 | | call | boolean | true | 是否执行注入 | | inject | object | null | 注入对象,需要开启call选项 | | override | boolean | false | 是否覆盖变量,如果遇到冲突 | | target | object | null | 结果继承到target对象上 | | runtime | function | null | 在处理class类型文件模块的时候,我们将该模块编译的方式 |

FileLoader

文件加载器,不编译,如果需要编译,使用initializer属性。

new FileLoader(options).load();

ContextLoader

对象加载器,会编译class文件模块,如果自定义编译方式,请使用runtime属性

new ContextLoader(options).load();

Utils

const {
  getProperties,
  getExports,
  defaultCamelize,
  getInstance
} = utils;

具体各自用法请看源码。

License

It is MIT licensed.