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

asset-pipe-build-server

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asset-pipe-build-server

Asset pipe build server

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31
increased by181.82%
Maintainers
4
Weekly downloads
 
Created
Source

asset-pipe-build-server

Travis CI Build Status NPM version Dependency Status Dev Dependency Status

Greenkeeper badge

Usage

Install

npm install asset-pipe-build-server

Configure

Configuration of the server is done via environment variables.

The following configuration options are available:

VariableDescriptionOptionsDefault
NODE_ENVApplicaton environmentdevelopment, productiondevelopment
LOG_LEVELWhich level the console transport log should log atdebug, info, warn, errordebug
PORTThe port the server should bind to-7100

Start

asset-pipe-server

OR with configuration options:

PORT=3321 LOG_LEVEL=info NODE_ENV=production asset-pipe-server

Endpoints

The server provides the following endpoints:

VerbEndpointDescriptionurl paramspayloadresponse
POST/feed/jsUpload a javascript asset feed-js feedfeed response
POST/feed/cssUpload a css asset feed-css feedfeed response
GET/feed/:idDownload an asset feedfeed id-feed
POST/bundle/jsRequest bundling of a list of js feeds-js bundlebundle response
POST/bundle/cssRequest bundling of a list of css feeds-css bundlebundle response
GET/bundle/:idDownload an asset bundlebundle id-bundle

See below for explanation and additional detail regarding the various url params, payloads and responses.

Url params

feed id

A js or css feed filename. (Depending on endpoint)

Examples

GET /feed/js/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json
GET /feed/css/bcd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json
bundle id

A js or css bundle filename. (Depending on endpoint)

Examples

GET /bundle/js/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json
GET /bundle/css/bcd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json

Payloads

js feed

An array of feed objects as produced by asset-pipe-js-writer

Example

[
    {
        "id":"c645cf572a8f5acf8716e4846b408d3b1ca45c58",
        "source":"\"use strict\";module.exports.world=function(){return\"world\"};",
        "deps":{},
        "file":"./assets/js/bar.js"
    }
]
css feed

An array of feed objects as produced by asset-pipe-css-writer

Example

[
    {
        id: '4f32a8e1c6cf6e5885241f3ea5fee583560b2dfde38b21ec3f9781c91d58f42e',
        name: 'my-module-1',
        version: '1.0.1',
        file: 'my-module-1/main.css',
        content: '/* ... */'
    }
]
js bundle

An ordered array of js feed filenames.

Example

[
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
]
css bundle

An ordered array of css feed filenames.

Example

[
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
]

Responses

feed response

After a feed is uploaded, the server will respond with a json body containing the keys file and uri where file is the name of the feed file that was saved on the server and uri is the same as file but with the server address prepended.

Example

{
    file: 'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    uri: 'http://127.0.0.1:7100/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
}
feed

Feed is the original js or css feed content that was saved on the server during a feed upload (via POST /feed/js or POST /feed/css)

Example

[
    {
        "id":"c645cf572a8f5acf8716e4846b408d3b1ca45c58",
        "source":"\"use strict\";module.exports.world=function(){return\"world\"};",
        "deps":{},
        "file":"./assets/js/bar.js"
    }
]
bundle response

After a bundling is complete, the server will respond with a json body containing the keys file and uri where file is the name of the file for the bundled content that was saved on the server and uri is the same as file but with the server address prepended.

Example

{
    file: 'acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json',
    uri: 'http://127.0.0.1:7100/acd1ac21dac12dac12dac12dac1d2ac1d2ac1d2a.json'
}
bundle

Bundle is a piece of bundled javascript or css content.

Contributing

The contribution process is as follows:

  • Fork this repository.
  • Make your changes as desired.
  • Run the tests using npm test. This will also check to ensure that 100% code coverage is maintained. If not you may need to add additional tests.
  • Stage your changes.
  • Run git commit or, if you are not familiar with semantic commit messages, please run npm run cm and follow the prompts instead which will help you write a correct semantic commit message.
  • Push your changes and submit a PR.

Keywords

FAQs

Package last updated on 10 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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