auklet 0.0.19 → 0.0.20
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/LICENSE +21 -0
- package/README.md +177 -389
- package/bin/entry.mjs +5 -0
- package/dist/build/bundleConfig.js +1 -1
- package/dist/build/cliOverrides.d.ts +22 -0
- package/dist/build/cliOverrides.js +22 -0
- package/dist/build/moduleConfig.js +1 -1
- package/dist/build/runTsdown.d.ts +2 -0
- package/dist/build/runTsdown.js +4 -3
- package/dist/build/tsdown/common.d.ts +2 -2
- package/dist/build/tsdown/context.d.ts +2 -1
- package/dist/build/tsdown/context.js +2 -1
- package/dist/build/tsdown/define.js +3 -2
- package/dist/build/tsdown/dependencies.js +3 -1
- package/dist/build/tsdown/entries.d.ts +2 -2
- package/dist/build/tsdown/entries.js +10 -10
- package/dist/build/tsdown/types.d.ts +1 -0
- package/dist/cli/build.d.ts +5 -0
- package/dist/cli/build.js +30 -0
- package/dist/cli/buildArgs.d.ts +8 -0
- package/dist/cli/buildArgs.js +114 -0
- package/dist/cli/buildCss.d.ts +12 -0
- package/dist/cli/buildCss.js +53 -0
- package/dist/cli/dev.d.ts +1 -0
- package/dist/cli/dev.js +39 -0
- package/dist/cli/main.d.ts +1 -0
- package/dist/cli/main.js +95 -0
- package/dist/cli/publish.d.ts +2 -0
- package/dist/cli/publish.js +9 -0
- package/dist/css/production/buildReporter.d.ts +3 -0
- package/dist/css/production/buildReporter.js +19 -0
- package/dist/css/production/builder.d.ts +8 -3
- package/dist/css/production/builder.js +9 -13
- package/dist/css/vite/hmr.js +7 -6
- package/dist/css/vite/moduleGraph/graph.js +0 -1
- package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +5 -1
- package/dist/css/vite/moduleGraph/packageSource/monorepo.js +40 -31
- package/dist/css/vite/moduleGraph/types.d.ts +0 -1
- package/dist/css/watch/watcher.d.ts +0 -1
- package/dist/css/watch/watcher.js +3 -10
- package/dist/index.d.ts +5 -7
- package/dist/index.js +4 -5
- package/dist/logger.d.ts +5 -0
- package/dist/logger.js +14 -0
- package/dist/publish/api/gitApi.d.ts +7 -0
- package/dist/publish/api/gitApi.js +55 -0
- package/dist/publish/api/packageJsonApi.d.ts +7 -0
- package/dist/publish/api/packageJsonApi.js +34 -0
- package/dist/publish/api/pnpmApi.d.ts +9 -0
- package/dist/publish/api/pnpmApi.js +85 -0
- package/dist/publish/api/pnpmPublishApi.d.ts +4 -0
- package/dist/publish/api/pnpmPublishApi.js +7 -0
- package/dist/publish/api/publishArgs.d.ts +2 -0
- package/dist/publish/api/publishArgs.js +25 -0
- package/dist/publish/api/publishHookApi.d.ts +10 -0
- package/dist/publish/api/publishHookApi.js +52 -0
- package/dist/publish/cli.d.ts +2 -0
- package/dist/publish/cli.js +94 -0
- package/dist/publish/ownerRunner.d.ts +6 -0
- package/dist/publish/ownerRunner.js +22 -0
- package/dist/publish/publishRunner.d.ts +16 -0
- package/dist/publish/publishRunner.js +108 -0
- package/dist/publish/runner/packageBuilder.d.ts +4 -0
- package/dist/publish/runner/packageBuilder.js +15 -0
- package/dist/publish/runner/packagePublisher.d.ts +7 -0
- package/dist/publish/runner/packagePublisher.js +21 -0
- package/dist/publish/runner/publishFailureReporter.d.ts +3 -0
- package/dist/publish/runner/publishFailureReporter.js +14 -0
- package/dist/publish/runner/publishOutputFormatter.d.ts +2 -0
- package/dist/publish/runner/publishOutputFormatter.js +83 -0
- package/dist/publish/runner/publishPreflight.d.ts +8 -0
- package/dist/publish/runner/publishPreflight.js +26 -0
- package/dist/publish/runner/publishSummaryReporter.d.ts +10 -0
- package/dist/publish/runner/publishSummaryReporter.js +81 -0
- package/dist/publish/runner/publishTargetError.d.ts +9 -0
- package/dist/publish/runner/publishTargetError.js +14 -0
- package/dist/publish/runner/releaseGitController.d.ts +10 -0
- package/dist/publish/runner/releaseGitController.js +41 -0
- package/dist/publish/runner/versionWriter.d.ts +13 -0
- package/dist/publish/runner/versionWriter.js +78 -0
- package/dist/publish/targetResolver.d.ts +7 -0
- package/dist/publish/targetResolver.js +195 -0
- package/dist/publish/types.d.ts +70 -0
- package/dist/publish/types.js +0 -0
- package/dist/publish/version.d.ts +5 -0
- package/dist/publish/version.js +55 -0
- package/dist/types.d.ts +8 -7
- package/dist/workspace/packages.d.ts +9 -0
- package/dist/workspace/packages.js +62 -0
- package/dist/workspace/root.d.ts +1 -0
- package/dist/workspace/root.js +14 -0
- package/package.json +15 -6
- package/bin/entry.cjs +0 -163
package/README.md
CHANGED
|
@@ -5,103 +5,133 @@
|
|
|
5
5
|
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
auklet is a build tool for TypeScript packages. It wraps `tsdown` for
|
|
9
|
+
JavaScript output, generates CSS style entries for package/module/theme output,
|
|
10
|
+
provides module CSS auto imports, and includes a Vite dev plugin for virtual
|
|
11
|
+
package CSS.
|
|
9
12
|
|
|
10
|
-
|
|
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.
|
|
13
|
+
It is designed for:
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
- single-package TypeScript libraries;
|
|
16
|
+
- single-package component libraries;
|
|
17
|
+
- pnpm monorepo TypeScript libraries;
|
|
18
|
+
- pnpm monorepo component packages.
|
|
15
19
|
|
|
16
|
-
|
|
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.
|
|
23
|
-
|
|
24
|
-
## Requirements
|
|
20
|
+
Requirements:
|
|
25
21
|
|
|
26
22
|
- Node.js `>=22`
|
|
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.
|
|
23
|
+
- pnpm for publish and owner workflows
|
|
50
24
|
|
|
51
25
|
## Quick Start
|
|
52
26
|
|
|
53
|
-
|
|
27
|
+
`auklet.config.ts` is optional. Without it, auklet uses `src` as source,
|
|
28
|
+
`dist` as output, no module output, and default JavaScript formats.
|
|
54
29
|
|
|
55
|
-
|
|
30
|
+
For a component package, a minimal config usually looks like this:
|
|
56
31
|
|
|
57
32
|
```ts
|
|
58
33
|
import type { AukletConfig } from 'auklet';
|
|
59
34
|
|
|
60
35
|
export const config: AukletConfig = {
|
|
61
|
-
source: 'src',
|
|
62
|
-
output: 'dist',
|
|
63
36
|
modules: true,
|
|
64
37
|
};
|
|
65
38
|
```
|
|
66
39
|
|
|
67
|
-
|
|
40
|
+
Build JavaScript and CSS output:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
auk build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Import generated CSS entries from the package:
|
|
68
47
|
|
|
69
48
|
```ts
|
|
70
49
|
import '@scope/ui/style.css';
|
|
71
50
|
import '@scope/ui/components/Button.css';
|
|
72
51
|
```
|
|
73
52
|
|
|
74
|
-
|
|
53
|
+
Use the Vite plugin during local development:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { aukletStylePlugin } from 'auklet';
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
plugins: [aukletStylePlugin()],
|
|
60
|
+
};
|
|
61
|
+
```
|
|
75
62
|
|
|
76
63
|
## CLI
|
|
77
64
|
|
|
78
|
-
The package exposes both `auk` and `auklet
|
|
65
|
+
The package exposes both `auk` and `auklet`.
|
|
66
|
+
|
|
67
|
+
| Command | Description |
|
|
68
|
+
| ----------------------- | --------------------------------------------------------------------- |
|
|
69
|
+
| `auk dev` | Watch JavaScript and CSS output together. |
|
|
70
|
+
| `auk build` | Remove configured output, then build JavaScript and CSS. |
|
|
71
|
+
| `auk build-js` | Run tsdown with auklet's built-in config unless `--config` is passed. |
|
|
72
|
+
| `auk build-js --watch` | Pass watch mode through to tsdown. |
|
|
73
|
+
| `auk build-css` | Generate CSS output only. |
|
|
74
|
+
| `auk build-css --watch` | Watch source/config/style files and rebuild CSS. |
|
|
75
|
+
| `auk publish` | Run the pnpm-based publish workflow. |
|
|
76
|
+
| `auk owner add <user>` | Add npm owners through pnpm. |
|
|
77
|
+
|
|
78
|
+
Build and dev commands can override package config for one run:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
pnpm auk build-css
|
|
87
|
-
pnpm auk build-css --watch
|
|
81
|
+
auk build --source source --output build --modules
|
|
82
|
+
auk build --build.formats esm,cjs
|
|
83
|
+
auk build --build.target es2022
|
|
84
|
+
auk build --build.platform node
|
|
85
|
+
auk build --build.tsconfig tsconfig.build.json
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
Supported build override flags:
|
|
89
|
+
|
|
90
|
+
| Flag | Description |
|
|
91
|
+
| ----------------------------- | -------------------------------------------- |
|
|
92
|
+
| `--source <dir>` | Source directory. |
|
|
93
|
+
| `--output <dir>` | Output directory. |
|
|
94
|
+
| `--modules` | Enable unbundled module output. |
|
|
95
|
+
| `--no-modules` | Disable unbundled module output. |
|
|
96
|
+
| `--build.formats <formats>` | Comma-separated `cjs`, `esm`, and/or `iife`. |
|
|
97
|
+
| `--build.target <target>` | JavaScript target passed to tsdown. |
|
|
98
|
+
| `--build.platform <platform>` | `node`, `neutral`, or `browser`. |
|
|
99
|
+
| `--build.tsconfig <file>` | TypeScript config file. |
|
|
100
|
+
|
|
101
|
+
Config precedence:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
CLI flags > auklet.config.ts > auklet defaults
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`build-js` passes unknown flags through to tsdown. Auklet build override flags
|
|
108
|
+
cannot be combined with tsdown custom config flags:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# not allowed
|
|
112
|
+
auk build-js --source source --config tsdown.config.ts
|
|
113
|
+
auk build-js --output build -c tsdown.config.ts
|
|
114
|
+
auk build-js --modules --no-config
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
When `--config`, `-c`, or `--no-config` is used, tsdown owns the full build
|
|
118
|
+
config. Use `auklet.config.ts` or tsdown config code directly instead of auklet
|
|
119
|
+
CLI overrides.
|
|
120
|
+
|
|
121
|
+
Publish controls stay on CLI flags:
|
|
91
122
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
- `build-css --watch`: watches source/config/style files and rebuilds CSS.
|
|
123
|
+
```bash
|
|
124
|
+
auk publish --filter @scope/ui
|
|
125
|
+
auk publish --version patch --dry-run
|
|
126
|
+
auk publish --no-format
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`--no-format` disables auklet's publish output formatter for that run. It is not
|
|
130
|
+
configured in `package.json`.
|
|
101
131
|
|
|
102
|
-
## Configuration
|
|
132
|
+
## Configuration
|
|
103
133
|
|
|
104
|
-
|
|
134
|
+
`auklet.config.ts` is loaded from the current package root:
|
|
105
135
|
|
|
106
136
|
```ts
|
|
107
137
|
import type { AukletConfig } from 'auklet';
|
|
@@ -128,239 +158,30 @@ export const config: AukletConfig = {
|
|
|
128
158
|
};
|
|
129
159
|
```
|
|
130
160
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
```
|
|
362
|
-
|
|
363
|
-
A common component-library dependency rule looks like this:
|
|
161
|
+
Configuration reference:
|
|
162
|
+
|
|
163
|
+
| Path | Default | Description |
|
|
164
|
+
| ------------------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
165
|
+
| `source` | `'src'` | Source directory relative to the current package root. |
|
|
166
|
+
| `output` | `'dist'` | Build output directory. `auk build` removes it before rebuilding. |
|
|
167
|
+
| `modules` | `false` | Generate unbundled module JS output and module-level CSS output. |
|
|
168
|
+
| `styles.themes` | `{}` | Current package theme entries, keyed by theme name. Values are paths relative to the current package root. |
|
|
169
|
+
| `styles.dependencies` | `{}` | External package style rules, keyed by dependency package name. |
|
|
170
|
+
| `styles.dependencies[pkg].entry` | `undefined` | Package-level style entry or entries from the dependency package. |
|
|
171
|
+
| `styles.dependencies[pkg].themes` | `undefined` | Theme entries from the dependency package, keyed by current package theme name. |
|
|
172
|
+
| `styles.dependencies[pkg].components` | `undefined` | Module CSS auto import rules. The name is historical; rules can point to paths such as `/pages/**.css` or `/blocks/**.css`. |
|
|
173
|
+
| `build.formats` | `['cjs', 'esm', 'iife']` | Package-level bundle formats. |
|
|
174
|
+
| `build.target` | `'es2020'` | JavaScript target passed to tsdown. |
|
|
175
|
+
| `build.platform` | `'neutral'` | Runtime platform: `node`, `neutral`, or `browser`. |
|
|
176
|
+
| `build.banner` | generated | Custom bundle banner. |
|
|
177
|
+
| `build.externals` | `[]` | Extra external package names combined with package dependencies. |
|
|
178
|
+
| `build.alias` | `{}` | Path aliases passed to tsdown. |
|
|
179
|
+
| `build.mainFields` | IIFE only | Package entry field resolution order for bundle output. |
|
|
180
|
+
| `build.globals` | `{}` | Global names for IIFE externals. |
|
|
181
|
+
| `build.tsconfig` | nearest `tsconfig.json` | TypeScript config path relative to package root. |
|
|
182
|
+
| `build.configureTsdown` | `undefined` | Final hook for each generated tsdown config. |
|
|
183
|
+
|
|
184
|
+
Common dependency rule:
|
|
364
185
|
|
|
365
186
|
```ts
|
|
366
187
|
{
|
|
@@ -373,12 +194,24 @@ A common component-library dependency rule looks like this:
|
|
|
373
194
|
}
|
|
374
195
|
```
|
|
375
196
|
|
|
376
|
-
|
|
197
|
+
`configureTsdown` receives the generated tsdown config and a context:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
type ConfigureTsdownContext = {
|
|
201
|
+
kind: 'bundle' | 'module';
|
|
202
|
+
format: 'cjs' | 'esm' | 'iife';
|
|
203
|
+
packageRoot: string;
|
|
204
|
+
output: string;
|
|
205
|
+
packageName?: string;
|
|
206
|
+
};
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## CSS Conventions And Limits
|
|
377
210
|
|
|
378
211
|
CSS auto import only scans `.tsx` files. `.ts` and `.d.ts` files do not
|
|
379
|
-
participate
|
|
212
|
+
participate.
|
|
380
213
|
|
|
381
|
-
Supported syntax:
|
|
214
|
+
Supported source syntax:
|
|
382
215
|
|
|
383
216
|
```tsx
|
|
384
217
|
import { Button } from '@scope/ui';
|
|
@@ -403,28 +236,35 @@ final exported component names, so it cannot infer CSS paths safely.
|
|
|
403
236
|
|
|
404
237
|
Inference rules:
|
|
405
238
|
|
|
406
|
-
- Package-root named imports use the imported name. For example,
|
|
407
|
-
|
|
239
|
+
- Package-root named imports use the imported name. For example, `Button` from
|
|
240
|
+
`@scope/ui` tries `@scope/ui/components/Button.css`.
|
|
241
|
+
- Local aliases do not affect package-root inference. `Button as UIButton`
|
|
242
|
+
still uses `Button`.
|
|
243
|
+
- Deep imports use the import path. `@scope/ui/components/Button` tries
|
|
408
244
|
`@scope/ui/components/Button.css`.
|
|
409
|
-
-
|
|
410
|
-
|
|
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.
|
|
245
|
+
- Missing inferred CSS files are skipped.
|
|
246
|
+
- Duplicate imports inferred from JS and handwritten source CSS are deduped.
|
|
418
247
|
|
|
419
248
|
Same-package source imports can be resolved through:
|
|
420
249
|
|
|
421
|
-
- relative paths
|
|
250
|
+
- relative paths such as `../Button`;
|
|
422
251
|
- `package.json#imports`, preferring the `source` condition;
|
|
423
252
|
- `tsconfig.json` `compilerOptions.paths`.
|
|
424
253
|
|
|
425
254
|
Only candidates resolved into the current package `source` directory are treated
|
|
426
255
|
as same-package CSS dependencies.
|
|
427
256
|
|
|
257
|
+
`build-css` handles CSS entry generation and simple `@import` expansion. It does
|
|
258
|
+
not aim to replace a full CSS toolchain. In particular, keep these boundaries in
|
|
259
|
+
mind:
|
|
260
|
+
|
|
261
|
+
- It does not process preprocessors such as Sass or Less.
|
|
262
|
+
- It does not implement CSS Modules.
|
|
263
|
+
- It does not perform URL rebasing.
|
|
264
|
+
- It does not evaluate conditional CSS import semantics beyond auklet's style
|
|
265
|
+
entry rules.
|
|
266
|
+
- It expects source CSS files and package/style paths to exist on disk.
|
|
267
|
+
|
|
428
268
|
## CSS Output
|
|
429
269
|
|
|
430
270
|
`build-css` generates package-level `index.css` when source styles exist.
|
|
@@ -473,10 +313,7 @@ output is not a completely empty file.
|
|
|
473
313
|
into virtual CSS modules. It only applies to the Vite dev server; production
|
|
474
314
|
builds still use `auk build` or `auk build-css`.
|
|
475
315
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
The plugin defaults to single-package mode. Vite root is treated as the current
|
|
479
|
-
package root:
|
|
316
|
+
Single-package mode is the default:
|
|
480
317
|
|
|
481
318
|
```ts
|
|
482
319
|
import { aukletStylePlugin } from 'auklet';
|
|
@@ -486,19 +323,8 @@ export default {
|
|
|
486
323
|
};
|
|
487
324
|
```
|
|
488
325
|
|
|
489
|
-
|
|
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:
|
|
326
|
+
Use monorepo mode when a workspace demo/app needs to work with multiple
|
|
327
|
+
workspace packages:
|
|
502
328
|
|
|
503
329
|
```ts
|
|
504
330
|
import { aukletStylePlugin } from 'auklet';
|
|
@@ -508,28 +334,14 @@ export default {
|
|
|
508
334
|
};
|
|
509
335
|
```
|
|
510
336
|
|
|
511
|
-
|
|
512
|
-
then scans workspace packages.
|
|
513
|
-
|
|
514
|
-
### Plugin Options
|
|
337
|
+
Primary options:
|
|
515
338
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
};
|
|
521
|
-
```
|
|
339
|
+
| Option | Default | Description |
|
|
340
|
+
| ------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
341
|
+
| `mode` | `'package'` | `'package'` treats Vite root as the package root. `'monorepo'` finds `pnpm-workspace.yaml` upward from Vite root and reads pnpm workspace packages. |
|
|
342
|
+
| `root` | inferred | Custom graph root. Usually unnecessary. |
|
|
522
343
|
|
|
523
|
-
|
|
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
|
-
|
|
532
|
-
The plugin resolves package CSS ids such as:
|
|
344
|
+
Supported dev CSS imports:
|
|
533
345
|
|
|
534
346
|
```ts
|
|
535
347
|
import '@scope/app/style.css';
|
|
@@ -539,13 +351,10 @@ import '@scope/app/components/Button.css';
|
|
|
539
351
|
import '@scope/app/themes/light.css';
|
|
540
352
|
```
|
|
541
353
|
|
|
542
|
-
### Dependency Resolution
|
|
543
|
-
|
|
544
354
|
In dev mode, workspace package style dependencies keep using auklet virtual CSS
|
|
545
355
|
recursion so style changes across packages can be tracked. Third-party CSS
|
|
546
356
|
dependencies are resolved from the package root that declares them and emitted
|
|
547
|
-
as Vite `/@fs/...` imports
|
|
548
|
-
virtual modules.
|
|
357
|
+
as Vite `/@fs/...` imports.
|
|
549
358
|
|
|
550
359
|
## Build Constants
|
|
551
360
|
|
|
@@ -561,58 +370,37 @@ Vitest uses test-friendly values with the same names: `__DEV__` is `true`,
|
|
|
561
370
|
|
|
562
371
|
## Programmatic API
|
|
563
372
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
aukletStylePlugin,
|
|
569
|
-
loadAukletConfig,
|
|
570
|
-
runTsdown,
|
|
571
|
-
} from 'auklet';
|
|
572
|
-
|
|
573
|
-
const aukletConfig = await loadAukletConfig(process.cwd());
|
|
574
|
-
|
|
575
|
-
await new ModuleStyleBuilder({
|
|
576
|
-
packageRoot: process.cwd(),
|
|
577
|
-
aukletConfig,
|
|
578
|
-
}).build();
|
|
579
|
-
```
|
|
373
|
+
The root package entry exposes the Vite plugin, configuration helpers, and a
|
|
374
|
+
small set of build helpers used by projects that need to compose auklet
|
|
375
|
+
programmatically. Publish and owner workflows remain CLI/internal implementation
|
|
376
|
+
details.
|
|
580
377
|
|
|
581
378
|
Public exports include:
|
|
582
379
|
|
|
583
|
-
- `ModuleStyleBuilder`
|
|
584
|
-
- `ModuleStyleWatcher`
|
|
585
380
|
- `aukletStylePlugin`
|
|
586
381
|
- `loadAukletConfig`
|
|
587
|
-
- `resolveAukletConfigModule`
|
|
588
|
-
- `createTsdownArgs`
|
|
589
382
|
- `runTsdown`
|
|
590
|
-
-
|
|
383
|
+
- `defineKernelPackageConfigFromFile`
|
|
384
|
+
- `defineKernelPackageConfigFromOptions`
|
|
385
|
+
- `runAukletCli`
|
|
386
|
+
- `AukletStylePluginOptions`
|
|
387
|
+
- `AukletConfig`
|
|
388
|
+
- `PackageBuildOptions`
|
|
389
|
+
- `StyleOptions`
|
|
390
|
+
- related user-facing TypeScript types
|
|
591
391
|
|
|
592
392
|
## Development
|
|
593
393
|
|
|
594
394
|
```bash
|
|
595
395
|
pnpm i
|
|
596
|
-
pnpm
|
|
597
|
-
pnpm
|
|
598
|
-
pnpm
|
|
396
|
+
pnpm test
|
|
397
|
+
pnpm typecheck
|
|
398
|
+
pnpm build
|
|
599
399
|
pnpm run format
|
|
600
400
|
```
|
|
601
401
|
|
|
602
402
|
Notes:
|
|
603
403
|
|
|
604
|
-
- `pnpm
|
|
404
|
+
- `pnpm build` rewrites `dist`.
|
|
605
405
|
- `pnpm run format` formats `bin`, `src`, `dist`, `examples`, and related files.
|
|
606
406
|
- Read `TESTING.md` before changing tests.
|
|
607
|
-
|
|
608
|
-
## Testing
|
|
609
|
-
|
|
610
|
-
Tests are organized into:
|
|
611
|
-
|
|
612
|
-
- `src/__tests__/e2e`: project-level output structure and dependency-chain tests.
|
|
613
|
-
- `src/__tests__/css`: CSS/style module and API tests.
|
|
614
|
-
- `src/__tests__/fixtures`: shared virtual project and style structure helpers.
|
|
615
|
-
- `src/__tests__/build`: tsdown/build config tests.
|
|
616
|
-
|
|
617
|
-
Temporary test projects are created under `src/__tests__/.tmp/` and ignored by
|
|
618
|
-
git.
|