postcss 2.2.2 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/ChangeLog.md +13 -0
- package/README.md +309 -241
- package/lib/at-rule.js +15 -15
- package/lib/comment.js +7 -7
- package/lib/container.js +58 -58
- package/lib/css-syntax-error.js +7 -7
- package/lib/declaration.js +9 -9
- package/lib/list.js +2 -2
- package/lib/map-generator.js +42 -40
- package/lib/node.js +21 -21
- package/lib/parse.js +73 -73
- package/lib/postcss.js +12 -11
- package/lib/previous-map.js +17 -17
- package/lib/result.js +7 -7
- package/lib/root.js +11 -11
- package/lib/rule.js +9 -9
- package/package.json +10 -10
package/lib/parse.js
CHANGED
@@ -13,7 +13,7 @@ var isSpace = /\s/;
|
|
13
13
|
var sequence = 0;
|
14
14
|
|
15
15
|
// CSS parser
|
16
|
-
var Parser = (function(){var DP$0 = Object.defineProperty;
|
16
|
+
var Parser = (function(){"use strict";var PRS$0 = (function(o,t){o["__proto__"]={"a":t};return o["a"]===t})({},{});var DP$0 = Object.defineProperty;var GOPD$0 = Object.getOwnPropertyDescriptor;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,GOPD$0(s,p));}}return t};var proto$0={};
|
17
17
|
function Parser(source) {var opts = arguments[1];if(opts === void 0)opts = { };
|
18
18
|
this.source = source.toString();
|
19
19
|
this.opts = opts;
|
@@ -31,9 +31,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
31
31
|
this.lines = [];
|
32
32
|
this.column = 0;
|
33
33
|
this.buffer = '';
|
34
|
-
}DP$0(Parser,
|
34
|
+
}DP$0(Parser,"prototype",{"configurable":false,"enumerable":false,"writable":false});
|
35
35
|
|
36
|
-
|
36
|
+
proto$0.loop = function() {
|
37
37
|
this.next = this.source[0];
|
38
38
|
var length = this.source.length - 1;
|
39
39
|
while ( this.pos < length ) {
|
@@ -41,17 +41,17 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
41
41
|
this.nextLetter();
|
42
42
|
}
|
43
43
|
this.endFile();
|
44
|
-
}
|
44
|
+
};
|
45
45
|
|
46
|
-
|
46
|
+
proto$0.setMap = function() {
|
47
47
|
var map = new PreviousMap(this.root, this.opts, this.id);
|
48
48
|
if ( map.text ) {
|
49
49
|
this.root.prevMap = map;
|
50
50
|
this.root.eachInside( function(i ) {return i.source.map = map} );
|
51
51
|
}
|
52
|
-
}
|
52
|
+
};
|
53
53
|
|
54
|
-
|
54
|
+
proto$0.nextLetter = function() {
|
55
55
|
return this.inString() ||
|
56
56
|
this.inComment() ||
|
57
57
|
this.isComment() ||
|
@@ -63,11 +63,11 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
63
63
|
this.isBlockEnd() ||
|
64
64
|
this.inSelector() || this.isSelector() ||
|
65
65
|
this.inProperty() || this.isProperty() || this.inValue();
|
66
|
-
}
|
66
|
+
};
|
67
67
|
|
68
68
|
// Parsers
|
69
69
|
|
70
|
-
|
70
|
+
proto$0.inString = function(close) {
|
71
71
|
if ( this.quote ) {
|
72
72
|
if ( this.escape && !close ) {
|
73
73
|
this.escape = false;
|
@@ -80,9 +80,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
80
80
|
|
81
81
|
return true;
|
82
82
|
}
|
83
|
-
}
|
83
|
+
};
|
84
84
|
|
85
|
-
|
85
|
+
proto$0.isString = function() {
|
86
86
|
if ( this.letter == '"' || this.letter == "'" ) {
|
87
87
|
this.quote = this.letter;
|
88
88
|
this.quotePos = { line: this.line, column: this.column };
|
@@ -90,9 +90,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
90
90
|
|
91
91
|
return true;
|
92
92
|
}
|
93
|
-
}
|
93
|
+
};
|
94
94
|
|
95
|
-
|
95
|
+
proto$0.inComment = function(close) {var $D$0;
|
96
96
|
if ( this.inside('comment') ) {
|
97
97
|
if ( close || ( this.letter == '*' && this.next == '/' ) ) {
|
98
98
|
var text, left, right;
|
@@ -113,9 +113,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
113
113
|
}
|
114
114
|
return true;
|
115
115
|
}
|
116
|
-
}
|
116
|
+
};
|
117
117
|
|
118
|
-
|
118
|
+
proto$0.isComment = function() {
|
119
119
|
if ( this.letter == '/' && this.next == '*' ) {
|
120
120
|
if ( this.inside('rules') || this.inside('decls') ) {
|
121
121
|
this.init( new Comment() );
|
@@ -129,9 +129,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
129
129
|
return true;
|
130
130
|
}
|
131
131
|
}
|
132
|
-
}
|
132
|
+
};
|
133
133
|
|
134
|
-
|
134
|
+
proto$0.isWrong = function() {
|
135
135
|
if ( this.letter == '{' ) {
|
136
136
|
if ( this.inside('decls') || this.inside('value') ) {
|
137
137
|
this.error("Unexpected {");
|
@@ -151,9 +151,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
151
151
|
}
|
152
152
|
}
|
153
153
|
}
|
154
|
-
}
|
154
|
+
};
|
155
155
|
|
156
|
-
|
156
|
+
proto$0.isAtrule = function() {
|
157
157
|
if ( this.letter == '@' && this.inside('rules') ) {
|
158
158
|
this.init( new AtRule() );
|
159
159
|
this.current.name = '';
|
@@ -161,9 +161,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
161
161
|
|
162
162
|
return true;
|
163
163
|
}
|
164
|
-
}
|
164
|
+
};
|
165
165
|
|
166
|
-
|
166
|
+
proto$0.inAtrule = function(close) {var $D$1;
|
167
167
|
if ( this.inside('atrule-name') ) {
|
168
168
|
if ( this.space() ) {
|
169
169
|
this.checkAtruleName();
|
@@ -201,9 +201,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
201
201
|
}
|
202
202
|
return true;
|
203
203
|
}
|
204
|
-
}
|
204
|
+
};
|
205
205
|
|
206
|
-
|
206
|
+
proto$0.inSelector = function() {var $D$2;
|
207
207
|
if ( this.inside('selector') ) {
|
208
208
|
if ( this.letter == '{' ) {
|
209
209
|
var raw, spaces;
|
@@ -219,9 +219,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
219
219
|
|
220
220
|
return true;
|
221
221
|
}
|
222
|
-
}
|
222
|
+
};
|
223
223
|
|
224
|
-
|
224
|
+
proto$0.isSelector = function() {
|
225
225
|
if ( !this.space() && this.inside('rules') ) {
|
226
226
|
this.init( new Rule() );
|
227
227
|
|
@@ -239,9 +239,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
239
239
|
|
240
240
|
return true;
|
241
241
|
}
|
242
|
-
}
|
242
|
+
};
|
243
243
|
|
244
|
-
|
244
|
+
proto$0.isBlockEnd = function(close) {var this$0 = this;
|
245
245
|
if ( this.letter == '}' || close ) {
|
246
246
|
if ( this.parents.length == 1 ) {
|
247
247
|
if ( !this.opts.safe ) {
|
@@ -261,9 +261,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
261
261
|
|
262
262
|
return true;
|
263
263
|
}
|
264
|
-
}
|
264
|
+
};
|
265
265
|
|
266
|
-
|
266
|
+
proto$0.inProperty = function(close) {
|
267
267
|
if ( this.inside('prop') ) {
|
268
268
|
if ( this.letter == ':' || close ) {
|
269
269
|
if ( this.buffer[0] == '*' || this.buffer[0] == '_' ) {
|
@@ -292,9 +292,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
292
292
|
|
293
293
|
return true;
|
294
294
|
}
|
295
|
-
}
|
295
|
+
};
|
296
296
|
|
297
|
-
|
297
|
+
proto$0.isProperty = function() {
|
298
298
|
if ( this.inside('decls') && !this.space() && this.letter != ';' ) {
|
299
299
|
this.init( new Declaration() );
|
300
300
|
this.addType('prop');
|
@@ -305,9 +305,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
305
305
|
|
306
306
|
return true;
|
307
307
|
}
|
308
|
-
}
|
308
|
+
};
|
309
309
|
|
310
|
-
|
310
|
+
proto$0.inValue = function(close) {var $D$3;
|
311
311
|
if ( this.inside('value') ) {
|
312
312
|
if ( this.letter == '(' ) {
|
313
313
|
this.inBrackets = true;
|
@@ -341,9 +341,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
341
341
|
|
342
342
|
return true;
|
343
343
|
}
|
344
|
-
}
|
344
|
+
};
|
345
345
|
|
346
|
-
|
346
|
+
proto$0.endFile = function() {var this$0 = this;
|
347
347
|
if ( this.inside('atrule-param') || this.inside('atrule-name') ) {
|
348
348
|
this.fixEnd( function() {return this$0.inAtrule('close')} );
|
349
349
|
}
|
@@ -379,15 +379,15 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
379
379
|
} else {
|
380
380
|
this.root.after = this.buffer;
|
381
381
|
}
|
382
|
-
}
|
382
|
+
};
|
383
383
|
|
384
384
|
// Helpers
|
385
385
|
|
386
|
-
|
386
|
+
proto$0.error = function(message) {var pos = arguments[1];if(pos === void 0)pos = { line: this.line, column: this.column };
|
387
387
|
throw new CssSyntaxError(message, this.source, pos, this.opts.from);
|
388
|
-
}
|
388
|
+
};
|
389
389
|
|
390
|
-
|
390
|
+
proto$0.move = function() {
|
391
391
|
this.pos += 1;
|
392
392
|
this.column += 1;
|
393
393
|
this.letter = this.next;
|
@@ -399,21 +399,21 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
399
399
|
this.line += 1;
|
400
400
|
this.column = 0;
|
401
401
|
}
|
402
|
-
}
|
402
|
+
};
|
403
403
|
|
404
|
-
|
404
|
+
proto$0.prevBuffer = function() {
|
405
405
|
return this.buffer.slice(0, -1);
|
406
|
-
}
|
406
|
+
};
|
407
407
|
|
408
|
-
|
408
|
+
proto$0.inside = function(type) {
|
409
409
|
return this.type == type;
|
410
|
-
}
|
410
|
+
};
|
411
411
|
|
412
|
-
|
412
|
+
proto$0.space = function() {
|
413
413
|
return this.letter.trim() === '';
|
414
|
-
}
|
414
|
+
};
|
415
415
|
|
416
|
-
|
416
|
+
proto$0.init = function(node) {
|
417
417
|
this.current.push(node);
|
418
418
|
this.parents.push(node);
|
419
419
|
this.current = node;
|
@@ -432,16 +432,16 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
432
432
|
}
|
433
433
|
this.current.before = this.buffer.slice(0, -1);
|
434
434
|
this.buffer = '';
|
435
|
-
}
|
435
|
+
};
|
436
436
|
|
437
|
-
|
437
|
+
proto$0.raw = function(prop, value, origin) {
|
438
438
|
this.current[prop] = value;
|
439
439
|
if ( value != origin ) {
|
440
440
|
this.current['_' + prop] = { value: value, raw: origin };
|
441
441
|
}
|
442
|
-
}
|
442
|
+
};
|
443
443
|
|
444
|
-
|
444
|
+
proto$0.fixEnd = function(callback) {
|
445
445
|
var start, after;
|
446
446
|
if ( this.letter == '}' ) {
|
447
447
|
start = this.buffer.search(/\s*\}$/);
|
@@ -468,9 +468,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
468
468
|
|
469
469
|
this.current.after = after;
|
470
470
|
this.buffer = after;
|
471
|
-
}
|
471
|
+
};
|
472
472
|
|
473
|
-
|
473
|
+
proto$0.pop = function() {
|
474
474
|
this.current.source.end = {
|
475
475
|
line: this.line,
|
476
476
|
column: this.column
|
@@ -480,24 +480,24 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
480
480
|
this.parents.pop();
|
481
481
|
this.current = this.parents[this.parents.length - 1];
|
482
482
|
this.buffer = '';
|
483
|
-
}
|
483
|
+
};
|
484
484
|
|
485
|
-
|
485
|
+
proto$0.addType = function(type) {
|
486
486
|
this.types.push(type);
|
487
487
|
this.type = type;
|
488
|
-
}
|
488
|
+
};
|
489
489
|
|
490
|
-
|
490
|
+
proto$0.setType = function(type) {
|
491
491
|
this.types[this.types.length - 1] = type;
|
492
492
|
this.type = type;
|
493
|
-
}
|
493
|
+
};
|
494
494
|
|
495
|
-
|
495
|
+
proto$0.popType = function() {
|
496
496
|
this.types.pop();
|
497
497
|
this.type = this.types[this.types.length - 1];
|
498
|
-
}
|
498
|
+
};
|
499
499
|
|
500
|
-
|
500
|
+
proto$0.atruleType = function() {
|
501
501
|
var name = this.current.name.toLowerCase();
|
502
502
|
if ( name == 'page' || name == 'font-face' ) {
|
503
503
|
return 'decls';
|
@@ -506,9 +506,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
506
506
|
} else {
|
507
507
|
return 'rules';
|
508
508
|
}
|
509
|
-
}
|
509
|
+
};
|
510
510
|
|
511
|
-
|
511
|
+
proto$0.endAtruleParams = function() {
|
512
512
|
if ( this.letter == '{' ) {
|
513
513
|
var type = this.atruleType();
|
514
514
|
this.current.addMixin(type);
|
@@ -518,13 +518,13 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
518
518
|
if ( this.letter == ';' ) this.current.semicolon = true;
|
519
519
|
this.pop();
|
520
520
|
}
|
521
|
-
}
|
521
|
+
};
|
522
522
|
|
523
|
-
|
523
|
+
proto$0.checkAtruleName = function() {
|
524
524
|
if ( this.current.name === '' ) this.error('At-rule without name');
|
525
|
-
}
|
525
|
+
};
|
526
526
|
|
527
|
-
|
527
|
+
proto$0.startSpaces = function(string) {
|
528
528
|
var match = string.match(/^\s+/);
|
529
529
|
if ( match ) {
|
530
530
|
var pos = match[0].length;
|
@@ -532,9 +532,9 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
532
532
|
} else {
|
533
533
|
return [string, ''];
|
534
534
|
}
|
535
|
-
}
|
535
|
+
};
|
536
536
|
|
537
|
-
|
537
|
+
proto$0.endSpaces = function(string) {
|
538
538
|
var match = string.match(/\s+$/);
|
539
539
|
if ( match ) {
|
540
540
|
var pos = match[0].length;
|
@@ -542,15 +542,15 @@ var Parser = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
542
542
|
} else {
|
543
543
|
return [string, ''];
|
544
544
|
}
|
545
|
-
}
|
545
|
+
};
|
546
546
|
|
547
|
-
|
547
|
+
proto$0.closeBlocks = function() {
|
548
548
|
for ( var i = 0; i < this.parents.length; i++ ) {
|
549
549
|
this.buffer += '{';
|
550
550
|
this.isBlockEnd('close');
|
551
551
|
}
|
552
|
-
}
|
553
|
-
;return Parser;})();
|
552
|
+
};
|
553
|
+
MIXIN$0(Parser.prototype,proto$0);proto$0=void 0;return Parser;})();
|
554
554
|
|
555
555
|
module.exports = function (source) {var opts = arguments[1];if(opts === void 0)opts = { };
|
556
556
|
if ( opts.map == 'inline' ) opts.map = { inline: true };
|
package/lib/postcss.js
CHANGED
@@ -6,20 +6,20 @@ var Rule = require('./rule');
|
|
6
6
|
var Root = require('./root');
|
7
7
|
|
8
8
|
// List of functions to process CSS
|
9
|
-
var PostCSS = (function(){var DP$0 = Object.defineProperty;
|
9
|
+
var PostCSS = (function(){"use strict";var PRS$0 = (function(o,t){o["__proto__"]={"a":t};return o["a"]===t})({},{});var DP$0 = Object.defineProperty;var GOPD$0 = Object.getOwnPropertyDescriptor;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,GOPD$0(s,p));}}return t};var proto$0={};
|
10
10
|
function PostCSS() {var processors = arguments[0];if(processors === void 0)processors = [];var this$0 = this;
|
11
11
|
this.processors = processors.map( function(i) {return this$0.normalize(i)} );
|
12
|
-
}DP$0(PostCSS,
|
12
|
+
}DP$0(PostCSS,"prototype",{"configurable":false,"enumerable":false,"writable":false});
|
13
13
|
|
14
14
|
// Add another function to CSS processors
|
15
|
-
|
15
|
+
proto$0.use = function(processor) {
|
16
16
|
processor = this.normalize(processor);
|
17
17
|
this.processors.push(processor);
|
18
18
|
return this;
|
19
|
-
}
|
19
|
+
};
|
20
20
|
|
21
21
|
// Process CSS throw installed processors
|
22
|
-
|
22
|
+
proto$0.process = function(css) {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;var $D$3;var opts = arguments[1];if(opts === void 0)opts = { };
|
23
23
|
if ( opts.map == 'inline' ) opts.map = { inline: true };
|
24
24
|
|
25
25
|
var parsed;
|
@@ -31,23 +31,24 @@ var PostCSS = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
31
31
|
parsed = postcss.parse(css, opts);
|
32
32
|
}
|
33
33
|
|
34
|
-
$D$3 = (this.processors);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for ( var processor
|
34
|
+
$D$3 = (this.processors);$D$0 = GET_ITER$0($D$3);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? $D$3.length : void 0);for ( var processor ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){processor = ($D$2 ? $D$3[$D$0++] : $D$1["value"]);
|
35
35
|
var returned = processor(parsed, opts);
|
36
36
|
if ( returned instanceof Root ) parsed = returned;
|
37
37
|
};$D$0 = $D$1 = $D$2 = $D$3 = void 0;
|
38
38
|
|
39
39
|
return parsed.toResult(opts);
|
40
|
-
}
|
40
|
+
};
|
41
41
|
|
42
42
|
// Return processor function
|
43
|
-
|
44
|
-
|
43
|
+
proto$0.normalize = function(processor) {
|
44
|
+
var type = typeof(processor);
|
45
|
+
if ( (type == 'object' || type == 'function') && processor.postcss ) {
|
45
46
|
return processor.postcss;
|
46
47
|
} else {
|
47
48
|
return processor;
|
48
49
|
}
|
49
|
-
}
|
50
|
-
;return PostCSS;})();
|
50
|
+
};
|
51
|
+
MIXIN$0(PostCSS.prototype,proto$0);proto$0=void 0;return PostCSS;})();
|
51
52
|
|
52
53
|
// Framework for CSS postprocessors
|
53
54
|
//
|
package/lib/previous-map.js
CHANGED
@@ -4,7 +4,7 @@ var path = require('path');
|
|
4
4
|
var fs = require('fs');
|
5
5
|
|
6
6
|
// Detect previous map
|
7
|
-
var PreviousMap = (function(){var DP$0 = Object.defineProperty;
|
7
|
+
var PreviousMap = (function(){"use strict";var PRS$0 = (function(o,t){o["__proto__"]={"a":t};return o["a"]===t})({},{});var DP$0 = Object.defineProperty;var GOPD$0 = Object.getOwnPropertyDescriptor;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,GOPD$0(s,p));}}return t};var proto$0={};
|
8
8
|
function PreviousMap(root, opts, id) {
|
9
9
|
this.file = opts.from || id;
|
10
10
|
|
@@ -14,30 +14,30 @@ var PreviousMap = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
14
14
|
|
15
15
|
var text = this.loadMap(opts.map ? opts.map.prev : undefined);
|
16
16
|
if ( text ) this.text = text;
|
17
|
-
}DP$0(PreviousMap,
|
17
|
+
}DP$0(PreviousMap,"prototype",{"configurable":false,"enumerable":false,"writable":false});
|
18
18
|
|
19
19
|
// Return SourceMapConsumer object to read map
|
20
|
-
|
20
|
+
proto$0.consumer = function() {
|
21
21
|
if ( !this.consumerCache ) {
|
22
22
|
this.consumerCache = new mozilla.SourceMapConsumer(this.text);
|
23
23
|
}
|
24
24
|
return this.consumerCache;
|
25
|
-
}
|
25
|
+
};
|
26
26
|
|
27
27
|
// Is map has sources content
|
28
|
-
|
28
|
+
proto$0.withContent = function() {
|
29
29
|
return !!(this.consumer().sourcesContent &&
|
30
30
|
this.consumer().sourcesContent.length > 0);
|
31
|
-
}
|
31
|
+
};
|
32
32
|
|
33
33
|
// Is `string` is starting with `start`
|
34
|
-
|
34
|
+
proto$0.startWith = function(string, start) {
|
35
35
|
if ( !string ) return false;
|
36
36
|
return string.substr(0, start.length) == start;
|
37
|
-
}
|
37
|
+
};
|
38
38
|
|
39
39
|
// Load for annotation comment from previous compilation step
|
40
|
-
|
40
|
+
proto$0.loadAnnotation = function(root) {
|
41
41
|
var last = root.last;
|
42
42
|
if ( !last ) return;
|
43
43
|
if ( last.type != 'comment' ) return;
|
@@ -45,10 +45,10 @@ var PreviousMap = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
45
45
|
if ( this.startWith(last.text, '# sourceMappingURL=') ) {
|
46
46
|
this.annotation = last.text;
|
47
47
|
}
|
48
|
-
}
|
48
|
+
};
|
49
49
|
|
50
50
|
// Encode different type of inline
|
51
|
-
|
51
|
+
proto$0.decodeInline = function(text) {
|
52
52
|
var uri = '# sourceMappingURL=data:application/json,';
|
53
53
|
var base64 = '# sourceMappingURL=data:application/json;base64,';
|
54
54
|
|
@@ -59,13 +59,13 @@ var PreviousMap = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
59
59
|
return Base64.decode( text.substr(base64.length) );
|
60
60
|
|
61
61
|
} else {
|
62
|
-
var encoding = text.match(/
|
62
|
+
var encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
63
63
|
throw new Error('Unsupported source map encoding ' + encoding);
|
64
64
|
}
|
65
|
-
}
|
65
|
+
};
|
66
66
|
|
67
67
|
// Load previous map
|
68
|
-
|
68
|
+
proto$0.loadMap = function(prev) {
|
69
69
|
if ( prev === false ) return;
|
70
70
|
|
71
71
|
if ( prev ) {
|
@@ -92,10 +92,10 @@ var PreviousMap = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
92
92
|
|
93
93
|
this.root = path.dirname(map);
|
94
94
|
if ( fs.existsSync && fs.existsSync(map) ) {
|
95
|
-
return fs.readFileSync(map, 'utf-8').toString();
|
95
|
+
return fs.readFileSync(map, 'utf-8').toString().trim();
|
96
96
|
}
|
97
97
|
}
|
98
|
-
}
|
99
|
-
;return PreviousMap;})();
|
98
|
+
};
|
99
|
+
MIXIN$0(PreviousMap.prototype,proto$0);proto$0=void 0;return PreviousMap;})();
|
100
100
|
|
101
101
|
module.exports = PreviousMap;
|
package/lib/result.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
var MapGenerator = require('./map-generator');
|
2
2
|
|
3
3
|
// Object with processed CSS
|
4
|
-
var Result = (function(){var DP$0 = Object.defineProperty;
|
4
|
+
var Result = (function(){"use strict";var PRS$0 = (function(o,t){o["__proto__"]={"a":t};return o["a"]===t})({},{});var DP$0 = Object.defineProperty;var GOPD$0 = Object.getOwnPropertyDescriptor;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,GOPD$0(s,p));}}return t};var DPS$0 = Object.defineProperties;var proto$0={};
|
5
5
|
function Result(root) {var opts = arguments[1];if(opts === void 0)opts = { };
|
6
6
|
this.root = root;
|
7
7
|
this.opts = opts;
|
8
|
-
}
|
8
|
+
}DPS$0(Result.prototype,{map: {"get": map$get$0, "configurable":true,"enumerable":true}, css: {"get": css$get$0, "configurable":true,"enumerable":true}});DP$0(Result,"prototype",{"configurable":false,"enumerable":false,"writable":false});
|
9
9
|
|
10
10
|
// Lazy method to return source map
|
11
11
|
function map$get$0() {
|
@@ -20,17 +20,17 @@ var Result = (function(){var DP$0 = Object.defineProperty;"use strict";
|
|
20
20
|
}
|
21
21
|
|
22
22
|
// Return CSS string on any try to print
|
23
|
-
|
23
|
+
proto$0.toString = function() {
|
24
24
|
return this.css;
|
25
|
-
}
|
25
|
+
};
|
26
26
|
|
27
27
|
// Generate CSS and map
|
28
|
-
|
28
|
+
proto$0.stringify = function() {
|
29
29
|
var map = new MapGenerator(this.root, this.opts);
|
30
30
|
var generated = map.generate();
|
31
31
|
this.cssCached = generated[0];
|
32
32
|
this.mapCached = generated[1];
|
33
|
-
}
|
34
|
-
;return Result;})();
|
33
|
+
};
|
34
|
+
MIXIN$0(Result.prototype,proto$0);proto$0=void 0;return Result;})();
|
35
35
|
|
36
36
|
module.exports = Result;
|
package/lib/root.js
CHANGED
@@ -6,22 +6,22 @@ var Result = require('./result');
|
|
6
6
|
var Rule = require('./rule');
|
7
7
|
|
8
8
|
// Root of CSS
|
9
|
-
var Root = (function(super$0){var DP$0 = Object.defineProperty;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,
|
9
|
+
var Root = (function(super$0){"use strict";var PRS$0 = (function(o,t){o["__proto__"]={"a":t};return o["a"]===t})({},{});var DP$0 = Object.defineProperty;var GOPD$0 = Object.getOwnPropertyDescriptor;var MIXIN$0 = function(t,s){for(var p in s){if(s.hasOwnProperty(p)){DP$0(t,p,GOPD$0(s,p));}}return t};var SP$0 = Object.setPrototypeOf||function(o,p){o["__proto__"]=p;return o};var OC$0 = Object.create;if(!PRS$0)MIXIN$0(Root, super$0);var proto$0={};
|
10
10
|
function Root(defaults) {
|
11
11
|
this.type = 'root';
|
12
12
|
this.rules = [];
|
13
13
|
super$0.call(this, defaults);
|
14
|
-
}Root.prototype =
|
14
|
+
}if(super$0!==null)SP$0(Root,super$0);Root.prototype = OC$0(super$0!==null?super$0.prototype:null,{"constructor":{"value":Root,"configurable":true,"writable":true}});DP$0(Root,"prototype",{"configurable":false,"enumerable":false,"writable":false});
|
15
15
|
|
16
16
|
// Fix spaces on insert before first rule
|
17
|
-
|
17
|
+
proto$0.normalize = function(child, sample, type) {var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$0;var $D$1;var $D$2;
|
18
18
|
var childs = super$0.prototype.normalize.call(this, child, sample, type);
|
19
19
|
|
20
|
-
$D$0 = GET_ITER$0(childs);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? childs.length : void 0);for ( child
|
20
|
+
$D$0 = GET_ITER$0(childs);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? childs.length : void 0);for ( child ;$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];){child = ($D$2 ? childs[$D$0++] : $D$1["value"]);
|
21
21
|
if ( type == 'prepend' ) {
|
22
22
|
if ( this.rules.length > 1 ) {
|
23
23
|
sample.before = this.rules[1].before;
|
24
|
-
} else {
|
24
|
+
} else if ( this.rules.length == 1 ) {
|
25
25
|
sample.before = this.after;
|
26
26
|
}
|
27
27
|
} else {
|
@@ -34,18 +34,18 @@ var Root = (function(super$0){var DP$0 = Object.defineProperty;var MIXIN$0 = fun
|
|
34
34
|
};$D$0 = $D$1 = $D$2 = void 0;
|
35
35
|
|
36
36
|
return childs;
|
37
|
-
}
|
37
|
+
};
|
38
38
|
|
39
39
|
// Stringify styles
|
40
|
-
|
40
|
+
proto$0.stringify = function(builder) {
|
41
41
|
this.stringifyContent(builder);
|
42
42
|
if ( this.after) builder(this.after);
|
43
|
-
}
|
43
|
+
};
|
44
44
|
|
45
45
|
// Generate processing result with optional source map
|
46
|
-
|
46
|
+
proto$0.toResult = function() {var opts = arguments[0];if(opts === void 0)opts = { };
|
47
47
|
return new Result(this, opts);
|
48
|
-
}
|
49
|
-
;return Root;})(Container.WithRules);
|
48
|
+
};
|
49
|
+
MIXIN$0(Root.prototype,proto$0);proto$0=void 0;return Root;})(Container.WithRules);
|
50
50
|
|
51
51
|
module.exports = Root;
|