tailwindcss-patch 8.4.0 → 8.4.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.
@@ -5,6 +5,9 @@ var logger_default = logger;
5
5
 
6
6
  // src/cache/store.ts
7
7
  import fs from "fs-extra";
8
+ function isErrnoException(error) {
9
+ return error instanceof Error && typeof error.code === "string";
10
+ }
8
11
  var CacheStore = class {
9
12
  constructor(options) {
10
13
  this.options = options;
@@ -55,6 +58,9 @@ var CacheStore = class {
55
58
  return new Set(data.filter((item) => typeof item === "string"));
56
59
  }
57
60
  } catch (error) {
61
+ if (isErrnoException(error) && error.code === "ENOENT") {
62
+ return /* @__PURE__ */ new Set();
63
+ }
58
64
  logger_default.warn("Unable to read Tailwind class cache, removing invalid file.", error);
59
65
  try {
60
66
  await fs.remove(this.options.path);
@@ -78,6 +84,9 @@ var CacheStore = class {
78
84
  return new Set(data.filter((item) => typeof item === "string"));
79
85
  }
80
86
  } catch (error) {
87
+ if (isErrnoException(error) && error.code === "ENOENT") {
88
+ return /* @__PURE__ */ new Set();
89
+ }
81
90
  logger_default.warn("Unable to read Tailwind class cache, removing invalid file.", error);
82
91
  try {
83
92
  fs.removeSync(this.options.path);
@@ -387,7 +396,7 @@ function normalizeTailwindV4Options(v4, fallbackBase) {
387
396
  const hasUserDefinedSources = Boolean(userSources?.length);
388
397
  const sources = hasUserDefinedSources ? userSources : [
389
398
  {
390
- base,
399
+ base: fallbackBase,
391
400
  pattern: "**/*",
392
401
  negated: false
393
402
  }
@@ -516,13 +525,6 @@ async function collectClassesFromTailwindV4(options) {
516
525
  if (!v4Options.sources?.length) {
517
526
  return void 0;
518
527
  }
519
- if (!v4Options.hasUserDefinedSources && !resolvedConfiguredBase) {
520
- return v4Options.sources.map((source) => ({
521
- base,
522
- pattern: source.pattern,
523
- negated: source.negated
524
- }));
525
- }
526
528
  return v4Options.sources.map((source) => ({
527
529
  base: source.base ?? base,
528
530
  pattern: source.pattern,
@@ -9,6 +9,9 @@ var logger_default = logger;
9
9
 
10
10
  // src/cache/store.ts
11
11
  var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
12
+ function isErrnoException(error) {
13
+ return error instanceof Error && typeof error.code === "string";
14
+ }
12
15
  var CacheStore = class {
13
16
  constructor(options) {
14
17
  this.options = options;
@@ -59,6 +62,9 @@ var CacheStore = class {
59
62
  return new Set(data.filter((item) => typeof item === "string"));
60
63
  }
61
64
  } catch (error) {
65
+ if (isErrnoException(error) && error.code === "ENOENT") {
66
+ return /* @__PURE__ */ new Set();
67
+ }
62
68
  logger_default.warn("Unable to read Tailwind class cache, removing invalid file.", error);
63
69
  try {
64
70
  await _fsextra2.default.remove(this.options.path);
@@ -82,6 +88,9 @@ var CacheStore = class {
82
88
  return new Set(data.filter((item) => typeof item === "string"));
83
89
  }
84
90
  } catch (error) {
91
+ if (isErrnoException(error) && error.code === "ENOENT") {
92
+ return /* @__PURE__ */ new Set();
93
+ }
85
94
  logger_default.warn("Unable to read Tailwind class cache, removing invalid file.", error);
86
95
  try {
87
96
  _fsextra2.default.removeSync(this.options.path);
@@ -391,7 +400,7 @@ function normalizeTailwindV4Options(v4, fallbackBase) {
391
400
  const hasUserDefinedSources = Boolean(_optionalChain([userSources, 'optionalAccess', _17 => _17.length]));
392
401
  const sources = hasUserDefinedSources ? userSources : [
393
402
  {
394
- base,
403
+ base: fallbackBase,
395
404
  pattern: "**/*",
396
405
  negated: false
397
406
  }
@@ -520,13 +529,6 @@ async function collectClassesFromTailwindV4(options) {
520
529
  if (!_optionalChain([v4Options, 'access', _28 => _28.sources, 'optionalAccess', _29 => _29.length])) {
521
530
  return void 0;
522
531
  }
523
- if (!v4Options.hasUserDefinedSources && !resolvedConfiguredBase) {
524
- return v4Options.sources.map((source) => ({
525
- base,
526
- pattern: source.pattern,
527
- negated: source.negated
528
- }));
529
- }
530
532
  return v4Options.sources.map((source) => ({
531
533
  base: _nullishCoalesce(source.base, () => ( base)),
532
534
  pattern: source.pattern,
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _chunkPF5ZTTYMjs = require('./chunk-PF5ZTTYM.js');
3
+ var _chunkFKEOVCUSjs = require('./chunk-FKEOVCUS.js');
4
4
 
5
5
  // src/cli.ts
6
- var cli = _chunkPF5ZTTYMjs.createTailwindcssPatchCli.call(void 0, );
6
+ var cli = _chunkFKEOVCUSjs.createTailwindcssPatchCli.call(void 0, );
7
7
  cli.help();
8
8
  cli.parse();
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTailwindcssPatchCli
3
- } from "./chunk-SHYTHM5B.mjs";
3
+ } from "./chunk-C3YPPFE6.mjs";
4
4
 
5
5
  // src/cli.ts
6
6
  var cli = createTailwindcssPatchCli();
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
 
17
17
 
18
- var _chunkPF5ZTTYMjs = require('./chunk-PF5ZTTYM.js');
18
+ var _chunkFKEOVCUSjs = require('./chunk-FKEOVCUS.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 = _chunkPF5ZTTYMjs.CacheStore; exports.TailwindcssPatcher = _chunkPF5ZTTYMjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkPF5ZTTYMjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkPF5ZTTYMjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkPF5ZTTYMjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkPF5ZTTYMjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkPF5ZTTYMjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkPF5ZTTYMjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkPF5ZTTYMjs.extractValidCandidates; exports.groupTokensByFile = _chunkPF5ZTTYMjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkPF5ZTTYMjs.loadRuntimeContexts; exports.logger = _chunkPF5ZTTYMjs.logger_default; exports.mountTailwindcssPatchCommands = _chunkPF5ZTTYMjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkPF5ZTTYMjs.normalizeOptions; exports.runTailwindBuild = _chunkPF5ZTTYMjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkPF5ZTTYMjs.tailwindcssPatchCommands;
40
+ exports.CacheStore = _chunkFKEOVCUSjs.CacheStore; exports.TailwindcssPatcher = _chunkFKEOVCUSjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkFKEOVCUSjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkFKEOVCUSjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkFKEOVCUSjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkFKEOVCUSjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkFKEOVCUSjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkFKEOVCUSjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkFKEOVCUSjs.extractValidCandidates; exports.groupTokensByFile = _chunkFKEOVCUSjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkFKEOVCUSjs.loadRuntimeContexts; exports.logger = _chunkFKEOVCUSjs.logger_default; exports.mountTailwindcssPatchCommands = _chunkFKEOVCUSjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkFKEOVCUSjs.normalizeOptions; exports.runTailwindBuild = _chunkFKEOVCUSjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkFKEOVCUSjs.tailwindcssPatchCommands;
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  normalizeOptions,
16
16
  runTailwindBuild,
17
17
  tailwindcssPatchCommands
18
- } from "./chunk-SHYTHM5B.mjs";
18
+ } from "./chunk-C3YPPFE6.mjs";
19
19
 
20
20
  // src/index.ts
21
21
  import { defineConfig } from "@tailwindcss-mangle/config";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",