auklet 0.0.17 → 0.0.19

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.
Files changed (37) hide show
  1. package/README.md +436 -107
  2. package/dist/css/constants.d.ts +1 -1
  3. package/dist/css/constants.js +1 -1
  4. package/dist/css/core/style/entries.d.ts +2 -2
  5. package/dist/css/core/style/entries.js +2 -2
  6. package/dist/css/core/style/specifier.d.ts +36 -0
  7. package/dist/css/core/style/specifier.js +86 -0
  8. package/dist/css/core/styleImports/autoImportRules.d.ts +13 -0
  9. package/dist/css/core/styleImports/autoImportRules.js +68 -0
  10. package/dist/css/core/styleImports/collector.d.ts +0 -5
  11. package/dist/css/core/styleImports/collector.js +13 -79
  12. package/dist/css/core/styleImports/sourceImportExportAnalyzer.d.ts +11 -0
  13. package/dist/css/core/styleImports/{sourceReference.js → sourceImportExportAnalyzer.js} +3 -3
  14. package/dist/css/core/styleModuleEntryPlanner.d.ts +1 -1
  15. package/dist/css/core/styleModuleEntryPlanner.js +3 -3
  16. package/dist/css/core/workspaceStyleResolver.d.ts +0 -1
  17. package/dist/css/core/workspaceStyleResolver.js +13 -45
  18. package/dist/css/production/format/{componentWriter.d.ts → moduleEntryWriter.d.ts} +1 -1
  19. package/dist/css/production/format/{componentWriter.js → moduleEntryWriter.js} +8 -10
  20. package/dist/css/production/format/shared.d.ts +1 -1
  21. package/dist/css/production/format/shared.js +1 -5
  22. package/dist/css/production/moduleOutputWriter.d.ts +2 -2
  23. package/dist/css/production/moduleOutputWriter.js +11 -11
  24. package/dist/css/vite/moduleGraph/graph.d.ts +1 -1
  25. package/dist/css/vite/moduleGraph/graph.js +15 -11
  26. package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +14 -3
  27. package/dist/css/vite/moduleGraph/packageSource/monorepo.js +9 -12
  28. package/dist/css/vite/moduleGraph/packageSource/singlePackage.d.ts +21 -0
  29. package/dist/css/vite/moduleGraph/packageSource/singlePackage.js +63 -0
  30. package/dist/css/vite/moduleGraph/packageSource/types.d.ts +1 -1
  31. package/dist/css/vite/moduleGraph/styleCodeFactory.js +19 -29
  32. package/dist/css/vite/moduleGraph/types.d.ts +1 -1
  33. package/dist/css/vite/vitePlugin.d.ts +2 -2
  34. package/dist/css/vite/vitePlugin.js +11 -4
  35. package/dist/css/watch/watcher.js +2 -2
  36. package/package.json +1 -1
  37. package/dist/css/core/styleImports/sourceReference.d.ts +0 -11
package/README.md CHANGED
@@ -7,43 +7,99 @@
7
7
 
8
8
  <h1></h1>
9
9
 
10
- Build utilities for TypeScript packages and module CSS output.
10
+ auklet is a build tool for TypeScript packages. It generates JavaScript and
11
+ TypeScript output through `tsdown`, and also provides CSS style entry builds,
12
+ module style auto imports, and a Vite dev plugin for virtual package CSS.
11
13
 
12
14
  ## Features
13
15
 
14
- - Build JavaScript/TypeScript package output with the bundled tsdown config.
15
- - Generate package-level and module-level CSS entries.
16
- - Infer component style dependencies from source imports.
17
- - Generate theme and external style entry files.
18
- - Provide a Vite dev plugin for virtual package CSS entries.
19
- - Watch source/config changes and rebuild module CSS output.
16
+ - Generate TypeScript package bundles, IIFE output, and unbundled module output.
17
+ - Generate package-level, module-level, theme, and external CSS entries.
18
+ - Infer module CSS dependencies from `.tsx` imports and re-exports.
19
+ - Turn package CSS imports into virtual CSS modules in Vite dev mode.
20
+ - Support single-package component libraries, single-package libraries,
21
+ monorepo component packages, and monorepo libraries.
22
+ - Watch source/config/style changes and rebuild CSS output.
20
23
 
21
24
  ## Requirements
