• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valksor / php-dev-build / 19384258487

15 Nov 2025 04:07AM UTC coverage: 19.747% (+2.5%) from 17.283%
19384258487

push

github

k0d3r1s
prettier

16 of 30 new or added lines in 4 files covered. (53.33%)

516 existing lines in 7 files now uncovered.

484 of 2451 relevant lines covered (19.75%)

1.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/DependencyInjection/BuildConfiguration.php
1
<?php declare(strict_types = 1);
2

3
/*
4
 * This file is part of the Valksor package.
5
 *
6
 * (c) Davis Zalitis (k0d3r1s)
7
 * (c) SIA Valksor <packages@valksor.com>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12

13
namespace ValksorDev\Build\DependencyInjection;
14

15
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
18
use Valksor\Bundle\DependencyInjection\AbstractDependencyConfiguration;
19
use Valksor\Bundle\ValksorBundle;
20

21
use function sprintf;
22

23
class BuildConfiguration extends AbstractDependencyConfiguration
24
{
25
    public function addSection(
26
        ArrayNodeDefinition $rootNode,
27
        callable $enableIfStandalone,
28
        string $component,
29
    ): void {
30
        $rootNode
×
31
            ->children()
×
32
                ->arrayNode($component)
×
33
                    ->{$enableIfStandalone(sprintf('%s/%s', ValksorBundle::VALKSOR, $component), self::class)}()
×
34
                    ->addDefaultsIfNotSet()
×
35
                    ->children()
×
36
                        // Service registry with extensible flag system
×
37
                        ->arrayNode('services')
×
38
                            ->info('Valksor Build System Services Configuration')
×
39
                            ->example([
×
40
                                'binaries' => [
×
41
                                    'enabled' => true,
×
42
                                    'flags' => ['init' => true, 'dev' => true, 'prod' => true],
×
43
                                    'provider' => 'binaries',
×
44
                                ],
×
45
                                'tailwind' => [
×
46
                                    'enabled' => true,
×
47
                                    'flags' => ['dev' => true, 'prod' => true],
×
48
                                    'provider' => 'tailwind',
×
49
                                    'options' => [
×
50
                                        'minify' => true,
×
51
                                        'watch' => false,
×
52
                                    ],
×
53
                                ],
×
54
                                'importmap' => [
×
55
                                    'enabled' => true,
×
56
                                    'flags' => ['dev' => true, 'prod' => true],
×
57
                                    'provider' => 'importmap',
×
58
                                    'options' => [
×
59
                                        'minify' => false,
×
60
                                        'esbuild' => true,
×
61
                                    ],
×
62
                                ],
×
63
                                'hot_reload' => [
×
64
                                    'enabled' => true,
×
65
                                    'flags' => ['dev' => true],
×
66
                                    'provider' => 'hot_reload',
×
67
                                    'options' => [
×
68
                                        'watch_dirs' => ['src/apps', 'infrastructure'],
×
69
                                        'debounce_delay' => 0.3,
×
70
                                        'extended_extensions' => [
×
71
                                            'php' => 0.1,
×
72
                                            'js' => 0.1,
×
73
                                            'css' => 0.2,
×
74
                                        ],
×
75
                                        'extended_suffixes' => [
×
76
                                            '.tailwind.css' => 0.5,
×
77
                                        ],
×
78
                                        'file_transformations' => [
×
79
                                            '*.tailwind.css' => [
×
80
                                                'output_pattern' => '{path}/{name}.css',
×
81
                                                'debounce_delay' => 0.5,
×
82
                                                'track_output' => true,
×
83
                                            ],
×
84
                                        ],
×
85
                                        'exclude' => [
×
86
                                            'tests', 'Tests', 'coverage', '.coverage', 'docs', 'build', 'dist',
×
87
                                            '**/*.log', '**/.DS_Store', '**/node_modules/**',
×
88
                                        ],
×
89
                                    ],
×
90
                                ],
×
91
                            ])
×
92
                            ->useAttributeAsKey('name')
×
93
                            ->arrayPrototype()
×
94
                                ->children()
×
95
                                    ->booleanNode('enabled')
×
96
                                        ->info('Enable or disable this service globally')
×
97
                                        ->example('true')
×
98
                                        ->defaultTrue()
×
99
                                    ->end()
×
100
                                    ->scalarNode('provider')
×
101
                                        ->info('Service provider class name (maps to implementation)')
×
102
                                        ->example('tailwind')
×
103
                                        ->isRequired()
×
104
                                    ->end()
×
105
                                    ->variableNode('flags')
×
106
                                        ->info('Service execution flags that determine when services run')
×
107
                                        ->example([
×
108
                                            'init' => true,
×
109
                                            'dev' => true,
×
110
                                            'prod' => true,
×
111
                                            'watch' => false,
×
112
                                            'build' => false,
×
113
                                        ])
×
114
                                        ->defaultValue([])
×
UNCOV
115
                                    ->end()
×
116
                                    ->variableNode('options')
×
117
                                        ->info('Service-specific configuration options')
×
UNCOV
118
                                        ->example([
×
119
                                            // Tailwind CSS service options
120
                                            'minify' => true,
×
121
                                            'watch' => false,
×
122

123
                                            // Importmap service options
124
                                            'esbuild' => true,
×
125
                                            'minify' => false,
×
126

127
                                            // Hot reload service options
128
                                            'watch_dirs' => ['src/apps', 'infrastructure'],
×
129
                                            'debounce_delay' => 0.3,
×
130
                                            'extended_extensions' => [
×
131
                                                'php' => 0.1,    // PHP files get 100ms debounce
×
132
                                                'js' => 0.1,     // JS files get 100ms debounce
×
133
                                                'css' => 0.2,     // CSS files get 200ms debounce
×
134
                                                'twig' => 0.3,   // Twig files get 300ms debounce
×
135
                                            ],
×
136
                                            'extended_suffixes' => [
×
137
                                                '.tailwind.css' => 0.5,  // Compiled CSS gets longer debounce
×
138
                                                '.min.css' => 0.3,
×
139
                                            ],
×
140
                                            'file_transformations' => [
×
141
                                                '*.tailwind.css' => [
×
142
                                                    'output_pattern' => '{path}/{name}.css',
×
143
                                                    'debounce_delay' => 0.5,
×
144
                                                    'track_output' => true,
×
145
                                                ],
×
146
                                            ],
×
147
                                        ])
×
148
                                        ->defaultValue(self::getDefaults())
×
149
                                    ->end()
×
150
                                ->end()
×
151
                            ->end()
×
UNCOV
152
                        ->end()
×
UNCOV
153
                    ->end()
×
UNCOV
154
                ->end()
×
UNCOV
155
            ->end();
×
156
    }
157

158
    public function registerPreConfiguration(
159
        ContainerConfigurator $container,
160
        ContainerBuilder $builder,
161
        string $component,
162
    ): void {
163
        if ($builder->hasExtension('framework')) {
×
164
            $builder->prependExtensionConfig('framework', [
×
165
                'asset_mapper' => [
×
166
                    'excluded_patterns' => [
×
UNCOV
167
                        '**/*.tailwind.css',
