@outfitter/tooling 0.3.0 → 0.3.4
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/.markdownlint-cli2.jsonc +55 -55
- package/README.md +21 -21
- package/dist/bun-version-compat.d.ts +2 -0
- package/dist/bun-version-compat.js +10 -0
- package/dist/cli/check-boundary-invocations.js +2 -2
- package/dist/cli/check-bunup-registry.js +2 -2
- package/dist/cli/check-changeset.js +2 -2
- package/dist/cli/check-clean-tree.js +2 -2
- package/dist/cli/check-exports.js +2 -2
- package/dist/cli/check-markdown-links.d.ts +42 -0
- package/dist/cli/check-markdown-links.js +13 -0
- package/dist/cli/check-readme-imports.d.ts +2 -3
- package/dist/cli/check-readme-imports.js +4 -4
- package/dist/cli/check-tsdoc.js +2 -2
- package/dist/cli/check.js +2 -2
- package/dist/cli/fix.js +2 -2
- package/dist/cli/index.js +49 -1221
- package/dist/cli/init.js +2 -2
- package/dist/cli/pre-push.d.ts +13 -1
- package/dist/cli/pre-push.js +5 -3
- package/dist/cli/upgrade-bun.js +3 -2
- package/dist/index.d.ts +6 -186
- package/dist/index.js +4 -42
- package/dist/registry/build.d.ts +1 -3
- package/dist/registry/build.js +187 -58
- package/dist/registry/index.js +1 -13
- package/dist/registry/schema.js +22 -6
- package/dist/shared/@outfitter/{tooling-9errkcvk.js → tooling-1hez6j9d.js} +1 -1
- package/dist/shared/@outfitter/{tooling-cj5vsa9k.js → tooling-6cxfdx0q.js} +21 -18
- package/dist/shared/@outfitter/{tooling-qk5xgmxr.js → tooling-875svjnz.js} +5 -4
- package/dist/shared/@outfitter/{tooling-mxwc1n8w.js → tooling-9ram55dd.js} +4 -3
- package/dist/shared/@outfitter/{tooling-0x5q15ec.js → tooling-a4bfx4be.js} +1 -1
- package/dist/shared/@outfitter/{tooling-r9976n43.js → tooling-amrbp7cm.js} +6 -4
- package/dist/shared/@outfitter/{tooling-2n2dpsaa.js → tooling-d363b88r.js} +38 -12
- package/dist/shared/@outfitter/{tooling-1y8w5ahg.js → tooling-gcdvsqqp.js} +7 -4
- package/dist/shared/@outfitter/{tooling-enjcenja.js → tooling-h04te11c.js} +6 -4
- package/dist/shared/@outfitter/tooling-ja1zg5yc.js +214 -0
- package/dist/shared/@outfitter/tooling-mkynjra9.js +23 -0
- package/dist/shared/@outfitter/{tooling-9yzd08v1.js → tooling-pq47jv6t.js} +72 -5
- package/dist/shared/@outfitter/tooling-vjmhvpjq.d.ts +29 -0
- package/dist/shared/@outfitter/{tooling-t17gnh9b.js → tooling-wwm97f47.js} +8 -5
- package/dist/version.js +1 -1
- package/package.json +134 -130
- package/registry/registry.json +18 -11
- package/tsconfig.preset.bun.json +5 -5
- package/tsconfig.preset.json +33 -33
- package/biome.json +0 -81
- package/dist/shared/@outfitter/tooling-kcvs6mys.js +0 -1
- package/dist/shared/@outfitter/tooling-wv09k6hr.js +0 -23
- package/dist/shared/chunk-3s189drz.js +0 -4
- package/dist/shared/chunk-7tdgbqb0.js +0 -197
- package/dist/shared/chunk-cmde0fwx.js +0 -421
- /package/dist/shared/@outfitter/{tooling-dvwh9qve.js → tooling-jnrs9rqd.js} +0 -0
package/tsconfig.preset.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"lib": ["ESNext"],
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noImplicitAny": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"strictFunctionTypes": true,
|
|
13
|
+
"strictBindCallApply": true,
|
|
14
|
+
"strictPropertyInitialization": true,
|
|
15
|
+
"noImplicitThis": true,
|
|
16
|
+
"useUnknownInCatchVariables": true,
|
|
17
|
+
"alwaysStrict": true,
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
"noUncheckedIndexedAccess": true,
|
|
20
|
+
"noImplicitReturns": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true,
|
|
22
|
+
"noUnusedLocals": true,
|
|
23
|
+
"noUnusedParameters": true,
|
|
24
|
+
"exactOptionalPropertyTypes": true,
|
|
25
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
"declaration": true,
|
|
28
|
+
"declarationMap": true,
|
|
29
|
+
"sourceMap": true,
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
"esModuleInterop": true,
|
|
32
|
+
"forceConsistentCasingInFileNames": true,
|
|
33
|
+
"isolatedModules": true,
|
|
34
|
+
"verbatimModuleSyntax": true,
|
|
35
|
+
"skipLibCheck": true,
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
"resolveJsonModule": true,
|
|
38
|
+
"allowSyntheticDefaultImports": true
|
|
39
|
+
}
|
|
40
40
|
}
|
package/biome.json
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/2.4.4/schema.json",
|
|
3
|
-
"root": false,
|
|
4
|
-
"javascript": {
|
|
5
|
-
"globals": ["Bun"]
|
|
6
|
-
},
|
|
7
|
-
"linter": {
|
|
8
|
-
"rules": {
|
|
9
|
-
"complexity": {
|
|
10
|
-
"useLiteralKeys": "off",
|
|
11
|
-
"noVoid": "off",
|
|
12
|
-
"noExcessiveCognitiveComplexity": "off"
|
|
13
|
-
},
|
|
14
|
-
"performance": {
|
|
15
|
-
"useTopLevelRegex": "off"
|
|
16
|
-
},
|
|
17
|
-
"style": {
|
|
18
|
-
"useBlockStatements": "off"
|
|
19
|
-
},
|
|
20
|
-
"suspicious": {
|
|
21
|
-
"noConsole": "error"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"vcs": {
|
|
26
|
-
"enabled": true,
|
|
27
|
-
"clientKind": "git",
|
|
28
|
-
"useIgnoreFile": true
|
|
29
|
-
},
|
|
30
|
-
"files": {
|
|
31
|
-
"ignoreUnknown": true,
|
|
32
|
-
"includes": [
|
|
33
|
-
"**",
|
|
34
|
-
"!**/node_modules",
|
|
35
|
-
"!**/dist",
|
|
36
|
-
"!**/.turbo",
|
|
37
|
-
"!**/*.gen.ts",
|
|
38
|
-
"!registry/registry.json"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"overrides": [
|
|
42
|
-
{
|
|
43
|
-
"includes": [
|
|
44
|
-
"packages/*/src/index.ts",
|
|
45
|
-
"apps/*/src/index.ts",
|
|
46
|
-
"**/index.ts"
|
|
47
|
-
],
|
|
48
|
-
"linter": {
|
|
49
|
-
"rules": {
|
|
50
|
-
"performance": {
|
|
51
|
-
"noBarrelFile": "off"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"includes": ["**/*.test.ts", "**/__tests__/**/*"],
|
|
58
|
-
"linter": {
|
|
59
|
-
"rules": {
|
|
60
|
-
"suspicious": {
|
|
61
|
-
"useAwait": "off",
|
|
62
|
-
"noConsole": "off"
|
|
63
|
-
},
|
|
64
|
-
"performance": {
|
|
65
|
-
"noDelete": "off"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"includes": ["apps/**/*.ts", "scripts/**/*.ts", "**/scripts/**/*.ts"],
|
|
72
|
-
"linter": {
|
|
73
|
-
"rules": {
|
|
74
|
-
"suspicious": {
|
|
75
|
-
"noConsole": "off"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/tooling/src/registry/schema.ts
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
var FileEntrySchema = z.object({
|
|
5
|
-
path: z.string().min(1),
|
|
6
|
-
content: z.string(),
|
|
7
|
-
executable: z.boolean().optional(),
|
|
8
|
-
template: z.boolean().optional()
|
|
9
|
-
});
|
|
10
|
-
var BlockSchema = z.object({
|
|
11
|
-
name: z.string().min(1),
|
|
12
|
-
description: z.string().min(1),
|
|
13
|
-
files: z.array(FileEntrySchema).optional(),
|
|
14
|
-
dependencies: z.record(z.string(), z.string()).optional(),
|
|
15
|
-
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
16
|
-
extends: z.array(z.string()).optional()
|
|
17
|
-
});
|
|
18
|
-
var RegistrySchema = z.object({
|
|
19
|
-
version: z.string(),
|
|
20
|
-
blocks: z.record(z.string(), BlockSchema)
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export { FileEntrySchema, BlockSchema, RegistrySchema };
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import"./chunk-3s189drz.js";
|
|
2
|
-
|
|
3
|
-
// src/cli/check-readme-imports.ts
|
|
4
|
-
import { resolve } from "node:path";
|
|
5
|
-
function parseSpecifier(specifier) {
|
|
6
|
-
if (!specifier.startsWith("@outfitter/")) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
const parts = specifier.split("/");
|
|
10
|
-
if (parts.length < 2) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const packageName = `${parts[0]}/${parts[1]}`;
|
|
14
|
-
const rest = parts.slice(2);
|
|
15
|
-
if (rest.length === 0) {
|
|
16
|
-
return { packageName, subpath: "." };
|
|
17
|
-
}
|
|
18
|
-
return { packageName, subpath: `./${rest.join("/")}` };
|
|
19
|
-
}
|
|
20
|
-
function extractImports(content, file) {
|
|
21
|
-
const lines = content.split(`
|
|
22
|
-
`);
|
|
23
|
-
const results = [];
|
|
24
|
-
const seen = new Set;
|
|
25
|
-
const CODE_FENCE_OPEN = /^```(?:typescript|ts|javascript|js)\s*$/;
|
|
26
|
-
const CODE_FENCE_CLOSE = /^```\s*$/;
|
|
27
|
-
const IMPORT_RE = /from\s+["'](@outfitter\/[^"']+)["']/;
|
|
28
|
-
const NON_CONTRACTUAL = /<!--\s*non-contractual\s*-->/;
|
|
29
|
-
let inCodeBlock = false;
|
|
30
|
-
let skipBlock = false;
|
|
31
|
-
for (let i = 0;i < lines.length; i++) {
|
|
32
|
-
const line = lines[i];
|
|
33
|
-
if (!inCodeBlock) {
|
|
34
|
-
if (CODE_FENCE_OPEN.test(line)) {
|
|
35
|
-
inCodeBlock = true;
|
|
36
|
-
skipBlock = false;
|
|
37
|
-
for (let j = i - 1;j >= 0; j--) {
|
|
38
|
-
const prev = lines[j].trim();
|
|
39
|
-
if (prev === "")
|
|
40
|
-
continue;
|
|
41
|
-
if (NON_CONTRACTUAL.test(prev)) {
|
|
42
|
-
skipBlock = true;
|
|
43
|
-
}
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (CODE_FENCE_CLOSE.test(line) && !CODE_FENCE_OPEN.test(line)) {
|
|
50
|
-
inCodeBlock = false;
|
|
51
|
-
skipBlock = false;
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (skipBlock)
|
|
55
|
-
continue;
|
|
56
|
-
const match = IMPORT_RE.exec(line);
|
|
57
|
-
if (!match?.[1])
|
|
58
|
-
continue;
|
|
59
|
-
const fullSpecifier = match[1];
|
|
60
|
-
if (seen.has(fullSpecifier))
|
|
61
|
-
continue;
|
|
62
|
-
seen.add(fullSpecifier);
|
|
63
|
-
const parsed = parseSpecifier(fullSpecifier);
|
|
64
|
-
if (!parsed)
|
|
65
|
-
continue;
|
|
66
|
-
results.push({
|
|
67
|
-
packageName: parsed.packageName,
|
|
68
|
-
subpath: parsed.subpath,
|
|
69
|
-
fullSpecifier,
|
|
70
|
-
file,
|
|
71
|
-
line: i + 1
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return results;
|
|
75
|
-
}
|
|
76
|
-
function isExportedSubpath(subpath, exports) {
|
|
77
|
-
return subpath in exports;
|
|
78
|
-
}
|
|
79
|
-
var COLORS = {
|
|
80
|
-
reset: "\x1B[0m",
|
|
81
|
-
red: "\x1B[31m",
|
|
82
|
-
green: "\x1B[32m",
|
|
83
|
-
yellow: "\x1B[33m",
|
|
84
|
-
blue: "\x1B[34m",
|
|
85
|
-
dim: "\x1B[2m"
|
|
86
|
-
};
|
|
87
|
-
function resolveJsonMode(options = {}) {
|
|
88
|
-
return options.json ?? process.env["OUTFITTER_JSON"] === "1";
|
|
89
|
-
}
|
|
90
|
-
async function runCheckReadmeImports(options = {}) {
|
|
91
|
-
const cwd = process.cwd();
|
|
92
|
-
const readmeGlob = new Bun.Glob("**/README.md");
|
|
93
|
-
const readmeDirs = ["packages", "docs/packages"];
|
|
94
|
-
const readmePaths = [];
|
|
95
|
-
for (const dir of readmeDirs) {
|
|
96
|
-
const fullDir = resolve(cwd, dir);
|
|
97
|
-
try {
|
|
98
|
-
for (const match of readmeGlob.scanSync({ cwd: fullDir, dot: false })) {
|
|
99
|
-
const segments = match.split("/");
|
|
100
|
-
if (segments.length === 2 && segments[1] === "README.md") {
|
|
101
|
-
readmePaths.push(resolve(fullDir, match));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
} catch {}
|
|
105
|
-
}
|
|
106
|
-
if (readmePaths.length === 0) {
|
|
107
|
-
process.stdout.write(`No README.md files found.
|
|
108
|
-
`);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const exportsCache = new Map;
|
|
112
|
-
async function getExportsForPackage(packageName) {
|
|
113
|
-
if (exportsCache.has(packageName)) {
|
|
114
|
-
return exportsCache.get(packageName) ?? null;
|
|
115
|
-
}
|
|
116
|
-
const shortName = packageName.replace("@outfitter/", "");
|
|
117
|
-
const pkgPath = resolve(cwd, "packages", shortName, "package.json");
|
|
118
|
-
try {
|
|
119
|
-
const pkg = await Bun.file(pkgPath).json();
|
|
120
|
-
const exports = typeof pkg.exports === "object" && pkg.exports !== null ? pkg.exports : {};
|
|
121
|
-
exportsCache.set(packageName, exports);
|
|
122
|
-
return exports;
|
|
123
|
-
} catch {
|
|
124
|
-
return null;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const results = [];
|
|
128
|
-
let hasInvalid = false;
|
|
129
|
-
for (const readmePath of readmePaths.sort()) {
|
|
130
|
-
const content = await Bun.file(readmePath).text();
|
|
131
|
-
const relativePath = readmePath.replace(`${cwd}/`, "");
|
|
132
|
-
const imports = extractImports(content, relativePath);
|
|
133
|
-
if (imports.length === 0)
|
|
134
|
-
continue;
|
|
135
|
-
const valid = [];
|
|
136
|
-
const invalid = [];
|
|
137
|
-
for (const imp of imports) {
|
|
138
|
-
const exports = await getExportsForPackage(imp.packageName);
|
|
139
|
-
if (exports === null) {
|
|
140
|
-
invalid.push(imp);
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (isExportedSubpath(imp.subpath, exports)) {
|
|
144
|
-
valid.push(imp);
|
|
145
|
-
} else {
|
|
146
|
-
invalid.push(imp);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (valid.length > 0 || invalid.length > 0) {
|
|
150
|
-
results.push({ file: relativePath, valid, invalid });
|
|
151
|
-
}
|
|
152
|
-
if (invalid.length > 0) {
|
|
153
|
-
hasInvalid = true;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (resolveJsonMode(options)) {
|
|
157
|
-
const output = {
|
|
158
|
-
ok: !hasInvalid,
|
|
159
|
-
files: results
|
|
160
|
-
};
|
|
161
|
-
process.stdout.write(`${JSON.stringify(output, null, 2)}
|
|
162
|
-
`);
|
|
163
|
-
} else {
|
|
164
|
-
const totalValid = results.reduce((n, r) => n + r.valid.length, 0);
|
|
165
|
-
const totalInvalid = results.reduce((n, r) => n + r.invalid.length, 0);
|
|
166
|
-
if (!hasInvalid) {
|
|
167
|
-
process.stdout.write(`${COLORS.green}All ${totalValid} README import examples match package exports.${COLORS.reset}
|
|
168
|
-
`);
|
|
169
|
-
} else {
|
|
170
|
-
process.stderr.write(`${COLORS.red}Invalid README import examples found:${COLORS.reset}
|
|
171
|
-
|
|
172
|
-
`);
|
|
173
|
-
for (const result of results) {
|
|
174
|
-
if (result.invalid.length === 0)
|
|
175
|
-
continue;
|
|
176
|
-
process.stderr.write(` ${COLORS.yellow}${result.file}${COLORS.reset}
|
|
177
|
-
`);
|
|
178
|
-
for (const imp of result.invalid) {
|
|
179
|
-
process.stderr.write(` ${COLORS.red}line ${imp.line}:${COLORS.reset} ${imp.fullSpecifier} ${COLORS.dim}(subpath ${imp.subpath} not in ${imp.packageName} exports)${COLORS.reset}
|
|
180
|
-
`);
|
|
181
|
-
}
|
|
182
|
-
process.stderr.write(`
|
|
183
|
-
`);
|
|
184
|
-
}
|
|
185
|
-
process.stderr.write(`${totalInvalid} invalid, ${totalValid} valid across ${results.length} file(s).
|
|
186
|
-
`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
process.exit(hasInvalid ? 1 : 0);
|
|
190
|
-
}
|
|
191
|
-
export {
|
|
192
|
-
runCheckReadmeImports,
|
|
193
|
-
resolveJsonMode,
|
|
194
|
-
parseSpecifier,
|
|
195
|
-
isExportedSubpath,
|
|
196
|
-
extractImports
|
|
197
|
-
};
|