@herb-tools/tailwind-class-sorter 0.9.6 → 0.9.7
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.
|
@@ -875,6 +875,18 @@ function requireStringifier () {
|
|
|
875
875
|
if (hasRequiredStringifier) return stringifier;
|
|
876
876
|
hasRequiredStringifier = 1;
|
|
877
877
|
|
|
878
|
+
// Escapes sequences that could break out of an HTML <style> context.
|
|
879
|
+
// Uses CSS unicode escaping (\3c = '<') which is valid CSS and parsed
|
|
880
|
+
// correctly by all compliant CSS consumers.
|
|
881
|
+
const STYLE_TAG = /(<)(\/?style\b)/gi;
|
|
882
|
+
const COMMENT_OPEN = /(<)(!--)/g;
|
|
883
|
+
|
|
884
|
+
function escapeHTMLInCSS(str) {
|
|
885
|
+
if (typeof str !== 'string') return str
|
|
886
|
+
if (!str.includes('<')) return str
|
|
887
|
+
return str.replace(STYLE_TAG, '\\3c $2').replace(COMMENT_OPEN, '\\3c $2')
|
|
888
|
+
}
|
|
889
|
+
|
|
878
890
|
const DEFAULT_RAW = {
|
|
879
891
|
after: '\n',
|
|
880
892
|
beforeClose: '\n',
|
|
@@ -913,7 +925,7 @@ function requireStringifier () {
|
|
|
913
925
|
this.block(node, name + params);
|
|
914
926
|
} else {
|
|
915
927
|
let end = (node.raws.between || '') + (semicolon ? ';' : '');
|
|
916
|
-
this.builder(name + params + end, node);
|
|
928
|
+
this.builder(escapeHTMLInCSS(name + params + end), node);
|
|
917
929
|
}
|
|
918
930
|
}
|
|
919
931
|
|
|
@@ -948,7 +960,7 @@ function requireStringifier () {
|
|
|
948
960
|
|
|
949
961
|
block(node, start) {
|
|
950
962
|
let between = this.raw(node, 'between', 'beforeOpen');
|
|
951
|
-
this.builder(start + between + '{', node, 'start');
|
|
963
|
+
this.builder(escapeHTMLInCSS(start + between) + '{', node, 'start');
|
|
952
964
|
|
|
953
965
|
let after;
|
|
954
966
|
if (node.nodes && node.nodes.length) {
|
|
@@ -958,7 +970,7 @@ function requireStringifier () {
|
|
|
958
970
|
after = this.raw(node, 'after', 'emptyBody');
|
|
959
971
|
}
|
|
960
972
|
|
|
961
|
-
if (after) this.builder(after);
|
|
973
|
+
if (after) this.builder(escapeHTMLInCSS(after));
|
|
962
974
|
this.builder('}', node, 'end');
|
|
963
975
|
}
|
|
964
976
|
|
|
@@ -970,10 +982,11 @@ function requireStringifier () {
|
|
|
970
982
|
}
|
|
971
983
|
|
|
972
984
|
let semicolon = this.raw(node, 'semicolon');
|
|
985
|
+
let isDocument = node.type === 'document';
|
|
973
986
|
for (let i = 0; i < node.nodes.length; i++) {
|
|
974
987
|
let child = node.nodes[i];
|
|
975
988
|
let before = this.raw(child, 'before');
|
|
976
|
-
if (before) this.builder(before);
|
|
989
|
+
if (before) this.builder(isDocument ? before : escapeHTMLInCSS(before));
|
|
977
990
|
this.stringify(child, last !== i || semicolon);
|
|
978
991
|
}
|
|
979
992
|
}
|
|
@@ -981,7 +994,7 @@ function requireStringifier () {
|
|
|
981
994
|
comment(node) {
|
|
982
995
|
let left = this.raw(node, 'left', 'commentLeft');
|
|
983
996
|
let right = this.raw(node, 'right', 'commentRight');
|
|
984
|
-
this.builder('/*' + left + node.text + right + '*/', node);
|
|
997
|
+
this.builder(escapeHTMLInCSS('/*' + left + node.text + right + '*/'), node);
|
|
985
998
|
}
|
|
986
999
|
|
|
987
1000
|
decl(node, semicolon) {
|
|
@@ -993,7 +1006,7 @@ function requireStringifier () {
|
|
|
993
1006
|
}
|
|
994
1007
|
|
|
995
1008
|
if (semicolon) string += ';';
|
|
996
|
-
this.builder(string, node);
|
|
1009
|
+
this.builder(escapeHTMLInCSS(string), node);
|
|
997
1010
|
}
|
|
998
1011
|
|
|
999
1012
|
document(node) {
|
|
@@ -1199,13 +1212,17 @@ function requireStringifier () {
|
|
|
1199
1212
|
|
|
1200
1213
|
root(node) {
|
|
1201
1214
|
this.body(node);
|
|
1202
|
-
if (node.raws.after)
|
|
1215
|
+
if (node.raws.after) {
|
|
1216
|
+
let after = node.raws.after;
|
|
1217
|
+
let isDocument = node.parent && node.parent.type === 'document';
|
|
1218
|
+
this.builder(isDocument ? after : escapeHTMLInCSS(after));
|
|
1219
|
+
}
|
|
1203
1220
|
}
|
|
1204
1221
|
|
|
1205
1222
|
rule(node) {
|
|
1206
1223
|
this.block(node, this.rawValue(node, 'selector'));
|
|
1207
1224
|
if (node.raws.ownSemicolon) {
|
|
1208
|
-
this.builder(node.raws.ownSemicolon, node, 'end');
|
|
1225
|
+
this.builder(escapeHTMLInCSS(node.raws.ownSemicolon), node, 'end');
|
|
1209
1226
|
}
|
|
1210
1227
|
}
|
|
1211
1228
|
|
|
@@ -5823,7 +5840,8 @@ function requirePreviousMap () {
|
|
|
5823
5840
|
return fromBase64(text.substr(baseUriMatch[0].length))
|
|
5824
5841
|
}
|
|
5825
5842
|
|
|
5826
|
-
let encoding = text.
|
|
5843
|
+
let encoding = text.slice('data:application/json;'.length);
|
|
5844
|
+
encoding = encoding.slice(0, encoding.indexOf(','));
|
|
5827
5845
|
throw new Error('Unsupported source map encoding ' + encoding)
|
|
5828
5846
|
}
|
|
5829
5847
|
|
|
@@ -6066,7 +6084,15 @@ function requireInput () {
|
|
|
6066
6084
|
);
|
|
6067
6085
|
}
|
|
6068
6086
|
|
|
6069
|
-
result.input = {
|
|
6087
|
+
result.input = {
|
|
6088
|
+
column,
|
|
6089
|
+
endColumn,
|
|
6090
|
+
endLine,
|
|
6091
|
+
endOffset,
|
|
6092
|
+
line,
|
|
6093
|
+
offset,
|
|
6094
|
+
source: this.css
|
|
6095
|
+
};
|
|
6070
6096
|
if (this.file) {
|
|
6071
6097
|
if (pathToFileURL) {
|
|
6072
6098
|
result.input.url = pathToFileURL(this.file).toString();
|
|
@@ -8159,7 +8185,7 @@ function requireNoWorkResult () {
|
|
|
8159
8185
|
|
|
8160
8186
|
let MapGenerator = requireMapGenerator();
|
|
8161
8187
|
let parse = requireParse$1();
|
|
8162
|
-
|
|
8188
|
+
let Result = requireResult();
|
|
8163
8189
|
let stringify = requireStringify$1();
|
|
8164
8190
|
let warnOnce = requireWarnOnce();
|
|
8165
8191
|
|
|
@@ -8309,7 +8335,7 @@ function requireProcessor () {
|
|
|
8309
8335
|
|
|
8310
8336
|
class Processor {
|
|
8311
8337
|
constructor(plugins = []) {
|
|
8312
|
-
this.version = '8.5.
|
|
8338
|
+
this.version = '8.5.10';
|
|
8313
8339
|
this.plugins = this.normalize(plugins);
|
|
8314
8340
|
}
|
|
8315
8341
|
|