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

valksor / php-dev-build / 19202038340

09 Nov 2025 02:25AM UTC coverage: 17.283% (-0.9%) from 18.191%
19202038340

push

github

k0d3r1s
update documentation

383 of 2216 relevant lines covered (17.28%)

0.92 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
                                    ],
×
86
                                ],
×
87
                            ])
×
88
                            ->useAttributeAsKey('name')
×
89
                            ->arrayPrototype()
×
90
                                ->children()
×
91
                                    ->booleanNode('enabled')
×
92
                                        ->info('Enable or disable this service globally')
×
93
                                        ->example('true')
×
94
                                        ->defaultTrue()
×
95
                                    ->end()
×
96
                                    ->scalarNode('provider')
×
97
                                        ->info('Service provider class name (maps to implementation)')
×
98
                                        ->example('tailwind')
×
99
                                        ->isRequired()
×
100
                                    ->end()
×
101
                                    ->variableNode('flags')
×
102
                                        ->info('Service execution flags that determine when services run')
×
103
                                        ->example([
×
104
                                            'init' => true,
×
105
                                            'dev' => true,
×
106
                                            'prod' => true,
×
107
                                            'watch' => false,
×
108
                                            'build' => false,
×
109
                                        ])
×
110
                                        ->defaultValue([])
×
111
                                    ->end()
×
112
                                    ->variableNode('options')
×
113
                                        ->info('Service-specific configuration options')
×
114
                                        ->example([
×
115
                                            // Tailwind CSS service options
116
                                            'minify' => true,
×
117
                                            'watch' => false,
×
118

119
                                            // Importmap service options
120
                                            'esbuild' => true,
×
121
                                            'minify' => false,
×
122

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

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

170
    public static function getDefaults(): array
171
    {
172
        return [
×
173
            'binaries' => [
×
174
                'enabled' => true,
×
175
                'provider' => 'binaries',
×
176
                'flags' => ['init' => true, 'dev' => false, 'prod' => true],
×
177
                'options' => [
×
178
                    'required' => ['tailwindcss', 'esbuild', ],
×
179
                    'cache_duration' => 3600,
×
180
                ],
×
181
            ],
×
182
            'icons' => [
×
183
                'enabled' => true,
×
184
                'provider' => 'icons',
×
185
                'flags' => ['init' => true, 'dev' => false, 'prod' => true],
×
186
                'options' => [],
×
187
            ],
×
188
            'assets' => [
×
189
                'enabled' => true,
×
190
                'provider' => 'assets',
×
191
                'flags' => ['init' => false, 'dev' => false, 'prod' => true],
×
192
                'options' => [],
×
193
            ],
×
194
            'tailwind' => [
×
195
                'enabled' => true,
×
196
                'provider' => 'tailwind',
×
197
                'flags' => ['init' => false, 'dev' => true, 'prod' => true],
×
198
                'options' => ['minify' => false, ],
×
199
            ],
×
200
            'importmap' => [
×
201
                'enabled' => true,
×
202
                'provider' => 'importmap',
×
203
                'flags' => ['init' => false, 'dev' => true, 'prod' => true],
×
204
                'options' => ['watch' => true, 'minify' => false],
×
205
            ],
×
206
            'hot_reload' => [
×
207
                'enabled' => true,
×
208
                'provider' => 'hot_reload',
×
209
                'flags' => ['init' => false, 'dev' => true, 'prod' => false],
×
210
                'options' => [
×
211
                    'debounce_delay' => 0.3,
×
212
                    'watch_dirs' => ['/src', '/templates'],
×
213
                    'file_transformations' => ['*.tailwind.css' => ['output_pattern' => '{path}/{name}.css', 'debounce_delay' => 0.5, 'track_output' => true]],
×
214
                    'extended_suffixes' => ['.tailwind.css' => 0.5, '.min.css' => 0.3],
×
215
                ],
×
216
            ],
×
217
        ];
×
218
    }
219
}
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