@pandacss/logger 1.5.1 → 1.6.1
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.
- package/dist/index.js +57 -19
- package/dist/index.mjs +57 -19
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -48,24 +48,27 @@ function escapeStringRegexp(string) {
|
|
|
48
48
|
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// ../../node_modules/.pnpm/matcher@
|
|
51
|
+
// ../../node_modules/.pnpm/matcher@6.0.0/node_modules/matcher/index.js
|
|
52
52
|
var regexpCache = /* @__PURE__ */ new Map();
|
|
53
53
|
var sanitizeArray = (input, inputName) => {
|
|
54
54
|
if (!Array.isArray(input)) {
|
|
55
55
|
switch (typeof input) {
|
|
56
|
-
case "string":
|
|
56
|
+
case "string": {
|
|
57
57
|
input = [input];
|
|
58
58
|
break;
|
|
59
|
-
|
|
59
|
+
}
|
|
60
|
+
case "undefined": {
|
|
60
61
|
input = [];
|
|
61
62
|
break;
|
|
62
|
-
|
|
63
|
+
}
|
|
64
|
+
default: {
|
|
63
65
|
throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
return input.filter((string) => {
|
|
67
70
|
if (typeof string !== "string") {
|
|
68
|
-
if (
|
|
71
|
+
if (string === void 0) {
|
|
69
72
|
return false;
|
|
70
73
|
}
|
|
71
74
|
throw new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);
|
|
@@ -78,7 +81,8 @@ var makeRegexp = (pattern, options) => {
|
|
|
78
81
|
caseSensitive: false,
|
|
79
82
|
...options
|
|
80
83
|
};
|
|
81
|
-
const
|
|
84
|
+
const flags = "s" + (options.caseSensitive ? "" : "i");
|
|
85
|
+
const cacheKey = pattern + "|" + flags;
|
|
82
86
|
if (regexpCache.has(cacheKey)) {
|
|
83
87
|
return regexpCache.get(cacheKey);
|
|
84
88
|
}
|
|
@@ -86,8 +90,10 @@ var makeRegexp = (pattern, options) => {
|
|
|
86
90
|
if (negated) {
|
|
87
91
|
pattern = pattern.slice(1);
|
|
88
92
|
}
|
|
89
|
-
pattern =
|
|
90
|
-
|
|
93
|
+
pattern = pattern.replaceAll(String.raw`\*`, "__ESCAPED_STAR__").replaceAll("\\\\", "__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g, "$1");
|
|
94
|
+
pattern = escapeStringRegexp(pattern).replaceAll(String.raw`\*`, ".*");
|
|
95
|
+
pattern = pattern.replaceAll("__ESCAPED_STAR__", String.raw`\*`).replaceAll("__ESCAPED_BACKSLASH__", "\\\\");
|
|
96
|
+
const regexp = new RegExp(`^${pattern}$`, flags);
|
|
91
97
|
regexp.negated = negated;
|
|
92
98
|
regexpCache.set(cacheKey, regexp);
|
|
93
99
|
return regexp;
|
|
@@ -99,25 +105,57 @@ var baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
|
|
|
99
105
|
return [];
|
|
100
106
|
}
|
|
101
107
|
patterns = patterns.map((pattern) => makeRegexp(pattern, options));
|
|
108
|
+
const negatedPatterns = patterns.filter((pattern) => pattern.negated);
|
|
109
|
+
const positivePatterns = patterns.filter((pattern) => !pattern.negated);
|
|
102
110
|
const { allPatterns } = options || {};
|
|
103
111
|
const result = [];
|
|
112
|
+
if (allPatterns && firstMatchOnly && negatedPatterns.length > 1 && positivePatterns.length === 0) {
|
|
113
|
+
for (const input of inputs) {
|
|
114
|
+
for (const pattern of negatedPatterns) {
|
|
115
|
+
if (pattern.test(input)) {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return inputs.slice(0, 1);
|
|
121
|
+
}
|
|
104
122
|
for (const input of inputs) {
|
|
105
|
-
let
|
|
106
|
-
const
|
|
107
|
-
for (const [index, pattern] of patterns.entries()) {
|
|
123
|
+
let excludedByNegation = false;
|
|
124
|
+
for (const pattern of negatedPatterns) {
|
|
108
125
|
if (pattern.test(input)) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (!matches2) {
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
126
|
+
excludedByNegation = true;
|
|
127
|
+
break;
|
|
114
128
|
}
|
|
115
129
|
}
|
|
116
|
-
if (
|
|
130
|
+
if (excludedByNegation) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (positivePatterns.length === 0) {
|
|
117
134
|
result.push(input);
|
|
118
|
-
|
|
119
|
-
|
|
135
|
+
} else if (allPatterns) {
|
|
136
|
+
const matchedPositive = Array.from({ length: positivePatterns.length }, () => false);
|
|
137
|
+
for (const [index, pattern] of positivePatterns.entries()) {
|
|
138
|
+
if (pattern.test(input)) {
|
|
139
|
+
matchedPositive[index] = true;
|
|
140
|
+
}
|
|
120
141
|
}
|
|
142
|
+
if (matchedPositive.every(Boolean)) {
|
|
143
|
+
result.push(input);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
let matchedAny = false;
|
|
147
|
+
for (const pattern of positivePatterns) {
|
|
148
|
+
if (pattern.test(input)) {
|
|
149
|
+
matchedAny = true;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (matchedAny) {
|
|
154
|
+
result.push(input);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (firstMatchOnly && result.length > 0) {
|
|
158
|
+
break;
|
|
121
159
|
}
|
|
122
160
|
}
|
|
123
161
|
return result;
|
package/dist/index.mjs
CHANGED
|
@@ -12,24 +12,27 @@ function escapeStringRegexp(string) {
|
|
|
12
12
|
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// ../../node_modules/.pnpm/matcher@
|
|
15
|
+
// ../../node_modules/.pnpm/matcher@6.0.0/node_modules/matcher/index.js
|
|
16
16
|
var regexpCache = /* @__PURE__ */ new Map();
|
|
17
17
|
var sanitizeArray = (input, inputName) => {
|
|
18
18
|
if (!Array.isArray(input)) {
|
|
19
19
|
switch (typeof input) {
|
|
20
|
-
case "string":
|
|
20
|
+
case "string": {
|
|
21
21
|
input = [input];
|
|
22
22
|
break;
|
|
23
|
-
|
|
23
|
+
}
|
|
24
|
+
case "undefined": {
|
|
24
25
|
input = [];
|
|
25
26
|
break;
|
|
26
|
-
|
|
27
|
+
}
|
|
28
|
+
default: {
|
|
27
29
|
throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
return input.filter((string) => {
|
|
31
34
|
if (typeof string !== "string") {
|
|
32
|
-
if (
|
|
35
|
+
if (string === void 0) {
|
|
33
36
|
return false;
|
|
34
37
|
}
|
|
35
38
|
throw new TypeError(`Expected '${inputName}' to be an array of strings, but found a type of '${typeof string}' in the array`);
|
|
@@ -42,7 +45,8 @@ var makeRegexp = (pattern, options) => {
|
|
|
42
45
|
caseSensitive: false,
|
|
43
46
|
...options
|
|
44
47
|
};
|
|
45
|
-
const
|
|
48
|
+
const flags = "s" + (options.caseSensitive ? "" : "i");
|
|
49
|
+
const cacheKey = pattern + "|" + flags;
|
|
46
50
|
if (regexpCache.has(cacheKey)) {
|
|
47
51
|
return regexpCache.get(cacheKey);
|
|
48
52
|
}
|
|
@@ -50,8 +54,10 @@ var makeRegexp = (pattern, options) => {
|
|
|
50
54
|
if (negated) {
|
|
51
55
|
pattern = pattern.slice(1);
|
|
52
56
|
}
|
|
53
|
-
pattern =
|
|
54
|
-
|
|
57
|
+
pattern = pattern.replaceAll(String.raw`\*`, "__ESCAPED_STAR__").replaceAll("\\\\", "__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g, "$1");
|
|
58
|
+
pattern = escapeStringRegexp(pattern).replaceAll(String.raw`\*`, ".*");
|
|
59
|
+
pattern = pattern.replaceAll("__ESCAPED_STAR__", String.raw`\*`).replaceAll("__ESCAPED_BACKSLASH__", "\\\\");
|
|
60
|
+
const regexp = new RegExp(`^${pattern}$`, flags);
|
|
55
61
|
regexp.negated = negated;
|
|
56
62
|
regexpCache.set(cacheKey, regexp);
|
|
57
63
|
return regexp;
|
|
@@ -63,25 +69,57 @@ var baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
|
|
|
63
69
|
return [];
|
|
64
70
|
}
|
|
65
71
|
patterns = patterns.map((pattern) => makeRegexp(pattern, options));
|
|
72
|
+
const negatedPatterns = patterns.filter((pattern) => pattern.negated);
|
|
73
|
+
const positivePatterns = patterns.filter((pattern) => !pattern.negated);
|
|
66
74
|
const { allPatterns } = options || {};
|
|
67
75
|
const result = [];
|
|
76
|
+
if (allPatterns && firstMatchOnly && negatedPatterns.length > 1 && positivePatterns.length === 0) {
|
|
77
|
+
for (const input of inputs) {
|
|
78
|
+
for (const pattern of negatedPatterns) {
|
|
79
|
+
if (pattern.test(input)) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return inputs.slice(0, 1);
|
|
85
|
+
}
|
|
68
86
|
for (const input of inputs) {
|
|
69
|
-
let
|
|
70
|
-
const
|
|
71
|
-
for (const [index, pattern] of patterns.entries()) {
|
|
87
|
+
let excludedByNegation = false;
|
|
88
|
+
for (const pattern of negatedPatterns) {
|
|
72
89
|
if (pattern.test(input)) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!matches2) {
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
90
|
+
excludedByNegation = true;
|
|
91
|
+
break;
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
|
-
if (
|
|
94
|
+
if (excludedByNegation) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (positivePatterns.length === 0) {
|
|
81
98
|
result.push(input);
|
|
82
|
-
|
|
83
|
-
|
|
99
|
+
} else if (allPatterns) {
|
|
100
|
+
const matchedPositive = Array.from({ length: positivePatterns.length }, () => false);
|
|
101
|
+
for (const [index, pattern] of positivePatterns.entries()) {
|
|
102
|
+
if (pattern.test(input)) {
|
|
103
|
+
matchedPositive[index] = true;
|
|
104
|
+
}
|
|
84
105
|
}
|
|
106
|
+
if (matchedPositive.every(Boolean)) {
|
|
107
|
+
result.push(input);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
let matchedAny = false;
|
|
111
|
+
for (const pattern of positivePatterns) {
|
|
112
|
+
if (pattern.test(input)) {
|
|
113
|
+
matchedAny = true;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (matchedAny) {
|
|
118
|
+
result.push(input);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (firstMatchOnly && result.length > 0) {
|
|
122
|
+
break;
|
|
85
123
|
}
|
|
86
124
|
}
|
|
87
125
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/logger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"kleur": "4.1.5",
|
|
37
|
-
"@pandacss/types": "1.
|
|
37
|
+
"@pandacss/types": "1.6.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"matcher": "
|
|
40
|
+
"matcher": "6.0.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|