mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-02 14:12:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
6
web/node_modules/icss-utils/LICENSE.md
generated
vendored
Normal file
6
web/node_modules/icss-utils/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
ISC License (ISC)
|
||||
Copyright 2018 Glen Maddern
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
84
web/node_modules/icss-utils/README.md
generated
vendored
Normal file
84
web/node_modules/icss-utils/README.md
generated
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
[](https://travis-ci.org/css-modules/icss-utils)
|
||||
|
||||
# ICSS Utils
|
||||
|
||||
## replaceSymbols
|
||||
|
||||
Governs the way tokens are searched & replaced during the linking stage of ICSS loading.
|
||||
|
||||
This is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins
|
||||
(i.e. [CSS Modules Values](https://github.com/css-modules/postcss-modules-values))
|
||||
|
||||
```js
|
||||
import { replaceSymbols, replaceValueSymbols } from "icss-utils";
|
||||
|
||||
replaceSymbols(css, replacements);
|
||||
replaceValueSymbols(string, replacements);
|
||||
```
|
||||
|
||||
Where:
|
||||
|
||||
- `css` is the PostCSS tree you're working with
|
||||
- `replacements` is an JS object of `symbol: "replacement"` pairs, where all occurrences of `symbol` are replaced with `replacement`.
|
||||
|
||||
A symbol is a string of alphanumeric, `-` or `_` characters. A replacement can be any string. They are replaced in the following places:
|
||||
|
||||
- In the value of a declaration, i.e. `color: my_symbol;` or `box-shadow: 0 0 blur spread shadow-color`
|
||||
- In a media expression i.e. `@media small {}` or `@media screen and not-large {}`
|
||||
|
||||
## extractICSS(css, removeRules = true)
|
||||
|
||||
Extracts and remove (if removeRules is equal true) from PostCSS tree `:import` and `:export` statements.
|
||||
|
||||
```js
|
||||
import postcss from "postcss";
|
||||
import { extractICSS } from "icss-utils";
|
||||
|
||||
const css = postcss.parse(`
|
||||
:import(colors) {
|
||||
a: b;
|
||||
}
|
||||
:export {
|
||||
c: d;
|
||||
}
|
||||
`);
|
||||
|
||||
extractICSS(css);
|
||||
/*
|
||||
{
|
||||
icssImports: {
|
||||
colors: {
|
||||
a: 'b'
|
||||
}
|
||||
},
|
||||
icssExports: {
|
||||
c: 'd'
|
||||
}
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
## createICSSRules(icssImports, icssExports)
|
||||
|
||||
Converts icss imports and exports definitions to postcss ast
|
||||
|
||||
```js
|
||||
createICSSRules(
|
||||
{
|
||||
colors: {
|
||||
a: "b"
|
||||
}
|
||||
},
|
||||
{
|
||||
c: "d"
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
---
|
||||
|
||||
Glen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.
|
65
web/node_modules/icss-utils/lib/createICSSRules.js
generated
vendored
Normal file
65
web/node_modules/icss-utils/lib/createICSSRules.js
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _postcss = _interopRequireDefault(require("postcss"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const createImports = imports => {
|
||||
return Object.keys(imports).map(path => {
|
||||
const aliases = imports[path];
|
||||
const declarations = Object.keys(aliases).map(key => _postcss.default.decl({
|
||||
prop: key,
|
||||
value: aliases[key],
|
||||
raws: {
|
||||
before: "\n "
|
||||
}
|
||||
}));
|
||||
const hasDeclarations = declarations.length > 0;
|
||||
|
||||
const rule = _postcss.default.rule({
|
||||
selector: `:import('${path}')`,
|
||||
raws: {
|
||||
after: hasDeclarations ? "\n" : ""
|
||||
}
|
||||
});
|
||||
|
||||
if (hasDeclarations) {
|
||||
rule.append(declarations);
|
||||
}
|
||||
|
||||
return rule;
|
||||
});
|
||||
};
|
||||
|
||||
const createExports = exports => {
|
||||
const declarations = Object.keys(exports).map(key => _postcss.default.decl({
|
||||
prop: key,
|
||||
value: exports[key],
|
||||
raws: {
|
||||
before: "\n "
|
||||
}
|
||||
}));
|
||||
|
||||
if (declarations.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const rule = _postcss.default.rule({
|
||||
selector: `:export`,
|
||||
raws: {
|
||||
after: "\n"
|
||||
}
|
||||
}).append(declarations);
|
||||
|
||||
return [rule];
|
||||
};
|
||||
|
||||
const createICSSRules = (imports, exports) => [...createImports(imports), ...createExports(exports)];
|
||||
|
||||
var _default = createICSSRules;
|
||||
exports.default = _default;
|
52
web/node_modules/icss-utils/lib/extractICSS.js
generated
vendored
Normal file
52
web/node_modules/icss-utils/lib/extractICSS.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const importPattern = /^:import\(("[^"]*"|'[^']*'|[^"']+)\)$/;
|
||||
|
||||
const getDeclsObject = rule => {
|
||||
const object = {};
|
||||
rule.walkDecls(decl => {
|
||||
const before = decl.raws.before ? decl.raws.before.trim() : "";
|
||||
object[before + decl.prop] = decl.value;
|
||||
});
|
||||
return object;
|
||||
};
|
||||
|
||||
const extractICSS = (css, removeRules = true) => {
|
||||
const icssImports = {};
|
||||
const icssExports = {};
|
||||
css.each(node => {
|
||||
if (node.type === "rule") {
|
||||
if (node.selector.slice(0, 7) === ":import") {
|
||||
const matches = importPattern.exec(node.selector);
|
||||
|
||||
if (matches) {
|
||||
const path = matches[1].replace(/'|"/g, "");
|
||||
icssImports[path] = Object.assign(icssImports[path] || {}, getDeclsObject(node));
|
||||
|
||||
if (removeRules) {
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node.selector === ":export") {
|
||||
Object.assign(icssExports, getDeclsObject(node));
|
||||
|
||||
if (removeRules) {
|
||||
node.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
icssImports,
|
||||
icssExports
|
||||
};
|
||||
};
|
||||
|
||||
var _default = extractICSS;
|
||||
exports.default = _default;
|
39
web/node_modules/icss-utils/lib/index.js
generated
vendored
Normal file
39
web/node_modules/icss-utils/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "replaceValueSymbols", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _replaceValueSymbols.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "replaceSymbols", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _replaceSymbols.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "extractICSS", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _extractICSS.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createICSSRules", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _createICSSRules.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _replaceValueSymbols = _interopRequireDefault(require("./replaceValueSymbols.js"));
|
||||
|
||||
var _replaceSymbols = _interopRequireDefault(require("./replaceSymbols.js"));
|
||||
|
||||
var _extractICSS = _interopRequireDefault(require("./extractICSS.js"));
|
||||
|
||||
var _createICSSRules = _interopRequireDefault(require("./createICSSRules.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
web/node_modules/icss-utils/lib/replaceSymbols.js
generated
vendored
Normal file
25
web/node_modules/icss-utils/lib/replaceSymbols.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _replaceValueSymbols = _interopRequireDefault(require("./replaceValueSymbols.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const replaceSymbols = (css, replacements) => {
|
||||
css.walk(node => {
|
||||
if (node.type === "decl" && node.value) {
|
||||
node.value = (0, _replaceValueSymbols.default)(node.value.toString(), replacements);
|
||||
} else if (node.type === "rule" && node.selector) {
|
||||
node.selector = (0, _replaceValueSymbols.default)(node.selector.toString(), replacements);
|
||||
} else if (node.type === "atrule" && node.params) {
|
||||
node.params = (0, _replaceValueSymbols.default)(node.params.toString(), replacements);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var _default = replaceSymbols;
|
||||
exports.default = _default;
|
25
web/node_modules/icss-utils/lib/replaceValueSymbols.js
generated
vendored
Normal file
25
web/node_modules/icss-utils/lib/replaceValueSymbols.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const matchValueName = /[$]?[\w-]+/g;
|
||||
|
||||
const replaceValueSymbols = (value, replacements) => {
|
||||
let matches;
|
||||
|
||||
while (matches = matchValueName.exec(value)) {
|
||||
const replacement = replacements[matches[0]];
|
||||
|
||||
if (replacement) {
|
||||
value = value.slice(0, matches.index) + replacement + value.slice(matchValueName.lastIndex);
|
||||
matchValueName.lastIndex -= matches[0].length - replacement.length;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
var _default = replaceValueSymbols;
|
||||
exports.default = _default;
|
86
web/node_modules/icss-utils/package.json
generated
vendored
Normal file
86
web/node_modules/icss-utils/package.json
generated
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"name": "icss-utils",
|
||||
"version": "4.1.1",
|
||||
"description": "ICSS utils for postcss ast",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint . --ignore-path .gitignore",
|
||||
"build": "babel --out-dir lib src",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run test:only",
|
||||
"test:only": "jest",
|
||||
"prepublish": "yarn test && yarn run build"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"node": 6
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"jest": true
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"prettier --write",
|
||||
"eslint",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/css-modules/icss-utils.git"
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"modules",
|
||||
"icss",
|
||||
"postcss"
|
||||
],
|
||||
"author": "Glen Maddern",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/css-modules/icss-utils/issues"
|
||||
},
|
||||
"homepage": "https://github.com/css-modules/icss-utils#readme",
|
||||
"dependencies": {
|
||||
"postcss": "^7.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.1.0",
|
||||
"@babel/core": "^7.1.0",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^24.1.0",
|
||||
"eslint": "^5.14.1",
|
||||
"husky": "^1.3.1",
|
||||
"jest": "^24.1.0",
|
||||
"lint-staged": "^8.1.4",
|
||||
"prettier": "^1.16.4"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue