@navecss/core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,279 @@
1
+ export { R as ResolvedUsedOptions, U as UsedAtomOptions, a as assertOptions, k as keptAtoms, r as resolveUsedOptions } from './vite-options-D1-hGA9L.js';
2
+ import './atom-names-2OreuBx9.js';
3
+
4
+ /**
5
+ * The few shapes of the ESTree `this.parse` returns that the collector reads, declared here
6
+ * rather than imported: the plugin takes no dependency, and a node is read through a handful of
7
+ * typed accessors instead of a full ESTree type package.
8
+ */
9
+ interface AstNode {
10
+ readonly type: string;
11
+ readonly start: number;
12
+ readonly end: number;
13
+ readonly [key: string]: unknown;
14
+ }
15
+
16
+ /**
17
+ * One thing the collector could not read in a module, before it has a position or a path: what
18
+ * it is, where it starts (an offset into the module as the post-order half saw it), the
19
+ * construct as the plugin reads it, and the sentence that follows the construct in the report.
20
+ */
21
+ /**
22
+ * The kinds a report groups its remedy lines by; the order here is the order the lines print.
23
+ */
24
+ declare const PROBLEM_KINDS: readonly ["argument", "reference", "reexport", "declared", "concatenation", "dynamic", "unknown", "own", "unreadable"];
25
+ type ProblemKind = (typeof PROBLEM_KINDS)[number];
26
+ interface Problem {
27
+ readonly kind: ProblemKind;
28
+ readonly offset: number;
29
+ /**
30
+ * The construct, quoted as the plugin reads it, before it is cut for the report.
31
+ */
32
+ readonly construct: string;
33
+ /**
34
+ * The sentence after the construct.
35
+ */
36
+ readonly text: string;
37
+ /**
38
+ * For an unknown atom with no near candidate: the report closes with `Available:`.
39
+ */
40
+ readonly needsAvailable?: boolean;
41
+ /**
42
+ * For a re-export: whether listing the module in `cxModules` would clear it, which it does not
43
+ * when the module re-exports the `cx` of a module that is already listed (a second hop).
44
+ */
45
+ readonly isListable?: boolean;
46
+ /**
47
+ * For a re-export of Nave's `cx`: whether it gives `cx` under a name other than `cx`, as a default
48
+ * or inside a namespace. A listed module may not do that, so listing the module would only turn
49
+ * this problem into another one: no `cxModules` entry clears it.
50
+ */
51
+ readonly isRenamed?: boolean;
52
+ /**
53
+ * For a problem that gives Nave's `cx` out of its module, or a namespace holding it, or the `cx`
54
+ * of a module listed in `cxModules`: the names it is exported under (`default` for the default
55
+ * export), so a build-end check can tell whether an importer takes it.
56
+ */
57
+ readonly exportedAs?: readonly string[];
58
+ /**
59
+ * For a problem in a module listed in `cxModules`: whether the module also exports Nave's own
60
+ * `cx`. An importer's `cx` is then Nave's, so what the build says of its calls is not an echo of
61
+ * this problem and stays when the problem is reported.
62
+ */
63
+ readonly hasNaveCx?: boolean;
64
+ }
65
+
66
+ /**
67
+ * Replaces the text from `start` up to `end` of the module with `text`.
68
+ */
69
+ interface Edit {
70
+ readonly start: number;
71
+ readonly end: number;
72
+ readonly text: string;
73
+ }
74
+
75
+ /**
76
+ * What a compiled Vue component's script exposes to its template, and how a template reads it:
77
+ * `$setup.<name>`.
78
+ */
79
+
80
+ type SetupExposure = {
81
+ readonly kind: 'cx';
82
+ } | {
83
+ readonly kind: 'values';
84
+ readonly values: readonly string[];
85
+ };
86
+ type SetupExposures = ReadonlyMap<string, SetupExposure>;
87
+
88
+ interface ReadOptions {
89
+ /**
90
+ * The import specifiers that bind Nave's `cx`: its own module, and every module listed in
91
+ * `cxModules` that this module imports.
92
+ */
93
+ readonly cxSources: ReadonlySet<string>;
94
+ /**
95
+ * The specifiers in `cxSources` that name a module listed in `cxModules`.
96
+ */
97
+ readonly declaredSources?: ReadonlySet<string>;
98
+ /**
99
+ * Whether this module is itself listed in `cxModules`, so its exports of `cx` are judged as a
100
+ * listed module's.
101
+ */
102
+ readonly isDeclared?: boolean;
103
+ /**
104
+ * The names of the consumer's own atoms, which have no class.
105
+ */
106
+ readonly ownAtoms: ReadonlySet<string>;
107
+ /**
108
+ * Whether this module belongs to a dependency, where a Nave class built from pieces is only
109
+ * refused if the module also imports `cx`.
110
+ */
111
+ readonly isDependency: boolean;
112
+ /**
113
+ * For a compiled Vue template: what its component's script exposes to it.
114
+ */
115
+ readonly setup?: SetupExposures | undefined;
116
+ /**
117
+ * Whether the module is a compiled Vue component's `<script setup>`.
118
+ */
119
+ readonly isVueScript?: boolean;
120
+ /**
121
+ * Set in a build: the reading also returns the edits that turn each call it read into the
122
+ * string the call returns, and `keep` is the map a `cx.dynamic()` call looks a name up in.
123
+ */
124
+ readonly rewrite?: {
125
+ readonly keep: Readonly<Record<string, string>>;
126
+ };
127
+ }
128
+ interface ModuleReading {
129
+ /**
130
+ * Built-in atoms named by a readable `cx()` call.
131
+ */
132
+ readonly atoms: Set<string>;
133
+ /**
134
+ * Built-in atoms whose class is written whole in the module.
135
+ */
136
+ readonly classes: Set<string>;
137
+ readonly problems: Problem[];
138
+ /**
139
+ * Where `cx.dynamic()` is called, and the call as the plugin reads it.
140
+ */
141
+ readonly dynamicCalls: {
142
+ readonly construct: string;
143
+ readonly offset: number;
144
+ }[];
145
+ /**
146
+ * For a compiled Vue `<script setup>`: what it exposes to its template.
147
+ */
148
+ readonly exposes: Map<string, SetupExposure>;
149
+ /**
150
+ * Whether the module imports from a `cx` source, whether or not it uses the import.
151
+ */
152
+ readonly usesCx: boolean;
153
+ /**
154
+ * With `rewrite` set: the edits that replace the calls the reading found, empty otherwise.
155
+ */
156
+ readonly edits: Edit[];
157
+ }
158
+
159
+ /**
160
+ * Reads one module for the atoms its `cx()` calls and written classes name, and for everything
161
+ * in it the build cannot read. Pure: it takes the parsed module and returns what it found, so the
162
+ * host (the post-order plugin) decides where the findings go.
163
+ */
164
+
165
+ declare const CX_SOURCE = "@navecss/core/cx";
166
+
167
+ /**
168
+ * Reads `program`, the parse of `code`.
169
+ */
170
+ declare function readModule(code: string, program: AstNode, options: ReadOptions): ModuleReading;
171
+
172
+ /**
173
+ * What an importer takes from a module that gives out Nave's `cx`: which of its `cx` exports it
174
+ * imports, re-exports or reads off a namespace. The test is by name, not by file: an importer that
175
+ * takes only `Button` from a module which also exports `cx` as `cn` takes no `cx` from it, so
176
+ * nothing of its own routes calls through `cn`. A take the parse cannot tell apart (a namespace
177
+ * passed on, a computed key, a rest element, an `import()` used any other way) counts as taken, and
178
+ * so does an importer whose text names the module in no way the build reads (a `require()`).
179
+ */
180
+
181
+ /**
182
+ * How an importer takes the module: by the names it imports or re-exports, as a namespace, as
183
+ * `export *`, as an `import()`, or in a way the build cannot read.
184
+ */
185
+ type TakeShape = 'dynamic-import' | 'names' | 'namespace' | 'star' | 'unreadable';
186
+ interface Taken {
187
+ readonly shape: TakeShape;
188
+ /**
189
+ * The `cx` exports the importer takes by name; none when it takes the module whole.
190
+ */
191
+ readonly names: readonly string[];
192
+ /**
193
+ * Whether the importer only passes on what it takes: a named re-export, or an import that it
194
+ * then exports.
195
+ */
196
+ readonly isPassedOn?: boolean;
197
+ /**
198
+ * Whether the importer does nothing with what it takes but re-export it: `export ... from`, or an
199
+ * import that every use of is an export. A forward is followed to what takes it; it is not a
200
+ * take on the `cxModules` route.
201
+ */
202
+ readonly isForward?: boolean;
203
+ /**
204
+ * Whether the take comes from what an earlier server command left in the cache directory.
205
+ */
206
+ readonly isRecorded?: boolean;
207
+ }
208
+ interface Take extends Taken {
209
+ /**
210
+ * The importer's path, relative to the project root, with forward slashes.
211
+ */
212
+ readonly taker: string;
213
+ /**
214
+ * Whether the module taken from is reached through another module of its package, which
215
+ * re-exports the `cx` it gives out.
216
+ */
217
+ readonly isReached: boolean;
218
+ }
219
+
220
+ /**
221
+ * The report a build fails with when it meets a use it cannot read: a first line counting the
222
+ * problems and stating the cause, one line per problem with a 1-based, root-relative position,
223
+ * and the remedy block printed once, last. Under the default nobody set the option, so the first
224
+ * line never names it, and no remedy printed for application code is `atomic: 'all'`: an agent
225
+ * takes the first remedy that clears the error, and that one always does.
226
+ */
227
+
228
+ interface LocatedProblem extends Problem {
229
+ /**
230
+ * The module's path, relative to the project root, with forward slashes.
231
+ */
232
+ readonly file: string;
233
+ readonly line: number;
234
+ readonly column: number;
235
+ /**
236
+ * Set when the source map does not lead to the authored position: `line` and `column` are then
237
+ * zero and mean nothing, and this is the sentence that ends the problem's line.
238
+ */
239
+ readonly unknownLine?: string | undefined;
240
+ /**
241
+ * The package name when the module lies under `node_modules`.
242
+ */
243
+ readonly pkg?: string | undefined;
244
+ /**
245
+ * The id of the module the problem is in, for a problem the build-end check looks into the
246
+ * module graph for.
247
+ */
248
+ readonly moduleId?: string | undefined;
249
+ /**
250
+ * For a dependency's re-export of `cx`: the specifier that resolves from the project root to the
251
+ * module that holds it, when a `cxModules` entry can name it.
252
+ */
253
+ readonly specifier?: string | undefined;
254
+ /**
255
+ * For a dependency's listed module that exports a `cx` the build does not follow: the
256
+ * `cxModules` entries, as written, that name it.
257
+ */
258
+ readonly entries?: readonly string[] | undefined;
259
+ /**
260
+ * For a module of a package `keepFor` lists that gives `cx` out under another name: the
261
+ * application modules that take one of its `cx` exports, which `keepFor` does not clear.
262
+ */
263
+ readonly takes?: readonly Take[] | undefined;
264
+ /**
265
+ * For a dependency module that re-exports the `cx` of a module `cxModules` lists: the modules of
266
+ * other dependencies that call through it, root-relative, which only the package's `keepFor`
267
+ * entry can stand in for.
268
+ */
269
+ readonly callers?: readonly string[] | undefined;
270
+ }
271
+ declare const REPORT_CAUSE = "the build cannot tell which atoms these apply, and it ships only the atoms it can read.";
272
+ /**
273
+ * The build report for every problem of an environment. `configured` is the `cxModules` list the
274
+ * remedies that print one extend, and `home` is how the host spells where the options are written,
275
+ * the call of its plugin or its wrapper: the one place the report names its host.
276
+ */
277
+ declare function buildReport(problems: readonly LocatedProblem[], configured: readonly string[], home: string): string;
278
+
279
+ export { type AstNode, CX_SOURCE, type LocatedProblem, type ModuleReading, type Problem, type ProblemKind, REPORT_CAUSE, type ReadOptions, buildReport, readModule };
@@ -0,0 +1,4 @@
1
+ export { CX_SOURCE, REPORT_CAUSE, assertOptions, buildReport, keptAtoms, readModule, resolveUsedOptions } from './chunk-E5F6YF7A.js';
2
+ import './chunk-SYNQJNVB.js';
3
+ import './chunk-CUL5PLPI.js';
4
+ import './chunk-GZL2VW7C.js';
package/dist/cx.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AtomName } from './atoms.js';
1
+ import { A as AtomName } from './atom-names-2OreuBx9.js';
2
2
 
