@ref0/workspace 0.11.0 → 0.13.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/README.md CHANGED
@@ -42,8 +42,9 @@ changes, beside its code, in the package too.
42
42
 
43
43
  `ref0-generic`'s rules: `seeded-properties`, `index-barrel-only` and `export-type-side-effects`,
44
44
  which `base.lint` turns on, and `effect-encoding`, `log-messages`, `env-at-entrypoints`,
45
- `entry-reexports`, `no-comments`, `package-imports` and `folder-imports`, which a repo turns on for
46
- its own files. `entry-reexports` takes the repo's root,
45
+ `entry-reexports`, `no-comments`, `package-imports`, `folder-imports`, `public-docs`,
46
+ `build-cache-inputs`, `pure-effect-fn`, `pure-top-level` and `effect-gen-wrappers`, which a repo
47
+ turns on for its own files. `entry-reexports` takes the repo's root,
47
48
  the folders of the packages whose entry files it checks, and the export condition that names an
48
49
  entry point's source:
49
50
 
@@ -104,6 +105,55 @@ export const folderLayers = {
104
105
  'ref0-generic/folder-imports': ['error', { root, sources: folderLayers }],
105
106
  ```
106
107
 
108
+ The rest take their options as below, with each options type in `@ref0/workspace/lint/graph`:
109
+
110
+ - `public-docs`: every name a public package publishes has a doc comment. It reads each published
111
+ entry's source through `condition`, or takes `entries`, files from the root.
112
+ - `build-cache-inputs`: each task `tasks` names lists, as cache input, the source, `package.json` and
113
+ `tsconfig.json` of each workspace package its package depends on, and each package's config
114
+ defines the first.
115
+ - `pure-effect-fn`: a top-level `Effect.fn` or `Effect.fnUntraced` carries `/* @__PURE__ */`. It
116
+ takes no options.
117
+ - `pure-top-level`: a top-level pure mark covers only a callee the repo lists in `callees`, each with
118
+ why it's pure, and with `requireMarks`, a listed call needs its mark, which `--fix` adds.
119
+ - `effect-gen-wrappers`: no function only returns `Effect.gen`. `allowed` names those that may, by
120
+ file and declaration, with why, and fails on one that no longer needs it.
121
+
122
+ ```ts
123
+ 'ref0-generic/public-docs': ['error', { root, packages: ['packages/*'], condition: '@ref0/source' }],
124
+ 'ref0-generic/build-cache-inputs': ['error', { root, packages: ['packages/*'], tasks: ['build:cached'] }],
125
+ 'ref0-generic/pure-top-level': ['error', { root, callees: pureCallees, requireMarks: true }],
126
+ 'ref0-generic/effect-gen-wrappers': ['error', { root, allowed: {} }],
127
+ ```
128
+
129
+ `@ref0/workspace/task-sources` keys a cached task by the files it reads, which Vite+ can't track on
130
+ WSL2. `taskSources({ root, packages, apps })` gives `builtFrom(import.meta.url, command)`, keyed by
131
+ the config's package and every workspace package it depends on, and `readsAll(command)`, keyed by
132
+ every file. Each puts `env REF0_SOURCES=<hash>` before each command `&&` joins.
133
+
134
+ ## TypeScript
135
+
136
+ A repo's base `tsconfig` extends one preset, so an option the team adopts reaches every repo in the
137
+ release that adds it:
138
+
139
+ | Preset | What it holds |
140
+ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
141
+ | `@ref0/workspace/tsconfig/base.json` | The strict options: `strict`, `exactOptionalPropertyTypes`, `noUncheckedIndexedAccess`, `verbatimModuleSyntax`, `isolatedModules`, the unused, fallthrough, return and override checks, and ES2023 |
142
+ | `@ref0/workspace/tsconfig/bundler.json` | The base, with `module: ESNext` and `moduleResolution: Bundler`, for code a bundler builds |
143
+ | `@ref0/workspace/tsconfig/node-next.json` | The base, with `module` and `moduleResolution` `NodeNext`, for code Node runs as it is |
144
+
145
+ ```jsonc
146
+ {
147
+ "extends": "@ref0/workspace/tsconfig/bundler.json",
148
+ "compilerOptions": {
149
+ "customConditions": ["@ref0/source"],
150
+ "plugins": [{ "name": "@effect/language-service" }],
151
+ },
152
+ }
153
+ ```
154
+
155
+ The repo keeps what's its own: `lib`, `types`, `paths`, `customConditions`, `noEmit`, its includes and references, and the Effect language service's options, since a config's `plugins` replaces the one it extends.
156
+
107
157
  ## Checks
108
158
 
109
159
  `ref0-workspace <check>`, from anywhere in the repo's checkout:
@@ -221,17 +271,19 @@ subcommands' at `origin/main`'s tip. A pull request's own copies count only once
221
271
  Every key of `review.json` may be left out, for the value in brackets, which ref-0/git's gate
222
272
  began with, and the file holds no other:
223
273
 
224
- | Key | What it holds |
225
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
226
- | `reviewTypes` | The review types a session may name, in lowercase, as the `review` skill's `references/types.md` lists them (its 14) |
227
- | `consideredTypes` | The types each session names, as run or as not run with why, on a change a review covers: each one of `reviewTypes` (stress test, system design, red team, storage, program design, formal verification, fuzzing and fidelity) |
228
- | `lowTierLines` | Changed lines, additions and deletions since the merge base, up to which a pull request may be low (150) |
229
- | `highTierLines` | Changed lines up to which it may be medium, at least `lowTierLines` (500) |
230
- | `productionSource` | Production source, as globs, whose net lines count toward a large change, less test code and fixtures (`packages/*/src/*.ts`, `packages/*/src/*.tsx`, `apps/*/src/*.ts`, `apps/*/src/*.tsx`) |
231
- | `testCode` | Test code, as globs in `review-paths.txt`'s form (`*.test.ts`, `*.test-d.ts`, `*/testing/*`) |
232
- | `testHelpers` | Shared test helpers, test code too whether `testCode` names them or not, whose change puts a pull request at medium (`*/testing/*`) |
233
- | `benchedPaths` | The bench list's path, whose `<case> <glob>` lines tie source to the bench cases that time it (none: no bench) |
234
- | `benchRuns` | Files under a `testing/` folder that a bench case runs all the same (none) |
274
+ | Key | What it holds |
275
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
276
+ | `reviewTypes` | The review types a session may name, in lowercase, as the `review` skill's `references/types.md` lists them (its 14) |
277
+ | `consideredTypes` | The types each session names, as run or as not run with why, on a change a review covers: each one of `reviewTypes` (stress test, system design, red team, storage, program design, formal verification, fuzzing and fidelity) |
278
+ | `lowTierLines` | Changed lines, additions and deletions since the merge base, up to which a pull request may be low (150) |
279
+ | `highTierLines` | Changed lines up to which it may be medium, at least `lowTierLines` (500) |
280
+ | `productionSource` | Production source, as globs, whose net lines count toward a large change, each `!` entry taking files off, test code among them; fixtures never count (`packages/*/src/*.ts`, `packages/*/src/*.tsx`, `apps/*/src/*.ts`, `apps/*/src/*.tsx`, `!*.test.ts`, `!*.test-d.ts`, `!*/testing/*`) |
281
+ | `testCode` | Test code, as globs in `review-paths.txt`'s form (`*.test.ts`, `*.test-d.ts`, `*/testing/*`) |
282
+ | `testHelpers` | Shared test helpers, test code too whether `testCode` names them or not, whose change puts a pull request at medium (`*/testing/*`) |
283
+ | `benchedPaths` | The bench list's path, whose `<case> <glob>` lines tie source to the bench cases that time it (none: no bench) |
284
+ | `benchRuns` | Files under a `testing/` folder that a bench case runs all the same (none) |
285
+ | `sizeUncounted` | Generated files, as globs, whose lines the size floor leaves out, though the always-review list and the test code rules still read them; a list replaces the default, so name the lock in it too (`pnpm-lock.yaml`) |
286
+ | `botBranches` | Head branches, as globs, from which a bot's pull request in the repo itself, never a fork's, counts as from someone who may push, as a release's from `release/next` does, so a low one needs no session (none) |
235
287
 
236
288
  ```json
237
289
  { "benchedPaths": "bench/benched-paths.txt", "lowTierLines": 200 }
@@ -296,8 +348,9 @@ The job's token reads the pull request, its comments and the repo's contents. Th
296
348
  credential helper reads `GH_TOKEN` from the environment, so the token is never in `.git/config` or
297
349
  on a command line, and a blob the gate reads later is fetched the same way, failing closed when the
298
350
  fetch does. A base with no `review.json` holds no gate yet, and the job says so. A repo's
299
- `review-paths.txt` lists `review.json`, `pnpm-workspace.yaml` and `.github/workflows/ci.yml` at
300
- high, since each changes the gate the next pull request meets.
351
+ `review-paths.txt` lists `review.json` and `.github/workflows/ci.yml` at high, since each changes
352
+ the gate the next pull request meets, and `pnpm-workspace.yaml` at medium or above, since its
353
+ catalog picks the gate's version.
301
354
 
302
355
  `@ref0/workspace/review-record` exports what a repo's own code reuses of the gate: `testsOnly` and
303
356
  `benchedCases`, which a bench's seeds and its list's tests read, and `settingsFrom` and
@@ -0,0 +1,32 @@
1
+ import { Predicate } from "effect";
2
+ // src/lint/generic/ast-fields.ts
3
+ /** Whether a field of oxc's tree is a node. */
4
+ const isNode = (value) => Predicate.isObject(value) && Predicate.hasProperty(value, "type") && Predicate.isString(value.type) && Predicate.hasProperty(value, "start") && Predicate.isNumber(value.start);
5
+ /** What `node` holds in its field `name`, which a node of another type may not have. */
6
+ const fieldOf = (node, name) => {
7
+ const fields = node;
8
+ return Object.hasOwn(fields, name) ? fields[name] : void 0;
9
+ };
10
+ /** Whether a field of oxc's tree is a node, a list or another object, so a walk goes into it. */
11
+ const isBranch = (value) => Predicate.isObjectOrArray(value);
12
+ /**
13
+ * Each item of a list, or each field of a plain value that isn't a node, such as a template's
14
+ * `{ raw, cooked }`, which holds no code.
15
+ */
16
+ const itemsOf = (value) => isBranch(value) && !isNode(value) ? Object.values(value) : [];
17
+ /** The node `node` holds in its field `name`, if one. */
18
+ const nodeAt = (node, name) => {
19
+ const value = fieldOf(node, name);
20
+ return isNode(value) ? value : void 0;
21
+ };
22
+ /** The nodes `node` holds in its list `name`, its holes left out. */
23
+ const nodesAt = (node, name) => {
24
+ const value = fieldOf(node, name);
25
+ return itemsOf(value).filter(isNode);
26
+ };
27
+ /** An identifier's name, or `undefined` for any other node. */
28
+ const nameOf = (node) => {
29
+ const name = node?.type === "Identifier" ? fieldOf(node, "name") : void 0;
30
+ return Predicate.isString(name) ? name : void 0;
31
+ };
32
+ export { fieldOf, isNode, nameOf, nodeAt, nodesAt };
@@ -0,0 +1,9 @@
1
+ import { Workspace } from "./workspace-packages.mjs";
2
+ /**
3
+ * What `ref0-generic/build-cache-inputs` takes: where the packages are, and `tasks`, the names of
4
+ * the tasks that build a package, such as `build:cached`, whose cache inputs it checks. Each
5
+ * package's config defines the first.
6
+ */
7
+ export interface BuildCacheInputsOptions extends Workspace {
8
+ readonly tasks: readonly [string, ...ReadonlyArray<string>];
9
+ }
@@ -0,0 +1,147 @@
1
+ import { decodedOnce } from "./rule-options.mjs";
2
+ import { dependedOn, fromRoot, workspacePackages } from "./workspace-packages.mjs";
3
+ import { dirname, resolve } from "node:path";
4
+ import { Schema } from "effect";
5
+ import { defineRule } from "vite-plus/lint/plugins";
6
+ // src/lint/generic/build-cache-inputs.ts
7
+ const decodeOptions = Schema.decodeUnknownSync(Schema.Tuple([Schema.Struct({
8
+ root: Schema.String,
9
+ packages: Schema.Array(Schema.String),
10
+ apps: Schema.optionalKey(Schema.Array(Schema.String)),
11
+ tasks: Schema.NonEmptyArray(Schema.String)
12
+ })]));
13
+ const optionsOf = decodedOnce((options) => decodeOptions(options)[0]);
14
+ const isString = Schema.is(Schema.String);
15
+ /** Whether `node` is a `Literal` whose value is a string. */
16
+ const isStringLiteral = (node) => node?.type === "Literal" && isString(node.value);
17
+ /** A property's name, when it's written as a name or a string, not computed. */
18
+ const keyOf = (property) => {
19
+ if (property.computed) return void 0;
20
+ if (property.key.type === "Identifier") return property.key.name;
21
+ return isStringLiteral(property.key) ? property.key.value : void 0;
22
+ };
23
+ /** The value of an object literal's property named `key`, or nothing for any other node. */
24
+ const valueOf = (node, key) => node?.type === "ObjectExpression" ? node.properties.find((property) => property.type === "Property" && keyOf(property) === key)?.value : void 0;
25
+ /** The `pattern` of a `{ pattern, base: 'workspace' }` input, or nothing for any other. */
26
+ const workspacePattern = (input) => {
27
+ const base = valueOf(input, "base");
28
+ const pattern = valueOf(input, "pattern");
29
+ return isStringLiteral(base) && base.value === "workspace" && isStringLiteral(pattern) ? [pattern.value] : [];
30
+ };
31
+ /**
32
+ * What a build reads of each workspace package it depends on: its source, its manifest, and its
33
+ * `tsconfig.json`, which esbuild and Vite read for each of its files, for such settings as
34
+ * `useDefineForClassFields`.
35
+ */
36
+ const dependencyInputs = [
37
+ {
38
+ messageId: "missingSource",
39
+ path: "src/**"
40
+ },
41
+ {
42
+ messageId: "missingManifest",
43
+ path: "package.json"
44
+ },
45
+ {
46
+ messageId: "missingTsconfig",
47
+ path: "tsconfig.json"
48
+ }
49
+ ];
50
+ /**
51
+ * Vite+'s automatic tracking fails on WSL2, which the shared machine runs: its file tracker can't
52
+ * install its seccomp filter there (voidzero-dev/vite-plus#1643, open as of Vite+ 1.8.0). Before
53
+ * 1.8.0 each process a build spawned, such as esbuild or tsgo, failed with `spawn EBUSY`; since, the
54
+ * task runs untracked and is never cached (vite-task#701). So each `build:cached` lists its inputs,
55
+ * and a package's build reads the source of every workspace package it depends on, through the
56
+ * `@ref0/source` condition in that package's `package.json`.
57
+ */
58
+ const buildCacheInputsRule = defineRule({
59
+ meta: {
60
+ messages: {
61
+ missingSource: "{{task}} reads {{dependency}}'s source, which its cache input leaves out, so a change there would replay a stale build. Add { pattern: '{{pattern}}', base: 'workspace' }.",
62
+ missingManifest: "{{task}} resolves {{dependency}} through its package.json, which its cache input leaves out, so a change to its exports or dependencies would replay a stale build. Add { pattern: '{{pattern}}', base: 'workspace' }.",
63
+ missingTsconfig: "{{task}} compiles {{dependency}}'s source with its tsconfig.json, which its cache input leaves out, so a change to its compiler settings would replay a stale build. Add { pattern: '{{pattern}}', base: 'workspace' }.",
64
+ noTask: "A workspace package defines a {{task}} task, whose cache input lists the source and package.json of each workspace package it depends on."
65
+ },
66
+ schema: [{
67
+ type: "object",
68
+ properties: {
69
+ root: { type: "string" },
70
+ packages: {
71
+ type: "array",
72
+ items: { type: "string" }
73
+ },
74
+ apps: {
75
+ type: "array",
76
+ items: { type: "string" }
77
+ },
78
+ tasks: {
79
+ type: "array",
80
+ items: { type: "string" },
81
+ minItems: 1
82
+ }
83
+ },
84
+ required: [
85
+ "root",
86
+ "packages",
87
+ "tasks"
88
+ ],
89
+ additionalProperties: false
90
+ }]
91
+ },
92
+ create(context) {
93
+ const options = optionsOf(context.options);
94
+ const packages = workspacePackages(options);
95
+ const directory = fromRoot(options.root, dirname(resolve(context.filename)));
96
+ const own = [...packages.values()].find((found) => found.directory === directory);
97
+ if (own === void 0) return {};
98
+ const { name } = own;
99
+ const [required] = options.tasks;
100
+ const buildTasks = new Set(options.tasks);
101
+ const arrays = /* @__PURE__ */ new Map();
102
+ const tasks = [];
103
+ /** A task's input list, written in place or as a `const` of this file holding the array. */
104
+ const inputOf = (task) => {
105
+ const input = valueOf(valueOf(task, "cache"), "input");
106
+ return input?.type === "Identifier" ? arrays.get(input.name) : input;
107
+ };
108
+ return {
109
+ VariableDeclarator(node) {
110
+ if (node.id.type === "Identifier" && node.init?.type === "ArrayExpression") arrays.set(node.id.name, node.init);
111
+ },
112
+ Property(node) {
113
+ const name = keyOf(node);
114
+ if (name !== void 0 && buildTasks.has(name)) tasks.push({
115
+ name,
116
+ node,
117
+ value: node.value
118
+ });
119
+ },
120
+ "Program:exit"(node) {
121
+ if (!tasks.some((task) => task.name === required)) context.report({
122
+ node,
123
+ messageId: "noTask",
124
+ data: { task: required }
125
+ });
126
+ for (const task of tasks) {
127
+ const input = inputOf(task.value);
128
+ const listed = new Set(input?.type === "ArrayExpression" ? input.elements.flatMap(workspacePattern) : []);
129
+ for (const [dependency, workspacePackage] of dependedOn(name, packages)) for (const { messageId, path } of dependencyInputs) {
130
+ const pattern = `${workspacePackage.directory}/${path}`;
131
+ if (listed.has(pattern)) continue;
132
+ context.report({
133
+ node: task.node,
134
+ messageId,
135
+ data: {
136
+ task: task.name,
137
+ dependency,
138
+ pattern
139
+ }
140
+ });
141
+ }
142
+ }
143
+ }
144
+ };
145
+ }
146
+ });
147
+ export { buildCacheInputsRule };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * What `ref0-generic/effect-gen-wrappers` takes, if anything: the repo's root, as an absolute path,
3
+ * and `allowed`, the functions that may stay ones returning `Effect.gen`, by file from the root,
4
+ * then by the top-level declaration each is in, with the reason each stays.
5
+ */
6
+ export interface EffectGenWrappersOptions {
7
+ readonly root: string;
8
+ readonly allowed: {
9
+ readonly [file: string]: {
10
+ readonly [declaration: string]: string;
11
+ };
12
+ };
13
+ }
@@ -0,0 +1,100 @@
1
+ import { decodedOnce } from "./rule-options.mjs";
2
+ import { fromRoot } from "./workspace-packages.mjs";
3
+ import { resolve } from "node:path";
4
+ import { Schema } from "effect";
5
+ import { defineRule } from "vite-plus/lint/plugins";
6
+ // src/lint/generic/effect-gen-wrappers.ts
7
+ const decodeOptions = Schema.decodeUnknownSync(Schema.Tuple([Schema.optionalKey(Schema.Struct({
8
+ root: Schema.String,
9
+ allowed: Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.String))
10
+ }))]));
11
+ const optionsOf = decodedOnce((options) => decodeOptions(options)[0]);
12
+ /** `node` with its parentheses and TypeScript's wrappers that change no value taken off: `as`, `satisfies`, `!` and `<T>`. */
13
+ const unwrap = (node) => {
14
+ switch (node.type) {
15
+ case "ParenthesizedExpression":
16
+ case "TSAsExpression":
17
+ case "TSSatisfiesExpression":
18
+ case "TSNonNullExpression":
19
+ case "TSTypeAssertion": return unwrap(node.expression);
20
+ default: return node;
21
+ }
22
+ };
23
+ /** `<object>.<property>`, or `<anything>.<property>` when `object` is `undefined`. */
24
+ const isMember = (node, object, property) => node.type === "MemberExpression" && !node.computed && node.property.type === "Identifier" && node.property.name === property && (object === void 0 || node.object.type === "Identifier" && node.object.name === object);
25
+ /** Whether `expression` is `Effect.gen(...)`, with any `.pipe(...)` on it and type assertions around it. */
26
+ const isGenOf = (expression) => {
27
+ if (expression === null || expression === void 0) return false;
28
+ const node = unwrap(expression);
29
+ if (node.type !== "CallExpression") return false;
30
+ if (isMember(node.callee, "Effect", "gen")) return true;
31
+ return isMember(node.callee, void 0, "pipe") && node.callee.type === "MemberExpression" && isGenOf(node.callee.object);
32
+ };
33
+ /** Whether a function only returns `Effect.gen`: an arrow whose body is one, or a body whose only statement returns one. */
34
+ const returnsGen = (fn) => {
35
+ if (fn.body === null || fn.body === void 0) return false;
36
+ if (fn.body.type !== "BlockStatement") return isGenOf(fn.body);
37
+ const [only, ...rest] = fn.body.body;
38
+ return rest.length === 0 && only?.type === "ReturnStatement" && isGenOf(only.argument);
39
+ };
40
+ /** The name a top-level statement declares, `default` for a default export, or `(top)`. */
41
+ const declaredName = (statement) => {
42
+ const inner = statement.type === "ExportNamedDeclaration" && statement.declaration !== null ? statement.declaration : statement;
43
+ if (inner.type === "VariableDeclaration") {
44
+ const id = inner.declarations[0]?.id;
45
+ return id?.type === "Identifier" ? id.name : "(top)";
46
+ }
47
+ if ((inner.type === "FunctionDeclaration" || inner.type === "ClassDeclaration") && inner.id) return inner.id.name;
48
+ return statement.type === "ExportDefaultDeclaration" ? "default" : "(top)";
49
+ };
50
+ /** The top-level statement that holds `node`. */
51
+ const statementOf = (node) => node.parent === null || node.parent.type === "Program" ? node : statementOf(node.parent);
52
+ const effectGenWrappersRule = defineRule({
53
+ meta: {
54
+ messages: {
55
+ wrapper: "This function only returns Effect.gen, which makes a generator closure on each call. Write it as Effect.fnUntraced(function* (…) { … }), or Effect.fn(\"name\") where a span helps.",
56
+ stale: "The rule's allowed list names {{declaration}} in this file, and no function there returns Effect.gen. Delete it."
57
+ },
58
+ schema: [{
59
+ type: "object",
60
+ properties: {
61
+ root: { type: "string" },
62
+ allowed: { type: "object" }
63
+ },
64
+ required: ["root", "allowed"],
65
+ additionalProperties: false
66
+ }]
67
+ },
68
+ create(context) {
69
+ const options = optionsOf(context.options);
70
+ const allowed = options === void 0 ? {} : options.allowed[fromRoot(options.root, resolve(context.filename))] ?? {};
71
+ const used = /* @__PURE__ */ new Set();
72
+ const check = (fn) => {
73
+ if (!returnsGen(fn)) return;
74
+ const { parent } = fn;
75
+ if ((parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.some((argument) => argument === fn)) return;
76
+ const declaration = declaredName(statementOf(fn));
77
+ if (Object.hasOwn(allowed, declaration)) {
78
+ used.add(declaration);
79
+ return;
80
+ }
81
+ context.report({
82
+ node: fn,
83
+ messageId: "wrapper"
84
+ });
85
+ };
86
+ return {
87
+ ArrowFunctionExpression: check,
88
+ FunctionExpression: check,
89
+ FunctionDeclaration: check,
90
+ "Program:exit"(program) {
91
+ for (const declaration of Object.keys(allowed)) if (!used.has(declaration)) context.report({
92
+ node: program,
93
+ messageId: "stale",
94
+ data: { declaration }
95
+ });
96
+ }
97
+ };
98
+ }
99
+ });
100
+ export { effectGenWrappersRule };
@@ -1,8 +1,11 @@
1
1
  /**
2
- * Rules any ref-0 repo can turn on, each over the files its config names. Four take options:
2
+ * Rules any ref-0 repo can turn on, each over the files its config names. These take options:
3
3
  * `entry-reexports` the repo's root, its packages and its source condition, `no-comments` the
4
4
  * repo's root and its comment budget's file, `package-imports` where its packages are and their
5
- * graph, and `folder-imports` its sources' layers.
5
+ * graph, `folder-imports` its sources' layers, `public-docs` where its packages are and their
6
+ * source condition, `build-cache-inputs` where its packages are and their build tasks,
7
+ * `pure-top-level` the callees it treats as pure, and `effect-gen-wrappers` the functions it
8
+ * allows.
6
9
  */
7
10
  declare const _default: import("vite-plus/lint/plugins").Plugin;
8
11
  export { _default as default };
@@ -1,4 +1,6 @@
1
+ import { buildCacheInputsRule } from "./build-cache-inputs.mjs";
1
2
  import { effectEncodingRule } from "./effect-encoding.mjs";
3
+ import { effectGenWrappersRule } from "./effect-gen-wrappers.mjs";
2
4
  import { entryReexportsRule } from "./entry-reexports.mjs";
3
5
  import { envAtEntrypointsRule } from "./env-at-entrypoints.mjs";
4
6
  import { exportTypeSideEffectsRule } from "./export-type-side-effects.mjs";
@@ -7,19 +9,27 @@ import { indexBarrelOnlyRule } from "./index-barrel.mjs";
7
9
  import { logMessagesRule } from "./log-messages.mjs";
8
10
  import { noCommentsRule } from "./no-comments.mjs";
9
11
  import { packageImportsRule } from "./package-imports.mjs";
12
+ import { publicDocsRule } from "./public-docs.mjs";
13
+ import { pureEffectFnRule } from "./pure-effect-fn.mjs";
14
+ import { pureTopLevelRule } from "./pure-top-level.mjs";
10
15
  import { seededPropertiesRule } from "./seeded-properties.mjs";
11
16
  import { definePlugin } from "vite-plus/lint/plugins";
12
17
  // src/lint/generic/plugin.ts
13
18
  /**
14
- * Rules any ref-0 repo can turn on, each over the files its config names. Four take options:
19
+ * Rules any ref-0 repo can turn on, each over the files its config names. These take options:
15
20
  * `entry-reexports` the repo's root, its packages and its source condition, `no-comments` the
16
21
  * repo's root and its comment budget's file, `package-imports` where its packages are and their
17
- * graph, and `folder-imports` its sources' layers.
22
+ * graph, `folder-imports` its sources' layers, `public-docs` where its packages are and their
23
+ * source condition, `build-cache-inputs` where its packages are and their build tasks,
24
+ * `pure-top-level` the callees it treats as pure, and `effect-gen-wrappers` the functions it
25
+ * allows.
18
26
  */
19
27
  var plugin_default = definePlugin({
20
28
  meta: { name: "ref0-generic" },
21
29
  rules: {
30
+ "build-cache-inputs": buildCacheInputsRule,
22
31
  "effect-encoding": effectEncodingRule,
32
+ "effect-gen-wrappers": effectGenWrappersRule,
23
33
  "entry-reexports": entryReexportsRule,
24
34
  "env-at-entrypoints": envAtEntrypointsRule,
25
35
  "export-type-side-effects": exportTypeSideEffectsRule,
@@ -28,6 +38,9 @@ var plugin_default = definePlugin({
28
38
  "log-messages": logMessagesRule,
29
39
  "no-comments": noCommentsRule,
30
40
  "package-imports": packageImportsRule,
41
+ "public-docs": publicDocsRule,
42
+ "pure-effect-fn": pureEffectFnRule,
43
+ "pure-top-level": pureTopLevelRule,
31
44
  "seeded-properties": seededPropertiesRule
32
45
  }
33
46
  });
@@ -0,0 +1,12 @@
1
+ import { Workspace } from "./workspace-packages.mjs";
2
+ import "vite-plus/lint/plugins";
3
+ import { parseSync } from "vite-plus";
4
+ /**
5
+ * What `ref0-generic/public-docs` takes: where the packages are, `condition`, the export condition
6
+ * that names an entry point's source, such as `@ref0/source`, and `entries`, the entry files from
7
+ * the root whose exports it follows, which default to each public package's published ones.
8
+ */
9
+ export interface PublicDocsOptions extends Workspace {
10
+ readonly condition: string;
11
+ readonly entries?: ReadonlyArray<string>;
12
+ }