@uniflowed/config 0.0.0-alpha.33 → 0.0.0-alpha.34
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/index.js +4 -0
- package/internal/schema.js +176 -13
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
// `@uniflowed/config`.
|
|
4
4
|
|
|
5
5
|
export type {
|
|
6
|
+
BuilderSpec,
|
|
6
7
|
CapabilityJsHost,
|
|
7
8
|
CoverageThresholds,
|
|
8
9
|
DeployAdapter,
|
|
9
10
|
PackageManagerPreference,
|
|
11
|
+
PackageManagerSpec,
|
|
10
12
|
Permissions,
|
|
11
13
|
PluginEntry,
|
|
12
14
|
RuleLevel,
|
|
13
15
|
RuntimeEngine,
|
|
16
|
+
RuntimeSpec,
|
|
14
17
|
SizeBudget,
|
|
15
18
|
TaskDefinition,
|
|
19
|
+
TestRunnerSpec,
|
|
16
20
|
UniflowedConfig,
|
|
17
21
|
} from "./internal/schema.js";
|
|
18
22
|
|
package/internal/schema.js
CHANGED
|
@@ -26,6 +26,17 @@
|
|
|
26
26
|
// parse — `orm.module` is `"@uniflowed/orm"` because there is one
|
|
27
27
|
// implementation, where the loader takes any string. Where this package means
|
|
28
28
|
// to be more opinionated than the parser, that is what these say.
|
|
29
|
+
//
|
|
30
|
+
// # What an editor shows
|
|
31
|
+
//
|
|
32
|
+
// `uf lsp` completes and explains `uf.config.js` from this file, compiled into
|
|
33
|
+
// the binary. A key's completion shows the comment directly above the key and
|
|
34
|
+
// the type as it is written here, and the members of a literal union are the
|
|
35
|
+
// values it offers — so a comment above a key is written for somebody typing
|
|
36
|
+
// that key. Either kind of comment counts above a key; above a type alias only
|
|
37
|
+
// a `/** */` block does, because the `//` notes on the aliases are this file's
|
|
38
|
+
// history rather than the key's meaning. `crates/uf_config/src/schema.rs` is
|
|
39
|
+
// the reader, and says exactly what it takes.
|
|
29
40
|
|
|
30
41
|
export type RuleLevel = "off" | "warn" | "error" | 0 | 1 | 2 | boolean;
|
|
31
42
|
|
|
@@ -95,6 +106,81 @@ export type DeployAdapter =
|
|
|
95
106
|
| "static"
|
|
96
107
|
| "container";
|
|
97
108
|
|
|
109
|
+
// # Tools, declared where they are used
|
|
110
|
+
//
|
|
111
|
+
// The four aliases below are strings to Flow and a grammar to uf, which reads
|
|
112
|
+
// every one of them where the config is read and refuses what it cannot run —
|
|
113
|
+
// naming the key, what was written, and what to write instead. They are
|
|
114
|
+
// aliases rather than bare `string` so the grammar has one place to be written
|
|
115
|
+
// down, and so an editor can find a tool-spec key by its type — which is what
|
|
116
|
+
// completion in `uf.config.js` keys on (ubugeeei-prod/uf#941). Rename one and
|
|
117
|
+
// that stops working without a type error anywhere.
|
|
118
|
+
//
|
|
119
|
+
// A spec is `name[@version]`, and what follows the `@` is one of three things:
|
|
120
|
+
//
|
|
121
|
+
// * nothing — `"node"` — the `node` on `PATH`, which is what every project
|
|
122
|
+
// got before it could say anything else;
|
|
123
|
+
// * a numeric prefix — `"node@26"`, `"bun@1.4"` — the newest release that
|
|
124
|
+
// starts with it, resolved once against the publisher's index and locked in
|
|
125
|
+
// `uf.lock`, so every machine runs the same release until somebody moves it;
|
|
126
|
+
// * a full version — `"pnpm@12.0.0"` — exactly that release.
|
|
127
|
+
//
|
|
128
|
+
// A range — `"node@^26"`, `"node@>=24"`, `"node@24.x"` — is refused: a range is
|
|
129
|
+
// not an environment, because it can resolve to a different release tomorrow.
|
|
130
|
+
// So is a tag such as `"node@lts"`, for the same reason. ubugeeei-prod/uf#940.
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A JavaScript runtime, and optionally which release of it: `"node"`,
|
|
134
|
+
* `"node@26"`, `"bun@1.3.5"`.
|
|
135
|
+
*
|
|
136
|
+
* The names are `node`, `bun` and `deno`. No version is the one on `PATH`; a
|
|
137
|
+
* prefix is the newest release that starts with it, locked in `uf.lock`; a full
|
|
138
|
+
* version is exactly that release. A range or a tag is refused.
|
|
139
|
+
*
|
|
140
|
+
* The type of `runtime`, `build.runtime` and `test.runtime`.
|
|
141
|
+
*/
|
|
142
|
+
export type RuntimeSpec = string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A package manager, and optionally which release of it: `"pnpm"`,
|
|
146
|
+
* `"pnpm@10"`, `"pnpm@12.0.0"`.
|
|
147
|
+
*
|
|
148
|
+
* The names are `npm`, `pnpm`, `yarn` and `bun`. Yarn's edition is its major
|
|
149
|
+
* version — `"yarn@1"` is Classic. No version is the one on `PATH`; a prefix is
|
|
150
|
+
* the newest release that starts with it, locked in `uf.lock`; a full version
|
|
151
|
+
* is exactly that release. A range or a tag is refused.
|
|
152
|
+
*
|
|
153
|
+
* The type of `packageManager`.
|
|
154
|
+
*/
|
|
155
|
+
export type PackageManagerSpec = string;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* What runs the test suite: `"uf"` or `"bun[@version]"`.
|
|
159
|
+
*
|
|
160
|
+
* `"uf"` is the runner built into uf, and the default; it takes no version,
|
|
161
|
+
* because it is the binary that is running. `"bun"` is `bun test`, on the Bun
|
|
162
|
+
* it names — so it also decides the test runtime when `test.runtime` is
|
|
163
|
+
* absent, and a `test.runtime` naming anything else is an error. The version
|
|
164
|
+
* follows the same grammar as a runtime's. `uf test` refuses a Bun runner until
|
|
165
|
+
* ubugeeei-prod/uf#942 lands, rather than running its own suite in its place.
|
|
166
|
+
*
|
|
167
|
+
* The type of `test.runner`.
|
|
168
|
+
*/
|
|
169
|
+
export type TestRunnerSpec = string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Which builder `uf dev`, `uf build`, `uf preview` and `uf start` drive:
|
|
173
|
+
* `"vite"`, or a module specifier.
|
|
174
|
+
*
|
|
175
|
+
* `"vite"` is `@uniflowed/vite`, the builder uf ships and the default. Any other
|
|
176
|
+
* string is a module specifier — a package found up `node_modules`, or a path
|
|
177
|
+
* starting with `.` or `/` that must stay inside the project — whose driver
|
|
178
|
+
* satisfies the contract in docs/architecture.md.
|
|
179
|
+
*
|
|
180
|
+
* The type of `build.builder`.
|
|
181
|
+
*/
|
|
182
|
+
export type BuilderSpec = string;
|
|
183
|
+
|
|
98
184
|
/**
|
|
99
185
|
* One entry of `plugins: [...]`.
|
|
100
186
|
*
|
|
@@ -443,10 +529,31 @@ export type UniflowedConfig = {
|
|
|
443
529
|
// modules; this is for what a manifest cannot say.
|
|
444
530
|
readonly external?: $ReadOnlyArray<string>,
|
|
445
531
|
},
|
|
532
|
+
/**
|
|
533
|
+
* What `uf dev`, `uf build` and `uf preview` run on, when it is not the
|
|
534
|
+
* top-level `runtime`: `"node@26"`.
|
|
535
|
+
*
|
|
536
|
+
* Read before `runtime`, so a project that builds on Node and tests on Bun
|
|
537
|
+
* can say so. See `RuntimeSpec` for the grammar.
|
|
538
|
+
*/
|
|
539
|
+
readonly runtime?: RuntimeSpec,
|
|
540
|
+
/**
|
|
541
|
+
* Which builder `uf dev`, `uf build`, `uf preview` and `uf start` drive:
|
|
542
|
+
* `"vite"`, or a module specifier.
|
|
543
|
+
*
|
|
544
|
+
* Vite is the default, not a dependency: any module satisfying the
|
|
545
|
+
* contract in docs/architecture.md can be named here. See `BuilderSpec`.
|
|
546
|
+
*/
|
|
547
|
+
readonly builder?: BuilderSpec,
|
|
446
548
|
},
|
|
447
|
-
// Which builder uf drives. Vite is the default, not a dependency: any module
|
|
448
|
-
// satisfying the contract in docs/architecture.md can be named here.
|
|
449
549
|
readonly builder?: {
|
|
550
|
+
/**
|
|
551
|
+
* The old spelling of `build.builder`.
|
|
552
|
+
*
|
|
553
|
+
* **Deprecated**, and read only when `build.builder` is absent; the two
|
|
554
|
+
* naming different builders is an error. `"@uniflowed/vite"` here is
|
|
555
|
+
* `builder: "vite"` there, and any other specifier moves as it is.
|
|
556
|
+
*/
|
|
450
557
|
readonly module?: string,
|
|
451
558
|
},
|
|
452
559
|
readonly dev?: {
|
|
@@ -474,7 +581,7 @@ export type UniflowedConfig = {
|
|
|
474
581
|
readonly deploy?: "void",
|
|
475
582
|
},
|
|
476
583
|
/**
|
|
477
|
-
* The `.env` cascade
|
|
584
|
+
* The `.env` cascade and the mode it is read for.
|
|
478
585
|
*
|
|
479
586
|
* `active` empty means the command decides — `development` for `uf dev`,
|
|
480
587
|
* `production` for a build, `test` for `uf test`. `files` empty selects the
|
|
@@ -483,8 +590,16 @@ export type UniflowedConfig = {
|
|
|
483
590
|
readonly env?: {
|
|
484
591
|
readonly active?: string,
|
|
485
592
|
readonly files?: $ReadOnlyArray<string>,
|
|
486
|
-
|
|
487
|
-
|
|
593
|
+
/**
|
|
594
|
+
* Runtimes and package managers by exact version — `{ node: "24.14.0" }`.
|
|
595
|
+
*
|
|
596
|
+
* **Deprecated.** It says which tools a project has and not what each is
|
|
597
|
+
* for, so a project that builds on Node and tests on Bun could not write
|
|
598
|
+
* that down. Declare each tool where it is used instead — `runtime`,
|
|
599
|
+
* `build.runtime`, `test.runtime` and `packageManager` — as
|
|
600
|
+
* `name@version`. It keeps working for `uf env install` and `uf env exec`,
|
|
601
|
+
* and a pin here that disagrees with one of those keys is an error.
|
|
602
|
+
*/
|
|
488
603
|
readonly toolchain?: { readonly [string]: string },
|
|
489
604
|
},
|
|
490
605
|
readonly fmt?: {
|
|
@@ -555,6 +670,14 @@ export type UniflowedConfig = {
|
|
|
555
670
|
>,
|
|
556
671
|
readonly typescriptDeclarationsToFlow?: true,
|
|
557
672
|
},
|
|
673
|
+
/**
|
|
674
|
+
* The package manager `uf install`, `uf add`, `uf update` and the rest drive,
|
|
675
|
+
* and optionally which release of it: `"pnpm@12.0.0"`.
|
|
676
|
+
*
|
|
677
|
+
* Read before `pm.packageManager` — its deprecated spelling — and before
|
|
678
|
+
* `package.json#packageManager` and the lockfile. See `PackageManagerSpec`.
|
|
679
|
+
*/
|
|
680
|
+
readonly packageManager?: PackageManagerSpec,
|
|
558
681
|
readonly permissions?: Permissions,
|
|
559
682
|
// Plugins the project adds, appended to uf's own and resolved in the order
|
|
560
683
|
// they are written. A name that names a file is code to run, so `uf_plugin`
|
|
@@ -566,6 +689,16 @@ export type UniflowedConfig = {
|
|
|
566
689
|
readonly lockfile?: "uf.lock",
|
|
567
690
|
readonly storeDir?: string,
|
|
568
691
|
readonly allowLifecycleScripts?: false,
|
|
692
|
+
/**
|
|
693
|
+
* The package manager uf drives, in the spelling that came before the
|
|
694
|
+
* top-level `packageManager`.
|
|
695
|
+
*
|
|
696
|
+
* **Deprecated** for the managers `packageManager` can name — write
|
|
697
|
+
* `packageManager: "pnpm"` rather than `pm: { packageManager: "pnpm" }`,
|
|
698
|
+
* and `"yarn@1"` for `"yarn-classic"` — and read only when that key is
|
|
699
|
+
* absent. The two naming different managers is an error. `"uf"`, uf's own
|
|
700
|
+
* resolver, has no other spelling and is not deprecated.
|
|
701
|
+
*/
|
|
569
702
|
readonly packageManager?: PackageManagerPreference,
|
|
570
703
|
/**
|
|
571
704
|
* The registry uf *reads* from: packuments, provenance attestations, and
|
|
@@ -614,6 +747,17 @@ export type UniflowedConfig = {
|
|
|
614
747
|
readonly apply?: "config-and-host",
|
|
615
748
|
readonly doctor?: boolean,
|
|
616
749
|
},
|
|
750
|
+
/**
|
|
751
|
+
* The runtime every command runs on unless a section names its own, and
|
|
752
|
+
* optionally which release of it: `"node@26"`.
|
|
753
|
+
*
|
|
754
|
+
* `uf start`, `uf run` and `uf exec` read it directly. `uf dev`, `uf build`
|
|
755
|
+
* and `uf preview` read `build.runtime` first; `uf test` reads `test.runtime`
|
|
756
|
+
* and the runtime its runner brings first. Absent, a command starts
|
|
757
|
+
* `app.runtime.capabilityJsHost` from `PATH`, as it always has. See
|
|
758
|
+
* `RuntimeSpec`.
|
|
759
|
+
*/
|
|
760
|
+
readonly runtime?: RuntimeSpec,
|
|
617
761
|
readonly server?: {
|
|
618
762
|
readonly engine?: "native-rust",
|
|
619
763
|
readonly native?: {
|
|
@@ -725,14 +869,33 @@ export type UniflowedConfig = {
|
|
|
725
869
|
},
|
|
726
870
|
readonly test?: {
|
|
727
871
|
readonly module?: "@uniflowed/test",
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
872
|
+
/**
|
|
873
|
+
* What `uf test` runs on, when it is neither the runtime the runner brings
|
|
874
|
+
* nor the top-level `runtime`: `"node@26"`.
|
|
875
|
+
*
|
|
876
|
+
* A runner that brings its own — `runner: "bun@1.4"` — decides this when it
|
|
877
|
+
* is absent, and a `runtime` here naming anything else is an error. See
|
|
878
|
+
* `RuntimeSpec`.
|
|
879
|
+
*/
|
|
880
|
+
readonly runtime?: RuntimeSpec,
|
|
881
|
+
/**
|
|
882
|
+
* What runs the suite: `"uf"`, the default, or `"bun[@version]"`. See
|
|
883
|
+
* `TestRunnerSpec`.
|
|
884
|
+
*
|
|
885
|
+
* The object is the old description of uf's own runner, field by field,
|
|
886
|
+
* and is **deprecated**: it still parses, and `applicationTarget` in it is
|
|
887
|
+
* still read. ubugeeei-prod/uf#953 is where that one field goes next.
|
|
888
|
+
*/
|
|
889
|
+
readonly runner?:
|
|
890
|
+
| TestRunnerSpec
|
|
891
|
+
| {
|
|
892
|
+
readonly applicationTarget?: "auto" | "web" | "react-native",
|
|
893
|
+
readonly runtime?: "vite-task" | "capability-js-host" | "uf-self-hosted",
|
|
894
|
+
readonly jsHosts?: $ReadOnlyArray<CapabilityJsHost>,
|
|
895
|
+
readonly scheduler?: "vite-task-cache" | "native-work-stealing",
|
|
896
|
+
readonly performanceTarget?: "vite-task" | "faster-than-bun",
|
|
897
|
+
readonly officialFlowParser?: true,
|
|
898
|
+
},
|
|
736
899
|
readonly reactTestingLibraryNative?: true,
|
|
737
900
|
/**
|
|
738
901
|
* What `uf test --coverage` measures, writes and fails on.
|