postcss-normalize-repeat-style 8.0.0 → 8.0.2
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/LICENSE-MIT +1 -1
- package/README.md +1 -1
- package/package.json +20 -7
- package/src/index.js +21 -25
- package/types/index.d.ts +2 -9
- package/types/index.d.ts.map +1 -1
package/LICENSE-MIT
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-normalize-repeat-style",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Convert two value syntax for repeat-style into one value.",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
8
|
+
"default": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./src": "./src/index.js",
|
|
11
|
+
"./src/index": "./src/index.js",
|
|
12
|
+
"./src/index.js": "./src/index.js",
|
|
13
|
+
"./src/lib/map": "./src/lib/map.js",
|
|
14
|
+
"./src/lib/map.js": "./src/lib/map.js",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
7
17
|
"files": [
|
|
8
18
|
"LICENSE-MIT",
|
|
9
19
|
"src",
|
|
@@ -16,9 +26,12 @@
|
|
|
16
26
|
"author": {
|
|
17
27
|
"name": "Ben Briggs",
|
|
18
28
|
"email": "beneb.info@gmail.com",
|
|
19
|
-
"url": "
|
|
29
|
+
"url": "https://beneb.info"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "cssnano/cssnano"
|
|
20
34
|
},
|
|
21
|
-
"repository": "cssnano/cssnano",
|
|
22
35
|
"bugs": {
|
|
23
36
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
24
37
|
},
|
|
@@ -27,9 +40,9 @@
|
|
|
27
40
|
"node": "^22.11.0 || ^24.11.0 || >=26.0"
|
|
28
41
|
},
|
|
29
42
|
"devDependencies": {
|
|
30
|
-
"postcss": "^8.5.
|
|
43
|
+
"postcss": "^8.5.25"
|
|
31
44
|
},
|
|
32
45
|
"peerDependencies": {
|
|
33
|
-
"postcss": "^8.5.
|
|
46
|
+
"postcss": "^8.5.25"
|
|
34
47
|
}
|
|
35
48
|
}
|
package/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const valueParser = require('postcss-value-parser');
|
|
3
3
|
const mappings = require('./lib/map');
|
|
4
4
|
|
|
5
|
+
const repeatPropertyRegex = /^(background(-repeat)?|(-\w+-)?mask-repeat)$/i;
|
|
5
6
|
/**
|
|
6
7
|
* @param {unknown} item
|
|
7
8
|
* @param {number} index
|
|
@@ -97,15 +98,9 @@ function transform(value) {
|
|
|
97
98
|
}
|
|
98
99
|
|
|
99
100
|
if (ranges[rangeIndex].start !== null) {
|
|
100
|
-
if (node.type
|
|
101
|
-
return;
|
|
102
|
-
} else if (isRepeatKeyword) {
|
|
101
|
+
if (node.type !== 'space' && isRepeatKeyword) {
|
|
103
102
|
ranges[rangeIndex].end = index;
|
|
104
|
-
|
|
105
|
-
return;
|
|
106
103
|
}
|
|
107
|
-
|
|
108
|
-
return;
|
|
109
104
|
}
|
|
110
105
|
});
|
|
111
106
|
|
|
@@ -139,7 +134,6 @@ function transform(value) {
|
|
|
139
134
|
}
|
|
140
135
|
|
|
141
136
|
/**
|
|
142
|
-
* @type {import('postcss').PluginCreator<void>}
|
|
143
137
|
* @return {import('postcss').Plugin}
|
|
144
138
|
*/
|
|
145
139
|
function pluginCreator() {
|
|
@@ -148,28 +142,28 @@ function pluginCreator() {
|
|
|
148
142
|
prepare() {
|
|
149
143
|
const cache = new Map();
|
|
150
144
|
return {
|
|
145
|
+
/**
|
|
146
|
+
* @param {import('postcss').Root} css
|
|
147
|
+
*/
|
|
151
148
|
OnceExit(css) {
|
|
152
|
-
css.walkDecls(
|
|
153
|
-
|
|
154
|
-
(decl) => {
|
|
155
|
-
const value = decl.value;
|
|
149
|
+
css.walkDecls(repeatPropertyRegex, (decl) => {
|
|
150
|
+
const value = decl.value;
|
|
156
151
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
if (!value) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
160
155
|
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
if (cache.has(value)) {
|
|
157
|
+
decl.value = cache.get(value);
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
166
161
|
|
|
167
|
-
|
|
162
|
+
const result = transform(value);
|
|
168
163
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
);
|
|
164
|
+
decl.value = result;
|
|
165
|
+
cache.set(value, result);
|
|
166
|
+
});
|
|
173
167
|
},
|
|
174
168
|
};
|
|
175
169
|
},
|
|
@@ -177,4 +171,6 @@ function pluginCreator() {
|
|
|
177
171
|
}
|
|
178
172
|
|
|
179
173
|
pluginCreator.postcss = true;
|
|
180
|
-
module.exports =
|
|
174
|
+
module.exports = /** @type {import('postcss').PluginCreator<void>}*/ (
|
|
175
|
+
pluginCreator
|
|
176
|
+
);
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @type {import('postcss').PluginCreator<void>}
|
|
4
|
-
* @return {import('postcss').Plugin}
|
|
5
|
-
*/
|
|
6
|
-
declare function pluginCreator(): import("postcss").Plugin;
|
|
7
|
-
declare namespace pluginCreator {
|
|
8
|
-
let postcss: true;
|
|
9
|
-
}
|
|
1
|
+
declare const _exports: import("postcss").PluginCreator<void>;
|
|
2
|
+
export = _exports;
|
|
10
3
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
|