applying transfer to react app

This commit is contained in:
Tyler Koenig
2021-09-20 16:54:47 -04:00
parent 8819f31dd0
commit c612b7d702
37373 changed files with 3775588 additions and 2871 deletions
+128
View File
@@ -0,0 +1,128 @@
# Changes to PostCSS Nesting
### 7.0.1 (July 29, 2018)
- Fixed: Non-breaking issue with rules being unnecessarily split
### 7.0.0 (September 17, 2018)
- Updated: Support for PostCSS v7+
- Updated: Support for Node v6+
In a comment, a CSSWG member expressed interest in handling nested `@media`
while handling selector nesting. Since the specification has yet to be added
to the official CSSWG repository, nested at-rule deprecation is further delayed.
### 6.0.0 (June 9, 2018)
- Deprecated: Nested at-rules like `@media` will no longer work in 7.0.0
- Refactored code to improve efficiency
### 5.0.0 (March 24, 2018)
- Refactored code to use Imports babel-transformed for Node v4 compatibility
### 4.2.1 (September 19, 2017)
- Updated: Exposing the transform function as its own for postcss-extend
### 4.2.0 (September 18, 2017)
- Added: Reduced splitting of rules
### 4.1.0 (August 19, 2017)
- Added: Mutation-safe walk method
- Improved: Complex selector validity testing
- Thanks: A special thanks to @JLHwung for these improvements
### 4.0.1 (May 22, 2017)
- Improved: Selector validity testing
### 4.0.0 (May 20, 2017)
- Changed: Transform only compliant nesting
- Added: Preserve more raws formatting
### 3.0.0 (May 8, 2017)
- Added: Node 4.x support
- Added: PostCSS 6 support
- Added: Preserved ordering
- Removed: Node 0.12 support
### 2.3.1 (March 16, 2016)
- Updated: Allow any direct nesting that follows the syntactic constraints
- Updated: PostCSS 5.0.6
- Updated: Tests
- Updated: Dependencies
- Updated: Project configuration
### 2.3.0 (February 20, 2016)
- Updated: JavaScript formatting, linting, tests, and documentation
- Updated: Properly concatenate at-rules with or expressions
- Updated: Update internal plugin name to postcss-nesting
### 2.2.0 (January 30, 2016)
- Added: Nesting of all at-rules
- Updated: Direct nesting order maintains order
- Updated: Tests and documentation
### 2.1.1 (January 3, 2016)
- Updated: Project conventions
### 2.1.0 (January 3, 2016)
- Added: Support for valid direct nesting
### 2.0.6 (October 15, 2015)
- Fixed: Issue with new PostCSS rules
### 2.0.5 (October 12, 2015)
- Updated: Nested rules source map to the parent rule
- Updated: PostCSS 5.0.9
- Updated: Tests and documentation
- Updated: Project configuration
### 2.0.4 (September 23, 2015)
- Updated: Map source raws
### 2.0.3 (September 22, 2015)
- Updated: Refactored plugin
- Updated: Tests
- Updated: PostCSS 5.0.6
### 2.0.2 (September 16, 2015)
- Fixed: Issue where the new rules children were not mapped to the parent internally
### 2.0.1 (September 16, 2015)
- Fixed: Issue where a `@nest` rule followed by another bubbling at-rule would not bubble
- Added: CONTRIBUTING.md
### 2.0.0 (September 16, 2015)
- Added: Requirement of `&` per the specification
- Added: New prefix option
- Added: `@document` and `@supports` as bubbles
- Updated: Documentation
### 1.0.0 (September 15, 2015)
- Added: New `@nest` at-rule syntax
- Updated: PostCSS 5
- Removed: Old inner bracket syntax
### 0.1.0 (June 17, 2015)
- Added: Initial release
+108
View File
@@ -0,0 +1,108 @@
# CC0 1.0 Universal
## Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an “owner”) of an original work of
authorship and/or a database (each, a “Work”).
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific works
(“Commons”) that the public can reliably and without fear of later claims of
infringement build upon, modify, incorporate in other works, reuse and
redistribute as freely as possible in any form whatsoever and for any purposes,
including without limitation commercial purposes. These owners may contribute
to the Commons to promote the ideal of a free culture and the further
production of creative, cultural and scientific works, or to gain reputation or
greater distribution for their Work in part through the use and efforts of
others.
For these and/or other purposes and motivations, and without any expectation of
additional consideration or compensation, the person associating CC0 with a
Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights (“Copyright and
Related Rights”). Copyright and Related Rights include, but are not limited
to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a persons image or likeness
depicted in a Work;
4. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
6. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations
thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmers Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “Waiver”). Affirmer
makes the Waiver for the benefit of each member of the public at large and
to the detriment of Affirmers heirs and successors, fully intending that
such Waiver shall not be subject to revocation, rescission, cancellation,
termination, or any other legal or equitable action to disrupt the quiet
enjoyment of the Work by the public as contemplated by Affirmers express
Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmers express Statement of Purpose. In addition, to the extent the
Waiver is so judged Affirmer hereby grants to each affected person a
royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmers Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the “License”). The License
shall be deemed effective as of the date CC0 was applied by Affirmer to the
Work. Should any part of the License for any reason be judged legally
invalid or ineffective under applicable law, such partial invalidity or
ineffectiveness shall not invalidate the remainder of the License, and in
such case Affirmer hereby affirms that he or she will not (i) exercise any
of his or her remaining Copyright and Related Rights in the Work or (ii)
assert any associated claims and causes of action with respect to the Work,
in either case contrary to Affirmers express Statement of Purpose.
4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or
otherwise, including without limitation warranties of title,
merchantability, fitness for a particular purpose, non infringement, or
the absence of latent or other defects, accuracy, or the present or
absence of errors, whether or not discoverable, all to the greatest
extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any persons Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
http://creativecommons.org/publicdomain/zero/1.0/.
+79
View File
@@ -0,0 +1,79 @@
# PostCSS Nesting [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]
[![NPM Version][npm-img]][npm-url]
[![CSS Standard Status][css-img]][css-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]
[PostCSS Nesting] lets you nest style rules inside each other, following the
[CSS Nesting] specification.
```pcss
a, b {
color: red;
& c, & d {
color: white;
}
}
/* becomes */
a, b {
color: red;
}
a c, a d, b c, b d {
color: white;
}
```
**NOTICE**: In a future version of this project, nesting at-rules like `@media`
may be deprecated, as they are not part of the nesting proposal. In a comment,
a CSSWG member expressed interest in handling nested `@media` while handling
selector nesting. So deprecating nested at-rules has been temporarily delayed.
## Usage
Add [PostCSS Nesting] to your project:
```bash
npm install postcss-nesting --save-dev
```
Use [PostCSS Nesting] to process your CSS:
```js
import postcssNesting from 'postcss-nesting';
postcssNesting.process(YOUR_CSS /*, processOptions, pluginOptions */);
```
Or use it as a [PostCSS] plugin:
```js
import postcss from 'postcss';
import postcssNesting from 'postcss-nesting';
postcss([
postcssNesting(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
```
[PostCSS Nesting] runs in all Node environments, with special instructions for:
| [Node](INSTALL.md#node) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
| --- | --- | --- | --- | --- |
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-nesting.svg
[cli-url]: https://travis-ci.org/jonathantneal/postcss-nesting
[css-img]: https://cssdb.org/badge/nesting-rules.svg
[css-url]: https://cssdb.org/#nesting-rules
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/postcss-nesting.svg
[npm-url]: https://www.npmjs.com/package/postcss-nesting
[CSS Nesting]: https://drafts.csswg.org/css-nesting-1/
[PostCSS]: https://github.com/postcss/postcss
[PostCSS Nesting]: https://github.com/jonathantneal/postcss-nesting
+134
View File
@@ -0,0 +1,134 @@
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var postcss = require('postcss');
var postcss__default = _interopDefault(postcss);
function shiftNodesBeforeParent(node) {
const parent = node.parent;
const index = parent.index(node); // conditionally move previous siblings into a clone of the parent
if (index) {
parent.cloneBefore().removeAll().append(parent.nodes.slice(0, index));
} // move the current node before the parent (and after the conditional clone)
parent.before(node);
return parent;
}
function cleanupParent(parent) {
if (!parent.nodes.length) {
parent.remove();
}
}
// a valid selector is an ampersand followed by a non-word character or nothing
var validSelector = /&(?:[^\w-|]|$)/;
const replaceable = /&/g;
function mergeSelectors(fromSelectors, toSelectors) {
return fromSelectors.reduce((selectors, fromSelector) => selectors.concat(toSelectors.map(toSelector => toSelector.replace(replaceable, fromSelector))), []);
}
function transformRuleWithinRule(node) {
// move previous siblings and the node to before the parent
const parent = shiftNodesBeforeParent(node); // update the selectors of the node to be merged with the parent
node.selectors = mergeSelectors(parent.selectors, node.selectors); // merge similar rules back together
// eslint-disable-next-line no-extra-parens
const areSameRule = node.type === 'rule' && parent.type === 'rule' && node.selector === parent.selector || node.type === 'atrule' && parent.type === 'atrule' && node.params === parent.params;
if (areSameRule) {
node.append(...parent.nodes);
} // conditionally cleanup an empty parent rule
cleanupParent(parent);
}
const isRuleWithinRule = node => node.type === 'rule' && Object(node.parent).type === 'rule' && node.selectors.every(selector => selector.trim().lastIndexOf('&') === 0 && validSelector.test(selector));
const comma = postcss.list.comma;
function transformNestRuleWithinRule(node) {
// move previous siblings and the node to before the parent
const parent = shiftNodesBeforeParent(node); // clone the parent as a new rule with children appended to it
const rule = parent.clone().removeAll().append(node.nodes); // replace the node with the new rule
node.replaceWith(rule); // update the selectors of the node to be merged with the parent
rule.selectors = mergeSelectors(parent.selectors, comma(node.params)); // conditionally cleanup an empty parent rule
cleanupParent(parent); // walk the children of the new rule
walk(rule);
}
const isNestRuleWithinRule = node => node.type === 'atrule' && node.name === 'nest' && Object(node.parent).type === 'rule' && comma(node.params).every(selector => selector.split('&').length === 2 && validSelector.test(selector));
var validAtrules = ['document', 'media', 'supports'];
/*
* DEPRECATED: In v7.0.0 these features will be removed as they are not part of
* the nesting proposal.
*/
function atruleWithinRule(node) {
// move previous siblings and the node to before the parent
const parent = shiftNodesBeforeParent(node); // clone the parent as a new rule with children appended to it
const rule = parent.clone().removeAll().append(node.nodes); // append the new rule to the node
node.append(rule); // conditionally cleanup an empty parent rule
cleanupParent(parent); // walk the children of the new rule
walk(rule);
}
const isAtruleWithinRule = node => node.type === 'atrule' && validAtrules.indexOf(node.name) !== -1 && Object(node.parent).type === 'rule';
const comma$1 = postcss.list.comma;
function mergeParams(fromParams, toParams) {
return comma$1(fromParams).map(params1 => comma$1(toParams).map(params2 => `${params1} and ${params2}`).join(', ')).join(', ');
}
/*
* DEPRECATED: In v7.0.0 these features will be removed as they are not part of
* the nesting proposal.
*/
function transformAtruleWithinAtrule(node) {
// move previous siblings and the node to before the parent
const parent = shiftNodesBeforeParent(node); // update the params of the node to be merged with the parent
node.params = mergeParams(parent.params, node.params); // conditionally cleanup an empty parent rule
cleanupParent(parent);
}
const isAtruleWithinAtrule = node => node.type === 'atrule' && validAtrules.indexOf(node.name) !== -1 && Object(node.parent).type === 'atrule' && node.name === node.parent.name;
function walk(node) {
node.nodes.slice(0).forEach(child => {
if (child.parent === node) {
if (isRuleWithinRule(child)) {
transformRuleWithinRule(child);
} else if (isNestRuleWithinRule(child)) {
transformNestRuleWithinRule(child);
} else if (isAtruleWithinRule(child)) {
atruleWithinRule(child);
} else if (isAtruleWithinAtrule(child)) {
transformAtruleWithinAtrule(child);
}
if (Object(child.nodes).length) {
walk(child);
}
}
});
}
var index = postcss__default.plugin('postcss-nesting', () => walk);
module.exports = index;
//# sourceMappingURL=index.cjs.js.map
+96
View File
@@ -0,0 +1,96 @@
{
"_from": "postcss-nesting@^7.0.0",
"_id": "postcss-nesting@7.0.1",
"_inBundle": false,
"_integrity": "sha512-FrorPb0H3nuVq0Sff7W2rnc3SmIcruVC6YwpcS+k687VxyxO33iE1amna7wHuRVzM8vfiYofXSBHNAZ3QhLvYg==",
"_location": "/postcss-nesting",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "postcss-nesting@^7.0.0",
"name": "postcss-nesting",
"escapedName": "postcss-nesting",
"rawSpec": "^7.0.0",
"saveSpec": null,
"fetchSpec": "^7.0.0"
},
"_requiredBy": [
"/postcss-preset-env"
],
"_resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-7.0.1.tgz",
"_shasum": "b50ad7b7f0173e5b5e3880c3501344703e04c052",
"_spec": "postcss-nesting@^7.0.0",
"_where": "/Users/tylerkoenig/Code/personal/react-scss2/node_modules/postcss-preset-env",
"author": {
"name": "Jonathan Neal",
"email": "jonathantneal@hotmail.com"
},
"bugs": {
"url": "https://github.com/jonathantneal/postcss-nesting/issues"
},
"bundleDependencies": false,
"dependencies": {
"postcss": "^7.0.2"
},
"deprecated": false,
"description": "Nest style rules inside each other",
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-eslint": "^9.0.0",
"babel-plugin-array-includes": "^2.0.3",
"eslint": "^5.6.0",
"eslint-config-dev": "^2.0.0",
"postcss-tape": "^2.2.0",
"pre-commit": "^1.2.2",
"rollup": "^0.66.0",
"rollup-plugin-babel": "^4.0.1"
},
"engines": {
"node": ">=6.0.0"
},
"eslintConfig": {
"extends": "dev",
"parser": "babel-eslint"
},
"files": [
"index.cjs.js",
"index.es.js"
],
"homepage": "https://github.com/jonathantneal/postcss-nesting#readme",
"keywords": [
"postcss",
"css",
"postcss-plugin",
"atrules",
"child",
"children",
"cssnext",
"nested",
"nestings",
"rules",
"selectors",
"syntax",
"specifications",
"specs",
"w3c",
"csswg"
],
"license": "CC0-1.0",
"main": "index.cjs.js",
"module": "index.es.js",
"name": "postcss-nesting",
"repository": {
"type": "git",
"url": "git+https://github.com/jonathantneal/postcss-nesting.git"
},
"scripts": {
"prepublishOnly": "npm test",
"pretest": "rollup -c .rollup.js --silent",
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape",
"test:js": "eslint *.js lib/*.js --cache --ignore-path .gitignore --quiet",
"test:tape": "postcss-tape"
},
"version": "7.0.1"
}