@unterberg/nivel 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -1,28 +1,83 @@
1
- # nivel engine
1
+ # @unterberg/nivel
2
2
 
3
- `@unterberg/nivel` is the docs runtime for this repo's Vike-based documentation sites.
3
+ Opinionated docs engine for Vike + Vite + React.
4
4
 
5
- It currently owns:
5
+ `@unterberg/nivel` owns the docs runtime: Vike integration, MDX setup, docs-graph validation, route code generation, page shell rendering, and reusable docs UI primitives. The consumer stays thin and keeps its content, docs graph, visible Vike shell files, and theme files local.
6
6
 
7
- - docs graph validation and resolution
8
- - generated Vike routes from MDX content
9
- - docs layout primitives such as navbar, sidebar, table of contents, pagination, and meta head wiring
10
- - MDX setup with built-in docs components and code-block transforms
11
- - optional Algolia search wiring
12
- - engine-owned fonts and shared assets
7
+ ## What It Provides
13
8
 
14
- The supported stack is currently Vike + Vite + React. Expect breaking changes while the package is still alpha.
9
+ - typed docs config and docs graph helpers
10
+ - generated Vike docs pages from a single docs graph
11
+ - docs shell primitives such as navbar, sidebar, table of contents, pagination, search, and meta head wiring
12
+ - MDX support with built-in docs components and code-block tooling
13
+ - Tailwind v4 and daisyUI integration helpers
14
+ - a small CLI for consumer scaffolding and docs page generation
15
15
 
16
- ## Public Helpers
16
+ ## Install
17
17
 
18
- ```ts
19
- import { defineDocsConfig, defineDocsGraph } from '@unterberg/nivel/config'
18
+ ```bash
19
+ pnpm add @unterberg/nivel react react-dom vike vike-react
20
+ pnpm add -D vite typescript @types/react @types/react-dom
21
+ ```
22
+
23
+ `vike` and `vite` are peer dependencies. The package exposes a local `nivel` binary after install.
24
+
25
+ ## Quick Start
26
+
27
+ Scaffold a consumer:
28
+
29
+ ```bash
30
+ pnpm exec nivel init
20
31
  ```
21
32
 
22
- Both helpers are identity functions. They are also re-exported from `@unterberg/nivel`, but the dedicated config entry keeps `pages/+docs.ts` and `docs/docs.graph.ts` on a lean config-time import path.
33
+ Generate docs pages:
34
+
35
+ ```bash
36
+ pnpm exec nivel prepare
37
+ ```
38
+
39
+ Typical consumer scripts:
40
+
41
+ ```json
42
+ {
43
+ "scripts": {
44
+ "generate:docs": "nivel prepare",
45
+ "predev": "pnpm generate:docs",
46
+ "dev": "vike dev",
47
+ "prebuild": "pnpm generate:docs",
48
+ "build": "vike build",
49
+ "pretypecheck": "pnpm generate:docs",
50
+ "typecheck": "tsc --noEmit -p tsconfig.json"
51
+ }
52
+ }
53
+ ```
54
+
55
+ ## Consumer Shape
56
+
57
+ Keep these files local and visible in the consumer:
58
+
59
+ - `docs/docs.graph.ts`
60
+ - `pages/+docs.ts`
61
+ - `pages/+config.ts`
62
+ - `pages/+Head.tsx`
63
+ - `pages/+Layout.tsx`
64
+ - `pages/+onCreateGlobalContext.ts`
65
+ - `pages/+Wrapper.tsx`
66
+ - `global.d.ts`
67
+ - docs content, brand assets, and consumer CSS/theme files
68
+
69
+ Only `pages/(nivel-generated)` is engine-generated and should not be edited by hand.
70
+
71
+ `docs/docs.graph.ts` is the single source of truth for docs structure. Navbar and sidebar behavior come from that graph.
72
+
73
+ ## Minimal Setup
74
+
75
+ `docs/docs.graph.ts`
23
76
 
24
77
  ```ts
