@kirigami/php-prepros 1.0.4 → 1.0.6
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/package.json +2 -2
- package/src/libraries/fs.class.php +10 -12
- package/src/prepros.php +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirigami/php-prepros",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "PHP preprocessor for the Kirigami static site generator. Compile PHP page templates to clean, deployable HTML — with zero server dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kirigami",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@kirigami/php-wasm": "8.5.
|
|
47
|
+
"@kirigami/php-wasm": "8.5.10",
|
|
48
48
|
"@kirigami/struct-walker": "1.0.3"
|
|
49
49
|
},
|
|
50
50
|
"repository": {
|
|
@@ -4,20 +4,18 @@
|
|
|
4
4
|
class FS
|
|
5
5
|
{
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
public static function dig(string $path): iterable
|
|
7
|
+
public static function dig(string $path, bool $reverse = false): \Iterator
|
|
9
8
|
{
|
|
10
9
|
$patt = pathinfo($path, PATHINFO_BASENAME);
|
|
11
|
-
$
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
10
|
+
$dir = pathinfo($path, PATHINFO_DIRNAME);
|
|
11
|
+
|
|
12
|
+
if (!($dir = realpath($dir))) return new \EmptyIterator();
|
|
13
|
+
$rdi = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS);
|
|
14
|
+
$filtered = new \RecursiveCallbackFilterIterator($rdi, fn(\SplFileInfo $current) => $current->isDir() || fnmatch($patt, $current->getFilename()));
|
|
15
|
+
$iterator = new \RecursiveIteratorIterator($filtered);
|
|
16
|
+
if (!$reverse) return $iterator;
|
|
17
|
+
|
|
18
|
+
return new \ArrayIterator(array_reverse(iterator_to_array($iterator, false)));
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
|
package/src/prepros.php
CHANGED
|
@@ -25,7 +25,7 @@ try {
|
|
|
25
25
|
elseif (!$target = realpath($argv[1])) STD::error("Invalid target.");
|
|
26
26
|
else if (is_dir($target)) {
|
|
27
27
|
$prj = new PREPROS($config);
|
|
28
|
-
foreach (FS::dig($target . '/*.php') as $file) {
|
|
28
|
+
foreach (FS::dig($target . '/*.php', true) as $file) {
|
|
29
29
|
$parent = pathinfo(pathinfo($file, PATHINFO_DIRNAME), PATHINFO_BASENAME);
|
|
30
30
|
if (strpos($parent, '_') === 0) continue;
|
|
31
31
|
if (strpos(pathinfo($file, PATHINFO_FILENAME), '_') !== 0) continue;
|