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

ninjs-rjs

v0.0.35

Published

requirejs build wrapper

Downloads

16

Readme

ninjs-rjs

requirejs build utils


Overview

This module includes common requirejs utility methods that fall into the following groupings:

  • Compiling/Optimizing/Obfuscating js
  • Dynamic UI Generators

We tried to keep it as tiny as possible with as few dependencies as possible.

{
  "dependencies": { "ninjs-lodash": "^0.1.56", "requirejs" : "^2.3.2" },
  "bundleDependencies": [],
  "peerDependencies": {},
  "devDependencies": {},
  "optionalDependencies": {}
}

Setup

Install

Install the module locally and add to ./package.json dependencies

npm install --save ninjs-rjs

Import

const _ =    require('ninjs-lodash')
const rjs = require('ninjs-rjs')

$ettings

Override/Add your own $ettings

  • Create a ./.ninjs/settings.js(json) file within a module cwd that exports an object
  • You can now access that object (and nested props) via _.$()
  • internally uses _.get(settings, 'keypath'))
  • *Be careful not to override _.$() default settings
_.$('rjs.options.paths')       // get
_.$('rjs.options.paths', true) // set

Default Settings

{
  "paths": {
    "code": "F:",
    "dev": "Y:",
    "prod": "Z:"
  },
  "rjs": {
    "optimize_options": ["none", "uglify"],
    "file_suffix_map": { "none": "", "uglify": "min" },
    "result_key_order": ['name', 'src', 'results', 'files', 'paths', 'shim'],
    "options": {
      "enabled": true,
      "baseUrl": "js",
      "name": "main",
      "out": "public/js/scripts.js",
      "optimize": "none",
      "paths": {
        "text": CDN_REQ_TEXT,
        "jquery": IGNORE,
        "underscore": IGNORE,
        "moment": IGNORE,
        "backbone": IGNORE,
        "ba": IGNORE,
        "jqueryactual": IGNORE,
        "jqappear": IGNORE,
        "jquerycookie": IGNORE,
        "jqueryui": IGNORE,
        "jquery.ui.widget": IGNORE,
        "jqueryiframetransport": IGNORE,
        "jqueryfileupload": IGNORE,
        "ace": IGNORE,
        "iscroll": IGNORE,
        "spin": IGNORE,
        "sio": IGNORE,
        "spectrum": IGNORE,
        "twemoji": IGNORE,
        "fblib": IGNORE
      },
      "shim": {
        "jquery": { "exports": "$" },
        "underscore": { "exports": "_" },
        "lodash": { "exports": "_" },
        "backbone": { "exports": "Backbone", "deps": ["underscore", "jquery"] },
        "ba": { "deps": ["underscore", "backbone"] },
        "jqueryui": { "deps": ["jquery"] },
        "jquerycookie": { "deps": ["jquery"] },
        "jqueryactual": { "deps": ["jquery"] },
        "jqappear": { "deps": ["jquery"] },
        "jqhashchange": { "deps": ["jquery"] },
        "jqeasytabs": { "deps": ["jquery", "jqhashchange"] },
        "jqueryiframetransport": { "deps": ["jquery"] },
        "jqueryfileupload": { "deps": ["jquery", "jqueryiframetransport"] },
        "ace": { "exports": "ace" },
        "spectrum": { "deps": ["jquery"] },
        "twemoji": { "exports": "twemoji" }
      }
    },
    "client_paths": {
      "text": CDN_URL + "/js/require/text.min",
      "jquery": CDN_URL + "/js/jquery/jquery.slim.min",
      "underscore": CDN_URL + "/js/lodash/lodash.slim.min",
      "moment": CDN_URL + "/js/moment/moment.min",
      "backbone": CDN_URL + "/js/backbone/backbone.min",
      "ba": CDN_URL + "/js/backbone/ba.min",

      "jqueryactual": CDN_URL + "/jquery.actual.min",
      "jqappear": CDN_URL + "/jquery.appear.min",
      "jquerycookie": CDN_URL + "/jquery.cookie.min",
      "jqueryui": CDN_URL + "/jquery.ui.min",
      "jquery.ui.widget": CDN_URL + "/jquery.ui.widget.min",
      "jqueryiframetransport": CDN_URL + "/jquery.iframe-transport.min",
      "jqueryfileupload": CDN_URL + "/jquery.fileupload.min",

      "ace": CDN_URL + "/ace",
      "iscroll": CDN_URL + "/iscroll.min",
      "spin": CDN_URL + "/spin.min",
      "sio": CDN_URL + "/sio.min",
      "spectrum": CDN_URL + "/spectrum.min",
      "twemoji": CDN_URL + "/twemoji.min",
      "fblib": "//connect.facebook.net/en_US/all",

      "mans": CDN_URL + "/snapp/mans",
      "models": CDN_URL + "/snapp/models",
      "node": CDN_URL + "/snapp/node",
      "plat": CDN_URL + "/snapp/plat",
      "rest": CDN_URL + "/snapp/rest",
      "ui": CDN_URL + "/snapp/ui",
      "mixins": CDN_URL + "/snapp/mixins"
    }
  }
}

Compiling/Optimizing .js

rjs.render(options, callback)

UI Generation

Creates UI Kits on the fly