tailwindcss-patch 8.4.1 → 8.4.2
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/{chunk-FKEOVCUS.js → chunk-6WXBENUZ.js} +62 -3
- package/dist/{chunk-C3YPPFE6.mjs → chunk-K5JHLM3J.mjs} +74 -15
- package/dist/cli.js +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ var logger = _consola.createConsola.call(void 0, );
|
|
|
8
8
|
var logger_default = logger;
|
|
9
9
|
|
|
10
10
|
// src/cache/store.ts
|
|
11
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
11
12
|
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
12
13
|
function isErrnoException(error) {
|
|
13
14
|
return error instanceof Error && typeof error.code === "string";
|
|
@@ -22,15 +23,70 @@ var CacheStore = class {
|
|
|
22
23
|
ensureDirSync() {
|
|
23
24
|
_fsextra2.default.ensureDirSync(this.options.dir);
|
|
24
25
|
}
|
|
26
|
+
createTempPath() {
|
|
27
|
+
const uniqueSuffix = `${_process2.default.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
28
|
+
return `${this.options.path}.${uniqueSuffix}.tmp`;
|
|
29
|
+
}
|
|
30
|
+
async replaceCacheFile(tempPath) {
|
|
31
|
+
try {
|
|
32
|
+
await _fsextra2.default.rename(tempPath, this.options.path);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
|
|
35
|
+
try {
|
|
36
|
+
await _fsextra2.default.remove(this.options.path);
|
|
37
|
+
} catch (removeError) {
|
|
38
|
+
if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
|
|
39
|
+
throw removeError;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await _fsextra2.default.rename(tempPath, this.options.path);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
replaceCacheFileSync(tempPath) {
|
|
49
|
+
try {
|
|
50
|
+
_fsextra2.default.renameSync(tempPath, this.options.path);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
|
|
53
|
+
try {
|
|
54
|
+
_fsextra2.default.removeSync(this.options.path);
|
|
55
|
+
} catch (removeError) {
|
|
56
|
+
if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
|
|
57
|
+
throw removeError;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
_fsextra2.default.renameSync(tempPath, this.options.path);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async cleanupTempFile(tempPath) {
|
|
67
|
+
try {
|
|
68
|
+
await _fsextra2.default.remove(tempPath);
|
|
69
|
+
} catch (e2) {
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
cleanupTempFileSync(tempPath) {
|
|
73
|
+
try {
|
|
74
|
+
_fsextra2.default.removeSync(tempPath);
|
|
75
|
+
} catch (e3) {
|
|
76
|
+
}
|
|
77
|
+
}
|
|
25
78
|
async write(data) {
|
|
26
79
|
if (!this.options.enabled) {
|
|
27
80
|
return void 0;
|
|
28
81
|
}
|
|
82
|
+
const tempPath = this.createTempPath();
|
|
29
83
|
try {
|
|
30
84
|
await this.ensureDir();
|
|
31
|
-
await _fsextra2.default.writeJSON(
|
|
85
|
+
await _fsextra2.default.writeJSON(tempPath, Array.from(data));
|
|
86
|
+
await this.replaceCacheFile(tempPath);
|
|
32
87
|
return this.options.path;
|
|
33
88
|
} catch (error) {
|
|
89
|
+
await this.cleanupTempFile(tempPath);
|
|
34
90
|
logger_default.error("Unable to persist Tailwind class cache", error);
|
|
35
91
|
return void 0;
|
|
36
92
|
}
|
|
@@ -39,11 +95,14 @@ var CacheStore = class {
|
|
|
39
95
|
if (!this.options.enabled) {
|
|
40
96
|
return void 0;
|
|
41
97
|
}
|
|
98
|
+
const tempPath = this.createTempPath();
|
|
42
99
|
try {
|
|
43
100
|
this.ensureDirSync();
|
|
44
|
-
_fsextra2.default.writeJSONSync(
|
|
101
|
+
_fsextra2.default.writeJSONSync(tempPath, Array.from(data));
|
|
102
|
+
this.replaceCacheFileSync(tempPath);
|
|
45
103
|
return this.options.path;
|
|
46
104
|
} catch (error) {
|
|
105
|
+
this.cleanupTempFileSync(tempPath);
|
|
47
106
|
logger_default.error("Unable to persist Tailwind class cache", error);
|
|
48
107
|
return void 0;
|
|
49
108
|
}
|
|
@@ -104,7 +163,7 @@ var CacheStore = class {
|
|
|
104
163
|
|
|
105
164
|
// src/extraction/candidate-extractor.ts
|
|
106
165
|
var _fs = require('fs');
|
|
107
|
-
|
|
166
|
+
|
|
108
167
|
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
109
168
|
async function importNode() {
|
|
110
169
|
return Promise.resolve().then(() => _interopRequireWildcard(require("@tailwindcss/node")));
|
|
@@ -4,6 +4,7 @@ var logger = createConsola();
|
|
|
4
4
|
var logger_default = logger;
|
|
5
5
|
|
|
6
6
|
// src/cache/store.ts
|
|
7
|
+
import process from "process";
|
|
7
8
|
import fs from "fs-extra";
|
|
8
9
|
function isErrnoException(error) {
|
|
9
10
|
return error instanceof Error && typeof error.code === "string";
|
|
@@ -18,15 +19,70 @@ var CacheStore = class {
|
|
|
18
19
|
ensureDirSync() {
|
|
19
20
|
fs.ensureDirSync(this.options.dir);
|
|
20
21
|
}
|
|
22
|
+
createTempPath() {
|
|
23
|
+
const uniqueSuffix = `${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
24
|
+
return `${this.options.path}.${uniqueSuffix}.tmp`;
|
|
25
|
+
}
|
|
26
|
+
async replaceCacheFile(tempPath) {
|
|
27
|
+
try {
|
|
28
|
+
await fs.rename(tempPath, this.options.path);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
|
|
31
|
+
try {
|
|
32
|
+
await fs.remove(this.options.path);
|
|
33
|
+
} catch (removeError) {
|
|
34
|
+
if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
|
|
35
|
+
throw removeError;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
await fs.rename(tempPath, this.options.path);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
replaceCacheFileSync(tempPath) {
|
|
45
|
+
try {
|
|
46
|
+
fs.renameSync(tempPath, this.options.path);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
|
|
49
|
+
try {
|
|
50
|
+
fs.removeSync(this.options.path);
|
|
51
|
+
} catch (removeError) {
|
|
52
|
+
if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
|
|
53
|
+
throw removeError;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
fs.renameSync(tempPath, this.options.path);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async cleanupTempFile(tempPath) {
|
|
63
|
+
try {
|
|
64
|
+
await fs.remove(tempPath);
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
cleanupTempFileSync(tempPath) {
|
|
69
|
+
try {
|
|
70
|
+
fs.removeSync(tempPath);
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
}
|
|
21
74
|
async write(data) {
|
|
22
75
|
if (!this.options.enabled) {
|
|
23
76
|
return void 0;
|
|
24
77
|
}
|
|
78
|
+
const tempPath = this.createTempPath();
|
|
25
79
|
try {
|
|
26
80
|
await this.ensureDir();
|
|
27
|
-
await fs.writeJSON(
|
|
81
|
+
await fs.writeJSON(tempPath, Array.from(data));
|
|
82
|
+
await this.replaceCacheFile(tempPath);
|
|
28
83
|
return this.options.path;
|
|
29
84
|
} catch (error) {
|
|
85
|
+
await this.cleanupTempFile(tempPath);
|
|
30
86
|
logger_default.error("Unable to persist Tailwind class cache", error);
|
|
31
87
|
return void 0;
|
|
32
88
|
}
|
|
@@ -35,11 +91,14 @@ var CacheStore = class {
|
|
|
35
91
|
if (!this.options.enabled) {
|
|
36
92
|
return void 0;
|
|
37
93
|
}
|
|
94
|
+
const tempPath = this.createTempPath();
|
|
38
95
|
try {
|
|
39
96
|
this.ensureDirSync();
|
|
40
|
-
fs.writeJSONSync(
|
|
97
|
+
fs.writeJSONSync(tempPath, Array.from(data));
|
|
98
|
+
this.replaceCacheFileSync(tempPath);
|
|
41
99
|
return this.options.path;
|
|
42
100
|
} catch (error) {
|
|
101
|
+
this.cleanupTempFileSync(tempPath);
|
|
43
102
|
logger_default.error("Unable to persist Tailwind class cache", error);
|
|
44
103
|
return void 0;
|
|
45
104
|
}
|
|
@@ -100,7 +159,7 @@ var CacheStore = class {
|
|
|
100
159
|
|
|
101
160
|
// src/extraction/candidate-extractor.ts
|
|
102
161
|
import { promises as fs2 } from "fs";
|
|
103
|
-
import
|
|
162
|
+
import process2 from "process";
|
|
104
163
|
import path from "pathe";
|
|
105
164
|
async function importNode() {
|
|
106
165
|
return import("@tailwindcss/node");
|
|
@@ -127,7 +186,7 @@ async function extractRawCandidates(sources) {
|
|
|
127
186
|
}
|
|
128
187
|
async function extractValidCandidates(options) {
|
|
129
188
|
const providedOptions = options ?? {};
|
|
130
|
-
const defaultCwd = providedOptions.cwd ??
|
|
189
|
+
const defaultCwd = providedOptions.cwd ?? process2.cwd();
|
|
131
190
|
const base = providedOptions.base ?? defaultCwd;
|
|
132
191
|
const css = providedOptions.css ?? '@import "tailwindcss";';
|
|
133
192
|
const sources = (providedOptions.sources ?? [
|
|
@@ -223,7 +282,7 @@ function toRelativeFile(cwd, filename) {
|
|
|
223
282
|
return relative === "" ? path.basename(filename) : relative;
|
|
224
283
|
}
|
|
225
284
|
async function extractProjectCandidatesWithPositions(options) {
|
|
226
|
-
const cwd = options?.cwd ? path.resolve(options.cwd) :
|
|
285
|
+
const cwd = options?.cwd ? path.resolve(options.cwd) : process2.cwd();
|
|
227
286
|
const normalizedSources = normalizeSources(options?.sources, cwd);
|
|
228
287
|
const { Scanner } = await importOxide();
|
|
229
288
|
const scanner = new Scanner({
|
|
@@ -295,7 +354,7 @@ function groupTokensByFile(report, options) {
|
|
|
295
354
|
}
|
|
296
355
|
|
|
297
356
|
// src/options/normalize.ts
|
|
298
|
-
import
|
|
357
|
+
import process3 from "process";
|
|
299
358
|
import path2 from "pathe";
|
|
300
359
|
|
|
301
360
|
// src/constants.ts
|
|
@@ -431,7 +490,7 @@ function normalizeTailwindOptions(tailwind, projectRoot) {
|
|
|
431
490
|
};
|
|
432
491
|
}
|
|
433
492
|
function normalizeOptions(options = {}) {
|
|
434
|
-
const projectRoot = options.cwd ? path2.resolve(options.cwd) :
|
|
493
|
+
const projectRoot = options.cwd ? path2.resolve(options.cwd) : process3.cwd();
|
|
435
494
|
const overwrite = options.overwrite ?? true;
|
|
436
495
|
const output = normalizeOutputOptions(options.output);
|
|
437
496
|
const cache = normalizeCacheOptions(options.cache, projectRoot);
|
|
@@ -462,7 +521,7 @@ function normalizeOptions(options = {}) {
|
|
|
462
521
|
}
|
|
463
522
|
|
|
464
523
|
// src/runtime/class-collector.ts
|
|
465
|
-
import
|
|
524
|
+
import process4 from "process";
|
|
466
525
|
import fs3 from "fs-extra";
|
|
467
526
|
import path3 from "pathe";
|
|
468
527
|
|
|
@@ -520,7 +579,7 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
520
579
|
return path3.isAbsolute(value) ? value : path3.resolve(options.projectRoot, value);
|
|
521
580
|
};
|
|
522
581
|
const resolvedConfiguredBase = toAbsolute(v4Options.configuredBase);
|
|
523
|
-
const resolvedDefaultBase = toAbsolute(v4Options.base) ??
|
|
582
|
+
const resolvedDefaultBase = toAbsolute(v4Options.base) ?? process4.cwd();
|
|
524
583
|
const resolveSources = (base) => {
|
|
525
584
|
if (!v4Options.sources?.length) {
|
|
526
585
|
return void 0;
|
|
@@ -658,7 +717,7 @@ async function runTailwindBuild(options) {
|
|
|
658
717
|
}
|
|
659
718
|
|
|
660
719
|
// src/api/tailwindcss-patcher.ts
|
|
661
|
-
import
|
|
720
|
+
import process5 from "process";
|
|
662
721
|
import fs7 from "fs-extra";
|
|
663
722
|
import { getPackageInfoSync } from "local-pkg";
|
|
664
723
|
import path8 from "pathe";
|
|
@@ -1534,7 +1593,7 @@ var TailwindcssPatcher = class {
|
|
|
1534
1593
|
await fs7.writeFile(target, `${classList.join("\n")}
|
|
1535
1594
|
`, "utf8");
|
|
1536
1595
|
}
|
|
1537
|
-
logger_default.success(`Tailwind CSS class list saved to ${target.replace(
|
|
1596
|
+
logger_default.success(`Tailwind CSS class list saved to ${target.replace(process5.cwd(), ".")}`);
|
|
1538
1597
|
return {
|
|
1539
1598
|
...result,
|
|
1540
1599
|
filename: target
|
|
@@ -1561,7 +1620,7 @@ var TailwindcssPatcher = class {
|
|
|
1561
1620
|
};
|
|
1562
1621
|
|
|
1563
1622
|
// src/cli/commands.ts
|
|
1564
|
-
import
|
|
1623
|
+
import process6 from "process";
|
|
1565
1624
|
import { CONFIG_NAME, getConfig, initConfig } from "@tailwindcss-mangle/config";
|
|
1566
1625
|
|
|
1567
1626
|
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
@@ -1682,7 +1741,7 @@ function formatGroupedPreview(map, limit = 3) {
|
|
|
1682
1741
|
}
|
|
1683
1742
|
function resolveCwd(rawCwd) {
|
|
1684
1743
|
if (!rawCwd) {
|
|
1685
|
-
return
|
|
1744
|
+
return process6.cwd();
|
|
1686
1745
|
}
|
|
1687
1746
|
return path9.resolve(rawCwd);
|
|
1688
1747
|
}
|
|
@@ -1746,7 +1805,7 @@ function createCwdOptionDefinition(description = "Working directory") {
|
|
|
1746
1805
|
return {
|
|
1747
1806
|
flags: "--cwd <dir>",
|
|
1748
1807
|
description,
|
|
1749
|
-
config: { default:
|
|
1808
|
+
config: { default: process6.cwd() }
|
|
1750
1809
|
};
|
|
1751
1810
|
}
|
|
1752
1811
|
function buildDefaultCommandDefinitions() {
|
|
@@ -1900,7 +1959,7 @@ async function tokensCommandDefaultHandler(ctx) {
|
|
|
1900
1959
|
await fs8.writeFile(target, `${lines.join("\n")}
|
|
1901
1960
|
`, "utf8");
|
|
1902
1961
|
}
|
|
1903
|
-
logger_default.success(`Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(
|
|
1962
|
+
logger_default.success(`Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(process6.cwd(), ".")}`);
|
|
1904
1963
|
} else {
|
|
1905
1964
|
logger_default.success(`Collected ${report.entries.length} tokens from ${report.filesScanned} files.`);
|
|
1906
1965
|
if (format === "lines") {
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk6WXBENUZjs = require('./chunk-6WXBENUZ.js');
|
|
4
4
|
|
|
5
5
|
// src/cli.ts
|
|
6
|
-
var cli =
|
|
6
|
+
var cli = _chunk6WXBENUZjs.createTailwindcssPatchCli.call(void 0, );
|
|
7
7
|
cli.help();
|
|
8
8
|
cli.parse();
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -417,6 +417,11 @@ declare class CacheStore {
|
|
|
417
417
|
constructor(options: NormalizedCacheOptions);
|
|
418
418
|
private ensureDir;
|
|
419
419
|
private ensureDirSync;
|
|
420
|
+
private createTempPath;
|
|
421
|
+
private replaceCacheFile;
|
|
422
|
+
private replaceCacheFileSync;
|
|
423
|
+
private cleanupTempFile;
|
|
424
|
+
private cleanupTempFileSync;
|
|
420
425
|
write(data: Set<string>): Promise<string | undefined>;
|
|
421
426
|
writeSync(data: Set<string>): string | undefined;
|
|
422
427
|
read(): Promise<Set<string>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -417,6 +417,11 @@ declare class CacheStore {
|
|
|
417
417
|
constructor(options: NormalizedCacheOptions);
|
|
418
418
|
private ensureDir;
|
|
419
419
|
private ensureDirSync;
|
|
420
|
+
private createTempPath;
|
|
421
|
+
private replaceCacheFile;
|
|
422
|
+
private replaceCacheFileSync;
|
|
423
|
+
private cleanupTempFile;
|
|
424
|
+
private cleanupTempFileSync;
|
|
420
425
|
write(data: Set<string>): Promise<string | undefined>;
|
|
421
426
|
writeSync(data: Set<string>): string | undefined;
|
|
422
427
|
read(): Promise<Set<string>>;
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk6WXBENUZjs = require('./chunk-6WXBENUZ.js');
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var _config = require('@tailwindcss-mangle/config');
|
|
@@ -37,4 +37,4 @@ var _config = require('@tailwindcss-mangle/config');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
exports.CacheStore =
|
|
40
|
+
exports.CacheStore = _chunk6WXBENUZjs.CacheStore; exports.TailwindcssPatcher = _chunk6WXBENUZjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunk6WXBENUZjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunk6WXBENUZjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunk6WXBENUZjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunk6WXBENUZjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunk6WXBENUZjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunk6WXBENUZjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunk6WXBENUZjs.extractValidCandidates; exports.groupTokensByFile = _chunk6WXBENUZjs.groupTokensByFile; exports.loadRuntimeContexts = _chunk6WXBENUZjs.loadRuntimeContexts; exports.logger = _chunk6WXBENUZjs.logger_default; exports.mountTailwindcssPatchCommands = _chunk6WXBENUZjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunk6WXBENUZjs.normalizeOptions; exports.runTailwindBuild = _chunk6WXBENUZjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunk6WXBENUZjs.tailwindcssPatchCommands;
|
package/dist/index.mjs
CHANGED