@uniflowed/config 0.0.0-alpha.13 → 0.0.0-alpha.15
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 +1 -0
- package/internal/schema.js +127 -0
- package/package.json +1 -1
package/index.js
CHANGED
package/internal/schema.js
CHANGED
|
@@ -25,6 +25,37 @@ export type TaskDefinition =
|
|
|
25
25
|
|
|
26
26
|
export type CapabilityJsHost = "node" | "deno" | "bun";
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* What the project's own code may reach.
|
|
30
|
+
*
|
|
31
|
+
* Absent from `uf.config.js` means no permission model: the toolchain starts
|
|
32
|
+
* its host the way it always has. Present means **deny by default** — the
|
|
33
|
+
* project's code gets what is listed and nothing else — and `permissions: {}`
|
|
34
|
+
* is a legitimate thing to write, meaning "nothing beyond what uf itself needs
|
|
35
|
+
* to load and transform the project". There is deliberately no way to spell
|
|
36
|
+
* "everything"; a project that wants everything does not declare a set.
|
|
37
|
+
*
|
|
38
|
+
* Every field is a list of literal strings, because `uf.config.js` is read as
|
|
39
|
+
* text and parsed as JSON5 rather than executed: a computed path or a
|
|
40
|
+
* `process.env` read here would not parse.
|
|
41
|
+
*
|
|
42
|
+
* The set is uf's, not a runtime's. Node.js enforces `read` and `write`, Deno
|
|
43
|
+
* enforces all five, and Bun has no permission model at all — a host that
|
|
44
|
+
* cannot enforce what is declared **refuses the run** rather than applying part
|
|
45
|
+
* of it. `docs/hosts.md` is the table.
|
|
46
|
+
*
|
|
47
|
+
* The declared paths are *added to* the ones uf needs to run the project, so
|
|
48
|
+
* what a set denies is the rest of the machine — `~/.ssh`, the network, the
|
|
49
|
+
* environment — and not the project's own files.
|
|
50
|
+
*/
|
|
51
|
+
export type Permissions = {
|
|
52
|
+
readonly read?: $ReadOnlyArray<string>,
|
|
53
|
+
readonly write?: $ReadOnlyArray<string>,
|
|
54
|
+
readonly net?: $ReadOnlyArray<string>,
|
|
55
|
+
readonly env?: $ReadOnlyArray<string>,
|
|
56
|
+
readonly run?: $ReadOnlyArray<string>,
|
|
57
|
+
};
|
|
58
|
+
|
|
28
59
|
/**
|
|
29
60
|
* Percentages a coverage gate requires, as whole numbers between 0 and 100.
|
|
30
61
|
*
|
|
@@ -93,6 +124,27 @@ export type UniflowedConfig = {
|
|
|
93
124
|
// faces `uf_assets::font::LOCAL_FACES` knows the metrics of, because
|
|
94
125
|
// the scaling is a ratio against real numbers rather than a guess.
|
|
95
126
|
readonly fallback?: string,
|
|
127
|
+
// How an imported family is cut down. `"none"` is the default and the
|
|
128
|
+
// argued position: subsetting is lossy, and a build cannot see the
|
|
129
|
+
// text a server will render or a user will type. `"ranges"` splits the
|
|
130
|
+
// font's own coverage into script buckets with exact `unicode-range`
|
|
131
|
+
// values and loses nothing.
|
|
132
|
+
readonly subset?: "none" | "ranges",
|
|
133
|
+
// Whether `Font` preloads the primary face. Exactly one file is ever
|
|
134
|
+
// preloaded, however many buckets a split produced.
|
|
135
|
+
readonly preload?: boolean,
|
|
136
|
+
},
|
|
137
|
+
readonly icons?: {
|
|
138
|
+
readonly enabled?: boolean,
|
|
139
|
+
// Where `uf:icon/<name>` looks for `<name>.svg`, from the project
|
|
140
|
+
// root. A directory rather than a claim on `.svg`, which stays Vite's.
|
|
141
|
+
readonly dir?: string,
|
|
142
|
+
},
|
|
143
|
+
readonly og?: {
|
|
144
|
+
readonly enabled?: boolean,
|
|
145
|
+
// The typeface every `*.og.json` is drawn with unless it names its
|
|
146
|
+
// own. uf embeds none, so a project that draws cards points at one.
|
|
147
|
+
readonly font?: string | null,
|
|
96
148
|
},
|
|
97
149
|
readonly motion?: {
|
|
98
150
|
readonly module?: "@uniflowed/motion",
|
|
@@ -147,6 +199,10 @@ export type UniflowedConfig = {
|
|
|
147
199
|
readonly entry?: string,
|
|
148
200
|
readonly root?: string,
|
|
149
201
|
readonly manifest?: string,
|
|
202
|
+
// Turning the file-system router off is what makes a project a
|
|
203
|
+
// **library** rather than an application, and `uf build` reads it: see
|
|
204
|
+
// `build.lib` below and docs/app/reference/config.
|
|
205
|
+
readonly enabled?: boolean,
|
|
150
206
|
},
|
|
151
207
|
readonly rendering?: {
|
|
152
208
|
readonly modes?: $ReadOnlyArray<"ppr" | "ssr" | "ssg" | "isr">,
|
|
@@ -161,8 +217,41 @@ export type UniflowedConfig = {
|
|
|
161
217
|
readonly build?: {
|
|
162
218
|
readonly entries?: $ReadOnlyArray<string>,
|
|
163
219
|
readonly outDir?: string,
|
|
220
|
+
// Prerender every route and leave no server bundle behind. Read together
|
|
221
|
+
// with `app.rendering.modes`; see docs/app/reference/config.
|
|
164
222
|
readonly staticBuild?: boolean,
|
|
165
223
|
readonly sourcemap?: boolean,
|
|
224
|
+
/**
|
|
225
|
+
* What a **library** build writes, for a project whose
|
|
226
|
+
* `app.router.enabled` is false.
|
|
227
|
+
*
|
|
228
|
+
* Never the switch. `app.router.enabled` decides which of the two builds
|
|
229
|
+
* `uf build` runs, and declaring this key in a project whose router is on
|
|
230
|
+
* is refused where the config is read rather than resolved by precedence.
|
|
231
|
+
* Every field has a default that builds what `uf new --lib` scaffolds, so
|
|
232
|
+
* a library ordinarily writes none of this.
|
|
233
|
+
*
|
|
234
|
+
* `"umd"` and `"iife"` are deliberately absent from `formats`: each needs
|
|
235
|
+
* a global name per entry, and what a Flow library's global should be is
|
|
236
|
+
* not a decision uf has made.
|
|
237
|
+
*/
|
|
238
|
+
readonly lib?: {
|
|
239
|
+
// The modules to build, relative to the project root. Each names its own
|
|
240
|
+
// output by its path — `internal/parse.js` is written to
|
|
241
|
+
// `dist/internal/parse.js` — so two entries cannot collide.
|
|
242
|
+
readonly entries?: $ReadOnlyArray<string>,
|
|
243
|
+
readonly formats?: $ReadOnlyArray<"es" | "cjs">,
|
|
244
|
+
// Package names to leave as imports *beyond* the ones the manifest
|
|
245
|
+
// declares. A library build already externalises `dependencies`,
|
|
246
|
+
// `peerDependencies`, `optionalDependencies` and the host's built-in
|
|
247
|
+
// modules; this is for what a manifest cannot say.
|
|
248
|
+
readonly external?: $ReadOnlyArray<string>,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
// Which builder uf drives. Vite is the default, not a dependency: any module
|
|
252
|
+
// satisfying the contract in docs/architecture.md can be named here.
|
|
253
|
+
readonly builder?: {
|
|
254
|
+
readonly module?: string,
|
|
166
255
|
},
|
|
167
256
|
readonly dev?: {
|
|
168
257
|
readonly host?: string,
|
|
@@ -216,12 +305,50 @@ export type UniflowedConfig = {
|
|
|
216
305
|
>,
|
|
217
306
|
readonly typescriptDeclarationsToFlow?: true,
|
|
218
307
|
},
|
|
308
|
+
readonly permissions?: Permissions,
|
|
219
309
|
readonly pm?: {
|
|
220
310
|
readonly module?: "@uniflowed/pm",
|
|
221
311
|
readonly resolver?: "uf-native",
|
|
222
312
|
readonly lockfile?: "uf.lock",
|
|
223
313
|
readonly storeDir?: string,
|
|
224
314
|
readonly allowLifecycleScripts?: false,
|
|
315
|
+
/**
|
|
316
|
+
* The registry uf *reads* from: packuments, provenance attestations, and
|
|
317
|
+
* the versions `uf update` reports against.
|
|
318
|
+
*
|
|
319
|
+
* Unset means `publish.registry`, which is where this lived until it
|
|
320
|
+
* turned out to be answering two questions with one value. A project that
|
|
321
|
+
* publishes to a company registry and installs through a read-through
|
|
322
|
+
* mirror sets both; one that has only ever set `publish.registry` keeps
|
|
323
|
+
* working and is told, once, which key to move to.
|
|
324
|
+
*/
|
|
325
|
+
readonly registry?: string,
|
|
326
|
+
/**
|
|
327
|
+
* Which registry answers for which scope: `{ "@company": "https://…" }`.
|
|
328
|
+
*
|
|
329
|
+
* A scope named here resolves from that registry **and nowhere else**.
|
|
330
|
+
* There is no fallback to the public registry, deliberately: publishing
|
|
331
|
+
* `@company/internal-thing` to npmjs and waiting for a resolver to fall
|
|
332
|
+
* back to it is the dependency-confusion attack, so the fallback is the
|
|
333
|
+
* vulnerability rather than a recovery from it. A name the bound registry
|
|
334
|
+
* does not have is an error that names the scope and the registry.
|
|
335
|
+
*
|
|
336
|
+
* uf refuses an install whose lockfile resolves a bound scope from
|
|
337
|
+
* somewhere else. It does not rewrite the project's `.npmrc`: the manager
|
|
338
|
+
* that resolves is the manager that has to be told, in its own
|
|
339
|
+
* configuration.
|
|
340
|
+
*/
|
|
341
|
+
readonly scopes?: { readonly [scope: string]: string },
|
|
342
|
+
/**
|
|
343
|
+
* How hard `uf install` looks at npm provenance attestations.
|
|
344
|
+
*
|
|
345
|
+
* `"report"`, the default, reads the attestation of every package the
|
|
346
|
+
* install brought in or moved: an attestation that is not about the
|
|
347
|
+
* tarball being installed stops the install, and a package with none is a
|
|
348
|
+
* line in the summary. `"off"` reads none, for a machine with no route to
|
|
349
|
+
* a registry.
|
|
350
|
+
*/
|
|
351
|
+
readonly provenance?: "report" | "off",
|
|
225
352
|
},
|
|
226
353
|
readonly rm?: {
|
|
227
354
|
readonly module?: "@uniflowed/rm",
|