@empline/preflight 1.1.4 → 1.1.5
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/checks/tailwind/undefined-tailwind-utilities.d.ts +29 -0
- package/dist/checks/tailwind/undefined-tailwind-utilities.d.ts.map +1 -0
- package/dist/checks/tailwind/undefined-tailwind-utilities.js +337 -0
- package/dist/checks/tailwind/undefined-tailwind-utilities.js.map +1 -0
- package/dist/checks/turbopack/map-closure-safety.d.ts +37 -0
- package/dist/checks/turbopack/map-closure-safety.d.ts.map +1 -0
- package/dist/checks/turbopack/map-closure-safety.js +261 -0
- package/dist/checks/turbopack/map-closure-safety.js.map +1 -0
- package/dist/core/categories.d.ts.map +1 -1
- package/dist/core/categories.js +42 -0
- package/dist/core/categories.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Undefined Tailwind Utilities Preflight (BLOCKING)
|
|
4
|
+
*
|
|
5
|
+
* Detects Tailwind utility classes that reference undefined CSS variables.
|
|
6
|
+
* This prevents invisible UI elements caused by missing theme tokens.
|
|
7
|
+
*
|
|
8
|
+
* Common issue detected:
|
|
9
|
+
* - `bg-background` used when theme defines `--bg-primary` instead of `--background`
|
|
10
|
+
* - Other utility classes that expect shadcn-style CSS variables
|
|
11
|
+
*
|
|
12
|
+
* Why this matters:
|
|
13
|
+
* - Using undefined CSS variables results in invisible elements
|
|
14
|
+
* - Components may appear broken (e.g., toggle thumbs not visible)
|
|
15
|
+
* - These issues are hard to detect visually until specific states are reached
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* pnpm preflight:undefined-tailwind-utilities
|
|
19
|
+
* pnpm preflight:undefined-tailwind-utilities --verbose
|
|
20
|
+
*/
|
|
21
|
+
export declare const id = "tailwind/undefined-tailwind-utilities";
|
|
22
|
+
export declare const name = "Undefined Tailwind Utilities";
|
|
23
|
+
export declare const category = "tailwind";
|
|
24
|
+
export declare const blocking = true;
|
|
25
|
+
export declare const description = "Detects Tailwind classes using undefined CSS variables (BLOCKING)";
|
|
26
|
+
export declare const tags: string[];
|
|
27
|
+
export declare const requires: string[];
|
|
28
|
+
export declare function run(): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=undefined-tailwind-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undefined-tailwind-utilities.d.ts","sourceRoot":"","sources":["../../../src/checks/tailwind/undefined-tailwind-utilities.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AASH,eAAO,MAAM,EAAE,0CAA0C,CAAC;AAC1D,eAAO,MAAM,IAAI,iCAAiC,CAAC;AACnD,eAAO,MAAM,QAAQ,aAAa,CAAC;AACnC,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,WAAW,sEAAsE,CAAC;AAC/F,eAAO,MAAM,IAAI,UAAiD,CAAC;AACnE,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAoLxC,wBAAsB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAuHzC"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Undefined Tailwind Utilities Preflight (BLOCKING)
|
|
5
|
+
*
|
|
6
|
+
* Detects Tailwind utility classes that reference undefined CSS variables.
|
|
7
|
+
* This prevents invisible UI elements caused by missing theme tokens.
|
|
8
|
+
*
|
|
9
|
+
* Common issue detected:
|
|
10
|
+
* - `bg-background` used when theme defines `--bg-primary` instead of `--background`
|
|
11
|
+
* - Other utility classes that expect shadcn-style CSS variables
|
|
12
|
+
*
|
|
13
|
+
* Why this matters:
|
|
14
|
+
* - Using undefined CSS variables results in invisible elements
|
|
15
|
+
* - Components may appear broken (e.g., toggle thumbs not visible)
|
|
16
|
+
* - These issues are hard to detect visually until specific states are reached
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* pnpm preflight:undefined-tailwind-utilities
|
|
20
|
+
* pnpm preflight:undefined-tailwind-utilities --verbose
|
|
21
|
+
*/
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.requires = exports.tags = exports.description = exports.blocking = exports.category = exports.name = exports.id = void 0;
|
|
57
|
+
exports.run = run;
|
|
58
|
+
const fs = __importStar(require("fs"));
|
|
59
|
+
const file_cache_1 = require("../../shared/file-cache");
|
|
60
|
+
const glob_patterns_1 = require("../../shared/glob-patterns");
|
|
61
|
+
const console_chars_1 = require("../../utils/console-chars");
|
|
62
|
+
const universal_progress_reporter_1 = require("../system/universal-progress-reporter");
|
|
63
|
+
// Check metadata
|
|
64
|
+
exports.id = "tailwind/undefined-tailwind-utilities";
|
|
65
|
+
exports.name = "Undefined Tailwind Utilities";
|
|
66
|
+
exports.category = "tailwind";
|
|
67
|
+
exports.blocking = true;
|
|
68
|
+
exports.description = "Detects Tailwind classes using undefined CSS variables (BLOCKING)";
|
|
69
|
+
exports.tags = ["tailwind", "css-variables", "theming", "ui"];
|
|
70
|
+
exports.requires = ["tailwindcss"];
|
|
71
|
+
const EXCLUDED = (0, glob_patterns_1.extendExcludes)(glob_patterns_1.STANDARD_EXCLUDES, [
|
|
72
|
+
"**/test-results/**",
|
|
73
|
+
"**/*.test.tsx",
|
|
74
|
+
"**/*.spec.tsx",
|
|
75
|
+
"**/*.stories.tsx",
|
|
76
|
+
]);
|
|
77
|
+
/**
|
|
78
|
+
* Tailwind utility classes that rely on CSS variables not defined in our theme.
|
|
79
|
+
* These often come from copying shadcn/ui components that expect different variable names.
|
|
80
|
+
*
|
|
81
|
+
* Patterns use (?:\/\d+)? to optionally match opacity modifiers like /20, /50, etc.
|
|
82
|
+
*
|
|
83
|
+
* Format: { pattern, name, message, suggestion, severity }
|
|
84
|
+
*/
|
|
85
|
+
const UNDEFINED_UTILITIES = [
|
|
86
|
+
{
|
|
87
|
+
// shadcn expects --background, we use --bg-primary
|
|
88
|
+
pattern: /\bbg-background(?:\/\d+)?\b/g,
|
|
89
|
+
name: "bg-background",
|
|
90
|
+
message: "bg-background uses undefined --background CSS variable",
|
|
91
|
+
suggestion: "Use bg-white, bg-[var(--bg-primary)], or appropriate color class",
|
|
92
|
+
severity: "error",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
// shadcn expects --foreground, we use --text-primary
|
|
96
|
+
pattern: /\btext-foreground(?:\/\d+)?\b/g,
|
|
97
|
+
name: "text-foreground",
|
|
98
|
+
message: "text-foreground uses undefined --foreground CSS variable",
|
|
99
|
+
suggestion: "Use text-[var(--text-primary)] or appropriate color class",
|
|
100
|
+
severity: "error",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
// shadcn expects --muted, we use --text-secondary or --bg-tertiary
|
|
104
|
+
// Matches: bg-muted, bg-muted/20, bg-muted/50, etc.
|
|
105
|
+
pattern: /\bbg-muted(?:\/\d+)?\b/g,
|
|
106
|
+
name: "bg-muted",
|
|
107
|
+
message: "bg-muted uses undefined --muted CSS variable",
|
|
108
|
+
suggestion: "Use bg-[var(--bg-tertiary)] or bg-[var(--bg-tertiary)]/20 for opacity",
|
|
109
|
+
severity: "error",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
// Matches: text-muted-foreground, text-muted-foreground/70, etc.
|
|
113
|
+
pattern: /\btext-muted-foreground(?:\/\d+)?\b/g,
|
|
114
|
+
name: "text-muted-foreground",
|
|
115
|
+
message: "text-muted-foreground uses undefined --muted-foreground CSS variable",
|
|
116
|
+
suggestion: "Use text-[var(--text-secondary)] or text-[var(--text-secondary)]/70 for opacity",
|
|
117
|
+
severity: "error",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
// shadcn expects --card, we use --bg-primary
|
|
121
|
+
pattern: /\bbg-card(?:\/\d+)?\b/g,
|
|
122
|
+
name: "bg-card",
|
|
123
|
+
message: "bg-card uses undefined --card CSS variable",
|
|
124
|
+
suggestion: "Use bg-[var(--bg-primary)] or appropriate color class",
|
|
125
|
+
severity: "error",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
// shadcn expects --popover
|
|
129
|
+
pattern: /\bbg-popover(?:\/\d+)?\b/g,
|
|
130
|
+
name: "bg-popover",
|
|
131
|
+
message: "bg-popover uses undefined --popover CSS variable",
|
|
132
|
+
suggestion: "Use bg-[var(--bg-primary)] or bg-white for popover backgrounds",
|
|
133
|
+
severity: "error",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
// shadcn expects --accent
|
|
137
|
+
pattern: /\bbg-accent(?:\/\d+)?\b/g,
|
|
138
|
+
name: "bg-accent",
|
|
139
|
+
message: "bg-accent uses undefined --accent CSS variable",
|
|
140
|
+
suggestion: "Use bg-[var(--color-primary-light)] or appropriate accent color",
|
|
141
|
+
severity: "warning",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
pattern: /\btext-accent-foreground(?:\/\d+)?\b/g,
|
|
145
|
+
name: "text-accent-foreground",
|
|
146
|
+
message: "text-accent-foreground uses undefined --accent-foreground CSS variable",
|
|
147
|
+
suggestion: "Use text-[var(--color-primary)] or appropriate color class",
|
|
148
|
+
severity: "warning",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
// shadcn expects --border, we use --border-color
|
|
152
|
+
pattern: /\bborder-border(?:\/\d+)?\b/g,
|
|
153
|
+
name: "border-border",
|
|
154
|
+
message: "border-border uses undefined --border CSS variable",
|
|
155
|
+
suggestion: "Use border-[var(--border-color)] instead",
|
|
156
|
+
severity: "error",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
// shadcn expects --input
|
|
160
|
+
pattern: /\bbg-input(?:\/\d+)?\b/g,
|
|
161
|
+
name: "bg-input",
|
|
162
|
+
message: "bg-input uses undefined --input CSS variable",
|
|
163
|
+
suggestion: "Use bg-[var(--bg-secondary)] or bg-white for input backgrounds",
|
|
164
|
+
severity: "warning",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
// shadcn expects --ring
|
|
168
|
+
pattern: /\bring-ring(?:\/\d+)?\b/g,
|
|
169
|
+
name: "ring-ring",
|
|
170
|
+
message: "ring-ring uses undefined --ring CSS variable",
|
|
171
|
+
suggestion: "Use ring-[var(--color-primary)] for focus rings",
|
|
172
|
+
severity: "warning",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
// shadcn expects --destructive
|
|
176
|
+
pattern: /\bbg-destructive(?:\/\d+)?\b/g,
|
|
177
|
+
name: "bg-destructive",
|
|
178
|
+
message: "bg-destructive uses undefined --destructive CSS variable",
|
|
179
|
+
suggestion: "Use bg-[var(--error-main)] for destructive/error backgrounds",
|
|
180
|
+
severity: "warning",
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
pattern: /\btext-destructive(?:\/\d+)?\b/g,
|
|
184
|
+
name: "text-destructive",
|
|
185
|
+
message: "text-destructive uses undefined --destructive CSS variable",
|
|
186
|
+
suggestion: "Use text-[var(--error-main)] for error text",
|
|
187
|
+
severity: "warning",
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
function checkFile(filePath, content) {
|
|
191
|
+
const issues = [];
|
|
192
|
+
const lines = content.split("\n");
|
|
193
|
+
for (const utility of UNDEFINED_UTILITIES) {
|
|
194
|
+
let match;
|
|
195
|
+
// Reset lastIndex for global regex
|
|
196
|
+
utility.pattern.lastIndex = 0;
|
|
197
|
+
while ((match = utility.pattern.exec(content)) !== null) {
|
|
198
|
+
// Find line number
|
|
199
|
+
let lineNumber = 1;
|
|
200
|
+
let charCount = 0;
|
|
201
|
+
for (let i = 0; i < lines.length; i++) {
|
|
202
|
+
charCount += lines[i].length + 1;
|
|
203
|
+
if (charCount > match.index) {
|
|
204
|
+
lineNumber = i + 1;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
issues.push({
|
|
209
|
+
file: filePath,
|
|
210
|
+
line: lineNumber,
|
|
211
|
+
type: utility.name,
|
|
212
|
+
severity: utility.severity,
|
|
213
|
+
message: utility.message,
|
|
214
|
+
suggestion: utility.suggestion,
|
|
215
|
+
snippet: lines[lineNumber - 1]?.trim().substring(0, 100),
|
|
216
|
+
match: match[0],
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return issues;
|
|
221
|
+
}
|
|
222
|
+
// CACHED FILE LISTS
|
|
223
|
+
let _cachedComponentFiles = null;
|
|
224
|
+
async function getComponentFiles() {
|
|
225
|
+
if (!_cachedComponentFiles) {
|
|
226
|
+
_cachedComponentFiles = await file_cache_1.fileCache.getComponentFiles();
|
|
227
|
+
}
|
|
228
|
+
return _cachedComponentFiles;
|
|
229
|
+
}
|
|
230
|
+
async function run() {
|
|
231
|
+
const reporter = (0, universal_progress_reporter_1.createUniversalProgressReporter)(exports.name);
|
|
232
|
+
const args = process.argv.slice(2);
|
|
233
|
+
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
234
|
+
const warnOnly = args.includes("--warn") || args.includes("-w");
|
|
235
|
+
console.log(`\n${console_chars_1.emoji.palette} Undefined Tailwind Utilities Preflight`);
|
|
236
|
+
console.log((0, console_chars_1.createDivider)(80, "heavy"));
|
|
237
|
+
if (warnOnly) {
|
|
238
|
+
console.log(`${console_chars_1.emoji.warning} Running in warning mode - not blocking.\n`);
|
|
239
|
+
}
|
|
240
|
+
const startTime = Date.now();
|
|
241
|
+
const allIssues = [];
|
|
242
|
+
// Find all component files
|
|
243
|
+
const files = await getComponentFiles();
|
|
244
|
+
let filesScanned = 0;
|
|
245
|
+
for (const file of files) {
|
|
246
|
+
try {
|
|
247
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
248
|
+
filesScanned++;
|
|
249
|
+
allIssues.push(...checkFile(file, content));
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
if (verbose) {
|
|
253
|
+
console.error(`${console_chars_1.emoji.warning} Error reading ${file}: ${error.message}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const duration = Date.now() - startTime;
|
|
258
|
+
// Report results
|
|
259
|
+
console.log(`\n${console_chars_1.emoji.chart} Scan Summary:`);
|
|
260
|
+
console.log(` Files scanned: ${filesScanned}`);
|
|
261
|
+
console.log(` Duration: ${duration}ms`);
|
|
262
|
+
const errors = allIssues.filter((i) => i.severity === "error");
|
|
263
|
+
const warnings = allIssues.filter((i) => i.severity === "warning");
|
|
264
|
+
const infos = allIssues.filter((i) => i.severity === "info");
|
|
265
|
+
if (allIssues.length === 0) {
|
|
266
|
+
console.log(`\n${console_chars_1.emoji.success} No undefined Tailwind utility classes found`);
|
|
267
|
+
console.log(` All CSS variable references are valid.`);
|
|
268
|
+
process.exit(0);
|
|
269
|
+
}
|
|
270
|
+
// Group by type
|
|
271
|
+
const byType = new Map();
|
|
272
|
+
for (const issue of allIssues) {
|
|
273
|
+
const existing = byType.get(issue.type) || [];
|
|
274
|
+
existing.push(issue);
|
|
275
|
+
byType.set(issue.type, existing);
|
|
276
|
+
}
|
|
277
|
+
console.log(`\n${console_chars_1.emoji.clipboard} Issues Found:`);
|
|
278
|
+
console.log(` ${console_chars_1.emoji.error} Errors: ${errors.length}`);
|
|
279
|
+
console.log(` ${console_chars_1.emoji.warning} Warnings: ${warnings.length}`);
|
|
280
|
+
console.log(` ${console_chars_1.emoji.info} Info: ${infos.length}`);
|
|
281
|
+
// Print issues by type
|
|
282
|
+
for (const [type, issues] of byType) {
|
|
283
|
+
const icon = issues[0].severity === "error"
|
|
284
|
+
? `${console_chars_1.emoji.error}`
|
|
285
|
+
: issues[0].severity === "warning"
|
|
286
|
+
? `${console_chars_1.emoji.warning}`
|
|
287
|
+
: `${console_chars_1.emoji.info}`;
|
|
288
|
+
console.log(`\n${icon} ${type} (${issues.length} occurrences)`);
|
|
289
|
+
if (verbose) {
|
|
290
|
+
for (const issue of issues.slice(0, 5)) {
|
|
291
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
292
|
+
console.log(` ${issue.message}`);
|
|
293
|
+
console.log(` ${console_chars_1.emoji.hint} ${issue.suggestion}`);
|
|
294
|
+
if (issue.snippet) {
|
|
295
|
+
console.log(` ${console_chars_1.emoji.memo} ${issue.snippet}`);
|
|
296
|
+
}
|
|
297
|
+
console.log("");
|
|
298
|
+
}
|
|
299
|
+
if (issues.length > 5) {
|
|
300
|
+
console.log(` ... and ${issues.length - 5} more`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
console.log(` ${issues[0].message}`);
|
|
305
|
+
console.log(` ${console_chars_1.emoji.hint} ${issues[0].suggestion}`);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// Print background info
|
|
309
|
+
console.log(`\n${console_chars_1.emoji.docs} Background:`);
|
|
310
|
+
console.log(` This project uses custom CSS variable names (--bg-primary,`);
|
|
311
|
+
console.log(` --text-primary, etc.) instead of shadcn defaults (--background,`);
|
|
312
|
+
console.log(` --foreground, etc.). Using shadcn-style classes results in`);
|
|
313
|
+
console.log(` undefined colors and invisible UI elements.`);
|
|
314
|
+
console.log("");
|
|
315
|
+
console.log(`${console_chars_1.emoji.hint} Common fixes:`);
|
|
316
|
+
console.log(` • bg-background → bg-white or bg-[var(--bg-primary)]`);
|
|
317
|
+
console.log(` • text-foreground → text-[var(--text-primary)]`);
|
|
318
|
+
console.log(` • bg-muted → bg-[var(--bg-tertiary)]`);
|
|
319
|
+
console.log(` • border-border → border-[var(--border-color)]`);
|
|
320
|
+
// Exit code
|
|
321
|
+
if (warnOnly) {
|
|
322
|
+
console.log(`\n${console_chars_1.emoji.warning} Running in warning mode - not blocking`);
|
|
323
|
+
process.exit(0);
|
|
324
|
+
}
|
|
325
|
+
if (errors.length > 0) {
|
|
326
|
+
console.log(`\n⛔ ${errors.length} blocking issue(s) found. Fix before deploying.`);
|
|
327
|
+
console.log(` These will cause invisible or broken UI elements.`);
|
|
328
|
+
process.exit(1);
|
|
329
|
+
}
|
|
330
|
+
console.log(`\n${console_chars_1.emoji.success} No blocking issues (warnings/info only)`);
|
|
331
|
+
process.exit(0);
|
|
332
|
+
}
|
|
333
|
+
// Allow direct execution
|
|
334
|
+
if (require.main === module) {
|
|
335
|
+
run().catch(console.error);
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=undefined-tailwind-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undefined-tailwind-utilities.js","sourceRoot":"","sources":["../../../src/checks/tailwind/undefined-tailwind-utilities.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmMH,kBAuHC;AAxTD,uCAAyB;AACzB,wDAAoD;AACpD,8DAA+E;AAC/E,6DAAiE;AACjE,uFAAwF;AAExF,iBAAiB;AACJ,QAAA,EAAE,GAAG,uCAAuC,CAAC;AAC7C,QAAA,IAAI,GAAG,8BAA8B,CAAC;AACtC,QAAA,QAAQ,GAAG,UAAU,CAAC;AACtB,QAAA,QAAQ,GAAG,IAAI,CAAC;AAChB,QAAA,WAAW,GAAG,mEAAmE,CAAC;AAClF,QAAA,IAAI,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACtD,QAAA,QAAQ,GAAG,CAAC,aAAa,CAAC,CAAC;AAaxC,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,iCAAiB,EAAE;IACjD,oBAAoB;IACpB,eAAe;IACf,eAAe;IACf,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG;IAC1B;QACE,mDAAmD;QACnD,OAAO,EAAE,8BAA8B;QACvC,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,wDAAwD;QACjE,UAAU,EAAE,kEAAkE;QAC9E,QAAQ,EAAE,OAAgB;KAC3B;IACD;QACE,qDAAqD;QACrD,OAAO,EAAE,gCAAgC;QACzC,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,0DAA0D;QACnE,UAAU,EAAE,2DAA2D;QACvE,QAAQ,EAAE,OAAgB;KAC3B;IACD;QACE,mEAAmE;QACnE,o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,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,qBAAK,CAAC,OAAO,0CAA0C,CAAC,CAAC;IAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,yBAAyB;AACzB,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Turbopack Map Closure Safety Preflight (BLOCKING)
|
|
4
|
+
*
|
|
5
|
+
* Detects patterns that cause Turbopack closure bugs where property access
|
|
6
|
+
* on mapped items gets mangled (e.g., `product.stock_quantity` becomes
|
|
7
|
+
* `_product_stock_quantity` and fails at runtime).
|
|
8
|
+
*
|
|
9
|
+
* Problem Pattern:
|
|
10
|
+
* {items.map((item) => (
|
|
11
|
+
* <div>{item.property}</div> // Turbopack may mangle this
|
|
12
|
+
* ))}
|
|
13
|
+
*
|
|
14
|
+
* Safe Pattern:
|
|
15
|
+
* {items.map((item) => {
|
|
16
|
+
* const property = item.property; // Extract first
|
|
17
|
+
* return <div>{property}</div>; // Use local variable
|
|
18
|
+
* })}
|
|
19
|
+
*
|
|
20
|
+
* Why this matters:
|
|
21
|
+
* - Turbopack's minification can break closure scope for mapped items
|
|
22
|
+
* - Results in runtime ReferenceError: _item_property is not defined
|
|
23
|
+
* - Only happens in development with Turbopack, not in production builds
|
|
24
|
+
*
|
|
25
|
+
* Usage:
|
|
26
|
+
* pnpm preflight:turbopack-map-closure
|
|
27
|
+
* pnpm preflight:turbopack-map-closure --verbose
|
|
28
|
+
*/
|
|
29
|
+
export declare const id = "turbopack/map-closure-safety";
|
|
30
|
+
export declare const name = "Turbopack Map Closure Safety";
|
|
31
|
+
export declare const category = "turbopack";
|
|
32
|
+
export declare const blocking = false;
|
|
33
|
+
export declare const description = "Detects map callbacks that may cause Turbopack closure bugs";
|
|
34
|
+
export declare const tags: string[];
|
|
35
|
+
export declare const requires: any[];
|
|
36
|
+
export declare function run(): Promise<void>;
|
|
37
|
+
//# sourceMappingURL=map-closure-safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-closure-safety.d.ts","sourceRoot":"","sources":["../../../src/checks/turbopack/map-closure-safety.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AASH,eAAO,MAAM,EAAE,iCAAiC,CAAC;AACjD,eAAO,MAAM,IAAI,iCAAiC,CAAC;AACnD,eAAO,MAAM,QAAQ,cAAc,CAAC;AACpC,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAC9B,eAAO,MAAM,WAAW,gEAAgE,CAAC;AACzF,eAAO,MAAM,IAAI,UAA6C,CAAC;AAC/D,eAAO,MAAM,QAAQ,OAAK,CAAC;AAuH3B,wBAAsB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAsGzC"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Turbopack Map Closure Safety Preflight (BLOCKING)
|
|
5
|
+
*
|
|
6
|
+
* Detects patterns that cause Turbopack closure bugs where property access
|
|
7
|
+
* on mapped items gets mangled (e.g., `product.stock_quantity` becomes
|
|
8
|
+
* `_product_stock_quantity` and fails at runtime).
|
|
9
|
+
*
|
|
10
|
+
* Problem Pattern:
|
|
11
|
+
* {items.map((item) => (
|
|
12
|
+
* <div>{item.property}</div> // Turbopack may mangle this
|
|
13
|
+
* ))}
|
|
14
|
+
*
|
|
15
|
+
* Safe Pattern:
|
|
16
|
+
* {items.map((item) => {
|
|
17
|
+
* const property = item.property; // Extract first
|
|
18
|
+
* return <div>{property}</div>; // Use local variable
|
|
19
|
+
* })}
|
|
20
|
+
*
|
|
21
|
+
* Why this matters:
|
|
22
|
+
* - Turbopack's minification can break closure scope for mapped items
|
|
23
|
+
* - Results in runtime ReferenceError: _item_property is not defined
|
|
24
|
+
* - Only happens in development with Turbopack, not in production builds
|
|
25
|
+
*
|
|
26
|
+
* Usage:
|
|
27
|
+
* pnpm preflight:turbopack-map-closure
|
|
28
|
+
* pnpm preflight:turbopack-map-closure --verbose
|
|
29
|
+
*/
|
|
30
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
33
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
34
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
35
|
+
}
|
|
36
|
+
Object.defineProperty(o, k2, desc);
|
|
37
|
+
}) : (function(o, m, k, k2) {
|
|
38
|
+
if (k2 === undefined) k2 = k;
|
|
39
|
+
o[k2] = m[k];
|
|
40
|
+
}));
|
|
41
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
42
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
43
|
+
}) : function(o, v) {
|
|
44
|
+
o["default"] = v;
|
|
45
|
+
});
|
|
46
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
47
|
+
var ownKeys = function(o) {
|
|
48
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
49
|
+
var ar = [];
|
|
50
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
51
|
+
return ar;
|
|
52
|
+
};
|
|
53
|
+
return ownKeys(o);
|
|
54
|
+
};
|
|
55
|
+
return function (mod) {
|
|
56
|
+
if (mod && mod.__esModule) return mod;
|
|
57
|
+
var result = {};
|
|
58
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
59
|
+
__setModuleDefault(result, mod);
|
|
60
|
+
return result;
|
|
61
|
+
};
|
|
62
|
+
})();
|
|
63
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
+
exports.requires = exports.tags = exports.description = exports.blocking = exports.category = exports.name = exports.id = void 0;
|
|
65
|
+
exports.run = run;
|
|
66
|
+
const fs = __importStar(require("fs"));
|
|
67
|
+
const file_cache_1 = require("../../shared/file-cache");
|
|
68
|
+
const glob_patterns_1 = require("../../shared/glob-patterns");
|
|
69
|
+
const console_chars_1 = require("../../utils/console-chars");
|
|
70
|
+
const universal_progress_reporter_1 = require("../system/universal-progress-reporter");
|
|
71
|
+
// Check metadata
|
|
72
|
+
exports.id = "turbopack/map-closure-safety";
|
|
73
|
+
exports.name = "Turbopack Map Closure Safety";
|
|
74
|
+
exports.category = "turbopack";
|
|
75
|
+
exports.blocking = false; // Warning for now, can be elevated
|
|
76
|
+
exports.description = "Detects map callbacks that may cause Turbopack closure bugs";
|
|
77
|
+
exports.tags = ["turbopack", "runtime", "closure", "map"];
|
|
78
|
+
exports.requires = [];
|
|
79
|
+
const EXCLUDED = (0, glob_patterns_1.extendExcludes)(glob_patterns_1.STANDARD_EXCLUDES, [
|
|
80
|
+
"**/test-results/**",
|
|
81
|
+
"**/*.test.tsx",
|
|
82
|
+
"**/*.spec.tsx",
|
|
83
|
+
"**/*.stories.tsx",
|
|
84
|
+
]);
|
|
85
|
+
/**
|
|
86
|
+
* Detects risky patterns in .map() callbacks where:
|
|
87
|
+
* 1. The callback uses parentheses (implicit return) instead of braces
|
|
88
|
+
* 2. Multiple property accesses on the mapped item in JSX
|
|
89
|
+
*
|
|
90
|
+
* These patterns are prone to Turbopack closure issues.
|
|
91
|
+
*/
|
|
92
|
+
function checkFile(filePath, content) {
|
|
93
|
+
const issues = [];
|
|
94
|
+
const lines = content.split("\n");
|
|
95
|
+
// Pattern: .map((paramName) => (
|
|
96
|
+
// This is the risky implicit return pattern
|
|
97
|
+
const mapImplicitReturnPattern = /\.map\s*\(\s*\((\w+)\)\s*=>\s*\(/g;
|
|
98
|
+
let match;
|
|
99
|
+
while ((match = mapImplicitReturnPattern.exec(content)) !== null) {
|
|
100
|
+
const paramName = match[1];
|
|
101
|
+
const mapStartIndex = match.index;
|
|
102
|
+
// Find the line number
|
|
103
|
+
let lineNumber = 1;
|
|
104
|
+
let charCount = 0;
|
|
105
|
+
for (let i = 0; i < lines.length; i++) {
|
|
106
|
+
charCount += lines[i].length + 1;
|
|
107
|
+
if (charCount > mapStartIndex) {
|
|
108
|
+
lineNumber = i + 1;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Look ahead to find property accesses on the param in JSX
|
|
113
|
+
// We'll check the next ~50 lines or until we find the closing
|
|
114
|
+
const searchEndIndex = Math.min(content.length, mapStartIndex + 5000);
|
|
115
|
+
const mapBlock = content.substring(mapStartIndex, searchEndIndex);
|
|
116
|
+
// Count property accesses on the mapped item
|
|
117
|
+
// Pattern: paramName.property (where property contains underscore - common DB fields)
|
|
118
|
+
const propertyAccessPattern = new RegExp(`\\b${paramName}\\.(\\w+_\\w+|stock_quantity|linked\\w+|created\\w+|updated\\w+)`, "g");
|
|
119
|
+
const propertyMatches = mapBlock.match(propertyAccessPattern) || [];
|
|
120
|
+
// If we find properties with underscores being accessed directly, it's risky
|
|
121
|
+
if (propertyMatches.length >= 2) {
|
|
122
|
+
issues.push({
|
|
123
|
+
file: filePath,
|
|
124
|
+
line: lineNumber,
|
|
125
|
+
severity: "warning",
|
|
126
|
+
message: `Map callback with implicit return accesses ${propertyMatches.length} underscore properties on '${paramName}'`,
|
|
127
|
+
suggestion: `Convert to block syntax { } and extract properties: const ${paramName}Prop = ${paramName}.prop;`,
|
|
128
|
+
snippet: lines[lineNumber - 1]?.trim().substring(0, 80),
|
|
129
|
+
paramName,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Also check for the dangerous pattern of nested property access in JSX
|
|
134
|
+
// Pattern: {item.foo.bar} or {item.prop ?? "default"} inside map
|
|
135
|
+
const nestedPropertyInMapPattern = /\.map\s*\(\s*\((\w+)\)\s*=>\s*[^{]*\{\s*\1\.[\w.]+\s*(?:\?\?|&&|\|\|)/g;
|
|
136
|
+
while ((match = nestedPropertyInMapPattern.exec(content)) !== null) {
|
|
137
|
+
const paramName = match[1];
|
|
138
|
+
const mapStartIndex = match.index;
|
|
139
|
+
let lineNumber = 1;
|
|
140
|
+
let charCount = 0;
|
|
141
|
+
for (let i = 0; i < lines.length; i++) {
|
|
142
|
+
charCount += lines[i].length + 1;
|
|
143
|
+
if (charCount > mapStartIndex) {
|
|
144
|
+
lineNumber = i + 1;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
issues.push({
|
|
149
|
+
file: filePath,
|
|
150
|
+
line: lineNumber,
|
|
151
|
+
severity: "info",
|
|
152
|
+
message: `Nullish coalescing/logical operators on mapped item '${paramName}' in JSX`,
|
|
153
|
+
suggestion: `Consider extracting: const value = ${paramName}.prop ?? default; before JSX`,
|
|
154
|
+
snippet: lines[lineNumber - 1]?.trim().substring(0, 80),
|
|
155
|
+
paramName,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return issues;
|
|
159
|
+
}
|
|
160
|
+
// CACHED FILE LISTS
|
|
161
|
+
let _cachedComponentFiles = null;
|
|
162
|
+
async function getComponentFiles() {
|
|
163
|
+
if (!_cachedComponentFiles) {
|
|
164
|
+
_cachedComponentFiles = await file_cache_1.fileCache.getComponentFiles();
|
|
165
|
+
}
|
|
166
|
+
return _cachedComponentFiles;
|
|
167
|
+
}
|
|
168
|
+
async function run() {
|
|
169
|
+
const reporter = (0, universal_progress_reporter_1.createUniversalProgressReporter)(exports.name);
|
|
170
|
+
const args = process.argv.slice(2);
|
|
171
|
+
const verbose = args.includes("--verbose") || args.includes("-v");
|
|
172
|
+
const strict = args.includes("--strict") || args.includes("-s");
|
|
173
|
+
console.log(`\n${console_chars_1.emoji.palette} Turbopack Map Closure Safety Preflight`);
|
|
174
|
+
console.log((0, console_chars_1.createDivider)(80, "heavy"));
|
|
175
|
+
const startTime = Date.now();
|
|
176
|
+
const allIssues = [];
|
|
177
|
+
// Find all component files
|
|
178
|
+
const files = await getComponentFiles();
|
|
179
|
+
let filesScanned = 0;
|
|
180
|
+
for (const file of files) {
|
|
181
|
+
// Only check TSX files (JSX components)
|
|
182
|
+
if (!file.endsWith(".tsx"))
|
|
183
|
+
continue;
|
|
184
|
+
try {
|
|
185
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
186
|
+
filesScanned++;
|
|
187
|
+
allIssues.push(...checkFile(file, content));
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
if (verbose) {
|
|
191
|
+
console.error(`${console_chars_1.emoji.warning} Error reading ${file}: ${error.message}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const duration = Date.now() - startTime;
|
|
196
|
+
// Report results
|
|
197
|
+
console.log(`\n${console_chars_1.emoji.chart} Scan Summary:`);
|
|
198
|
+
console.log(` Files scanned: ${filesScanned}`);
|
|
199
|
+
console.log(` Duration: ${duration}ms`);
|
|
200
|
+
const warnings = allIssues.filter((i) => i.severity === "warning");
|
|
201
|
+
const infos = allIssues.filter((i) => i.severity === "info");
|
|
202
|
+
if (allIssues.length === 0) {
|
|
203
|
+
console.log(`\n${console_chars_1.emoji.success} No risky map closure patterns detected`);
|
|
204
|
+
console.log(` All mapped item property accesses appear safe.`);
|
|
205
|
+
process.exit(0);
|
|
206
|
+
}
|
|
207
|
+
console.log(`\n${console_chars_1.emoji.clipboard} Issues Found:`);
|
|
208
|
+
console.log(` ${console_chars_1.emoji.warning} Warnings: ${warnings.length}`);
|
|
209
|
+
console.log(` ${console_chars_1.emoji.info} Info: ${infos.length}`);
|
|
210
|
+
if (warnings.length > 0) {
|
|
211
|
+
console.log(`\n${console_chars_1.emoji.warning} WARNINGS (may cause Turbopack runtime errors):`);
|
|
212
|
+
console.log((0, console_chars_1.createDivider)(60, "light"));
|
|
213
|
+
for (const issue of warnings.slice(0, verbose ? 20 : 5)) {
|
|
214
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
215
|
+
console.log(` ${issue.message}`);
|
|
216
|
+
console.log(` ${console_chars_1.emoji.hint} ${issue.suggestion}`);
|
|
217
|
+
if (issue.snippet) {
|
|
218
|
+
console.log(` ${console_chars_1.emoji.memo} ${issue.snippet}`);
|
|
219
|
+
}
|
|
220
|
+
console.log("");
|
|
221
|
+
}
|
|
222
|
+
if (warnings.length > (verbose ? 20 : 5)) {
|
|
223
|
+
console.log(` ... and ${warnings.length - (verbose ? 20 : 5)} more`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (verbose && infos.length > 0) {
|
|
227
|
+
console.log(`\n${console_chars_1.emoji.info} INFO:`);
|
|
228
|
+
console.log((0, console_chars_1.createDivider)(60, "light"));
|
|
229
|
+
for (const issue of infos.slice(0, 10)) {
|
|
230
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
231
|
+
console.log(` ${issue.message}`);
|
|
232
|
+
console.log("");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// Print fix guidance
|
|
236
|
+
console.log(`\n${console_chars_1.emoji.docs} How to fix:`);
|
|
237
|
+
console.log(` Convert implicit return map callbacks to block syntax:`);
|
|
238
|
+
console.log("");
|
|
239
|
+
console.log(` // BEFORE (risky):`);
|
|
240
|
+
console.log(` {items.map((item) => (`);
|
|
241
|
+
console.log(` <div>{item.stock_quantity}</div>`);
|
|
242
|
+
console.log(` ))}`);
|
|
243
|
+
console.log("");
|
|
244
|
+
console.log(` // AFTER (safe):`);
|
|
245
|
+
console.log(` {items.map((item) => {`);
|
|
246
|
+
console.log(` const stockQuantity = item.stock_quantity;`);
|
|
247
|
+
console.log(` return <div>{stockQuantity}</div>;`);
|
|
248
|
+
console.log(` })}`);
|
|
249
|
+
// Exit code
|
|
250
|
+
if (strict && warnings.length > 0) {
|
|
251
|
+
console.log(`\n⛔ ${warnings.length} warning(s) found in strict mode.`);
|
|
252
|
+
process.exit(1);
|
|
253
|
+
}
|
|
254
|
+
console.log(`\n${console_chars_1.emoji.success} Preflight complete (warnings only, not blocking)`);
|
|
255
|
+
process.exit(0);
|
|
256
|
+
}
|
|
257
|
+
// Allow direct execution
|
|
258
|
+
if (require.main === module) {
|
|
259
|
+
run().catch(console.error);
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=map-closure-safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-closure-safety.js","sourceRoot":"","sources":["../../../src/checks/turbopack/map-closure-safety.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsIH,kBAsGC;AA1OD,uCAAyB;AACzB,wDAAoD;AACpD,8DAA+E;AAC/E,6DAAiE;AACjE,uFAAwF;AAExF,iBAAiB;AACJ,QAAA,EAAE,GAAG,8BAA8B,CAAC;AACpC,QAAA,IAAI,GAAG,8BAA8B,CAAC;AACtC,QAAA,QAAQ,GAAG,WAAW,CAAC;AACvB,QAAA,QAAQ,GAAG,KAAK,CAAC,CAAC,mCAAmC;AACrD,QAAA,WAAW,GAAG,6DAA6D,CAAC;AAC5E,QAAA,IAAI,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAClD,QAAA,QAAQ,GAAG,EAAE,CAAC;AAY3B,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,iCAAiB,EAAE;IACjD,oBAAoB;IACpB,eAAe;IACf,eAAe;IACf,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,QAAgB,EAAE,OAAe;IAClD,MAAM,MA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nC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEtB,YAAY;IACZ,IAAI,MAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,OAAO,QAAQ,CAAC,MAAM,mCAAmC,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,qBAAK,CAAC,OAAO,mDAAmD,CAAC,CAAC;IACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,yBAAyB;AACzB,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../src/core/categories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../src/core/categories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+CnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAAoD,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA2F5C,CAAC;AAEF;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAc7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC"}
|
package/dist/core/categories.js
CHANGED
|
@@ -40,6 +40,18 @@ exports.CATEGORY_FILTERS = {
|
|
|
40
40
|
seo: "SEO|Hardcoded URLs|Missing Metadata",
|
|
41
41
|
// Framework compatibility
|
|
42
42
|
framework: "Compatibility|Next\\.js|Prisma|React|Zod|TanStack|Tailwind",
|
|
43
|
+
// System/infrastructure checks
|
|
44
|
+
system: "Script Path|Orphaned Script|Preflight|System|Broken|Validation|Sync Check",
|
|
45
|
+
// Turbopack-specific checks
|
|
46
|
+
turbopack: "Turbopack|Map Closure|Zod Turbopack",
|
|
47
|
+
// Card processing (trading card system)
|
|
48
|
+
"card-processing": "Card|Dimension|Edge Detection|Front.Back|Deskew|Image Processing|Filename",
|
|
49
|
+
// Data integrity
|
|
50
|
+
data: "Constants|Crockford|Geographic|Hardcoded Options|Product Slug|Schema|FK Defaults|League Data",
|
|
51
|
+
// Integration platform checks
|
|
52
|
+
integrations: "Integration|Platform Feed|WooCommerce|Amazon|eBay|Etsy|Walmart|TikTok|Whatnot|Shopify",
|
|
53
|
+
// AI/ML checks
|
|
54
|
+
ai: "Recognition Pipeline|Series Subset|AI|ML",
|
|
43
55
|
};
|
|
44
56
|
/**
|
|
45
57
|
* Quick mode categories - runs only fast, critical checks
|
|
@@ -109,6 +121,36 @@ exports.CATEGORY_CONFIGS = [
|
|
|
109
121
|
pattern: exports.CATEGORY_FILTERS.framework,
|
|
110
122
|
description: "Framework compatibility: Next.js, React, Prisma",
|
|
111
123
|
},
|
|
124
|
+
{
|
|
125
|
+
name: "system",
|
|
126
|
+
pattern: exports.CATEGORY_FILTERS.system,
|
|
127
|
+
description: "System checks: script paths, orphaned files, preflight health",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "turbopack",
|
|
131
|
+
pattern: exports.CATEGORY_FILTERS.turbopack,
|
|
132
|
+
description: "Turbopack-specific: closure safety, Zod ESM compatibility",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "card-processing",
|
|
136
|
+
pattern: exports.CATEGORY_FILTERS["card-processing"],
|
|
137
|
+
description: "Card processing: dimensions, edge detection, image processing",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "data",
|
|
141
|
+
pattern: exports.CATEGORY_FILTERS.data,
|
|
142
|
+
description: "Data integrity: constants, geographic, schema validation",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "integrations",
|
|
146
|
+
pattern: exports.CATEGORY_FILTERS.integrations,
|
|
147
|
+
description: "Integration platforms: eBay, Amazon, Etsy, WooCommerce, etc.",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "ai",
|
|
151
|
+
pattern: exports.CATEGORY_FILTERS.ai,
|
|
152
|
+
description: "AI/ML checks: recognition pipeline, series hierarchy",
|
|
153
|
+
},
|
|
112
154
|
];
|
|
113
155
|
/**
|
|
114
156
|
* Build filter regex from category names
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/core/categories.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;
|
|
1
|
+
{"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/core/categories.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAgKH,8DAcC;AAKD,4CAEC;AAKD,0CAEC;AAKD,8CAMC;AAnMD;;GAEG;AACU,QAAA,gBAAgB,GAA2B;IACtD,8BA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