3
3
  /**
4
4
  * cx — typed atomic class composer for Nave.
package/dist/cx.js CHANGED
@@ -1,12 +1,25 @@
1
- import { atomClassMap } from './chunk-LIUB4EES.js';
1
+ import { atomClassMap } from './chunk-GZL2VW7C.js';
2
2
 
3
3
  // src/cx.ts
4
+ var decodedKeep = /* @__PURE__ */ new Map();
5
+ function decodedMap(text) {
6
+ let map = decodedKeep.get(text);
7
+ if (map === void 0) {
8
+ map = JSON.parse(text);
9
+ decodedKeep.set(text, map);
10
+ }
11
+ return map;
12
+ }
4
13
  var cx = (...args) => args.filter(Boolean).map(
5
14
  (arg) => Object.hasOwn(atomClassMap, arg) ? atomClassMap[arg] : arg
6
15
  ).join(" ");
7
16
  cx.raw = (...args) => args.filter(Boolean).join(" ");
8
17
  cx.dynamic = (name) => {
9
18
  if (!name) return "";
19
+ if (typeof __NAVE_KEEP_CLASSES__ === "string") {
20
+ const decoded = decodedMap(__NAVE_KEEP_CLASSES__);
21
+ return Object.hasOwn(decoded, name) ? decoded[name] ?? "" : "";
22
+ }
10
23
  const map = typeof __NAVE_KEEP_CLASSES__ === "undefined" ? atomClassMap : __NAVE_KEEP_CLASSES__;
11
24
  return Object.hasOwn(map, name) ? map[name] : "";
12
25
  };
