Skip to content
Permalink
Browse files

feat: Exporting values. (#396) (#398)

BREAKING CHANGE: Values will now be exported alongside composed classes

Fixes #396
  • Loading branch information...
AndrewLeedham authored and tivac committed Feb 8, 2018
1 parent 7fff2bf commit 4a15d8fe8e818e096402d394278ad9f99ba79210
@@ -10,6 +10,7 @@ Object {
},
"packages/paths/test/specimens/one/start.css": Object {
"rule": "two rule",
"sub": "\\"sub\\"",
},
}
`;
@@ -21,6 +22,7 @@ Object {
},
"packages/paths/test/specimens/one/start.css": Object {
"rule": "two rule",
"sub": "\\"sub\\"",
},
"packages/paths/test/specimens/one/sub/sub.css": Object {
"sub": "sub",
@@ -12,19 +12,25 @@ exports[`/browserify.js basic functionality should correctly rewrite urls based
exports[`/browserify.js basic functionality should error if an invalid extension is applied 1`] = `"Missing or invalid \\"ext\\" option: false"`;

exports[`/browserify.js basic functionality should include all CSS dependencies in output css 1`] = `
"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
require('./packages/browserify/test/specimens/start.css');
},{\\"./packages/browserify/test/specimens/start.css\\":4}],2:[function(require,module,exports){
module.exports = {
\\"folder\\": \\"mcd19f1319_folder\\"
};
},{}],3:[function(require,module,exports){
module.exports = {
\\"folder\\": \\"white\\",
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"booga\\": \\"mcc4e2a8e1_booga\\",
\\"looga\\": \\"mcc4e2a8e1_booga mcc4e2a8e1_looga\\"
};
},{\\"./packages/browserify/test/specimens/folder/folder.css\\":2}],4:[function(require,module,exports){
module.exports = {
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"folder\\": \\"white\\",
\\"wooga\\": \\"mcc4e2a8e1_booga mc1c78395f_wooga\\",
\\"booga\\": \\"mc1c78395f_booga\\",
\\"tooga\\": \\"mc1c78395f_tooga\\"
@@ -45,19 +51,25 @@ exports[`/browserify.js basic functionality should include all CSS dependencies
`;

exports[`/browserify.js basic functionality should not include duplicate files in the output multiple times 1`] = `
"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
require('./packages/browserify/test/specimens/start.css'); require('./packages/browserify/test/specimens/local.css');
},{\\"./packages/browserify/test/specimens/local.css\\":3,\\"./packages/browserify/test/specimens/start.css\\":4}],2:[function(require,module,exports){
module.exports = {
\\"folder\\": \\"mcd19f1319_folder\\"
};
},{}],3:[function(require,module,exports){
module.exports = {
\\"folder\\": \\"white\\",
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"booga\\": \\"mcc4e2a8e1_booga\\",
\\"looga\\": \\"mcc4e2a8e1_booga mcc4e2a8e1_looga\\"
};
},{\\"./packages/browserify/test/specimens/folder/folder.css\\":2}],4:[function(require,module,exports){
module.exports = {
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"folder\\": \\"white\\",
\\"wooga\\": \\"mcc4e2a8e1_booga mc1c78395f_wooga\\",
\\"booga\\": \\"mc1c78395f_booga\\",
\\"tooga\\": \\"mc1c78395f_tooga\\"
@@ -104,7 +116,7 @@ exports[`/browserify.js basic functionality should output an inline source map w
`;

exports[`/browserify.js basic functionality should replace require() calls with the exported identifiers 1`] = `
"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
require('./packages/browserify/test/specimens/simple.css');
},{\\"./packages/browserify/test/specimens/simple.css\\":2}],2:[function(require,module,exports){
module.exports = {
@@ -16,8 +16,11 @@ exports[`/browserify.js factor-bundle should avoid outputting empty css files by
`;

exports[`/browserify.js factor-bundle should be supported 1`] = `
"require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({5:[function(require,module,exports){
"require=(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({5:[function(require,module,exports){
module.exports = {
\\"folder\\": \\"white\\",
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"booga\\": \\"mcc4e2a8e1_booga\\",
\\"looga\\": \\"mcc4e2a8e1_booga mcc4e2a8e1_looga\\"
};
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`/browserify.js /issues /58 should update when CSS dependencies change 1`] = `
"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
require('./packages/browserify/test/specimens/issues/58/issue.css');
},{\\"./packages/browserify/test/specimens/issues/58/issue.css\\":2}],2:[function(require,module,exports){
module.exports = {
@@ -19,7 +19,7 @@ module.exports = {
`;

exports[`/browserify.js /issues /58 should update when CSS dependencies change 2`] = `
"(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\\"function\\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\\"Cannot find module '\\"+o+\\"'\\");throw f.code=\\"MODULE_NOT_FOUND\\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\\"function\\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
require('./packages/browserify/test/specimens/issues/58/issue.css');
},{\\"./packages/browserify/test/specimens/issues/58/issue.css\\":2}],2:[function(require,module,exports){
module.exports = {
@@ -3,11 +3,12 @@
var fs = require("fs"),
path = require("path"),

Graph = require("dependency-graph").DepGraph,
postcss = require("postcss"),
slug = require("unique-slug"),
series = require("p-each-series"),
unique = require("lodash.uniq"),
Graph = require("dependency-graph").DepGraph,
postcss = require("postcss"),
slug = require("unique-slug"),
series = require("p-each-series"),
unique = require("lodash.uniq"),
mapValues = require("lodash.mapvalues"),

output = require("./lib/output.js"),
message = require("./lib/message.js"),
@@ -131,7 +132,11 @@ Processor.prototype = {
}

return file.processed.then((result) => {
file.exports = message(result, "classes");
file.exports = Object.assign(
Object.create(null),
mapValues(file.values, (obj) => [ obj.value ]),
message(result, "classes")
);
file.result = result;
});
});
@@ -128,11 +128,17 @@ Object {
},
"packages/core/test/specimens/local.css": Object {
"booga": "booga",
"folder": "white",
"looga": "booga looga",
"one": "red",
"two": "blue",
},
"packages/core/test/specimens/start.css": Object {
"booga": "booga",
"folder": "white",
"one": "red",
"tooga": "tooga",
"two": "blue",
"wooga": "booga wooga",
},
}
@@ -28,11 +28,17 @@ Object {
},
"packages/core/test/specimens/local.css": Object {
"booga": "booga",
"folder": "white",
"looga": "booga looga",
"one": "red",
"two": "blue",
},
"packages/core/test/specimens/start.css": Object {
"booga": "booga",
"folder": "white",
"one": "red",
"tooga": "tooga",
"two": "blue",
"wooga": "booga wooga",
},
}
@@ -41,6 +41,15 @@ Object {
"fooga": Array [
"fooga",
],
"local": Array [
"'./local.css'",
],
"o": Array [
"red",
],
"one": Array [
"red",
],
}
`;

@@ -6,6 +6,9 @@ Object {
"wooga",
"a",
],
"simple": Array [
"\\"./simple.css\\"",
],
}
`;

@@ -4,6 +4,7 @@ exports[`modular-css-paths should be usable as a modular-css resolver 1`] = `
Object {
"packages/paths/test/specimens/one/start.css": Object {
"rule": "two rule",
"sub": "\\"sub\\"",
},
"packages/paths/test/specimens/one/sub/sub.css": Object {
"sub": "sub",
@@ -6,10 +6,16 @@ exports[`/postcss.js should accept a \`json\` property and write exports to that
\\"folder\\": \\"folder\\"
},
\\"packages/postcss/test/specimens/local.css\\": {
\\"folder\\": \\"white\\",
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"booga\\": \\"booga\\",
\\"looga\\": \\"booga looga\\"
},
\\"packages/postcss/test/specimens/start.css\\": {
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"folder\\": \\"white\\",
\\"wooga\\": \\"booga wooga\\",
\\"booga\\": \\"booga\\",
\\"tooga\\": \\"tooga\\"
@@ -166,7 +166,7 @@ function _set(newState) {
}

function callAll(fns) {
while (fns && fns.length) fns.pop()();
while (fns && fns.length) fns.shift()();
}

function _mount(target, anchor) {
@@ -569,14 +569,23 @@ __webpack_require__(1);

\\"use strict\\";
Object.defineProperty(__webpack_exports__, \\"__esModule\\", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"one\\", function() { return one; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"two\\", function() { return two; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"folder\\", function() { return folder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"wooga\\", function() { return wooga; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"booga\\", function() { return booga; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \\"tooga\\", function() { return tooga; });
/* harmony default export */ __webpack_exports__[\\"default\\"] = ({
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"folder\\": \\"white\\",
\\"wooga\\": \\"booga wooga\\",
\\"booga\\": \\"booga\\",
\\"tooga\\": \\"tooga\\"
});
var one = \\"red\\";
var two = \\"blue\\";
var folder = \\"white\\";
var wooga = \\"booga wooga\\";
var booga = \\"booga\\";
var tooga = \\"tooga\\";
@@ -602,10 +611,16 @@ exports[`/webpack.js should handle dependencies 3`] = `
\\"folder\\": \\"folder\\"
},
\\"packages/webpack/test/specimens/local.css\\": {
\\"folder\\": \\"white\\",
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"booga\\": \\"booga\\",
\\"looga\\": \\"booga looga\\"
},
\\"packages/webpack/test/specimens/start.css\\": {
\\"one\\": \\"red\\",
\\"two\\": \\"blue\\",
\\"folder\\": \\"white\\",
\\"wooga\\": \\"booga wooga\\",
\\"booga\\": \\"booga\\",
\\"tooga\\": \\"tooga\\"

0 comments on commit 4a15d8f

Please sign in to comment.
You can’t perform that action at this time.