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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gulp-msapp-require

v3.2.5

Published

Require npm module or common module, for Wechat miniapp

Readme

gulp-msapp-require

Require npm module or custom-common module, for Wechat miniapp.

Install

npm install gulp-msapp-require --save-dev

Usage


var gulp = require("gulp")
var msappRequire = require("gulp-msapp-require")

// msappRequire(options)
gulp.task("release", function() {
    gulp.src(["src/**/*"])
    .pipe(gulp.dest("./dist")) // gulp-msapp-require will change the origin file's dependency path, the best way is building in a new folder
    .on("end", function() {
        gulp.src(["dist/**/*"])
        .pipe(msappRequire({
            output: path.resolve(__dirname, "./dist/common"),
            resolve: {
                extensions: [".js", ".json"],
                modules: [path.resolve(__dirname, "./custom"), path.resolve(__dirname, "../node_modules")],
                alias: {
                    utils: "./test/a/index.js",
                    math: "sub/math"
                }
            },
            cache: true
        }))
        .pipe(gulp.dest("./dist"))
    })
})

// msappRequire.manifest(options)
gulp.task("manifest-release", function() {
    gulp.src(["src/**/*"])
    .pipe(gulp.dest("./cdist"))
    .on("end", function() {
        gulp.src(["cdist/**/*"])
        .pipe(msappRequire.manifest({
            output: path.resolve(__dirname, "./cdist/common"),
            resolve: {
                extensions: [".js", ".json"],
                modules: [path.resolve(__dirname, "./custom"), path.resolve(__dirname, "../node_modules")],
                alias: {
                    utils: "./test/a/index.js",
                    math: "sub/math"
                }
            },
            cache: path.resolve(__dirname, "./src/depends.json"),
            manifest: "msapp-require-manifest.json"
        }))
        .pipe(gulp.dest("./cdist"))
    })
})

API

msappRequire(options)

Analyze the npm module or custom-common module that the code relies on, and then copy to the corresponding directory, and convert the corresponding dependent path in the code.

msappRequire.manifest(options)

Analyze the npm module or custom-common module that the code relies on, and then copy to the corresponding directory, and map the corresponding dependency path to the manifest.json. (It does not convert the dependent path in the code)

options

Type: Object

options.output

Type: String

options.resolve

Type: Object

| Field | Default | Description | | ------------------------ | --------------------------- | ---------------------------------------------------------------------------------- | | alias | [] | A list of module alias configurations or an object which maps key to value | | aliasFields | [] | A list of alias fields in description files | | cacheWithContext | true | If unsafe cache is enabled, includes request.context in the cache key | | descriptionFiles | ["package.json"] | A list of description files to read from | | enforceExtension | false | Enforce that a extension from extensions must be used | | enforceModuleExtension | false | Enforce that a extension from moduleExtensions must be used | | extensions | [".js", ".json", ".node"] | A list of extensions which should be tried for files | | mainFields | ["main"] | A list of main fields in description files | | mainFiles | ["index"] | A list of main files in directories | | modules | ["node_modules"] | A list of directories to resolve modules from, can be absolute path or folder name | | unsafeCache | false | Use this cache object to unsafely cache the successful requests | | plugins | [] | A list of additional resolve plugins which should be applied | | symlinks | true | Whether to resolve symlinks to their symlinked location | | cachePredicate | function() { return true }; | A function which decides whether a request should be cached or not. An object is passed to the function with path and request properties. | | moduleExtensions | [] | A list of module extensions which should be tried for modules | | resolveToContext | false | Resolve to a context instead of a file | | fileSystem | | The file system which should be used | | resolver | undefined | A prepared Resolver to which the plugins are attached |

options.cache

Type: Boolean|String Default: false

Using cache, building faster.