sheetloaf 1.21.0 → 1.22.0

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.
@@ -6,57 +6,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildDestinationPath = exports.getAllFilesPathsFromSources = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
- const picomatch_1 = __importDefault(require("picomatch"));
10
9
  const glob_1 = require("glob");
11
10
  function getAllFilesPathsFromSources(input, callback) {
12
11
  let sourcesCompleted = 0;
13
12
  let filePaths = [];
14
13
  for (let i = 0; i < input.length; i++) {
15
- let isGlob, isDir, isFile = false;
16
- isGlob = picomatch_1.default.scan(input[i]).isGlob;
17
- if (isGlob === true) {
18
- getGlobPaths(input[i], (files) => {
19
- filePaths.push(...files);
20
- sourcesCompleted++;
21
- if (sourcesCompleted === input.length) {
22
- callback([...new Set(filePaths)].sort());
23
- }
24
- });
25
- }
26
- else {
14
+ const result = (0, glob_1.globSync)(input[i], { withFileTypes: true });
15
+ if (result.length === 1 && result[0].isDirectory()) {
27
16
  try {
28
- isDir = fs_1.default.lstatSync(path_1.default.normalize(input[i])).isDirectory();
29
- isFile = fs_1.default.lstatSync(path_1.default.normalize(input[i])).isFile();
30
- if (isFile) {
31
- getGlobPaths(input[i], (files) => {
32
- filePaths.push(...files);
33
- sourcesCompleted++;
34
- if (sourcesCompleted === input.length) {
35
- callback([...new Set(filePaths)].sort());
36
- }
37
- });
38
- }
39
- else if (isDir) {
40
- getAllFilePathsInDir(input[i], (files) => {
41
- filePaths.push(...files);
42
- sourcesCompleted++;
43
- if (sourcesCompleted === input.length) {
44
- callback([...new Set(filePaths)].sort());
45
- }
46
- });
47
- }
17
+ getAllFilePathsInDir(input[i], (files) => {
18
+ filePaths.push(...files);
19
+ sourcesCompleted++;
20
+ if (sourcesCompleted === input.length) {
21
+ callback([...new Set(filePaths)].sort());
22
+ }
23
+ });
48
24
  }
49
25
  catch (err) {
50
26
  throw err;
51
27
  }
52
28
  }
29
+ else {
30
+ for (const entry of result) {
31
+ if (entry.isFile()) {
32
+ filePaths.push(path_1.default.normalize(entry.relative()));
33
+ }
34
+ }
35
+ sourcesCompleted++;
36
+ if (sourcesCompleted === input.length) {
37
+ callback([...new Set(filePaths)].sort());
38
+ }
39
+ }
53
40
  }
54
41
  }
55
42
  exports.getAllFilesPathsFromSources = getAllFilesPathsFromSources;
56
- function getGlobPaths(glob, callback) {
57
- let expanded = (0, glob_1.globSync)(glob).map((entry) => path_1.default.normalize(entry));
58
- callback(expanded);
59
- }
60
43
  function getAllFilePathsInDir(dir, callback) {
61
44
  let files = [];
62
45
  fs_1.default.readdir(dir, (err, nodes) => {
package/dist/index.js CHANGED
@@ -46,8 +46,9 @@ const postcss_1 = __importDefault(require("postcss"));
46
46
  const configs = __importStar(require("./configs"));
47
47
  const fileFinder = __importStar(require("./fileFinder"));
48
48
  const sources = __importStar(require("./sources"));
49
+ const glob_1 = require("glob");
49
50
  const sheetloaf = new commander_1.Command();
50
- sheetloaf.version("1.21.0", '-v, --version', 'Print the version of Sheetloaf.');
51
+ sheetloaf.version("1.22.0", '-v, --version', 'Print the version of Sheetloaf.');
51
52
  let usingStdin = false;
52
53
  let postcssConfig = {
53
54
  plugins: []
@@ -142,8 +143,9 @@ function renderPartially(source, fileName) {
142
143
  }
143
144
  function watch(source) {
144
145
  if (sheetloaf.opts().watch === true) {
146
+ const toWatch = (0, glob_1.globSync)(source[0].split(','));
145
147
  chokidar_1.default
146
- .watch(source[0].split(','), {
148
+ .watch(toWatch, {
147
149
  usePolling: sheetloaf.opts().poll !== undefined,
148
150
  interval: typeof sheetloaf.opts().poll === 'number' ? sheetloaf.opts().poll : 100,
149
151
  ignoreInitial: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sheetloaf",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "freshmade stylesheets for the whole family.",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {
@@ -49,11 +49,10 @@
49
49
  "postcss": "^8.4.0"
50
50
  },
51
51
  "dependencies": {
52
- "chokidar": "^3.6.0",
52
+ "chokidar": "^4.0.1",
53
53
  "commander": "^9.4.0",
54
54
  "glob": "^11.0.0",
55
55
  "picocolors": "^1.0.1",
56
- "picomatch": "^4.0.2",
57
- "sass": "^1.78.0"
56
+ "sass": "^1.79.4"
58
57
  }
59
58
  }