@navecss/core 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONSUMER-ATOMS.md +15 -11
- package/LICENSE +22 -0
- package/README.md +285 -30
- package/dist/atom-names-B8Ud-7zD.d.ts +28 -0
- package/dist/atoms.d.ts +4 -13
- package/dist/atoms.js +2 -1
- package/dist/bin.js +101 -16
- package/dist/check.d.ts +2 -1
- package/dist/check.js +4 -3
- package/dist/{chunk-NFS2REPQ.js → chunk-2K5EBBF2.js} +1 -191
- package/dist/chunk-2TNTYI4L.js +7 -0
- package/dist/{chunk-R6JJZGXC.js → chunk-63H2FLGU.js} +3 -2
- package/dist/chunk-BCUK4M4P.js +2765 -0
- package/dist/{chunk-XQQCDUV6.js → chunk-CTFEYJBE.js} +1 -1
- package/dist/{chunk-LIUB4EES.js → chunk-CUL5PLPI.js} +1 -5
- package/dist/chunk-GZL2VW7C.js +57 -0
- package/dist/{chunk-IZQLFUQU.js → chunk-KKUYU75D.js} +9 -8
- package/dist/chunk-MWHZ26S4.js +4059 -0
- package/dist/chunk-SYNQJNVB.js +302 -0
- package/dist/chunk-UVHGEVMV.js +204 -0
- package/dist/{chunk-UANF3FGO.js → chunk-ZNTNLGEC.js} +2 -1
- package/dist/collect.d.ts +317 -0
- package/dist/collect.js +5 -0
- package/dist/css.d.ts +1 -0
- package/dist/cx.d.ts +1 -1
- package/dist/cx.js +14 -1
- package/dist/lightningcss.d.ts +3 -1
- package/dist/lightningcss.js +10 -5
- package/dist/postcss.d.ts +29 -2
- package/dist/postcss.js +334 -82
- package/dist/standalone.css +4 -0
- package/dist/vite-options-sOCeGn9B.d.ts +87 -0
- package/dist/vite.d.ts +27 -68
- package/dist/vite.js +1344 -3176
- package/package.json +58 -24
- package/skills/navecss/SKILL.md +16 -0
- package/dist/chunk-S7DZUVV3.js +0 -1386
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AtomDefinition } from './atoms.js';
|
|
2
|
+
import { UsedAtomOptions } from './collect.js';
|
|
3
|
+
import './atom-names-B8Ud-7zD.js';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* The few shapes of Vite's (and Rollup's) own objects the plugin touches, declared here rather
|
|
@@ -68,6 +70,9 @@ interface BuilderLike {
|
|
|
68
70
|
interface EnvironmentLike {
|
|
69
71
|
readonly name: string;
|
|
70
72
|
readonly config: {
|
|
73
|
+
readonly build?: {
|
|
74
|
+
readonly emitAssets?: boolean;
|
|
75
|
+
};
|
|
71
76
|
readonly command?: string;
|
|
72
77
|
readonly consumer: string;
|
|
73
78
|
readonly inlineConfig?: object;
|
|
@@ -213,74 +218,23 @@ interface BundleEntry {
|
|
|
213
218
|
readonly type: string;
|
|
214
219
|
readonly fileName: string;
|
|
215
220
|
readonly source?: string | Uint8Array;
|
|
216
|
-
}
|
|
217
|
-
interface TransformResultLike {
|
|
218
|
-
readonly code: string;
|
|
219
|
-
readonly map: string;
|
|
220
|
-
}
|
|
221
|
-
|
|
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
221
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
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.
|
|
222
|
+
* The names an asset was emitted under, and the files it was made from: they survive a
|
|
223
|
+
* renaming of the file.
|
|
266
224
|
*/
|
|
267
|
-
|
|
225
|
+
readonly names?: readonly string[];
|
|
226
|
+
readonly originalFileNames?: readonly string[];
|
|
268
227
|
/**
|
|
269
|
-
*
|
|
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`.
|
|
228
|
+
* What a chunk holds, and the stylesheets it imports.
|
|
282
229
|
*/
|
|
283
|
-
|
|
230
|
+
readonly modules?: Readonly<Record<string, unknown>>;
|
|
231
|
+
readonly viteMetadata?: {
|
|
232
|
+
readonly importedCss?: ReadonlySet<string>;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
interface TransformResultLike {
|
|
236
|
+
readonly code: string;
|
|
237
|
+
readonly map: string;
|
|
284
238
|
}
|
|
285
239
|
|
|
286
240
|
interface HtmlHook {
|
|
@@ -292,10 +246,14 @@ interface HtmlHook {
|
|
|
292
246
|
interface NaveCollectPlugin {
|
|
293
247
|
readonly name: 'nave:collect';
|
|
294
248
|
readonly enforce: 'post';
|
|
295
|
-
transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<undefined>;
|
|
249
|
+
transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<TransformResultLike | undefined>;
|
|
296
250
|
readonly transformIndexHtml: HtmlHook;
|
|
297
251
|
buildStart(this: RenderContext): Promise<void>;
|
|
298
252
|
buildEnd(this: RenderContext, error?: unknown): Promise<void>;
|
|
253
|
+
readonly generateBundle: {
|
|
254
|
+
handler(this: BundleContext, options: unknown, bundle: Record<string, BundleEntry>): void;
|
|
255
|
+
readonly order: 'pre';
|
|
256
|
+
};
|
|
299
257
|
}
|
|
300
258
|
|
|
301
259
|
/**
|
|
@@ -310,7 +268,7 @@ interface NaveCollectPlugin {
|
|
|
310
268
|
interface NaveWorkerPlugin {
|
|
311
269
|
readonly name: 'nave:collect-worker';
|
|
312
270
|
readonly enforce: 'post';
|
|
313
|
-
transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<undefined>;
|
|
271
|
+
transform(this: TransformContext, code: string, id: string, meta?: TransformMeta): Promise<TransformResultLike | undefined>;
|
|
314
272
|
buildEnd(this: RenderContext, error?: unknown): Promise<void>;
|
|
315
273
|
}
|
|
316
274
|
|
|
@@ -427,4 +385,5 @@ type NavePlugins = [NaveVitePlugin, NaveCollectPlugin];
|
|
|
427
385
|
*/
|
|
428
386
|
declare function navePlugin(options?: NaveViteOptions): NavePlugins;
|
|
429
387
|
|
|
430
|
-
export {
|
|
388
|
+
export { navePlugin as default, navePlugin };
|
|
389
|
+
export type { NavePlugins, NaveViteOptions, NaveVitePlugin };
|