Jesus sucks
This commit is contained in:
95
backend/frontend/node_modules/postcss-advanced-variables/CHANGELOG.md
generated
vendored
Normal file
95
backend/frontend/node_modules/postcss-advanced-variables/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
# Changes to PostCSS Advanced Variables
|
||||
|
||||
### 3.0.1 (February 27, 2020)
|
||||
|
||||
- Fixed: parsing the contents of imported stylesheets (#71)
|
||||
|
||||
### 3.0.0 (November 22, 2018)
|
||||
|
||||
- Fixed: transform variables in default value of mixins
|
||||
- Updated: `postcss` to 7.0.6 (major)
|
||||
- Changed: Support for Node 6+
|
||||
|
||||
### 2.3.3 (February 10, 2018)
|
||||
|
||||
- Fixed: asynchronous transforms to allow for imported mixins and variables
|
||||
|
||||
### 2.3.2 (February 10, 2018)
|
||||
|
||||
- Fixed: imports failing when `from` is missing
|
||||
|
||||
### 2.3.1 (February 10, 2018)
|
||||
|
||||
- Added: `babel-plugin-array-includes` instead of `babel-polyfill` for publish
|
||||
- Fixed: `@mixin` rules to support being declared with empty parens
|
||||
- Noted: Recommend `postcss-scss-syntax` to best support variable interpolation
|
||||
|
||||
### 2.3.0 (January 6, 2018)
|
||||
|
||||
- Added: `importFilter` option to accept or ignore imports by function or regex
|
||||
- Added: Support for media parameters after `@import` rules
|
||||
- Added: Support for case-insensitive at-rules
|
||||
- Fixed: Protocol and protocol-less imports are ignored
|
||||
|
||||
### 2.2.0 (January 2, 2018)
|
||||
|
||||
- Added: Support for `@import`
|
||||
- Added: `disable` option to conditionally disable any feature(s)
|
||||
- Fixed: How iterator arrays and objects are treated
|
||||
|
||||
### 2.1.0 (January 1, 2018)
|
||||
|
||||
- Added: Support for `@mixin`, `@include`, and `@content`
|
||||
|
||||
### 2.0.0 (December 31, 2017)
|
||||
|
||||
- Completely rewritten
|
||||
- Added: `unresolved` option to throw errors or warnings on unresolved variables
|
||||
- Added: Support for the `#{$var}` syntax
|
||||
- Added: Support for iterators in `@each` at-rules
|
||||
- Added: Support for boolean `@if` at-rules
|
||||
(`@each $item $index in $array`)
|
||||
- Added: Support for variable replacement in all at-rules
|
||||
- Added: Support for neighboring variables `$a$b`
|
||||
- Fixed: Number comparison in `@if` at-rules
|
||||
|
||||
## 1.2.2 (October 21, 2015)
|
||||
|
||||
- Removed: Old gulp file
|
||||
|
||||
## 1.2.1 (October 21, 2015)
|
||||
|
||||
- Updated: PostCSS 5.0.10
|
||||
- Updated: Tests
|
||||
|
||||
## 1.2.0 (October 21, 2015)
|
||||
|
||||
- Added: Global variables set in options
|
||||
|
||||
## 1.1.0 (September 8, 2015)
|
||||
|
||||
- Added: Support for `!default`
|
||||
|
||||
## 1.0.0 (September 7, 2015)
|
||||
|
||||
- Updated: PostCSS 5.0.4
|
||||
- Updated: Chai 3.2.0
|
||||
- Updated: ESLint 1.0
|
||||
- Updated: Mocha 2.1.3
|
||||
|
||||
## 0.0.4 (July 22, 2015)
|
||||
|
||||
- Added: Support for vars in @media
|
||||
|
||||
## 0.0.3 (July 8, 2015)
|
||||
|
||||
- Added: Support for @else statements
|
||||
|
||||
## 0.0.2 (July 7, 2015)
|
||||
|
||||
- Fixed: Some variable evaluations
|
||||
- Added: Support for deep arrays
|
||||
|
||||
## 0.0.1 (July 7, 2015)
|
||||
|
||||
- Pre-release
|
||||
108
backend/frontend/node_modules/postcss-advanced-variables/LICENSE.md
generated
vendored
Normal file
108
backend/frontend/node_modules/postcss-advanced-variables/LICENSE.md
generated
vendored
Normal 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 person’s 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 Affirmer’s 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 Affirmer’s 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 Affirmer’s 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
|
||||
Affirmer’s 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 Affirmer’s 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 Affirmer’s 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 person’s 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/.
|
||||
576
backend/frontend/node_modules/postcss-advanced-variables/README.md
generated
vendored
Normal file
576
backend/frontend/node_modules/postcss-advanced-variables/README.md
generated
vendored
Normal file
@@ -0,0 +1,576 @@
|
||||
# PostCSS Advanced Variables [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
|
||||
|
||||
[![NPM Version][npm-img]][npm-url]
|
||||
[![Build Status][cli-img]][cli-url]
|
||||
[![Support Chat][git-img]][git-url]
|
||||
|
||||
[PostCSS Advanced Variables] lets you use Sass-like variables, conditionals,
|
||||
and iterators in CSS.
|
||||
|
||||
```scss
|
||||
$dir: assets/icons;
|
||||
|
||||
@each $icon in (foo, bar, baz) {
|
||||
.icon-$icon {
|
||||
background: url('$dir/$icon.png');
|
||||
}
|
||||
}
|
||||
|
||||
@for $count from 1 to 5 by 2 {
|
||||
@if $count > 2 {
|
||||
.col-$count {
|
||||
width: #{$count}0%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@import "path/to/some-file";
|
||||
|
||||
/* after */
|
||||
|
||||
.icon-foo {
|
||||
background: url('assets/icons/foo.png');
|
||||
}
|
||||
|
||||
.icon-bar {
|
||||
background: url('assets/icons/bar.png');
|
||||
}
|
||||
|
||||
.icon-baz {
|
||||
background: url('assets/icons/baz.png');
|
||||
}
|
||||
|
||||
.col-3 {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.col-5 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
// the contents of "path/to/_some-file.scss"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Add [PostCSS Advanced Variables] to your build tool:
|
||||
|
||||
```bash
|
||||
npm install postcss-advanced-variables --save-dev
|
||||
```
|
||||
|
||||
#### Node
|
||||
|
||||
Use [PostCSS Advanced Variables] to process your CSS:
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables').process(YOUR_CSS);
|
||||
```
|
||||
|
||||
#### PostCSS
|
||||
|
||||
Add [PostCSS] to your build tool:
|
||||
|
||||
```bash
|
||||
npm install postcss --save-dev
|
||||
```
|
||||
|
||||
Use [PostCSS Advanced Variables] as a plugin:
|
||||
|
||||
```js
|
||||
postcss([
|
||||
require('postcss-advanced-variables')(/* options */)
|
||||
]).process(YOUR_CSS);
|
||||
```
|
||||
|
||||
#### Gulp
|
||||
|
||||
Add [Gulp PostCSS] to your build tool:
|
||||
|
||||
```bash
|
||||
npm install gulp-postcss --save-dev
|
||||
```
|
||||
|
||||
Use [PostCSS Advanced Variables] in your Gulpfile:
|
||||
|
||||
```js
|
||||
var postcss = require('gulp-postcss');
|
||||
|
||||
gulp.task('css', function () {
|
||||
return gulp.src('./src/*.css').pipe(
|
||||
postcss([
|
||||
require('postcss-advanced-variables')(/* options */)
|
||||
])
|
||||
).pipe(
|
||||
gulp.dest('.')
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
#### Grunt
|
||||
|
||||
Add [Grunt PostCSS] to your build tool:
|
||||
|
||||
```bash
|
||||
npm install grunt-postcss --save-dev
|
||||
```
|
||||
|
||||
Use [PostCSS Advanced Variables] in your Gruntfile:
|
||||
|
||||
```js
|
||||
grunt.loadNpmTasks('grunt-postcss');
|
||||
|
||||
grunt.initConfig({
|
||||
postcss: {
|
||||
options: {
|
||||
use: [
|
||||
require('postcss-advanced-variables')(/* options */)
|
||||
]
|
||||
},
|
||||
dist: {
|
||||
src: '*.css'
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
### $variables
|
||||
|
||||
Variables let you store information to be reused anywhere in a stylesheet.
|
||||
|
||||
Variables are set just like CSS properties, placing a `$` symbol before the
|
||||
name of the variable (`$var-name`). They may also be set placing a `$` symbol
|
||||
before two parentheses wrapping the name of the variable (`$(var-name)`), or by
|
||||
wrapping the `$` symbol and variable name in curly braces preceeded by a hash
|
||||
(`#{$var-name}`).
|
||||
|
||||
```scss
|
||||
$font-size: 1.25em;
|
||||
$font-stack: "Helvetica Neue", sans-serif;
|
||||
$primary-color: #333;
|
||||
|
||||
body {
|
||||
font: $font-size $(font-stack);
|
||||
color: #{$primary-color};
|
||||
}
|
||||
```
|
||||
|
||||
*Note: To use `#{$var-name}` without issues, you will need to include the
|
||||
[PostCSS SCSS Syntax].
|
||||
|
||||
In that example, `$font-size`, `$font-stack`, and `$primary-color` are replaced
|
||||
with their values.
|
||||
|
||||
```css
|
||||
body {
|
||||
font: 1.25em "Helvetica Neue", sans-serif;
|
||||
color: #333;
|
||||
}
|
||||
```
|
||||
|
||||
### @if and @else Rules
|
||||
|
||||
Conditionals like `@if` and `@else` let you use rules in a stylesheet if they
|
||||
evaluate true or false.
|
||||
|
||||
Conditionals are set by writing `@if` before the expression you want to
|
||||
evaluate. If the expression is true, then its contents are included in the
|
||||
stylesheet. If the expression is false, then its contents are not included, but
|
||||
the contents of an `@else` that follows it are included.
|
||||
|
||||
```scss
|
||||
$type: monster;
|
||||
|
||||
p {
|
||||
@if $type == ocean {
|
||||
color: blue;
|
||||
} @else {
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In that example, `$type === ocean` is false, so the `@if` contents are ignored
|
||||
and the `@else` contents are used.
|
||||
|
||||
```css
|
||||
p {
|
||||
color: black;
|
||||
}
|
||||
```
|
||||
|
||||
### @for and @each Rules
|
||||
|
||||
Iterators like `@for` and `@each` let you repeat content in a stylesheet.
|
||||
|
||||
A `@for` statement repeats by a numerical counter defined as a variable.
|
||||
|
||||
It can be written as `@for $counter from <start> through <end>` where
|
||||
`$counter` is the name of the iterating variable, `<start>` is the number to
|
||||
start with, and `<end>` is the number to finish with.
|
||||
|
||||
It can also be written as `@for $counter from <start> to <end>` where
|
||||
`$counter` is still the name of the counter variable, `<start>` is still the
|
||||
number to start with, but `<end>` is now the number to finish
|
||||
*before, but not include*.
|
||||
|
||||
When `<start>` is greater than `<end>`, the counter will decrement instead of
|
||||
increment.
|
||||
|
||||
Either form of `@for` can be written as
|
||||
`@for $var from <start> to <end> by <increment>` or
|
||||
`@for $var from <start> through <end> by <increment>`
|
||||
where `<incremement>` is the amount the counter variable will advance.
|
||||
|
||||
```scss
|
||||
@for $i from 1 through 5 by 2 {
|
||||
.width-#{$i} {
|
||||
width: #{$i}0em;
|
||||
}
|
||||
}
|
||||
|
||||
@for $j from 1 to 5 by 2 {
|
||||
.height-#{$j} {
|
||||
height: #{$j}0em;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In that example, `$i` is repeated from 1 through 5 by 2, which means it is
|
||||
repeated 3 times (1, 3, and 5). Meanwhile, `$j` is repeated from 1 to 5 by 2,
|
||||
which means it is repeated 2 times (1 and 3).
|
||||
|
||||
```css
|
||||
.width-1 {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
.width-3 {
|
||||
width: 30em;
|
||||
}
|
||||
|
||||
.width-5 {
|
||||
width: 50em;
|
||||
}
|
||||
|
||||
.height-1 {
|
||||
height: 10em;
|
||||
}
|
||||
|
||||
.height-3 {
|
||||
height: 30em;
|
||||
}
|
||||
```
|
||||
|
||||
An `@each` statement statement repeats through a list of values.
|
||||
|
||||
It can be written as `@each $item in $list` where `$item` is the
|
||||
name of the iterating variable and `$list` is the list of values being looped
|
||||
over.
|
||||
|
||||
```scss
|
||||
@each $animal in (puma, sea-slug, egret, salamander) {
|
||||
.#{$animal}-icon {
|
||||
background-image: url("images/icon-#{$animal}.svg");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In that example, a list of 4 animals is looped over to create 4 unique
|
||||
classnames.
|
||||
|
||||
```css
|
||||
.puma-icon {
|
||||
background-image: url("images/icon-puma.svg");
|
||||
}
|
||||
|
||||
.sea-slug-icon {
|
||||
background-image: url("images/icon-sea-slug.svg");
|
||||
}
|
||||
|
||||
.egret-icon {
|
||||
background-image: url("images/icon-egret.svg");
|
||||
}
|
||||
|
||||
.salamander-icon {
|
||||
background-image: url("images/icon-salamander.svg");
|
||||
}
|
||||
```
|
||||
|
||||
It can also be written as `@each $item $counter in $list` where `$item` is
|
||||
still the name of the iterating variable and `$list` is still the list of values
|
||||
being looped over, but now `$counter` is the numerical counter.
|
||||
|
||||
```scss
|
||||
@each $animal $i in (puma, sea-slug, egret, salamander) {
|
||||
.#{$animal}-icon {
|
||||
background-image: url("images/icon-#{$i}.svg");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
.puma-icon {
|
||||
background-image: url("images/icon-1.svg");
|
||||
}
|
||||
|
||||
.sea-slug-icon {
|
||||
background-image: url("images/icon-2.svg");
|
||||
}
|
||||
|
||||
.egret-icon {
|
||||
background-image: url("images/icon-3.svg");
|
||||
}
|
||||
|
||||
.salamander-icon {
|
||||
background-image: url("images/icon-4.svg");
|
||||
}
|
||||
```
|
||||
|
||||
In that example, a list of 4 animals is looped over to create 4 unique
|
||||
classnames.
|
||||
|
||||
### @mixin, @include, and @content rules
|
||||
|
||||
Mixins let you reuse rule in a stylesheet. A `@mixin` defines the content you
|
||||
want to reuse, while an `@include` rule includes it anywhere in your stylesheet.
|
||||
|
||||
Mixins are set by writing `@mixin` before the name of the mixin you define.
|
||||
This can be (optionally) followed by comma-separated variables you
|
||||
want to use inside of it. Mixins are then used anywhere by writing `@include`
|
||||
before the name of the mixin you are using. This is (again, optionally)
|
||||
followed by some comma-separated arguments you want to pass into the mixin as
|
||||
the (aforementioned) variables.
|
||||
|
||||
```scss
|
||||
@mixin heading-text {
|
||||
color: #242424;
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
@include heading-text;
|
||||
}
|
||||
|
||||
.some-heading-component > :first-child {
|
||||
@include heading-text;
|
||||
}
|
||||
```
|
||||
|
||||
In that example, `@include heading-text` is replaced with its contents.
|
||||
|
||||
```css
|
||||
h1, h2, h3 {
|
||||
color: #242424;
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
.some-heading-component > :first-child {
|
||||
color: #242424;
|
||||
font-size: 4em;
|
||||
}
|
||||
```
|
||||
|
||||
Remember, mixins can be followed by comma-separated variables you
|
||||
want to pass into the mixin as variables.
|
||||
|
||||
```scss
|
||||
@mixin heading-text($color: #242424, $font-size: 4em) {
|
||||
color: $color;
|
||||
font-size: $font-size;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
@include heading-text;
|
||||
}
|
||||
|
||||
.some-heading-component > :first-child {
|
||||
@include heading-text(#111111, 6em);
|
||||
}
|
||||
```
|
||||
|
||||
In that example, `@include heading-text` is replaced with its contents, but
|
||||
this time some of their contents are customized with variables.
|
||||
|
||||
```css
|
||||
h1, h2, h3 {
|
||||
color: #242424;
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
.some-heading-component > :first-child {
|
||||
color: #111111;
|
||||
font-size: 6em;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Options
|
||||
|
||||
### variables
|
||||
|
||||
The `variables` option defines global variables used when they cannot be
|
||||
resolved automatically.
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
variables: {
|
||||
'site-width': '960px'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
The `variables` option also accepts a function, which is given 2 arguments; the
|
||||
name of the unresolved variable, and the PostCSS node that used it.
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
variables(name, node) {
|
||||
if (name === 'site-width') {
|
||||
return '960px';
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
```scss
|
||||
.hero {
|
||||
max-width: $site-width;
|
||||
}
|
||||
|
||||
/* after */
|
||||
|
||||
.hero {
|
||||
max-width: 960px;
|
||||
}
|
||||
```
|
||||
|
||||
### unresolved
|
||||
|
||||
The `unresolved` option defines how unresolved variables, mixins, and imports
|
||||
should be handled. The available options are `throw`, `warn`, and `ignore`. The
|
||||
default option is to `throw`.
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
unresolved: 'ignore' // ignore unresolved variables
|
||||
});
|
||||
```
|
||||
|
||||
### disable
|
||||
|
||||
The `disable` option defines which features should be disabled in
|
||||
[PostCSS Advanced Variables].
|
||||
|
||||
The `disable` option can be a string or an array, and the features that can be
|
||||
disabled are `@content`, `@each`, `@else`, `@if`, `@include`, `@import`, `@for`,
|
||||
and `@mixin`.
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
disable: '@mixin, @include, @content' // ignore @mixin, @include, and @content at-rules
|
||||
});
|
||||
```
|
||||
|
||||
### Import Options
|
||||
|
||||
These options only apply to the `@import` at-rule.
|
||||
|
||||
#### importPaths
|
||||
|
||||
The `importPaths` option defines a path or multiple paths used to lookup
|
||||
files when they cannot be found automatically.
|
||||
|
||||
The `importPaths` option can be a string or an array.
|
||||
|
||||
By default, imports are resolved using the [Sass Import Resolve Specification].
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
importPaths: ['path/to/files', 'another/path/to/files']
|
||||
});
|
||||
```
|
||||
|
||||
#### importResolve
|
||||
|
||||
The `importResolve` option defines the file resolver used by imports. It is a
|
||||
function given 3 arguments; the url id, the current working directory, and the
|
||||
options processed by [PostCSS Advanced Variables].
|
||||
|
||||
The `importResolve` function should return a Promise with an object containing
|
||||
the full path (`file`) and the contents of the file (`contents`).
|
||||
|
||||
```js
|
||||
const resolve = require('custom-resolver');
|
||||
|
||||
require('postcss-advanced-variables')({
|
||||
// a resolver may work many ways, and this is just an example
|
||||
importResolve: (id, cwd, opts) => resolve({ id, cwd });
|
||||
});
|
||||
```
|
||||
|
||||
#### importFilter
|
||||
|
||||
The `importFilter` option determines whether an import will be inlined.
|
||||
|
||||
The value can be a function or an regular expression. When
|
||||
providing a function, it is called with a single string argument `id`
|
||||
and returns true when the import should be inlined. When providing a
|
||||
regular expression, if the `id` matches the expression, the import will
|
||||
be inlined.
|
||||
|
||||
By default, imports are ignored if they begin with a protocol or
|
||||
protocol-relative slashes (`//`).
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
importFilter: (id) => {
|
||||
return ['ignore', 'these', 'imports'].contains(id);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### importRoot
|
||||
|
||||
The `importRoot` option defines the root directory used by imports when the
|
||||
current directory cannot be detected. Its default value is `process.cwd()`.
|
||||
|
||||
```js
|
||||
require('postcss-advanced-variables')({
|
||||
importRoot: 'path/to/root'
|
||||
});
|
||||
```
|
||||
|
||||
#### importCache
|
||||
|
||||
The `importCache` option defines a cache made available to the options object
|
||||
that may be used by the [file resolver](#importResolve).
|
||||
|
||||
```js
|
||||
const sharedCache = {};
|
||||
|
||||
require('postcss-advanced-variables')({
|
||||
importCache: sharedCache
|
||||
});
|
||||
```
|
||||
|
||||
[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-advanced-variables.svg
|
||||
[cli-url]: https://travis-ci.org/jonathantneal/postcss-advanced-variables
|
||||
[git-img]: https://img.shields.io/badge/chat-gitter-blue.svg
|
||||
[git-url]: https://gitter.im/postcss/postcss
|
||||
[npm-img]: https://img.shields.io/npm/v/postcss-advanced-variables.svg
|
||||
[npm-url]: https://www.npmjs.com/package/postcss-advanced-variables
|
||||
|
||||
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
|
||||
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
[PostCSS Advanced Variables]: https://github.com/jonathantneal/postcss-advanced-variables
|
||||
[PostCSS SCSS Syntax]: https://github.com/postcss/postcss-scss
|
||||
[Sass Import Resolve Specification]: https://jonathantneal.github.io/sass-import-resolve/
|
||||
663
backend/frontend/node_modules/postcss-advanced-variables/index.js
generated
vendored
Normal file
663
backend/frontend/node_modules/postcss-advanced-variables/index.js
generated
vendored
Normal file
@@ -0,0 +1,663 @@
|
||||
'use strict';
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var path = _interopDefault(require('path'));
|
||||
var postcss = require('postcss');
|
||||
var postcss__default = _interopDefault(postcss);
|
||||
var resolve = _interopDefault(require('@csstools/sass-import-resolve'));
|
||||
|
||||
// return the closest variable from a node
|
||||
function getClosestVariable(name, node, opts) {
|
||||
const variables = getVariables(node);
|
||||
let variable = variables[name];
|
||||
|
||||
if (requiresAncestorVariable(variable, node)) {
|
||||
variable = getClosestVariable(name, node.parent, opts);
|
||||
}
|
||||
|
||||
if (requiresFnVariable(variable, opts)) {
|
||||
variable = getFnVariable(name, node, opts.variables);
|
||||
}
|
||||
|
||||
return variable;
|
||||
} // return the variables object of a node
|
||||
|
||||
const getVariables = node => Object(Object(node).variables); // return whether the variable should be replaced using an ancestor variable
|
||||
|
||||
|
||||
const requiresAncestorVariable = (variable, node) => undefined === variable && node && node.parent; // return whether variable should be replaced using a variables function
|
||||
|
||||
|
||||
const requiresFnVariable = (value, opts) => value === undefined && Object(opts).variables === Object(Object(opts).variables); // return whether variable should be replaced using a variables function
|
||||
|
||||
|
||||
const getFnVariable = (name, node, variables) => 'function' === typeof variables ? variables(name, node) : variables[name];
|
||||
|
||||
function manageUnresolved(node, opts, word, message) {
|
||||
if ('warn' === opts.unresolved) {
|
||||
node.warn(opts.result, message, {
|
||||
word
|
||||
});
|
||||
} else if ('ignore' !== opts.unresolved) {
|
||||
throw node.error(message, {
|
||||
word
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// tooling
|
||||
|
||||
function getReplacedString(string, node, opts) {
|
||||
const replacedString = string.replace(matchVariables, (match, before, name1, name2, name3) => {
|
||||
// conditionally return an (unescaped) match
|
||||
if (before === '\\') {
|
||||
return match.slice(1);
|
||||
} // the first matching variable name
|
||||
|
||||
|
||||
const name = name1 || name2 || name3; // the closest variable value
|
||||
|
||||
const value = getClosestVariable(name, node.parent, opts); // if a variable has not been resolved
|
||||
|
||||
if (undefined === value) {
|
||||
manageUnresolved(node, opts, name, `Could not resolve the variable "$${name}" within "${string}"`);
|
||||
return match;
|
||||
} // the stringified value
|
||||
|
||||
|
||||
const stringifiedValue = `${before}${stringify(value)}`;
|
||||
return stringifiedValue;
|
||||
});
|
||||
return replacedString;
|
||||
} // match all $name, $(name), and #{$name} variables (and catch the character before it)
|
||||
|
||||
const matchVariables = /(.?)(?:\$([A-z][\w-]*)|\$\(([A-z][\w-]*)\)|#\{\$([A-z][\w-]*)\})/g; // return a sass stringified variable
|
||||
|
||||
const stringify = object => Array.isArray(object) ? `(${object.map(stringify).join(',')})` : Object(object) === object ? `(${Object.keys(object).map(key => `${key}:${stringify(object[key])}`).join(',')})` : String(object);
|
||||
|
||||
// tooling
|
||||
|
||||
function setVariable(node, name, value, opts) {
|
||||
// if the value is not a default with a value already defined
|
||||
if (!matchDefault.test(value) || getClosestVariable(name, node, opts) === undefined) {
|
||||
// the value without a default suffix
|
||||
const undefaultedValue = matchDefault.test(value) ? value.replace(matchDefault, '') : value; // ensure the node has a variables object
|
||||
|
||||
node.variables = node.variables || {}; // set the variable
|
||||
|
||||
node.variables[name] = undefaultedValue;
|
||||
}
|
||||
} // match anything ending with a valid !default
|
||||
|
||||
const matchDefault = /\s+!default$/;
|
||||
|
||||
// tooling
|
||||
|
||||
function transformDecl(decl, opts) {
|
||||
// update the declaration value with its variables replaced by their corresponding values
|
||||
decl.value = getReplacedString(decl.value, decl, opts); // if the declaration is a variable declaration
|
||||
|
||||
if (isVariableDeclaration(decl)) {
|
||||
// set the variable on the parent of the declaration
|
||||
setVariable(decl.parent, decl.prop.slice(1), decl.value, opts); // remove the declaration
|
||||
|
||||
decl.remove();
|
||||
}
|
||||
} // return whether the declaration property is a variable declaration
|
||||
|
||||
const isVariableDeclaration = decl => matchVariable.test(decl.prop); // match a variable ($any-name)
|
||||
|
||||
|
||||
const matchVariable = /^\$[\w-]+$/;
|
||||
|
||||
// tooling
|
||||
|
||||
function transformAtrule(rule, opts) {
|
||||
// update the at-rule params with its variables replaced by their corresponding values
|
||||
rule.params = getReplacedString(rule.params, rule, opts);
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _toArray(arr) {
|
||||
return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
}
|
||||
|
||||
function _iterableToArray(iter) {
|
||||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
||||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
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"] != null) _i["return"]();
|
||||
} finally {
|
||||
if (_d) throw _e;
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function getValueAsObject(value) {
|
||||
const hasWrappingParens = matchWrappingParens.test(value);
|
||||
const unwrappedValue = String(hasWrappingParens ? value.replace(matchWrappingParens, '$1') : value).replace(matchTrailingComma, '');
|
||||
const separatedValue = postcss.list.comma(unwrappedValue);
|
||||
const firstValue = separatedValue[0];
|
||||
|
||||
if (firstValue === value) {
|
||||
return value;
|
||||
} else {
|
||||
const objectValue = {};
|
||||
const arrayValue = [];
|
||||
separatedValue.forEach((subvalue, index) => {
|
||||
const _ref = subvalue.match(matchDeclaration) || [],
|
||||
_ref2 = _slicedToArray(_ref, 3),
|
||||
match = _ref2[0],
|
||||
key = _ref2[1],
|
||||
keyvalue = _ref2[2];
|
||||
|
||||
if (match) {
|
||||
objectValue[key] = getValueAsObject(keyvalue);
|
||||
} else {
|
||||
arrayValue[index] = getValueAsObject(subvalue);
|
||||
}
|
||||
});
|
||||
const transformedValue = Object.keys(objectValue).length > 0 ? Object.assign(objectValue, arrayValue) : arrayValue;
|
||||
return transformedValue;
|
||||
}
|
||||
} // match wrapping parentheses ((), (anything), (anything (anything)))
|
||||
|
||||
const matchWrappingParens = /^\(([\W\w]*)\)$/g; // match a property name (any-possible_name)
|
||||
|
||||
const matchDeclaration = /^([\w-]+)\s*:\s*([\W\w]+)\s*$/; // match a trailing comma
|
||||
|
||||
const matchTrailingComma = /\s*,\s*$/;
|
||||
|
||||
var waterfall = ((items, asyncFunction) => items.reduce((lastPromise, item) => lastPromise.then(() => asyncFunction(item)), Promise.resolve()));
|
||||
|
||||
// tooling
|
||||
|
||||
function transformEachAtrule(rule, opts) {
|
||||
// if @each is supported
|
||||
if (opts.transform.indexOf('@each') !== -1) {
|
||||
// @each options
|
||||
const _getEachOpts = getEachOpts(rule, opts),
|
||||
varname = _getEachOpts.varname,
|
||||
incname = _getEachOpts.incname,
|
||||
list = _getEachOpts.list;
|
||||
|
||||
const replacements = [];
|
||||
const ruleClones = [];
|
||||
Object.keys(list).forEach(key => {
|
||||
// set the current variable
|
||||
setVariable(rule, varname, list[key], opts); // conditionally set the incremenator variable
|
||||
|
||||
if (incname) {
|
||||
setVariable(rule, incname, key, opts);
|
||||
} // clone the @each at-rule
|
||||
|
||||
|
||||
const clone = rule.clone({
|
||||
parent: rule.parent,
|
||||
variables: Object.assign({}, rule.variables)
|
||||
});
|
||||
ruleClones.push(clone);
|
||||
});
|
||||
return waterfall(ruleClones, clone => transformNode(clone, opts).then(() => {
|
||||
replacements.push(...clone.nodes);
|
||||
})).then(() => {
|
||||
// replace the @each at-rule with the replacements
|
||||
rule.parent.insertBefore(rule, replacements);
|
||||
rule.remove();
|
||||
});
|
||||
}
|
||||
} // return the @each statement options (@each NAME in LIST, @each NAME ITERATOR in LIST)
|
||||
|
||||
const getEachOpts = (node, opts) => {
|
||||
const params = node.params.split(matchInOperator);
|
||||
const args = (params[0] || '').trim().split(' ');
|
||||
const varname = args[0].trim().slice(1);
|
||||
const incname = args.length > 1 && args[1].trim().slice(1);
|
||||
const rawlist = getValueAsObject(getReplacedString(params.slice(1).join(matchInOperator), node, opts));
|
||||
const list = 'string' === typeof rawlist ? [rawlist] : rawlist;
|
||||
return {
|
||||
varname,
|
||||
incname,
|
||||
list
|
||||
};
|
||||
}; // match the opertor separating the name and iterator from the list
|
||||
|
||||
|
||||
const matchInOperator = ' in ';
|
||||
|
||||
// tooling
|
||||
|
||||
function transformIfAtrule(rule, opts) {
|
||||
// @if options
|
||||
const isTruthy = isIfTruthy(rule, opts);
|
||||
const next = rule.next();
|
||||
|
||||
const transformAndInsertBeforeParent = node => transformNode(node, opts).then(() => node.parent.insertBefore(node, node.nodes));
|
||||
|
||||
return ifPromise(opts.transform.indexOf('@if') !== -1, () => ifPromise(isTruthy, () => transformAndInsertBeforeParent(rule)).then(() => {
|
||||
rule.remove();
|
||||
})).then(() => ifPromise(opts.transform.indexOf('@else') !== -1 && isElseRule(next), () => ifPromise(!isTruthy, () => transformAndInsertBeforeParent(next)).then(() => {
|
||||
next.remove();
|
||||
})));
|
||||
}
|
||||
|
||||
const ifPromise = (condition, trueFunction) => Promise.resolve(condition && trueFunction()); // return whether the @if at-rule is truthy
|
||||
|
||||
|
||||
const isIfTruthy = (node, opts) => {
|
||||
// @if statement options (@if EXPRESSION, @if LEFT OPERATOR RIGHT)
|
||||
const params = postcss.list.space(node.params);
|
||||
const left = getInterprettedString(getReplacedString(params[0] || '', node, opts));
|
||||
const operator = params[1];
|
||||
const right = getInterprettedString(getReplacedString(params[2] || '', node, opts)); // evaluate the expression
|
||||
|
||||
const isTruthy = !operator && left || operator === '==' && left === right || operator === '!=' && left !== right || operator === '<' && left < right || operator === '<=' && left <= right || operator === '>' && left > right || operator === '>=' && left >= right;
|
||||
return isTruthy;
|
||||
}; // return the value as a boolean, number, or string
|
||||
|
||||
|
||||
const getInterprettedString = value => 'true' === value ? true : 'false' === value ? false : isNaN(value) ? value : Number(value); // return whether the node is an else at-rule
|
||||
|
||||
|
||||
const isElseRule = node => Object(node) === node && 'atrule' === node.type && 'else' === node.name;
|
||||
|
||||
function transformImportAtrule(rule, opts) {
|
||||
// if @import is supported
|
||||
if (opts.transform.indexOf('@import') !== -1) {
|
||||
// @import options
|
||||
const _getImportOpts = getImportOpts(rule, opts),
|
||||
id = _getImportOpts.id,
|
||||
media = _getImportOpts.media,
|
||||
cwf = _getImportOpts.cwf,
|
||||
cwd = _getImportOpts.cwd; // PostCSS options
|
||||
|
||||
|
||||
const options = opts.result.opts;
|
||||
const parser = options.parser || options.syntax && options.syntax.parse || null;
|
||||
|
||||
if (opts.importFilter instanceof Function && opts.importFilter(id, media) || opts.importFilter instanceof RegExp && opts.importFilter.test(id)) {
|
||||
const cwds = [cwd].concat(opts.importPaths); // promise the resolved file and its contents using the file resolver
|
||||
|
||||
const importPromise = cwds.reduce((promise, thiscwd) => promise.catch(() => opts.importResolve(id, thiscwd, opts)), Promise.reject());
|
||||
return importPromise.then( // promise the processed file
|
||||
({
|
||||
file,
|
||||
contents
|
||||
}) => processor.process(contents, {
|
||||
from: file,
|
||||
parser: parser
|
||||
}).then(({
|
||||
root
|
||||
}) => {
|
||||
// push a dependency message
|
||||
opts.result.messages.push({
|
||||
type: 'dependency',
|
||||
file: file,
|
||||
parent: cwf
|
||||
}); // imported nodes
|
||||
|
||||
const nodes = root.nodes.slice(0); // if media params were detected
|
||||
|
||||
if (media) {
|
||||
// create a new media rule
|
||||
const mediaRule = postcss__default.atRule({
|
||||
name: 'media',
|
||||
params: media,
|
||||
source: rule.source
|
||||
}); // append with the imported nodes
|
||||
|
||||
mediaRule.append(nodes); // replace the @import at-rule with the @media at-rule
|
||||
|
||||
rule.replaceWith(mediaRule);
|
||||
} else {
|
||||
// replace the @import at-rule with the imported nodes
|
||||
rule.replaceWith(nodes);
|
||||
} // transform all nodes from the import
|
||||
|
||||
|
||||
return transformNode({
|
||||
nodes
|
||||
}, opts);
|
||||
}), () => {
|
||||
// otherwise, if the @import could not be found
|
||||
manageUnresolved(rule, opts, '@import', `Could not resolve the @import for "${id}"`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const processor = postcss__default(); // return the @import statement options (@import ID, @import ID MEDIA)
|
||||
|
||||
const getImportOpts = (node, opts) => {
|
||||
const _list$space = postcss.list.space(node.params),
|
||||
_list$space2 = _toArray(_list$space),
|
||||
rawid = _list$space2[0],
|
||||
medias = _list$space2.slice(1);
|
||||
|
||||
const id = getReplacedString(trimWrappingURL(rawid), node, opts);
|
||||
const media = medias.join(' '); // current working file and directory
|
||||
|
||||
const cwf = node.source && node.source.input && node.source.input.file || opts.result.from;
|
||||
const cwd = cwf ? path.dirname(cwf) : opts.importRoot;
|
||||
return {
|
||||
id,
|
||||
media,
|
||||
cwf,
|
||||
cwd
|
||||
};
|
||||
}; // return a string with the wrapping url() and quotes trimmed
|
||||
|
||||
|
||||
const trimWrappingURL = string => trimWrappingQuotes(string.replace(/^url\(([\W\w]*)\)$/, '$1')); // return a string with the wrapping quotes trimmed
|
||||
|
||||
|
||||
const trimWrappingQuotes = string => string.replace(/^("|')([\W\w]*)\1$/, '$2');
|
||||
|
||||
function transformIncludeAtrule(rule, opts) {
|
||||
// if @include is supported
|
||||
if (opts.transform.indexOf('@include') !== -1) {
|
||||
// @include options
|
||||
const _getIncludeOpts = getIncludeOpts(rule),
|
||||
name = _getIncludeOpts.name,
|
||||
args = _getIncludeOpts.args; // the closest @mixin variable
|
||||
|
||||
|
||||
const mixin = getClosestVariable(`@mixin ${name}`, rule.parent, opts); // if the @mixin variable exists
|
||||
|
||||
if (mixin) {
|
||||
// set @mixin variables on the @include at-rule
|
||||
mixin.params.forEach((param, index) => {
|
||||
const arg = index in args ? getReplacedString(args[index], rule, opts) : param.value;
|
||||
setVariable(rule, param.name, arg, opts);
|
||||
}); // clone the @mixin at-rule
|
||||
|
||||
const clone = mixin.rule.clone({
|
||||
original: rule,
|
||||
parent: rule.parent,
|
||||
variables: rule.variables
|
||||
}); // transform the clone children
|
||||
|
||||
return transformNode(clone, opts).then(() => {
|
||||
// replace the @include at-rule with the clone children
|
||||
rule.parent.insertBefore(rule, clone.nodes);
|
||||
rule.remove();
|
||||
});
|
||||
} else {
|
||||
// otherwise, if the @mixin variable does not exist
|
||||
manageUnresolved(rule, opts, name, `Could not resolve the mixin for "${name}"`);
|
||||
}
|
||||
}
|
||||
} // return the @include statement options (@include NAME, @include NAME(ARGS))
|
||||
|
||||
const getIncludeOpts = node => {
|
||||
// @include name and args
|
||||
const _node$params$split = node.params.split(matchOpeningParen, 2),
|
||||
_node$params$split2 = _slicedToArray(_node$params$split, 2),
|
||||
name = _node$params$split2[0],
|
||||
sourceArgs = _node$params$split2[1];
|
||||
|
||||
const args = sourceArgs ? postcss.list.comma(sourceArgs.slice(0, -1)) : [];
|
||||
return {
|
||||
name,
|
||||
args
|
||||
};
|
||||
}; // match an opening parenthesis
|
||||
|
||||
|
||||
const matchOpeningParen = '(';
|
||||
|
||||
// tooling
|
||||
|
||||
function transformForAtrule(rule, opts) {
|
||||
// if @for is supported
|
||||
if (opts.transform.indexOf('@for') !== -1) {
|
||||
// @for options
|
||||
const _getForOpts = getForOpts(rule, opts),
|
||||
varname = _getForOpts.varname,
|
||||
start = _getForOpts.start,
|
||||
end = _getForOpts.end,
|
||||
increment = _getForOpts.increment;
|
||||
|
||||
const direction = start <= end ? 1 : -1;
|
||||
const replacements = [];
|
||||
const ruleClones = []; // for each iteration
|
||||
|
||||
for (let incrementor = start; incrementor * direction <= end * direction; incrementor += increment * direction) {
|
||||
// set the current variable
|
||||
setVariable(rule, varname, incrementor, opts); // clone the @for at-rule
|
||||
|
||||
const clone = rule.clone({
|
||||
parent: rule.parent,
|
||||
variables: Object.assign({}, rule.variables)
|
||||
});
|
||||
ruleClones.push(clone);
|
||||
}
|
||||
|
||||
return waterfall(ruleClones, clone => transformNode(clone, opts).then(() => {
|
||||
replacements.push(...clone.nodes);
|
||||
})).then(() => {
|
||||
// replace the @for at-rule with the replacements
|
||||
rule.parent.insertBefore(rule, replacements);
|
||||
rule.remove();
|
||||
});
|
||||
}
|
||||
} // return the @for statement options (@for NAME from START through END, @for NAME from START through END by INCREMENT)
|
||||
|
||||
const getForOpts = (node, opts) => {
|
||||
const params = postcss.list.space(node.params);
|
||||
const varname = params[0].trim().slice(1);
|
||||
const start = Number(getReplacedString(params[2], node, opts));
|
||||
const end = Number(getReplacedString(params[4], node, opts));
|
||||
const increment = 6 in params && Number(getReplacedString(params[6], node, opts)) || 1;
|
||||
return {
|
||||
varname,
|
||||
start,
|
||||
end,
|
||||
increment
|
||||
};
|
||||
};
|
||||
|
||||
function transformMixinAtrule(rule, opts) {
|
||||
// if @mixin is supported
|
||||
if (opts.transform.indexOf('@mixin') !== -1) {
|
||||
// @mixin options
|
||||
const _getMixinOpts = getMixinOpts(rule, opts),
|
||||
name = _getMixinOpts.name,
|
||||
params = _getMixinOpts.params; // set the mixin as a variable on the parent of the @mixin at-rule
|
||||
|
||||
|
||||
setVariable(rule.parent, `@mixin ${name}`, {
|
||||
params,
|
||||
rule
|
||||
}, opts); // remove the @mixin at-rule
|
||||
|
||||
rule.remove();
|
||||
}
|
||||
} // return the @mixin statement options (@mixin NAME, @mixin NAME(PARAMS))
|
||||
|
||||
const getMixinOpts = (node, opts) => {
|
||||
// @mixin name and default params ([{ name, value }, ...])
|
||||
const _node$params$split = node.params.split(matchOpeningParen$1, 2),
|
||||
_node$params$split2 = _slicedToArray(_node$params$split, 2),
|
||||
name = _node$params$split2[0],
|
||||
sourceParams = _node$params$split2[1];
|
||||
|
||||
const params = sourceParams && sourceParams.slice(0, -1).trim() ? postcss.list.comma(sourceParams.slice(0, -1).trim()).map(param => {
|
||||
const parts = postcss.list.split(param, ':');
|
||||
const paramName = parts[0].slice(1);
|
||||
const paramValue = parts.length > 1 ? getReplacedString(parts.slice(1).join(':'), node, opts) : undefined;
|
||||
return {
|
||||
name: paramName,
|
||||
value: paramValue
|
||||
};
|
||||
}) : [];
|
||||
return {
|
||||
name,
|
||||
params
|
||||
};
|
||||
}; // match an opening parenthesis
|
||||
|
||||
|
||||
const matchOpeningParen$1 = '(';
|
||||
|
||||
// tooling
|
||||
|
||||
function transformRule(rule, opts) {
|
||||
// update the rule selector with its variables replaced by their corresponding values
|
||||
rule.selector = getReplacedString(rule.selector, rule, opts);
|
||||
}
|
||||
|
||||
// tooling
|
||||
|
||||
function transformContentAtrule(rule, opts) {
|
||||
// if @content is supported
|
||||
if (opts.transform.indexOf('@content') !== -1) {
|
||||
// the closest @mixin at-rule
|
||||
const mixin = getClosestMixin(rule); // if the @mixin at-rule exists
|
||||
|
||||
if (mixin) {
|
||||
// clone the @mixin at-rule
|
||||
const clone = mixin.original.clone({
|
||||
parent: rule.parent,
|
||||
variables: rule.variables
|
||||
}); // transform the clone children
|
||||
|
||||
return transformNode(clone, opts).then(() => {
|
||||
// replace the @content at-rule with the clone children
|
||||
rule.parent.insertBefore(rule, clone.nodes);
|
||||
rule.remove();
|
||||
});
|
||||
} else {
|
||||
// otherwise, if the @mixin at-rule does not exist
|
||||
manageUnresolved(rule, opts, '@content', 'Could not resolve the mixin for @content');
|
||||
}
|
||||
}
|
||||
} // return the closest @mixin at-rule
|
||||
|
||||
const getClosestMixin = node => 'atrule' === node.type && 'mixin' === node.name ? node : node.parent && getClosestMixin(node.parent);
|
||||
|
||||
// tooling
|
||||
function transformNode(node, opts) {
|
||||
return waterfall(getNodesArray(node), child => transformRuleOrDecl(child, opts).then(() => {
|
||||
// conditionally walk the children of the attached child
|
||||
if (child.parent) {
|
||||
return transformNode(child, opts);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
function transformRuleOrDecl(child, opts) {
|
||||
return Promise.resolve().then(() => {
|
||||
const type = child.type;
|
||||
|
||||
if ('atrule' === type) {
|
||||
const name = child.name.toLowerCase();
|
||||
|
||||
if ('content' === name) {
|
||||
// transform @content at-rules
|
||||
return transformContentAtrule(child, opts);
|
||||
} else if ('each' === name) {
|
||||
// transform @each at-rules
|
||||
return transformEachAtrule(child, opts);
|
||||
} else if ('if' === name) {
|
||||
// transform @if at-rules
|
||||
return transformIfAtrule(child, opts);
|
||||
} else if ('import' === name) {
|
||||
return transformImportAtrule(child, opts);
|
||||
} else if ('include' === name) {
|
||||
// transform @include at-rules
|
||||
return transformIncludeAtrule(child, opts);
|
||||
} else if ('for' === name) {
|
||||
// transform @for at-rules
|
||||
return transformForAtrule(child, opts);
|
||||
} else if ('mixin' === name) {
|
||||
// transform mixin at-rules
|
||||
return transformMixinAtrule(child, opts);
|
||||
} else {
|
||||
// transform all other at-rules
|
||||
return transformAtrule(child, opts);
|
||||
}
|
||||
} else if ('decl' === type) {
|
||||
// transform declarations
|
||||
return transformDecl(child, opts);
|
||||
} else if ('rule' === type) {
|
||||
// transform rule
|
||||
return transformRule(child, opts);
|
||||
}
|
||||
});
|
||||
} // return the children of a node as an array
|
||||
|
||||
|
||||
const getNodesArray = node => Array.from(Object(node).nodes || []);
|
||||
|
||||
// tooling
|
||||
|
||||
var index = postcss__default.plugin('postcss-advanced-variables', opts => (root, result) => {
|
||||
// process options
|
||||
const transformOpt = ['@content', '@each', '@else', '@if', '@include', '@import', '@for', '@mixin'].filter(feature => !(String(Object(opts).disable || '').split(/\s*,\s*|\s+,?\s*|\s,?\s+/).indexOf(feature) !== -1));
|
||||
const unresolvedOpt = String(Object(opts).unresolved || 'throw').toLowerCase();
|
||||
const variablesOpt = Object(opts).variables;
|
||||
const importCache = Object(Object(opts).importCache);
|
||||
|
||||
const importFilter = Object(opts).importFilter || (id => {
|
||||
return !matchProtocol.test(id);
|
||||
});
|
||||
|
||||
const importPaths = [].concat(Object(opts).importPaths || []);
|
||||
|
||||
const importResolve = Object(opts).importResolve || ((id, cwd) => resolve(id, {
|
||||
cwd,
|
||||
readFile: true,
|
||||
cache: importCache
|
||||
}));
|
||||
|
||||
const importRoot = Object(opts).importRoot || process.cwd();
|
||||
return transformNode(root, {
|
||||
result,
|
||||
importCache,
|
||||
importFilter,
|
||||
importPaths,
|
||||
importResolve,
|
||||
importRoot,
|
||||
transform: transformOpt,
|
||||
unresolved: unresolvedOpt,
|
||||
variables: variablesOpt
|
||||
});
|
||||
});
|
||||
const matchProtocol = /^(?:[A-z]+:)?\/\//;
|
||||
|
||||
module.exports = index;
|
||||
658
backend/frontend/node_modules/postcss-advanced-variables/index.mjs
generated
vendored
Normal file
658
backend/frontend/node_modules/postcss-advanced-variables/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,658 @@
|
||||
import path from 'path';
|
||||
import postcss, { list } from 'postcss';
|
||||
import resolve from '@csstools/sass-import-resolve';
|
||||
|
||||
// return the closest variable from a node
|
||||
function getClosestVariable(name, node, opts) {
|
||||
const variables = getVariables(node);
|
||||
let variable = variables[name];
|
||||
|
||||
if (requiresAncestorVariable(variable, node)) {
|
||||
variable = getClosestVariable(name, node.parent, opts);
|
||||
}
|
||||
|
||||
if (requiresFnVariable(variable, opts)) {
|
||||
variable = getFnVariable(name, node, opts.variables);
|
||||
}
|
||||
|
||||
return variable;
|
||||
} // return the variables object of a node
|
||||
|
||||
const getVariables = node => Object(Object(node).variables); // return whether the variable should be replaced using an ancestor variable
|
||||
|
||||
|
||||
const requiresAncestorVariable = (variable, node) => undefined === variable && node && node.parent; // return whether variable should be replaced using a variables function
|
||||
|
||||
|
||||
const requiresFnVariable = (value, opts) => value === undefined && Object(opts).variables === Object(Object(opts).variables); // return whether variable should be replaced using a variables function
|
||||
|
||||
|
||||
const getFnVariable = (name, node, variables) => 'function' === typeof variables ? variables(name, node) : variables[name];
|
||||
|
||||
function manageUnresolved(node, opts, word, message) {
|
||||
if ('warn' === opts.unresolved) {
|
||||
node.warn(opts.result, message, {
|
||||
word
|
||||
});
|
||||
} else if ('ignore' !== opts.unresolved) {
|
||||
throw node.error(message, {
|
||||
word
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// tooling
|
||||
|
||||
function getReplacedString(string, node, opts) {
|
||||
const replacedString = string.replace(matchVariables, (match, before, name1, name2, name3) => {
|
||||
// conditionally return an (unescaped) match
|
||||
if (before === '\\') {
|
||||
return match.slice(1);
|
||||
} // the first matching variable name
|
||||
|
||||
|
||||
const name = name1 || name2 || name3; // the closest variable value
|
||||
|
||||
const value = getClosestVariable(name, node.parent, opts); // if a variable has not been resolved
|
||||
|
||||
if (undefined === value) {
|
||||
manageUnresolved(node, opts, name, `Could not resolve the variable "$${name}" within "${string}"`);
|
||||
return match;
|
||||
} // the stringified value
|
||||
|
||||
|
||||
const stringifiedValue = `${before}${stringify(value)}`;
|
||||
return stringifiedValue;
|
||||
});
|
||||
return replacedString;
|
||||
} // match all $name, $(name), and #{$name} variables (and catch the character before it)
|
||||
|
||||
const matchVariables = /(.?)(?:\$([A-z][\w-]*)|\$\(([A-z][\w-]*)\)|#\{\$([A-z][\w-]*)\})/g; // return a sass stringified variable
|
||||
|
||||
const stringify = object => Array.isArray(object) ? `(${object.map(stringify).join(',')})` : Object(object) === object ? `(${Object.keys(object).map(key => `${key}:${stringify(object[key])}`).join(',')})` : String(object);
|
||||
|
||||
// tooling
|
||||
|
||||
function setVariable(node, name, value, opts) {
|
||||
// if the value is not a default with a value already defined
|
||||
if (!matchDefault.test(value) || getClosestVariable(name, node, opts) === undefined) {
|
||||
// the value without a default suffix
|
||||
const undefaultedValue = matchDefault.test(value) ? value.replace(matchDefault, '') : value; // ensure the node has a variables object
|
||||
|
||||
node.variables = node.variables || {}; // set the variable
|
||||
|
||||
node.variables[name] = undefaultedValue;
|
||||
}
|
||||
} // match anything ending with a valid !default
|
||||
|
||||
const matchDefault = /\s+!default$/;
|
||||
|
||||
// tooling
|
||||
|
||||
function transformDecl(decl, opts) {
|
||||
// update the declaration value with its variables replaced by their corresponding values
|
||||
decl.value = getReplacedString(decl.value, decl, opts); // if the declaration is a variable declaration
|
||||
|
||||
if (isVariableDeclaration(decl)) {
|
||||
// set the variable on the parent of the declaration
|
||||
setVariable(decl.parent, decl.prop.slice(1), decl.value, opts); // remove the declaration
|
||||
|
||||
decl.remove();
|
||||
}
|
||||
} // return whether the declaration property is a variable declaration
|
||||
|
||||
const isVariableDeclaration = decl => matchVariable.test(decl.prop); // match a variable ($any-name)
|
||||
|
||||
|
||||
const matchVariable = /^\$[\w-]+$/;
|
||||
|
||||
// tooling
|
||||
|
||||
function transformAtrule(rule, opts) {
|
||||
// update the at-rule params with its variables replaced by their corresponding values
|
||||
rule.params = getReplacedString(rule.params, rule, opts);
|
||||
}
|
||||
|
||||
function _slicedToArray(arr, i) {
|
||||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _toArray(arr) {
|
||||
return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
|
||||
}
|
||||
|
||||
function _arrayWithHoles(arr) {
|
||||
if (Array.isArray(arr)) return arr;
|
||||
}
|
||||
|
||||
function _iterableToArray(iter) {
|
||||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
||||
}
|
||||
|
||||
function _iterableToArrayLimit(arr, i) {
|
||||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
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"] != null) _i["return"]();
|
||||
} finally {
|
||||
if (_d) throw _e;
|
||||
}
|
||||
}
|
||||
|
||||
return _arr;
|
||||
}
|
||||
|
||||
function _nonIterableRest() {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
}
|
||||
|
||||
function getValueAsObject(value) {
|
||||
const hasWrappingParens = matchWrappingParens.test(value);
|
||||
const unwrappedValue = String(hasWrappingParens ? value.replace(matchWrappingParens, '$1') : value).replace(matchTrailingComma, '');
|
||||
const separatedValue = list.comma(unwrappedValue);
|
||||
const firstValue = separatedValue[0];
|
||||
|
||||
if (firstValue === value) {
|
||||
return value;
|
||||
} else {
|
||||
const objectValue = {};
|
||||
const arrayValue = [];
|
||||
separatedValue.forEach((subvalue, index) => {
|
||||
const _ref = subvalue.match(matchDeclaration) || [],
|
||||
_ref2 = _slicedToArray(_ref, 3),
|
||||
match = _ref2[0],
|
||||
key = _ref2[1],
|
||||
keyvalue = _ref2[2];
|
||||
|
||||
if (match) {
|
||||
objectValue[key] = getValueAsObject(keyvalue);
|
||||
} else {
|
||||
arrayValue[index] = getValueAsObject(subvalue);
|
||||
}
|
||||
});
|
||||
const transformedValue = Object.keys(objectValue).length > 0 ? Object.assign(objectValue, arrayValue) : arrayValue;
|
||||
return transformedValue;
|
||||
}
|
||||
} // match wrapping parentheses ((), (anything), (anything (anything)))
|
||||
|
||||
const matchWrappingParens = /^\(([\W\w]*)\)$/g; // match a property name (any-possible_name)
|
||||
|
||||
const matchDeclaration = /^([\w-]+)\s*:\s*([\W\w]+)\s*$/; // match a trailing comma
|
||||
|
||||
const matchTrailingComma = /\s*,\s*$/;
|
||||
|
||||
var waterfall = ((items, asyncFunction) => items.reduce((lastPromise, item) => lastPromise.then(() => asyncFunction(item)), Promise.resolve()));
|
||||
|
||||
// tooling
|
||||
|
||||
function transformEachAtrule(rule, opts) {
|
||||
// if @each is supported
|
||||
if (opts.transform.indexOf('@each') !== -1) {
|
||||
// @each options
|
||||
const _getEachOpts = getEachOpts(rule, opts),
|
||||
varname = _getEachOpts.varname,
|
||||
incname = _getEachOpts.incname,
|
||||
list$$1 = _getEachOpts.list;
|
||||
|
||||
const replacements = [];
|
||||
const ruleClones = [];
|
||||
Object.keys(list$$1).forEach(key => {
|
||||
// set the current variable
|
||||
setVariable(rule, varname, list$$1[key], opts); // conditionally set the incremenator variable
|
||||
|
||||
if (incname) {
|
||||
setVariable(rule, incname, key, opts);
|
||||
} // clone the @each at-rule
|
||||
|
||||
|
||||
const clone = rule.clone({
|
||||
parent: rule.parent,
|
||||
variables: Object.assign({}, rule.variables)
|
||||
});
|
||||
ruleClones.push(clone);
|
||||
});
|
||||
return waterfall(ruleClones, clone => transformNode(clone, opts).then(() => {
|
||||
replacements.push(...clone.nodes);
|
||||
})).then(() => {
|
||||
// replace the @each at-rule with the replacements
|
||||
rule.parent.insertBefore(rule, replacements);
|
||||
rule.remove();
|
||||
});
|
||||
}
|
||||
} // return the @each statement options (@each NAME in LIST, @each NAME ITERATOR in LIST)
|
||||
|
||||
const getEachOpts = (node, opts) => {
|
||||
const params = node.params.split(matchInOperator);
|
||||
const args = (params[0] || '').trim().split(' ');
|
||||
const varname = args[0].trim().slice(1);
|
||||
const incname = args.length > 1 && args[1].trim().slice(1);
|
||||
const rawlist = getValueAsObject(getReplacedString(params.slice(1).join(matchInOperator), node, opts));
|
||||
const list$$1 = 'string' === typeof rawlist ? [rawlist] : rawlist;
|
||||
return {
|
||||
varname,
|
||||
incname,
|
||||
list: list$$1
|
||||
};
|
||||
}; // match the opertor separating the name and iterator from the list
|
||||
|
||||
|
||||
const matchInOperator = ' in ';
|
||||
|
||||
// tooling
|
||||
|
||||
function transformIfAtrule(rule, opts) {
|
||||
// @if options
|
||||
const isTruthy = isIfTruthy(rule, opts);
|
||||
const next = rule.next();
|
||||
|
||||
const transformAndInsertBeforeParent = node => transformNode(node, opts).then(() => node.parent.insertBefore(node, node.nodes));
|
||||
|
||||
return ifPromise(opts.transform.indexOf('@if') !== -1, () => ifPromise(isTruthy, () => transformAndInsertBeforeParent(rule)).then(() => {
|
||||
rule.remove();
|
||||
})).then(() => ifPromise(opts.transform.indexOf('@else') !== -1 && isElseRule(next), () => ifPromise(!isTruthy, () => transformAndInsertBeforeParent(next)).then(() => {
|
||||
next.remove();
|
||||
})));
|
||||
}
|
||||
|
||||
const ifPromise = (condition, trueFunction) => Promise.resolve(condition && trueFunction()); // return whether the @if at-rule is truthy
|
||||
|
||||
|
||||
const isIfTruthy = (node, opts) => {
|
||||
// @if statement options (@if EXPRESSION, @if LEFT OPERATOR RIGHT)
|
||||
const params = list.space(node.params);
|
||||
const left = getInterprettedString(getReplacedString(params[0] || '', node, opts));
|
||||
const operator = params[1];
|
||||
const right = getInterprettedString(getReplacedString(params[2] || '', node, opts)); // evaluate the expression
|
||||
|
||||
const isTruthy = !operator && left || operator === '==' && left === right || operator === '!=' && left !== right || operator === '<' && left < right || operator === '<=' && left <= right || operator === '>' && left > right || operator === '>=' && left >= right;
|
||||
return isTruthy;
|
||||
}; // return the value as a boolean, number, or string
|
||||
|
||||
|
||||
const getInterprettedString = value => 'true' === value ? true : 'false' === value ? false : isNaN(value) ? value : Number(value); // return whether the node is an else at-rule
|
||||
|
||||
|
||||
const isElseRule = node => Object(node) === node && 'atrule' === node.type && 'else' === node.name;
|
||||
|
||||
function transformImportAtrule(rule, opts) {
|
||||
// if @import is supported
|
||||
if (opts.transform.indexOf('@import') !== -1) {
|
||||
// @import options
|
||||
const _getImportOpts = getImportOpts(rule, opts),
|
||||
id = _getImportOpts.id,
|
||||
media = _getImportOpts.media,
|
||||
cwf = _getImportOpts.cwf,
|
||||
cwd = _getImportOpts.cwd; // PostCSS options
|
||||
|
||||
|
||||
const options = opts.result.opts;
|
||||
const parser = options.parser || options.syntax && options.syntax.parse || null;
|
||||
|
||||
if (opts.importFilter instanceof Function && opts.importFilter(id, media) || opts.importFilter instanceof RegExp && opts.importFilter.test(id)) {
|
||||
const cwds = [cwd].concat(opts.importPaths); // promise the resolved file and its contents using the file resolver
|
||||
|
||||
const importPromise = cwds.reduce((promise, thiscwd) => promise.catch(() => opts.importResolve(id, thiscwd, opts)), Promise.reject());
|
||||
return importPromise.then( // promise the processed file
|
||||
({
|
||||
file,
|
||||
contents
|
||||
}) => processor.process(contents, {
|
||||
from: file,
|
||||
parser: parser
|
||||
}).then(({
|
||||
root
|
||||
}) => {
|
||||
// push a dependency message
|
||||
opts.result.messages.push({
|
||||
type: 'dependency',
|
||||
file: file,
|
||||
parent: cwf
|
||||
}); // imported nodes
|
||||
|
||||
const nodes = root.nodes.slice(0); // if media params were detected
|
||||
|
||||
if (media) {
|
||||
// create a new media rule
|
||||
const mediaRule = postcss.atRule({
|
||||
name: 'media',
|
||||
params: media,
|
||||
source: rule.source
|
||||
}); // append with the imported nodes
|
||||
|
||||
mediaRule.append(nodes); // replace the @import at-rule with the @media at-rule
|
||||
|
||||
rule.replaceWith(mediaRule);
|
||||
} else {
|
||||
// replace the @import at-rule with the imported nodes
|
||||
rule.replaceWith(nodes);
|
||||
} // transform all nodes from the import
|
||||
|
||||
|
||||
return transformNode({
|
||||
nodes
|
||||
}, opts);
|
||||
}), () => {
|
||||
// otherwise, if the @import could not be found
|
||||
manageUnresolved(rule, opts, '@import', `Could not resolve the @import for "${id}"`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const processor = postcss(); // return the @import statement options (@import ID, @import ID MEDIA)
|
||||
|
||||
const getImportOpts = (node, opts) => {
|
||||
const _list$space = list.space(node.params),
|
||||
_list$space2 = _toArray(_list$space),
|
||||
rawid = _list$space2[0],
|
||||
medias = _list$space2.slice(1);
|
||||
|
||||
const id = getReplacedString(trimWrappingURL(rawid), node, opts);
|
||||
const media = medias.join(' '); // current working file and directory
|
||||
|
||||
const cwf = node.source && node.source.input && node.source.input.file || opts.result.from;
|
||||
const cwd = cwf ? path.dirname(cwf) : opts.importRoot;
|
||||
return {
|
||||
id,
|
||||
media,
|
||||
cwf,
|
||||
cwd
|
||||
};
|
||||
}; // return a string with the wrapping url() and quotes trimmed
|
||||
|
||||
|
||||
const trimWrappingURL = string => trimWrappingQuotes(string.replace(/^url\(([\W\w]*)\)$/, '$1')); // return a string with the wrapping quotes trimmed
|
||||
|
||||
|
||||
const trimWrappingQuotes = string => string.replace(/^("|')([\W\w]*)\1$/, '$2');
|
||||
|
||||
function transformIncludeAtrule(rule, opts) {
|
||||
// if @include is supported
|
||||
if (opts.transform.indexOf('@include') !== -1) {
|
||||
// @include options
|
||||
const _getIncludeOpts = getIncludeOpts(rule),
|
||||
name = _getIncludeOpts.name,
|
||||
args = _getIncludeOpts.args; // the closest @mixin variable
|
||||
|
||||
|
||||
const mixin = getClosestVariable(`@mixin ${name}`, rule.parent, opts); // if the @mixin variable exists
|
||||
|
||||
if (mixin) {
|
||||
// set @mixin variables on the @include at-rule
|
||||
mixin.params.forEach((param, index) => {
|
||||
const arg = index in args ? getReplacedString(args[index], rule, opts) : param.value;
|
||||
setVariable(rule, param.name, arg, opts);
|
||||
}); // clone the @mixin at-rule
|
||||
|
||||
const clone = mixin.rule.clone({
|
||||
original: rule,
|
||||
parent: rule.parent,
|
||||
variables: rule.variables
|
||||
}); // transform the clone children
|
||||
|
||||
return transformNode(clone, opts).then(() => {
|
||||
// replace the @include at-rule with the clone children
|
||||
rule.parent.insertBefore(rule, clone.nodes);
|
||||
rule.remove();
|
||||
});
|
||||
} else {
|
||||
// otherwise, if the @mixin variable does not exist
|
||||
manageUnresolved(rule, opts, name, `Could not resolve the mixin for "${name}"`);
|
||||
}
|
||||
}
|
||||
} // return the @include statement options (@include NAME, @include NAME(ARGS))
|
||||
|
||||
const getIncludeOpts = node => {
|
||||
// @include name and args
|
||||
const _node$params$split = node.params.split(matchOpeningParen, 2),
|
||||
_node$params$split2 = _slicedToArray(_node$params$split, 2),
|
||||
name = _node$params$split2[0],
|
||||
sourceArgs = _node$params$split2[1];
|
||||
|
||||
const args = sourceArgs ? list.comma(sourceArgs.slice(0, -1)) : [];
|
||||
return {
|
||||
name,
|
||||
args
|
||||
};
|
||||
}; // match an opening parenthesis
|
||||
|
||||
|
||||
const matchOpeningParen = '(';
|
||||
|
||||
// tooling
|
||||
|
||||
function transformForAtrule(rule, opts) {
|
||||
// if @for is supported
|
||||
if (opts.transform.indexOf('@for') !== -1) {
|
||||
// @for options
|
||||
const _getForOpts = getForOpts(rule, opts),
|
||||
varname = _getForOpts.varname,
|
||||
start = _getForOpts.start,
|
||||
end = _getForOpts.end,
|
||||
increment = _getForOpts.increment;
|
||||
|
||||
const direction = start <= end ? 1 : -1;
|
||||
const replacements = [];
|
||||
const ruleClones = []; // for each iteration
|
||||
|
||||
for (let incrementor = start; incrementor * direction <= end * direction; incrementor += increment * direction) {
|
||||
// set the current variable
|
||||
setVariable(rule, varname, incrementor, opts); // clone the @for at-rule
|
||||
|
||||
const clone = rule.clone({
|
||||
parent: rule.parent,
|
||||
variables: Object.assign({}, rule.variables)
|
||||
});
|
||||
ruleClones.push(clone);
|
||||
}
|
||||
|
||||
return waterfall(ruleClones, clone => transformNode(clone, opts).then(() => {
|
||||
replacements.push(...clone.nodes);
|
||||
})).then(() => {
|
||||
// replace the @for at-rule with the replacements
|
||||
rule.parent.insertBefore(rule, replacements);
|
||||
rule.remove();
|
||||
});
|
||||
}
|
||||
} // return the @for statement options (@for NAME from START through END, @for NAME from START through END by INCREMENT)
|
||||
|
||||
const getForOpts = (node, opts) => {
|
||||
const params = list.space(node.params);
|
||||
const varname = params[0].trim().slice(1);
|
||||
const start = Number(getReplacedString(params[2], node, opts));
|
||||
const end = Number(getReplacedString(params[4], node, opts));
|
||||
const increment = 6 in params && Number(getReplacedString(params[6], node, opts)) || 1;
|
||||
return {
|
||||
varname,
|
||||
start,
|
||||
end,
|
||||
increment
|
||||
};
|
||||
};
|
||||
|
||||
function transformMixinAtrule(rule, opts) {
|
||||
// if @mixin is supported
|
||||
if (opts.transform.indexOf('@mixin') !== -1) {
|
||||
// @mixin options
|
||||
const _getMixinOpts = getMixinOpts(rule, opts),
|
||||
name = _getMixinOpts.name,
|
||||
params = _getMixinOpts.params; // set the mixin as a variable on the parent of the @mixin at-rule
|
||||
|
||||
|
||||
setVariable(rule.parent, `@mixin ${name}`, {
|
||||
params,
|
||||
rule
|
||||
}, opts); // remove the @mixin at-rule
|
||||
|
||||
rule.remove();
|
||||
}
|
||||
} // return the @mixin statement options (@mixin NAME, @mixin NAME(PARAMS))
|
||||
|
||||
const getMixinOpts = (node, opts) => {
|
||||
// @mixin name and default params ([{ name, value }, ...])
|
||||
const _node$params$split = node.params.split(matchOpeningParen$1, 2),
|
||||
_node$params$split2 = _slicedToArray(_node$params$split, 2),
|
||||
name = _node$params$split2[0],
|
||||
sourceParams = _node$params$split2[1];
|
||||
|
||||
const params = sourceParams && sourceParams.slice(0, -1).trim() ? list.comma(sourceParams.slice(0, -1).trim()).map(param => {
|
||||
const parts = list.split(param, ':');
|
||||
const paramName = parts[0].slice(1);
|
||||
const paramValue = parts.length > 1 ? getReplacedString(parts.slice(1).join(':'), node, opts) : undefined;
|
||||
return {
|
||||
name: paramName,
|
||||
value: paramValue
|
||||
};
|
||||
}) : [];
|
||||
return {
|
||||
name,
|
||||
params
|
||||
};
|
||||
}; // match an opening parenthesis
|
||||
|
||||
|
||||
const matchOpeningParen$1 = '(';
|
||||
|
||||
// tooling
|
||||
|
||||
function transformRule(rule, opts) {
|
||||
// update the rule selector with its variables replaced by their corresponding values
|
||||
rule.selector = getReplacedString(rule.selector, rule, opts);
|
||||
}
|
||||
|
||||
// tooling
|
||||
|
||||
function transformContentAtrule(rule, opts) {
|
||||
// if @content is supported
|
||||
if (opts.transform.indexOf('@content') !== -1) {
|
||||
// the closest @mixin at-rule
|
||||
const mixin = getClosestMixin(rule); // if the @mixin at-rule exists
|
||||
|
||||
if (mixin) {
|
||||
// clone the @mixin at-rule
|
||||
const clone = mixin.original.clone({
|
||||
parent: rule.parent,
|
||||
variables: rule.variables
|
||||
}); // transform the clone children
|
||||
|
||||
return transformNode(clone, opts).then(() => {
|
||||
// replace the @content at-rule with the clone children
|
||||
rule.parent.insertBefore(rule, clone.nodes);
|
||||
rule.remove();
|
||||
});
|
||||
} else {
|
||||
// otherwise, if the @mixin at-rule does not exist
|
||||
manageUnresolved(rule, opts, '@content', 'Could not resolve the mixin for @content');
|
||||
}
|
||||
}
|
||||
} // return the closest @mixin at-rule
|
||||
|
||||
const getClosestMixin = node => 'atrule' === node.type && 'mixin' === node.name ? node : node.parent && getClosestMixin(node.parent);
|
||||
|
||||
// tooling
|
||||
function transformNode(node, opts) {
|
||||
return waterfall(getNodesArray(node), child => transformRuleOrDecl(child, opts).then(() => {
|
||||
// conditionally walk the children of the attached child
|
||||
if (child.parent) {
|
||||
return transformNode(child, opts);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
function transformRuleOrDecl(child, opts) {
|
||||
return Promise.resolve().then(() => {
|
||||
const type = child.type;
|
||||
|
||||
if ('atrule' === type) {
|
||||
const name = child.name.toLowerCase();
|
||||
|
||||
if ('content' === name) {
|
||||
// transform @content at-rules
|
||||
return transformContentAtrule(child, opts);
|
||||
} else if ('each' === name) {
|
||||
// transform @each at-rules
|
||||
return transformEachAtrule(child, opts);
|
||||
} else if ('if' === name) {
|
||||
// transform @if at-rules
|
||||
return transformIfAtrule(child, opts);
|
||||
} else if ('import' === name) {
|
||||
return transformImportAtrule(child, opts);
|
||||
} else if ('include' === name) {
|
||||
// transform @include at-rules
|
||||
return transformIncludeAtrule(child, opts);
|
||||
} else if ('for' === name) {
|
||||
// transform @for at-rules
|
||||
return transformForAtrule(child, opts);
|
||||
} else if ('mixin' === name) {
|
||||
// transform mixin at-rules
|
||||
return transformMixinAtrule(child, opts);
|
||||
} else {
|
||||
// transform all other at-rules
|
||||
return transformAtrule(child, opts);
|
||||
}
|
||||
} else if ('decl' === type) {
|
||||
// transform declarations
|
||||
return transformDecl(child, opts);
|
||||
} else if ('rule' === type) {
|
||||
// transform rule
|
||||
return transformRule(child, opts);
|
||||
}
|
||||
});
|
||||
} // return the children of a node as an array
|
||||
|
||||
|
||||
const getNodesArray = node => Array.from(Object(node).nodes || []);
|
||||
|
||||
// tooling
|
||||
|
||||
var index = postcss.plugin('postcss-advanced-variables', opts => (root, result) => {
|
||||
// process options
|
||||
const transformOpt = ['@content', '@each', '@else', '@if', '@include', '@import', '@for', '@mixin'].filter(feature => !(String(Object(opts).disable || '').split(/\s*,\s*|\s+,?\s*|\s,?\s+/).indexOf(feature) !== -1));
|
||||
const unresolvedOpt = String(Object(opts).unresolved || 'throw').toLowerCase();
|
||||
const variablesOpt = Object(opts).variables;
|
||||
const importCache = Object(Object(opts).importCache);
|
||||
|
||||
const importFilter = Object(opts).importFilter || (id => {
|
||||
return !matchProtocol.test(id);
|
||||
});
|
||||
|
||||
const importPaths = [].concat(Object(opts).importPaths || []);
|
||||
|
||||
const importResolve = Object(opts).importResolve || ((id, cwd) => resolve(id, {
|
||||
cwd,
|
||||
readFile: true,
|
||||
cache: importCache
|
||||
}));
|
||||
|
||||
const importRoot = Object(opts).importRoot || process.cwd();
|
||||
return transformNode(root, {
|
||||
result,
|
||||
importCache,
|
||||
importFilter,
|
||||
importPaths,
|
||||
importResolve,
|
||||
importRoot,
|
||||
transform: transformOpt,
|
||||
unresolved: unresolvedOpt,
|
||||
variables: variablesOpt
|
||||
});
|
||||
});
|
||||
const matchProtocol = /^(?:[A-z]+:)?\/\//;
|
||||
|
||||
export default index;
|
||||
15
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/LICENSE
generated
vendored
Normal file
15
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
|
||||
|
||||
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.
|
||||
23
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/README.md
generated
vendored
Normal file
23
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/README.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# picocolors
|
||||
|
||||
npm install picocolors
|
||||
|
||||
A tinier and faster alternative to [nanocolors](https://github.com/ai/nanocolors). Andrey, are you even trying?
|
||||
|
||||
```javascript
|
||||
import pc from "picocolors";
|
||||
|
||||
console.log(pc.green(`How are ${pc.italic(`you`)} doing?`));
|
||||
```
|
||||
|
||||
- Up to [2x faster and 2x smaller](#benchmarks) than alternatives
|
||||
- 3x faster and 10x smaller than `chalk`
|
||||
- [TypeScript](https://www.typescriptlang.org/) support
|
||||
- [`NO_COLOR`](https://no-color.org/) friendly
|
||||
- Node.js v6+ & browsers support
|
||||
- The same API, but faster, much faster
|
||||
- No `String.prototype` modifications (anyone still doing it?)
|
||||
- No dependencies and the smallest `node_modules` footprint
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub.
|
||||
25
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/package.json
generated
vendored
Normal file
25
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/package.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "picocolors",
|
||||
"version": "0.2.1",
|
||||
"main": "./picocolors.js",
|
||||
"types": "./picocolors.d.ts",
|
||||
"browser": {
|
||||
"./picocolors.js": "./picocolors.browser.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"description": "The tiniest and the fastest coloring library ever",
|
||||
"files": [
|
||||
"picocolors.*",
|
||||
"types.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"terminal",
|
||||
"colors",
|
||||
"formatting",
|
||||
"cli",
|
||||
"console"
|
||||
],
|
||||
"author": "Alexey Raspopov",
|
||||
"repository": "alexeyraspopov/picocolors",
|
||||
"license": "ISC"
|
||||
}
|
||||
4
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/picocolors.browser.js
generated
vendored
Normal file
4
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/picocolors.browser.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var x=String;
|
||||
var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}};
|
||||
module.exports=create();
|
||||
module.exports.createColors = create;
|
||||
5
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/picocolors.d.ts
generated
vendored
Normal file
5
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/picocolors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Colors } from "./types"
|
||||
|
||||
declare const picocolors: Colors & { createColors: (enabled: boolean) => Colors }
|
||||
|
||||
export = picocolors
|
||||
60
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/picocolors.js
generated
vendored
Normal file
60
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/picocolors.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
let tty = require("tty")
|
||||
|
||||
let isColorSupported =
|
||||
!("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
|
||||
("FORCE_COLOR" in process.env ||
|
||||
process.argv.includes("--color") ||
|
||||
process.platform === "win32" ||
|
||||
(tty.isatty(1) && process.env.TERM !== "dumb") ||
|
||||
"CI" in process.env)
|
||||
|
||||
function formatter(open, close, replace = open) {
|
||||
return (input) => {
|
||||
let string = "" + input
|
||||
let index = string.indexOf(close, open.length)
|
||||
return !~index
|
||||
? open + string + close
|
||||
: open + replaceClose(string, close, replace, index) + close
|
||||
}
|
||||
}
|
||||
|
||||
function replaceClose(string, close, replace, index) {
|
||||
let start = string.substring(0, index) + replace
|
||||
let end = string.substring(index + close.length)
|
||||
let nextIndex = end.indexOf(close)
|
||||
return !~nextIndex ? start + end : start + replaceClose(end, close, replace, nextIndex)
|
||||
}
|
||||
|
||||
function createColors(enabled = isColorSupported) {
|
||||
return {
|
||||
isColorSupported: enabled,
|
||||
reset: enabled ? (s) => `\x1b[0m${s}\x1b[0m` : String,
|
||||
bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
|
||||
dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
|
||||
italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
|
||||
underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
|
||||
inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
|
||||
hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
|
||||
strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
|
||||
black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
|
||||
red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
|
||||
green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
|
||||
yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
|
||||
blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
|
||||
magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
|
||||
cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
|
||||
white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
|
||||
gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
|
||||
bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
|
||||
bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
|
||||
bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
|
||||
bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
|
||||
bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
|
||||
bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
|
||||
bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
|
||||
bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = createColors()
|
||||
module.exports.createColors = createColors
|
||||
30
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/types.ts
generated
vendored
Normal file
30
backend/frontend/node_modules/postcss-advanced-variables/node_modules/picocolors/types.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
export type Formatter = (input: string | number | null | undefined) => string
|
||||
|
||||
export interface Colors {
|
||||
isColorSupported: boolean
|
||||
reset: Formatter
|
||||
bold: Formatter
|
||||
dim: Formatter
|
||||
italic: Formatter
|
||||
underline: Formatter
|
||||
inverse: Formatter
|
||||
hidden: Formatter
|
||||
strikethrough: Formatter
|
||||
black: Formatter
|
||||
red: Formatter
|
||||
green: Formatter
|
||||
yellow: Formatter
|
||||
blue: Formatter
|
||||
magenta: Formatter
|
||||
cyan: Formatter
|
||||
white: Formatter
|
||||
gray: Formatter
|
||||
bgBlack: Formatter
|
||||
bgRed: Formatter
|
||||
bgGreen: Formatter
|
||||
bgYellow: Formatter
|
||||
bgBlue: Formatter
|
||||
bgMagenta: Formatter
|
||||
bgCyan: Formatter
|
||||
bgWhite: Formatter
|
||||
}
|
||||
20
backend/frontend/node_modules/postcss-advanced-variables/node_modules/postcss/LICENSE
generated
vendored
Normal file
20
backend/frontend/node_modules/postcss-advanced-variables/node_modules/postcss/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
43
backend/frontend/node_modules/postcss-advanced-variables/node_modules/postcss/README.md
generated
vendored
Normal file
43
backend/frontend/node_modules/postcss-advanced-variables/node_modules/postcss/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# PostCSS [![Gitter][chat-img]][chat]
|
||||
|
||||
<img align="right" width="95" height="95"
|
||||
alt="Philosopher’s stone, logo of PostCSS"
|
||||
src="http://postcss.github.io/postcss/logo.svg">
|
||||
|
||||
[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
|
||||
[chat]: https://gitter.im/postcss/postcss
|
||||
|
||||
PostCSS is a tool for transforming styles with JS plugins.
|
||||
These plugins can lint your CSS, support variables and mixins,
|
||||
transpile future CSS syntax, inline images, and more.
|
||||
|
||||
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
|
||||
and JetBrains. The [Autoprefixer] PostCSS plugin is one of the most popular
|
||||
CSS processors.
|
||||
|
||||
PostCSS takes a CSS file and provides an API to analyze and modify its rules
|
||||
(by transforming them into an [Abstract Syntax Tree]).
|
||||
This API can then be used by [plugins] to do a lot of useful things,
|
||||
e.g. to find errors automatically insert vendor prefixes.
|
||||
|
||||
**Support / Discussion:** [Gitter](https://gitter.im/postcss/postcss)<br>
|
||||
**Twitter account:** [@postcss](https://twitter.com/postcss)<br>
|
||||
**VK.com page:** [postcss](https://vk.com/postcss)<br>
|
||||
**中文翻译**: [`README-cn.md`](./README-cn.md)
|
||||
|
||||
For PostCSS commercial support (consulting, improving the front-end culture
|
||||
of your company, PostCSS plugins), contact [Evil Martians]
|
||||
at <surrender@evilmartians.com>.
|
||||
|
||||
[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
|
||||
[Evil Martians]: https://evilmartians.com/?utm_source=postcss
|
||||
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
||||
[plugins]: https://github.com/postcss/postcss#plugins
|
||||
|
||||
<a href="https://evilmartians.com/?utm_source=postcss">
|
||||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
||||
alt="Sponsored by Evil Martians" width="236" height="54">
|
||||
</a>
|
||||
|
||||
## Docs
|
||||
Read **[full docs](https://github.com/postcss/postcss#readme)** on GitHub.
|
||||
37
backend/frontend/node_modules/postcss-advanced-variables/node_modules/postcss/package.json
generated
vendored
Normal file
37
backend/frontend/node_modules/postcss-advanced-variables/node_modules/postcss/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "postcss",
|
||||
"version": "7.0.39",
|
||||
"description": "Tool for transforming styles with JS plugins",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"css",
|
||||
"postcss",
|
||||
"rework",
|
||||
"preprocessor",
|
||||
"parser",
|
||||
"source map",
|
||||
"transform",
|
||||
"manipulation",
|
||||
"transpiler"
|
||||
],
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://postcss.org/",
|
||||
"repository": "postcss/postcss",
|
||||
"dependencies": {
|
||||
"picocolors": "^0.2.1",
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"main": "lib/postcss",
|
||||
"types": "lib/postcss.d.ts",
|
||||
"browser": {
|
||||
"./lib/terminal-highlight": false,
|
||||
"fs": false
|
||||
}
|
||||
}
|
||||
301
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/CHANGELOG.md
generated
vendored
Normal file
301
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,301 @@
|
||||
# Change Log
|
||||
|
||||
## 0.5.6
|
||||
|
||||
* Fix for regression when people were using numbers as names in source maps. See
|
||||
#236.
|
||||
|
||||
## 0.5.5
|
||||
|
||||
* Fix "regression" of unsupported, implementation behavior that half the world
|
||||
happens to have come to depend on. See #235.
|
||||
|
||||
* Fix regression involving function hoisting in SpiderMonkey. See #233.
|
||||
|
||||
## 0.5.4
|
||||
|
||||
* Large performance improvements to source-map serialization. See #228 and #229.
|
||||
|
||||
## 0.5.3
|
||||
|
||||
* Do not include unnecessary distribution files. See
|
||||
commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86.
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Include browser distributions of the library in package.json's `files`. See
|
||||
issue #212.
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See
|
||||
ff05274becc9e6e1295ed60f3ea090d31d843379.
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Node 0.8 is no longer supported.
|
||||
|
||||
* Use webpack instead of dryice for bundling.
|
||||
|
||||
* Big speedups serializing source maps. See pull request #203.
|
||||
|
||||
* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that
|
||||
explicitly start with the source root. See issue #199.
|
||||
|
||||
## 0.4.4
|
||||
|
||||
* Fix an issue where using a `SourceMapGenerator` after having created a
|
||||
`SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See
|
||||
issue #191.
|
||||
|
||||
* Fix an issue with where `SourceMapGenerator` would mistakenly consider
|
||||
different mappings as duplicates of each other and avoid generating them. See
|
||||
issue #192.
|
||||
|
||||
## 0.4.3
|
||||
|
||||
* A very large number of performance improvements, particularly when parsing
|
||||
source maps. Collectively about 75% of time shaved off of the source map
|
||||
parsing benchmark!
|
||||
|
||||
* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy
|
||||
searching in the presence of a column option. See issue #177.
|
||||
|
||||
* Fix a bug with joining a source and its source root when the source is above
|
||||
the root. See issue #182.
|
||||
|
||||
* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to
|
||||
determine when all sources' contents are inlined into the source map. See
|
||||
issue #190.
|
||||
|
||||
## 0.4.2
|
||||
|
||||
* Add an `.npmignore` file so that the benchmarks aren't pulled down by
|
||||
dependent projects. Issue #169.
|
||||
|
||||
* Add an optional `column` argument to
|
||||
`SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines
|
||||
with no mappings. Issues #172 and #173.
|
||||
|
||||
## 0.4.1
|
||||
|
||||
* Fix accidentally defining a global variable. #170.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* The default direction for fuzzy searching was changed back to its original
|
||||
direction. See #164.
|
||||
|
||||
* There is now a `bias` option you can supply to `SourceMapConsumer` to control
|
||||
the fuzzy searching direction. See #167.
|
||||
|
||||
* About an 8% speed up in parsing source maps. See #159.
|
||||
|
||||
* Added a benchmark for parsing and generating source maps.
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Change the default direction that searching for positions fuzzes when there is
|
||||
not an exact match. See #154.
|
||||
|
||||
* Support for environments using json2.js for JSON serialization. See #156.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
* Support for consuming "indexed" source maps which do not have any remote
|
||||
sections. See pull request #127. This introduces a minor backwards
|
||||
incompatibility if you are monkey patching `SourceMapConsumer.prototype`
|
||||
methods.
|
||||
|
||||
## 0.1.43
|
||||
|
||||
* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue
|
||||
#148 for some discussion and issues #150, #151, and #152 for implementations.
|
||||
|
||||
## 0.1.42
|
||||
|
||||
* Fix an issue where `SourceNode`s from different versions of the source-map
|
||||
library couldn't be used in conjunction with each other. See issue #142.
|
||||
|
||||
## 0.1.41
|
||||
|
||||
* Fix a bug with getting the source content of relative sources with a "./"
|
||||
prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768).
|
||||
|
||||
* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the
|
||||
column span of each mapping.
|
||||
|
||||
* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find
|
||||
all generated positions associated with a given original source and line.
|
||||
|
||||
## 0.1.40
|
||||
|
||||
* Performance improvements for parsing source maps in SourceMapConsumer.
|
||||
|
||||
## 0.1.39
|
||||
|
||||
* Fix a bug where setting a source's contents to null before any source content
|
||||
had been set before threw a TypeError. See issue #131.
|
||||
|
||||
## 0.1.38
|
||||
|
||||
* Fix a bug where finding relative paths from an empty path were creating
|
||||
absolute paths. See issue #129.
|
||||
|
||||
## 0.1.37
|
||||
|
||||
* Fix a bug where if the source root was an empty string, relative source paths
|
||||
would turn into absolute source paths. Issue #124.
|
||||
|
||||
## 0.1.36
|
||||
|
||||
* Allow the `names` mapping property to be an empty string. Issue #121.
|
||||
|
||||
## 0.1.35
|
||||
|
||||
* A third optional parameter was added to `SourceNode.fromStringWithSourceMap`
|
||||
to specify a path that relative sources in the second parameter should be
|
||||
relative to. Issue #105.
|
||||
|
||||
* If no file property is given to a `SourceMapGenerator`, then the resulting
|
||||
source map will no longer have a `null` file property. The property will
|
||||
simply not exist. Issue #104.
|
||||
|
||||
* Fixed a bug where consecutive newlines were ignored in `SourceNode`s.
|
||||
Issue #116.
|
||||
|
||||
## 0.1.34
|
||||
|
||||
* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103.
|
||||
|
||||
* Fix bug involving source contents and the
|
||||
`SourceMapGenerator.prototype.applySourceMap`. Issue #100.
|
||||
|
||||
## 0.1.33
|
||||
|
||||
* Fix some edge cases surrounding path joining and URL resolution.
|
||||
|
||||
* Add a third parameter for relative path to
|
||||
`SourceMapGenerator.prototype.applySourceMap`.
|
||||
|
||||
* Fix issues with mappings and EOLs.
|
||||
|
||||
## 0.1.32
|
||||
|
||||
* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns
|
||||
(issue 92).
|
||||
|
||||
* Fixed test runner to actually report number of failed tests as its process
|
||||
exit code.
|
||||
|
||||
* Fixed a typo when reporting bad mappings (issue 87).
|
||||
|
||||
## 0.1.31
|
||||
|
||||
* Delay parsing the mappings in SourceMapConsumer until queried for a source
|
||||
location.
|
||||
|
||||
* Support Sass source maps (which at the time of writing deviate from the spec
|
||||
in small ways) in SourceMapConsumer.
|
||||
|
||||
## 0.1.30
|
||||
|
||||
* Do not join source root with a source, when the source is a data URI.
|
||||
|
||||
* Extend the test runner to allow running single specific test files at a time.
|
||||
|
||||
* Performance improvements in `SourceNode.prototype.walk` and
|
||||
`SourceMapConsumer.prototype.eachMapping`.
|
||||
|
||||
* Source map browser builds will now work inside Workers.
|
||||
|
||||
* Better error messages when attempting to add an invalid mapping to a
|
||||
`SourceMapGenerator`.
|
||||
|
||||
## 0.1.29
|
||||
|
||||
* Allow duplicate entries in the `names` and `sources` arrays of source maps
|
||||
(usually from TypeScript) we are parsing. Fixes github issue 72.
|
||||
|
||||
## 0.1.28
|
||||
|
||||
* Skip duplicate mappings when creating source maps from SourceNode; github
|
||||
issue 75.
|
||||
|
||||
## 0.1.27
|
||||
|
||||
* Don't throw an error when the `file` property is missing in SourceMapConsumer,
|
||||
we don't use it anyway.
|
||||
|
||||
## 0.1.26
|
||||
|
||||
* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70.
|
||||
|
||||
## 0.1.25
|
||||
|
||||
* Make compatible with browserify
|
||||
|
||||
## 0.1.24
|
||||
|
||||
* Fix issue with absolute paths and `file://` URIs. See
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=885597
|
||||
|
||||
## 0.1.23
|
||||
|
||||
* Fix issue with absolute paths and sourcesContent, github issue 64.
|
||||
|
||||
## 0.1.22
|
||||
|
||||
* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21.
|
||||
|
||||
## 0.1.21
|
||||
|
||||
* Fixed handling of sources that start with a slash so that they are relative to
|
||||
the source root's host.
|
||||
|
||||
## 0.1.20
|
||||
|
||||
* Fixed github issue #43: absolute URLs aren't joined with the source root
|
||||
anymore.
|
||||
|
||||
## 0.1.19
|
||||
|
||||
* Using Travis CI to run tests.
|
||||
|
||||
## 0.1.18
|
||||
|
||||
* Fixed a bug in the handling of sourceRoot.
|
||||
|
||||
## 0.1.17
|
||||
|
||||
* Added SourceNode.fromStringWithSourceMap.
|
||||
|
||||
## 0.1.16
|
||||
|
||||
* Added missing documentation.
|
||||
|
||||
* Fixed the generating of empty mappings in SourceNode.
|
||||
|
||||
## 0.1.15
|
||||
|
||||
* Added SourceMapGenerator.applySourceMap.
|
||||
|
||||
## 0.1.14
|
||||
|
||||
* The sourceRoot is now handled consistently.
|
||||
|
||||
## 0.1.13
|
||||
|
||||
* Added SourceMapGenerator.fromSourceMap.
|
||||
|
||||
## 0.1.12
|
||||
|
||||
* SourceNode now generates empty mappings too.
|
||||
|
||||
## 0.1.11
|
||||
|
||||
* Added name support to SourceNode.
|
||||
|
||||
## 0.1.10
|
||||
|
||||
* Added sourcesContent support to the customer and generator.
|
||||
28
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/LICENSE
generated
vendored
Normal file
28
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the Mozilla Foundation nor the names of project
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
742
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/README.md
generated
vendored
Normal file
742
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/README.md
generated
vendored
Normal file
@@ -0,0 +1,742 @@
|
||||
# Source Map
|
||||
|
||||
[](https://travis-ci.org/mozilla/source-map)
|
||||
|
||||
[](https://www.npmjs.com/package/source-map)
|
||||
|
||||
This is a library to generate and consume the source map format
|
||||
[described here][format].
|
||||
|
||||
[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
|
||||
|
||||
## Use with Node
|
||||
|
||||
$ npm install source-map
|
||||
|
||||
## Use on the Web
|
||||
|
||||
<script src="https://raw.githubusercontent.com/mozilla/source-map/master/dist/source-map.min.js" defer></script>
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
<!-- `npm run toc` to regenerate the Table of Contents -->
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
## Table of Contents
|
||||
|
||||
- [Examples](#examples)
|
||||
- [Consuming a source map](#consuming-a-source-map)
|
||||
- [Generating a source map](#generating-a-source-map)
|
||||
- [With SourceNode (high level API)](#with-sourcenode-high-level-api)
|
||||
- [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
|
||||
- [API](#api)
|
||||
- [SourceMapConsumer](#sourcemapconsumer)
|
||||
- [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
|
||||
- [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
|
||||
- [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
|
||||
- [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
|
||||
- [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
|
||||
- [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
|
||||
- [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
|
||||
- [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
|
||||
- [SourceMapGenerator](#sourcemapgenerator)
|
||||
- [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
|
||||
- [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
|
||||
- [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
|
||||
- [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
|
||||
- [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
|
||||
- [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
|
||||
- [SourceNode](#sourcenode)
|
||||
- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
|
||||
- [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
|
||||
- [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
|
||||
- [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
|
||||
- [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
|
||||
- [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
|
||||
- [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
|
||||
- [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
|
||||
- [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
|
||||
- [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
|
||||
- [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Examples
|
||||
|
||||
### Consuming a source map
|
||||
|
||||
```js
|
||||
var rawSourceMap = {
|
||||
version: 3,
|
||||
file: 'min.js',
|
||||
names: ['bar', 'baz', 'n'],
|
||||
sources: ['one.js', 'two.js'],
|
||||
sourceRoot: 'http://example.com/www/js/',
|
||||
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
|
||||
};
|
||||
|
||||
var smc = new SourceMapConsumer(rawSourceMap);
|
||||
|
||||
console.log(smc.sources);
|
||||
// [ 'http://example.com/www/js/one.js',
|
||||
// 'http://example.com/www/js/two.js' ]
|
||||
|
||||
console.log(smc.originalPositionFor({
|
||||
line: 2,
|
||||
column: 28
|
||||
}));
|
||||
// { source: 'http://example.com/www/js/two.js',
|
||||
// line: 2,
|
||||
// column: 10,
|
||||
// name: 'n' }
|
||||
|
||||
console.log(smc.generatedPositionFor({
|
||||
source: 'http://example.com/www/js/two.js',
|
||||
line: 2,
|
||||
column: 10
|
||||
}));
|
||||
// { line: 2, column: 28 }
|
||||
|
||||
smc.eachMapping(function (m) {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
### Generating a source map
|
||||
|
||||
In depth guide:
|
||||
[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
|
||||
|
||||
#### With SourceNode (high level API)
|
||||
|
||||
```js
|
||||
function compile(ast) {
|
||||
switch (ast.type) {
|
||||
case 'BinaryExpression':
|
||||
return new SourceNode(
|
||||
ast.location.line,
|
||||
ast.location.column,
|
||||
ast.location.source,
|
||||
[compile(ast.left), " + ", compile(ast.right)]
|
||||
);
|
||||
case 'Literal':
|
||||
return new SourceNode(
|
||||
ast.location.line,
|
||||
ast.location.column,
|
||||
ast.location.source,
|
||||
String(ast.value)
|
||||
);
|
||||
// ...
|
||||
default:
|
||||
throw new Error("Bad AST");
|
||||
}
|
||||
}
|
||||
|
||||
var ast = parse("40 + 2", "add.js");
|
||||
console.log(compile(ast).toStringWithSourceMap({
|
||||
file: 'add.js'
|
||||
}));
|
||||
// { code: '40 + 2',
|
||||
// map: [object SourceMapGenerator] }
|
||||
```
|
||||
|
||||
#### With SourceMapGenerator (low level API)
|
||||
|
||||
```js
|
||||
var map = new SourceMapGenerator({
|
||||
file: "source-mapped.js"
|
||||
});
|
||||
|
||||
map.addMapping({
|
||||
generated: {
|
||||
line: 10,
|
||||
column: 35
|
||||
},
|
||||
source: "foo.js",
|
||||
original: {
|
||||
line: 33,
|
||||
column: 2
|
||||
},
|
||||
name: "christopher"
|
||||
});
|
||||
|
||||
console.log(map.toString());
|
||||
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Get a reference to the module:
|
||||
|
||||
```js
|
||||
// Node.js
|
||||
var sourceMap = require('source-map');
|
||||
|
||||
// Browser builds
|
||||
var sourceMap = window.sourceMap;
|
||||
|
||||
// Inside Firefox
|
||||
const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
|
||||
```
|
||||
|
||||
### SourceMapConsumer
|
||||
|
||||
A SourceMapConsumer instance represents a parsed source map which we can query
|
||||
for information about the original file positions by giving it a file position
|
||||
in the generated source.
|
||||
|
||||
#### new SourceMapConsumer(rawSourceMap)
|
||||
|
||||
The only parameter is the raw source map (either as a string which can be
|
||||
`JSON.parse`'d, or an object). According to the spec, source maps have the
|
||||
following attributes:
|
||||
|
||||
* `version`: Which version of the source map spec this map is following.
|
||||
|
||||
* `sources`: An array of URLs to the original source files.
|
||||
|
||||
* `names`: An array of identifiers which can be referenced by individual
|
||||
mappings.
|
||||
|
||||
* `sourceRoot`: Optional. The URL root from which all sources are relative.
|
||||
|
||||
* `sourcesContent`: Optional. An array of contents of the original source files.
|
||||
|
||||
* `mappings`: A string of base64 VLQs which contain the actual mappings.
|
||||
|
||||
* `file`: Optional. The generated filename this source map is associated with.
|
||||
|
||||
```js
|
||||
var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.computeColumnSpans()
|
||||
|
||||
Compute the last column for each generated mapping. The last column is
|
||||
inclusive.
|
||||
|
||||
```js
|
||||
// Before:
|
||||
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1 },
|
||||
// { line: 2,
|
||||
// column: 10 },
|
||||
// { line: 2,
|
||||
// column: 20 } ]
|
||||
|
||||
consumer.computeColumnSpans();
|
||||
|
||||
// After:
|
||||
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1,
|
||||
// lastColumn: 9 },
|
||||
// { line: 2,
|
||||
// column: 10,
|
||||
// lastColumn: 19 },
|
||||
// { line: 2,
|
||||
// column: 20,
|
||||
// lastColumn: Infinity } ]
|
||||
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
|
||||
|
||||
Returns the original source, line, and column information for the generated
|
||||
source's line and column positions provided. The only argument is an object with
|
||||
the following properties:
|
||||
|
||||
* `line`: The line number in the generated source. Line numbers in
|
||||
this library are 1-based (note that the underlying source map
|
||||
specification uses 0-based line numbers -- this library handles the
|
||||
translation).
|
||||
|
||||
* `column`: The column number in the generated source. Column numbers
|
||||
in this library are 0-based.
|
||||
|
||||
* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
|
||||
`SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
|
||||
element that is smaller than or greater than the one we are searching for,
|
||||
respectively, if the exact element cannot be found. Defaults to
|
||||
`SourceMapConsumer.GREATEST_LOWER_BOUND`.
|
||||
|
||||
and an object is returned with the following properties:
|
||||
|
||||
* `source`: The original source file, or null if this information is not
|
||||
available.
|
||||
|
||||
* `line`: The line number in the original source, or null if this information is
|
||||
not available. The line number is 1-based.
|
||||
|
||||
* `column`: The column number in the original source, or null if this
|
||||
information is not available. The column number is 0-based.
|
||||
|
||||
* `name`: The original identifier, or null if this information is not available.
|
||||
|
||||
```js
|
||||
consumer.originalPositionFor({ line: 2, column: 10 })
|
||||
// { source: 'foo.coffee',
|
||||
// line: 2,
|
||||
// column: 2,
|
||||
// name: null }
|
||||
|
||||
consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
|
||||
// { source: null,
|
||||
// line: null,
|
||||
// column: null,
|
||||
// name: null }
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
|
||||
|
||||
Returns the generated line and column information for the original source,
|
||||
line, and column positions provided. The only argument is an object with
|
||||
the following properties:
|
||||
|
||||
* `source`: The filename of the original source.
|
||||
|
||||
* `line`: The line number in the original source. The line number is
|
||||
1-based.
|
||||
|
||||
* `column`: The column number in the original source. The column
|
||||
number is 0-based.
|
||||
|
||||
and an object is returned with the following properties:
|
||||
|
||||
* `line`: The line number in the generated source, or null. The line
|
||||
number is 1-based.
|
||||
|
||||
* `column`: The column number in the generated source, or null. The
|
||||
column number is 0-based.
|
||||
|
||||
```js
|
||||
consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
|
||||
// { line: 1,
|
||||
// column: 56 }
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
|
||||
|
||||
Returns all generated line and column information for the original source, line,
|
||||
and column provided. If no column is provided, returns all mappings
|
||||
corresponding to a either the line we are searching for or the next closest line
|
||||
that has any mappings. Otherwise, returns all mappings corresponding to the
|
||||
given line and either the column we are searching for or the next closest column
|
||||
that has any offsets.
|
||||
|
||||
The only argument is an object with the following properties:
|
||||
|
||||
* `source`: The filename of the original source.
|
||||
|
||||
* `line`: The line number in the original source. The line number is
|
||||
1-based.
|
||||
|
||||
* `column`: Optional. The column number in the original source. The
|
||||
column number is 0-based.
|
||||
|
||||
and an array of objects is returned, each with the following properties:
|
||||
|
||||
* `line`: The line number in the generated source, or null. The line
|
||||
number is 1-based.
|
||||
|
||||
* `column`: The column number in the generated source, or null. The
|
||||
column number is 0-based.
|
||||
|
||||
```js
|
||||
consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
|
||||
// [ { line: 2,
|
||||
// column: 1 },
|
||||
// { line: 2,
|
||||
// column: 10 },
|
||||
// { line: 2,
|
||||
// column: 20 } ]
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.hasContentsOfAllSources()
|
||||
|
||||
Return true if we have the embedded source content for every source listed in
|
||||
the source map, false otherwise.
|
||||
|
||||
In other words, if this method returns `true`, then
|
||||
`consumer.sourceContentFor(s)` will succeed for every source `s` in
|
||||
`consumer.sources`.
|
||||
|
||||
```js
|
||||
// ...
|
||||
if (consumer.hasContentsOfAllSources()) {
|
||||
consumerReadyCallback(consumer);
|
||||
} else {
|
||||
fetchSources(consumer, consumerReadyCallback);
|
||||
}
|
||||
// ...
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
|
||||
|
||||
Returns the original source content for the source provided. The only
|
||||
argument is the URL of the original source file.
|
||||
|
||||
If the source content for the given source is not found, then an error is
|
||||
thrown. Optionally, pass `true` as the second param to have `null` returned
|
||||
instead.
|
||||
|
||||
```js
|
||||
consumer.sources
|
||||
// [ "my-cool-lib.clj" ]
|
||||
|
||||
consumer.sourceContentFor("my-cool-lib.clj")
|
||||
// "..."
|
||||
|
||||
consumer.sourceContentFor("this is not in the source map");
|
||||
// Error: "this is not in the source map" is not in the source map
|
||||
|
||||
consumer.sourceContentFor("this is not in the source map", true);
|
||||
// null
|
||||
```
|
||||
|
||||
#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
|
||||
|
||||
Iterate over each mapping between an original source/line/column and a
|
||||
generated line/column in this source map.
|
||||
|
||||
* `callback`: The function that is called with each mapping. Mappings have the
|
||||
form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
|
||||
name }`
|
||||
|
||||
* `context`: Optional. If specified, this object will be the value of `this`
|
||||
every time that `callback` is called.
|
||||
|
||||
* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
|
||||
`SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
|
||||
the mappings sorted by the generated file's line/column order or the
|
||||
original's source/line/column order, respectively. Defaults to
|
||||
`SourceMapConsumer.GENERATED_ORDER`.
|
||||
|
||||
```js
|
||||
consumer.eachMapping(function (m) { console.log(m); })
|
||||
// ...
|
||||
// { source: 'illmatic.js',
|
||||
// generatedLine: 1,
|
||||
// generatedColumn: 0,
|
||||
// originalLine: 1,
|
||||
// originalColumn: 0,
|
||||
// name: null }
|
||||
// { source: 'illmatic.js',
|
||||
// generatedLine: 2,
|
||||
// generatedColumn: 0,
|
||||
// originalLine: 2,
|
||||
// originalColumn: 0,
|
||||
// name: null }
|
||||
// ...
|
||||
```
|
||||
### SourceMapGenerator
|
||||
|
||||
An instance of the SourceMapGenerator represents a source map which is being
|
||||
built incrementally.
|
||||
|
||||
#### new SourceMapGenerator([startOfSourceMap])
|
||||
|
||||
You may pass an object with the following properties:
|
||||
|
||||
* `file`: The filename of the generated source that this source map is
|
||||
associated with.
|
||||
|
||||
* `sourceRoot`: A root for all relative URLs in this source map.
|
||||
|
||||
* `skipValidation`: Optional. When `true`, disables validation of mappings as
|
||||
they are added. This can improve performance but should be used with
|
||||
discretion, as a last resort. Even then, one should avoid using this flag when
|
||||
running tests, if possible.
|
||||
|
||||
```js
|
||||
var generator = new sourceMap.SourceMapGenerator({
|
||||
file: "my-generated-javascript-file.js",
|
||||
sourceRoot: "http://example.com/app/js/"
|
||||
});
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.fromSourceMap(sourceMapConsumer)
|
||||
|
||||
Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
|
||||
|
||||
* `sourceMapConsumer` The SourceMap.
|
||||
|
||||
```js
|
||||
var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer);
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.addMapping(mapping)
|
||||
|
||||
Add a single mapping from original source line and column to the generated
|
||||
source's line and column for this source map being created. The mapping object
|
||||
should have the following properties:
|
||||
|
||||
* `generated`: An object with the generated line and column positions.
|
||||
|
||||
* `original`: An object with the original line and column positions.
|
||||
|
||||
* `source`: The original source file (relative to the sourceRoot).
|
||||
|
||||
* `name`: An optional original token name for this mapping.
|
||||
|
||||
```js
|
||||
generator.addMapping({
|
||||
source: "module-one.scm",
|
||||
original: { line: 128, column: 0 },
|
||||
generated: { line: 3, column: 456 }
|
||||
})
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
|
||||
|
||||
Set the source content for an original source file.
|
||||
|
||||
* `sourceFile` the URL of the original source file.
|
||||
|
||||
* `sourceContent` the content of the source file.
|
||||
|
||||
```js
|
||||
generator.setSourceContent("module-one.scm",
|
||||
fs.readFileSync("path/to/module-one.scm"))
|
||||
```
|
||||
|
||||
#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
|
||||
|
||||
Applies a SourceMap for a source file to the SourceMap.
|
||||
Each mapping to the supplied source file is rewritten using the
|
||||
supplied SourceMap. Note: The resolution for the resulting mappings
|
||||
is the minimum of this map and the supplied map.
|
||||
|
||||
* `sourceMapConsumer`: The SourceMap to be applied.
|
||||
|
||||
* `sourceFile`: Optional. The filename of the source file.
|
||||
If omitted, sourceMapConsumer.file will be used, if it exists.
|
||||
Otherwise an error will be thrown.
|
||||
|
||||
* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
|
||||
to be applied. If relative, it is relative to the SourceMap.
|
||||
|
||||
This parameter is needed when the two SourceMaps aren't in the same
|
||||
directory, and the SourceMap to be applied contains relative source
|
||||
paths. If so, those relative source paths need to be rewritten
|
||||
relative to the SourceMap.
|
||||
|
||||
If omitted, it is assumed that both SourceMaps are in the same directory,
|
||||
thus not needing any rewriting. (Supplying `'.'` has the same effect.)
|
||||
|
||||
#### SourceMapGenerator.prototype.toString()
|
||||
|
||||
Renders the source map being generated to a string.
|
||||
|
||||
```js
|
||||
generator.toString()
|
||||
// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
|
||||
```
|
||||
|
||||
### SourceNode
|
||||
|
||||
SourceNodes provide a way to abstract over interpolating and/or concatenating
|
||||
snippets of generated JavaScript source code, while maintaining the line and
|
||||
column information associated between those snippets and the original source
|
||||
code. This is useful as the final intermediate representation a compiler might
|
||||
use before outputting the generated JS and source map.
|
||||
|
||||
#### new SourceNode([line, column, source[, chunk[, name]]])
|
||||
|
||||
* `line`: The original line number associated with this source node, or null if
|
||||
it isn't associated with an original line. The line number is 1-based.
|
||||
|
||||
* `column`: The original column number associated with this source node, or null
|
||||
if it isn't associated with an original column. The column number
|
||||
is 0-based.
|
||||
|
||||
* `source`: The original source's filename; null if no filename is provided.
|
||||
|
||||
* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
|
||||
below.
|
||||
|
||||
* `name`: Optional. The original identifier.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.cpp", [
|
||||
new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
|
||||
new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
|
||||
new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
|
||||
]);
|
||||
```
|
||||
|
||||
#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
|
||||
|
||||
Creates a SourceNode from generated code and a SourceMapConsumer.
|
||||
|
||||
* `code`: The generated code
|
||||
|
||||
* `sourceMapConsumer` The SourceMap for the generated code
|
||||
|
||||
* `relativePath` The optional path that relative sources in `sourceMapConsumer`
|
||||
should be relative to.
|
||||
|
||||
```js
|
||||
var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
|
||||
var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
|
||||
consumer);
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.add(chunk)
|
||||
|
||||
Add a chunk of generated JS to this source node.
|
||||
|
||||
* `chunk`: A string snippet of generated JS code, another instance of
|
||||
`SourceNode`, or an array where each member is one of those things.
|
||||
|
||||
```js
|
||||
node.add(" + ");
|
||||
node.add(otherNode);
|
||||
node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.prepend(chunk)
|
||||
|
||||
Prepend a chunk of generated JS to this source node.
|
||||
|
||||
* `chunk`: A string snippet of generated JS code, another instance of
|
||||
`SourceNode`, or an array where each member is one of those things.
|
||||
|
||||
```js
|
||||
node.prepend("/** Build Id: f783haef86324gf **/\n\n");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
|
||||
|
||||
Set the source content for a source file. This will be added to the
|
||||
`SourceMap` in the `sourcesContent` field.
|
||||
|
||||
* `sourceFile`: The filename of the source file
|
||||
|
||||
* `sourceContent`: The content of the source file
|
||||
|
||||
```js
|
||||
node.setSourceContent("module-one.scm",
|
||||
fs.readFileSync("path/to/module-one.scm"))
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.walk(fn)
|
||||
|
||||
Walk over the tree of JS snippets in this node and its children. The walking
|
||||
function is called once for each snippet of JS and is passed that snippet and
|
||||
the its original associated source's line/column location.
|
||||
|
||||
* `fn`: The traversal function.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.walk(function (code, loc) { console.log("WALK:", code, loc); })
|
||||
// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
|
||||
// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
|
||||
// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
|
||||
// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.walkSourceContents(fn)
|
||||
|
||||
Walk over the tree of SourceNodes. The walking function is called for each
|
||||
source file content and is passed the filename and source content.
|
||||
|
||||
* `fn`: The traversal function.
|
||||
|
||||
```js
|
||||
var a = new SourceNode(1, 2, "a.js", "generated from a");
|
||||
a.setSourceContent("a.js", "original a");
|
||||
var b = new SourceNode(1, 2, "b.js", "generated from b");
|
||||
b.setSourceContent("b.js", "original b");
|
||||
var c = new SourceNode(1, 2, "c.js", "generated from c");
|
||||
c.setSourceContent("c.js", "original c");
|
||||
|
||||
var node = new SourceNode(null, null, null, [a, b, c]);
|
||||
node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
|
||||
// WALK: a.js : original a
|
||||
// WALK: b.js : original b
|
||||
// WALK: c.js : original c
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.join(sep)
|
||||
|
||||
Like `Array.prototype.join` except for SourceNodes. Inserts the separator
|
||||
between each of this source node's children.
|
||||
|
||||
* `sep`: The separator.
|
||||
|
||||
```js
|
||||
var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
|
||||
var operand = new SourceNode(3, 4, "a.rs", "=");
|
||||
var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
|
||||
|
||||
var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
|
||||
var joinedNode = node.join(" ");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.replaceRight(pattern, replacement)
|
||||
|
||||
Call `String.prototype.replace` on the very right-most source snippet. Useful
|
||||
for trimming white space from the end of a source node, etc.
|
||||
|
||||
* `pattern`: The pattern to replace.
|
||||
|
||||
* `replacement`: The thing to replace the pattern with.
|
||||
|
||||
```js
|
||||
// Trim trailing white space.
|
||||
node.replaceRight(/\s*$/, "");
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.toString()
|
||||
|
||||
Return the string representation of this source node. Walks over the tree and
|
||||
concatenates all the various snippets together to one string.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.toString()
|
||||
// 'unodostresquatro'
|
||||
```
|
||||
|
||||
#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
|
||||
|
||||
Returns the string representation of this tree of source nodes, plus a
|
||||
SourceMapGenerator which contains all the mappings between the generated and
|
||||
original sources.
|
||||
|
||||
The arguments are the same as those to `new SourceMapGenerator`.
|
||||
|
||||
```js
|
||||
var node = new SourceNode(1, 2, "a.js", [
|
||||
new SourceNode(3, 4, "b.js", "uno"),
|
||||
"dos",
|
||||
[
|
||||
"tres",
|
||||
new SourceNode(5, 6, "c.js", "quatro")
|
||||
]
|
||||
]);
|
||||
|
||||
node.toStringWithSourceMap({ file: "my-output-file.js" })
|
||||
// { code: 'unodostresquatro',
|
||||
// map: [object SourceMapGenerator] }
|
||||
```
|
||||
73
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/package.json
generated
vendored
Normal file
73
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "source-map",
|
||||
"description": "Generates and consumes source maps",
|
||||
"version": "0.6.1",
|
||||
"homepage": "https://github.com/mozilla/source-map",
|
||||
"author": "Nick Fitzgerald <nfitzgerald@mozilla.com>",
|
||||
"contributors": [
|
||||
"Tobias Koppers <tobias.koppers@googlemail.com>",
|
||||
"Duncan Beevers <duncan@dweebd.com>",
|
||||
"Stephen Crane <scrane@mozilla.com>",
|
||||
"Ryan Seddon <seddon.ryan@gmail.com>",
|
||||
"Miles Elam <miles.elam@deem.com>",
|
||||
"Mihai Bazon <mihai.bazon@gmail.com>",
|
||||
"Michael Ficarra <github.public.email@michael.ficarra.me>",
|
||||
"Todd Wolfson <todd@twolfson.com>",
|
||||
"Alexander Solovyov <alexander@solovyov.net>",
|
||||
"Felix Gnass <fgnass@gmail.com>",
|
||||
"Conrad Irwin <conrad.irwin@gmail.com>",
|
||||
"usrbincc <usrbincc@yahoo.com>",
|
||||
"David Glasser <glasser@davidglasser.net>",
|
||||
"Chase Douglas <chase@newrelic.com>",
|
||||
"Evan Wallace <evan.exe@gmail.com>",
|
||||
"Heather Arthur <fayearthur@gmail.com>",
|
||||
"Hugh Kennedy <hughskennedy@gmail.com>",
|
||||
"David Glasser <glasser@davidglasser.net>",
|
||||
"Simon Lydell <simon.lydell@gmail.com>",
|
||||
"Jmeas Smith <jellyes2@gmail.com>",
|
||||
"Michael Z Goddard <mzgoddard@gmail.com>",
|
||||
"azu <azu@users.noreply.github.com>",
|
||||
"John Gozde <john@gozde.ca>",
|
||||
"Adam Kirkton <akirkton@truefitinnovation.com>",
|
||||
"Chris Montgomery <christopher.montgomery@dowjones.com>",
|
||||
"J. Ryan Stinnett <jryans@gmail.com>",
|
||||
"Jack Herrington <jherrington@walmartlabs.com>",
|
||||
"Chris Truter <jeffpalentine@gmail.com>",
|
||||
"Daniel Espeset <daniel@danielespeset.com>",
|
||||
"Jamie Wong <jamie.lf.wong@gmail.com>",
|
||||
"Eddy Bruël <ejpbruel@mozilla.com>",
|
||||
"Hawken Rives <hawkrives@gmail.com>",
|
||||
"Gilad Peleg <giladp007@gmail.com>",
|
||||
"djchie <djchie.dev@gmail.com>",
|
||||
"Gary Ye <garysye@gmail.com>",
|
||||
"Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/mozilla/source-map.git"
|
||||
},
|
||||
"main": "./source-map.js",
|
||||
"files": [
|
||||
"source-map.js",
|
||||
"source-map.d.ts",
|
||||
"lib/",
|
||||
"dist/source-map.debug.js",
|
||||
"dist/source-map.js",
|
||||
"dist/source-map.min.js",
|
||||
"dist/source-map.min.js.map"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"scripts": {
|
||||
"test": "npm run build && node test/run-tests.js",
|
||||
"build": "webpack --color",
|
||||
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
|
||||
},
|
||||
"devDependencies": {
|
||||
"doctoc": "^0.15.0",
|
||||
"webpack": "^1.12.0"
|
||||
},
|
||||
"typings": "source-map"
|
||||
}
|
||||
98
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/source-map.d.ts
generated
vendored
Normal file
98
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/source-map.d.ts
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
export interface StartOfSourceMap {
|
||||
file?: string;
|
||||
sourceRoot?: string;
|
||||
}
|
||||
|
||||
export interface RawSourceMap extends StartOfSourceMap {
|
||||
version: string;
|
||||
sources: string[];
|
||||
names: string[];
|
||||
sourcesContent?: string[];
|
||||
mappings: string;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface LineRange extends Position {
|
||||
lastColumn: number;
|
||||
}
|
||||
|
||||
export interface FindPosition extends Position {
|
||||
// SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
|
||||
bias?: number;
|
||||
}
|
||||
|
||||
export interface SourceFindPosition extends FindPosition {
|
||||
source: string;
|
||||
}
|
||||
|
||||
export interface MappedPosition extends Position {
|
||||
source: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface MappingItem {
|
||||
source: string;
|
||||
generatedLine: number;
|
||||
generatedColumn: number;
|
||||
originalLine: number;
|
||||
originalColumn: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export class SourceMapConsumer {
|
||||
static GENERATED_ORDER: number;
|
||||
static ORIGINAL_ORDER: number;
|
||||
|
||||
static GREATEST_LOWER_BOUND: number;
|
||||
static LEAST_UPPER_BOUND: number;
|
||||
|
||||
constructor(rawSourceMap: RawSourceMap);
|
||||
computeColumnSpans(): void;
|
||||
originalPositionFor(generatedPosition: FindPosition): MappedPosition;
|
||||
generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
|
||||
allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
|
||||
hasContentsOfAllSources(): boolean;
|
||||
sourceContentFor(source: string, returnNullOnMissing?: boolean): string;
|
||||
eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
|
||||
}
|
||||
|
||||
export interface Mapping {
|
||||
generated: Position;
|
||||
original: Position;
|
||||
source: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export class SourceMapGenerator {
|
||||
constructor(startOfSourceMap?: StartOfSourceMap);
|
||||
static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
|
||||
addMapping(mapping: Mapping): void;
|
||||
setSourceContent(sourceFile: string, sourceContent: string): void;
|
||||
applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export interface CodeWithSourceMap {
|
||||
code: string;
|
||||
map: SourceMapGenerator;
|
||||
}
|
||||
|
||||
export class SourceNode {
|
||||
constructor();
|
||||
constructor(line: number, column: number, source: string);
|
||||
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
||||
static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
||||
add(chunk: string): void;
|
||||
prepend(chunk: string): void;
|
||||
setSourceContent(sourceFile: string, sourceContent: string): void;
|
||||
walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
||||
walkSourceContents(fn: (file: string, content: string) => void): void;
|
||||
join(sep: string): SourceNode;
|
||||
replaceRight(pattern: string, replacement: string): SourceNode;
|
||||
toString(): string;
|
||||
toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
|
||||
}
|
||||
8
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/source-map.js
generated
vendored
Normal file
8
backend/frontend/node_modules/postcss-advanced-variables/node_modules/source-map/source-map.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* Copyright 2009-2011 Mozilla Foundation and contributors
|
||||
* Licensed under the New BSD license. See LICENSE.txt or:
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*/
|
||||
exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
|
||||
exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
|
||||
exports.SourceNode = require('./lib/source-node').SourceNode;
|
||||
71
backend/frontend/node_modules/postcss-advanced-variables/package.json
generated
vendored
Normal file
71
backend/frontend/node_modules/postcss-advanced-variables/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "postcss-advanced-variables",
|
||||
"version": "3.0.1",
|
||||
"description": "Use Sass-like variables, conditionals, and iterators in CSS",
|
||||
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
||||
"license": "CC0-1.0",
|
||||
"repository": "jonathantneal/postcss-advanced-variables",
|
||||
"homepage": "https://github.com/jonathantneal/postcss-advanced-variables#readme",
|
||||
"bugs": "https://github.com/jonathantneal/postcss-advanced-variables/issues",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.mjs"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm test",
|
||||
"pretest": "rollup -c .rollup.js --silent",
|
||||
"test": "npm run test:js && npm run test:tape",
|
||||
"test:js": "eslint src/*.js src/lib/*.js --cache --ignore-path .gitignore --quiet",
|
||||
"test:tape": "postcss-tape"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@csstools/sass-import-resolve": "^1.0.0",
|
||||
"postcss": "^7.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
"@babel/plugin-external-helpers": "^7.0.0",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
"babel-eslint": "^10",
|
||||
"babel-plugin-array-includes": "^2.0.3",
|
||||
"eslint": "^5.9.0",
|
||||
"eslint-config-dev": "^2.0.0",
|
||||
"postcss-scss": "^2.0.0",
|
||||
"postcss-tape": "2.2",
|
||||
"pre-commit": "^1.2.2",
|
||||
"rollup": "^0.67.3",
|
||||
"rollup-plugin-babel": "^4.0.3"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "dev",
|
||||
"parser": "babel-eslint",
|
||||
"rules": {
|
||||
"consistent-return": [
|
||||
0
|
||||
],
|
||||
"max-params": [
|
||||
1,
|
||||
5
|
||||
]
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"postcss",
|
||||
"css",
|
||||
"postcss-plugin",
|
||||
"sass",
|
||||
"scss",
|
||||
"variables",
|
||||
"conditionals",
|
||||
"iterators",
|
||||
"fors",
|
||||
"eaches",
|
||||
"medias",
|
||||
"defaults"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user