@csszyx/unplugin 0.14.4 → 0.15.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.
- package/README.md +4 -3
- package/dist/index.cjs +8 -7
- package/dist/index.d.cts +70 -3
- package/dist/index.d.mts +70 -3
- package/dist/index.mjs +4 -4
- package/dist/next-config.d.cts +1 -2
- package/dist/next-config.d.mts +1 -2
- package/dist/next-prebuild.cjs +9 -5
- package/dist/next-prebuild.d.cts +4 -2
- package/dist/next-prebuild.d.mts +4 -2
- package/dist/next-prebuild.mjs +8 -4
- package/dist/next-turbo-loader.cjs +20 -14
- package/dist/next-turbo-loader.d.cts +1 -1
- package/dist/next-turbo-loader.d.mts +1 -1
- package/dist/next-turbo-loader.mjs +19 -13
- package/dist/next-watcher.cjs +2 -2
- package/dist/next-watcher.d.cts +2 -2
- package/dist/next-watcher.d.mts +2 -2
- package/dist/next-watcher.mjs +2 -2
- package/dist/postcss.cjs +124 -0
- package/dist/postcss.d.cts +42 -0
- package/dist/postcss.d.mts +42 -0
- package/dist/postcss.mjs +107 -0
- package/dist/shared/{unplugin.NlPvn5P4.mjs → unplugin.AGR7mihU.mjs} +2 -6
- package/dist/shared/{unplugin.BnRf0Tvd.mjs → unplugin.BGufkSFT.mjs} +297 -173
- package/dist/shared/{unplugin.BXYakiXt.d.cts → unplugin.BHfqCocB.d.cts} +53 -55
- package/dist/shared/{unplugin.BXYakiXt.d.mts → unplugin.BHfqCocB.d.mts} +53 -55
- package/dist/shared/{unplugin.RGzhYt-D.cjs → unplugin.BLbrShMZ.cjs} +344 -221
- package/dist/shared/{unplugin.DVbPNK3W.cjs → unplugin.BbBYWFGT.cjs} +6 -6
- package/dist/shared/{unplugin.BZPdvVcj.mjs → unplugin.BourSpnZ.mjs} +105 -127
- package/dist/shared/{unplugin.CPEWNSA0.d.cts → unplugin.C2ilavL1.d.cts} +2 -0
- package/dist/shared/{unplugin.CPEWNSA0.d.mts → unplugin.C2ilavL1.d.mts} +2 -0
- package/dist/shared/{unplugin.D8BxOOkA.cjs → unplugin.C7i0agiO.cjs} +121 -142
- package/dist/shared/{unplugin.CdZxp0x-.d.mts → unplugin.CXCaQ3-s.d.cts} +1 -1
- package/dist/shared/{unplugin.xeED_qwh.d.cts → unplugin.CbNydVwv.d.mts} +1 -1
- package/dist/shared/unplugin.CqJS0BbD.mjs +211 -0
- package/dist/shared/{unplugin.VtXstzEh.cjs → unplugin.DX3rYT4P.cjs} +6 -11
- package/dist/shared/{unplugin.Cji6O5jv.cjs → unplugin.Dai5wlZ3.cjs} +27 -19
- package/dist/shared/{unplugin.DN95k991.mjs → unplugin.Dbc26ty6.mjs} +2 -2
- package/dist/shared/{unplugin.BU0O4IkX.mjs → unplugin.DmCOQc-b.mjs} +22 -16
- package/dist/shared/unplugin.KnDCM-sr.cjs +241 -0
- package/dist/vite.cjs +4 -4
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +4 -4
- package/dist/webpack.cjs +4 -4
- package/dist/webpack.d.cts +2 -1
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +4 -4
- package/package.json +19 -9
- package/dist/shared/unplugin.B3XoSRB8.mjs +0 -40
- package/dist/shared/unplugin.BkRah5Ot.cjs +0 -48
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
function _interopNamespaceCompat(e) {
|
|
7
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
8
|
+
const n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
for (const k in e) {
|
|
11
|
+
n[k] = e[k];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
n.default = e;
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const fs__namespace = /*#__PURE__*/_interopNamespaceCompat(fs);
|
|
19
|
+
const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
|
|
20
|
+
|
|
21
|
+
function sortStrings(values) {
|
|
22
|
+
return [...values].sort((a, b) => {
|
|
23
|
+
if (a < b) return -1;
|
|
24
|
+
if (a > b) return 1;
|
|
25
|
+
return 0;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const WINDOWS_PATH_SEPARATOR = String.fromCodePoint(92);
|
|
30
|
+
function normalizePathSeparators(value) {
|
|
31
|
+
return value.split(WINDOWS_PATH_SEPARATOR).join("/");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const SAFELIST_HEADER = "# Auto-generated by csszyx \u2014 DO NOT EDIT\n# Tailwind scans this file for class names, one per line.\n";
|
|
35
|
+
function renderSafelistFile(classNames) {
|
|
36
|
+
if (classNames.length === 0) {
|
|
37
|
+
return SAFELIST_HEADER;
|
|
38
|
+
}
|
|
39
|
+
return `${SAFELIST_HEADER}${classNames.join("\n")}
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const SAFELIST_FILE = ".csszyx/csszyx-classes.txt";
|
|
44
|
+
const LEGACY_SAFELIST_FILES = [
|
|
45
|
+
"csszyx-classes.html",
|
|
46
|
+
".csszyx/next-loader-classes.html"
|
|
47
|
+
];
|
|
48
|
+
const LEGACY_HTML_MARKERS = [
|
|
49
|
+
"<!-- Auto-generated by csszyx",
|
|
50
|
+
"<!-- csszyx Next safelist",
|
|
51
|
+
"<!-- csszyx exact scanner candidates -->"
|
|
52
|
+
];
|
|
53
|
+
function removeLegacySafelists(rootDir, warn) {
|
|
54
|
+
for (const legacy of LEGACY_SAFELIST_FILES) {
|
|
55
|
+
const file = path__namespace.join(rootDir, legacy);
|
|
56
|
+
let content;
|
|
57
|
+
try {
|
|
58
|
+
content = fs__namespace.readFileSync(file, "utf8");
|
|
59
|
+
} catch {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (!LEGACY_HTML_MARKERS.some((marker) => content.includes(marker))) continue;
|
|
63
|
+
try {
|
|
64
|
+
fs__namespace.rmSync(file, { force: true });
|
|
65
|
+
} catch (error) {
|
|
66
|
+
const { message } = error;
|
|
67
|
+
warn(`[csszyx] could not remove ${legacy}: ${message}. Delete it by hand.`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
warn(
|
|
71
|
+
`[csszyx] removed ${legacy}: the safelist now lives at ${SAFELIST_FILE}. Update any hand-written @source that named the old file, or drop it and list '@csszyx/unplugin/postcss' before '@tailwindcss/postcss' in postcss.config.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const LEGACY_SAFELIST_BASENAMES = new Set(
|
|
76
|
+
LEGACY_SAFELIST_FILES.map((file) => path__namespace.posix.basename(file))
|
|
77
|
+
);
|
|
78
|
+
function isDanglingLegacySource(target, cssFile) {
|
|
79
|
+
if (!LEGACY_SAFELIST_BASENAMES.has(path__namespace.posix.basename(target))) return false;
|
|
80
|
+
return !fs__namespace.existsSync(path__namespace.resolve(path__namespace.dirname(cssFile), target));
|
|
81
|
+
}
|
|
82
|
+
function findLegacySourceDirective(code, cssFile) {
|
|
83
|
+
const withoutComments = stripCssBlockComments(code);
|
|
84
|
+
for (const match of withoutComments.matchAll(/@source\s+(["'])([^"']+)\1/g)) {
|
|
85
|
+
const target = match[2];
|
|
86
|
+
if (isDanglingLegacySource(target, cssFile)) {
|
|
87
|
+
return { directive: match[0], target };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const SKIPPED_DIRS = /* @__PURE__ */ new Set([
|
|
93
|
+
"node_modules",
|
|
94
|
+
".git",
|
|
95
|
+
".csszyx",
|
|
96
|
+
"dist",
|
|
97
|
+
"build",
|
|
98
|
+
"out",
|
|
99
|
+
"coverage",
|
|
100
|
+
".turbo",
|
|
101
|
+
".vercel"
|
|
102
|
+
]);
|
|
103
|
+
const STYLESHEET_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".pcss", ".postcss"]);
|
|
104
|
+
function findLegacySourceStylesheet(rootDir) {
|
|
105
|
+
const pending = [rootDir];
|
|
106
|
+
while (pending.length > 0) {
|
|
107
|
+
const dir = pending.pop();
|
|
108
|
+
for (const entry of readDirectory(dir)) {
|
|
109
|
+
if (entry.isDirectory()) {
|
|
110
|
+
if (!isSkippedDirectory(entry.name)) pending.push(path__namespace.join(dir, entry.name));
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const found = readLegacySourceDirective(dir, entry);
|
|
114
|
+
if (found !== null) return found;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
function readDirectory(dir) {
|
|
120
|
+
try {
|
|
121
|
+
return fs__namespace.readdirSync(dir, { withFileTypes: true });
|
|
122
|
+
} catch {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function isSkippedDirectory(name) {
|
|
127
|
+
return SKIPPED_DIRS.has(name) || name.startsWith(".next");
|
|
128
|
+
}
|
|
129
|
+
function readLegacySourceDirective(dir, entry) {
|
|
130
|
+
if (!entry.isFile() || !STYLESHEET_EXTENSIONS.has(path__namespace.extname(entry.name))) return null;
|
|
131
|
+
const file = path__namespace.join(dir, entry.name);
|
|
132
|
+
const code = fs__namespace.readFileSync(file, "utf8");
|
|
133
|
+
if (!code.includes("@source")) return null;
|
|
134
|
+
const found = findLegacySourceDirective(code, file);
|
|
135
|
+
return found === null ? null : { file, ...found };
|
|
136
|
+
}
|
|
137
|
+
const ROOTS_WITHOUT_LEGACY_SOURCE = /* @__PURE__ */ new Set();
|
|
138
|
+
function assertNoLegacySourceStylesheet(rootDir) {
|
|
139
|
+
if (ROOTS_WITHOUT_LEGACY_SOURCE.has(rootDir)) return;
|
|
140
|
+
const found = findLegacySourceStylesheet(rootDir);
|
|
141
|
+
if (found !== null) throw new Error(legacySourceMessage(found.file, found.target));
|
|
142
|
+
ROOTS_WITHOUT_LEGACY_SOURCE.add(rootDir);
|
|
143
|
+
}
|
|
144
|
+
const CSSZYX_POSTCSS_PLUGIN = "@csszyx/unplugin/postcss";
|
|
145
|
+
const POSTCSS_CONFIG_FILES = [
|
|
146
|
+
".postcssrc.json",
|
|
147
|
+
"postcss.config.json",
|
|
148
|
+
".postcssrc.js",
|
|
149
|
+
"postcss.config.js",
|
|
150
|
+
"postcss.config.mjs",
|
|
151
|
+
"postcss.config.cjs"
|
|
152
|
+
];
|
|
153
|
+
function findPostcssConfigWithoutCsszyx(rootDir) {
|
|
154
|
+
const packageJson = path__namespace.join(rootDir, "package.json");
|
|
155
|
+
let postcssKey;
|
|
156
|
+
try {
|
|
157
|
+
postcssKey = JSON.parse(fs__namespace.readFileSync(packageJson, "utf8")).postcss;
|
|
158
|
+
} catch {
|
|
159
|
+
postcssKey = void 0;
|
|
160
|
+
}
|
|
161
|
+
if (postcssKey !== void 0) {
|
|
162
|
+
return JSON.stringify(postcssKey).includes(CSSZYX_POSTCSS_PLUGIN) ? null : packageJson;
|
|
163
|
+
}
|
|
164
|
+
for (const name of POSTCSS_CONFIG_FILES) {
|
|
165
|
+
const file = path__namespace.join(rootDir, name);
|
|
166
|
+
let text;
|
|
167
|
+
try {
|
|
168
|
+
text = fs__namespace.readFileSync(file, "utf8");
|
|
169
|
+
} catch {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
return text.includes(CSSZYX_POSTCSS_PLUGIN) ? null : file;
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function missingPostcssPluginMessage(configFile) {
|
|
177
|
+
return `[csszyx] ${configFile} does not list '@csszyx/unplugin/postcss'. Next.js reads the safelist only through that plugin: list it before '@tailwindcss/postcss', or no sz class gets CSS.`;
|
|
178
|
+
}
|
|
179
|
+
function legacySourceMessage(cssFile, target) {
|
|
180
|
+
return `[csszyx] ${cssFile}: @source "${target}" names the old safelist, which csszyx no longer writes. The safelist is now ${SAFELIST_FILE}, and csszyx adds the directive itself: remove this line. Vite, Rollup and webpack inject it; on Next.js list '@csszyx/unplugin/postcss' before '@tailwindcss/postcss' in postcss.config.`;
|
|
181
|
+
}
|
|
182
|
+
const TAILWIND_SPECIFIER = String.raw`["']tailwindcss(?:\/[^"']*)?["']`;
|
|
183
|
+
const TAILWIND_IMPORT = new RegExp(String.raw`@import\s+${TAILWIND_SPECIFIER}`);
|
|
184
|
+
function computeSafelistRelPath(rootDir, safelistFilename, cssId) {
|
|
185
|
+
const safelistPath = normalizePathSeparators(path__namespace.join(rootDir, safelistFilename));
|
|
186
|
+
const cssDir = normalizePathSeparators(path__namespace.dirname(cssId));
|
|
187
|
+
let relPath = path__namespace.posix.relative(cssDir, safelistPath);
|
|
188
|
+
if (!relPath.startsWith("./") && !relPath.startsWith("../")) {
|
|
189
|
+
relPath = `./${relPath}`;
|
|
190
|
+
}
|
|
191
|
+
return relPath;
|
|
192
|
+
}
|
|
193
|
+
function appendTailwindSourceDirective(code, relPath) {
|
|
194
|
+
const directive = `@source "${relPath}";`;
|
|
195
|
+
if (code.includes(directive)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const separator = code.length === 0 || code.endsWith("\n") ? "" : "\n";
|
|
199
|
+
return `${code}${separator}${directive}
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
function stripCssBlockComments(code) {
|
|
203
|
+
const SLASH = 47;
|
|
204
|
+
const STAR = 42;
|
|
205
|
+
let out = "";
|
|
206
|
+
let last = 0;
|
|
207
|
+
let i = 0;
|
|
208
|
+
const n = code.length;
|
|
209
|
+
while (i < n) {
|
|
210
|
+
if (code.codePointAt(i) === SLASH && code.codePointAt(i + 1) === STAR) {
|
|
211
|
+
out += code.slice(last, i);
|
|
212
|
+
i += 2;
|
|
213
|
+
while (i < n && !(code.codePointAt(i) === STAR && code.codePointAt(i + 1) === SLASH)) {
|
|
214
|
+
i++;
|
|
215
|
+
}
|
|
216
|
+
i += 2;
|
|
217
|
+
last = i;
|
|
218
|
+
} else {
|
|
219
|
+
i++;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return out + code.slice(last);
|
|
223
|
+
}
|
|
224
|
+
function cssImportsTailwind(code) {
|
|
225
|
+
return TAILWIND_IMPORT.test(stripCssBlockComments(code));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
exports.SAFELIST_FILE = SAFELIST_FILE;
|
|
229
|
+
exports.appendTailwindSourceDirective = appendTailwindSourceDirective;
|
|
230
|
+
exports.assertNoLegacySourceStylesheet = assertNoLegacySourceStylesheet;
|
|
231
|
+
exports.computeSafelistRelPath = computeSafelistRelPath;
|
|
232
|
+
exports.cssImportsTailwind = cssImportsTailwind;
|
|
233
|
+
exports.findLegacySourceDirective = findLegacySourceDirective;
|
|
234
|
+
exports.findPostcssConfigWithoutCsszyx = findPostcssConfigWithoutCsszyx;
|
|
235
|
+
exports.legacySourceMessage = legacySourceMessage;
|
|
236
|
+
exports.missingPostcssPluginMessage = missingPostcssPluginMessage;
|
|
237
|
+
exports.normalizePathSeparators = normalizePathSeparators;
|
|
238
|
+
exports.removeLegacySafelists = removeLegacySafelists;
|
|
239
|
+
exports.renderSafelistFile = renderSafelistFile;
|
|
240
|
+
exports.sortStrings = sortStrings;
|
|
241
|
+
exports.stripCssBlockComments = stripCssBlockComments;
|
package/dist/vite.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const unplugin = require('./shared/unplugin.
|
|
5
|
+
const unplugin = require('./shared/unplugin.BLbrShMZ.cjs');
|
|
6
6
|
require('node:crypto');
|
|
7
7
|
require('node:fs');
|
|
8
8
|
require('node:module');
|
|
@@ -16,12 +16,12 @@ require('@csszyx/svelte-adapter');
|
|
|
16
16
|
require('@csszyx/types');
|
|
17
17
|
require('@csszyx/vue-adapter');
|
|
18
18
|
require('unplugin');
|
|
19
|
-
require('./shared/unplugin.
|
|
19
|
+
require('./shared/unplugin.DX3rYT4P.cjs');
|
|
20
|
+
require('./shared/unplugin.KnDCM-sr.cjs');
|
|
20
21
|
require('./css-mangler.cjs');
|
|
21
22
|
require('postcss');
|
|
22
23
|
require('postcss-selector-parser');
|
|
23
|
-
require('./shared/unplugin.
|
|
24
|
-
require('./shared/unplugin.BkRah5Ot.cjs');
|
|
24
|
+
require('./shared/unplugin.C7i0agiO.cjs');
|
|
25
25
|
require('node:zlib');
|
|
26
26
|
require('postcss-value-parser');
|
|
27
27
|
|
package/dist/vite.d.cts
CHANGED
package/dist/vite.d.mts
CHANGED
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a1 as default } from './shared/unplugin.BGufkSFT.mjs';
|
|
2
2
|
import 'node:crypto';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:module';
|
|
@@ -12,11 +12,11 @@ import '@csszyx/svelte-adapter';
|
|
|
12
12
|
import '@csszyx/types';
|
|
13
13
|
import '@csszyx/vue-adapter';
|
|
14
14
|
import 'unplugin';
|
|
15
|
-
import './shared/unplugin.
|
|
15
|
+
import './shared/unplugin.AGR7mihU.mjs';
|
|
16
|
+
import './shared/unplugin.CqJS0BbD.mjs';
|
|
16
17
|
import './css-mangler.mjs';
|
|
17
18
|
import 'postcss';
|
|
18
19
|
import 'postcss-selector-parser';
|
|
19
|
-
import './shared/unplugin.
|
|
20
|
-
import './shared/unplugin.B3XoSRB8.mjs';
|
|
20
|
+
import './shared/unplugin.BourSpnZ.mjs';
|
|
21
21
|
import 'node:zlib';
|
|
22
22
|
import 'postcss-value-parser';
|
package/dist/webpack.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const unplugin = require('./shared/unplugin.
|
|
5
|
+
const unplugin = require('./shared/unplugin.BLbrShMZ.cjs');
|
|
6
6
|
require('node:crypto');
|
|
7
7
|
require('node:fs');
|
|
8
8
|
require('node:module');
|
|
@@ -16,12 +16,12 @@ require('@csszyx/svelte-adapter');
|
|
|
16
16
|
require('@csszyx/types');
|
|
17
17
|
require('@csszyx/vue-adapter');
|
|
18
18
|
require('unplugin');
|
|
19
|
-
require('./shared/unplugin.
|
|
19
|
+
require('./shared/unplugin.DX3rYT4P.cjs');
|
|
20
|
+
require('./shared/unplugin.KnDCM-sr.cjs');
|
|
20
21
|
require('./css-mangler.cjs');
|
|
21
22
|
require('postcss');
|
|
22
23
|
require('postcss-selector-parser');
|
|
23
|
-
require('./shared/unplugin.
|
|
24
|
-
require('./shared/unplugin.BkRah5Ot.cjs');
|
|
24
|
+
require('./shared/unplugin.C7i0agiO.cjs');
|
|
25
25
|
require('node:zlib');
|
|
26
26
|
require('postcss-value-parser');
|
|
27
27
|
|
package/dist/webpack.d.cts
CHANGED
package/dist/webpack.d.mts
CHANGED
package/dist/webpack.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as default } from './shared/unplugin.BGufkSFT.mjs';
|
|
2
2
|
import 'node:crypto';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:module';
|
|
@@ -12,11 +12,11 @@ import '@csszyx/svelte-adapter';
|
|
|
12
12
|
import '@csszyx/types';
|
|
13
13
|
import '@csszyx/vue-adapter';
|
|
14
14
|
import 'unplugin';
|
|
15
|
-
import './shared/unplugin.
|
|
15
|
+
import './shared/unplugin.AGR7mihU.mjs';
|
|
16
|
+
import './shared/unplugin.CqJS0BbD.mjs';
|
|
16
17
|
import './css-mangler.mjs';
|
|
17
18
|
import 'postcss';
|
|
18
19
|
import 'postcss-selector-parser';
|
|
19
|
-
import './shared/unplugin.
|
|
20
|
-
import './shared/unplugin.B3XoSRB8.mjs';
|
|
20
|
+
import './shared/unplugin.BourSpnZ.mjs';
|
|
21
21
|
import 'node:zlib';
|
|
22
22
|
import 'postcss-value-parser';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/unplugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Vite and Webpack integration for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -103,6 +103,16 @@
|
|
|
103
103
|
"types": "./dist/next-watcher.d.cts",
|
|
104
104
|
"default": "./dist/next-watcher.cjs"
|
|
105
105
|
}
|
|
106
|
+
},
|
|
107
|
+
"./postcss": {
|
|
108
|
+
"import": {
|
|
109
|
+
"types": "./dist/postcss.d.mts",
|
|
110
|
+
"default": "./dist/postcss.mjs"
|
|
111
|
+
},
|
|
112
|
+
"require": {
|
|
113
|
+
"types": "./dist/postcss.d.cts",
|
|
114
|
+
"default": "./dist/postcss.cjs"
|
|
115
|
+
}
|
|
106
116
|
}
|
|
107
117
|
},
|
|
108
118
|
"main": "dist/index.cjs",
|
|
@@ -117,14 +127,14 @@
|
|
|
117
127
|
"postcss-value-parser": "^4.2.0",
|
|
118
128
|
"proper-lockfile": "^4.1.2",
|
|
119
129
|
"unplugin": "^3.3.0",
|
|
120
|
-
"@csszyx/compiler": "0.
|
|
121
|
-
"@csszyx/
|
|
122
|
-
"@csszyx/
|
|
123
|
-
"@csszyx/
|
|
124
|
-
"@csszyx/types": "0.
|
|
130
|
+
"@csszyx/compiler": "0.15.0",
|
|
131
|
+
"@csszyx/svelte-adapter": "0.15.0",
|
|
132
|
+
"@csszyx/vue-adapter": "0.15.0",
|
|
133
|
+
"@csszyx/core": "0.15.0",
|
|
134
|
+
"@csszyx/types": "0.15.0"
|
|
125
135
|
},
|
|
126
136
|
"peerDependencies": {
|
|
127
|
-
"@csszyx/runtime": "^0.
|
|
137
|
+
"@csszyx/runtime": "^0.15.0"
|
|
128
138
|
},
|
|
129
139
|
"devDependencies": {
|
|
130
140
|
"@tailwindcss/node": "4.3.3",
|
|
@@ -137,8 +147,8 @@
|
|
|
137
147
|
"vite": "^8.2.1",
|
|
138
148
|
"vitest": "^4.1.10",
|
|
139
149
|
"webpack": "^5.109.0",
|
|
140
|
-
"@csszyx/runtime": "0.
|
|
141
|
-
"@csszyx/tooling-metadata": "0.
|
|
150
|
+
"@csszyx/runtime": "0.15.0",
|
|
151
|
+
"@csszyx/tooling-metadata": "0.15.0"
|
|
142
152
|
},
|
|
143
153
|
"sideEffects": false,
|
|
144
154
|
"engines": {
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
function sortStrings(values) {
|
|
2
|
-
return [...values].sort((a, b) => {
|
|
3
|
-
if (a < b) return -1;
|
|
4
|
-
if (a > b) return 1;
|
|
5
|
-
return 0;
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const BACKSLASH = String.fromCodePoint(92);
|
|
10
|
-
function unicodeEscape(hexadecimal) {
|
|
11
|
-
return `${BACKSLASH}u${hexadecimal}`;
|
|
12
|
-
}
|
|
13
|
-
function replaceEveryLiteral(value, search, replacement) {
|
|
14
|
-
return value.replaceAll(search, () => replacement);
|
|
15
|
-
}
|
|
16
|
-
function escapeSingleQuotedString(value) {
|
|
17
|
-
let escaped = replaceEveryLiteral(value, BACKSLASH, BACKSLASH.repeat(2));
|
|
18
|
-
escaped = replaceEveryLiteral(escaped, "'", `${BACKSLASH}'`);
|
|
19
|
-
escaped = replaceEveryLiteral(escaped, "\r", `${BACKSLASH}r`);
|
|
20
|
-
return replaceEveryLiteral(escaped, "\n", `${BACKSLASH}n`);
|
|
21
|
-
}
|
|
22
|
-
function escapeDoubleQuotedString(value) {
|
|
23
|
-
const escaped = replaceEveryLiteral(value, BACKSLASH, BACKSLASH.repeat(2));
|
|
24
|
-
return replaceEveryLiteral(escaped, '"', `${BACKSLASH}"`);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function escapeHtmlAttribute(value) {
|
|
28
|
-
let escaped = replaceEveryLiteral(value, "&", "&");
|
|
29
|
-
escaped = replaceEveryLiteral(escaped, '"', """);
|
|
30
|
-
escaped = replaceEveryLiteral(escaped, "<", "<");
|
|
31
|
-
return replaceEveryLiteral(escaped, ">", ">");
|
|
32
|
-
}
|
|
33
|
-
const RAW_SAFELIST_MARKER = "<!-- csszyx exact scanner candidates -->";
|
|
34
|
-
function renderTailwindScannerCandidates(classNames) {
|
|
35
|
-
return `${RAW_SAFELIST_MARKER}
|
|
36
|
-
${classNames.join("\n")}
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { replaceEveryLiteral as a, escapeDoubleQuotedString as b, escapeSingleQuotedString as c, escapeHtmlAttribute as e, renderTailwindScannerCandidates as r, sortStrings as s, unicodeEscape as u };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function sortStrings(values) {
|
|
4
|
-
return [...values].sort((a, b) => {
|
|
5
|
-
if (a < b) return -1;
|
|
6
|
-
if (a > b) return 1;
|
|
7
|
-
return 0;
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const BACKSLASH = String.fromCodePoint(92);
|
|
12
|
-
function unicodeEscape(hexadecimal) {
|
|
13
|
-
return `${BACKSLASH}u${hexadecimal}`;
|
|
14
|
-
}
|
|
15
|
-
function replaceEveryLiteral(value, search, replacement) {
|
|
16
|
-
return value.replaceAll(search, () => replacement);
|
|
17
|
-
}
|
|
18
|
-
function escapeSingleQuotedString(value) {
|
|
19
|
-
let escaped = replaceEveryLiteral(value, BACKSLASH, BACKSLASH.repeat(2));
|
|
20
|
-
escaped = replaceEveryLiteral(escaped, "'", `${BACKSLASH}'`);
|
|
21
|
-
escaped = replaceEveryLiteral(escaped, "\r", `${BACKSLASH}r`);
|
|
22
|
-
return replaceEveryLiteral(escaped, "\n", `${BACKSLASH}n`);
|
|
23
|
-
}
|
|
24
|
-
function escapeDoubleQuotedString(value) {
|
|
25
|
-
const escaped = replaceEveryLiteral(value, BACKSLASH, BACKSLASH.repeat(2));
|
|
26
|
-
return replaceEveryLiteral(escaped, '"', `${BACKSLASH}"`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function escapeHtmlAttribute(value) {
|
|
30
|
-
let escaped = replaceEveryLiteral(value, "&", "&");
|
|
31
|
-
escaped = replaceEveryLiteral(escaped, '"', """);
|
|
32
|
-
escaped = replaceEveryLiteral(escaped, "<", "<");
|
|
33
|
-
return replaceEveryLiteral(escaped, ">", ">");
|
|
34
|
-
}
|
|
35
|
-
const RAW_SAFELIST_MARKER = "<!-- csszyx exact scanner candidates -->";
|
|
36
|
-
function renderTailwindScannerCandidates(classNames) {
|
|
37
|
-
return `${RAW_SAFELIST_MARKER}
|
|
38
|
-
${classNames.join("\n")}
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
exports.escapeDoubleQuotedString = escapeDoubleQuotedString;
|
|
43
|
-
exports.escapeHtmlAttribute = escapeHtmlAttribute;
|
|
44
|
-
exports.escapeSingleQuotedString = escapeSingleQuotedString;
|
|
45
|
-
exports.renderTailwindScannerCandidates = renderTailwindScannerCandidates;
|
|
46
|
-
exports.replaceEveryLiteral = replaceEveryLiteral;
|
|
47
|
-
exports.sortStrings = sortStrings;
|
|
48
|
-
exports.unicodeEscape = unicodeEscape;
|