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

asset-pipe-css-writer

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asset-pipe-css-writer - npm Package Compare versions

Comparing version 1.0.0-alpha.1 to 1.0.0

LICENSE.md

4

lib/util.js

@@ -11,3 +11,3 @@ 'use strict';

module.exports.identifyCssModule = async function identifyCssModule (filePath) {
module.exports.identifyCssModule = async function identifyCssModule(filePath) {
const { pkg: { name, version }, path: packagePath } = await readPkgUp({

@@ -22,3 +22,3 @@ normalize: false,

module.exports.bundleCssModule = async function bundleCssModule (filePath) {
module.exports.bundleCssModule = async function bundleCssModule(filePath) {
const fileContents = await readFile(filePath, 'utf8');

@@ -25,0 +25,0 @@ const { css } = await postcss()

@@ -11,3 +11,3 @@ 'use strict';

module.exports = class Writer extends Readable {
constructor (files = []) {
constructor(files = []) {
super({ objectMode: true });

@@ -21,9 +21,18 @@

for (const file of this.files) {
assert(typeof file === 'string', `Expected 'file' (${file}) to be of type 'string', instead got '${typeof file}'`);
assert(isAbsolute(file), `Expected 'file' (${file}) to be an absolute path to a file but it was not`);
assert(existsSync(file), `Expected 'file' (${file}) to exist on file system but it did not`);
assert(
typeof file === 'string',
`Expected 'file' (${file}) to be of type 'string', instead got '${typeof file}'`
);
assert(
isAbsolute(file),
`Expected 'file' (${file}) to be an absolute path to a file but it was not`
);
assert(
existsSync(file),
`Expected 'file' (${file}) to exist on file system but it did not`
);
}
}
async _read () {
async _read() {
const file = this.files.shift();

@@ -36,4 +45,9 @@ if (!file) {

try {
const [css, meta] = await Promise.all([bundleCssModule(file), identifyCssModule(file)]);
meta.id = hasher(`${meta.name}|${meta.version}|${meta.file}|${css}`);
const [css, meta] = await Promise.all([
bundleCssModule(file),
identifyCssModule(file),
]);
meta.id = hasher(
`${meta.name}|${meta.version}|${meta.file}|${css}`
);
meta.content = css;

@@ -40,0 +54,0 @@ this.push(meta);

@@ -1,54 +0,1 @@

{
"name": "asset-pipe-css-writer",
"version": "1.0.0-alpha.1",
"author": {
"name": "Richard Walker",
"email": "digitalsadhu@gmail.com"
},
"description": "CSS asset feed writer",
"main": "./lib/writer.js",
"repository": {
"type": "git",
"url": "git@github.com:asset-pipe/asset-pipe-css-writer.git"
},
"keywords": ["css", "assets"],
"contributors": [
{
"name": "Richard Walker",
"email": "digitalsadhu@gmail.com"
}
],
"bugs": {
"url": "https://github.com/asset-pipe/asset-pipe-css-writer/issues"
},
"license": "MIT",
"dependencies": {
"asset-pipe-common": "1.0.0-beta.6",
"postcss": "^6.0.13",
"postcss-import": "^11.0.0",
"read-pkg-up": "^2.0.0"
},
"devDependencies": {
"eslint": "^4.1.1",
"eslint-config-finn": "^3.0.0",
"jest": "^21.2.1",
"prettier": "^1.7.4"
},
"scripts": {
"format":
"prettier --write --single-quote --trailing-comma=all --tab-width=4 lib/**/*.js test/**/*.js",
"lint": "eslint .",
"test": "jest --coverage"
},
"files": ["lib"],
"jest": {
"coverageThreshold": {
"global": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
}
}
}
}
{"name":"asset-pipe-css-writer","version":"1.0.0","author":"Richard Walker <digitalsadhu@gmail.com>","description":"CSS asset feed writer","main":"./lib/writer.js","repository":{"type":"git","url":"https://github.com/asset-pipe/asset-pipe-css-writer"},"keywords":["css","assets"],"contributors":["Richard Walker <digitalsadhu@gmail.com>","Richard Walker (https://github.com/digitalsadhu)"],"bugs":{"url":"https://github.com/asset-pipe/asset-pipe-css-writer/issues"},"license":"MIT","dependencies":{"asset-pipe-common":"1.0.0-beta.6","postcss":"^6.0.13","postcss-import":"^11.0.0","read-pkg-up":"^3.0.0"},"devDependencies":{"commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.9.0","eslint-config-finn":"^3.0.0","eslint-config-finn-prettier":"^3.0.1","husky":"^0.14.3","jest":"^21.2.1","lint-staged":"^5.0.0","prettier":"^1.7.4","projectz":"^1.4.0","semantic-release":"^8.2.0"},"scripts":{"format":"prettier --write --single-quote --trailing-comma=all --tab-width=4 lib/**/*.js test/**/*.js","lint":"eslint .","test":"jest --coverage","lint:format":"eslint --fix .","precommit":"lint-staged","cm":"git-cz","readme":"projectz compile","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"files":["lib"],"jest":{"coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":100}},"clearMocks":true},"lint-staged":{"*.js":["eslint --fix --config ./.eslintrc","git add"],"{package.json,README.md,LICENSE.md}":["projectz compile","git add"]},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"badges":{"list":["travisci","npmversion","daviddm","daviddmdev"]},"maintainers":[]}

@@ -1,3 +0,20 @@

# asset-pipe-css-writer
<!-- TITLE/ -->
<h1>asset-pipe-css-writer</h1>
<!-- /TITLE -->
<!-- BADGES/ -->
<span class="badge-travisci"><a href="http://travis-ci.org/asset-pipe/asset-pipe-css-writer" title="Check this project's build status on TravisCI"><img src="https://img.shields.io/travis/asset-pipe/asset-pipe-css-writer/master.svg" alt="Travis CI Build Status" /></a></span>
<span class="badge-npmversion"><a href="https://npmjs.org/package/asset-pipe-css-writer" title="View this project on NPM"><img src="https://img.shields.io/npm/v/asset-pipe-css-writer.svg" alt="NPM version" /></a></span>
<span class="badge-daviddm"><a href="https://david-dm.org/asset-pipe/asset-pipe-css-writer" title="View the status of this project's dependencies on DavidDM"><img src="https://img.shields.io/david/asset-pipe/asset-pipe-css-writer.svg" alt="Dependency Status" /></a></span>
<span class="badge-daviddmdev"><a href="https://david-dm.org/asset-pipe/asset-pipe-css-writer#info=devDependencies" title="View the status of this project's development dependencies on DavidDM"><img src="https://img.shields.io/david/dev/asset-pipe/asset-pipe-css-writer.svg" alt="Dev Dependency Status" /></a></span>
<!-- /BADGES -->
[![Greenkeeper badge](https://badges.greenkeeper.io/asset-pipe/asset-pipe-css-writer.svg)](https://greenkeeper.io/)
A module that takes any number of css file entry points and packages them together with meta data before providing them as a readable stream.

@@ -80,2 +97,2 @@

writer.pipe(consumer)
```
```
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