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

remote-webpack-plugin

v1.0.2

Published

A webpack plugin to load dependency from internet instead of local file system to ensure the latest is bundled

Downloads

4

Readme

remote-webpack-plugin

NPM Version Build Status codecov License

A webpack plugin to fetch dependency from internet, instead of local file system, to ensure the latest is bundled, e.g. to require an url starting with http/https/ftp: require('http://abc.com/def.gh').

If you want to load script in browser at runtime, you may need this plugin: webpack-require-http.

Features

  • HTTP, HTTPS, FTP protocols
  • Cache and offline use: if file in server has not updated yet (http/https only), or server is inaccessable, cached version is picked.

Usage

webpack.config.js

const path = require('path');
const RemotePlugin = require('remote-webpack-plugin');

module.exports = {
  context: __dirname,
  entry: './index.js',
    output: {
      path: path.resolve(__dirname, 'dist'),
      filename: 'index.bundle.js',
    },
    module: {
      rules: [
        {
          test: /\.png$/,
          loader: 'file-loader',
        },
        {
          test: /\.js$/,
          loader: 'babel-loader',
        },
      ],
    },
  plugins: [new RemotePlugin(/*options*/)],
};

index.js

import React from 'react';
import { render } from 'react-dom';
import npmjsIcon from 'https://www.npmjs.com/static/images/touch-icons/coast-228x228.png';

render(
  <div>
    <img src={npmjsIcon} />
  </div>,
  document.getElementById('root'),
);

.babelrc

{
  "presets": [
    "react"
  ]
}

output

|- dist/
|--- c426a1116301d1fd178c51522484127a.png
|--- index.bundle.js
index.bundle.js
...
(function(module, exports, __webpack_require__) {
  module.exports = __webpack_require__.p + "c426a1116301d1fd178c51522484127a.png";
})
...

Configuration

{
  cacheDir:  - where cache is placed, `__download_cache__` by default, if `false`, cache is turned off.

  http: {   - for http/https.
    'https://abc\\.com:8080/\\.*': {  - Regexp string to of specific rule matched againast whole url.
      cache:      - {bool} turn on/off cache, overriding global config.
      method,     - {string} http method.
      user,       - {string} auth user.
      password,   - {string} auth password.
      headers,    - {string} http headers.
      agent,      - {string} custom useragent.
      timeout     - {number} request timeout duration.
    }
  },

  ftp: {  - refer to: https://www.npmjs.com/package/ftp
    'ftp://abc\\.com:8080/\\.*': {  - Regexp string to test against whole url.
      cache:        - {bool} (same as above)
      secure        - {mixed} Set to true for both control and data connection encryption, 'control' for control connection encryption only, or 'implicit' for implicitly encrypted control connection (this mode is deprecated in modern times, but usually uses port 990) Default: false,
      secureOptions - {object} Additional options to be passed to tls.connect(). Default: (none),
      user          - {string} Username for authentication. Default: 'anonymous',
      password      - {string} Password for authentication. Default: 'anonymous',
      connTimeout   - {integer} How long (in milliseconds) to wait for the control connection to be established. Default: 10000,
      pasvTimeout   - {integer} How long (in milliseconds) to wait for a PASV data connection to be established. Default: 10000,
      keepalive     - {integer} How often (in milliseconds) to send a 'dummy' (NOOP) command to keep the connection alive. Default: 10000
    }
  }
}

License

MIT.