25
- const docsGraph = defineDocsGraph({
78
+ import { defineDocsGraph } from '@unterberg/nivel/config'
79
+
80
+ export const docsGraph = defineDocsGraph({
26
81
  items: [
27
82
  {
28
83
  kind: 'section',
@@ -31,56 +86,37 @@ const docsGraph = defineDocsGraph({
31
86
  items: [
32
87
  {
33
88
  kind: 'page',
34
- id: 'quickStart',
35
- title: 'Quick Start',
36
- slug: 'quick-start',
37
- source: 'content/quick-start/content.mdx',
89
+ id: 'gettingStarted',
90
+ title: 'Getting Started',
91
+ slug: 'getting-started',
92
+ source: 'content/getting-started/content.mdx',
93
+ description: 'Getting started with @unterberg/nivel.',
38
94
  },
39
95
  ],
40
96
  },
41
97
  ],
42
98
  })
43
-
44
- export default defineDocsConfig({
45
- siteTitle: 'My Docs',
46
- siteDescription: 'Documentation site powered by @unterberg/nivel.',
47
- basePath: '/docs',
48
- // Optional project-relative root for page.source resolution.
49
- // contentDir: 'docs',
50
- graph: docsGraph,
51
- })
52
99
  ```
53
100
 
54
- ## Recommended Consumer Files
55
-
56
- A consumer should keep these files explicit and local:
57
-
58
- - hand-authored: `pages/+docs.ts`, `docs/docs.graph.ts`, docs content, brand assets, and consumer CSS/Tailwind/theme files
59
- - scaffolded once but still editable: `pages/+config.ts`, `pages/+Head.tsx`, `pages/+Layout.tsx`, `pages/+onCreateGlobalContext.ts`, `pages/+Wrapper.tsx`, and `global.d.ts`
60
-
61
- Only `(nivel-generated)` stays engine-generated.
62
-
63
- ## Standard Vike Config
64
-
65
- Keep `pages/+config.ts` looking like normal Vike config and spread in the engine-owned config from `@unterberg/nivel/vike`:
101
+ `pages/+docs.ts`
66
102
 
67
103
  ```ts
68
- // pages/+docs.ts
69
104
  import { defineDocsConfig } from '@unterberg/nivel/config'
70
105
  import { docsGraph } from '../docs/docs.graph'
71
106
 
72
- export default defineDocsConfig({
107
+ const docsConfig = defineDocsConfig({
108
+ graph: docsGraph,
73
109
  siteTitle: 'My Docs',
74
110
  siteDescription: 'Documentation site powered by @unterberg/nivel.',
75
111
  basePath: '/docs',
76
- graph: docsGraph,
77
112
  })
113
+
114
+ export default docsConfig
78
115
  ```
79
116
 
80
- `basePath` controls the public docs route prefix. `contentDir` is an optional project-relative filesystem root for resolving `page.source` entries and defaults to `docs`.
117
+ `pages/+config.ts`
81
118
 
82
119
  ```ts
83
- // pages/+config.ts
84
120
  import nivel from '@unterberg/nivel/vike'
85
121
  import type { Config } from 'vike/types'
86
122
  import vikeReact from 'vike-react/config'
@@ -101,42 +137,101 @@ const config: Config = {
101
137
  description: docsConfig.siteDescription ?? `${docsConfig.siteTitle} documentation`,
102
138
  htmlAttributes: { 'data-theme': dataTheme },
103
139
  passToClient: ['docs'],
104
-
105
- // User-facing Vike levers stay visible here.
106
140
  prerender: true,
107
- // ssr: true,
108
- // prefetchStaticAssets: 'viewport',
109
141
  }
110
142
  ```
111
143
 
112
- The engine still owns the MDX, Vite, route-generation, and runtime wiring. The consumer keeps the normal Vike entry file and can adjust visible levers such as `prerender`, `ssr`, and prefetch-related settings directly in `+config.ts`.
144
+ `vite.config.ts`
113
145
 
114
- ## CLI
146
+ ```ts
147
+ import { nivelTailwindVite } from '@unterberg/nivel/tailwind'
148
+ import vike from 'vike/plugin'
115
149
 
116
- `nivel prepare` generates docs pages from `pages/+docs.ts`.
150
+ process.env.VIKE_CRAWL ??= JSON.stringify({ git: false })
117
151
 
118
- `nivel init` scaffolds the visible consumer shell files and updates the standard docs scripts in `package.json`.
152
+ export default {
153
+ plugins: [nivelTailwindVite(), vike()],
154
+ }
155
+ ```
119
156
 
120
- ```bash
121
- nivel init
122
- nivel prepare
157
+ `pages/+Head.tsx`
158
+
159
+ ```tsx
160
+ import { MetaHead } from '@unterberg/nivel/client'
161
+
162
+ export const Head = () => {
163
+ return <MetaHead />
164
+ }
123
165
  ```
124
166
 
125
- `nivel init` does not create or overwrite consumer CSS/Tailwind/theme files. Keep those hand-authored. Add the engine Tailwind helper manually in your stylesheet:
167
+ `pages/+Layout.tsx`
126
168
 
127
- ```css
128
- @import '@unterberg/nivel/tailwind-sources.css';
169
+ ```tsx
170
+ import { AppLayout } from '@unterberg/nivel/client'
171
+ import type { ReactNode } from 'react'
172
+
173
+ const Layout = ({ children }: { children: ReactNode }) => {
174
+ return <AppLayout>{children}</AppLayout>
175
+ }
176
+
177
+ export default Layout
129
178
  ```
130
179
 
131
- If you use Algolia, `apiKey` must be a search-only public key because requests are made from the browser.
180
+ `pages/+Wrapper.tsx`
181
+
182
+ ```tsx
183
+ import type { ReactNode } from 'react'
184
+ import '../styles/global.css'
185
+
186
+ const Wrapper = ({ children }: { children: ReactNode }) => {
187
+ return <>{children}</>
188
+ }
189
+
190
+ export default Wrapper
191
+ ```
132
192
 
133
- ## Commands
193
+ `styles/global.css`
194
+
195
+ ```css
196
+ @import '@unterberg/nivel/tailwind.css';
197
+ @import './theme.css';
198
+
199
+ @source '../pages';
200
+ @source '../docs';
201
+ ```
202
+
203
+ ## CLI
134
204
 
135
205
  ```bash
136
- pnpm install
137
- pnpm dev
138
- pnpm build
139
- pnpm typecheck
140
- pnpm format
141
- pnpm knip
206
+ nivel init [--root <path>] [--force]
207
+ nivel prepare [--root <path>]
208
+ nivel --help
142
209
  ```
210
+
211
+ - `nivel init` scaffolds the visible consumer files and patches the standard docs scripts in `package.json`
212
+ - `nivel init --force` overwrites scaffold-managed files if they already exist
213
+ - `nivel prepare` reads `pages/+docs.ts` and generates `pages/(nivel-generated)`
214
+
215
+ `nivel init` does not create or overwrite your brand assets or consumer-specific styling decisions beyond the initial scaffold. Theme and palette files stay consumer-owned.
216
+
217
+ ## Public Entry Points
218
+
219
+ | Entry | Purpose |
220
+ | --- | --- |
221
+ | `@unterberg/nivel` | main types, docs helpers, MDX components, shared utilities |
222
+ | `@unterberg/nivel/config` | lean config-time entry for `defineDocsConfig()` and `defineDocsGraph()` |
223
+ | `@unterberg/nivel/vike` | engine-owned Vike config for the consumer's `pages/+config.ts` |
224
+ | `@unterberg/nivel/client` | `AppLayout`, `MetaHead`, `UserSettingsSync`, `DocsPage`, and client stores |
225
+ | `@unterberg/nivel/mdx` | MDX provider entry |
226
+ | `@unterberg/nivel/mdx/code-blocks` | code-block components and transforms |
227
+ | `@unterberg/nivel/tailwind` | `nivelTailwindVite()` helper |
228
+ | `@unterberg/nivel/daisyui-theme` | daisyUI theme plugin surface |
229
+ | `@unterberg/nivel/runtime/node` | lower-level runtime helpers for loading config, resolving docs, scaffolding, and codegen |
230
+ | `@unterberg/nivel/runtime/client` | lower-level client runtime entry |
231
+
232
+ ## Notes
233
+
234
+ - `basePath` controls the public docs route prefix.
235
+ - `contentDir` is optional and defaults to `docs`.
236
+ - If you configure Algolia, `apiKey` must be a browser-safe search key.
237
+ - The repo validates this package through both the in-repo consumer at `packages/consumer-dev` and the standalone fixture at `tests/npm-consumer`.
@@ -3,7 +3,7 @@ import {
3
3
  isDocsSourcePath,
4
4
  loadDocsConfig,
5
5
  syncGeneratedDocsPages
6
- } from "./chunk-HU6EVSHN.js";
6
+ } from "./chunk-YQFALPGR.js";
7
7
  import {
8
8
  nivelPublicRoute
9
9
  } from "./chunk-NDJ5LYLK.js";
@@ -237,4 +237,4 @@ var nivelPagesPlugin = () => {
237
237
  export {
238
238
  nivelPagesPlugin
239
239
  };
240
- //# sourceMappingURL=chunk-FNOA7AFJ.js.map
240
+ //# sourceMappingURL=chunk-5YLY5ROG.js.map
@@ -235,6 +235,25 @@ import path3 from "path";
235
235
  var MANAGED_SCRIPT_NAMES = ["generate:docs", "predev", "prebuild", "pretypecheck"];
236
236
  var REQUIRED_DEPENDENCIES = ["@unterberg/nivel", "react", "react-dom", "vike", "vike-react"];
237
237
  var REQUIRED_DEV_DEPENDENCIES = ["vite", "typescript", "@types/react", "@types/react-dom"];
238
+ var getViteConfigTemplate = () => {
239
+ return [
240
+ "import { nivelTailwindVite } from '@unterberg/nivel/tailwind'",
241
+ "import vike from 'vike/plugin'",
242
+ "",
243
+ "process.env.VIKE_CRAWL ??= JSON.stringify({ git: false })",
244
+ "",
245
+ "const base = (() => {",
246
+ " const normalized = process.env.PAGES_BASE_PATH?.trim().replace(/^\\/+|\\/+$/g, '') ?? ''",
247
+ " return normalized ? `/${normalized}/` : '/'",
248
+ "})()",
249
+ "",
250
+ "export default {",
251
+ " base,",
252
+ " plugins: [nivelTailwindVite(), vike()],",
253
+ "}",
254
+ ""
255
+ ].join("\n");
256
+ };
238
257
  var getDocsConfigTemplate = () => {
239
258
  return [
240
259
  "import { defineDocsConfig } from '@unterberg/nivel/config'",
@@ -344,6 +363,7 @@ var getGlobalContextTemplate = () => {
344
363
  var getWrapperTemplate = () => {
345
364
  return [
346
365
  "import type { ReactNode } from 'react'",
366
+ "import '../styles/global.css'",
347
367
  "",
348
368
  "const Wrapper = ({ children }: { children: ReactNode }) => {",
349
369
  " return <>{children}</>",
@@ -353,6 +373,167 @@ var getWrapperTemplate = () => {
353
373
  ""
354
374
  ].join("\n");
355
375
  };
376
+ var getGlobalStyleTemplate = () => {
377
+ return [
378
+ "@import '@unterberg/nivel/tailwind.css';",
379
+ "@import './theme.css';",
380
+ "",
381
+ "@source '../pages';",
382
+ "@source '../docs';",
383
+ "",
384
+ "@layer base {",
385
+ " html,",
386
+ " body {",
387
+ " @apply bg-base-100 text-base-content font-sans antialiased md:subpixel-antialiased;",
388
+ " }",
389
+ "",
390
+ " .prose-container {",
391
+ " @apply prose prose-neutral max-w-none dark:prose-invert;",
392
+ " @apply prose-a:text-primary;",
393
+ " @apply prose-pre:bg-base-200!;",
394
+ " @apply prose-code:rounded!;",
395
+ " @apply prose-code:bg-primary/5!;",
396
+ " @apply prose-code:border-primary/15!;",
397
+ " @apply prose-code:dark:bg-primary/10!;",
398
+ " @apply prose-code:dark:border-primary/20!;",
399
+ " @apply prose-p:leading-[180%];",
400
+ " @apply prose-li:leading-[180%];",
401
+ " @apply prose-p:after:content-none;",
402
+ " @apply prose-p:before:content-none;",
403
+ " @apply prose-blockquote:not-italic;",
404
+ " @apply prose-blockquote:bg-base-200;",
405
+ " @apply prose-blockquote:py-2;",
406
+ " }",
407
+ "}",
408
+ ""
409
+ ].join("\n");
410
+ };
411
+ var getThemeTemplate = () => {
412
+ return [
413
+ "@custom-variant dark (&:where(",
414
+ " [data-theme='consumer-dark'],",
415
+ " [data-theme='consumer-dark'] *",
416
+ " ));",
417
+ "",
418
+ "@plugin '@unterberg/nivel/daisyui-theme' {",
419
+ " name: 'consumer-light';",
420
+ " default: true;",
421
+ " prefersdark: false;",
422
+ " color-scheme: 'light';",
423
+ " --color-base-100: #f6f6f4;",
424
+ " --color-base-200: #ffffff;",
425
+ " --color-base-300: #ecebe7;",
426
+ " --color-base-content: #171717;",
427
+ " --color-primary: #0f766e;",
428
+ " --color-primary-content: #f8fafc;",
429
+ " --color-secondary: #d97706;",
430
+ " --color-secondary-content: #111827;",
431
+ " --color-accent: #1d4ed8;",
432
+ " --color-accent-content: #f8fafc;",
433
+ " --color-neutral: #171717;",
434
+ " --color-neutral-content: #f8fafc;",
435
+ " --color-info: #2563eb;",
436
+ " --color-info-content: #eff6ff;",
437
+ " --color-success: #15803d;",
438
+ " --color-success-content: #f0fdf4;",
439
+ " --color-warning: #d97706;",
440
+ " --color-warning-content: #fff7ed;",
441
+ " --color-error: #dc2626;",
442
+ " --color-error-content: #fef2f2;",
443
+ " --radius-selector: 0.25rem;",
444
+ " --radius-field: 0.5rem;",
445
+ " --radius-box: 1rem;",
446
+ " --size-selector: 0.25rem;",
447
+ " --size-field: 0.25rem;",
448
+ " --border: 1px;",
449
+ " --depth: 0;",
450
+ " --noise: 0;",
451
+ "}",
452
+ "",
453
+ "@plugin '@unterberg/nivel/daisyui-theme' {",
454
+ " name: 'consumer-dark';",
455
+ " default: false;",
456
+ " prefersdark: false;",
457
+ " color-scheme: 'dark';",
458
+ " --color-base-100: #151515;",
459
+ " --color-base-200: #1e1e1e;",
460
+ " --color-base-300: #2a2a2a;",
461
+ " --color-base-content: #ededed;",
462
+ " --color-primary: #2dd4bf;",
463
+ " --color-primary-content: #042f2e;",
464
+ " --color-secondary: #f59e0b;",
465
+ " --color-secondary-content: #1c1917;",
466
+ " --color-accent: #60a5fa;",
467
+ " --color-accent-content: #172554;",
468
+ " --color-neutral: #ededed;",
469
+ " --color-neutral-content: #171717;",
470
+ " --color-info: #60a5fa;",
471
+ " --color-info-content: #172554;",
472
+ " --color-success: #4ade80;",
473
+ " --color-success-content: #052e16;",
474
+ " --color-warning: #fbbf24;",
475
+ " --color-warning-content: #451a03;",
476
+ " --color-error: #f87171;",
477
+ " --color-error-content: #450a0a;",
478
+ " --radius-selector: 0.25rem;",
479
+ " --radius-field: 0.5rem;",
480
+ " --radius-box: 1rem;",
481
+ " --size-selector: 0.25rem;",
482
+ " --size-field: 0.25rem;",
483
+ " --border: 1px;",
484
+ " --depth: 0;",
485
+ " --noise: 0;",
486
+ "}",
487
+ "",
488
+ "@theme inline {",
489
+ " --color-base-muted: color-mix(",
490
+ " in oklab,",
491
+ " var(--color-base-content) 65%,",
492
+ " transparent",
493
+ " );",
494
+ " --color-base-muted-medium: color-mix(",
495
+ " in oklab,",
496
+ " var(--color-base-content) 40%,",
497
+ " transparent",
498
+ " );",
499
+ " --color-base-muted-light: color-mix(",
500
+ " in oklab,",
501
+ " var(--color-base-content) 12%,",
502
+ " transparent",
503
+ " );",
504
+ " --color-base-muted-superlight: color-mix(",
505
+ " in oklab,",
506
+ " var(--color-base-content) 5%,",
507
+ " transparent",
508
+ " );",
509
+ " --color-primary-muted: color-mix(",
510
+ " in oklab,",
511
+ " var(--color-primary) 80%,",
512
+ " transparent",
513
+ " );",
514
+ " --color-primary-muted-medium: color-mix(",
515
+ " in oklab,",
516
+ " var(--color-primary) 50%,",
517
+ " transparent",
518
+ " );",
519
+ " --color-primary-muted-light: color-mix(",
520
+ " in oklab,",
521
+ " var(--color-primary) 20%,",
522
+ " transparent",
523
+ " );",
524
+ " --color-primary-muted-superlight: color-mix(",
525
+ " in oklab,",
526
+ " var(--color-primary) 5%,",
527
+ " transparent",
528
+ " );",
529
+ " --font-sans: 'Inter', 'Helvetica Neue', sans-serif;",
530
+ " --font-mono:",
531
+ " 'Monaco', 'SF Mono', SF Mono, SF Mono Regular, Consolas, 'Liberation Mono',",
532
+ " Menlo, Courier, monospace;",
533
+ "}",
534
+ ""
535
+ ].join("\n");
536
+ };
356
537
  var getGlobalTypesTemplate = () => {
357
538
  return [
358
539
  "declare module '*.mdx' {",
@@ -376,6 +557,7 @@ var getGlobalTypesTemplate = () => {
376
557
  };
377
558
  var getManagedFileEntries = () => {
378
559
  return [
560
+ ["vite.config.ts", getViteConfigTemplate()],
379
561
  ["pages/+docs.ts", getDocsConfigTemplate()],
380
562
  ["docs/docs.graph.ts", getDocsGraphTemplate()],
381
563
  ["pages/+config.ts", getConfigTemplate()],
@@ -383,9 +565,44 @@ var getManagedFileEntries = () => {
383
565
  ["pages/+Layout.tsx", getLayoutTemplate()],
384
566
  ["pages/+onCreateGlobalContext.ts", getGlobalContextTemplate()],
385
567
  ["pages/+Wrapper.tsx", getWrapperTemplate()],
568
+ ["styles/global.css", getGlobalStyleTemplate()],
569
+ ["styles/theme.css", getThemeTemplate()],
386
570
  ["global.d.ts", getGlobalTypesTemplate()]
387
571
  ];
388
572
  };
573
+ var readFileIfExists = (filePath) => {
574
+ if (!fs2.existsSync(filePath)) {
575
+ return null;
576
+ }
577
+ return fs2.readFileSync(filePath, "utf8");
578
+ };
579
+ var getTailwindBootstrapWarnings = (rootDir) => {
580
+ const warnings = [];
581
+ const viteConfigPath = path3.join(rootDir, "vite.config.ts");
582
+ const wrapperPath = path3.join(rootDir, "pages", "+Wrapper.tsx");
583
+ const globalCssPath = path3.join(rootDir, "styles", "global.css");
584
+ const themeCssPath = path3.join(rootDir, "styles", "theme.css");
585
+ const viteConfigSource = readFileIfExists(viteConfigPath);
586
+ if (!viteConfigSource || !viteConfigSource.includes("@unterberg/nivel/tailwind") || !viteConfigSource.includes("nivelTailwindVite()")) {
587
+ warnings.push(
588
+ "vite.config.ts should use @unterberg/nivel/tailwind and call nivelTailwindVite() for the engine-owned Tailwind integration."
589
+ );
590
+ }
591
+ const wrapperSource = readFileIfExists(wrapperPath);
592
+ if (!wrapperSource || !wrapperSource.includes("../styles/global.css")) {
593
+ warnings.push("pages/+Wrapper.tsx should import ../styles/global.css.");
594
+ }
595
+ const globalCssSource = readFileIfExists(globalCssPath);
596
+ if (!globalCssSource || !globalCssSource.includes("@unterberg/nivel/tailwind.css") || !globalCssSource.includes("@import './theme.css';") || !globalCssSource.includes("@source '../pages';") || !globalCssSource.includes("@source '../docs';")) {
597
+ warnings.push(
598
+ "styles/global.css should import @unterberg/nivel/tailwind.css, import ./theme.css, and declare @source '../pages' plus @source '../docs'."
599
+ );
600
+ }
601
+ if (!fs2.existsSync(themeCssPath)) {
602
+ warnings.push("styles/theme.css is missing; define local daisyUI themes there.");
603
+ }
604
+ return warnings;
605
+ };
389
606
  var getGenerateDocsRunner = (packageJson) => {
390
607
  const packageManager = packageJson.packageManager?.trim() ?? "";
391
608
  if (packageManager.startsWith("pnpm@")) {
@@ -471,11 +688,9 @@ var getInitSummary = (result) => {
471
688
  if (result.updatedScripts.length > 0) {
472
689
  lines.push(`Updated package.json scripts: ${result.updatedScripts.join(", ")}`);
473
690
  }
691
+ lines.push("Scaffolded vite.config.ts and local Tailwind starter files remain visible and editable in the consumer.");
474
692
  if (result.missingDependencies.length > 0) {
475
693
  lines.push(`Missing dependencies: ${result.missingDependencies.join(", ")}`);
476
- lines.push(
477
- "Consumer CSS stays hand-authored. Add your stylesheet import manually, for example in pages/+Wrapper.tsx."
478
- );
479
694
  } else if (!result.allDependenciesPresent) {
480
695
  lines.push("Dependency validation completed with warnings.");
481
696
  } else {
@@ -509,7 +724,8 @@ export {
509
724
  isDocsSourcePath,
510
725
  syncGeneratedDocsPages,
511
726
  loadDocsConfig,
727
+ getTailwindBootstrapWarnings,
512
728
  getInitSummary,
513
729
  initConsumer
514
730
  };
515
- //# sourceMappingURL=chunk-HU6EVSHN.js.map
731
+ //# sourceMappingURL=chunk-YQFALPGR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime/node/codegen.ts","../src/runtime/node/loadDocsConfig.ts","../src/runtime/node/scaffold.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { extractDocHeadings } from '../../docs/docHeadings.js'\nimport { getResolvedPageById, resolveDocsConfig } from '../../docs/resolveDocsConfig.js'\nimport type { DocPageData, DocPageLinkData, DocsConfig, DocsGlobalContextData } from '../../docs/types.js'\n\nconst GENERATED_DIRNAME = '(nivel-generated)'\n\nconst writeFileIfChanged = (filePath: string, source: string) => {\n const current = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : null\n if (current === source) {\n return\n }\n\n fs.mkdirSync(path.dirname(filePath), { recursive: true })\n fs.writeFileSync(filePath, source)\n}\n\nconst toPosix = (value: string) => value.split(path.sep).join(path.posix.sep)\n\nconst getRelativeImportPath = (fromDirectory: string, toFile: string) => {\n const relativePath = toPosix(path.relative(fromDirectory, toFile))\n if (relativePath.startsWith('.')) {\n return relativePath\n }\n return `./${relativePath}`\n}\n\nconst serializeData = (data: DocPageData | DocsGlobalContextData) => JSON.stringify(data, null, 2)\n\nconst collectFiles = (directoryPath: string): string[] => {\n if (!fs.existsSync(directoryPath)) {\n return []\n }\n\n const entries = fs.readdirSync(directoryPath, { withFileTypes: true })\n\n return entries.flatMap((entry) => {\n const entryPath = path.join(directoryPath, entry.name)\n return entry.isDirectory() ? collectFiles(entryPath) : [entryPath]\n })\n}\n\nconst removeEmptyDirectories = (directoryPath: string, rootPath: string) => {\n if (!fs.existsSync(directoryPath)) {\n return\n }\n\n for (const entry of fs.readdirSync(directoryPath, { withFileTypes: true })) {\n if (!entry.isDirectory()) {\n continue\n }\n\n removeEmptyDirectories(path.join(directoryPath, entry.name), rootPath)\n }\n\n if (directoryPath === rootPath) {\n return\n }\n\n if (fs.readdirSync(directoryPath).length === 0) {\n fs.rmdirSync(directoryPath)\n }\n}\n\nconst getGeneratedPageSource = (contentImportPath: string) => {\n return [\n \"import { DocsPage } from '@unterberg/nivel/client'\",\n `import Content from ${JSON.stringify(contentImportPath)}`,\n '',\n 'const Page = () => {',\n ' return <DocsPage Content={Content} />',\n '}',\n '',\n 'export default Page',\n '',\n ].join('\\n')\n}\n\nconst getGeneratedDataSource = (data: DocPageData) => {\n return [\n \"import type { DocPageData } from '@unterberg/nivel'\",\n '',\n `const data: DocPageData = ${serializeData(data)}`,\n '',\n 'const pageData = () => {',\n ' return data',\n '}',\n '',\n 'export default pageData',\n '',\n ].join('\\n')\n}\n\nconst getGeneratedGlobalContextSource = (data: DocsGlobalContextData) => {\n return [\n \"import type { DocsGlobalContextData } from '@unterberg/nivel'\",\n '',\n `const docsGlobalContextData: DocsGlobalContextData = ${serializeData(data)}`,\n '',\n 'export { docsGlobalContextData }',\n '',\n ].join('\\n')\n}\n\nconst getRouteString = (href: string) => {\n if (href === '/') {\n return href\n }\n\n return href.replace(/\\/+$/g, '')\n}\n\nconst getGeneratedRouteSource = (href: string) => {\n return [`export default ${JSON.stringify(getRouteString(href))}`, ''].join('\\n')\n}\n\nconst getGeneratedTextExport = (value: string) => {\n return [`export default ${JSON.stringify(value)}`, ''].join('\\n')\n}\n\nconst toDocPageLinkData = (\n page:\n | {\n id: string\n title: string\n href: string\n documentTitle: string\n }\n | undefined,\n): DocPageLinkData | null => {\n if (!page) {\n return null\n }\n\n return {\n id: page.id,\n title: page.title,\n href: page.href,\n documentTitle: page.documentTitle,\n }\n}\n\nexport const getGeneratedPagesRoot = (rootDir: string) => path.join(rootDir, 'pages', GENERATED_DIRNAME)\n\nexport type DocsSourcePaths = {\n contentRootPath: string\n docsConfigPath: string\n docsGraphPath: string\n generatedRootPath: string\n}\n\nconst getDocsConfigPath = (rootDir: string) => path.join(rootDir, 'pages', '+docs.ts')\n\nconst getDocsGraphPath = (rootDir: string) => path.join(rootDir, 'docs', 'docs.graph.ts')\n\nexport const getDocsSourcePaths = (options: { rootDir: string; docsConfig: DocsConfig }): DocsSourcePaths => {\n const resolved = resolveDocsConfig(options.docsConfig)\n\n return {\n contentRootPath: path.join(options.rootDir, resolved.contentDir),\n docsConfigPath: getDocsConfigPath(options.rootDir),\n docsGraphPath: getDocsGraphPath(options.rootDir),\n generatedRootPath: getGeneratedPagesRoot(options.rootDir),\n }\n}\n\nexport const isDocsSourcePath = (filePath: string, docsSourcePaths: DocsSourcePaths) => {\n const normalized = toPosix(filePath)\n const generatedRootPath = toPosix(docsSourcePaths.generatedRootPath)\n const docsConfigPath = toPosix(docsSourcePaths.docsConfigPath)\n const docsGraphPath = toPosix(docsSourcePaths.docsGraphPath)\n const contentRootPath = toPosix(docsSourcePaths.contentRootPath)\n\n if (normalized.startsWith(generatedRootPath)) {\n return false\n }\n\n return (\n normalized === docsConfigPath ||\n normalized === docsGraphPath ||\n normalized === contentRootPath ||\n normalized.startsWith(`${contentRootPath}/`)\n )\n}\n\nexport const syncGeneratedDocsPages = (options: { rootDir: string; docsConfig: DocsConfig }) => {\n const { rootDir, docsConfig } = options\n const resolved = resolveDocsConfig(docsConfig)\n const generatedPagesRoot = getGeneratedPagesRoot(rootDir)\n const docsContentRoot = path.join(rootDir, resolved.contentDir)\n const expectedFiles = new Set<string>()\n const globalContextFilePath = path.join(generatedPagesRoot, '_docsGlobalContext.ts')\n\n fs.mkdirSync(generatedPagesRoot, { recursive: true })\n\n const globalContextData: DocsGlobalContextData = {\n siteTitle: resolved.siteTitle,\n basePath: resolved.basePath,\n theme: resolved.theme,\n footer: resolved.footer,\n brand: resolved.brand,\n head: resolved.head,\n partners: resolved.partners,\n social: resolved.social,\n algolia: resolved.algolia,\n pages: resolved.pages,\n navbarItems: resolved.navbarItems,\n sidebarSections: resolved.sections,\n }\n\n writeFileIfChanged(globalContextFilePath, getGeneratedGlobalContextSource(globalContextData))\n expectedFiles.add(globalContextFilePath)\n\n for (const [pageIndex, page] of resolved.pages.entries()) {\n const contentFilePath = path.join(docsContentRoot, page.source)\n\n if (!fs.existsSync(contentFilePath)) {\n throw new Error(`Docs page \"${page.id}\" points to missing source file: ${contentFilePath}`)\n }\n\n const pageSource = fs.readFileSync(contentFilePath, 'utf8')\n const data: DocPageData = {\n page: getResolvedPageById(resolved, page.id),\n headings: extractDocHeadings(pageSource),\n previousPage: toDocPageLinkData(resolved.pages[pageIndex - 1]),\n nextPage: toDocPageLinkData(resolved.pages[pageIndex + 1]),\n }\n\n const routeTargets = [\n { routeHref: page.href, routePath: page.slug },\n ...page.aliases.map((routePath, index) => ({\n routeHref: page.aliasHrefs[index] as string,\n routePath,\n })),\n ]\n\n for (const { routeHref, routePath } of routeTargets) {\n const pageDir = path.join(generatedPagesRoot, ...routePath.split('/'))\n const contentImportPath = getRelativeImportPath(pageDir, contentFilePath)\n\n const pageFilePath = path.join(pageDir, '+Page.tsx')\n const dataFilePath = path.join(pageDir, '+data.ts')\n const routeFilePath = path.join(pageDir, '+route.ts')\n const titleFilePath = path.join(pageDir, '+title.ts')\n\n writeFileIfChanged(pageFilePath, getGeneratedPageSource(contentImportPath))\n writeFileIfChanged(dataFilePath, getGeneratedDataSource(data))\n writeFileIfChanged(routeFilePath, getGeneratedRouteSource(routeHref))\n writeFileIfChanged(titleFilePath, getGeneratedTextExport(page.documentTitle))\n\n expectedFiles.add(pageFilePath)\n expectedFiles.add(dataFilePath)\n expectedFiles.add(routeFilePath)\n expectedFiles.add(titleFilePath)\n\n if (page.description) {\n const descriptionFilePath = path.join(pageDir, '+description.ts')\n writeFileIfChanged(descriptionFilePath, getGeneratedTextExport(page.description))\n expectedFiles.add(descriptionFilePath)\n }\n }\n }\n\n for (const filePath of collectFiles(generatedPagesRoot)) {\n if (expectedFiles.has(filePath)) {\n continue\n }\n\n fs.rmSync(filePath, { force: true })\n }\n\n removeEmptyDirectories(generatedPagesRoot, generatedPagesRoot)\n}\n","import path from 'node:path'\nimport type { DocsConfig } from '../../docs/types.js'\n\nconst getDocsConfigModulePath = (rootDir: string) => {\n return path.join(rootDir, 'pages', '+docs.ts')\n}\n\nconst getDocsConfigFromLoadedModule = (loaded: unknown, modulePath: string) => {\n const docsConfig = (loaded as { default?: DocsConfig }).default\n\n if (!docsConfig) {\n throw new Error(`Expected default export from ${modulePath}`)\n }\n\n return docsConfig\n}\n\nexport const loadDocsConfig = async (options: {\n rootDir: string\n loadModule: (modulePath: string) => Promise<unknown>\n}) => {\n const modulePath = getDocsConfigModulePath(options.rootDir)\n const loaded = await options.loadModule(modulePath)\n return getDocsConfigFromLoadedModule(loaded, modulePath)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst MANAGED_SCRIPT_NAMES = ['generate:docs', 'predev', 'prebuild', 'pretypecheck'] as const\n\nconst REQUIRED_DEPENDENCIES = ['@unterberg/nivel', 'react', 'react-dom', 'vike', 'vike-react'] as const\nconst REQUIRED_DEV_DEPENDENCIES = ['vite', 'typescript', '@types/react', '@types/react-dom'] as const\n\ntype InitConsumerOptions = { force: boolean; rootDir: string }\n\ntype InitConsumerResult = {\n allDependenciesPresent: boolean\n createdFiles: string[]\n missingDependencies: string[]\n overwrittenFiles: string[]\n skippedFiles: string[]\n updatedScripts: string[]\n}\n\ntype PackageJsonShape = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n packageManager?: string\n scripts?: Record<string, string>\n}\n\nconst getViteConfigTemplate = () => {\n return [\n \"import { nivelTailwindVite } from '@unterberg/nivel/tailwind'\",\n \"import vike from 'vike/plugin'\",\n '',\n 'process.env.VIKE_CRAWL ??= JSON.stringify({ git: false })',\n '',\n 'const base = (() => {',\n \" const normalized = process.env.PAGES_BASE_PATH?.trim().replace(/^\\\\/+|\\\\/+$/g, '') ?? ''\",\n \" return normalized ? `/${normalized}/` : '/'\",\n '})()',\n '',\n 'export default {',\n ' base,',\n ' plugins: [nivelTailwindVite(), vike()],',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getDocsConfigTemplate = () => {\n return [\n \"import { defineDocsConfig } from '@unterberg/nivel/config'\",\n \"import { docsGraph } from '../docs/docs.graph'\",\n '',\n 'const docsConfig = defineDocsConfig({',\n ' graph: docsGraph,',\n \" siteTitle: 'My Docs',\",\n \" siteDescription: 'Documentation site powered by @unterberg/nivel.',\",\n \" basePath: '/docs',\",\n '})',\n '',\n 'export default docsConfig',\n '',\n ].join('\\n')\n}\n\nconst getDocsGraphTemplate = () => {\n return [\n \"import { defineDocsGraph } from '@unterberg/nivel/config'\",\n '',\n 'export const docsGraph = defineDocsGraph({',\n ' items: [',\n ' {',\n \" kind: 'section',\",\n \" id: 'docs',\",\n \" title: 'Docs',\",\n ' items: [',\n ' {',\n \" kind: 'page',\",\n \" id: 'gettingStarted',\",\n \" title: 'Getting Started',\",\n \" slug: 'getting-started',\",\n \" source: 'content/getting-started/content.mdx',\",\n \" description: 'Getting started with @unterberg/nivel.',\",\n ' },',\n ' ],',\n ' },',\n ' ],',\n '})',\n '',\n ].join('\\n')\n}\n\nconst getConfigTemplate = () => {\n return [\n \"import nivel from '@unterberg/nivel/vike'\",\n \"import type { Config } from 'vike/types'\",\n \"import vikeReact from 'vike-react/config'\",\n \"import docsConfig from './+docs'\",\n '',\n 'export { config }',\n '',\n \"const themePreference = docsConfig.theme?.defaultPreference ?? 'light'\",\n 'const dataTheme =',\n \" themePreference === 'dark'\",\n \" ? (docsConfig.theme?.dark ?? 'consumer-dark')\",\n \" : (docsConfig.theme?.light ?? 'consumer-light')\",\n '',\n 'const config: Config = {',\n ' ...nivel,',\n ' extends: [vikeReact],',\n ' title: docsConfig.siteTitle,',\n ' description: docsConfig.siteDescription ?? `${docsConfig.siteTitle} documentation`,',\n \" htmlAttributes: { 'data-theme': dataTheme },\",\n \" passToClient: ['docs'],\",\n '',\n ' // User-facing Vike levers stay visible in +config.ts.',\n ' prerender: true,',\n ' // ssr: true,',\n \" // prefetchStaticAssets: 'viewport',\",\n '}',\n '',\n ].join('\\n')\n}\n\nconst getHeadTemplate = () => {\n return [\n \"import { MetaHead } from '@unterberg/nivel/client'\",\n '',\n 'export const Head = () => {',\n ' return <MetaHead />',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getLayoutTemplate = () => {\n return [\n \"import { AppLayout } from '@unterberg/nivel/client'\",\n \"import type { ReactNode } from 'react'\",\n '',\n 'const Layout = ({ children }: { children: ReactNode }) => {',\n ' return <AppLayout>{children}</AppLayout>',\n '}',\n '',\n 'export default Layout',\n '',\n ].join('\\n')\n}\n\nconst getGlobalContextTemplate = () => {\n return [\n \"import { docsGlobalContextData } from './(nivel-generated)/_docsGlobalContext'\",\n '',\n 'export const onCreateGlobalContext = (globalContext: { docs?: typeof docsGlobalContextData }) => {',\n ' globalContext.docs = docsGlobalContextData',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getWrapperTemplate = () => {\n return [\n \"import type { ReactNode } from 'react'\",\n \"import '../styles/global.css'\",\n '',\n 'const Wrapper = ({ children }: { children: ReactNode }) => {',\n ' return <>{children}</>',\n '}',\n '',\n 'export default Wrapper',\n '',\n ].join('\\n')\n}\n\nconst getGlobalStyleTemplate = () => {\n return [\n \"@import '@unterberg/nivel/tailwind.css';\",\n \"@import './theme.css';\",\n '',\n \"@source '../pages';\",\n \"@source '../docs';\",\n '',\n '@layer base {',\n ' html,',\n ' body {',\n ' @apply bg-base-100 text-base-content font-sans antialiased md:subpixel-antialiased;',\n ' }',\n '',\n ' .prose-container {',\n ' @apply prose prose-neutral max-w-none dark:prose-invert;',\n ' @apply prose-a:text-primary;',\n ' @apply prose-pre:bg-base-200!;',\n ' @apply prose-code:rounded!;',\n ' @apply prose-code:bg-primary/5!;',\n ' @apply prose-code:border-primary/15!;',\n ' @apply prose-code:dark:bg-primary/10!;',\n ' @apply prose-code:dark:border-primary/20!;',\n ' @apply prose-p:leading-[180%];',\n ' @apply prose-li:leading-[180%];',\n ' @apply prose-p:after:content-none;',\n ' @apply prose-p:before:content-none;',\n ' @apply prose-blockquote:not-italic;',\n ' @apply prose-blockquote:bg-base-200;',\n ' @apply prose-blockquote:py-2;',\n ' }',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getThemeTemplate = () => {\n return [\n '@custom-variant dark (&:where(',\n \" [data-theme='consumer-dark'],\",\n \" [data-theme='consumer-dark'] *\",\n ' ));',\n '',\n \"@plugin '@unterberg/nivel/daisyui-theme' {\",\n \" name: 'consumer-light';\",\n ' default: true;',\n ' prefersdark: false;',\n \" color-scheme: 'light';\",\n ' --color-base-100: #f6f6f4;',\n ' --color-base-200: #ffffff;',\n ' --color-base-300: #ecebe7;',\n ' --color-base-content: #171717;',\n ' --color-primary: #0f766e;',\n ' --color-primary-content: #f8fafc;',\n ' --color-secondary: #d97706;',\n ' --color-secondary-content: #111827;',\n ' --color-accent: #1d4ed8;',\n ' --color-accent-content: #f8fafc;',\n ' --color-neutral: #171717;',\n ' --color-neutral-content: #f8fafc;',\n ' --color-info: #2563eb;',\n ' --color-info-content: #eff6ff;',\n ' --color-success: #15803d;',\n ' --color-success-content: #f0fdf4;',\n ' --color-warning: #d97706;',\n ' --color-warning-content: #fff7ed;',\n ' --color-error: #dc2626;',\n ' --color-error-content: #fef2f2;',\n ' --radius-selector: 0.25rem;',\n ' --radius-field: 0.5rem;',\n ' --radius-box: 1rem;',\n ' --size-selector: 0.25rem;',\n ' --size-field: 0.25rem;',\n ' --border: 1px;',\n ' --depth: 0;',\n ' --noise: 0;',\n '}',\n '',\n \"@plugin '@unterberg/nivel/daisyui-theme' {\",\n \" name: 'consumer-dark';\",\n ' default: false;',\n ' prefersdark: false;',\n \" color-scheme: 'dark';\",\n ' --color-base-100: #151515;',\n ' --color-base-200: #1e1e1e;',\n ' --color-base-300: #2a2a2a;',\n ' --color-base-content: #ededed;',\n ' --color-primary: #2dd4bf;',\n ' --color-primary-content: #042f2e;',\n ' --color-secondary: #f59e0b;',\n ' --color-secondary-content: #1c1917;',\n ' --color-accent: #60a5fa;',\n ' --color-accent-content: #172554;',\n ' --color-neutral: #ededed;',\n ' --color-neutral-content: #171717;',\n ' --color-info: #60a5fa;',\n ' --color-info-content: #172554;',\n ' --color-success: #4ade80;',\n ' --color-success-content: #052e16;',\n ' --color-warning: #fbbf24;',\n ' --color-warning-content: #451a03;',\n ' --color-error: #f87171;',\n ' --color-error-content: #450a0a;',\n ' --radius-selector: 0.25rem;',\n ' --radius-field: 0.5rem;',\n ' --radius-box: 1rem;',\n ' --size-selector: 0.25rem;',\n ' --size-field: 0.25rem;',\n ' --border: 1px;',\n ' --depth: 0;',\n ' --noise: 0;',\n '}',\n '',\n '@theme inline {',\n ' --color-base-muted: color-mix(',\n ' in oklab,',\n ' var(--color-base-content) 65%,',\n ' transparent',\n ' );',\n ' --color-base-muted-medium: color-mix(',\n ' in oklab,',\n ' var(--color-base-content) 40%,',\n ' transparent',\n ' );',\n ' --color-base-muted-light: color-mix(',\n ' in oklab,',\n ' var(--color-base-content) 12%,',\n ' transparent',\n ' );',\n ' --color-base-muted-superlight: color-mix(',\n ' in oklab,',\n ' var(--color-base-content) 5%,',\n ' transparent',\n ' );',\n ' --color-primary-muted: color-mix(',\n ' in oklab,',\n ' var(--color-primary) 80%,',\n ' transparent',\n ' );',\n ' --color-primary-muted-medium: color-mix(',\n ' in oklab,',\n ' var(--color-primary) 50%,',\n ' transparent',\n ' );',\n ' --color-primary-muted-light: color-mix(',\n ' in oklab,',\n ' var(--color-primary) 20%,',\n ' transparent',\n ' );',\n ' --color-primary-muted-superlight: color-mix(',\n ' in oklab,',\n ' var(--color-primary) 5%,',\n ' transparent',\n ' );',\n \" --font-sans: 'Inter', 'Helvetica Neue', sans-serif;\",\n ' --font-mono:',\n \" 'Monaco', 'SF Mono', SF Mono, SF Mono Regular, Consolas, 'Liberation Mono',\",\n ' Menlo, Courier, monospace;',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getGlobalTypesTemplate = () => {\n return [\n \"declare module '*.mdx' {\",\n \" import type { ComponentType } from 'react'\",\n '',\n ' const MdxComponent: ComponentType',\n ' export default MdxComponent',\n '}',\n '',\n \"declare module '*.css'\",\n '',\n 'declare global {',\n ' namespace Vike {',\n ' interface GlobalContext {',\n \" docs: import('@unterberg/nivel').DocsGlobalContextData\",\n ' }',\n ' }',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getManagedFileEntries = () => {\n return [\n ['vite.config.ts', getViteConfigTemplate()],\n ['pages/+docs.ts', getDocsConfigTemplate()],\n ['docs/docs.graph.ts', getDocsGraphTemplate()],\n ['pages/+config.ts', getConfigTemplate()],\n ['pages/+Head.tsx', getHeadTemplate()],\n ['pages/+Layout.tsx', getLayoutTemplate()],\n ['pages/+onCreateGlobalContext.ts', getGlobalContextTemplate()],\n ['pages/+Wrapper.tsx', getWrapperTemplate()],\n ['styles/global.css', getGlobalStyleTemplate()],\n ['styles/theme.css', getThemeTemplate()],\n ['global.d.ts', getGlobalTypesTemplate()],\n ] as const\n}\n\nconst readFileIfExists = (filePath: string) => {\n if (!fs.existsSync(filePath)) {\n return null\n }\n\n return fs.readFileSync(filePath, 'utf8')\n}\n\nexport const getTailwindBootstrapWarnings = (rootDir: string) => {\n const warnings: string[] = []\n const viteConfigPath = path.join(rootDir, 'vite.config.ts')\n const wrapperPath = path.join(rootDir, 'pages', '+Wrapper.tsx')\n const globalCssPath = path.join(rootDir, 'styles', 'global.css')\n const themeCssPath = path.join(rootDir, 'styles', 'theme.css')\n\n const viteConfigSource = readFileIfExists(viteConfigPath)\n if (\n !viteConfigSource ||\n !viteConfigSource.includes('@unterberg/nivel/tailwind') ||\n !viteConfigSource.includes('nivelTailwindVite()')\n ) {\n warnings.push(\n 'vite.config.ts should use @unterberg/nivel/tailwind and call nivelTailwindVite() for the engine-owned Tailwind integration.',\n )\n }\n\n const wrapperSource = readFileIfExists(wrapperPath)\n if (!wrapperSource || !wrapperSource.includes('../styles/global.css')) {\n warnings.push('pages/+Wrapper.tsx should import ../styles/global.css.')\n }\n\n const globalCssSource = readFileIfExists(globalCssPath)\n if (\n !globalCssSource ||\n !globalCssSource.includes('@unterberg/nivel/tailwind.css') ||\n !globalCssSource.includes(\"@import './theme.css';\") ||\n !globalCssSource.includes(\"@source '../pages';\") ||\n !globalCssSource.includes(\"@source '../docs';\")\n ) {\n warnings.push(\n \"styles/global.css should import @unterberg/nivel/tailwind.css, import ./theme.css, and declare @source '../pages' plus @source '../docs'.\",\n )\n }\n\n if (!fs.existsSync(themeCssPath)) {\n warnings.push('styles/theme.css is missing; define local daisyUI themes there.')\n }\n\n return warnings\n}\n\nconst getGenerateDocsRunner = (packageJson: PackageJsonShape) => {\n const packageManager = packageJson.packageManager?.trim() ?? ''\n\n if (packageManager.startsWith('pnpm@')) {\n return 'pnpm generate:docs'\n }\n\n if (packageManager.startsWith('npm@')) {\n return 'npm run generate:docs'\n }\n\n return 'npm run generate:docs'\n}\n\nconst getManagedScripts = (packageJson: PackageJsonShape) => {\n const generateDocsRunner = getGenerateDocsRunner(packageJson)\n\n return {\n 'generate:docs': 'nivel prepare',\n predev: generateDocsRunner,\n prebuild: generateDocsRunner,\n pretypecheck: generateDocsRunner,\n } satisfies Record<(typeof MANAGED_SCRIPT_NAMES)[number], string>\n}\n\nconst writeFile = (filePath: string, source: string) => {\n fs.mkdirSync(path.dirname(filePath), { recursive: true })\n fs.writeFileSync(filePath, source)\n}\n\nconst writeManagedFile = (\n rootDir: string,\n relativeFilePath: string,\n source: string,\n force: boolean,\n result: InitConsumerResult,\n) => {\n const filePath = path.join(rootDir, relativeFilePath)\n const exists = fs.existsSync(filePath)\n\n if (exists && !force) {\n result.skippedFiles.push(relativeFilePath)\n return\n }\n\n writeFile(filePath, source)\n\n if (exists) {\n result.overwrittenFiles.push(relativeFilePath)\n return\n }\n\n result.createdFiles.push(relativeFilePath)\n}\n\nconst readPackageJson = (rootDir: string) => {\n const packageJsonPath = path.join(rootDir, 'package.json')\n\n if (!fs.existsSync(packageJsonPath)) {\n throw new Error(`Expected package.json in ${rootDir}`)\n }\n\n return {\n packageJson: JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as PackageJsonShape,\n packageJsonPath,\n }\n}\n\nconst patchPackageScripts = (packageJson: PackageJsonShape, packageJsonPath: string, result: InitConsumerResult) => {\n const scripts = { ...(packageJson.scripts ?? {}) }\n const managedScripts = getManagedScripts(packageJson)\n\n for (const scriptName of MANAGED_SCRIPT_NAMES) {\n if (scripts[scriptName] === managedScripts[scriptName]) {\n continue\n }\n\n scripts[scriptName] = managedScripts[scriptName]\n result.updatedScripts.push(scriptName)\n }\n\n const nextPackageJson = {\n ...packageJson,\n scripts,\n }\n\n fs.writeFileSync(packageJsonPath, `${JSON.stringify(nextPackageJson, null, 2)}\\n`)\n}\n\nconst getMissingDependencies = (packageJson: PackageJsonShape) => {\n const installed = new Set<string>([\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.devDependencies ?? {}),\n ])\n\n return [...REQUIRED_DEPENDENCIES, ...REQUIRED_DEV_DEPENDENCIES].filter((packageName) => !installed.has(packageName))\n}\n\nexport const getInitSummary = (result: InitConsumerResult) => {\n const lines = ['Initialized nivel consumer scaffolding.']\n\n if (result.createdFiles.length > 0) {\n lines.push(`Created files: ${result.createdFiles.join(', ')}`)\n }\n\n if (result.overwrittenFiles.length > 0) {\n lines.push(`Overwritten files: ${result.overwrittenFiles.join(', ')}`)\n }\n\n if (result.skippedFiles.length > 0) {\n lines.push(`Skipped existing files: ${result.skippedFiles.join(', ')}`)\n }\n\n if (result.updatedScripts.length > 0) {\n lines.push(`Updated package.json scripts: ${result.updatedScripts.join(', ')}`)\n }\n\n lines.push('Scaffolded vite.config.ts and local Tailwind starter files remain visible and editable in the consumer.')\n\n if (result.missingDependencies.length > 0) {\n lines.push(`Missing dependencies: ${result.missingDependencies.join(', ')}`)\n } else if (!result.allDependenciesPresent) {\n lines.push('Dependency validation completed with warnings.')\n } else {\n lines.push('All required dependencies are already present.')\n }\n\n return `${lines.join('\\n')}\\n`\n}\n\nexport const initConsumer = (options: InitConsumerOptions): InitConsumerResult => {\n const result: InitConsumerResult = {\n allDependenciesPresent: true,\n createdFiles: [],\n missingDependencies: [],\n overwrittenFiles: [],\n skippedFiles: [],\n updatedScripts: [],\n }\n\n const { packageJson, packageJsonPath } = readPackageJson(options.rootDir)\n\n for (const [relativeFilePath, source] of getManagedFileEntries()) {\n writeManagedFile(options.rootDir, relativeFilePath, source, options.force, result)\n }\n\n patchPackageScripts(packageJson, packageJsonPath, result)\n\n result.missingDependencies = getMissingDependencies(packageJson)\n result.allDependenciesPresent = result.missingDependencies.length === 0\n\n return result\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAKjB,IAAM,oBAAoB;AAE1B,IAAM,qBAAqB,CAAC,UAAkB,WAAmB;AAC/D,QAAM,UAAU,GAAG,WAAW,QAAQ,IAAI,GAAG,aAAa,UAAU,MAAM,IAAI;AAC9E,MAAI,YAAY,QAAQ;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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA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kB,MAAM,KAAK,sBAAsB,GAAG;AAChE,qBAAiB,QAAQ,SAAS,kBAAkB,QAAQ,QAAQ,OAAO,MAAM;AAAA,EACnF;AAEA,sBAAoB,aAAa,iBAAiB,MAAM;AAExD,SAAO,sBAAsB,uBAAuB,WAAW;AAC/D,SAAO,yBAAyB,OAAO,oBAAoB,WAAW;AAEtE,SAAO;AACT;","names":["path","fs","path"]}
package/dist/cli.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  getInitSummary,
3
+ getTailwindBootstrapWarnings,
3
4
  initConsumer,
4
5
  loadDocsConfig,
5
6
  syncGeneratedDocsPages
6
- } from "./chunk-HU6EVSHN.js";
7
+ } from "./chunk-YQFALPGR.js";
7
8
  import "./chunk-SOVTSE5J.js";
8
9
  import "./chunk-NDJ5LYLK.js";
9
10
 
@@ -81,6 +82,11 @@ var runPrepare = async (rootDir) => {
81
82
  rootDir,
82
83
  docsConfig
83
84
  });
85
+ const warnings = getTailwindBootstrapWarnings(rootDir);
86
+ for (const warning of warnings) {
87
+ process.stderr.write(`Tailwind integration warning: ${warning}
88
+ `);
89
+ }
84
90
  };
85
91
  var runInit = (rootDir, force) => {
86
92
  const result = initConsumer({
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/runtime/node/loadDocsConfigWithTsx.ts"],"sourcesContent":["import path from 'node:path'\nimport { syncGeneratedDocsPages } from './runtime/node/codegen.js'\nimport { loadDocsConfigWithTsx } from './runtime/node/loadDocsConfigWithTsx.js'\nimport { getInitSummary, initConsumer } from './runtime/node/scaffold.js'\n\nconst usage = [\n 'Usage:',\n ' nivel prepare [--root <path>]',\n ' nivel init [--root <path>] [--force]',\n '',\n 'Commands:',\n ' prepare Generate docs pages from pages/+docs.ts',\n ' init Scaffold visible consumer files and standard docs scripts',\n].join('\\n')\n\nconst parseCliArgs = (args: string[]) => {\n let command: string | null = null\n let force = false\n let rootDir = process.cwd()\n\n for (let index = 0; index < args.length; index += 1) {\n const value = args[index]\n\n if (value === '--help' || value === '-h') {\n return {\n command: 'help',\n force,\n rootDir,\n }\n }\n\n if (value === '--root') {\n const nextValue = args[index + 1]\n\n if (!nextValue) {\n throw new Error('Missing value for --root.')\n }\n\n rootDir = path.resolve(nextValue)\n index += 1\n continue\n }\n\n if (value === '--force') {\n force = true\n continue\n }\n\n if (value.startsWith('--')) {\n throw new Error(`Unknown option ${value}`)\n }\n\n if (command) {\n throw new Error(`Unexpected argument ${value}`)\n }\n\n command = value\n }\n\n return {\n command,\n force,\n rootDir,\n }\n}\n\nconst runPrepare = async (rootDir: string) => {\n const docsConfig = await loadDocsConfigWithTsx(rootDir)\n\n syncGeneratedDocsPages({\n rootDir,\n docsConfig,\n })\n}\n\nconst runInit = (rootDir: string, force: boolean) => {\n const result = initConsumer({\n force,\n rootDir,\n })\n\n process.stdout.write(getInitSummary(result))\n}\n\nexport const runCli = async (args: string[]) => {\n const parsed = parseCliArgs(args)\n\n if (!parsed.command || parsed.command === 'help') {\n process.stdout.write(`${usage}\\n`)\n return\n }\n\n if (parsed.command !== 'prepare') {\n if (parsed.command !== 'init') {\n throw new Error(`Unknown command ${parsed.command}`)\n }\n\n runInit(parsed.rootDir, parsed.force)\n return\n }\n\n await runPrepare(parsed.rootDir)\n}\n\nvoid runCli(process.argv.slice(2)).catch((error: unknown) => {\n const message = error instanceof Error ? (error.stack ?? error.message) : String(error)\n process.stderr.write(`${message}\\n`)\n process.exitCode = 1\n})\n","import { pathToFileURL } from 'node:url'\nimport { register } from 'tsx/esm/api'\nimport { loadDocsConfig } from './loadDocsConfig.js'\n\nexport const loadDocsConfigWithTsx = async (rootDir: string) => {\n const unregister = register()\n\n try {\n return await loadDocsConfig({\n rootDir,\n loadModule: async (modulePath) => import(pathToFileURL(modulePath).href),\n })\n } finally {\n await unregister()\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,OAAO,UAAU;;;ACAjB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AAGlB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AAA,IACrB;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEA,IAAM,UAAU,CAAC,SAAiB,UAAmB;AACnD,QAAM,SAAS,aAAa;AAAA,IAC1B;AAAA,IACA;AAAA,EACF,CAAC;AAED,UAAQ,OAAO,MAAM,eAAe,MAAM,CAAC;AAC7C;AAEO,IAAM,SAAS,OAAO,SAAmB;AAC9C,QAAM,SAAS,aAAa,IAAI;AAEhC,MAAI,CAAC,OAAO,WAAW,OAAO,YAAY,QAAQ;AAChD,YAAQ,OAAO,MAAM,GAAG,KAAK;AAAA,CAAI;AACjC;AAAA,EACF;AAEA,MAAI,OAAO,YAAY,WAAW;AAChC,QAAI,OAAO,YAAY,QAAQ;AAC7B,YAAM,IAAI,MAAM,mBAAmB,OAAO,OAAO,EAAE;AAAA,IACrD;AAEA,YAAQ,OAAO,SAAS,OAAO,KAAK;AACpC;AAAA,EACF;AAEA,QAAM,WAAW,OAAO,OAAO;AACjC;AAEA,KAAK,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,UAAmB;AAC3D,QAAM,UAAU,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK;AACtF,UAAQ,OAAO,MAAM,GAAG,OAAO;AAAA,CAAI;AACnC,UAAQ,WAAW;AACrB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/cli.ts","../src/runtime/node/loadDocsConfigWithTsx.ts"],"sourcesContent":["import path from 'node:path'\nimport { syncGeneratedDocsPages } from './runtime/node/codegen.js'\nimport { loadDocsConfigWithTsx } from './runtime/node/loadDocsConfigWithTsx.js'\nimport { getInitSummary, getTailwindBootstrapWarnings, initConsumer } from './runtime/node/scaffold.js'\n\nconst usage = [\n 'Usage:',\n ' nivel prepare [--root <path>]',\n ' nivel init [--root <path>] [--force]',\n '',\n 'Commands:',\n ' prepare Generate docs pages from pages/+docs.ts',\n ' init Scaffold visible consumer files and standard docs scripts',\n].join('\\n')\n\nconst parseCliArgs = (args: string[]) => {\n let command: string | null = null\n let force = false\n let rootDir = process.cwd()\n\n for (let index = 0; index < args.length; index += 1) {\n const value = args[index]\n\n if (value === '--help' || value === '-h') {\n return {\n command: 'help',\n force,\n rootDir,\n }\n }\n\n if (value === '--root') {\n const nextValue = args[index + 1]\n\n if (!nextValue) {\n throw new Error('Missing value for --root.')\n }\n\n rootDir = path.resolve(nextValue)\n index += 1\n continue\n }\n\n if (value === '--force') {\n force = true\n continue\n }\n\n if (value.startsWith('--')) {\n throw new Error(`Unknown option ${value}`)\n }\n\n if (command) {\n throw new Error(`Unexpected argument ${value}`)\n }\n\n command = value\n }\n\n return {\n command,\n force,\n rootDir,\n }\n}\n\nconst runPrepare = async (rootDir: string) => {\n const docsConfig = await loadDocsConfigWithTsx(rootDir)\n\n syncGeneratedDocsPages({\n rootDir,\n docsConfig,\n })\n\n const warnings = getTailwindBootstrapWarnings(rootDir)\n\n for (const warning of warnings) {\n process.stderr.write(`Tailwind integration warning: ${warning}\\n`)\n }\n}\n\nconst runInit = (rootDir: string, force: boolean) => {\n const result = initConsumer({\n force,\n rootDir,\n })\n\n process.stdout.write(getInitSummary(result))\n}\n\nexport const runCli = async (args: string[]) => {\n const parsed = parseCliArgs(args)\n\n if (!parsed.command || parsed.command === 'help') {\n process.stdout.write(`${usage}\\n`)\n return\n }\n\n if (parsed.command !== 'prepare') {\n if (parsed.command !== 'init') {\n throw new Error(`Unknown command ${parsed.command}`)\n }\n\n runInit(parsed.rootDir, parsed.force)\n return\n }\n\n await runPrepare(parsed.rootDir)\n}\n\nvoid runCli(process.argv.slice(2)).catch((error: unknown) => {\n const message = error instanceof Error ? (error.stack ?? error.message) : String(error)\n process.stderr.write(`${message}\\n`)\n process.exitCode = 1\n})\n","import { pathToFileURL } from 'node:url'\nimport { register } from 'tsx/esm/api'\nimport { loadDocsConfig } from './loadDocsConfig.js'\n\nexport const loadDocsConfigWithTsx = async (rootDir: string) => {\n const unregister = register()\n\n try {\n return await loadDocsConfig({\n rootDir,\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 import daisyuiTheme from "daisyui/theme";
3
+ var daisyuiThemePlugin = daisyuiTheme;
4
+ var daisyuiTheme_default = daisyuiThemePlugin;
5
+ export {
6
+ daisyuiTheme_default as default
7
+ };
8
+ //# sourceMappingURL=daisyui-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tailwind/daisyuiTheme.ts"],"sourcesContent":["// daisyUI doesn't publish a declaration for this helper subpath.\n// @ts-expect-error Missing upstream module declaration for daisyui/theme.\nimport daisyuiTheme from 'daisyui/theme'\n\nconst daisyuiThemePlugin = daisyuiTheme as unknown\n\nexport default daisyuiThemePlugin\n"],"mappings":";AAEA,OAAO,kBAAkB;AAEzB,IAAM,qBAAqB;AAE3B,IAAO,uBAAQ;","names":[]}
package/dist/index.js CHANGED
@@ -10,15 +10,15 @@ import {
10
10
  RepoLink,
11
11
  Table
12
12
  } from "./chunk-SJDXMQ43.js";
13
- import {
14
- defineDocsConfig,
15
- defineDocsGraph
16
- } from "./chunk-JSZZPQEP.js";
17
13
  import {
18
14
  UniversalMdxProvider,
19
15
  renderInlineMarkdown,
20
16
  useUniversalMdxRuntime
21
17
  } from "./chunk-L6ZVB6XH.js";
18
+ import {
19
+ defineDocsConfig,
20
+ defineDocsGraph
21
+ } from "./chunk-JSZZPQEP.js";
22
22
  import {
23
23
  baseAssets,
24
24
  nivelAssetUrl,
package/dist/mdx.js CHANGED
@@ -10,8 +10,8 @@ import {
10
10
  RepoLink,
11
11
  Table
12
12
  } from "./chunk-SJDXMQ43.js";
13
- import "./chunk-JSZZPQEP.js";
14
13
  import "./chunk-L6ZVB6XH.js";
14
+ import "./chunk-JSZZPQEP.js";
15
15
  import "./chunk-NDJ5LYLK.js";
16
16
 
17
17
  // src/mdx/index.ts
@@ -32,7 +32,8 @@ type InitConsumerResult = {
32
32
  skippedFiles: string[];
33
33
  updatedScripts: string[];
34
34
  };
35
+ declare const getTailwindBootstrapWarnings: (rootDir: string) => string[];
35
36
  declare const getInitSummary: (result: InitConsumerResult) => string;
36
37
  declare const initConsumer: (options: InitConsumerOptions) => InitConsumerResult;
37
38
 
38
- export { getGeneratedPagesRoot, getInitSummary, getResolvedPageById, initConsumer, loadDocsConfig, nivelPagesPlugin, resolveDocsConfig, resolveDocsHref, syncGeneratedDocsPages };
39
+ export { getGeneratedPagesRoot, getInitSummary, getResolvedPageById, getTailwindBootstrapWarnings, initConsumer, loadDocsConfig, nivelPagesPlugin, resolveDocsConfig, resolveDocsHref, syncGeneratedDocsPages };
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  nivelPagesPlugin
3
- } from "../chunk-FNOA7AFJ.js";
3
+ } from "../chunk-5YLY5ROG.js";
4
4
  import {
5
5
  getGeneratedPagesRoot,
6
6
  getInitSummary,
7
+ getTailwindBootstrapWarnings,
7
8
  initConsumer,
8
9
  loadDocsConfig,
9
10
  syncGeneratedDocsPages
10
- } from "../chunk-HU6EVSHN.js";
11
+ } from "../chunk-YQFALPGR.js";
11
12
  import "../chunk-SOVTSE5J.js";
12
13
  import {
13
14
  getResolvedPageById,
@@ -18,6 +19,7 @@ export {
18
19
  getGeneratedPagesRoot,
19
20
  getInitSummary,
20
21
  getResolvedPageById,
22
+ getTailwindBootstrapWarnings,
21
23
  initConsumer,
22
24
  loadDocsConfig,
23
25
  nivelPagesPlugin,
@@ -0,0 +1,5 @@
1
+ import * as vite from 'vite';
2
+
3
+ declare const nivelTailwindVite: () => vite.Plugin<any>[];
4
+
5
+ export { nivelTailwindVite };
@@ -0,0 +1,9 @@
1
+ // src/tailwind/index.ts
2
+ import tailwindcss from "@tailwindcss/vite";
3
+ var nivelTailwindVite = () => {
4
+ return tailwindcss();
5
+ };
6
+ export {
7
+ nivelTailwindVite
8
+ };
9
+ //# sourceMappingURL=tailwind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tailwind/index.ts"],"sourcesContent":["import tailwindcss from '@tailwindcss/vite'\n\nexport const nivelTailwindVite = () => {\n return tailwindcss()\n}\n"],"mappings":";AAAA,OAAO,iBAAiB;AAEjB,IAAM,oBAAoB,MAAM;AACrC,SAAO,YAAY;AACrB;","names":[]}
package/dist/vike.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  nivelPagesPlugin
3
- } from "./chunk-FNOA7AFJ.js";
4
- import "./chunk-HU6EVSHN.js";
5
- import {
6
- getCodeBlockMdxPlugins
7
- } from "./chunk-Q7JU4J6A.js";
3
+ } from "./chunk-5YLY5ROG.js";
4
+ import "./chunk-YQFALPGR.js";
8
5
  import {
9
6
  createHeadingSlugger,
10
7
  normalizeHeadingTitle
11
8
  } from "./chunk-SOVTSE5J.js";
12
9
  import "./chunk-NDJ5LYLK.js";
10
+ import {
11
+ getCodeBlockMdxPlugins
12
+ } from "./chunk-Q7JU4J6A.js";
13
13
 
14
14
  // src/vike/index.ts
15
15
  import mdx from "@mdx-js/rollup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unterberg/nivel",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "repository": {
@@ -22,6 +22,7 @@
22
22
  "dist",
23
23
  "assets",
24
24
  "bin",
25
+ "tailwind.css",
25
26
  "tailwind-sources.css"
26
27
  ],
27
28
  "main": "./dist/index.js",
@@ -59,20 +60,32 @@
59
60
  "types": "./dist/runtime/node.d.ts",
60
61
  "import": "./dist/runtime/node.js"
61
62
  },
63
+ "./tailwind": {
64
+ "types": "./dist/tailwind.d.ts",
65
+ "import": "./dist/tailwind.js"
66
+ },
67
+ "./daisyui-theme": {
68
+ "types": "./dist/daisyui-theme.d.ts",
69
+ "import": "./dist/daisyui-theme.js"
70
+ },
71
+ "./tailwind.css": "./tailwind.css",
62
72
  "./tailwind-sources.css": "./tailwind-sources.css"
63
73
  },
64
74
  "scripts": {
65
75
  "build": "tsup",
66
76
  "dev": "tsup --watch",
67
- "test": "pnpm build && node --import tsx --test tests/*.test.mjs tests/*.test.ts",
77
+ "test": "node --import tsx --test tests/*.test.mjs tests/*.test.ts",
68
78
  "typecheck": "tsc --noEmit -p tsconfig.json"
69
79
  },
70
80
  "dependencies": {
81
+ "@tailwindcss/typography": "^0.5.19",
82
+ "@tailwindcss/vite": "^4.1.12",
71
83
  "@brillout/shiki-transformers": "^4.0.2",
72
84
  "@tanstack/react-query": "^5.90.2",
73
85
  "@classmatejs/react": "^0.2.1",
74
86
  "@mdx-js/rollup": "^3.1.1",
75
87
  "@shikijs/transformers": "^4.0.2",
88
+ "daisyui": "^5.5.19",
76
89
  "detype": "^2.0.6",
77
90
  "estree-util-value-to-estree": "^3.5.0",
78
91
  "lucide-react": "0.543.0",
@@ -84,6 +97,7 @@
84
97
  "remark-directive": "^4.0.0",
85
98
  "remark-gfm": "^4.0.1",
86
99
  "shiki": "^4.0.2",
100
+ "tailwindcss": "^4.2.2",
87
101
  "tsx": "^4.21.0",
88
102
  "unist-util-visit": "^5.1.0",
89
103
  "vike-react": "^0.6.21",
package/tailwind.css ADDED
@@ -0,0 +1,9 @@
1
+ @import 'tailwindcss';
2
+ @import './tailwind-sources.css';
3
+
4
+ @plugin '@tailwindcss/typography';
5
+
6
+ @plugin 'daisyui' {
7
+ exclude: rootcolor;
8
+ themes: false;
9
+ }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime/node/codegen.ts","../src/runtime/node/loadDocsConfig.ts","../src/runtime/node/scaffold.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { extractDocHeadings } from '../../docs/docHeadings.js'\nimport { getResolvedPageById, resolveDocsConfig } from '../../docs/resolveDocsConfig.js'\nimport type { DocPageData, DocPageLinkData, DocsConfig, DocsGlobalContextData } from '../../docs/types.js'\n\nconst GENERATED_DIRNAME = '(nivel-generated)'\n\nconst writeFileIfChanged = (filePath: string, source: string) => {\n const current = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : null\n if (current === source) {\n return\n }\n\n fs.mkdirSync(path.dirname(filePath), { recursive: true })\n fs.writeFileSync(filePath, source)\n}\n\nconst toPosix = (value: string) => value.split(path.sep).join(path.posix.sep)\n\nconst getRelativeImportPath = (fromDirectory: string, toFile: string) => {\n const relativePath = toPosix(path.relative(fromDirectory, toFile))\n if (relativePath.startsWith('.')) {\n return relativePath\n }\n return `./${relativePath}`\n}\n\nconst serializeData = (data: DocPageData | DocsGlobalContextData) => JSON.stringify(data, null, 2)\n\nconst collectFiles = (directoryPath: string): string[] => {\n if (!fs.existsSync(directoryPath)) {\n return []\n }\n\n const entries = fs.readdirSync(directoryPath, { withFileTypes: true })\n\n return entries.flatMap((entry) => {\n const entryPath = path.join(directoryPath, entry.name)\n return entry.isDirectory() ? collectFiles(entryPath) : [entryPath]\n })\n}\n\nconst removeEmptyDirectories = (directoryPath: string, rootPath: string) => {\n if (!fs.existsSync(directoryPath)) {\n return\n }\n\n for (const entry of fs.readdirSync(directoryPath, { withFileTypes: true })) {\n if (!entry.isDirectory()) {\n continue\n }\n\n removeEmptyDirectories(path.join(directoryPath, entry.name), rootPath)\n }\n\n if (directoryPath === rootPath) {\n return\n }\n\n if (fs.readdirSync(directoryPath).length === 0) {\n fs.rmdirSync(directoryPath)\n }\n}\n\nconst getGeneratedPageSource = (contentImportPath: string) => {\n return [\n \"import { DocsPage } from '@unterberg/nivel/client'\",\n `import Content from ${JSON.stringify(contentImportPath)}`,\n '',\n 'const Page = () => {',\n ' return <DocsPage Content={Content} />',\n '}',\n '',\n 'export default Page',\n '',\n ].join('\\n')\n}\n\nconst getGeneratedDataSource = (data: DocPageData) => {\n return [\n \"import type { DocPageData } from '@unterberg/nivel'\",\n '',\n `const data: DocPageData = ${serializeData(data)}`,\n '',\n 'const pageData = () => {',\n ' return data',\n '}',\n '',\n 'export default pageData',\n '',\n ].join('\\n')\n}\n\nconst getGeneratedGlobalContextSource = (data: DocsGlobalContextData) => {\n return [\n \"import type { DocsGlobalContextData } from '@unterberg/nivel'\",\n '',\n `const docsGlobalContextData: DocsGlobalContextData = ${serializeData(data)}`,\n '',\n 'export { docsGlobalContextData }',\n '',\n ].join('\\n')\n}\n\nconst getRouteString = (href: string) => {\n if (href === '/') {\n return href\n }\n\n return href.replace(/\\/+$/g, '')\n}\n\nconst getGeneratedRouteSource = (href: string) => {\n return [`export default ${JSON.stringify(getRouteString(href))}`, ''].join('\\n')\n}\n\nconst getGeneratedTextExport = (value: string) => {\n return [`export default ${JSON.stringify(value)}`, ''].join('\\n')\n}\n\nconst toDocPageLinkData = (\n page:\n | {\n id: string\n title: string\n href: string\n documentTitle: string\n }\n | undefined,\n): DocPageLinkData | null => {\n if (!page) {\n return null\n }\n\n return {\n id: page.id,\n title: page.title,\n href: page.href,\n documentTitle: page.documentTitle,\n }\n}\n\nexport const getGeneratedPagesRoot = (rootDir: string) => path.join(rootDir, 'pages', GENERATED_DIRNAME)\n\nexport type DocsSourcePaths = {\n contentRootPath: string\n docsConfigPath: string\n docsGraphPath: string\n generatedRootPath: string\n}\n\nconst getDocsConfigPath = (rootDir: string) => path.join(rootDir, 'pages', '+docs.ts')\n\nconst getDocsGraphPath = (rootDir: string) => path.join(rootDir, 'docs', 'docs.graph.ts')\n\nexport const getDocsSourcePaths = (options: { rootDir: string; docsConfig: DocsConfig }): DocsSourcePaths => {\n const resolved = resolveDocsConfig(options.docsConfig)\n\n return {\n contentRootPath: path.join(options.rootDir, resolved.contentDir),\n docsConfigPath: getDocsConfigPath(options.rootDir),\n docsGraphPath: getDocsGraphPath(options.rootDir),\n generatedRootPath: getGeneratedPagesRoot(options.rootDir),\n }\n}\n\nexport const isDocsSourcePath = (filePath: string, docsSourcePaths: DocsSourcePaths) => {\n const normalized = toPosix(filePath)\n const generatedRootPath = toPosix(docsSourcePaths.generatedRootPath)\n const docsConfigPath = toPosix(docsSourcePaths.docsConfigPath)\n const docsGraphPath = toPosix(docsSourcePaths.docsGraphPath)\n const contentRootPath = toPosix(docsSourcePaths.contentRootPath)\n\n if (normalized.startsWith(generatedRootPath)) {\n return false\n }\n\n return (\n normalized === docsConfigPath ||\n normalized === docsGraphPath ||\n normalized === contentRootPath ||\n normalized.startsWith(`${contentRootPath}/`)\n )\n}\n\nexport const syncGeneratedDocsPages = (options: { rootDir: string; docsConfig: DocsConfig }) => {\n const { rootDir, docsConfig } = options\n const resolved = resolveDocsConfig(docsConfig)\n const generatedPagesRoot = getGeneratedPagesRoot(rootDir)\n const docsContentRoot = path.join(rootDir, resolved.contentDir)\n const expectedFiles = new Set<string>()\n const globalContextFilePath = path.join(generatedPagesRoot, '_docsGlobalContext.ts')\n\n fs.mkdirSync(generatedPagesRoot, { recursive: true })\n\n const globalContextData: DocsGlobalContextData = {\n siteTitle: resolved.siteTitle,\n basePath: resolved.basePath,\n theme: resolved.theme,\n footer: resolved.footer,\n brand: resolved.brand,\n head: resolved.head,\n partners: resolved.partners,\n social: resolved.social,\n algolia: resolved.algolia,\n pages: resolved.pages,\n navbarItems: resolved.navbarItems,\n sidebarSections: resolved.sections,\n }\n\n writeFileIfChanged(globalContextFilePath, getGeneratedGlobalContextSource(globalContextData))\n expectedFiles.add(globalContextFilePath)\n\n for (const [pageIndex, page] of resolved.pages.entries()) {\n const contentFilePath = path.join(docsContentRoot, page.source)\n\n if (!fs.existsSync(contentFilePath)) {\n throw new Error(`Docs page \"${page.id}\" points to missing source file: ${contentFilePath}`)\n }\n\n const pageSource = fs.readFileSync(contentFilePath, 'utf8')\n const data: DocPageData = {\n page: getResolvedPageById(resolved, page.id),\n headings: extractDocHeadings(pageSource),\n previousPage: toDocPageLinkData(resolved.pages[pageIndex - 1]),\n nextPage: toDocPageLinkData(resolved.pages[pageIndex + 1]),\n }\n\n const routeTargets = [\n { routeHref: page.href, routePath: page.slug },\n ...page.aliases.map((routePath, index) => ({\n routeHref: page.aliasHrefs[index] as string,\n routePath,\n })),\n ]\n\n for (const { routeHref, routePath } of routeTargets) {\n const pageDir = path.join(generatedPagesRoot, ...routePath.split('/'))\n const contentImportPath = getRelativeImportPath(pageDir, contentFilePath)\n\n const pageFilePath = path.join(pageDir, '+Page.tsx')\n const dataFilePath = path.join(pageDir, '+data.ts')\n const routeFilePath = path.join(pageDir, '+route.ts')\n const titleFilePath = path.join(pageDir, '+title.ts')\n\n writeFileIfChanged(pageFilePath, getGeneratedPageSource(contentImportPath))\n writeFileIfChanged(dataFilePath, getGeneratedDataSource(data))\n writeFileIfChanged(routeFilePath, getGeneratedRouteSource(routeHref))\n writeFileIfChanged(titleFilePath, getGeneratedTextExport(page.documentTitle))\n\n expectedFiles.add(pageFilePath)\n expectedFiles.add(dataFilePath)\n expectedFiles.add(routeFilePath)\n expectedFiles.add(titleFilePath)\n\n if (page.description) {\n const descriptionFilePath = path.join(pageDir, '+description.ts')\n writeFileIfChanged(descriptionFilePath, getGeneratedTextExport(page.description))\n expectedFiles.add(descriptionFilePath)\n }\n }\n }\n\n for (const filePath of collectFiles(generatedPagesRoot)) {\n if (expectedFiles.has(filePath)) {\n continue\n }\n\n fs.rmSync(filePath, { force: true })\n }\n\n removeEmptyDirectories(generatedPagesRoot, generatedPagesRoot)\n}\n","import path from 'node:path'\nimport type { DocsConfig } from '../../docs/types.js'\n\nconst getDocsConfigModulePath = (rootDir: string) => {\n return path.join(rootDir, 'pages', '+docs.ts')\n}\n\nconst getDocsConfigFromLoadedModule = (loaded: unknown, modulePath: string) => {\n const docsConfig = (loaded as { default?: DocsConfig }).default\n\n if (!docsConfig) {\n throw new Error(`Expected default export from ${modulePath}`)\n }\n\n return docsConfig\n}\n\nexport const loadDocsConfig = async (options: {\n rootDir: string\n loadModule: (modulePath: string) => Promise<unknown>\n}) => {\n const modulePath = getDocsConfigModulePath(options.rootDir)\n const loaded = await options.loadModule(modulePath)\n return getDocsConfigFromLoadedModule(loaded, modulePath)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst MANAGED_SCRIPT_NAMES = ['generate:docs', 'predev', 'prebuild', 'pretypecheck'] as const\n\nconst REQUIRED_DEPENDENCIES = ['@unterberg/nivel', 'react', 'react-dom', 'vike', 'vike-react'] as const\nconst REQUIRED_DEV_DEPENDENCIES = ['vite', 'typescript', '@types/react', '@types/react-dom'] as const\n\ntype InitConsumerOptions = { force: boolean; rootDir: string }\n\ntype InitConsumerResult = {\n allDependenciesPresent: boolean\n createdFiles: string[]\n missingDependencies: string[]\n overwrittenFiles: string[]\n skippedFiles: string[]\n updatedScripts: string[]\n}\n\ntype PackageJsonShape = {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n packageManager?: string\n scripts?: Record<string, string>\n}\n\nconst getDocsConfigTemplate = () => {\n return [\n \"import { defineDocsConfig } from '@unterberg/nivel/config'\",\n \"import { docsGraph } from '../docs/docs.graph'\",\n '',\n 'const docsConfig = defineDocsConfig({',\n ' graph: docsGraph,',\n \" siteTitle: 'My Docs',\",\n \" siteDescription: 'Documentation site powered by @unterberg/nivel.',\",\n \" basePath: '/docs',\",\n '})',\n '',\n 'export default docsConfig',\n '',\n ].join('\\n')\n}\n\nconst getDocsGraphTemplate = () => {\n return [\n \"import { defineDocsGraph } from '@unterberg/nivel/config'\",\n '',\n 'export const docsGraph = defineDocsGraph({',\n ' items: [',\n ' {',\n \" kind: 'section',\",\n \" id: 'docs',\",\n \" title: 'Docs',\",\n ' items: [',\n ' {',\n \" kind: 'page',\",\n \" id: 'gettingStarted',\",\n \" title: 'Getting Started',\",\n \" slug: 'getting-started',\",\n \" source: 'content/getting-started/content.mdx',\",\n \" description: 'Getting started with @unterberg/nivel.',\",\n ' },',\n ' ],',\n ' },',\n ' ],',\n '})',\n '',\n ].join('\\n')\n}\n\nconst getConfigTemplate = () => {\n return [\n \"import nivel from '@unterberg/nivel/vike'\",\n \"import type { Config } from 'vike/types'\",\n \"import vikeReact from 'vike-react/config'\",\n \"import docsConfig from './+docs'\",\n '',\n 'export { config }',\n '',\n \"const themePreference = docsConfig.theme?.defaultPreference ?? 'light'\",\n 'const dataTheme =',\n \" themePreference === 'dark'\",\n \" ? (docsConfig.theme?.dark ?? 'consumer-dark')\",\n \" : (docsConfig.theme?.light ?? 'consumer-light')\",\n '',\n 'const config: Config = {',\n ' ...nivel,',\n ' extends: [vikeReact],',\n ' title: docsConfig.siteTitle,',\n ' description: docsConfig.siteDescription ?? `${docsConfig.siteTitle} documentation`,',\n \" htmlAttributes: { 'data-theme': dataTheme },\",\n \" passToClient: ['docs'],\",\n '',\n ' // User-facing Vike levers stay visible in +config.ts.',\n ' prerender: true,',\n ' // ssr: true,',\n \" // prefetchStaticAssets: 'viewport',\",\n '}',\n '',\n ].join('\\n')\n}\n\nconst getHeadTemplate = () => {\n return [\n \"import { MetaHead } from '@unterberg/nivel/client'\",\n '',\n 'export const Head = () => {',\n ' return <MetaHead />',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getLayoutTemplate = () => {\n return [\n \"import { AppLayout } from '@unterberg/nivel/client'\",\n \"import type { ReactNode } from 'react'\",\n '',\n 'const Layout = ({ children }: { children: ReactNode }) => {',\n ' return <AppLayout>{children}</AppLayout>',\n '}',\n '',\n 'export default Layout',\n '',\n ].join('\\n')\n}\n\nconst getGlobalContextTemplate = () => {\n return [\n \"import { docsGlobalContextData } from './(nivel-generated)/_docsGlobalContext'\",\n '',\n 'export const onCreateGlobalContext = (globalContext: { docs?: typeof docsGlobalContextData }) => {',\n ' globalContext.docs = docsGlobalContextData',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getWrapperTemplate = () => {\n return [\n \"import type { ReactNode } from 'react'\",\n '',\n 'const Wrapper = ({ children }: { children: ReactNode }) => {',\n ' return <>{children}</>',\n '}',\n '',\n 'export default Wrapper',\n '',\n ].join('\\n')\n}\n\nconst getGlobalTypesTemplate = () => {\n return [\n \"declare module '*.mdx' {\",\n \" import type { ComponentType } from 'react'\",\n '',\n ' const MdxComponent: ComponentType',\n ' export default MdxComponent',\n '}',\n '',\n \"declare module '*.css'\",\n '',\n 'declare global {',\n ' namespace Vike {',\n ' interface GlobalContext {',\n \" docs: import('@unterberg/nivel').DocsGlobalContextData\",\n ' }',\n ' }',\n '}',\n '',\n ].join('\\n')\n}\n\nconst getManagedFileEntries = () => {\n return [\n ['pages/+docs.ts', getDocsConfigTemplate()],\n ['docs/docs.graph.ts', getDocsGraphTemplate()],\n ['pages/+config.ts', getConfigTemplate()],\n ['pages/+Head.tsx', getHeadTemplate()],\n ['pages/+Layout.tsx', getLayoutTemplate()],\n ['pages/+onCreateGlobalContext.ts', getGlobalContextTemplate()],\n ['pages/+Wrapper.tsx', getWrapperTemplate()],\n ['global.d.ts', getGlobalTypesTemplate()],\n ] as const\n}\n\nconst getGenerateDocsRunner = (packageJson: PackageJsonShape) => {\n const packageManager = packageJson.packageManager?.trim() ?? ''\n\n if (packageManager.startsWith('pnpm@')) {\n return 'pnpm generate:docs'\n }\n\n if (packageManager.startsWith('npm@')) {\n return 'npm run generate:docs'\n }\n\n return 'npm run generate:docs'\n}\n\nconst getManagedScripts = (packageJson: PackageJsonShape) => {\n const generateDocsRunner = getGenerateDocsRunner(packageJson)\n\n return {\n 'generate:docs': 'nivel prepare',\n predev: generateDocsRunner,\n prebuild: generateDocsRunner,\n pretypecheck: generateDocsRunner,\n } satisfies Record<(typeof MANAGED_SCRIPT_NAMES)[number], string>\n}\n\nconst writeFile = (filePath: string, source: string) => {\n fs.mkdirSync(path.dirname(filePath), { recursive: true })\n fs.writeFileSync(filePath, source)\n}\n\nconst writeManagedFile = (\n rootDir: string,\n relativeFilePath: string,\n source: string,\n force: boolean,\n result: InitConsumerResult,\n) => {\n const filePath = path.join(rootDir, relativeFilePath)\n const exists = fs.existsSync(filePath)\n\n if (exists && !force) {\n result.skippedFiles.push(relativeFilePath)\n return\n }\n\n writeFile(filePath, source)\n\n if (exists) {\n result.overwrittenFiles.push(relativeFilePath)\n return\n }\n\n result.createdFiles.push(relativeFilePath)\n}\n\nconst readPackageJson = (rootDir: string) => {\n const packageJsonPath = path.join(rootDir, 'package.json')\n\n if (!fs.existsSync(packageJsonPath)) {\n throw new Error(`Expected package.json in ${rootDir}`)\n }\n\n return {\n packageJson: JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as PackageJsonShape,\n packageJsonPath,\n }\n}\n\nconst patchPackageScripts = (packageJson: PackageJsonShape, packageJsonPath: string, result: InitConsumerResult) => {\n const scripts = { ...(packageJson.scripts ?? {}) }\n const managedScripts = getManagedScripts(packageJson)\n\n for (const scriptName of MANAGED_SCRIPT_NAMES) {\n if (scripts[scriptName] === managedScripts[scriptName]) {\n continue\n }\n\n scripts[scriptName] = managedScripts[scriptName]\n result.updatedScripts.push(scriptName)\n }\n\n const nextPackageJson = {\n ...packageJson,\n scripts,\n }\n\n fs.writeFileSync(packageJsonPath, `${JSON.stringify(nextPackageJson, null, 2)}\\n`)\n}\n\nconst getMissingDependencies = (packageJson: PackageJsonShape) => {\n const installed = new Set<string>([\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.devDependencies ?? {}),\n ])\n\n return [...REQUIRED_DEPENDENCIES, ...REQUIRED_DEV_DEPENDENCIES].filter((packageName) => !installed.has(packageName))\n}\n\nexport const getInitSummary = (result: InitConsumerResult) => {\n const lines = ['Initialized nivel consumer scaffolding.']\n\n if (result.createdFiles.length > 0) {\n lines.push(`Created files: ${result.createdFiles.join(', ')}`)\n }\n\n if (result.overwrittenFiles.length > 0) {\n lines.push(`Overwritten files: ${result.overwrittenFiles.join(', ')}`)\n }\n\n if (result.skippedFiles.length > 0) {\n lines.push(`Skipped existing files: ${result.skippedFiles.join(', ')}`)\n }\n\n if (result.updatedScripts.length > 0) {\n lines.push(`Updated package.json scripts: ${result.updatedScripts.join(', ')}`)\n }\n\n if (result.missingDependencies.length > 0) {\n lines.push(`Missing dependencies: ${result.missingDependencies.join(', ')}`)\n lines.push(\n 'Consumer CSS stays hand-authored. Add your stylesheet import manually, for example in pages/+Wrapper.tsx.',\n )\n } else if (!result.allDependenciesPresent) {\n lines.push('Dependency validation completed with warnings.')\n } else {\n lines.push('All required dependencies are already present.')\n }\n\n return `${lines.join('\\n')}\\n`\n}\n\nexport const initConsumer = (options: InitConsumerOptions): InitConsumerResult => {\n const result: InitConsumerResult = {\n allDependenciesPresent: true,\n createdFiles: [],\n missingDependencies: [],\n overwrittenFiles: [],\n skippedFiles: [],\n updatedScripts: [],\n }\n\n const { packageJson, packageJsonPath } = readPackageJson(options.rootDir)\n\n for (const [relativeFilePath, source] of getManagedFileEntries()) {\n writeManagedFile(options.rootDir, relativeFilePath, source, options.force, result)\n }\n\n patchPackageScripts(packageJson, packageJsonPath, result)\n\n result.missingDependencies = getMissingDependencies(packageJson)\n result.allDependenciesPresent = result.missingDependencies.length === 0\n\n return result\n}\n"],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAKjB,IAAM,oBAAoB;AAE1B,IAAM,qBAAqB,CAAC,UAAkB,WAAmB;AAC/D,QAAM,UAAU,GAAG,WAAW,QAAQ,IAAI,GAAG,aAAa,UAAU,MAAM,IAAI;AAC9E,MAAI,YAAY,QAAQ;AACtB;AAAA,EACF;AAEA,KAAG,UAAU,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AACxD,KAAG,cAAc,UAAU,MAAM;AACnC;AAEA,IAAM,UAAU,CAAC,UAAkB,MAAM,MAAM,KAAK,GAAG,EAAE,KAAK,KAAK,MAAM,GAAG;AAE5E,IAAM,wBAAwB,CAAC,eAAuB,WAAmB;AACvE,QAAM,eAAe,QAAQ,KAAK,SAAS,eAAe,MAAM,CAAC;AACjE,MAAI,aAAa,WAAW,GAAG,GAAG;AAChC,WAAO;AAAA,EACT;AACA,SAAO,KAAK,YAAY;AAC1B;AAEA,IAAM,gBAAgB,CAAC,SAA8C,KAAK,UAAU,MAAM,MAAM,CAAC;AAEjG,IAAM,eAAe,CAAC,kBAAoC;AACxD,MAAI,CAAC,GAAG,WAAW,aAAa,GAAG;AACjC,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,UAAU,GAAG,YAAY,eAAe,EAAE,eAAe,KAAK,CAAC;AAErE,SAAO,QAAQ,QAAQ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