22
25
 
23
26
  - Node.js `>=22`
24
27
 
28
+ ## Project Shapes
29
+
30
+ auklet supports four project shapes:
31
+
32
+ - single-package component library;
33
+ - single-package TypeScript library;
34
+ - monorepo component packages;
35
+ - monorepo TypeScript libraries.
36
+
37
+ Production build commands always run from the **current package root**, whether
38
+ that package lives in a monorepo or not:
39
+
40
+ ```bash
41
+ auk build
42
+ auk build-js
43
+ auk build-css
44
+ ```
45
+
46
+ Vite dev mode is provided by `aukletStylePlugin`, which exposes virtual CSS
47
+ entries. The plugin defaults to single-package mode. If a workspace demo/app
48
+ needs to work with multiple packages at the same time, enable monorepo mode
49
+ explicitly.
50
+
51
+ ## Quick Start
52
+
53
+ ### Single-Package Component Library
54
+
55
+ Add `auklet.config.ts` in the package root:
56
+
57
+ ```ts
58
+ import type { AukletConfig } from 'auklet';
59
+
60
+ export const config: AukletConfig = {
61
+ source: 'src',
62
+ output: 'dist',
63
+ modules: true,
64
+ };
65
+ ```
66
+
67
+ Then import CSS entries from the current package:
68
+
69
+ ```ts
70
+ import '@scope/ui/style.css';
71
+ import '@scope/ui/components/Button.css';
72
+ ```
73
+
74
+ See the "Vite Plugin" section for dev plugin setup.
75
+
25
76
  ## CLI
26
77
 
27
- The package exposes both `auk` and `auklet` commands.
78
+ The package exposes both `auk` and `auklet` commands:
28
79
 
29
80
  ```bash
30
81
  pnpm auk --help
82
+ pnpm auk dev
31
83
  pnpm auk build
32
84
  pnpm auk build-js
85
+ pnpm auk build-js --watch
33
86
  pnpm auk build-css
34
87
  pnpm auk build-css --watch
35
- pnpm auk dev
36
88
  ```
37
89
 
38
90
  Commands:
39
91
 
40
- - `build` removes the configured `output` directory, builds JavaScript output, then builds CSS output.
41
- - `build-js` runs tsdown with the default auklet tsdown config unless a config flag is passed.
42
- - `build-css` generates module CSS output.
43
- - `build-css --watch` watches source/config files and rebuilds CSS.
44
- - `dev` runs JavaScript and CSS watch tasks together.
92
+ - `dev`: starts JavaScript watch and CSS watch together.
93
+ - `build`: removes the configured `output` directory, then builds JavaScript and
94
+ CSS output.
95
+ - `build-js`: runs tsdown. If no `--config` is passed, auklet uses its built-in
96
+ tsdown config.
97
+ - `build-js --watch`: passes `--watch` through to tsdown and watches JS/TS
98
+ builds.
99
+ - `build-css`: generates CSS output.
100
+ - `build-css --watch`: watches source/config/style files and rebuilds CSS.
45
101
 
46
- ## Configuration
102
+ ## Configuration Example
47
103
 
48
104
  Create `auklet.config.ts` in the package root:
49
105
 
@@ -54,7 +110,9 @@ export const config: AukletConfig = {
54
110
  source: 'src',
55
111
  output: 'dist',
56
112
  modules: true,
57
- tsconfig: 'tsconfig.json',
113
+ build: {
114
+ formats: ['esm', 'cjs'],
115
+ },
58
116
  styles: {
59
117
  themes: {
60
118
  light: './src/themes/light.css',
@@ -65,115 +123,316 @@ export const config: AukletConfig = {
65
123
  entry: '/style.css',
66
124
  components: ['/components/**.css'],
67
125
  },
68
- '@scope/theme': {
69
- entry: '/style.css',
70
- themes: {
71
- light: '/themes/light.css',
72
- dark: '/themes/dark.css',
73
- },
74
- },
75
- },
76
- },
77
- build: {
78
- alias: { ... },
79
- globals: { ... },
80
- target: 'es2020',
81
- formats: ['esm', 'cjs'],
82
- mainFields: ['browser', 'module', 'main'],
83
- configureTsdown(config, context) {
84
- if (context.kind !== 'bundle') return config;
85
- return {
86
- ...config,
87
- sourcemap: true,
88
- };
89
126
  },
90
127
  },
91
128
  };
92
129
  ```
93
130
 
94
- ### Style Options
131
+ ## Configuration Reference
95
132
 
96
- - `source`: source directory relative to the package root. Defaults to `src`.
97
- - `output`: build output directory relative to the package root. Defaults to `dist`. `auk build` removes this directory before writing JavaScript and CSS output.
98
- - `styles.themes`: package theme style entries. Defaults to `{}`.
99
- - `styles.dependencies`: external package style dependencies. Defaults to `{}`.
133
+ The full `auklet.config.ts` shape is:
100
134
 
101
- Each `styles.dependencies` entry may define:
135
+ ```ts
136
+ import type { UserConfig } from 'tsdown/config';
137
+
138
+ export interface AukletConfig {
139
+ /**
140
+ * Source directory, relative to the current package root.
141
+ *
142
+ * @default 'src'
143
+ */
144
+ source?: string;
145
+
146
+ /**
147
+ * Build output directory, relative to the current package root.
148
+ *
149
+ * `auk build` removes this directory before generating JavaScript and CSS
150
+ * output again.
151
+ *
152
+ * @default 'dist'
153
+ */
154
+ output?: string;
155
+
156
+ /**
157
+ * Whether to generate unbundled module output.
158
+ *
159
+ * When enabled, auklet generates module output such as `dist/es` and
160
+ * `dist/lib`. Module-level CSS output follows the same switch.
161
+ *
162
+ * @default false
163
+ */
164
+ modules?: boolean;
165
+
166
+ /**
167
+ * Style build configuration.
168
+ *
169
+ * @default { themes: {}, dependencies: {} }
170
+ */
171
+ styles?: {
172
+ /**
173
+ * Theme style entries for the current package.
174
+ *
175
+ * The key is the theme name, and the value is a style file path relative to
176
+ * the current package root.
177
+ *
178
+ * @example
179
+ * {
180
+ * light: './src/themes/light.css',
181
+ * dark: './src/themes/dark.css',
182
+ * }
183
+ *
184
+ * @default {}
185
+ */
186
+ themes?: Record<string, string>;
187
+
188
+ /**
189
+ * External package style dependencies.
190
+ *
191
+ * The key is the dependency package name, and the value describes style
192
+ * entry rules for that package.
193
+ *
194
+ * @default {}
195
+ */
196
+ dependencies?: Record<
197
+ string,
198
+ {
199
+ /**
200
+ * Package-level style entry from the dependency package.
201
+ *
202
+ * This participates in package style and external style generation for
203
+ * the current package.
204
+ *
205
+ * @default undefined
206
+ */
207
+ entry?: string | string[];
208
+
209
+ /**
210
+ * Theme style entries from the dependency package.
211
+ *
212
+ * The key should match a theme name in the current package, and the
213
+ * value is the corresponding theme entry in the dependency package.
214
+ *
215
+ * @default undefined
216
+ */
217
+ themes?: Record<string, string>;
218
+
219
+ /**
220
+ * Module CSS auto import rules.
221
+ *
222
+ * The field name remains `components` for compatibility with common
223
+ * component-library usage. The rule itself is not limited to
224
+ * components; paths such as `/pages/**.css` or `/blocks/**.css` are also
225
+ * valid.
226
+ *
227
+ * @default undefined
228
+ */
229
+ components?: string | string[];
230
+ }
231
+ >;
232
+ };
233
+
234
+ /**
235
+ * JavaScript/TypeScript build configuration.
236
+ */
237
+ build?: {
238
+ /**
239
+ * Package-level bundle formats.
240
+ *
241
+ * @default ['cjs', 'esm', 'iife']
242
+ */
243
+ formats?: Array<'cjs' | 'esm' | 'iife'>;
244
+
245
+ /**
246
+ * JavaScript compilation target passed to tsdown.
247
+ *
248
+ * Bundle, IIFE, and module output use the same target.
249
+ *
250
+ * @default 'es2020'
251
+ */
252
+ target?: string | string[] | false;
253
+
254
+ /**
255
+ * Runtime platform for the build target.
256
+ *
257
+ * @default 'neutral'
258
+ */
259
+ platform?: 'node' | 'neutral' | 'browser';
260
+
261
+ /**
262
+ * Custom bundle banner.
263
+ *
264
+ * When omitted, auklet generates one from package name/version/author.
265
+ *
266
+ * @default undefined
267
+ */
268
+ banner?: string;
269
+
270
+ /**
271
+ * Additional external package names.
272
+ *
273
+ * These are combined with package.json dependencies and peerDependencies
274
+ * before being passed to tsdown.
275
+ *
276
+ * @default []
277
+ */
278
+ externals?: string[];
279
+
280
+ /**
281
+ * Path aliases passed to tsdown `alias`.
282
+ *
283
+ * This applies to both bundle output and module output.
284
+ *
285
+ * @default {}
286
+ */
287
+ alias?: Record<string, string>;
288
+
289
+ /**
290
+ * Package.json entry field resolution order for bundle output.
291
+ *
292
+ * This is passed to rolldown `resolve.mainFields`. When omitted, auklet
293
+ * only sets `['browser', 'module', 'main']` for IIFE bundles.
294
+ *
295
+ * @default undefined
296
+ */
297
+ mainFields?: string[];
298
+
299
+ /**
300
+ * Global names for IIFE externals.
301
+ *
302
+ * This is passed to tsdown `output.globals` and overrides the global names
303
+ * auklet infers from package names.
304
+ *
305
+ * @default {}
306
+ */
307
+ globals?: Record<string, string>;
308
+
309
+ /**
310
+ * TypeScript config file path, relative to the current package root.
311
+ *
312
+ * When omitted, auklet searches upward from the current package root for
313
+ * the nearest `tsconfig.json`.
314
+ *
315
+ * @default undefined
316
+ */
317
+ tsconfig?: string;
318
+
319
+ /**
320
+ * Final tsdown config hook.
321
+ *
322
+ * auklet calls this after generating each tsdown config, allowing users to
323
+ * make final adjustments.
324
+ *
325
+ * @default undefined
326
+ */
327
+ configureTsdown?: (
328
+ config: UserConfig,
329
+ context: {
330
+ /**
331
+ * Build output kind for the current config.
332
+ *
333
+ * `bundle` means package-level bundle/IIFE output.
334
+ * `module` means unbundled module output generated by `modules: true`.
335
+ */
336
+ kind: 'bundle' | 'module';
337
+
338
+ /**
339
+ * Output format for the current config.
340
+ */
341
+ format: 'cjs' | 'esm' | 'iife';
342
+
343
+ /**
344
+ * Current package root.
345
+ */
346
+ packageRoot: string;
347
+
348
+ /**
349
+ * Current package build output directory.
350
+ */
351
+ output: string;
352
+
353
+ /**
354
+ * Current package.json name.
355
+ */
356
+ packageName?: string;
357
+ },
358
+ ) => UserConfig;
359
+ };
360
+ }
361
+ ```
102
362
 
103
- - `entry`: package-level style dependency.
104
- - `themes`: theme style dependency map.
105
- - `components`: glob-like component style rules used to infer style imports from source imports.
363
+ A common component-library dependency rule looks like this:
106
364
 
107
- Component style inference only scans source `.tsx` files. Component imports or
108
- re-exports in `.ts` files are ignored for CSS auto import, so component barrel
109
- files that should drive component CSS must be `.tsx`.
365
+ ```ts
366
+ {
367
+ entry: '/style.css',
368
+ components: ['/pages/**.css', '/components/**.css'],
369
+ themes: {
370
+ dark: '/themes/dark.css',
371
+ light: '/themes/light.css',
372
+ },
373
+ }
374
+ ```
110
375
 
111
- Same-package component style inference resolves relative imports,
112
- `package.json#imports` mappings, and `tsconfig.json` `compilerOptions.paths`.
113
- For `package.json#imports`, the `source` condition is preferred when present.
114
- Only aliases that resolve into the current package source directory are treated
115
- as same-package CSS dependencies.
376
+ ## CSS Auto Import
116
377
 
117
- Supported value forms include named imports, named re-exports, and local
118
- re-exports that can be traced back to an import binding:
378
+ CSS auto import only scans `.tsx` files. `.ts` and `.d.ts` files do not
379
+ participate in CSS auto import.
380
+
381
+ Supported syntax:
119
382
 
120
383
  ```tsx
121
384
  import { Button } from '@scope/ui';
385
+ import { Card as UICard } from '@scope/ui';
386
+ import { Dialog } from '@scope/ui/components/Dialog';
387
+
388
+ export { Button } from '@scope/ui';
122
389
  export { Card } from '@scope/ui/components/Card';
123
390
 
124
391
  import { Dialog as BaseDialog } from '@scope/ui';
125
392
  export { BaseDialog as Dialog };
126
393
  ```
127
394
 
128
- `export * from '...'` is intentionally not supported for CSS auto import because
129
- the exported component names cannot be inferred reliably.
130
-
131
- Style configuration should use the grouped `styles` field.
395
+ Unsupported:
132
396
 
133
397
  ```ts
134
- export const config: AukletConfig = {
135
- styles: {
136
- dependencies: {
137
- '@scope/ui': {
138
- entry: '/style.css',
139
- components: ['/components/**.css'],
140
- },
141
- },
142
- },
143
- };
398
+ export * from '@scope/ui/components/Button';
144
399
  ```
145
400
 
146
- ### Build Options
401
+ `export *` is intentionally unsupported because auklet cannot reliably infer the
402
+ final exported component names, so it cannot infer CSS paths safely.
147
403
 
148
- - `modules`: whether to generate unbundled `dist/es` and `dist/lib` output. Defaults to `false`. CSS module style entries also follow this flag.
149
- - `build.formats`: package bundle formats: `esm`, `cjs`, or `iife`. Defaults to `['cjs', 'esm', 'iife']`.
150
- - `build.target`: JavaScript compilation target passed to tsdown. Defaults to `es2020` and is shared by bundle, global, and module output.
151
- - `build.platform`: build target runtime platform: `neutral`, `node`, or `browser`. Defaults to `neutral`.
152
- - `build.banner`: custom bundle banner. Defaults to a package name/version banner.
153
- - `build.externals`: additional external packages. Defaults to `[]`.
154
- - `build.alias`: path aliases passed to tsdown `alias`. Defaults to `{}`.
155
- - `build.mainFields`: bundle package entry resolution order passed to rolldown `resolve.mainFields`. When omitted, auklet only sets `['browser', 'module', 'main']` for IIFE bundles.
156
- - `build.globals`: IIFE external global names passed to tsdown `output.globals`. Values override auklet's generated global names.
157
- - `build.configureTsdown`: final customization hook for each generated tsdown config. It receives `(config, context)` and should return a tsdown config.
158
- - `build.tsconfig`: TypeScript config path relative to the package root. Defaults to the nearest `tsconfig.json` found from the package root upward.
404
+ Inference rules:
159
405
 
160
- ### Build Constants
406
+ - Package-root named imports use the imported name. For example,
407
+ `import { Button } from '@scope/ui'` tries to generate
408
+ `@scope/ui/components/Button.css`.
409
+ - Local aliases do not affect package-root import inference. For example,
410
+ `import { Button as UIButton } from '@scope/ui'` still uses `Button`.
411
+ - Deep imports use the import path. For example,
412
+ `import { Anything } from '@scope/ui/components/Button'` tries to generate
413
+ `@scope/ui/components/Button.css`.
414
+ - If the inferred CSS file does not exist, auklet skips it and does not generate
415
+ an invalid import.
416
+ - If JavaScript auto inference and handwritten source CSS `@import` point to the
417
+ same file, auklet dedupes the import.
161
418
 
162
- `auk build` injects these compile-time constants into bundled output:
419
+ Same-package source imports can be resolved through:
163
420
 
164
- - `__DEV__`: `true` when `process.env.NODE_ENV !== 'production'`, otherwise `false`.
165
- - `__TEST__`: always `false` in package builds.
166
- - `__VERSION__`: current package version from `package.json`.
421
+ - relative paths, such as `../Button`;
422
+ - `package.json#imports`, preferring the `source` condition;
423
+ - `tsconfig.json` `compilerOptions.paths`.
167
424
 
168
- Vitest uses the same names with test-friendly values: `__DEV__` is `true`, `__TEST__` is `true`, and `__VERSION__` is `'unknown'`.
425
+ Only candidates resolved into the current package `source` directory are treated
426
+ as same-package CSS dependencies.
169
427
 
170
428
  ## CSS Output
171
429
 
172
- `build-css` always generates the package-level `index.css` when source styles exist.
430
+ `build-css` generates package-level `index.css` when source styles exist.
173
431
 
174
- Module style entries under `dist/es` and `dist/lib` are generated only when `modules` is `true`, matching the JavaScript module output.
432
+ When `modules: true` is enabled, auklet also generates module-level CSS output
433
+ under `dist/es` and `dist/lib`, aligned with JavaScript module output.
175
434
 
176
- Typical module output includes:
435
+ Typical output structure:
177
436
 
178
437
  ```text
179
438
  dist/
@@ -194,18 +453,30 @@ dist/
194
453
  ...
195
454
  ```
196
455
 
197
- Important entry semantics:
456
+ Entry semantics:
198
457
 
199
458
  - `index.css`: package-level aggregate CSS.
200
- - `style/index.css`: package style entry for a specific output format.
201
- - `style/module.css`: current package module styles.
202
- - `style/external.css`: external style entries.
203
- - `components/*/style/index.css`: component-level style entry.
459
+ - `style/index.css`: style entry for the current format.
460
+ - `style/module.css`: module styles from the current package.
461
+ - `style/external.css`: external style entry.
204
462
  - `themes/*.css`: theme style entry.
463
+ - `components/*/style/index.css`: module-level style entry. `components/` is a
464
+ common output path, not a restriction that the internal model only supports
465
+ components.
466
+
467
+ If a generated CSS file is empty, auklet writes a placeholder comment so the
468
+ output is not a completely empty file.
205
469
 
206
470
  ## Vite Plugin
207
471
 
208
- Use `aukletStylePlugin` in Vite dev mode to load virtual package CSS entries.
472
+ `aukletStylePlugin` is the Vite dev entry point. It turns package CSS imports
473
+ into virtual CSS modules. It only applies to the Vite dev server; production
474
+ builds still use `auk build` or `auk build-css`.
475
+
476
+ ### Single-Package Mode
477
+
478
+ The plugin defaults to single-package mode. Vite root is treated as the current
479
+ package root:
209
480
 
210
481
  ```ts
211
482
  import { aukletStylePlugin } from 'auklet';
@@ -215,19 +486,78 @@ export default {
215
486
  };
216
487
  ```
217
488
 
489
+ This is equivalent to:
490
+
491
+ ```ts
492
+ aukletStylePlugin({ mode: 'package' });
493
+ ```
494
+
495
+ Single-package mode is intended for running a Vite demo directly from a
496
+ component-library package root.
497
+
498
+ ### Monorepo Mode
499
+
500
+ Use monorepo mode when a demo/app lives in a workspace and needs to work with
501
+ multiple workspace packages at the same time:
502
+
503
+ ```ts
504
+ import { aukletStylePlugin } from 'auklet';
505
+
506
+ export default {
507
+ plugins: [aukletStylePlugin({ mode: 'monorepo' })],
508
+ };
509
+ ```
510
+
511
+ `mode: 'monorepo'` walks upward from Vite root to find `pnpm-workspace.yaml`,
512
+ then scans workspace packages.
513
+
514
+ ### Plugin Options
515
+
516
+ ```ts
517
+ export type AukletStylePluginOptions = {
518
+ mode?: 'package' | 'monorepo';
519
+ root?: string;
520
+ };
521
+ ```
522
+
523
+ - `mode: 'package'`: default. Vite root is the current package root. This is
524
+ intended for single-package component libraries.
525
+ - `mode: 'monorepo'`: walks upward from Vite root to find `pnpm-workspace.yaml`
526
+ and scans workspace packages.
527
+ - `root`: custom graph root. This is usually unnecessary; use it only when a
528
+ monorepo root cannot be inferred automatically.
529
+
530
+ ### Supported CSS Imports
531
+
218
532
  The plugin resolves package CSS ids such as:
219
533
 
220
534
  ```ts
221
535
  import '@scope/app/style.css';
536
+ import '@scope/app/external.css';
537
+ import '@scope/app/module.css';
222
538
  import '@scope/app/components/Button.css';
223
539
  import '@scope/app/themes/light.css';
224
540
  ```
225
541
 
542
+ ### Dependency Resolution
543
+
226
544
  In dev mode, workspace package style dependencies keep using auklet virtual CSS
227
- entries so changes can be tracked recursively. Third-party CSS dependencies are
228
- resolved from the package that declares the dependency and emitted as Vite
229
- `/@fs/...` imports, so packages such as `katex/dist/katex.min.css` do not need
230
- to be installed by the consuming app.
545
+ recursion so style changes across packages can be tracked. Third-party CSS
546
+ dependencies are resolved from the package root that declares them and emitted
547
+ as Vite `/@fs/...` imports, avoiding lost `node_modules` resolution context from
548
+ virtual modules.
549
+
550
+ ## Build Constants
551
+
552
+ `auk build` injects these compile-time constants into bundles:
553
+
554
+ - `__DEV__`: `true` when `process.env.NODE_ENV !== 'production'`, otherwise
555
+ `false`.
556
+ - `__TEST__`: always `false` in package builds.
557
+ - `__VERSION__`: current package version.
558
+
559
+ Vitest uses test-friendly values with the same names: `__DEV__` is `true`,
560
+ `__TEST__` is `true`, and `__VERSION__` is `'unknown'`.
231
561
 
232
562
  ## Programmatic API
233
563
 
@@ -272,18 +602,17 @@ pnpm run format
272
602
  Notes:
273
603
 
274
604
  - `pnpm run build` rewrites `dist`.
275
- - `pnpm run format` formats `bin`, `src`, and `dist`.
276
- - `TESTING.md` defines the testing architecture and style rules for future changes.
605
+ - `pnpm run format` formats `bin`, `src`, `dist`, `examples`, and related files.
606
+ - Read `TESTING.md` before changing tests.
277
607
 
278
608
  ## Testing
279
609
 
280
610
  Tests are organized into:
281
611
 
282
612
  - `src/__tests__/e2e`: project-level output structure and dependency-chain tests.
283
- - `src/__tests__/css`: module/API tests for CSS and style logic.
613
+ - `src/__tests__/css`: CSS/style module and API tests.
284
614
  - `src/__tests__/fixtures`: shared virtual project and style structure helpers.
285
615
  - `src/__tests__/build`: tsdown/build config tests.
286
616
 
287
- Temporary test projects are created under `src/__tests__/.tmp/` and ignored by git.
288
-
289
- Read `TESTING.md` before adding or changing tests.
617
+ Temporary test projects are created under `src/__tests__/.tmp/` and ignored by
618
+ git.
@@ -1,5 +1,5 @@
1
1
  export declare const NODE_MODULES_DIR = "node_modules";
2
- export declare const SOURCE_COMPONENT_MODULE_RE: RegExp;
2
+ export declare const SOURCE_MODULE_RE: RegExp;
3
3
  export declare const THEMES_DIR = "themes";
4
4
  export declare const THEMES_ENTRY_PREFIX = "themes/";
5
5
  export declare const STYLE_ENTRY = "style.css";
@@ -1,5 +1,5 @@
1
1
  export const NODE_MODULES_DIR = 'node_modules';
2
- export const SOURCE_COMPONENT_MODULE_RE = /\.tsx$/;
2
+ export const SOURCE_MODULE_RE = /\.tsx$/;
3
3
  export const THEMES_DIR = 'themes';
4
4
  export const THEMES_ENTRY_PREFIX = 'themes/';
5
5
  export const STYLE_ENTRY = 'style.css';
@@ -39,12 +39,12 @@ export declare function createExternalEntryParts(config: NormalizedAukletConfig)
39
39
  specifiers: string[];
40
40
  }[];
41
41
  export declare function collectModuleStyleImports(packageContext: StylePackageContext): Map<string, string[]>;
42
- export declare function createComponentStyleEntryPlan(packageContext: StylePackageContext, sourceDir: string): {
42
+ export declare function createModuleStyleEntryPlan(packageContext: StylePackageContext, sourceDir: string): {
43
43
  sourceDir: string;
44
44
  moduleStyleImports: string[];
45
45
  ownStyleFiles: string[];
46
46
  };
47
- export declare function createComponentStyleEntryPlans(packageContext: StylePackageContext): {
47
+ export declare function createModuleStyleEntryPlans(packageContext: StylePackageContext): {
48
48
  sourceDir: string;
49
49
  moduleStyleImports: string[];
50
50
  ownStyleFiles: string[];