@getvitops/vite 8.2.0-alpha.0 → 8.3.0-alpha.0
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/CHANGELOG.md +159 -16
- package/dist/index.d.mts +3 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +28 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,163 @@
|
|
|
1
1
|
# @getvitops/vite
|
|
2
2
|
|
|
3
|
+
## 8.3.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 06d6112: Fix the EmDash `/design-system` admin page erroring on a tailwind site. It fetches `/vitops/design-manifest.json`, which the `tailwind` format never emitted and the integration only mirrored under `editor: true` (which also loads `editor.js` on every public page).
|
|
8
|
+
|
|
9
|
+
- **generator** (`tailwind` format only): `design-manifest.json` is now emitted alongside `tailwind.css`. No change to the CSS.
|
|
10
|
+
- **astro**: new `vitops({ editorManifest: true })` writes everything an outside host needs into `public/vitops/` (`design-manifest.json`, `editor.js`, a standalone `editor.css`, and `design-system-editor.html`) without loading the editor on public pages. `editor: true` still loads it from `<Head />`.
|
|
11
|
+
- **vite**: `editorManifestDir` also writes `vitops/editor.css`, from a throwaway `css`-format pass on tailwind sites.
|
|
12
|
+
- **emdash**: the `/design-system` admin page was unstyled and overflowed the admin, because the editor borrows the framework CSS and the admin never loads it. It now embeds `/vitops/design-system-editor.html` in an iframe, so the design system can't leak into the admin's styles. **Requires `editorManifest: true`** in `vitops({ … })`.
|
|
13
|
+
- **create**: the EmDash template sets `editorManifest: true`. Existing sites: add it to `vitops({ … })` in `astro.config.mjs`.
|
|
14
|
+
|
|
15
|
+
No consumer-facing change in the other toolchain packages.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [93d2067]
|
|
20
|
+
- Updated dependencies [161c7f3]
|
|
21
|
+
- Updated dependencies [175d16e]
|
|
22
|
+
- Updated dependencies [83d6f3c]
|
|
23
|
+
- Updated dependencies [892b204]
|
|
24
|
+
- Updated dependencies [06d6112]
|
|
25
|
+
- Updated dependencies [6297337]
|
|
26
|
+
- Updated dependencies [55061e2]
|
|
27
|
+
- Updated dependencies [b47df4d]
|
|
28
|
+
- @getvitops/generator@8.3.0-alpha.0
|
|
29
|
+
- @getvitops/utils@8.3.0-alpha.0
|
|
30
|
+
|
|
31
|
+
## 8.2.0
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- c3c1bcb: **New: the design-system editor, mounted inside the EmDash admin.** `vitopsEmdash({
|
|
36
|
+
designSystemEditor: { config } })` (`config` is your `site.json`, e.g. `import config from
|
|
37
|
+
'./site.json' with { type: 'json' }`) adds a `/design-system` admin page mounting
|
|
38
|
+
`<wc-theme-editor>` — the same live token editor `@getvitops/vite`'s dev server has always
|
|
39
|
+
offered, now usable by the client directly, no dev server required. An edit is visible
|
|
40
|
+
site-wide immediately (a runtime `:root` override, served via a new plugin API route and
|
|
41
|
+
`page:fragments`) and — once `site.deployment.repo`/`branch` and a `VITOPS_GITHUB_TOKEN`
|
|
42
|
+
secret are set (see the scaffold's `SETUP.html`) — auto-commits to your `dev` branch, so it
|
|
43
|
+
reaches the git-tracked `site.json` through your repo's normal review path rather than
|
|
44
|
+
becoming a second, unreviewed source of truth. Until that's configured, the live half still
|
|
45
|
+
works; only the auto-commit half is skipped (and says so in the admin page). The save route
|
|
46
|
+
runs the exact same accessibility (APCA contrast) gate `generate()` enforces at build time,
|
|
47
|
+
synchronously, before persisting — nothing non-compliant ever goes live even momentarily.
|
|
48
|
+
|
|
49
|
+
Requires `@astrojs/react` + `react` + `react-dom` (already scaffold dependencies, for
|
|
50
|
+
EmDash's own admin) and `@getvitops/core` (added as a new scaffold dependency this release).
|
|
51
|
+
Declares two new plugin capabilities when enabled: `network:request` (for the GitHub
|
|
52
|
+
auto-commit) and `hooks.page-fragments:register` (for the live override) — reviewed once at
|
|
53
|
+
plugin-install time.
|
|
54
|
+
|
|
55
|
+
**Breaking for `@getvitops/emdash`**: `vitopsEmdash()`'s `hooks.page-fragments:register`
|
|
56
|
+
capability is now also granted whenever `designSystemEditor` is set, independent of the
|
|
57
|
+
existing `scripts: 'fragments'` option (which governs something unrelated — web-component
|
|
58
|
+
script delivery). No change if you don't use `designSystemEditor`.
|
|
59
|
+
|
|
60
|
+
Also new, supporting the above:
|
|
61
|
+
|
|
62
|
+
- `@getvitops/generator`: `validateColorContract()` and `buildReverseIndex()` (both
|
|
63
|
+
`/tokens` subpath, Worker-safe) — the monotonicity/contrast gate and the
|
|
64
|
+
`design-manifest.json` reverse-index, each extracted from `generate()`'s `build()` into
|
|
65
|
+
standalone, non-throwing functions. `patchToOverrideCss()` turns a design-system patch
|
|
66
|
+
into the `:root` override `<style>` block. `designSystemPath`/`getAt`/`setAt`/
|
|
67
|
+
`mergePatch`/`formatConfig` moved from `@getvitops/vite` into `@getvitops/generator/config`
|
|
68
|
+
(re-exported from `@getvitops/vite` unchanged) — one "patch a config file's design-system
|
|
69
|
+
subtree" implementation shared by the dev endpoint and the new plugin route. New
|
|
70
|
+
`site.deployment.repo`/`branch` config fields.
|
|
71
|
+
- `@getvitops/utils`: new `/git` subpath — `commitFile()`, a Worker-safe (fetch-only)
|
|
72
|
+
wrapper over GitHub's Contents API.
|
|
73
|
+
- `@getvitops/core`: `<wc-theme-editor>` gains a `save-endpoint` attribute (default
|
|
74
|
+
unchanged — `/__vitops/design-system`) so the same element can target the new plugin
|
|
75
|
+
route instead of the dev-only Vite endpoint.
|
|
76
|
+
|
|
77
|
+
- 0574388: Bump `emdash`/`@emdash-cms/cloudflare` peers to `>=1.0.0 <2` and `vite-plus` to `^1.0.0`, following
|
|
78
|
+
both projects' GA releases.
|
|
79
|
+
|
|
80
|
+
**Breaking for `@getvitops/emdash` consumers on EmDash 0.x**: the peer range no longer admits
|
|
81
|
+
`emdash@0.31.x`/`@emdash-cms/cloudflare@0.31.x`. Upgrade `emdash` and `@emdash-cms/cloudflare` to
|
|
82
|
+
`^1.0.1` first — nothing in `@getvitops/emdash`'s own plugin surface (`admin.portableTextBlocks`,
|
|
83
|
+
the `hooks.page-fragments:register` capability, `definePlugin()`) changed against EmDash 1.0, so no
|
|
84
|
+
code here needed to change, only the declared range.
|
|
85
|
+
|
|
86
|
+
The `emdash` scaffold template (`vp create @getvitops:emdash`) picks up several fixes alongside
|
|
87
|
+
the version bump:
|
|
88
|
+
|
|
89
|
+
- `tailwindcss`/`@tailwindcss/vite` are now real dependencies — the template selected
|
|
90
|
+
`css.format: 'tailwind'` without installing either, which threw on build.
|
|
91
|
+
- `site.json` now sets `site.icons.sprite: true` plus the full `semantic` list the
|
|
92
|
+
`vitops.actionLink` block's icon picker offers — previously its sprite icons pointed at a file
|
|
93
|
+
the build never generated.
|
|
94
|
+
- `astro.config.mjs` sets `migrations: { runtime: 'check', dev: 'auto' }`, and
|
|
95
|
+
`site-deploy-emdash.yml` runs EmDash 1.0's documented `build → status → apply → deploy → check`
|
|
96
|
+
migration sequence explicitly, rather than relying solely on first-request auto-migration. This
|
|
97
|
+
needs a new GitHub Environment variable, `EMDASH_TARGET_FINGERPRINT` (one per environment),
|
|
98
|
+
which only a human can set — run `emdash migrate --status` against the real deployed database,
|
|
99
|
+
review the printed identity, then `gh variable set EMDASH_TARGET_FINGERPRINT --env <env> --body
|
|
100
|
+
<value>`. Deploys fail clearly on the migration-apply step until it's set.
|
|
101
|
+
- `lint.options.typeAware`/`typeCheck` in the template's own `vite.config.ts` are commented out,
|
|
102
|
+
not deleted: vite-plus 1.0 only honours that option in a project's actual root config, and hard
|
|
103
|
+
errors on it in a nested one (which this file is, sitting inside the `design-system` monorepo).
|
|
104
|
+
Uncomment it once scaffolded into its own repo.
|
|
105
|
+
|
|
106
|
+
No config schema changes. `@getvitops/generator` also switches from the `zod/mini` subpath import
|
|
107
|
+
to the standalone `@zod/mini` package (zod 4.5+; same API) and fixes `validateConfig()` silently
|
|
108
|
+
losing the offending key name on an `unrecognized_keys` error (e.g. a typo'd `site.ads` platform
|
|
109
|
+
now names the bad key instead of reporting a bare "Invalid input").
|
|
110
|
+
|
|
111
|
+
Also fixed: `vp check`'s `tsconfig-error` for `packages/create/templates/emdash/tsconfig.json`
|
|
112
|
+
(`extends: "astro/tsconfigs/strict"`, unresolvable from inside this monorepo since the template
|
|
113
|
+
has no `node_modules` of its own — a pre-existing, structural gap, newly surfaced as a hard error
|
|
114
|
+
by oxlint 1.85's deeper config discovery, and blocking on every commit since this repo's pre-commit
|
|
115
|
+
hook runs `vp check --fix`). Fixed with a new `scripts/link-template-deps.mjs`, wired as the root
|
|
116
|
+
`postinstall` script: symlinks `astro`/`emdash`/`@emdash-cms/cloudflare` into the template's own
|
|
117
|
+
`node_modules/` (resolved fresh from sibling packages that already depend on them for real, not a
|
|
118
|
+
hardcoded `.pnpm` hash) and writes a minimal `astro:content` ambient shim at `.astro/types.d.ts`
|
|
119
|
+
(the same path `astro sync` would generate for real). Both are gitignored and only ever exist
|
|
120
|
+
inside this monorepo's copy of the template — a real scaffold installs its own real copies instead.
|
|
121
|
+
Considered and rejected first: inlining astro's strict preset (drift risk against astro's own
|
|
122
|
+
evolving default) and making the template a real pnpm workspace member (would change how its
|
|
123
|
+
`@getvitops/*: "latest"` deps resolve locally, which `templates.test.ts` exists to protect).
|
|
124
|
+
|
|
125
|
+
**Known gap, not fixed here**: `packages/astro/src/components/container.test.ts` (the
|
|
126
|
+
`AstroContainer`-based render tests) fails to even load under vite-plus 1.0's Vite 8 — direct
|
|
127
|
+
`.astro` imports in a Vitest file need the Astro Vite plugin registered, which nothing in this
|
|
128
|
+
repo's test config actually does (Astro's own docs call for `getViteConfig()`, which doesn't
|
|
129
|
+
compose with vite-plus's own `defineConfig`). A type-level shim
|
|
130
|
+
(`packages/astro/src/components/astro-modules.d.ts`) fixes `vp check`'s type-aware pass, but the
|
|
131
|
+
runtime `vp test` failure for this one file is still open.
|
|
132
|
+
|
|
133
|
+
- Updated dependencies [65a13cc]
|
|
134
|
+
- Updated dependencies [67e2088]
|
|
135
|
+
- Updated dependencies [89265af]
|
|
136
|
+
- Updated dependencies [0574388]
|
|
137
|
+
- Updated dependencies [c3c1bcb]
|
|
138
|
+
- Updated dependencies [0574388]
|
|
139
|
+
- Updated dependencies [1a8231d]
|
|
140
|
+
- Updated dependencies [779d22e]
|
|
141
|
+
- Updated dependencies [0574388]
|
|
142
|
+
- Updated dependencies [8d8aad7]
|
|
143
|
+
- Updated dependencies [0574388]
|
|
144
|
+
- Updated dependencies [1a3e811]
|
|
145
|
+
- Updated dependencies [0574388]
|
|
146
|
+
- Updated dependencies [dde3df3]
|
|
147
|
+
- Updated dependencies [d9f213b]
|
|
148
|
+
- Updated dependencies [7f4f50e]
|
|
149
|
+
- Updated dependencies [7fd5f8f]
|
|
150
|
+
- Updated dependencies [ceb8310]
|
|
151
|
+
- @getvitops/generator@8.2.0
|
|
152
|
+
- @getvitops/utils@8.2.0
|
|
153
|
+
|
|
3
154
|
## 8.2.0-alpha.0
|
|
4
155
|
|
|
5
156
|
### Patch Changes
|
|
6
157
|
|
|
7
158
|
- c3c1bcb: **New: the design-system editor, mounted inside the EmDash admin.** `vitopsEmdash({
|
|
8
|
-
designSystemEditor: { config } })` (`config` is your `site.json`, e.g. `import config from
|
|
9
|
-
'./site.json' with { type: 'json' }`) adds a `/design-system` admin page mounting
|
|
159
|
+
designSystemEditor: { config } })` (`config` is your `site.json`, e.g. `import config from
|
|
160
|
+
'./site.json' with { type: 'json' }`) adds a `/design-system` admin page mounting
|
|
10
161
|
`<wc-theme-editor>` — the same live token editor `@getvitops/vite`'s dev server has always
|
|
11
162
|
offered, now usable by the client directly, no dev server required. An edit is visible
|
|
12
163
|
site-wide immediately (a runtime `:root` override, served via a new plugin API route and
|
|
@@ -67,7 +218,7 @@ designSystemEditor: { config } })` (`config` is your `site.json`, e.g. `import c
|
|
|
67
218
|
needs a new GitHub Environment variable, `EMDASH_TARGET_FINGERPRINT` (one per environment),
|
|
68
219
|
which only a human can set — run `emdash migrate --status` against the real deployed database,
|
|
69
220
|
review the printed identity, then `gh variable set EMDASH_TARGET_FINGERPRINT --env <env> --body
|
|
70
|
-
<value>`. Deploys fail clearly on the migration-apply step until it's set.
|
|
221
|
+
<value>`. Deploys fail clearly on the migration-apply step until it's set.
|
|
71
222
|
- `lint.options.typeAware`/`typeCheck` in the template's own `vite.config.ts` are commented out,
|
|
72
223
|
not deleted: vite-plus 1.0 only honours that option in a project's actual root config, and hard
|
|
73
224
|
errors on it in a nested one (which this file is, sitting inside the `design-system` monorepo).
|
|
@@ -458,28 +609,20 @@ options, watch behaviour and dev-server endpoints are unchanged.
|
|
|
458
609
|
{
|
|
459
610
|
"designSystem": {
|
|
460
611
|
"themes": {
|
|
461
|
-
"default": {
|
|
462
|
-
/* … */
|
|
463
|
-
},
|
|
612
|
+
"default": {/* … */},
|
|
464
613
|
},
|
|
465
614
|
},
|
|
466
615
|
"organization": {
|
|
467
616
|
"name": "Acme",
|
|
468
617
|
"contact": "hq",
|
|
469
618
|
"locations": {
|
|
470
|
-
"hq": {
|
|
471
|
-
/* … */
|
|
472
|
-
},
|
|
619
|
+
"hq": {/* … */},
|
|
473
620
|
},
|
|
474
621
|
},
|
|
475
622
|
"site": {
|
|
476
623
|
"defaultLocale": "en",
|
|
477
|
-
"domains": {
|
|
478
|
-
|
|
479
|
-
},
|
|
480
|
-
"analytics": {
|
|
481
|
-
/* … */
|
|
482
|
-
},
|
|
624
|
+
"domains": {/* … */},
|
|
625
|
+
"analytics": {/* … */},
|
|
483
626
|
},
|
|
484
627
|
}
|
|
485
628
|
```
|
|
@@ -559,7 +702,7 @@ options, watch behaviour and dev-server endpoints are unchanged.
|
|
|
559
702
|
toolchain bump. Use `--force` when you mean to re-encode.
|
|
560
703
|
|
|
561
704
|
**`ffmpeg` is an external tool, not an npm dependency** — install it yourself (`brew install
|
|
562
|
-
ffmpeg`, `apt install ffmpeg`, `winget install Gyan.FFmpeg`). The command fails without it rather
|
|
705
|
+
ffmpeg`, `apt install ffmpeg`, `winget install Gyan.FFmpeg`). The command fails without it rather
|
|
563
706
|
than skipping: a page referencing a video that was never encoded is broken, not degraded.
|
|
564
707
|
|
|
565
708
|
Two defaults worth knowing about. The MP4 exists because older iOS and the in-app webviews inside
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Format, LegalOutput, designSystemPath, getAt, setAt } from "@getvitops/generator";
|
|
2
2
|
import { OutputKind } from "@getvitops/utils/media";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
|
-
//#region src/index.d.ts
|
|
5
4
|
export interface VitopsMediaOptions {
|
|
6
5
|
/** Directory of unprocessed video, walked recursively. Default: 'raw'. */
|
|
7
6
|
raw?: string;
|
|
@@ -83,8 +82,9 @@ export interface VitopsPluginOptions {
|
|
|
83
82
|
media?: VitopsMediaOptions;
|
|
84
83
|
/**
|
|
85
84
|
* Directory to mirror `design-manifest.json` into as `vitops/design-manifest.json`
|
|
86
|
-
* — the URL `<wc-theme-editor>` fetches by default
|
|
87
|
-
* `editor`
|
|
85
|
+
* — the URL `<wc-theme-editor>` fetches by default — plus a standalone
|
|
86
|
+
* `vitops/editor.css` for hosts that render the editor outside the site's own pages.
|
|
87
|
+
* Set by the Astro integration's `editor` / `editorManifest` options. Copied inside the generate pass rather than by the caller, so
|
|
88
88
|
* it can't race the first generation and can't go stale on regeneration.
|
|
89
89
|
*/
|
|
90
90
|
editorManifestDir?: string;
|
|
@@ -142,6 +142,5 @@ export interface VitopsLegalOptions {
|
|
|
142
142
|
siteEnv?: string;
|
|
143
143
|
}
|
|
144
144
|
export default function vitops(options?: VitopsPluginOptions): Plugin;
|
|
145
|
-
//#endregion
|
|
146
145
|
export { designSystemPath, getAt, setAt };
|
|
147
146
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;iBAsDiB;;EAEf;;;;;;;EAOA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,UAAU;;EAEV;;iBAGe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;iBAGe;;;;;;;;;EASf;;;;;;;EAOA;;EAEA,SAAS;;EAET;;EAEA,UAAU;;;;;;;;;;;;;;;;;EAiBV,QAAQ;;;;;;;;EAQR;;;;;;;;EAQA;;;;;;;;;EASA,QAAQ;;;;;;;;;;EAUR,OAAO;;;;;;EAMP;;iBAGe;;EAEf;;EAEA;;iBAGe;;;;;EAKf;;EAEA;;EAEA,SAAS;;EAET;;wBAGsB,OAAO,UAAS,sBAA2B"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
2
3
|
import { join, resolve } from "node:path";
|
|
3
4
|
import { designSystemPath, designSystemPath as designSystemPath$1, formatConfig, generate, generateLegal, getAt, getAt as getAt$1, isConfig, mergePatch, resolveConfig, setAt, setAt as setAt$1, validate } from "@getvitops/generator";
|
|
4
5
|
import { generateFavicons, writeFaviconManifest } from "@getvitops/utils";
|
|
5
6
|
import { MEDIA_MANIFEST_PATH, processMedia } from "@getvitops/utils/media";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
// src/index.ts
|
|
8
9
|
/**
|
|
9
10
|
* @getvitops/vite — a Vite plugin that generates Vitops design-system output from a
|
|
10
11
|
* `design-system.json` (or from the larger site config that embeds one) during a
|
|
@@ -28,14 +29,17 @@ function vitops(options = {}) {
|
|
|
28
29
|
const run = async () => {
|
|
29
30
|
const raw = readJson(input);
|
|
30
31
|
const inputIsSite = isConfig(raw);
|
|
31
|
-
|
|
32
|
+
const genArgs = {
|
|
32
33
|
input: raw,
|
|
33
|
-
format,
|
|
34
34
|
outDir,
|
|
35
35
|
...options.theme != null ? { theme: options.theme } : {},
|
|
36
36
|
siteEnv: options.site?.siteEnv ?? "production",
|
|
37
37
|
...options.systemColorScheme != null ? { systemColorScheme: options.systemColorScheme } : {},
|
|
38
38
|
...siteInput ? { site: readJson(siteInput) } : {}
|
|
39
|
+
};
|
|
40
|
+
await generate({
|
|
41
|
+
...genArgs,
|
|
42
|
+
format
|
|
39
43
|
});
|
|
40
44
|
if (options.legal) {
|
|
41
45
|
const legalPath = legalInput || siteInput || (inputIsSite ? input : "");
|
|
@@ -47,11 +51,26 @@ function vitops(options = {}) {
|
|
|
47
51
|
for (const [name, content] of Object.entries(files)) writeFileSync(join(legalOut, name), content);
|
|
48
52
|
}
|
|
49
53
|
if (options.editorManifestDir) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const dest = resolve(root, options.editorManifestDir, "vitops");
|
|
55
|
+
mkdirSync(dest, { recursive: true });
|
|
56
|
+
const manifest = resolve(root, outDir, "design-manifest.json");
|
|
57
|
+
if (existsSync(manifest)) copyFileSync(manifest, join(dest, "design-manifest.json"));
|
|
58
|
+
if (format === "css") copyFileSync(resolve(root, outDir, "styles.css"), join(dest, "editor.css"));
|
|
59
|
+
else {
|
|
60
|
+
const scratch = mkdtempSync(join(tmpdir(), "vitops-editor-css-"));
|
|
61
|
+
try {
|
|
62
|
+
await generate({
|
|
63
|
+
...genArgs,
|
|
64
|
+
format: "css",
|
|
65
|
+
outDir: scratch
|
|
66
|
+
});
|
|
67
|
+
copyFileSync(join(scratch, "styles.css"), join(dest, "editor.css"));
|
|
68
|
+
} finally {
|
|
69
|
+
rmSync(scratch, {
|
|
70
|
+
recursive: true,
|
|
71
|
+
force: true
|
|
72
|
+
});
|
|
73
|
+
}
|
|
55
74
|
}
|
|
56
75
|
}
|
|
57
76
|
if (options.spriteDir) {
|
|
@@ -167,6 +186,5 @@ function vitops(options = {}) {
|
|
|
167
186
|
};
|
|
168
187
|
}
|
|
169
188
|
|
|
170
|
-
//#endregion
|
|
171
189
|
export { vitops as default, designSystemPath, getAt, setAt };
|
|
172
190
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["designSystemPath","getAt","setAt"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @getvitops/vite — a Vite plugin that generates Vitops design-system output from a\n * `design-system.json` (or from the larger site config that embeds one) during a\n * Vite/Astro (EmDash) build, and hot-regenerates when the config changes in dev.\n *\n * import vitops from '@getvitops/vite';\n * export default { plugins: [vitops({ input: 'design-system.json', format: 'tailwind', out: 'src/styles' })] };\n *\n * Thin wrapper over @getvitops/generator — the same generator the CLI uses.\n */\nimport { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport type { Plugin } from 'vite';\nimport {\n designSystemPath,\n formatConfig,\n generate,\n generateLegal,\n getAt,\n isConfig,\n mergePatch,\n resolveConfig,\n setAt,\n validate,\n type Format,\n type LegalOutput,\n} from '@getvitops/generator';\nimport { generateFavicons, writeFaviconManifest } from '@getvitops/utils';\n// Re-exported for existing consumers/tests importing these from this package\n// directly — the implementations now live in `@getvitops/generator` (shared\n// with the EmDash design-system-editor plugin route; see that package's\n// AGENTS.md section), this module just re-uses them.\nexport { designSystemPath, getAt, setAt } from '@getvitops/generator';\n// Own subpath: it shells out to ffmpeg, and a project without a `media` option\n// should never load it.\nimport {\n MEDIA_MANIFEST_PATH,\n processMedia,\n type MediaConfig,\n type OutputKind,\n} from '@getvitops/utils/media';\n\n/** Endpoint `<wc-theme-editor>` probes for, and POSTs its patch to. */\nconst EDITOR_ENDPOINT = '/__vitops/design-system';\n\nexport interface VitopsMediaOptions {\n /** Directory of unprocessed video, walked recursively. Default: 'raw'. */\n raw?: string;\n /**\n * Where encoded outputs go. Default: `'src/assets/processed'`.\n *\n * Under `src/` so Vite content-hashes each file and it can be served immutable;\n * the raw sources stay outside anything Vite scans.\n */\n out?: string;\n /** Cap the output width, keeping aspect ratio. Default 1920; 0 disables. */\n maxWidth?: number;\n /** Quality on VP9's CRF scale (0–63, lower is better). Default 32. */\n crf?: number;\n /** Optional bitrate ceiling, e.g. `'2M'`. Absent means constant quality. */\n maxBitrate?: string;\n /** Keep the audio track. Default false. */\n audio?: boolean;\n /** Timestamp (seconds) the poster frame comes from. Default 0. */\n posterTime?: number;\n /** Which outputs to produce. Default: webm, mp4 and a poster. */\n outputs?: OutputKind[];\n /** Cache file. Default `.vitops/media-manifest.json`. */\n manifest?: string;\n}\n\nexport interface VitopsFaviconOptions {\n /** Source SVG or PNG. */\n source: string;\n /** Optional simplified source for the 16px icon. */\n lowResSource?: string;\n /** Directory to write the favicon set into. Default: 'public'. */\n out?: string;\n /** App name — when set (with `themeColor`), also emit `site.webmanifest`. */\n name?: string;\n /** PWA theme color (also drives `<meta name=\"theme-color\">`). */\n themeColor?: string;\n /** PWA background color. */\n backgroundColor?: string;\n}\n\nexport interface VitopsPluginOptions {\n /**\n * Path to the config. Default: `'design-system.json'`.\n *\n * May be a `design-system.json` **or** the larger site config that embeds one\n * (`company.json` / `site.json`) — told apart by shape. Pointing it at a site\n * config also supplies `site` below, so a consumer who keeps their tokens\n * there declares the path once instead of three times.\n */\n input?: string;\n /**\n * Which `designSystem.themes` entry to build, when `input` is a site config.\n * Default: the config's `defaultTheme`, else `default`.\n *\n * Also the theme `<wc-theme-editor>`'s **Save to source** writes back into.\n */\n theme?: string;\n /** Output target. Default: 'tailwind' (the EmDash/Astro case). */\n format?: Format;\n /** Directory to write generated output into. Default: 'src/styles'. */\n out?: string;\n /** Also generate a favicon set on build from this source image. */\n favicon?: VitopsFaviconOptions;\n /**\n * Also encode raw video on build, into WebM + MP4 + a poster frame.\n *\n * Runs inside this pass rather than in the Astro integration's `config:setup`\n * hook, for the same reason the manifest and sprite copies do: it produces bytes,\n * so it belongs where it cannot race the first generation.\n *\n * Cached on source content and encode settings, so re-running costs a hash per\n * file. Needs `ffmpeg` on PATH and fails loudly without it — an unencoded hero\n * video is not a degraded build, it is a broken page.\n *\n * The raw directory is deliberately **not** watched: `watched()` matches config\n * files by exact path, and a multi-minute encode triggered mid-dev-server is a\n * poor trade for it. A video added during dev arrives on restart, or via\n * `vitops media`.\n */\n media?: VitopsMediaOptions;\n /**\n * Directory to mirror `design-manifest.json` into as `vitops/design-manifest.json`\n * — the URL `<wc-theme-editor>` fetches by default. Set by the Astro integration's\n * `editor` option. Copied inside the generate pass rather than by the caller, so\n * it can't race the first generation and can't go stale on regeneration.\n */\n editorManifestDir?: string;\n /**\n * Directory to mirror the generated `icons.svg` into as `vitops/icons.svg` —\n * the URL `<Icon />` targets under the `sprite` engine. Same reasoning as\n * `editorManifestDir`: copied inside the generate pass, so it can't race a\n * cold start or go stale after a config edit. The *href* is a plain string\n * decided at config:setup; only the bytes arrive here.\n */\n spriteDir?: string;\n /**\n * Also render the site's legal documents on build, and re-render when the site\n * config changes.\n *\n * Its own option because it is an *output* you opt into — but its `input` is\n * optional, defaulting to `site.input`, then to `input` when that is itself a\n * site config. `legal: {}` is therefore the whole declaration in the common case.\n */\n legal?: VitopsLegalOptions;\n /**\n * The site config, for the parts of generation that depend on site-level facts\n * rather than on the design system — currently `designSystem.defaultColorScheme`, which\n * decides whether the colour layer carries a `prefers-color-scheme` block.\n *\n * Only needed when the site config is a *different* file from `input`; when\n * `input` is itself a site config, that one is used. Watched, so an edit\n * regenerates.\n */\n site?: VitopsSiteOptions;\n /**\n * Emit the `prefers-color-scheme: dark` block. Normally read from the site\n * config's `designSystem.defaultColorScheme: \"system\"`; set here it wins, for consumers with no\n * site config.\n */\n systemColorScheme?: boolean;\n}\n\nexport interface VitopsSiteOptions {\n /** Path to the site config (JSON). */\n input: string;\n /** Environment whose A/B variant applies. Default: 'production'. */\n siteEnv?: string;\n}\n\nexport interface VitopsLegalOptions {\n /**\n * Path to the site config (JSON). Optional: defaults to `site.input`, then to\n * the plugin's own `input` when that is itself a site config.\n */\n input?: string;\n /** Directory to write documents into. Default: 'src/content/legal'. */\n out?: string;\n /** Output format. Default: 'md', which suits an Astro content collection. */\n format?: LegalOutput;\n /** Environment whose A/B variant applies. Default: 'production'. */\n siteEnv?: string;\n}\n\nexport default function vitops(options: VitopsPluginOptions = {}): Plugin {\n const format: Format = options.format ?? 'tailwind';\n const outDir = options.out ?? 'src/styles';\n let input = resolve(options.input ?? 'design-system.json');\n let legalInput = options.legal?.input ? resolve(options.legal.input) : '';\n let siteInput = options.site ? resolve(options.site.input) : '';\n let root = '';\n\n const readJson = (p: string) => JSON.parse(readFileSync(p, 'utf8')) as unknown;\n\n const run = async () => {\n // Read once and hand `generate` the parsed object: it has to be inspected\n // here anyway to know whether `input` is a site config, and reading the same\n // file twice per regeneration is how a half-written save gets picked up.\n const raw = readJson(input);\n const inputIsSite = isConfig(raw);\n // `generate` reads the site config only for what the stylesheet depends on;\n // legal documents stay the separate opt-in below.\n await generate({\n input: raw as Parameters<typeof generate>[0]['input'],\n format,\n outDir,\n ...(options.theme != null ? { theme: options.theme } : {}),\n siteEnv: options.site?.siteEnv ?? 'production',\n ...(options.systemColorScheme != null\n ? { systemColorScheme: options.systemColorScheme }\n : {}),\n // An explicit `site` wins; otherwise `input` supplies it when it is one.\n ...(siteInput ? { site: readJson(siteInput) as never } : {}),\n });\n if (options.legal) {\n // The three paths are the same file in almost every project, so the\n // declaration cascades rather than being repeated.\n const legalPath = legalInput || siteInput || (inputIsSite ? input : '');\n if (!legalPath)\n throw new Error(\n '[vitops] legal: needs a site config — set `legal.input`, or the `site` option, or ' +\n 'point `input` at a site config.',\n );\n const legalOut = resolve(root, options.legal.out ?? 'src/content/legal');\n const site = resolveConfig(readJson(legalPath), options.legal.siteEnv ?? 'production');\n const files = generateLegal(site, { output: options.legal.format ?? 'md' });\n mkdirSync(legalOut, { recursive: true });\n for (const [name, content] of Object.entries(files))\n writeFileSync(join(legalOut, name), content);\n }\n if (options.editorManifestDir) {\n const src = resolve(root, outDir, 'design-manifest.json');\n if (existsSync(src)) {\n const dest = resolve(root, options.editorManifestDir, 'vitops');\n mkdirSync(dest, { recursive: true });\n copyFileSync(src, join(dest, 'design-manifest.json'));\n }\n }\n if (options.spriteDir) {\n const src = resolve(root, outDir, 'icons.svg');\n if (existsSync(src)) {\n const dest = resolve(root, options.spriteDir, 'vitops');\n mkdirSync(dest, { recursive: true });\n copyFileSync(src, join(dest, 'icons.svg'));\n }\n }\n if (options.favicon) {\n const faviconOut = resolve(root, options.favicon.out ?? 'public');\n await generateFavicons({\n source: resolve(root, options.favicon.source),\n outputDir: faviconOut,\n ...(options.favicon.lowResSource\n ? { lowResSource: resolve(root, options.favicon.lowResSource) }\n : {}),\n // Composited under the maskable outputs, so they match the manifest's\n // `background_color` rather than being transparent where it must not be.\n ...(options.favicon.backgroundColor\n ? { backgroundColor: options.favicon.backgroundColor }\n : {}),\n });\n if (options.favicon.name && options.favicon.themeColor) {\n await writeFaviconManifest(faviconOut, {\n name: options.favicon.name,\n themeColor: options.favicon.themeColor,\n ...(options.favicon.backgroundColor\n ? { backgroundColor: options.favicon.backgroundColor }\n : {}),\n });\n }\n }\n if (options.media) {\n const media = options.media;\n const config: MediaConfig = {\n ...(media.maxWidth != null ? { maxWidth: media.maxWidth } : {}),\n ...(media.crf != null ? { crf: media.crf } : {}),\n ...(media.maxBitrate ? { maxBitrate: media.maxBitrate } : {}),\n ...(media.audio != null ? { audio: media.audio } : {}),\n ...(media.posterTime != null ? { posterTime: media.posterTime } : {}),\n ...(media.outputs ? { outputs: media.outputs } : {}),\n };\n const result = await processMedia({\n raw: resolve(root, media.raw ?? 'raw'),\n out: resolve(root, media.out ?? 'src/assets/processed'),\n config,\n // Resolved against the project root even when defaulted. Left to\n // `processMedia` it would resolve against cwd, and in a monorepo run from\n // the workspace root that puts the cache somewhere the next build won't\n // look — so every build re-encodes, silently.\n manifest: resolve(root, media.manifest ?? MEDIA_MANIFEST_PATH),\n // An encode is minutes of silence otherwise, which in a build reads as a hang.\n onProgress: (message) => console.log(`[vitops] media: ${message}`),\n });\n if (result.written.length > 0)\n console.log(\n `[vitops] media: ${result.written.length} written, ${result.skipped} unchanged`,\n );\n }\n };\n\n // Every config `run()` reads is an input, so every one must trigger a re-run —\n // a legal document (or a colour layer) that only refreshes when the design\n // system changes is worse than one that never refreshes, because it looks\n // current. De-duplicated because `site.input` and `legal.input` are usually the\n // same file, and watching it twice would regenerate twice per edit.\n const watched = () => [...new Set([input, siteInput, legalInput].filter(Boolean))];\n\n return {\n name: '@getvitops/vite',\n // Resolve paths against Vite's project root once it's known.\n configResolved(config) {\n root = config.root;\n input = resolve(config.root, options.input ?? 'design-system.json');\n if (options.legal?.input) legalInput = resolve(config.root, options.legal.input);\n if (options.site) siteInput = resolve(config.root, options.site.input);\n },\n async buildStart() {\n for (const f of watched()) this.addWatchFile(f);\n await run();\n },\n async watchChange(id) {\n if (watched().includes(resolve(id))) await run();\n },\n configureServer(server) {\n for (const f of watched()) server.watcher.add(f);\n server.watcher.on('change', async (file) => {\n if (!watched().includes(resolve(file))) return;\n await run();\n server.ws.send({ type: 'full-reload' });\n });\n\n // Dev-only design-system write-back, for `<wc-theme-editor>`'s \"Save to\n // source\". Registered in configureServer only, so it exists in `vite dev`\n // and never in a build — on a static deploy the editor's probe 404s and the\n // button simply isn't rendered. The only writable path is `input`, already\n // resolved from config: a request supplies a patch, never a destination.\n //\n // The editor's patch is always design-system-relative (`colors.palette.…`),\n // because that is the only config it knows about. When `input` is a site\n // config the patch is therefore merged into — and validated against — the\n // design system SUBTREE, and only the surrounding file is written whole.\n // Merging it at the root instead would write a `colors` key beside\n // `organization` that nothing reads, and `validate` would reject the site\n // config wholesale, so every save would fail with errors about the wrong\n // document.\n server.middlewares.use(EDITOR_ENDPOINT, (req, res, next) => {\n const json = (status: number, body: unknown): void => {\n res.statusCode = status;\n res.setHeader('content-type', 'application/json');\n res.end(JSON.stringify(body));\n };\n\n if (req.method === 'GET') {\n try {\n const current = readJson(input);\n const at = designSystemPath(current, options.theme);\n return json(200, {\n writable: true,\n path: input,\n // The subtree, not the file: the editor's own model of a config is\n // a design system, and `at` says where in the file it lives.\n at,\n config: getAt(current, at),\n });\n } catch (err) {\n return json(500, { error: (err as Error).message });\n }\n }\n\n if (req.method !== 'POST') return next();\n\n const chunks: Buffer[] = [];\n req.on('data', (c: Buffer) => chunks.push(c));\n req.on('end', () => {\n try {\n const { patch } = JSON.parse(Buffer.concat(chunks).toString('utf8')) as {\n patch?: unknown;\n };\n if (patch == null || typeof patch !== 'object')\n return json(400, { errors: ['body must be { patch: object }'] });\n\n const current = readJson(input);\n const at = designSystemPath(current, options.theme);\n const merged = mergePatch(getAt(current, at), patch);\n // Validate the *merged* result, not the patch: a patch is a partial\n // by design, so it can't be validated on its own, and writing an\n // invalid config would break the very dev server doing the writing.\n const result = validate(merged);\n if (!result.ok)\n return json(400, {\n errors: result.errors.map((e) => `${e.path.join('.') || '(root)'}: ${e.message}`),\n });\n\n writeFileSync(input, `${formatConfig(setAt(current, at, merged))}\\n`);\n // The watcher above picks the write up and regenerates + reloads.\n return json(200, { ok: true, warnings: result.warnings });\n } catch (err) {\n return json(400, { errors: [(err as Error).message] });\n }\n });\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAM,kBAAkB;AAkJxB,SAAwB,OAAO,UAA+B,CAAC,GAAW;CACxE,MAAM,SAAiB,QAAQ,UAAU;CACzC,MAAM,SAAS,QAAQ,OAAO;CAC9B,IAAI,QAAQ,QAAQ,QAAQ,SAAS,oBAAoB;CACzD,IAAI,aAAa,QAAQ,OAAO,QAAQ,QAAQ,QAAQ,MAAM,KAAK,IAAI;CACv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,EAAE,GAAG;MAEpE,OAAO,KAAK,KAAK;OAAE,IAAI;OAAM,UAAU,OAAO;MAAS,CAAC;KAC1D,SAAS,KAAK;MACZ,OAAO,KAAK,KAAK,EAAE,QAAQ,CAAE,IAAc,OAAO,EAAE,CAAC;KACvD;IACF,CAAC;GACH,CAAC;EACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["designSystemPath","getAt","setAt"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @getvitops/vite — a Vite plugin that generates Vitops design-system output from a\n * `design-system.json` (or from the larger site config that embeds one) during a\n * Vite/Astro (EmDash) build, and hot-regenerates when the config changes in dev.\n *\n * import vitops from '@getvitops/vite';\n * export default { plugins: [vitops({ input: 'design-system.json', format: 'tailwind', out: 'src/styles' })] };\n *\n * Thin wrapper over @getvitops/generator — the same generator the CLI uses.\n */\nimport {\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join, resolve } from 'node:path';\nimport type { Plugin } from 'vite';\nimport {\n designSystemPath,\n formatConfig,\n generate,\n generateLegal,\n getAt,\n isConfig,\n mergePatch,\n resolveConfig,\n setAt,\n validate,\n type Format,\n type LegalOutput,\n} from '@getvitops/generator';\nimport { generateFavicons, writeFaviconManifest } from '@getvitops/utils';\n// Re-exported for existing consumers/tests importing these from this package\n// directly — the implementations now live in `@getvitops/generator` (shared\n// with the EmDash design-system-editor plugin route; see that package's\n// AGENTS.md section), this module just re-uses them.\nexport { designSystemPath, getAt, setAt } from '@getvitops/generator';\n// Own subpath: it shells out to ffmpeg, and a project without a `media` option\n// should never load it.\nimport {\n MEDIA_MANIFEST_PATH,\n processMedia,\n type MediaConfig,\n type OutputKind,\n} from '@getvitops/utils/media';\n\n/** Endpoint `<wc-theme-editor>` probes for, and POSTs its patch to. */\nconst EDITOR_ENDPOINT = '/__vitops/design-system';\n\nexport interface VitopsMediaOptions {\n /** Directory of unprocessed video, walked recursively. Default: 'raw'. */\n raw?: string;\n /**\n * Where encoded outputs go. Default: `'src/assets/processed'`.\n *\n * Under `src/` so Vite content-hashes each file and it can be served immutable;\n * the raw sources stay outside anything Vite scans.\n */\n out?: string;\n /** Cap the output width, keeping aspect ratio. Default 1920; 0 disables. */\n maxWidth?: number;\n /** Quality on VP9's CRF scale (0–63, lower is better). Default 32. */\n crf?: number;\n /** Optional bitrate ceiling, e.g. `'2M'`. Absent means constant quality. */\n maxBitrate?: string;\n /** Keep the audio track. Default false. */\n audio?: boolean;\n /** Timestamp (seconds) the poster frame comes from. Default 0. */\n posterTime?: number;\n /** Which outputs to produce. Default: webm, mp4 and a poster. */\n outputs?: OutputKind[];\n /** Cache file. Default `.vitops/media-manifest.json`. */\n manifest?: string;\n}\n\nexport interface VitopsFaviconOptions {\n /** Source SVG or PNG. */\n source: string;\n /** Optional simplified source for the 16px icon. */\n lowResSource?: string;\n /** Directory to write the favicon set into. Default: 'public'. */\n out?: string;\n /** App name — when set (with `themeColor`), also emit `site.webmanifest`. */\n name?: string;\n /** PWA theme color (also drives `<meta name=\"theme-color\">`). */\n themeColor?: string;\n /** PWA background color. */\n backgroundColor?: string;\n}\n\nexport interface VitopsPluginOptions {\n /**\n * Path to the config. Default: `'design-system.json'`.\n *\n * May be a `design-system.json` **or** the larger site config that embeds one\n * (`company.json` / `site.json`) — told apart by shape. Pointing it at a site\n * config also supplies `site` below, so a consumer who keeps their tokens\n * there declares the path once instead of three times.\n */\n input?: string;\n /**\n * Which `designSystem.themes` entry to build, when `input` is a site config.\n * Default: the config's `defaultTheme`, else `default`.\n *\n * Also the theme `<wc-theme-editor>`'s **Save to source** writes back into.\n */\n theme?: string;\n /** Output target. Default: 'tailwind' (the EmDash/Astro case). */\n format?: Format;\n /** Directory to write generated output into. Default: 'src/styles'. */\n out?: string;\n /** Also generate a favicon set on build from this source image. */\n favicon?: VitopsFaviconOptions;\n /**\n * Also encode raw video on build, into WebM + MP4 + a poster frame.\n *\n * Runs inside this pass rather than in the Astro integration's `config:setup`\n * hook, for the same reason the manifest and sprite copies do: it produces bytes,\n * so it belongs where it cannot race the first generation.\n *\n * Cached on source content and encode settings, so re-running costs a hash per\n * file. Needs `ffmpeg` on PATH and fails loudly without it — an unencoded hero\n * video is not a degraded build, it is a broken page.\n *\n * The raw directory is deliberately **not** watched: `watched()` matches config\n * files by exact path, and a multi-minute encode triggered mid-dev-server is a\n * poor trade for it. A video added during dev arrives on restart, or via\n * `vitops media`.\n */\n media?: VitopsMediaOptions;\n /**\n * Directory to mirror `design-manifest.json` into as `vitops/design-manifest.json`\n * — the URL `<wc-theme-editor>` fetches by default — plus a standalone\n * `vitops/editor.css` for hosts that render the editor outside the site's own pages.\n * Set by the Astro integration's `editor` / `editorManifest` options. Copied inside the generate pass rather than by the caller, so\n * it can't race the first generation and can't go stale on regeneration.\n */\n editorManifestDir?: string;\n /**\n * Directory to mirror the generated `icons.svg` into as `vitops/icons.svg` —\n * the URL `<Icon />` targets under the `sprite` engine. Same reasoning as\n * `editorManifestDir`: copied inside the generate pass, so it can't race a\n * cold start or go stale after a config edit. The *href* is a plain string\n * decided at config:setup; only the bytes arrive here.\n */\n spriteDir?: string;\n /**\n * Also render the site's legal documents on build, and re-render when the site\n * config changes.\n *\n * Its own option because it is an *output* you opt into — but its `input` is\n * optional, defaulting to `site.input`, then to `input` when that is itself a\n * site config. `legal: {}` is therefore the whole declaration in the common case.\n */\n legal?: VitopsLegalOptions;\n /**\n * The site config, for the parts of generation that depend on site-level facts\n * rather than on the design system — currently `designSystem.defaultColorScheme`, which\n * decides whether the colour layer carries a `prefers-color-scheme` block.\n *\n * Only needed when the site config is a *different* file from `input`; when\n * `input` is itself a site config, that one is used. Watched, so an edit\n * regenerates.\n */\n site?: VitopsSiteOptions;\n /**\n * Emit the `prefers-color-scheme: dark` block. Normally read from the site\n * config's `designSystem.defaultColorScheme: \"system\"`; set here it wins, for consumers with no\n * site config.\n */\n systemColorScheme?: boolean;\n}\n\nexport interface VitopsSiteOptions {\n /** Path to the site config (JSON). */\n input: string;\n /** Environment whose A/B variant applies. Default: 'production'. */\n siteEnv?: string;\n}\n\nexport interface VitopsLegalOptions {\n /**\n * Path to the site config (JSON). Optional: defaults to `site.input`, then to\n * the plugin's own `input` when that is itself a site config.\n */\n input?: string;\n /** Directory to write documents into. Default: 'src/content/legal'. */\n out?: string;\n /** Output format. Default: 'md', which suits an Astro content collection. */\n format?: LegalOutput;\n /** Environment whose A/B variant applies. Default: 'production'. */\n siteEnv?: string;\n}\n\nexport default function vitops(options: VitopsPluginOptions = {}): Plugin {\n const format: Format = options.format ?? 'tailwind';\n const outDir = options.out ?? 'src/styles';\n let input = resolve(options.input ?? 'design-system.json');\n let legalInput = options.legal?.input ? resolve(options.legal.input) : '';\n let siteInput = options.site ? resolve(options.site.input) : '';\n let root = '';\n\n const readJson = (p: string) => JSON.parse(readFileSync(p, 'utf8')) as unknown;\n\n const run = async () => {\n // Read once and hand `generate` the parsed object: it has to be inspected\n // here anyway to know whether `input` is a site config, and reading the same\n // file twice per regeneration is how a half-written save gets picked up.\n const raw = readJson(input);\n const inputIsSite = isConfig(raw);\n // `generate` reads the site config only for what the stylesheet depends on;\n // legal documents stay the separate opt-in below.\n const genArgs = {\n input: raw as Parameters<typeof generate>[0]['input'],\n outDir,\n ...(options.theme != null ? { theme: options.theme } : {}),\n siteEnv: options.site?.siteEnv ?? 'production',\n ...(options.systemColorScheme != null\n ? { systemColorScheme: options.systemColorScheme }\n : {}),\n // An explicit `site` wins; otherwise `input` supplies it when it is one.\n ...(siteInput ? { site: readJson(siteInput) as never } : {}),\n };\n await generate({ ...genArgs, format });\n if (options.legal) {\n // The three paths are the same file in almost every project, so the\n // declaration cascades rather than being repeated.\n const legalPath = legalInput || siteInput || (inputIsSite ? input : '');\n if (!legalPath)\n throw new Error(\n '[vitops] legal: needs a site config — set `legal.input`, or the `site` option, or ' +\n 'point `input` at a site config.',\n );\n const legalOut = resolve(root, options.legal.out ?? 'src/content/legal');\n const site = resolveConfig(readJson(legalPath), options.legal.siteEnv ?? 'production');\n const files = generateLegal(site, { output: options.legal.format ?? 'md' });\n mkdirSync(legalOut, { recursive: true });\n for (const [name, content] of Object.entries(files))\n writeFileSync(join(legalOut, name), content);\n }\n if (options.editorManifestDir) {\n const dest = resolve(root, options.editorManifestDir, 'vitops');\n mkdirSync(dest, { recursive: true });\n const manifest = resolve(root, outDir, 'design-manifest.json');\n if (existsSync(manifest)) copyFileSync(manifest, join(dest, 'design-manifest.json'));\n // The editor renders in light DOM and borrows the framework's own CSS, which a host\n // outside the site's pages (the EmDash admin, in an iframe) has to load itself. That\n // needs a standalone stylesheet; only the `css` format emits one, so a tailwind site\n // gets a throwaway `css` pass whose output never reaches `outDir`.\n if (format === 'css') {\n copyFileSync(resolve(root, outDir, 'styles.css'), join(dest, 'editor.css'));\n } else {\n const scratch = mkdtempSync(join(tmpdir(), 'vitops-editor-css-'));\n try {\n await generate({ ...genArgs, format: 'css', outDir: scratch });\n copyFileSync(join(scratch, 'styles.css'), join(dest, 'editor.css'));\n } finally {\n rmSync(scratch, { recursive: true, force: true });\n }\n }\n }\n if (options.spriteDir) {\n const src = resolve(root, outDir, 'icons.svg');\n if (existsSync(src)) {\n const dest = resolve(root, options.spriteDir, 'vitops');\n mkdirSync(dest, { recursive: true });\n copyFileSync(src, join(dest, 'icons.svg'));\n }\n }\n if (options.favicon) {\n const faviconOut = resolve(root, options.favicon.out ?? 'public');\n await generateFavicons({\n source: resolve(root, options.favicon.source),\n outputDir: faviconOut,\n ...(options.favicon.lowResSource\n ? { lowResSource: resolve(root, options.favicon.lowResSource) }\n : {}),\n // Composited under the maskable outputs, so they match the manifest's\n // `background_color` rather than being transparent where it must not be.\n ...(options.favicon.backgroundColor\n ? { backgroundColor: options.favicon.backgroundColor }\n : {}),\n });\n if (options.favicon.name && options.favicon.themeColor) {\n await writeFaviconManifest(faviconOut, {\n name: options.favicon.name,\n themeColor: options.favicon.themeColor,\n ...(options.favicon.backgroundColor\n ? { backgroundColor: options.favicon.backgroundColor }\n : {}),\n });\n }\n }\n if (options.media) {\n const media = options.media;\n const config: MediaConfig = {\n ...(media.maxWidth != null ? { maxWidth: media.maxWidth } : {}),\n ...(media.crf != null ? { crf: media.crf } : {}),\n ...(media.maxBitrate ? { maxBitrate: media.maxBitrate } : {}),\n ...(media.audio != null ? { audio: media.audio } : {}),\n ...(media.posterTime != null ? { posterTime: media.posterTime } : {}),\n ...(media.outputs ? { outputs: media.outputs } : {}),\n };\n const result = await processMedia({\n raw: resolve(root, media.raw ?? 'raw'),\n out: resolve(root, media.out ?? 'src/assets/processed'),\n config,\n // Resolved against the project root even when defaulted. Left to\n // `processMedia` it would resolve against cwd, and in a monorepo run from\n // the workspace root that puts the cache somewhere the next build won't\n // look — so every build re-encodes, silently.\n manifest: resolve(root, media.manifest ?? MEDIA_MANIFEST_PATH),\n // An encode is minutes of silence otherwise, which in a build reads as a hang.\n onProgress: (message) => console.log(`[vitops] media: ${message}`),\n });\n if (result.written.length > 0)\n console.log(\n `[vitops] media: ${result.written.length} written, ${result.skipped} unchanged`,\n );\n }\n };\n\n // Every config `run()` reads is an input, so every one must trigger a re-run —\n // a legal document (or a colour layer) that only refreshes when the design\n // system changes is worse than one that never refreshes, because it looks\n // current. De-duplicated because `site.input` and `legal.input` are usually the\n // same file, and watching it twice would regenerate twice per edit.\n const watched = () => [...new Set([input, siteInput, legalInput].filter(Boolean))];\n\n return {\n name: '@getvitops/vite',\n // Resolve paths against Vite's project root once it's known.\n configResolved(config) {\n root = config.root;\n input = resolve(config.root, options.input ?? 'design-system.json');\n if (options.legal?.input) legalInput = resolve(config.root, options.legal.input);\n if (options.site) siteInput = resolve(config.root, options.site.input);\n },\n async buildStart() {\n for (const f of watched()) this.addWatchFile(f);\n await run();\n },\n async watchChange(id) {\n if (watched().includes(resolve(id))) await run();\n },\n configureServer(server) {\n for (const f of watched()) server.watcher.add(f);\n server.watcher.on('change', async (file) => {\n if (!watched().includes(resolve(file))) return;\n await run();\n server.ws.send({ type: 'full-reload' });\n });\n\n // Dev-only design-system write-back, for `<wc-theme-editor>`'s \"Save to\n // source\". Registered in configureServer only, so it exists in `vite dev`\n // and never in a build — on a static deploy the editor's probe 404s and the\n // button simply isn't rendered. The only writable path is `input`, already\n // resolved from config: a request supplies a patch, never a destination.\n //\n // The editor's patch is always design-system-relative (`colors.palette.…`),\n // because that is the only config it knows about. When `input` is a site\n // config the patch is therefore merged into — and validated against — the\n // design system SUBTREE, and only the surrounding file is written whole.\n // Merging it at the root instead would write a `colors` key beside\n // `organization` that nothing reads, and `validate` would reject the site\n // config wholesale, so every save would fail with errors about the wrong\n // document.\n server.middlewares.use(EDITOR_ENDPOINT, (req, res, next) => {\n const json = (status: number, body: unknown): void => {\n res.statusCode = status;\n res.setHeader('content-type', 'application/json');\n res.end(JSON.stringify(body));\n };\n\n if (req.method === 'GET') {\n try {\n const current = readJson(input);\n const at = designSystemPath(current, options.theme);\n return json(200, {\n writable: true,\n path: input,\n // The subtree, not the file: the editor's own model of a config is\n // a design system, and `at` says where in the file it lives.\n at,\n config: getAt(current, at),\n });\n } catch (err) {\n return json(500, { error: (err as Error).message });\n }\n }\n\n if (req.method !== 'POST') return next();\n\n const chunks: Buffer[] = [];\n req.on('data', (c: Buffer) => chunks.push(c));\n req.on('end', () => {\n try {\n const { patch } = JSON.parse(Buffer.concat(chunks).toString('utf8')) as {\n patch?: unknown;\n };\n if (patch == null || typeof patch !== 'object')\n return json(400, { errors: ['body must be { patch: object }'] });\n\n const current = readJson(input);\n const at = designSystemPath(current, options.theme);\n const merged = mergePatch(getAt(current, at), patch);\n // Validate the *merged* result, not the patch: a patch is a partial\n // by design, so it can't be validated on its own, and writing an\n // invalid config would break the very dev server doing the writing.\n const result = validate(merged);\n if (!result.ok)\n return json(400, {\n errors: result.errors.map((e) => `${e.path.join('.') || '(root)'}: ${e.message}`),\n });\n\n writeFileSync(input, `${formatConfig(setAt(current, at, merged))}\\n`);\n // The watcher above picks the write up and regenerates + reloads.\n return json(200, { ok: true, warnings: result.warnings });\n } catch (err) {\n return json(400, { errors: [(err as Error).message] });\n }\n });\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,MAAM,kBAAkB;AAmJxB,SAAwB,OAAO,UAA+B,CAAC,GAAW;CACxE,MAAM,SAAiB,QAAQ,UAAU;CACzC,MAAM,SAAS,QAAQ,OAAO;CAC9B,IAAI,QAAQ,QAAQ,QAAQ,SAAS,oBAAoB;CACzD,IAAI,aAAa,QAAQ,OAAO,QAAQ,QAAQ,QAAQ,MAAM,KAAK,IAAI;CACvE,IAAI,YAAY,QAAQ,OAAO,QAAQ,QAAQ,KAAK,KAAK,IAAI;CAC7D,IAAI,OAAO;CAEX,MAAM,YAAY,MAAc,KAAK,MAAM,aAAa,GAAG,MAAM,CAAC;CAElE,MAAM,MAAM,YAAY;EAItB,MAAM,MAAM,SAAS,KAAK;EAC1B,MAAM,cAAc,SAAS,GAAG;EAGhC,MAAM,UAAU;GACd,OAAO;GACP;GACA,GAAI,QAAQ,SAAS,OAAO,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;GACxD,SAAS,QAAQ,MAAM,WAAW;GAClC,GAAI,QAAQ,qBAAqB,OAC7B,EAAE,mBAAmB,QAAQ,kBAAkB,IAC/C,CAAC;GAEL,GAAI,YAAY,EAAE,MAAM,SAAS,SAAS,EAAW,IAAI,CAAC;EAC5D;EACA,MAAM,SAAS;GAAE,GAAG;GAAS;EAAO,CAAC;EACrC,IAAI,QAAQ,OAAO;GAGjB,MAAM,YAAY,cAAc,cAAc,cAAc,QAAQ;GACpE,IAAI,CAAC,WACH,MAAM,IAAI,MACR,mHAEF;GACF,MAAM,WAAW,QAAQ,MAAM,QAAQ,MAAM,OAAO,mBAAmB;GACvE,MAAM,OAAO,cAAc,SAAS,SAAS,GAAG,QAAQ,MAAM,WAAW,YAAY;GACrF,MAAM,QAAQ,cAAc,MAAM,EAAE,QAAQ,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,OAAO,KAAK,KAAK,EAAE,OAAQ,IAAc,QAAQ,CAAC;IACpD;IAGF,IAAI,IAAI,WAAW,QAAQ,OAAO,KAAK;IAEvC,MAAM,SAAmB,CAAC;IAC1B,IAAI,GAAG,SAAS,MAAc,OAAO,KAAK,CAAC,CAAC;IAC5C,IAAI,GAAG,aAAa;KAClB,IAAI;MACF,MAAM,EAAE,UAAU,KAAK,MAAM,OAAO,OAAO,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC;MAGnE,IAAI,SAAS,QAAQ,OAAO,UAAU,UACpC,OAAO,KAAK,KAAK,EAAE,QAAQ,CAAC,gCAAgC,EAAE,CAAC;MAEjE,MAAM,UAAU,SAAS,KAAK;MAC9B,MAAM,KAAKD,mBAAiB,SAAS,QAAQ,KAAK;MAClD,MAAM,SAAS,WAAWC,QAAM,SAAS,EAAE,GAAG,KAAK;MAInD,MAAM,SAAS,SAAS,MAAM;MAC9B,IAAI,CAAC,OAAO,IACV,OAAO,KAAK,KAAK,EACf,QAAQ,OAAO,OAAO,KAAK,MAAM,GAAG,EAAE,KAAK,KAAK,GAAG,KAAK,SAAS,IAAI,EAAE,SAAS,EAClF,CAAC;MAEH,cAAc,OAAO,GAAG,aAAaC,QAAM,SAAS,IAAI,MAAM,CAAC,EAAE,GAAG;MAEpE,OAAO,KAAK,KAAK;OAAE,IAAI;OAAM,UAAU,OAAO;MAAS,CAAC;KAC1D,SAAS,KAAK;MACZ,OAAO,KAAK,KAAK,EAAE,QAAQ,CAAE,IAAc,OAAO,EAAE,CAAC;KACvD;IACF,CAAC;GACH,CAAC;EACH;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/vite",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0-alpha.0",
|
|
4
4
|
"description": "Vite plugin that generates Vitops design-system outputs from a design-system.json during a Vite/Astro build.",
|
|
5
5
|
"homepage": "https://docs.vitops.ca",
|
|
6
6
|
"bugs": "https://github.com/getvitops/design-system/issues",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@getvitops/generator": "8.
|
|
30
|
-
"@getvitops/utils": "8.
|
|
29
|
+
"@getvitops/generator": "8.3.0-alpha.0",
|
|
30
|
+
"@getvitops/utils": "8.3.0-alpha.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
33
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"vite": ">=5"
|