×
UNCOV
168
                    ],
×
UNCOV
169
                ],
×
UNCOV
170
            ]);
×
171
        }
172
    }
173

174
    public static function getDefaults(): array
175
    {
176
        return [
×
177
            'binaries' => [
×
178
                'enabled' => true,
×
179
                'provider' => 'binaries',
×
180
                'flags' => ['init' => true, 'dev' => false, 'prod' => true],
×
181
                'options' => [
×
182
                    'required' => ['tailwindcss', 'esbuild', ],
×
183
                    'cache_duration' => 3600,
×
184
                ],
×
185
            ],
×
186
            'icons' => [
×
187
                'enabled' => true,
×
188
                'provider' => 'icons',
×
189
                'flags' => ['init' => true, 'dev' => false, 'prod' => true],
×
190
                'options' => [],
×
191
            ],
×
192
            'assets' => [
×
193
                'enabled' => true,
×
194
                'provider' => 'assets',
×
195
                'flags' => ['init' => false, 'dev' => false, 'prod' => true],
×
196
                'options' => [],
×
197
            ],
×
198
            'tailwind' => [
×
199
                'enabled' => true,
×
200
                'provider' => 'tailwind',
×
201
                'flags' => ['init' => false, 'dev' => true, 'prod' => true],
×
202
                'options' => ['minify' => false, ],
×
203
            ],
×
204
            'importmap' => [
×
205
                'enabled' => true,
×
206
                'provider' => 'importmap',
×
207
                'flags' => ['init' => false, 'dev' => true, 'prod' => true],
×
208
                'options' => ['watch' => true, 'minify' => false],
×
209
            ],
×
210
            'hot_reload' => [
×
211
                'enabled' => true,
×
212
                'provider' => 'hot_reload',
×
213
                'flags' => ['init' => false, 'dev' => true, 'prod' => false],
×
214
                'options' => [
×
215
                    'debounce_delay' => 0.3,
×
216
                    'watch_dirs' => ['/src', '/templates'],
×
217
                    'file_transformations' => ['*.tailwind.css' => ['output_pattern' => '{path}/{name}.css', 'debounce_delay' => 0.5, 'track_output' => true]],
×
UNCOV
218
                    'extended_suffixes' => ['.tailwind.css' => 1.0, '.min.css' => 0.3],
×
UNCOV
219
                ],
×
UNCOV
220
            ],
×
UNCOV
221
        ];
×
222
    }
223
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc