viv isolate

Rewrites a plugin's bundled vendor/ under its own namespace prefix with php-scoper, so a library the plugin bundles at one version stops clashing with the same library the site, or another plugin, ships at another. Reach for it once viv install names the clash: it prints the plugin, the library and both versions, and the exact viv isolate <plugin> to run. install and update then keep every plugin in extra.viv.isolate prefixed. --no-plugins and --no-scripts work as they do on install: a lock that names a plugin viv refuses stops viv isolate too, unless you pass --no-plugins.

Usage

Prefix a plugin's bundled dependency tree with php-scoper so it can coexist with the site's own copy of the same library (#351): `<package>` adds it to `extra.viv.isolate` and isolates it, `--rm <package>` removes it and relinks the plain archive, `--list` prints every isolated plugin and its prefix

Usage: viv isolate [OPTIONS] [PACKAGE]

Arguments:
  [PACKAGE]  `vendor/package` to isolate; omit with `--list`/`--rm`

Options:
      --list                       Print every isolated plugin and its prefix, one per line
  -v, --verbose                    Raise logging to debug
      --cache-dir <CACHE_DIR>      Store location (default `$XDG_CACHE_HOME/vivace`, or `~/.cache/vivace`)
      --rm <PACKAGE>               Remove this package from `extra.viv.isolate` and relink the plain archive, instead of adding one
  -d, --project-dir <PROJECT_DIR>  Project directory holding `composer.json` [default: .]
      --offline                    Fail fast on any request instead of connecting: install errors, naming every package not already in the store; update solves from cached repository metadata only, erroring on an uncached package. Also set by `COMPOSER_DISABLE_NETWORK` (any value but unset, empty or `0`; Composer's own git-priming `prime` value is not special-cased here, since neither `install` nor `update` touch a git source)
      --no-plugins                 #354: resolve the site's own lock as Composer would with the same flag — the native installer adapters disabled, any other enabled plugin viv would otherwise refuse only warns (`docs/plugin-strategy.md`). Without it, a lock naming a plugin viv refuses (e.g. Altis) never reaches the scoper at all: `load_project` resolves the whole site lock before anything else here runs
      --no-scripts                 Accepted for symmetry with `install`/`dump-autoload`: `viv isolate` never runs scripts itself, so this is already true and only logged
  -h, --help                       Print help

Reads and writes

  • Reads: extra.viv.isolate in composer.json, the plugin's own install path under vendor/.
  • Writes: extra.viv.isolate in composer.json (adding or removing a package); the store's isolated-v0 bucket (the scoped tree) and isolate-check-v0 bucket (the cached per-plugin clash verdict); vendor/composer/.vivace-state (the prefix and the php-scoper version last checked against).

Exit codes

  • 0 — isolated (or already isolated, or removed) and the load check passed.
  • 1 — php -l or the load check failed on the scoped tree, and the plugin's plain archive stays linked; or --offline found no cached scoped tree for the plugin, and the error names it.

See also

Two plugins, one library, viv x, viv php, viv install