@@ -1,4 +1,5 @@
1
1
  import { AtomDefinition } from './atoms.js';
2
+ import './atom-names-2OreuBx9.js';
2
3
 
3
4
  interface NaveLightningOptions {
4
5
  /**
@@ -1,8 +1,10 @@
1
- import { splitByteOrderMark, warningTexts, foldedText } from './chunk-IZQLFUQU.js';
2
- import { validateExtendAtomsHostFree } from './chunk-R6JJZGXC.js';
3
- import { snapshotExtendMap, expandText } from './chunk-S7DZUVV3.js';
1
+ import { splitByteOrderMark, warningTexts, foldedText } from './chunk-2A7IUZBH.js';
2
+ import { validateExtendAtomsHostFree } from './chunk-LQSGQ2OA.js';
3
+ import { snapshotExtendMap, expandText } from './chunk-LADFXRWQ.js';
4
4
  import './chunk-NFS2REPQ.js';
5
- import './chunk-LIUB4EES.js';
5
+ import './chunk-SYNQJNVB.js';
6
+ import './chunk-CUL5PLPI.js';
7
+ import './chunk-GZL2VW7C.js';
6
8
  import { readFileSync } from 'fs';
7
9
 
8
10
  function report(diagnostics, file, extend, onUnknown) {
package/dist/postcss.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Plugin } from 'postcss';
2
2
  import { AtomDefinition } from './atoms.js';
3
+ import './atom-names-2OreuBx9.js';
3
4
 
4
5
  /**
5
6
  * Nave PostCSS plugin — resolves @nave directives.
package/dist/postcss.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { resolveExtendSpecifier, applyExtendModule } from './chunk-NKUZNRF4.js';
2
- import { snapshotExtendMap, walkExtendAtoms, foldLocated, anchorSelectorList, plan, formatDiagnostic, WORKAROUND_GROUP_AT_RULE_NAMES } from './chunk-S7DZUVV3.js';
2
+ import { snapshotExtendMap, walkExtendAtoms, foldLocated, anchorSelectorList, plan, WORKAROUND_GROUP_AT_RULE_NAMES } from './chunk-LADFXRWQ.js';
3
3
  import { tokenize } from './chunk-NFS2REPQ.js';
4
- import './chunk-LIUB4EES.js';
4
+ import { formatDiagnostic } from './chunk-SYNQJNVB.js';
5
+ import './chunk-CUL5PLPI.js';
6
+ import './chunk-GZL2VW7C.js';
5
7
  import postcss from 'postcss';
6
8
 
7
9
  // src/postcss-nested-builders.ts
@@ -475,6 +475,7 @@
475
475
  --nave-color-action-primary-active: light-dark(oklch(0.27 0.0398 186.17), oklch(0.94 0.0574 186.17));
476
476
  --nave-color-on-action-primary: light-dark(oklch(from var(--nave-color-tint) 1 0 h / 1), oklch(from var(--nave-color-tint) 0.18 0.0067 h / 1));
477
477
  --nave-color-action-secondary: light-dark(oklch(from var(--nave-color-tint) 0.965 0.0067 h / 1), oklch(from var(--nave-color-tint) 0.27 0.0067 h / 1));
478
+ --nave-color-action-highlight: light-dark(oklch(from var(--nave-color-tint) 0.965 0.0067 h / 1), oklch(from var(--nave-color-tint) 0.37 0.0067 h / 1));
478
479
  --nave-color-feedback-danger: light-dark(oklch(0.47 0.1455 15.02), oklch(0.835 0.0661 15.02));
479
480
  --nave-color-feedback-danger-foreground: light-dark(oklch(0.47 0.1455 15.02), oklch(0.835 0.0661 15.02));
480
481
  --nave-color-on-feedback-danger: light-dark(oklch(from var(--nave-color-tint) 1 0 h / 1), oklch(from var(--nave-color-tint) 0.18 0.0067 h / 1));
@@ -488,6 +489,7 @@
488
489
  --nave-color-feedback-info: light-dark(oklch(from var(--nave-color-tint) 0.47 0.0067 h / 1), oklch(from var(--nave-color-tint) 0.835 0.0067 h / 1));
489
490
  --nave-color-feedback-info-foreground: light-dark(oklch(from var(--nave-color-tint) 0.47 0.0067 h / 1), oklch(from var(--nave-color-tint) 0.835 0.0067 h / 1));
490
491
  --nave-color-on-feedback-info: light-dark(oklch(from var(--nave-color-tint) 1 0 h / 1), oklch(from var(--nave-color-tint) 0.18 0.0067 h / 1));
492
+ --nave-color-backdrop-modal: light-dark(oklch(from var(--nave-color-tint) 0.12 0.0067 h / 0.3), oklch(from var(--nave-color-tint) 0.12 0.0067 h / 0.6));
491
493
  }
492
494
  }
493
495
 
@@ -0,0 +1,86 @@
1
+ import { A as AtomName } from './atom-names-2OreuBx9.js';
2
+
3
+ /**
4
+ * The options that choose which atoms the Vite plugin ships, and their validation. A value a
5
+ * type would refuse in TypeScript is refused here too, so a JavaScript config gets the same
6
+ * answer; every text opens `navePlugin(): `, the prefix of the plugin's config-level messages.
7
+ */
8
+
9
+ interface UsedAtomOptions {
10
+ /**
11
+ * Which atoms the build ships. `'used'` (the default): the atoms your `cx()` calls and your
12
+ * written Nave classes name, plus those in `keep` and `keepFor`. Under the default the build
13
+ * filters the atomic layer of every stylesheet it can reach, and the dev server serves the same
14
+ * set as far as it has read; a stylesheet imported with `?inline` or `?raw` ships every atom
15
+ * with a warning; a `cx()` call whose atoms the build cannot read fails the build, and is an
16
+ * error in the dev server. In a build, each `cx()` call the plugin read also becomes the class
17
+ * string it returns.
18
+ * `'all'`: every atom, and no `cx()` call is read or rewritten, as with the PostCSS plugin.
19
+ */
20
+ atomic?: 'all' | 'used';
21
+ /**
22
+ * Atoms always shipped, whether or not the build reads a use of them: every atom your own
23
+ * `cx.dynamic()` calls can take, and the atom of each Nave class written where the build cannot
24
+ * read it, such as in a server template or in CMS text.
25
+ */
26
+ keep?: readonly AtomName[];
27
+ /**
28
+ * By package name: the atoms a dependency's own `cx()` calls can produce, for a package whose
29
+ * calls the build cannot read. They ship as if they were in `keep`, beside the atoms of the
30
+ * package's calls the build does read. The calls it cannot read are not changed, so any other
31
+ * atom they apply has no rule unless the build ships it for another reason. An empty list is
32
+ * accepted: it says those calls produce no atom, so the list adds none, and a `cx.dynamic()` call
33
+ * in the package still fails the build, as it does with no entry. A package in your own workspace
34
+ * is your code, not a dependency. The entry stands in for the package's own calls only: a
35
+ * re-export of `cx` in the package that the build reads and a module of yours takes (imports,
36
+ * re-exports or reads off a namespace, directly or through re-exports of it that the build reads,
37
+ * as `export ... from` or an import exported unchanged, in this package or another) still fails
38
+ * the build, because the calls your module makes through it would ship with no rule, and the
39
+ * message says how to clear it. Listing here a package that only re-exports it does not clear a
40
+ * take of yours, since a re-export is not a call. A server build that leaves the package external
41
+ * does not read it, so a take only your server code makes is judged by what the client build
42
+ * read: it fails the build as above when the client build read the re-export it takes and the
43
+ * build can read the take, and gets a warning naming `ssr.noExternal` when the build cannot tell,
44
+ * because no environment read the file the server loads, or your file reaches the package in a
45
+ * way the build cannot read as a take (a `require()`, say, or a `#` import); with separate client
46
+ * and server commands, the next client command judges what the last build of each server recorded
47
+ * of server files that still exist.
48
+ */
49
+ keepFor?: Readonly<Record<string, readonly AtomName[]>>;
50
+ /**
51
+ * Modules that re-export `cx` from `@navecss/core/cx` unchanged, as
52
+ * `export { cx } from '@navecss/core/cx'`, in your code or in a dependency: a file that imports
53
+ * `cx` from one is read as if it imported it from `@navecss/core/cx`. The build follows a listed
54
+ * module one step. A relative entry (`'./src/ui/index.ts'`) is a path from Vite's `root`. A
55
+ * package name or subpath, an alias or an absolute path matches an import written the same way.
56
+ * A `#` entry matches an import written the same way only where that import resolves to a listed
57
+ * file, since a `#` import resolves through the `package.json` nearest the file that writes it.
58
+ * Every entry also matches an import that resolves to its file through a specifier naming that
59
+ * file or, for an `index` file, its directory; in your code, an import that reaches the file
60
+ * through any other specifier fails the build instead. A relative entry that resolves to no file
61
+ * is ignored, and so is an entry naming `@navecss/core/cx`, which the build always reads. The
62
+ * same setting, with the same entries, as `@navecss/eslint-plugin`'s `cxModules`, which reads a
63
+ * relative entry from the working directory instead of Vite's `root`.
64
+ */
65
+ cxModules?: readonly string[];
66
+ }
67
+ interface ResolvedUsedOptions {
68
+ readonly atomic: 'all' | 'used';
69
+ readonly keep: readonly string[];
70
+ readonly keepFor: Readonly<Record<string, readonly string[]>>;
71
+ readonly cxModules: readonly string[];
72
+ }
73
+ /**
74
+ * Throws the first problem in the options, if there is one.
75
+ */
76
+ declare function assertOptions(options: UsedAtomOptions | ResolvedUsedOptions, own: ReadonlySet<string> | undefined): void;
77
+ /**
78
+ * The options with their defaults filled in.
79
+ */
80
+ declare function resolveUsedOptions(options: UsedAtomOptions): ResolvedUsedOptions;
81
+ /**
82
+ * Every atom the options always ship: `keep` and every `keepFor` list.
83
+ */
84
+ declare function keptAtoms(options: ResolvedUsedOptions): string[];
85
+
86
+ export { type ResolvedUsedOptions as R, type UsedAtomOptions as U, assertOptions as a, keptAtoms as k, resolveUsedOptions as r };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { AtomName, AtomDefinition } from './atoms.js';
1
+ import { AtomDefinition } from './atoms.js';
2
+ import { U as UsedAtomOptions } from './vite-options-D1-hGA9L.js';
3
+ import './atom-names-2OreuBx9.js';
2
4
 
3
5
  /**
4
6
  * The few shapes of Vite's (and Rollup's) own objects the plugin touches, declared here rather
@@ -219,70 +221,6 @@ interface TransformResultLike {
219
221
  readonly map: string;
220
222
  }
221
223
 
222
- /**
223
- * The options that choose which atoms the Vite plugin ships, and their validation. A value a
224
- * type would refuse in TypeScript is refused here too, so a JavaScript config gets the same
225
- * answer; every text opens `navePlugin(): `, the prefix of the plugin's config-level messages.
226
- */
227
-
228
- interface UsedAtomOptions {
229
- /**
230
- * Which atoms the build ships. `'used'` (the default): the atoms your `cx()` calls and your
231
- * written Nave classes name, plus those in `keep` and `keepFor`. Under the default the build
232
- * filters the atomic layer of every stylesheet it can reach, and the dev server serves the same
233
- * set as far as it has read; a stylesheet imported with `?inline` or `?raw` ships every atom
234
- * with a warning; a `cx()` call whose atoms the build cannot read fails the build, and is an
235
- * error in the dev server.
236
- * `'all'`: every atom, and no `cx()` call is read, as with the PostCSS plugin.
237
- */
238
- atomic?: 'all' | 'used';
239
- /**
240
- * Atoms always shipped, whether or not the build reads a use of them: every atom your own
241
- * `cx.dynamic()` calls can take, and the atom of each Nave class written where the build cannot
242
- * read it, such as in a server template or in CMS text.
243
- */
244
- keep?: readonly AtomName[];
245
- /**
246
- * By package name: the atoms a dependency's own `cx()` calls can produce, for a package whose
247
- * calls the build cannot read. They ship as if they were in `keep`, beside the atoms of the
248
- * package's calls the build does read. The calls it cannot read are not changed, so any other
249
- * atom they apply has no rule unless the build ships it for another reason. An empty list is
250
- * accepted: it says those calls produce no atom, so the list adds none, and a `cx.dynamic()` call
251
- * in the package still fails the build, as it does with no entry. A package in your own workspace
252
- * is your code, not a dependency. The entry stands in for the package's own calls only: a
253
- * re-export of `cx` in the package that the build reads and a module of yours takes (imports,
254
- * re-exports or reads off a namespace, directly or through re-exports of it that the build reads,
255
- * as `export ... from` or an import exported unchanged, in this package or another) still fails
256
- * the build, because the calls your module makes through it would ship with no rule, and the
257
- * message says how to clear it. Listing here a package that only re-exports it does not clear a
258
- * take of yours, since a re-export is not a call. A server build that leaves the package external
259
- * does not read it, so a take only your server code makes is judged by what the client build
260
- * read: it fails the build as above when the client build read the re-export it takes and the
261
- * build can read the take, and gets a warning naming `ssr.noExternal` when the build cannot tell,
262
- * because no environment read the file the server loads, or your file reaches the package in a
263
- * way the build cannot read as a take (a `require()`, say, or a `#` import); with separate client
264
- * and server commands, the next client command judges what the last build of each server recorded
265
- * of server files that still exist.
266
- */
267
- keepFor?: Readonly<Record<string, readonly AtomName[]>>;
268
- /**
269
- * Modules that re-export `cx` from `@navecss/core/cx` unchanged, as
270
- * `export { cx } from '@navecss/core/cx'`, in your code or in a dependency: a file that imports
271
- * `cx` from one is read as if it imported it from `@navecss/core/cx`. The build follows a listed
272
- * module one step. A relative entry (`'./src/ui/index.ts'`) is a path from Vite's `root`. A
273
- * package name or subpath, an alias or an absolute path matches an import written the same way.
274
- * A `#` entry matches an import written the same way only where that import resolves to a listed
275
- * file, since a `#` import resolves through the `package.json` nearest the file that writes it.
276
- * Every entry also matches an import that resolves to its file through a specifier naming that
277
- * file or, for an `index` file, its directory; in your code, an import that reaches the file
278
- * through any other specifier fails the build instead. A relative entry that resolves to no file
279
- * is ignored, and so is an entry naming `@navecss/core/cx`, which the build always reads. The
280
- * same setting, with the same entries, as `@navecss/eslint-plugin`'s `cxModules`, which reads a
281
- * relative entry from the working directory instead of Vite's `root`.
282
- */
283
- cxModules?: readonly string[];
284
- }
285
-
286
224
  interface HtmlHook {
287
225
  readonly order: 'pre';
288
226
  handler(html: string, context: {
@@ -292,7 +230,7 @@ interface HtmlHook {
292
230
  interface NaveCollectPlugin {
293
231
  readonly name: 'nave:collect';
294
232
  readonly enforce: 'post';
295
- transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<undefined>;
233
+ transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<TransformResultLike | undefined>;
296
234
  readonly transformIndexHtml: HtmlHook;
297
235
  buildStart(this: RenderContext): Promise<void>;
298
236
  buildEnd(this: RenderContext, error?: unknown): Promise<void>;
@@ -310,7 +248,7 @@ interface NaveCollectPlugin {
310
248
  interface NaveWorkerPlugin {
311
249
  readonly name: 'nave:collect-worker';
312
250
  readonly enforce: 'post';
313
- transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<undefined>;
251
+ transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<TransformResultLike | undefined>;
314
252
  buildEnd(this: RenderContext, error?: unknown): Promise<void>;
315
253
  }
316
254