@csszyx/compiler 0.10.6 → 0.10.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.
- package/dist/color-var.cjs +3 -0
- package/dist/color-var.d.cts +3 -2
- package/dist/color-var.d.mts +3 -2
- package/dist/color-var.mjs +3 -0
- package/dist/index.cjs +22 -2
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +23 -3
- package/dist/shared/{compiler.DGInsDP8.mjs → compiler.DINxoUCF.mjs} +24 -3
- package/dist/shared/{compiler.BCOOXYBh.cjs → compiler.DIYC1vdY.cjs} +25 -2
- package/dist/transform-core.cjs +3 -1
- package/dist/transform-core.d.cts +23 -1
- package/dist/transform-core.d.mts +23 -1
- package/dist/transform-core.mjs +1 -1
- package/package.json +2 -2
package/dist/color-var.cjs
CHANGED
package/dist/color-var.d.cts
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* The runtime/lite inlines this implementation at build time (zero runtime dep).
|
|
7
7
|
*
|
|
8
8
|
* Resolution rules (Tailwind v4 conventions):
|
|
9
|
+
* - undefined/null/empty/non-string → undefined ("no colour", omit the CSS var)
|
|
9
10
|
* - Raw CSS values (#hex, rgb, hsl, oklch) → pass through unchanged
|
|
10
11
|
* - CSS custom properties (--*) → wrapped in var()
|
|
11
12
|
* - Tailwind color names (blue-500, etc.) → var(--color-<name>)
|
|
12
13
|
*
|
|
13
14
|
* @param v - Color value: Tailwind name, hex, rgb/hsl/oklch, or CSS variable
|
|
14
|
-
* @returns CSS-compatible color string
|
|
15
|
+
* @returns CSS-compatible color string, or undefined when there is no colour
|
|
15
16
|
*/
|
|
16
|
-
declare function __szColorVar(v: string): string;
|
|
17
|
+
declare function __szColorVar(v: string | null | undefined): string | undefined;
|
|
17
18
|
|
|
18
19
|
export { __szColorVar };
|
package/dist/color-var.d.mts
CHANGED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* The runtime/lite inlines this implementation at build time (zero runtime dep).
|
|
7
7
|
*
|
|
8
8
|
* Resolution rules (Tailwind v4 conventions):
|
|
9
|
+
* - undefined/null/empty/non-string → undefined ("no colour", omit the CSS var)
|
|
9
10
|
* - Raw CSS values (#hex, rgb, hsl, oklch) → pass through unchanged
|
|
10
11
|
* - CSS custom properties (--*) → wrapped in var()
|
|
11
12
|
* - Tailwind color names (blue-500, etc.) → var(--color-<name>)
|
|
12
13
|
*
|
|
13
14
|
* @param v - Color value: Tailwind name, hex, rgb/hsl/oklch, or CSS variable
|
|
14
|
-
* @returns CSS-compatible color string
|
|
15
|
+
* @returns CSS-compatible color string, or undefined when there is no colour
|
|
15
16
|
*/
|
|
16
|
-
declare function __szColorVar(v: string): string;
|
|
17
|
+
declare function __szColorVar(v: string | null | undefined): string | undefined;
|
|
17
18
|
|
|
18
19
|
export { __szColorVar };
|
package/dist/color-var.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const core = require('@csszyx/core');
|
|
4
|
-
const transformCore = require('./shared/compiler.
|
|
4
|
+
const transformCore = require('./shared/compiler.DIYC1vdY.cjs');
|
|
5
5
|
const oxcParser = require('oxc-parser');
|
|
6
6
|
const t = require('@babel/types');
|
|
7
7
|
const node_crypto = require('node:crypto');
|
|
@@ -117,6 +117,7 @@ function transformSourceCode(source, filename, options) {
|
|
|
117
117
|
// before any sz transform work begins, and doesn't
|
|
118
118
|
// interfere with the JSXAttribute handler below.
|
|
119
119
|
pre(file) {
|
|
120
|
+
transformCore.setSzWarnLocation(void 0);
|
|
120
121
|
let nodeCount = 0;
|
|
121
122
|
babel__namespace.traverse(file.ast, {
|
|
122
123
|
enter() {
|
|
@@ -131,6 +132,11 @@ function transformSourceCode(source, filename, options) {
|
|
|
131
132
|
}
|
|
132
133
|
});
|
|
133
134
|
},
|
|
135
|
+
// Drop the warn location after the file's visitor pass so it
|
|
136
|
+
// never leaks to an unrelated later transform or the runtime path.
|
|
137
|
+
post() {
|
|
138
|
+
transformCore.setSzWarnLocation(void 0);
|
|
139
|
+
},
|
|
134
140
|
visitor: {
|
|
135
141
|
JSXAttribute(path) {
|
|
136
142
|
const attrName = t__namespace.isJSXIdentifier(path.node.name) ? path.node.name.name : "";
|
|
@@ -197,6 +203,13 @@ function transformSourceCode(source, filename, options) {
|
|
|
197
203
|
if (attrName !== "sz") {
|
|
198
204
|
return;
|
|
199
205
|
}
|
|
206
|
+
transformCore.setSzWarnLocation(
|
|
207
|
+
transformCore.formatSzWarnLocation(
|
|
208
|
+
filename ?? "file.tsx",
|
|
209
|
+
path.node.loc?.start.line,
|
|
210
|
+
options?.rootDir
|
|
211
|
+
)
|
|
212
|
+
);
|
|
200
213
|
const value = path.node.value;
|
|
201
214
|
let existingClassNameNode = null;
|
|
202
215
|
let existingClassExpr = null;
|
|
@@ -2288,6 +2301,7 @@ function transformOxc(source, filename, options) {
|
|
|
2288
2301
|
};
|
|
2289
2302
|
}
|
|
2290
2303
|
const effectiveFilename = filename ?? "file.tsx";
|
|
2304
|
+
transformCore.setSzWarnLocation(void 0);
|
|
2291
2305
|
const astBudget = options?.astBudget ?? AST_BUDGET;
|
|
2292
2306
|
const parsed = oxcParser.parseSync(effectiveFilename, source);
|
|
2293
2307
|
if (parsed.errors.length > 0) {
|
|
@@ -2428,6 +2442,10 @@ function transformOxc(source, filename, options) {
|
|
|
2428
2442
|
let runtimeFallbackExpr = null;
|
|
2429
2443
|
let runtimeFallbackAttr = null;
|
|
2430
2444
|
for (const szAttr of szAttrs) {
|
|
2445
|
+
const { line: szWarnLine } = offsetToLineColumn(source, szAttr.start);
|
|
2446
|
+
transformCore.setSzWarnLocation(
|
|
2447
|
+
transformCore.formatSzWarnLocation(effectiveFilename, szWarnLine, options?.rootDir)
|
|
2448
|
+
);
|
|
2431
2449
|
const value = szAttr.value;
|
|
2432
2450
|
if (!value) {
|
|
2433
2451
|
throw new OxcNotImplementedError(
|
|
@@ -2704,6 +2722,7 @@ function transformOxc(source, filename, options) {
|
|
|
2704
2722
|
}
|
|
2705
2723
|
}
|
|
2706
2724
|
}
|
|
2725
|
+
transformCore.setSzWarnLocation(void 0);
|
|
2707
2726
|
if (runtimeFallbackExpr && runtimeFallbackAttr) {
|
|
2708
2727
|
if (classNameAttr) {
|
|
2709
2728
|
throw new OxcNotImplementedError(
|
|
@@ -4283,7 +4302,8 @@ function transformRustBatch(files, options) {
|
|
|
4283
4302
|
{
|
|
4284
4303
|
mangleVars: options?.mangleVars === true,
|
|
4285
4304
|
mangleVarHoistMaxDepth: options?.mangleVarHoistMaxDepth,
|
|
4286
|
-
globalVarAliases: normalizeGlobalVarAliases(options?.globalVarAliases)
|
|
4305
|
+
globalVarAliases: normalizeGlobalVarAliases(options?.globalVarAliases),
|
|
4306
|
+
rootDir: options?.rootDir
|
|
4287
4307
|
}
|
|
4288
4308
|
).map(fromNativeResult);
|
|
4289
4309
|
} catch (err) {
|
package/dist/index.d.cts
CHANGED
|
@@ -329,6 +329,12 @@ interface TransformSourceCodeOptions {
|
|
|
329
329
|
* token names to aliases, for example `--brand-primary` -> `---gz`.
|
|
330
330
|
*/
|
|
331
331
|
globalVarAliases?: GlobalVarAliasTableInput;
|
|
332
|
+
/**
|
|
333
|
+
* Project root used only to render diagnostic file paths relative to it (so a
|
|
334
|
+
* dev-mode "Unknown property" warning reads `src/Foo.tsx:12`, not an absolute
|
|
335
|
+
* path). When omitted, diagnostics fall back to the filename as given.
|
|
336
|
+
*/
|
|
337
|
+
rootDir?: string;
|
|
332
338
|
}
|
|
333
339
|
/**
|
|
334
340
|
* Accepted input shapes for global CSS custom-property alias tables.
|
package/dist/index.d.mts
CHANGED
|
@@ -329,6 +329,12 @@ interface TransformSourceCodeOptions {
|
|
|
329
329
|
* token names to aliases, for example `--brand-primary` -> `---gz`.
|
|
330
330
|
*/
|
|
331
331
|
globalVarAliases?: GlobalVarAliasTableInput;
|
|
332
|
+
/**
|
|
333
|
+
* Project root used only to render diagnostic file paths relative to it (so a
|
|
334
|
+
* dev-mode "Unknown property" warning reads `src/Foo.tsx:12`, not an absolute
|
|
335
|
+
* path). When omitted, diagnostics fall back to the filename as given.
|
|
336
|
+
*/
|
|
337
|
+
rootDir?: string;
|
|
332
338
|
}
|
|
333
339
|
/**
|
|
334
340
|
* Accepted input shapes for global CSS custom-property alias tables.
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init, version, transform_sz, encode } from '@csszyx/core';
|
|
2
|
-
import { t as transform, C as COLOR_PROPERTIES, P as PROPERTY_MAP, g as getCSSVariableName, a as PropertyCategory, K as KNOWN_VARIANTS, b as getVariantPrefix, c as getPropertyCategory,
|
|
3
|
-
export { B as BOOLEAN_SHORTHANDS,
|
|
2
|
+
import { t as transform, s as setSzWarnLocation, f as formatSzWarnLocation, C as COLOR_PROPERTIES, P as PROPERTY_MAP, g as getCSSVariableName, a as PropertyCategory, K as KNOWN_VARIANTS, b as getVariantPrefix, c as getPropertyCategory, d as stripInvalidColorStrings } from './shared/compiler.DINxoUCF.mjs';
|
|
3
|
+
export { B as BOOLEAN_SHORTHANDS, e as PROPERTY_CATEGORY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, h as SUGGESTION_MAP, i as isValidSzProp, n as normalizeClassName } from './shared/compiler.DINxoUCF.mjs';
|
|
4
4
|
import { parseSync } from 'oxc-parser';
|
|
5
5
|
import * as t from '@babel/types';
|
|
6
6
|
import { createHash } from 'node:crypto';
|
|
@@ -98,6 +98,7 @@ function transformSourceCode(source, filename, options) {
|
|
|
98
98
|
// before any sz transform work begins, and doesn't
|
|
99
99
|
// interfere with the JSXAttribute handler below.
|
|
100
100
|
pre(file) {
|
|
101
|
+
setSzWarnLocation(void 0);
|
|
101
102
|
let nodeCount = 0;
|
|
102
103
|
babel.traverse(file.ast, {
|
|
103
104
|
enter() {
|
|
@@ -112,6 +113,11 @@ function transformSourceCode(source, filename, options) {
|
|
|
112
113
|
}
|
|
113
114
|
});
|
|
114
115
|
},
|
|
116
|
+
// Drop the warn location after the file's visitor pass so it
|
|
117
|
+
// never leaks to an unrelated later transform or the runtime path.
|
|
118
|
+
post() {
|
|
119
|
+
setSzWarnLocation(void 0);
|
|
120
|
+
},
|
|
115
121
|
visitor: {
|
|
116
122
|
JSXAttribute(path) {
|
|
117
123
|
const attrName = t.isJSXIdentifier(path.node.name) ? path.node.name.name : "";
|
|
@@ -178,6 +184,13 @@ function transformSourceCode(source, filename, options) {
|
|
|
178
184
|
if (attrName !== "sz") {
|
|
179
185
|
return;
|
|
180
186
|
}
|
|
187
|
+
setSzWarnLocation(
|
|
188
|
+
formatSzWarnLocation(
|
|
189
|
+
filename ?? "file.tsx",
|
|
190
|
+
path.node.loc?.start.line,
|
|
191
|
+
options?.rootDir
|
|
192
|
+
)
|
|
193
|
+
);
|
|
181
194
|
const value = path.node.value;
|
|
182
195
|
let existingClassNameNode = null;
|
|
183
196
|
let existingClassExpr = null;
|
|
@@ -2269,6 +2282,7 @@ function transformOxc(source, filename, options) {
|
|
|
2269
2282
|
};
|
|
2270
2283
|
}
|
|
2271
2284
|
const effectiveFilename = filename ?? "file.tsx";
|
|
2285
|
+
setSzWarnLocation(void 0);
|
|
2272
2286
|
const astBudget = options?.astBudget ?? AST_BUDGET;
|
|
2273
2287
|
const parsed = parseSync(effectiveFilename, source);
|
|
2274
2288
|
if (parsed.errors.length > 0) {
|
|
@@ -2409,6 +2423,10 @@ function transformOxc(source, filename, options) {
|
|
|
2409
2423
|
let runtimeFallbackExpr = null;
|
|
2410
2424
|
let runtimeFallbackAttr = null;
|
|
2411
2425
|
for (const szAttr of szAttrs) {
|
|
2426
|
+
const { line: szWarnLine } = offsetToLineColumn(source, szAttr.start);
|
|
2427
|
+
setSzWarnLocation(
|
|
2428
|
+
formatSzWarnLocation(effectiveFilename, szWarnLine, options?.rootDir)
|
|
2429
|
+
);
|
|
2412
2430
|
const value = szAttr.value;
|
|
2413
2431
|
if (!value) {
|
|
2414
2432
|
throw new OxcNotImplementedError(
|
|
@@ -2685,6 +2703,7 @@ function transformOxc(source, filename, options) {
|
|
|
2685
2703
|
}
|
|
2686
2704
|
}
|
|
2687
2705
|
}
|
|
2706
|
+
setSzWarnLocation(void 0);
|
|
2688
2707
|
if (runtimeFallbackExpr && runtimeFallbackAttr) {
|
|
2689
2708
|
if (classNameAttr) {
|
|
2690
2709
|
throw new OxcNotImplementedError(
|
|
@@ -4264,7 +4283,8 @@ function transformRustBatch(files, options) {
|
|
|
4264
4283
|
{
|
|
4265
4284
|
mangleVars: options?.mangleVars === true,
|
|
4266
4285
|
mangleVarHoistMaxDepth: options?.mangleVarHoistMaxDepth,
|
|
4267
|
-
globalVarAliases: normalizeGlobalVarAliases(options?.globalVarAliases)
|
|
4286
|
+
globalVarAliases: normalizeGlobalVarAliases(options?.globalVarAliases),
|
|
4287
|
+
rootDir: options?.rootDir
|
|
4268
4288
|
}
|
|
4269
4289
|
).map(fromNativeResult);
|
|
4270
4290
|
} catch (err) {
|
|
@@ -1495,6 +1495,26 @@ function handleSupports(supportsObj, prefix) {
|
|
|
1495
1495
|
return classes;
|
|
1496
1496
|
}
|
|
1497
1497
|
let szTransformDepth = 0;
|
|
1498
|
+
let szWarnLocation;
|
|
1499
|
+
function setSzWarnLocation(location) {
|
|
1500
|
+
szWarnLocation = location;
|
|
1501
|
+
}
|
|
1502
|
+
function formatSzWarnLocation(file, line, rootDir) {
|
|
1503
|
+
let rel = file;
|
|
1504
|
+
if (rootDir) {
|
|
1505
|
+
let end = rootDir.length;
|
|
1506
|
+
while (end > 0 && (rootDir[end - 1] === "/" || rootDir[end - 1] === "\\")) {
|
|
1507
|
+
end--;
|
|
1508
|
+
}
|
|
1509
|
+
const root = rootDir.slice(0, end);
|
|
1510
|
+
if (file === root) {
|
|
1511
|
+
rel = file;
|
|
1512
|
+
} else if (file.startsWith(`${root}/`) || file.startsWith(`${root}\\`)) {
|
|
1513
|
+
rel = file.slice(root.length + 1);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
return line === void 0 ? rel : `${rel}:${line}`;
|
|
1517
|
+
}
|
|
1498
1518
|
function transform(szProp, prefix = "", mangleMap) {
|
|
1499
1519
|
if (!szProp || typeof szProp !== "object") {
|
|
1500
1520
|
return { className: "", attributes: {} };
|
|
@@ -2339,14 +2359,15 @@ function transformImpl(szProp, prefix, mangleMap) {
|
|
|
2339
2359
|
KNOWN_VARIANTS.has(rawKey) || // Parametric/scope variants (group, peer, has, not, data, aria, supports)
|
|
2340
2360
|
SPECIAL_VARIANTS.has(rawKey) || rawKey === "min" || rawKey === "max";
|
|
2341
2361
|
if (!isKnown) {
|
|
2362
|
+
const at = szWarnLocation ? ` at ${szWarnLocation}` : "";
|
|
2342
2363
|
const suggestion = SUGGESTION_MAP[rawKey];
|
|
2343
2364
|
if (suggestion) {
|
|
2344
2365
|
console.warn(
|
|
2345
|
-
`[csszyx] Use the canonical key "${suggestion}" instead of "${rawKey}".`
|
|
2366
|
+
`[csszyx] Use the canonical key "${suggestion}" instead of "${rawKey}"${at}.`
|
|
2346
2367
|
);
|
|
2347
2368
|
} else {
|
|
2348
2369
|
console.warn(
|
|
2349
|
-
`[csszyx] Unknown property "${rawKey}" in sz prop. This will be ignored. Check for typos.`
|
|
2370
|
+
`[csszyx] Unknown property "${rawKey}" in sz prop${at}. This will be ignored. Check for typos.`
|
|
2350
2371
|
);
|
|
2351
2372
|
}
|
|
2352
2373
|
}
|
|
@@ -2465,4 +2486,4 @@ function normalizeClassName(className) {
|
|
|
2465
2486
|
return className.split(/\s+/).filter(Boolean).join(" ");
|
|
2466
2487
|
}
|
|
2467
2488
|
|
|
2468
|
-
export { BOOLEAN_SHORTHANDS as B, COLOR_PROPERTIES as C, KNOWN_VARIANTS as K, MAX_SZ_DEPTH as M, PROPERTY_MAP as P, REMOVED_BOOLEAN_SUGAR as R, SPECIAL_VARIANTS as S, VARIANT_MAP as V, PropertyCategory as a, getVariantPrefix as b, getPropertyCategory as c,
|
|
2489
|
+
export { BOOLEAN_SHORTHANDS as B, COLOR_PROPERTIES as C, KNOWN_VARIANTS as K, MAX_SZ_DEPTH as M, PROPERTY_MAP as P, REMOVED_BOOLEAN_SUGAR as R, SPECIAL_VARIANTS as S, VARIANT_MAP as V, PropertyCategory as a, getVariantPrefix as b, getPropertyCategory as c, stripInvalidColorStrings as d, PROPERTY_CATEGORY_MAP as e, formatSzWarnLocation as f, getCSSVariableName as g, SUGGESTION_MAP as h, isValidSzProp as i, SzDepthError as j, isForbiddenSzKey as k, normalizeArbitraryValue as l, normalizeArbitraryVariant as m, normalizeClassName as n, setSzWarnLocation as s, transform as t };
|
|
@@ -1497,6 +1497,26 @@ function handleSupports(supportsObj, prefix) {
|
|
|
1497
1497
|
return classes;
|
|
1498
1498
|
}
|
|
1499
1499
|
let szTransformDepth = 0;
|
|
1500
|
+
let szWarnLocation;
|
|
1501
|
+
function setSzWarnLocation(location) {
|
|
1502
|
+
szWarnLocation = location;
|
|
1503
|
+
}
|
|
1504
|
+
function formatSzWarnLocation(file, line, rootDir) {
|
|
1505
|
+
let rel = file;
|
|
1506
|
+
if (rootDir) {
|
|
1507
|
+
let end = rootDir.length;
|
|
1508
|
+
while (end > 0 && (rootDir[end - 1] === "/" || rootDir[end - 1] === "\\")) {
|
|
1509
|
+
end--;
|
|
1510
|
+
}
|
|
1511
|
+
const root = rootDir.slice(0, end);
|
|
1512
|
+
if (file === root) {
|
|
1513
|
+
rel = file;
|
|
1514
|
+
} else if (file.startsWith(`${root}/`) || file.startsWith(`${root}\\`)) {
|
|
1515
|
+
rel = file.slice(root.length + 1);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
return line === void 0 ? rel : `${rel}:${line}`;
|
|
1519
|
+
}
|
|
1500
1520
|
function transform(szProp, prefix = "", mangleMap) {
|
|
1501
1521
|
if (!szProp || typeof szProp !== "object") {
|
|
1502
1522
|
return { className: "", attributes: {} };
|
|
@@ -2341,14 +2361,15 @@ function transformImpl(szProp, prefix, mangleMap) {
|
|
|
2341
2361
|
KNOWN_VARIANTS.has(rawKey) || // Parametric/scope variants (group, peer, has, not, data, aria, supports)
|
|
2342
2362
|
SPECIAL_VARIANTS.has(rawKey) || rawKey === "min" || rawKey === "max";
|
|
2343
2363
|
if (!isKnown) {
|
|
2364
|
+
const at = szWarnLocation ? ` at ${szWarnLocation}` : "";
|
|
2344
2365
|
const suggestion = SUGGESTION_MAP[rawKey];
|
|
2345
2366
|
if (suggestion) {
|
|
2346
2367
|
console.warn(
|
|
2347
|
-
`[csszyx] Use the canonical key "${suggestion}" instead of "${rawKey}".`
|
|
2368
|
+
`[csszyx] Use the canonical key "${suggestion}" instead of "${rawKey}"${at}.`
|
|
2348
2369
|
);
|
|
2349
2370
|
} else {
|
|
2350
2371
|
console.warn(
|
|
2351
|
-
`[csszyx] Unknown property "${rawKey}" in sz prop. This will be ignored. Check for typos.`
|
|
2372
|
+
`[csszyx] Unknown property "${rawKey}" in sz prop${at}. This will be ignored. Check for typos.`
|
|
2352
2373
|
);
|
|
2353
2374
|
}
|
|
2354
2375
|
}
|
|
@@ -2479,6 +2500,7 @@ exports.SPECIAL_VARIANTS = SPECIAL_VARIANTS;
|
|
|
2479
2500
|
exports.SUGGESTION_MAP = SUGGESTION_MAP;
|
|
2480
2501
|
exports.SzDepthError = SzDepthError;
|
|
2481
2502
|
exports.VARIANT_MAP = VARIANT_MAP;
|
|
2503
|
+
exports.formatSzWarnLocation = formatSzWarnLocation;
|
|
2482
2504
|
exports.getCSSVariableName = getCSSVariableName;
|
|
2483
2505
|
exports.getPropertyCategory = getPropertyCategory;
|
|
2484
2506
|
exports.getVariantPrefix = getVariantPrefix;
|
|
@@ -2487,5 +2509,6 @@ exports.isValidSzProp = isValidSzProp;
|
|
|
2487
2509
|
exports.normalizeArbitraryValue = normalizeArbitraryValue;
|
|
2488
2510
|
exports.normalizeArbitraryVariant = normalizeArbitraryVariant;
|
|
2489
2511
|
exports.normalizeClassName = normalizeClassName;
|
|
2512
|
+
exports.setSzWarnLocation = setSzWarnLocation;
|
|
2490
2513
|
exports.stripInvalidColorStrings = stripInvalidColorStrings;
|
|
2491
2514
|
exports.transform = transform;
|
package/dist/transform-core.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const transformCore = require('./shared/compiler.
|
|
3
|
+
const transformCore = require('./shared/compiler.DIYC1vdY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -13,10 +13,12 @@ exports.SPECIAL_VARIANTS = transformCore.SPECIAL_VARIANTS;
|
|
|
13
13
|
exports.SUGGESTION_MAP = transformCore.SUGGESTION_MAP;
|
|
14
14
|
exports.SzDepthError = transformCore.SzDepthError;
|
|
15
15
|
exports.VARIANT_MAP = transformCore.VARIANT_MAP;
|
|
16
|
+
exports.formatSzWarnLocation = transformCore.formatSzWarnLocation;
|
|
16
17
|
exports.getVariantPrefix = transformCore.getVariantPrefix;
|
|
17
18
|
exports.isForbiddenSzKey = transformCore.isForbiddenSzKey;
|
|
18
19
|
exports.isValidSzProp = transformCore.isValidSzProp;
|
|
19
20
|
exports.normalizeArbitraryValue = transformCore.normalizeArbitraryValue;
|
|
20
21
|
exports.normalizeArbitraryVariant = transformCore.normalizeArbitraryVariant;
|
|
21
22
|
exports.normalizeClassName = transformCore.normalizeClassName;
|
|
23
|
+
exports.setSzWarnLocation = transformCore.setSzWarnLocation;
|
|
22
24
|
exports.transform = transformCore.transform;
|
|
@@ -104,6 +104,28 @@ declare function normalizeArbitraryValue(value: string): string;
|
|
|
104
104
|
* @returns the mapped or kebab-cased variant prefix
|
|
105
105
|
*/
|
|
106
106
|
declare function getVariantPrefix(key: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Set (or clear, with `undefined`) the source location appended to the dev-mode
|
|
109
|
+
* unknown-property warning. Called by the build engines (oxc/babel) around each
|
|
110
|
+
* sz attribute; a balanced clear MUST follow so the location never leaks to an
|
|
111
|
+
* unrelated later transform.
|
|
112
|
+
*
|
|
113
|
+
* @param location - `relativePath:line` (or `relativePath`) to attribute the
|
|
114
|
+
* warning to, or `undefined` to clear.
|
|
115
|
+
*/
|
|
116
|
+
declare function setSzWarnLocation(location: string | undefined): void;
|
|
117
|
+
/**
|
|
118
|
+
* Render a `relativePath:line` location string for the unknown-property warning,
|
|
119
|
+
* relative to the project root when one is known. Avoids a `node:path` dependency
|
|
120
|
+
* (this module is also browser-bundled) with a plain prefix strip — good enough
|
|
121
|
+
* for a human-facing diagnostic.
|
|
122
|
+
*
|
|
123
|
+
* @param file - the source filename (typically absolute, as the bundler gives it).
|
|
124
|
+
* @param line - 1-based line of the sz prop, or undefined to omit it.
|
|
125
|
+
* @param rootDir - project root to relativize against, or undefined to keep `file`.
|
|
126
|
+
* @returns `relativePath:line`, `relativePath`, or the raw filename.
|
|
127
|
+
*/
|
|
128
|
+
declare function formatSzWarnLocation(file: string, line: number | undefined, rootDir: string | undefined): string;
|
|
107
129
|
/**
|
|
108
130
|
* Transform an sz object into a className string plus any attributes, bounding
|
|
109
131
|
* recursion depth via {@link szTransformDepth}.
|
|
@@ -129,5 +151,5 @@ declare function isValidSzProp(szProp: unknown): szProp is SzObject;
|
|
|
129
151
|
*/
|
|
130
152
|
declare function normalizeClassName(className: string): string;
|
|
131
153
|
|
|
132
|
-
export { BOOLEAN_SHORTHANDS, KNOWN_VARIANTS, MAX_SZ_DEPTH, PROPERTY_MAP, REMOVED_BOOLEAN_SUGAR, SPECIAL_VARIANTS, SUGGESTION_MAP, SzDepthError, VARIANT_MAP, getVariantPrefix, isForbiddenSzKey, isValidSzProp, normalizeArbitraryValue, normalizeArbitraryVariant, normalizeClassName, transform };
|
|
154
|
+
export { BOOLEAN_SHORTHANDS, KNOWN_VARIANTS, MAX_SZ_DEPTH, PROPERTY_MAP, REMOVED_BOOLEAN_SUGAR, SPECIAL_VARIANTS, SUGGESTION_MAP, SzDepthError, VARIANT_MAP, formatSzWarnLocation, getVariantPrefix, isForbiddenSzKey, isValidSzProp, normalizeArbitraryValue, normalizeArbitraryVariant, normalizeClassName, setSzWarnLocation, transform };
|
|
133
155
|
export type { ReadonlySzObject, ReadonlySzValue, SzObject, SzValue, TransformResult };
|
|
@@ -104,6 +104,28 @@ declare function normalizeArbitraryValue(value: string): string;
|
|
|
104
104
|
* @returns the mapped or kebab-cased variant prefix
|
|
105
105
|
*/
|
|
106
106
|
declare function getVariantPrefix(key: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* Set (or clear, with `undefined`) the source location appended to the dev-mode
|
|
109
|
+
* unknown-property warning. Called by the build engines (oxc/babel) around each
|
|
110
|
+
* sz attribute; a balanced clear MUST follow so the location never leaks to an
|
|
111
|
+
* unrelated later transform.
|
|
112
|
+
*
|
|
113
|
+
* @param location - `relativePath:line` (or `relativePath`) to attribute the
|
|
114
|
+
* warning to, or `undefined` to clear.
|
|
115
|
+
*/
|
|
116
|
+
declare function setSzWarnLocation(location: string | undefined): void;
|
|
117
|
+
/**
|
|
118
|
+
* Render a `relativePath:line` location string for the unknown-property warning,
|
|
119
|
+
* relative to the project root when one is known. Avoids a `node:path` dependency
|
|
120
|
+
* (this module is also browser-bundled) with a plain prefix strip — good enough
|
|
121
|
+
* for a human-facing diagnostic.
|
|
122
|
+
*
|
|
123
|
+
* @param file - the source filename (typically absolute, as the bundler gives it).
|
|
124
|
+
* @param line - 1-based line of the sz prop, or undefined to omit it.
|
|
125
|
+
* @param rootDir - project root to relativize against, or undefined to keep `file`.
|
|
126
|
+
* @returns `relativePath:line`, `relativePath`, or the raw filename.
|
|
127
|
+
*/
|
|
128
|
+
declare function formatSzWarnLocation(file: string, line: number | undefined, rootDir: string | undefined): string;
|
|
107
129
|
/**
|
|
108
130
|
* Transform an sz object into a className string plus any attributes, bounding
|
|
109
131
|
* recursion depth via {@link szTransformDepth}.
|
|
@@ -129,5 +151,5 @@ declare function isValidSzProp(szProp: unknown): szProp is SzObject;
|
|
|
129
151
|
*/
|
|
130
152
|
declare function normalizeClassName(className: string): string;
|
|
131
153
|
|
|
132
|
-
export { BOOLEAN_SHORTHANDS, KNOWN_VARIANTS, MAX_SZ_DEPTH, PROPERTY_MAP, REMOVED_BOOLEAN_SUGAR, SPECIAL_VARIANTS, SUGGESTION_MAP, SzDepthError, VARIANT_MAP, getVariantPrefix, isForbiddenSzKey, isValidSzProp, normalizeArbitraryValue, normalizeArbitraryVariant, normalizeClassName, transform };
|
|
154
|
+
export { BOOLEAN_SHORTHANDS, KNOWN_VARIANTS, MAX_SZ_DEPTH, PROPERTY_MAP, REMOVED_BOOLEAN_SUGAR, SPECIAL_VARIANTS, SUGGESTION_MAP, SzDepthError, VARIANT_MAP, formatSzWarnLocation, getVariantPrefix, isForbiddenSzKey, isValidSzProp, normalizeArbitraryValue, normalizeArbitraryVariant, normalizeClassName, setSzWarnLocation, transform };
|
|
133
155
|
export type { ReadonlySzObject, ReadonlySzValue, SzObject, SzValue, TransformResult };
|
package/dist/transform-core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { B as BOOLEAN_SHORTHANDS, K as KNOWN_VARIANTS, M as MAX_SZ_DEPTH, P as PROPERTY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS,
|
|
1
|
+
export { B as BOOLEAN_SHORTHANDS, K as KNOWN_VARIANTS, M as MAX_SZ_DEPTH, P as PROPERTY_MAP, R as REMOVED_BOOLEAN_SUGAR, S as SPECIAL_VARIANTS, h as SUGGESTION_MAP, j as SzDepthError, V as VARIANT_MAP, f as formatSzWarnLocation, b as getVariantPrefix, k as isForbiddenSzKey, i as isValidSzProp, l as normalizeArbitraryValue, m as normalizeArbitraryVariant, n as normalizeClassName, s as setSzWarnLocation, t as transform } from './shared/compiler.DINxoUCF.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/compiler",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Core compiler and transformation logic for csszyx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"csszyx",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@babel/types": "^7.23.6",
|
|
66
66
|
"magic-string": "0.30.21",
|
|
67
67
|
"oxc-parser": "0.131.0",
|
|
68
|
-
"@csszyx/core": "0.10.
|
|
68
|
+
"@csszyx/core": "0.10.7"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/babel__core": "^7.20.5",
|