@c15t/cli 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/145.mjs +18 -1
- package/package.json +1 -1
package/dist/145.mjs
CHANGED
|
@@ -372,6 +372,7 @@ const CSS_ENTRYPOINT_CANDIDATES = [
|
|
|
372
372
|
'src/App.css'
|
|
373
373
|
];
|
|
374
374
|
const LOCAL_CSS_IMPORT_RE = /^\s*import(?:\s+[^'"]+\s+from\s+)?['"]([^'"]+\.css)['"];\s*$/gm;
|
|
375
|
+
const CSS_IMPORT_RE = /^\s*@import\b.+;\s*(?:(?:\/\*.*\*\/|\/\/.*)\s*)?$/;
|
|
375
376
|
const TAILWIND_V4_IMPORT_RE = /^\s*@import\s+['"]tailwindcss['"];\s*$/;
|
|
376
377
|
const TAILWIND_COMPONENTS_RE = /^\s*@tailwind\s+components\s*;\s*$/;
|
|
377
378
|
const TAILWIND_UTILITIES_RE = /^\s*@tailwind\s+utilities\s*;\s*$/;
|
|
@@ -432,6 +433,22 @@ function findTopInsertionLineIndex(lines) {
|
|
|
432
433
|
}
|
|
433
434
|
return index;
|
|
434
435
|
}
|
|
436
|
+
function findTailwindV4InsertionLineIndex(lines, tailwindImportIndex) {
|
|
437
|
+
let lastImportIndex = tailwindImportIndex;
|
|
438
|
+
for(let index = tailwindImportIndex + 1; index < lines.length; index += 1){
|
|
439
|
+
const line = lines[index];
|
|
440
|
+
const trimmed = line?.trim() ?? '';
|
|
441
|
+
const isStandaloneCommentLine = /^\/\*.*\*\/\s*$/.test(trimmed) || /^\/\/.*\s*$/.test(trimmed) || /^\/\*.*\s*$/.test(trimmed) || /^\*(?:\/|$|\s(?!\{).*)$/.test(trimmed);
|
|
442
|
+
if ('' !== trimmed && !isStandaloneCommentLine) {
|
|
443
|
+
if (CSS_IMPORT_RE.test(line ?? '')) {
|
|
444
|
+
lastImportIndex = index;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return lastImportIndex + 1;
|
|
451
|
+
}
|
|
435
452
|
function insertImportsIntoCssContent(content, desiredImports, tailwindVersion, managedPackages) {
|
|
436
453
|
const normalizedContent = content.replace(/\r\n/g, '\n');
|
|
437
454
|
const hadTrailingNewline = normalizedContent.endsWith('\n');
|
|
@@ -450,7 +467,7 @@ function insertImportsIntoCssContent(content, desiredImports, tailwindVersion, m
|
|
|
450
467
|
}
|
|
451
468
|
} else {
|
|
452
469
|
const tailwindImportIndex = filteredLines.findIndex((line)=>TAILWIND_V4_IMPORT_RE.test(line));
|
|
453
|
-
if (tailwindImportIndex >= 0) insertionIndex = tailwindImportIndex
|
|
470
|
+
if (tailwindImportIndex >= 0) insertionIndex = findTailwindV4InsertionLineIndex(filteredLines, tailwindImportIndex);
|
|
454
471
|
}
|
|
455
472
|
const nextLines = [
|
|
456
473
|
...filteredLines.slice(0, insertionIndex),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "CLI for rapid c15t setup. Scaffold React and Next.js cookie banners and a preferences centre, generate types and config, and run migration tooling for self-hosted deployments.",
|
|
5
5
|
"homepage": "https://c15t.com",
|
|
6
6
|
"repository": {
|