prev-cli 0.24.13 → 0.24.14
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/cli.js +9 -6
- package/package.json +2 -2
- package/src/preview-runtime/tailwind.ts +7 -2
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { parseArgs } from "util";
|
|
5
5
|
import path11 from "path";
|
|
6
6
|
import { existsSync as existsSync8, mkdirSync as mkdirSync4, writeFileSync as writeFileSync6, rmSync as rmSync4, readFileSync as readFileSync7 } from "fs";
|
|
7
|
-
import { fileURLToPath as
|
|
7
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
8
8
|
|
|
9
9
|
// src/vite/start.ts
|
|
10
10
|
import { createServer as createServer2, build as build3, preview } from "vite";
|
|
@@ -17,7 +17,7 @@ import remarkGfm from "remark-gfm";
|
|
|
17
17
|
import rehypeHighlight from "rehype-highlight";
|
|
18
18
|
import path8 from "path";
|
|
19
19
|
import os from "os";
|
|
20
|
-
import { fileURLToPath as
|
|
20
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
21
21
|
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
22
22
|
|
|
23
23
|
// src/vite/plugins/pages-plugin.ts
|
|
@@ -663,6 +663,9 @@ import { $ } from "bun";
|
|
|
663
663
|
import { mkdtempSync, mkdirSync, writeFileSync as writeFileSync2, readFileSync as readFileSync4, rmSync } from "fs";
|
|
664
664
|
import { join, dirname as dirname2 } from "path";
|
|
665
665
|
import { tmpdir } from "os";
|
|
666
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
667
|
+
var __dirname3 = dirname2(fileURLToPath3(import.meta.url));
|
|
668
|
+
var tailwindBin = join(__dirname3, "../../node_modules/.bin/tailwindcss");
|
|
666
669
|
async function compileTailwind(files) {
|
|
667
670
|
const tempDir = mkdtempSync(join(tmpdir(), "prev-tailwind-"));
|
|
668
671
|
try {
|
|
@@ -687,7 +690,7 @@ async function compileTailwind(files) {
|
|
|
687
690
|
const inputPath = join(tempDir, "input.css");
|
|
688
691
|
writeFileSync2(inputPath, inputCss);
|
|
689
692
|
const outputPath = join(tempDir, "output.css");
|
|
690
|
-
await
|
|
693
|
+
await $`${tailwindBin} -c ${configPath} -i ${inputPath} -o ${outputPath} --minify`.quiet();
|
|
691
694
|
const css = readFileSync4(outputPath, "utf-8");
|
|
692
695
|
return { success: true, css };
|
|
693
696
|
} catch (err) {
|
|
@@ -1221,7 +1224,7 @@ function createFriendlyLogger() {
|
|
|
1221
1224
|
};
|
|
1222
1225
|
}
|
|
1223
1226
|
function findCliRoot2() {
|
|
1224
|
-
let dir = path8.dirname(
|
|
1227
|
+
let dir = path8.dirname(fileURLToPath4(import.meta.url));
|
|
1225
1228
|
for (let i = 0;i < 10; i++) {
|
|
1226
1229
|
const pkgPath = path8.join(dir, "package.json");
|
|
1227
1230
|
if (existsSync6(pkgPath)) {
|
|
@@ -1237,7 +1240,7 @@ function findCliRoot2() {
|
|
|
1237
1240
|
break;
|
|
1238
1241
|
dir = parent;
|
|
1239
1242
|
}
|
|
1240
|
-
return path8.dirname(path8.dirname(
|
|
1243
|
+
return path8.dirname(path8.dirname(fileURLToPath4(import.meta.url)));
|
|
1241
1244
|
}
|
|
1242
1245
|
function findNodeModules(cliRoot2) {
|
|
1243
1246
|
const localNodeModules = path8.join(cliRoot2, "node_modules");
|
|
@@ -1851,7 +1854,7 @@ async function cleanCache(options) {
|
|
|
1851
1854
|
import yaml3 from "js-yaml";
|
|
1852
1855
|
function getVersion() {
|
|
1853
1856
|
try {
|
|
1854
|
-
let dir = path11.dirname(
|
|
1857
|
+
let dir = path11.dirname(fileURLToPath5(import.meta.url));
|
|
1855
1858
|
for (let i = 0;i < 5; i++) {
|
|
1856
1859
|
const pkgPath = path11.join(dir, "package.json");
|
|
1857
1860
|
if (existsSync8(pkgPath)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prev-cli",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.14",
|
|
4
4
|
"description": "Transform MDX directories into beautiful documentation websites",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"rehype-highlight": "^7.0.0",
|
|
65
65
|
"remark-gfm": "^4.0.0",
|
|
66
66
|
"tailwind-merge": "^2.5.0",
|
|
67
|
-
"tailwindcss": "
|
|
67
|
+
"tailwindcss": "3",
|
|
68
68
|
"vite": "npm:rolldown-vite@^7.3.1",
|
|
69
69
|
"zod": "^4.3.5"
|
|
70
70
|
},
|
|
@@ -2,6 +2,11 @@ import { $ } from 'bun'
|
|
|
2
2
|
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync } from 'fs'
|
|
3
3
|
import { join, dirname } from 'path'
|
|
4
4
|
import { tmpdir } from 'os'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
|
|
7
|
+
// Resolve tailwindcss CLI from this package's node_modules
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
const tailwindBin = join(__dirname, '../../node_modules/.bin/tailwindcss')
|
|
5
10
|
|
|
6
11
|
export interface TailwindResult {
|
|
7
12
|
success: boolean
|
|
@@ -46,8 +51,8 @@ export async function compileTailwind(files: ContentFile[]): Promise<TailwindRes
|
|
|
46
51
|
|
|
47
52
|
const outputPath = join(tempDir, 'output.css')
|
|
48
53
|
|
|
49
|
-
// Run Tailwind CLI
|
|
50
|
-
await
|
|
54
|
+
// Run Tailwind CLI from package's node_modules
|
|
55
|
+
await $`${tailwindBin} -c ${configPath} -i ${inputPath} -o ${outputPath} --minify`.quiet()
|
|
51
56
|
|
|
52
57
|
const css = readFileSync(outputPath, 'utf-8')
|
|
53
58
|
|