@modular-css/processor
Advanced tools
Comparing version 27.0.3 to 27.1.0
@@ -30,1 +30,2 @@ "use strict"; | ||
exports.SELECTOR_PREFIX = SELECTOR_PREFIX; | ||
exports.VALUE_PREFIX = VALUE_PREFIX; |
{ | ||
"name": "@modular-css/processor", | ||
"version": "27.0.3", | ||
"version": "27.1.0", | ||
"description": "A streamlined reinterpretation of CSS Modules", | ||
@@ -26,6 +26,8 @@ "main": "./processor.js", | ||
], | ||
"devDependencies": { | ||
"sugarss": "^4.0.1" | ||
}, | ||
"dependencies": { | ||
"dependency-graph": "^0.11.0", | ||
"escape-string-regexp": "^4.0.0", | ||
"lodash": "^4.17.0", | ||
"postcss-selector-parser": "^6.0.2", | ||
@@ -40,3 +42,3 @@ "postcss-url": "^10.0.0", | ||
}, | ||
"gitHead": "55fe19b3d768b3998e8e391431906eb9c3ce6a9a" | ||
"gitHead": "e302570bde992b563a69bad58245c68adda65504" | ||
} |
@@ -39,7 +39,4 @@ "use strict"; | ||
const sourceKey = processor._addValue(file, name); | ||
const nameKey = processor._addValue(from, name); | ||
processor._addDependency({ name : from, dependency : file, refs : [{ name }] }); | ||
processor.graph.addDependency(nameKey, sourceKey); | ||
values[name] = { | ||
@@ -62,6 +59,6 @@ ...value, | ||
processor._addValue(file, parsed.name, { namespace : true }); | ||
for(const key in source.values) { | ||
const name = `${parsed.name}.${key}`; | ||
values[name] = { | ||
@@ -68,0 +65,0 @@ ...source.values[key], |
@@ -13,3 +13,2 @@ /* eslint-disable no-await-in-loop */ | ||
const message = require("./lib/message.js"); | ||
const relative = require("./lib/relative.js"); | ||
@@ -29,2 +28,4 @@ const tiered = require("./lib/graph-tiers.js"); | ||
const keys = require("./lib/keys.js"); | ||
const { | ||
@@ -37,8 +38,4 @@ selectorKey, | ||
isFile, | ||
isSelector, | ||
isValue, | ||
FILE_PREFIX, | ||
} = require("./lib/keys.js"); | ||
} = keys; | ||
@@ -77,3 +74,3 @@ let fs; | ||
const DEFAULTS = { | ||
cwd : process.cwd(), | ||
cwd : false, | ||
map : false, | ||
@@ -98,2 +95,4 @@ | ||
...opts, | ||
cwd : opts.cwd || process.cwd(), | ||
}; | ||
@@ -254,18 +253,16 @@ | ||
fileDependencies(file) { | ||
let results; | ||
if(!file) { | ||
return filterByPrefix(FILE_PREFIX, this._graph.overallOrder()); | ||
} | ||
if(file) { | ||
const normalized = this._normalize(file); | ||
const key = fileKey(normalized); | ||
const normalized = this._normalize(file); | ||
const key = fileKey(normalized); | ||
if(!this._graph.hasNode(key)) { | ||
throw new Error(`Unknown file: ${normalized}`); | ||
} | ||
results = this._graph.dependenciesOf(key); | ||
} else { | ||
results = this._graph.overallOrder(); | ||
if(!this._graph.hasNode(key)) { | ||
throw new Error(`Unknown file: ${normalized}`); | ||
} | ||
return filterByPrefix(FILE_PREFIX, results); | ||
const dependencies = this._graph.dependenciesOf(key); | ||
return filterByPrefix(FILE_PREFIX, dependencies); | ||
} | ||
@@ -307,2 +304,4 @@ | ||
await this._files[dep].walked; | ||
const result = await this._after.process( | ||
@@ -412,4 +411,2 @@ // NOTE: the call to .clone() is really important here, otherwise this call | ||
if(!this._graph.hasNode(key)) { | ||
// console.log("_addFile", { file }); | ||
this._graph.addNode(key, { | ||
@@ -432,4 +429,2 @@ file, | ||
if(!this._graph.hasNode(sKey)) { | ||
// console.log("_addSelector", { file, selector }); | ||
this._graph.addNode(sKey, { | ||
@@ -470,4 +465,2 @@ file, | ||
if(!this._graph.hasNode(vKey)) { | ||
// console.log("_addValue", { file, name, opts }); | ||
this._graph.addNode(vKey, { | ||
@@ -568,8 +561,2 @@ file, | ||
// Pull in any classes from an @composes command | ||
Object.assign(file.classes, message(result, "atcomposes")); | ||
// export the last "classes" message that was sent | ||
Object.assign(file.classes, message(result, "classes")); | ||
// Save off anything from plugins named "modular-css-export*" | ||
@@ -667,10 +654,4 @@ // https://github.com/tivac/modular-css/pull/404 | ||
// Static exports of key.js functionality | ||
Processor.selectorKey = selectorKey; | ||
Processor.fileKey = fileKey; | ||
Processor.valueKey = valueKey; | ||
Object.assign(Processor, keys); | ||
Processor.isFile = isFile; | ||
Processor.isSelector = isSelector; | ||
Processor.isValue = isValue; | ||
module.exports = Processor; |
@modular-css/processor [![NPM Version](https://img.shields.io/npm/v/@modular-css/processor.svg)](https://www.npmjs.com/package/@modular-css/processor) [![NPM License](https://img.shields.io/npm/l/@modular-css/processor.svg)](https://www.npmjs.com/package/@modular-css/processor) [![NPM Downloads](https://img.shields.io/npm/dm/@modular-css/processor.svg)](https://www.npmjs.com/package/@modular-css/processor) | ||
=========== | ||
<p align="center"> | ||
<a href="https://gitter.im/modular-css/modular-css"><img src="https://img.shields.io/gitter/room/modular-css/modular-css.svg" alt="Gitter" /></a> | ||
</p> | ||
The core functionality of [`modular-css`](https://npmjs.com/modular-css) exposed as a JS API. | ||
@@ -9,0 +5,0 @@ |
8
162728
1
24
4972
233
- Removedlodash@^4.17.0
- Removedlodash@4.17.21(transitive)