Izmjenjena struktura, dodan backand

This commit is contained in:
GotPPay
2017-10-16 11:19:46 +02:00
parent 1ec88afacb
commit 048e32c4aa
37153 changed files with 2975854 additions and 1 deletions

View File

@@ -0,0 +1,63 @@
# CSS Modules: Extract Imports
[![Build Status](https://travis-ci.org/css-modules/postcss-modules-extract-imports.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-extract-imports)
Transforms:
```css
:local(.continueButton) {
composes: button from "library/button.css";
color: green;
}
```
into:
```css
:import("library/button.css") {
button: __tmp_487387465fczSDGHSABb;
}
:local(.continueButton) {
composes: __tmp_487387465fczSDGHSABb;
color: green;
}
```
## Specification
- Only a certain whitelist of properties are inspected. Currently, that whitelist is `['composes']` alone.
- An extend-import has the following format:
```
composes: className [... className] from "path/to/file.css";
```
## Building
```
npm install
npm build
npm test
```
[![Build Status](https://travis-ci.org/css-modules/postcss-modules-extract-imports.svg?branch=master)](https://travis-ci.org/css-modules/postcss-modules-extract-imports)
* Lines: [![Coverage Status](https://coveralls.io/repos/css-modules/postcss-modules-extract-imports/badge.svg?branch=master)](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
* Statements: [![codecov.io](http://codecov.io/github/css-modules/postcss-modules-extract-imports/coverage.svg?branch=master)](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)
## Development
- `npm watch` will watch `src` for changes and rebuild
- `npm autotest` will watch `src` and `test` for changes and retest
## License
ISC
## With thanks
- Mark Dalgleish
- Tobias Koppers
- Guy Bedford
---
Glen Maddern, 2015.

View File

@@ -0,0 +1,97 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _postcss = require('postcss');
var _postcss2 = _interopRequireDefault(_postcss);
var declWhitelist = ['composes'],
declFilter = new RegExp('^(' + declWhitelist.join('|') + ')$'),
matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/,
icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
var processor = _postcss2['default'].plugin('modules-extract-imports', function (options) {
return function (css) {
var imports = {},
importIndex = 0,
createImportedName = options && options.createImportedName || function (importName /*, path*/) {
return 'i__imported_' + importName.replace(/\W/g, '_') + '_' + importIndex++;
};
// Find any declaration that supports imports
css.walkDecls(declFilter, function (decl) {
var matches = decl.value.match(matchImports);
var tmpSymbols = undefined;
if (matches) {
var _matches = _slicedToArray(matches, 5);
var /*match*/symbols = _matches[1];
var doubleQuotePath = _matches[2];
var singleQuotePath = _matches[3];
var _global = _matches[4];
if (_global) {
// Composing globals simply means changing these classes to wrap them in global(name)
tmpSymbols = symbols.split(/\s+/).map(function (s) {
return 'global(' + s + ')';
});
} else {
(function () {
var path = doubleQuotePath || singleQuotePath;
imports[path] = imports[path] || {};
tmpSymbols = symbols.split(/\s+/).map(function (s) {
if (!imports[path][s]) {
imports[path][s] = createImportedName(s, path);
}
return imports[path][s];
});
})();
}
decl.value = tmpSymbols.join(' ');
}
});
// If we've found any imports, insert or append :import rules
var existingImports = {};
css.walkRules(function (rule) {
var matches = icssImport.exec(rule.selector);
if (matches) {
var _matches2 = _slicedToArray(matches, 3);
var /*match*/doubleQuotePath = _matches2[1];
var singleQuotePath = _matches2[2];
existingImports[doubleQuotePath || singleQuotePath] = rule;
}
});
Object.keys(imports).reverse().forEach(function (path) {
var rule = existingImports[path];
if (!rule) {
rule = _postcss2['default'].rule({
selector: ':import("' + path + '")',
raws: { after: "\n" }
});
css.prepend(rule);
}
Object.keys(imports[path]).forEach(function (importedSymbol) {
rule.append(_postcss2['default'].decl({
value: importedSymbol,
prop: imports[path][importedSymbol],
raws: { before: "\n " }
}));
});
});
};
});
exports['default'] = processor;
module.exports = exports['default'];

View File

@@ -0,0 +1,77 @@
{
"_from": "postcss-modules-extract-imports@^1.0.0",
"_id": "postcss-modules-extract-imports@1.1.0",
"_inBundle": false,
"_integrity": "sha1-thTJcgvmgW6u41+zpfqh26agXds=",
"_location": "/postcss-modules-extract-imports",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "postcss-modules-extract-imports@^1.0.0",
"name": "postcss-modules-extract-imports",
"escapedName": "postcss-modules-extract-imports",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/css-loader"
],
"_resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.1.0.tgz",
"_shasum": "b614c9720be6816eaee35fb3a5faa1dba6a05ddb",
"_spec": "postcss-modules-extract-imports@^1.0.0",
"_where": "/home/bilal/Saburly/slucajna-televizija/node_modules/css-loader",
"author": {
"name": "Glen Maddern"
},
"bugs": {
"url": "https://github.com/css-modules/postcss-modules-extract-imports/issues"
},
"bundleDependencies": false,
"dependencies": {
"postcss": "^6.0.1"
},
"deprecated": false,
"description": "A CSS Modules transform to extract local aliases for inline imports",
"devDependencies": {
"babel": "^5.4.7",
"babel-eslint": "^7.2.2",
"babel-istanbul": "^0.4.0",
"babelify": "^7.3.0",
"chokidar-cli": "^1.0.1",
"codecov.io": "^0.1.2",
"coveralls": "^2.11.2",
"eslint": "^1.5.0",
"mocha": "^3.1.2"
},
"files": [
"lib"
],
"homepage": "https://github.com/css-modules/postcss-modules-extract-imports",
"keywords": [
"css-modules",
"postcss",
"plugin"
],
"license": "ISC",
"main": "lib/index.js",
"name": "postcss-modules-extract-imports",
"repository": {
"type": "git",
"url": "git+https://github.com/css-modules/postcss-modules-extract-imports.git"
},
"scripts": {
"autotest": "chokidar src test -c 'npm test'",
"build": "babel --out-dir lib src",
"cover": "babel-istanbul cover node_modules/.bin/_mocha",
"lint": "eslint src",
"posttest": "npm run lint && npm run build",
"precover": "npm run lint && npm run build",
"prepublish": "npm run build",
"test": "mocha --compilers js:babel/register",
"travis": "npm run cover -- --report lcovonly",
"watch": "chokidar src -c 'npm run build'"
},
"version": "1.1.0"
}