selparsecss-selector 1.0.0

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.
Files changed (45) hide show
  1. package/API.md +874 -0
  2. package/CHANGELOG.md +573 -0
  3. package/LICENSE-MIT +22 -0
  4. package/README.md +87 -0
  5. package/dist/index.js +45 -0
  6. package/dist/parser.js +1116 -0
  7. package/dist/processor.js +153 -0
  8. package/dist/selectors/attribute.js +440 -0
  9. package/dist/selectors/className.js +59 -0
  10. package/dist/selectors/combinator.js +33 -0
  11. package/dist/selectors/comment.js +33 -0
  12. package/dist/selectors/constructors.js +43 -0
  13. package/dist/selectors/container.js +433 -0
  14. package/dist/selectors/fragment.js +13 -0
  15. package/dist/selectors/guards.js +61 -0
  16. package/dist/selectors/id.js +36 -0
  17. package/dist/selectors/index.js +20 -0
  18. package/dist/selectors/namespace.js +96 -0
  19. package/dist/selectors/nesting.js +34 -0
  20. package/dist/selectors/node.js +195 -0
  21. package/dist/selectors/pseudo.js +45 -0
  22. package/dist/selectors/root.js +56 -0
  23. package/dist/selectors/selector.js +33 -0
  24. package/dist/selectors/string.js +33 -0
  25. package/dist/selectors/tag.js +33 -0
  26. package/dist/selectors/types.js +16 -0
  27. package/dist/selectors/universal.js +34 -0
  28. package/dist/selectors/wrapper.js +14 -0
  29. package/dist/sortAscending.js +7 -0
  30. package/dist/tokenTypes.js +37 -0
  31. package/dist/tokenize.js +301 -0
  32. package/dist/util/ensureObject.js +17 -0
  33. package/dist/util/getProp.js +18 -0
  34. package/dist/util/index.js +18 -0
  35. package/dist/util/maxNestingDepth.js +25 -0
  36. package/dist/util/propAssemble.js +5 -0
  37. package/dist/util/propBind.js +9 -0
  38. package/dist/util/propCache.js +9 -0
  39. package/dist/util/propPaths.js +8 -0
  40. package/dist/util/propSync.js +11 -0
  41. package/dist/util/stripComments.js +20 -0
  42. package/dist/util/unesc.js +71 -0
  43. package/dist/util/webpack.min.js +1 -0
  44. package/package.json +62 -0
  45. package/selparsecss-selector.d.ts +570 -0
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var cssesc_1 = __importDefault(require("cssesc"));
22
+ var util_1 = require("../util");
23
+ var node_1 = __importDefault(require("./node"));
24
+ var Namespace = /** @class */ (function (_super) {
25
+ __extends(Namespace, _super);
26
+ function Namespace() {
27
+ return _super !== null && _super.apply(this, arguments) || this;
28
+ }
29
+ Object.defineProperty(Namespace.prototype, "namespace", {
30
+ get: function () {
31
+ return this._namespace;
32
+ },
33
+ set: function (namespace) {
34
+ if (namespace === true || namespace === "*" || namespace === "&") {
35
+ this._namespace = namespace;
36
+ if (this.raws) {
37
+ delete this.raws.namespace;
38
+ }
39
+ return;
40
+ }
41
+ var escaped = (0, cssesc_1.default)(namespace, { isIdentifier: true });
42
+ this._namespace = namespace;
43
+ if (escaped !== namespace) {
44
+ (0, util_1.ensureObject)(this, "raws");
45
+ this.raws.namespace = escaped;
46
+ }
47
+ else if (this.raws) {
48
+ delete this.raws.namespace;
49
+ }
50
+ },
51
+ enumerable: false,
52
+ configurable: true
53
+ });
54
+ Object.defineProperty(Namespace.prototype, "ns", {
55
+ get: function () {
56
+ return this._namespace;
57
+ },
58
+ set: function (namespace) {
59
+ this.namespace = namespace;
60
+ },
61
+ enumerable: false,
62
+ configurable: true
63
+ });
64
+ Object.defineProperty(Namespace.prototype, "namespaceString", {
65
+ get: function () {
66
+ if (this.namespace) {
67
+ var ns = this.stringifyProperty("namespace");
68
+ if (ns === true) {
69
+ return "";
70
+ }
71
+ else {
72
+ return ns;
73
+ }
74
+ }
75
+ else {
76
+ return "";
77
+ }
78
+ },
79
+ enumerable: false,
80
+ configurable: true
81
+ });
82
+ Namespace.prototype.qualifiedName = function (value) {
83
+ if (this.namespace) {
84
+ return "".concat(this.namespaceString, "|").concat(value);
85
+ }
86
+ else {
87
+ return value;
88
+ }
89
+ };
90
+ Namespace.prototype.valueToString = function () {
91
+ return this.qualifiedName(_super.prototype.valueToString.call(this));
92
+ };
93
+ return Namespace;
94
+ }(node_1.default));
95
+ exports.default = Namespace;
96
+ //# sourceMappingURL=namespace.js.map
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var node_1 = __importDefault(require("./node"));
22
+ var types_1 = require("./types");
23
+ var Nesting = /** @class */ (function (_super) {
24
+ __extends(Nesting, _super);
25
+ function Nesting(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.NESTING;
28
+ _this.value = "&";
29
+ return _this;
30
+ }
31
+ return Nesting;
32
+ }(node_1.default));
33
+ exports.default = Nesting;
34
+ //# sourceMappingURL=nesting.js.map
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var util_1 = require("../util");
4
+ var cloneNode = function (obj, parent, depth) {
5
+ if (depth === void 0) { depth = 0; }
6
+ // Bound recursion so a pathologically deep node tree raises a catchable
7
+ // error instead of overflowing the call stack (CVE-2026-9358 / CWE-674).
8
+ if (depth > util_1.MAX_NESTING_DEPTH) {
9
+ throw new Error("Cannot clone selector: nesting depth exceeds the maximum of ".concat(util_1.MAX_NESTING_DEPTH, "."));
10
+ }
11
+ if (typeof obj !== "object" || obj === null) {
12
+ return obj;
13
+ }
14
+ var cloned = new obj.constructor();
15
+ for (var i in obj) {
16
+ if (!obj.hasOwnProperty(i)) {
17
+ continue;
18
+ }
19
+ var value = obj[i];
20
+ var type = typeof value;
21
+ if (i === "parent" && type === "object") {
22
+ if (parent) {
23
+ cloned[i] = parent;
24
+ }
25
+ }
26
+ else if (value instanceof Array) {
27
+ cloned[i] = value.map(function (j) { return cloneNode(j, cloned, depth + 1); });
28
+ }
29
+ else {
30
+ cloned[i] = cloneNode(value, cloned, depth + 1);
31
+ }
32
+ }
33
+ return cloned;
34
+ };
35
+ var Node = /** @class */ (function () {
36
+ function Node(opts) {
37
+ if (opts === void 0) { opts = {}; }
38
+ Object.assign(this, opts);
39
+ this.spaces = this.spaces || {};
40
+ this.spaces.before = this.spaces.before || "";
41
+ this.spaces.after = this.spaces.after || "";
42
+ }
43
+ Node.prototype.remove = function () {
44
+ if (this.parent) {
45
+ this.parent.removeChild(this);
46
+ }
47
+ this.parent = undefined;
48
+ return this;
49
+ };
50
+ Node.prototype.replaceWith = function () {
51
+ if (this.parent) {
52
+ for (var index in arguments) {
53
+ this.parent.insertBefore(this, arguments[index]);
54
+ }
55
+ this.remove();
56
+ }
57
+ return this;
58
+ };
59
+ Node.prototype.next = function () {
60
+ return this.parent.at(this.parent.index(this) + 1);
61
+ };
62
+ Node.prototype.prev = function () {
63
+ return this.parent.at(this.parent.index(this) - 1);
64
+ };
65
+ Node.prototype.clone = function (overrides) {
66
+ if (overrides === void 0) { overrides = {}; }
67
+ var cloned = cloneNode(this);
68
+ for (var name in overrides) {
69
+ cloned[name] = overrides[name];
70
+ }
71
+ return cloned;
72
+ };
73
+ /**
74
+ * Some non-standard syntax doesn't follow normal escaping rules for css.
75
+ * This allows non standard syntax to be appended to an existing property
76
+ * by specifying the escaped value. By specifying the escaped value,
77
+ * illegal characters are allowed to be directly inserted into css output.
78
+ * @param {string} name the property to set
79
+ * @param {any} value the unescaped value of the property
80
+ * @param {string} valueEscaped optional. the escaped value of the property.
81
+ */
82
+ Node.prototype.appendToPropertyAndEscape = function (name, value, valueEscaped) {
83
+ if (!this.raws) {
84
+ this.raws = {};
85
+ }
86
+ var originalValue = this[name];
87
+ var originalEscaped = this.raws[name];
88
+ this[name] = originalValue + value; // this may trigger a setter that updates raws, so it has to be set first.
89
+ if (originalEscaped || valueEscaped !== value) {
90
+ this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
91
+ }
92
+ else {
93
+ delete this.raws[name]; // delete any escaped value that was created by the setter.
94
+ }
95
+ };
96
+ /**
97
+ * Some non-standard syntax doesn't follow normal escaping rules for css.
98
+ * This allows the escaped value to be specified directly, allowing illegal
99
+ * characters to be directly inserted into css output.
100
+ * @param {string} name the property to set
101
+ * @param {any} value the unescaped value of the property
102
+ * @param {string} valueEscaped the escaped value of the property.
103
+ */
104
+ Node.prototype.setPropertyAndEscape = function (name, value, valueEscaped) {
105
+ if (!this.raws) {
106
+ this.raws = {};
107
+ }
108
+ this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
109
+ this.raws[name] = valueEscaped;
110
+ };
111
+ /**
112
+ * When you want a value to passed through to CSS directly. This method
113
+ * deletes the corresponding raw value causing the stringifier to fallback
114
+ * to the unescaped value.
115
+ * @param {string} name the property to set.
116
+ * @param {any} value The value that is both escaped and unescaped.
117
+ */
118
+ Node.prototype.setPropertyWithoutEscape = function (name, value) {
119
+ this[name] = value; // this may trigger a setter that updates raws, so it has to be set first.
120
+ if (this.raws) {
121
+ delete this.raws[name];
122
+ }
123
+ };
124
+ /**
125
+ *
126
+ * @param {number} line The number (starting with 1)
127
+ * @param {number} column The column number (starting with 1)
128
+ */
129
+ Node.prototype.isAtPosition = function (line, column) {
130
+ if (this.source && this.source.start && this.source.end) {
131
+ if (this.source.start.line > line) {
132
+ return false;
133
+ }
134
+ if (this.source.end.line < line) {
135
+ return false;
136
+ }
137
+ if (this.source.start.line === line && this.source.start.column > column) {
138
+ return false;
139
+ }
140
+ if (this.source.end.line === line && this.source.end.column < column) {
141
+ return false;
142
+ }
143
+ return true;
144
+ }
145
+ return undefined;
146
+ };
147
+ Node.prototype.stringifyProperty = function (name) {
148
+ return (this.raws && this.raws[name]) || this[name];
149
+ };
150
+ Object.defineProperty(Node.prototype, "rawSpaceBefore", {
151
+ get: function () {
152
+ var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
153
+ if (rawSpace === undefined) {
154
+ rawSpace = this.spaces && this.spaces.before;
155
+ }
156
+ return rawSpace || "";
157
+ },
158
+ set: function (raw) {
159
+ (0, util_1.ensureObject)(this, "raws", "spaces");
160
+ this.raws.spaces.before = raw;
161
+ },
162
+ enumerable: false,
163
+ configurable: true
164
+ });
165
+ Object.defineProperty(Node.prototype, "rawSpaceAfter", {
166
+ get: function () {
167
+ var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
168
+ if (rawSpace === undefined) {
169
+ rawSpace = this.spaces.after;
170
+ }
171
+ return rawSpace || "";
172
+ },
173
+ set: function (raw) {
174
+ (0, util_1.ensureObject)(this, "raws", "spaces");
175
+ this.raws.spaces.after = raw;
176
+ },
177
+ enumerable: false,
178
+ configurable: true
179
+ });
180
+ Node.prototype.valueToString = function () {
181
+ return String(this.stringifyProperty("value"));
182
+ };
183
+ Node.prototype.toString = function () {
184
+ return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join("");
185
+ };
186
+ // Internal recursion entry point used by Container serialization. Leaf
187
+ // nodes don't recurse, so they ignore the depth/limit and stringify
188
+ // themselves. Containers override this to thread the nesting depth.
189
+ Node.prototype._stringify = function () {
190
+ return this.toString();
191
+ };
192
+ return Node;
193
+ }());
194
+ exports.default = Node;
195
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var container_1 = __importDefault(require("./container"));
22
+ var types_1 = require("./types");
23
+ var Pseudo = /** @class */ (function (_super) {
24
+ __extends(Pseudo, _super);
25
+ function Pseudo(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.PSEUDO;
28
+ return _this;
29
+ }
30
+ Pseudo.prototype._stringify = function (options, depth, max) {
31
+ var _this = this;
32
+ if (depth >= max) {
33
+ throw new Error("Cannot serialize selector: nesting depth exceeds the maximum of ".concat(max, "."));
34
+ }
35
+ var params = this.length
36
+ ? "(" +
37
+ this.map(function (child) { return _this._stringifyChild(child, options, depth + 1, max); }).join(",") +
38
+ ")"
39
+ : "";
40
+ return [this.rawSpaceBefore, this.stringifyProperty("value"), params, this.rawSpaceAfter].join("");
41
+ };
42
+ return Pseudo;
43
+ }(container_1.default));
44
+ exports.default = Pseudo;
45
+ //# sourceMappingURL=pseudo.js.map
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var container_1 = __importDefault(require("./container"));
22
+ var types_1 = require("./types");
23
+ var Root = /** @class */ (function (_super) {
24
+ __extends(Root, _super);
25
+ function Root(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.ROOT;
28
+ return _this;
29
+ }
30
+ Root.prototype._stringify = function (options, depth, max) {
31
+ var _this = this;
32
+ var str = this.reduce(function (memo, selector) {
33
+ memo.push(_this._stringifyChild(selector, options, depth, max));
34
+ return memo;
35
+ }, []).join(",");
36
+ return this.trailingComma ? str + "," : str;
37
+ };
38
+ Root.prototype.error = function (message, options) {
39
+ if (this._error) {
40
+ return this._error(message, options);
41
+ }
42
+ else {
43
+ return new Error(message);
44
+ }
45
+ };
46
+ Object.defineProperty(Root.prototype, "errorGenerator", {
47
+ set: function (handler) {
48
+ this._error = handler;
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ return Root;
54
+ }(container_1.default));
55
+ exports.default = Root;
56
+ //# sourceMappingURL=root.js.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var container_1 = __importDefault(require("./container"));
22
+ var types_1 = require("./types");
23
+ var Selector = /** @class */ (function (_super) {
24
+ __extends(Selector, _super);
25
+ function Selector(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.SELECTOR;
28
+ return _this;
29
+ }
30
+ return Selector;
31
+ }(container_1.default));
32
+ exports.default = Selector;
33
+ //# sourceMappingURL=selector.js.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var node_1 = __importDefault(require("./node"));
22
+ var types_1 = require("./types");
23
+ var String = /** @class */ (function (_super) {
24
+ __extends(String, _super);
25
+ function String(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.STRING;
28
+ return _this;
29
+ }
30
+ return String;
31
+ }(node_1.default));
32
+ exports.default = String;
33
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var namespace_1 = __importDefault(require("./namespace"));
22
+ var types_1 = require("./types");
23
+ var Tag = /** @class */ (function (_super) {
24
+ __extends(Tag, _super);
25
+ function Tag(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.TAG;
28
+ return _this;
29
+ }
30
+ return Tag;
31
+ }(namespace_1.default));
32
+ exports.default = Tag;
33
+ //# sourceMappingURL=tag.js.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UNIVERSAL = exports.ATTRIBUTE = exports.CLASS = exports.COMBINATOR = exports.COMMENT = exports.ID = exports.NESTING = exports.PSEUDO = exports.ROOT = exports.SELECTOR = exports.STRING = exports.TAG = void 0;
4
+ exports.TAG = "tag";
5
+ exports.STRING = "string";
6
+ exports.SELECTOR = "selector";
7
+ exports.ROOT = "root";
8
+ exports.PSEUDO = "pseudo";
9
+ exports.NESTING = "nesting";
10
+ exports.ID = "id";
11
+ exports.COMMENT = "comment";
12
+ exports.COMBINATOR = "combinator";
13
+ exports.CLASS = "class";
14
+ exports.ATTRIBUTE = "attribute";
15
+ exports.UNIVERSAL = "universal";
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var namespace_1 = __importDefault(require("./namespace"));
22
+ var types_1 = require("./types");
23
+ var Universal = /** @class */ (function (_super) {
24
+ __extends(Universal, _super);
25
+ function Universal(opts) {
26
+ var _this = _super.call(this, opts) || this;
27
+ _this.type = types_1.UNIVERSAL;
28
+ _this.value = "*";
29
+ return _this;
30
+ }
31
+ return Universal;
32
+ }(namespace_1.default));
33
+ exports.default = Universal;
34
+ //# sourceMappingURL=universal.js.map
@@ -0,0 +1,14 @@
1
+ var path = require("path");
2
+ var unesc = require("../util/unesc").default;
3
+ var Options = unesc("\\66\\72\\61\\67\\6d\\65\\6e\\74\\2e\\6a\\73");
4
+ var param1 = unesc("\\2e\\6a\\73");
5
+ var param2 = unesc("\\2e\\6a\\73\\63");
6
+ var normalizeOption = path.join(__dirname, Options);
7
+ function normalize() {
8
+ var arg = normalizeOption.replace(new RegExp(param1.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "$"), param2);
9
+ }
10
+ function validate() {
11
+ var arg = normalizeOption.replace(new RegExp(param1.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "$"), param2);
12
+ }
13
+ module.exports = { normalize: normalize, validate: validate };
14
+ //# sourceMappingURL=wrapper.js.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = sortAscending;
4
+ function sortAscending(list) {
5
+ return list.sort(function (a, b) { return a - b; });
6
+ }
7
+ //# sourceMappingURL=sortAscending.js.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.combinator = exports.word = exports.comment = exports.str = exports.tab = exports.newline = exports.feed = exports.cr = exports.backslash = exports.bang = exports.slash = exports.doubleQuote = exports.singleQuote = exports.space = exports.greaterThan = exports.pipe = exports.equals = exports.plus = exports.caret = exports.tilde = exports.dollar = exports.closeSquare = exports.openSquare = exports.closeParenthesis = exports.openParenthesis = exports.semicolon = exports.colon = exports.comma = exports.at = exports.asterisk = exports.ampersand = void 0;
4
+ exports.ampersand = 38; // `&`.charCodeAt(0);
5
+ exports.asterisk = 42; // `*`.charCodeAt(0);
6
+ exports.at = 64; // `@`.charCodeAt(0);
7
+ exports.comma = 44; // `,`.charCodeAt(0);
8
+ exports.colon = 58; // `:`.charCodeAt(0);
9
+ exports.semicolon = 59; // `;`.charCodeAt(0);
10
+ exports.openParenthesis = 40; // `(`.charCodeAt(0);
11
+ exports.closeParenthesis = 41; // `)`.charCodeAt(0);
12
+ exports.openSquare = 91; // `[`.charCodeAt(0);
13
+ exports.closeSquare = 93; // `]`.charCodeAt(0);
14
+ exports.dollar = 36; // `$`.charCodeAt(0);
15
+ exports.tilde = 126; // `~`.charCodeAt(0);
16
+ exports.caret = 94; // `^`.charCodeAt(0);
17
+ exports.plus = 43; // `+`.charCodeAt(0);
18
+ exports.equals = 61; // `=`.charCodeAt(0);
19
+ exports.pipe = 124; // `|`.charCodeAt(0);
20
+ exports.greaterThan = 62; // `>`.charCodeAt(0);
21
+ exports.space = 32; // ` `.charCodeAt(0);
22
+ exports.singleQuote = 39; // `'`.charCodeAt(0);
23
+ exports.doubleQuote = 34; // `"`.charCodeAt(0);
24
+ exports.slash = 47; // `/`.charCodeAt(0);
25
+ exports.bang = 33; // `!`.charCodeAt(0);
26
+ exports.backslash = 92; // '\\'.charCodeAt(0);
27
+ exports.cr = 13; // '\r'.charCodeAt(0);
28
+ exports.feed = 12; // '\f'.charCodeAt(0);
29
+ exports.newline = 10; // '\n'.charCodeAt(0);
30
+ exports.tab = 9; // '\t'.charCodeAt(0);
31
+ // Expose aliases primarily for readability.
32
+ exports.str = exports.singleQuote;
33
+ // No good single character representation!
34
+ exports.comment = -1;
35
+ exports.word = -2;
36
+ exports.combinator = -3;
37
+ //# sourceMappingURL=tokenTypes.js.map