-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.php
More file actions
30 lines (26 loc) · 1.24 KB
/
Copy pathinstall.php
File metadata and controls
30 lines (26 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
use Ynamite\ViteRex\Config;
use Ynamite\ViteRex\Csp;
use Ynamite\ViteRex\StubsInstaller;
// During an update, the OLD boot.php has already registered the badge
// OUTPUT_FILTER closure. It lazy-loads Badge at the end of the request —
// by then the NEW lib/Badge.php is on disk and references Csp, which the
// stale rex_autoload classmap can't resolve mid-request → fatal. Eagerly
// load classes introduced in this version that late-firing EPs may need.
if (!class_exists(Csp::class)) {
require_once __DIR__ . '/lib/Csp.php';
}
// Seed rex_config with defaults for any unset/empty keys, then write structure.json.
// On first install everything is unset → all defaults written. On re-install,
// only previously-cleared (or never-set) keys are repopulated; user-customized
// values stay intact. Idempotent.
Config::seedDefaults();
// Push viterex_addon's own npm deps into the user's project package.json.
// Additive + version-compare merge — won't downgrade or duplicate. Lets the
// Vite plugin resolve `svgo` from node_modules after the user runs `npm install`.
// Existing-install upgrade path; fresh installs get svgo via stubs/package.json.
StubsInstaller::syncPackageDeps([
'devDependencies' => [
'svgo' => '^4.0.0',
],
]);