Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
5
node_modules/postcss-modules-extract-imports/LICENSE
generated
vendored
Normal file
5
node_modules/postcss-modules-extract-imports/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
Copyright 2015 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.
|
76
node_modules/postcss-modules-extract-imports/README.md
generated
vendored
Normal file
76
node_modules/postcss-modules-extract-imports/README.md
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
# CSS Modules: Extract Imports
|
||||
|
||||
[](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", className [... className], className [... className] from global;
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `failOnWrongOrder` `bool` generates exception for unpredictable imports order.
|
||||
|
||||
```css
|
||||
.aa {
|
||||
composes: b from "./b.css";
|
||||
composes: c from "./c.css";
|
||||
}
|
||||
|
||||
.bb {
|
||||
/* "b.css" should be before "c.css" in this case */
|
||||
composes: c from "./c.css";
|
||||
composes: b from "./b.css";
|
||||
}
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
```
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
|
||||
[](https://travis-ci.org/css-modules/postcss-modules-extract-imports)
|
||||
|
||||
- Lines: [](https://coveralls.io/r/css-modules/postcss-modules-extract-imports?branch=master)
|
||||
- Statements: [](http://codecov.io/github/css-modules/postcss-modules-extract-imports?branch=master)
|
||||
|
||||
## License
|
||||
|
||||
ISC
|
||||
|
||||
## With thanks
|
||||
|
||||
- Mark Dalgleish
|
||||
- Tobias Koppers
|
||||
- Guy Bedford
|
||||
|
||||
---
|
||||
|
||||
Glen Maddern, 2015.
|
51
node_modules/postcss-modules-extract-imports/package.json
generated
vendored
Normal file
51
node_modules/postcss-modules-extract-imports/package.json
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "postcss-modules-extract-imports",
|
||||
"version": "3.1.0",
|
||||
"description": "A CSS Modules transform to extract local aliases for inline imports",
|
||||
"main": "src/index.js",
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >= 14"
|
||||
},
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"prettier": "prettier -l --ignore-path .gitignore . \"!test/test-cases\"",
|
||||
"eslint": "eslint --ignore-path .gitignore .",
|
||||
"lint": "yarn eslint && yarn prettier",
|
||||
"test:only": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:coverage": "jest --coverage --collectCoverageFrom=\"src/**/*\"",
|
||||
"pretest": "yarn lint",
|
||||
"test": "yarn test:coverage",
|
||||
"prepublishOnly": "yarn test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/css-modules/postcss-modules-extract-imports.git"
|
||||
},
|
||||
"keywords": [
|
||||
"css-modules",
|
||||
"postcss",
|
||||
"plugin"
|
||||
],
|
||||
"author": "Glen Maddern",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/css-modules/postcss-modules-extract-imports/issues"
|
||||
},
|
||||
"homepage": "https://github.com/css-modules/postcss-modules-extract-imports",
|
||||
"devDependencies": {
|
||||
"coveralls": "^3.1.0",
|
||||
"eslint": "^7.10.0",
|
||||
"eslint-config-prettier": "^6.12.0",
|
||||
"husky": "^4.3.0",
|
||||
"jest": "^26.5.2",
|
||||
"lint-staged": "^10.4.0",
|
||||
"postcss": "^8.1.1",
|
||||
"prettier": "^2.1.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.1.0"
|
||||
}
|
||||
}
|
209
node_modules/postcss-modules-extract-imports/src/index.js
generated
vendored
Normal file
209
node_modules/postcss-modules-extract-imports/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,209 @@
|
|||
const topologicalSort = require("./topologicalSort");
|
||||
|
||||
const matchImports = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/;
|
||||
const icssImport = /^:import\((?:"([^"]+)"|'([^']+)')\)/;
|
||||
|
||||
const VISITED_MARKER = 1;
|
||||
|
||||
/**
|
||||
* :import('G') {}
|
||||
*
|
||||
* Rule
|
||||
* composes: ... from 'A'
|
||||
* composes: ... from 'B'
|
||||
|
||||
* Rule
|
||||
* composes: ... from 'A'
|
||||
* composes: ... from 'A'
|
||||
* composes: ... from 'C'
|
||||
*
|
||||
* Results in:
|
||||
*
|
||||
* graph: {
|
||||
* G: [],
|
||||
* A: [],
|
||||
* B: ['A'],
|
||||
* C: ['A'],
|
||||
* }
|
||||
*/
|
||||
function addImportToGraph(importId, parentId, graph, visited) {
|
||||
const siblingsId = parentId + "_" + "siblings";
|
||||
const visitedId = parentId + "_" + importId;
|
||||
|
||||
if (visited[visitedId] !== VISITED_MARKER) {
|
||||
if (!Array.isArray(visited[siblingsId])) {
|
||||
visited[siblingsId] = [];
|
||||
}
|
||||
|
||||
const siblings = visited[siblingsId];
|
||||
|
||||
if (Array.isArray(graph[importId])) {
|
||||
graph[importId] = graph[importId].concat(siblings);
|
||||
} else {
|
||||
graph[importId] = siblings.slice();
|
||||
}
|
||||
|
||||
visited[visitedId] = VISITED_MARKER;
|
||||
|
||||
siblings.push(importId);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (options = {}) => {
|
||||
let importIndex = 0;
|
||||
const createImportedName =
|
||||
typeof options.createImportedName !== "function"
|
||||
? (importName /*, path*/) =>
|
||||
`i__imported_${importName.replace(/\W/g, "_")}_${importIndex++}`
|
||||
: options.createImportedName;
|
||||
const failOnWrongOrder = options.failOnWrongOrder;
|
||||
|
||||
return {
|
||||
postcssPlugin: "postcss-modules-extract-imports",
|
||||
prepare() {
|
||||
const graph = {};
|
||||
const visited = {};
|
||||
const existingImports = {};
|
||||
const importDecls = {};
|
||||
const imports = {};
|
||||
|
||||
return {
|
||||
Once(root, postcss) {
|
||||
// Check the existing imports order and save refs
|
||||
root.walkRules((rule) => {
|
||||
const matches = icssImport.exec(rule.selector);
|
||||
|
||||
if (matches) {
|
||||
const [, /*match*/ doubleQuotePath, singleQuotePath] = matches;
|
||||
const importPath = doubleQuotePath || singleQuotePath;
|
||||
|
||||
addImportToGraph(importPath, "root", graph, visited);
|
||||
|
||||
existingImports[importPath] = rule;
|
||||
}
|
||||
});
|
||||
|
||||
root.walkDecls(/^composes$/, (declaration) => {
|
||||
const multiple = declaration.value.split(",");
|
||||
const values = [];
|
||||
|
||||
multiple.forEach((value) => {
|
||||
const matches = value.trim().match(matchImports);
|
||||
|
||||
if (!matches) {
|
||||
values.push(value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let tmpSymbols;
|
||||
let [
|
||||
,
|
||||
/*match*/ symbols,
|
||||
doubleQuotePath,
|
||||
singleQuotePath,
|
||||
global,
|
||||
] = matches;
|
||||
|
||||
if (global) {
|
||||
// Composing globals simply means changing these classes to wrap them in global(name)
|
||||
tmpSymbols = symbols.split(/\s+/).map((s) => `global(${s})`);
|
||||
} else {
|
||||
const importPath = doubleQuotePath || singleQuotePath;
|
||||
|
||||
let parent = declaration.parent;
|
||||
let parentIndexes = "";
|
||||
|
||||
while (parent.type !== "root") {
|
||||
parentIndexes =
|
||||
parent.parent.index(parent) + "_" + parentIndexes;
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
const { selector } = declaration.parent;
|
||||
const parentRule = `_${parentIndexes}${selector}`;
|
||||
|
||||
addImportToGraph(importPath, parentRule, graph, visited);
|
||||
|
||||
importDecls[importPath] = declaration;
|
||||
imports[importPath] = imports[importPath] || {};
|
||||
|
||||
tmpSymbols = symbols.split(/\s+/).map((s) => {
|
||||
if (!imports[importPath][s]) {
|
||||
imports[importPath][s] = createImportedName(s, importPath);
|
||||
}
|
||||
|
||||
return imports[importPath][s];
|
||||
});
|
||||
}
|
||||
|
||||
values.push(tmpSymbols.join(" "));
|
||||
});
|
||||
|
||||
declaration.value = values.join(", ");
|
||||
});
|
||||
|
||||
const importsOrder = topologicalSort(graph, failOnWrongOrder);
|
||||
|
||||
if (importsOrder instanceof Error) {
|
||||
const importPath = importsOrder.nodes.find((importPath) =>
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
importDecls.hasOwnProperty(importPath)
|
||||
);
|
||||
const decl = importDecls[importPath];
|
||||
|
||||
throw decl.error(
|
||||
"Failed to resolve order of composed modules " +
|
||||
importsOrder.nodes
|
||||
.map((importPath) => "`" + importPath + "`")
|
||||
.join(", ") +
|
||||
".",
|
||||
{
|
||||
plugin: "postcss-modules-extract-imports",
|
||||
word: "composes",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
let lastImportRule;
|
||||
|
||||
importsOrder.forEach((path) => {
|
||||
const importedSymbols = imports[path];
|
||||
let rule = existingImports[path];
|
||||
|
||||
if (!rule && importedSymbols) {
|
||||
rule = postcss.rule({
|
||||
selector: `:import("${path}")`,
|
||||
raws: { after: "\n" },
|
||||
});
|
||||
|
||||
if (lastImportRule) {
|
||||
root.insertAfter(lastImportRule, rule);
|
||||
} else {
|
||||
root.prepend(rule);
|
||||
}
|
||||
}
|
||||
|
||||
lastImportRule = rule;
|
||||
|
||||
if (!importedSymbols) {
|
||||
return;
|
||||
}
|
||||
|
||||
Object.keys(importedSymbols).forEach((importedSymbol) => {
|
||||
rule.append(
|
||||
postcss.decl({
|
||||
value: importedSymbol,
|
||||
prop: importedSymbols[importedSymbol],
|
||||
raws: { before: "\n " },
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.postcss = true;
|
66
node_modules/postcss-modules-extract-imports/src/topologicalSort.js
generated
vendored
Normal file
66
node_modules/postcss-modules-extract-imports/src/topologicalSort.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
const PERMANENT_MARKER = 2;
|
||||
const TEMPORARY_MARKER = 1;
|
||||
|
||||
function createError(node, graph) {
|
||||
const er = new Error("Nondeterministic import's order");
|
||||
|
||||
const related = graph[node];
|
||||
const relatedNode = related.find(
|
||||
(relatedNode) => graph[relatedNode].indexOf(node) > -1
|
||||
);
|
||||
|
||||
er.nodes = [node, relatedNode];
|
||||
|
||||
return er;
|
||||
}
|
||||
|
||||
function walkGraph(node, graph, state, result, strict) {
|
||||
if (state[node] === PERMANENT_MARKER) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (state[node] === TEMPORARY_MARKER) {
|
||||
if (strict) {
|
||||
return createError(node, graph);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
state[node] = TEMPORARY_MARKER;
|
||||
|
||||
const children = graph[node];
|
||||
const length = children.length;
|
||||
|
||||
for (let i = 0; i < length; ++i) {
|
||||
const error = walkGraph(children[i], graph, state, result, strict);
|
||||
|
||||
if (error instanceof Error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
state[node] = PERMANENT_MARKER;
|
||||
|
||||
result.push(node);
|
||||
}
|
||||
|
||||
function topologicalSort(graph, strict) {
|
||||
const result = [];
|
||||
const state = {};
|
||||
|
||||
const nodes = Object.keys(graph);
|
||||
const length = nodes.length;
|
||||
|
||||
for (let i = 0; i < length; ++i) {
|
||||
const er = walkGraph(nodes[i], graph, state, result, strict);
|
||||
|
||||
if (er instanceof Error) {
|
||||
return er;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = topologicalSort;
|
Loading…
Add table
Add a link
Reference in a new issue