@r_masseater/msch 0.6.1 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/msch",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "description": "masseater's check policy: points every finite value set and object shape at its one owner, and ships the oxlint preset of plugins and rules.",
5
5
  "keywords": [
6
6
  "lint",
@@ -39,6 +39,10 @@
39
39
  "types": "./dist/oxlint.d.mts",
40
40
  "default": "./dist/oxlint.mjs"
41
41
  },
42
+ "./workspace-settings": {
43
+ "types": "./dist/workspace-settings.d.mts",
44
+ "default": "./dist/workspace-settings.mjs"
45
+ },
42
46
  "./vite": {
43
47
  "types": "./src/vite.d.ts"
44
48
  },
@@ -49,9 +53,9 @@
49
53
  "provenance": true
50
54
  },
51
55
  "dependencies": {
52
- "@effect/platform-node-shared": "4.1.3",
56
+ "@effect/platform-node-shared": "4.1.4",
53
57
  "@html-eslint/eslint-plugin-react": "0.68.0",
54
- "@r_masseater/oxlint-plugin-decision": "0.4.0",
58
+ "@r_masseater/oxlint-plugin-decision": "0.5.0",
55
59
  "@r_masseater/oxlint-typed-rules": "0.4.0",
56
60
  "@shadcn/lint": "0.2.5",
57
61
  "eslint-plugin-baseline-js": "0.7.7",
@@ -61,15 +65,15 @@
61
65
  "yaml": "2.9.1"
62
66
  },
63
67
  "devDependencies": {
64
- "@effect/platform-node": "4.1.3",
65
- "@effect/tsgo": "0.67.7",
66
- "@effect/vitest": "4.1.3",
68
+ "@effect/platform-node": "4.1.4",
69
+ "@effect/tsgo": "0.68.1",
70
+ "@effect/vitest": "4.1.4",
67
71
  "@r_masseater/vitest-otlp": "0.2.0",
68
72
  "@types/node": "26.6.6",
69
- "effect": "4.1.3",
73
+ "effect": "4.1.4",
70
74
  "typescript": "7.1.0-beta",
71
- "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
72
- "vite-plus": "1.5.1"
75
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.6.0",
76
+ "vite-plus": "1.6.0"
73
77
  },
74
78
  "peerDependencies": {
75
79
  "@effect/tsgo": ">=0.67.5",
package/src/vite.d.ts CHANGED
@@ -1,11 +1,33 @@
1
+ import type { OxlintOverride } from "vite-plus/lint";
2
+
1
3
  type InstallSize = `${number} ${"B" | "kB" | "MB"}`;
2
4
 
3
5
  interface PublishSettings {
4
6
  readonly installSize: InstallSize;
5
7
  }
6
8
 
9
+ interface WorkspaceLintOverride {
10
+ readonly files: readonly string[];
11
+ readonly excludeFiles?: readonly string[];
12
+ readonly rules?: OxlintOverride["rules"];
13
+ readonly use?: readonly string[];
14
+ }
15
+
16
+ interface WorkspaceLintSettings {
17
+ readonly ignorePatterns?: readonly string[];
18
+ readonly overrides?: readonly WorkspaceLintOverride[];
19
+ }
20
+
21
+ interface DevDependencyAllowance {
22
+ readonly use?: readonly string[];
23
+ readonly dependencies?: readonly string[];
24
+ }
25
+
7
26
  interface MschConfig {
8
27
  readonly publish?: PublishSettings;
28
+ readonly lint?: WorkspaceLintSettings;
29
+ readonly devDependencies?: Readonly<Record<string, DevDependencyAllowance>>;
30
+ readonly workspaceAgentsMd?: true;
9
31
  }
10
32
 
11
33
  declare module "vite" {
@@ -14,4 +36,11 @@ declare module "vite" {
14
36
  }
15
37
  }
16
38
 
17
- export type { InstallSize, MschConfig, PublishSettings };
39
+ export type {
40
+ DevDependencyAllowance,
41
+ InstallSize,
42
+ MschConfig,
43
+ PublishSettings,
44
+ WorkspaceLintOverride,
45
+ WorkspaceLintSettings,
46
+ };
@@ -1,286 +0,0 @@
1
- import { Array, Context, Effect, FileSystem, Layer, Option, Order, Path, Predicate, Record, Schema, Stream, String as String$1, pipe } from "effect";
2
- import { InternalSymbolName, SyntaxKind, getJSDocTags, getLeadingCommentRanges, getNameOfDeclaration, getTextOfJSDocComment } from "typescript/ast";
3
- import { isArrayLiteralExpression, isBinaryExpression, isCallExpression, isClassDeclaration, isElementAccessExpression, isEnumDeclaration, isExportDeclaration, isIdentifier, isImportDeclaration, isInterfaceDeclaration, isModuleBlock, isModuleDeclaration, isNewExpression, isNumericLiteral, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isSignatureDeclaration, isSourceFile, isSpreadElement, isStringLiteral, isTypeAliasDeclaration, isTypeLiteralNode, isTypeReferenceNode, isUnionTypeNode, isVariableDeclaration, isVariableDeclarationList, isVariableStatement } from "typescript/ast/is";
4
- import { API, IndexKind } from "typescript/sync";
5
- import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
- import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
7
- // src/node-services.ts
8
- const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
9
- // src/repository-files.ts
10
- const MISSING_SIZE = 0;
11
- const GENERATED_PATHSPEC = ":(attr:linguist-generated)";
12
- const LISTED_ARGS = [
13
- "--cached",
14
- "--others",
15
- "--exclude-standard"
16
- ];
17
- var RepositoryFiles = class extends Context.Service()("@r_masseater/msch/repository-files/RepositoryFiles") {};
18
- const nodeRepositoryFiles = Layer.effect(RepositoryFiles, Effect.gen(function* nodeRepositoryFiles() {
19
- const fs = yield* FileSystem.FileSystem;
20
- const path = yield* Path.Path;
21
- const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
22
- const gitFiles = (root, args) => Effect.gen(function* listFiles() {
23
- const listed = yield* (yield* ChildProcess.make("git", [
24
- "ls-files",
25
- "-z",
26
- ...args
27
- ], {
28
- cwd: root,
29
- stdin: "ignore"
30
- })).stdout.pipe(Stream.decodeText(), Stream.mkString);
31
- return pipe(String$1.split(listed, "\0"), Array.filter(String$1.isNonEmpty));
32
- }).pipe(Effect.scoped, Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), Effect.orElseSucceed(() => []));
33
- return RepositoryFiles.of({
34
- generatedFiles: (root) => gitFiles(root, ["--", GENERATED_PATHSPEC]).pipe(Effect.map(Array.map((file) => path.join(root, file)))),
35
- listedFiles: (root) => gitFiles(root, LISTED_ARGS),
36
- readFile: (file) => fs.readFileString(file).pipe(Effect.option),
37
- exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),
38
- realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),
39
- readDirectory: (directory) => fs.readDirectory(directory).pipe(Effect.orElseSucceed(() => [])),
40
- isDirectory: (file) => fs.stat(file).pipe(Effect.map((info) => info.type === "Directory"), Effect.option),
41
- fileSize: (file) => fs.stat(file).pipe(Effect.map((info) => Number(info.size)), Effect.orElseSucceed(() => MISSING_SIZE)),
42
- join: (...segments) => path.join(...segments),
43
- resolve: (...segments) => path.resolve(...segments),
44
- relative: (from, to) => path.relative(from, to),
45
- dirname: (file) => path.dirname(file),
46
- basename: (file) => path.basename(file)
47
- });
48
- })).pipe(Layer.provide(nodeServicesLayer));
49
- // src/dependencies.ts
50
- const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
51
- const PackageManifest = Schema.Struct({
52
- name: Schema.optional(Schema.String),
53
- dependencies: DependencyMap,
54
- devDependencies: DependencyMap,
55
- peerDependencies: DependencyMap,
56
- exports: Schema.optional(Schema.Unknown),
57
- types: Schema.optional(Schema.String),
58
- typings: Schema.optional(Schema.String),
59
- main: Schema.optional(Schema.String)
60
- });
61
- const MANIFEST_FILE = "package.json";
62
- const NODE_MODULES = "node_modules";
63
- const WORKSPACE_PROTOCOL = "workspace:";
64
- const ROOT_SUBPATH = ".";
65
- const SUBPATH_PREFIX = "./";
66
- const WILDCARD = "*";
67
- const TYPES_CONDITION = "types";
68
- const TYPES_SCOPE = "@types/";
69
- const TYPES_SCOPE_SEPARATOR = "__";
70
- const CONDITION_DEPTH_LIMIT = 8;
71
- const ROOT_DEPTH = 0;
72
- const DEPTH_STEP = 1;
73
- const DECLARATIONS_SUFFIX = /\.d\.[cm]?ts$|\.[cm]?tsx?$/u;
74
- const SCRIPT_SUFFIX = /\.(?<module>[cm]?)js$/u;
75
- const readManifest = Effect.fn("readManifest")(function* readManifest(directory) {
76
- const files = yield* RepositoryFiles;
77
- const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));
78
- const text = yield* Effect.fromOption(manifestText);
79
- return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);
80
- }, Effect.option);
81
- const conditionsOf = (held) => {
82
- if (!Predicate.isObject(held)) return [];
83
- return Record.toEntries(held);
84
- };
85
- const typesConditionIn = (held, depth) => {
86
- if (depth > CONDITION_DEPTH_LIMIT) return Option.none();
87
- const entries = conditionsOf(held);
88
- const declared = Array.findFirst(entries, ([condition, target]) => Option.liftPredicate(target, (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate))).pipe(Option.filter(Predicate.isString));
89
- return Option.orElse(declared, () => Array.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)));
90
- };
91
- const anyConditionIn = (held, depth) => {
92
- if (Predicate.isString(held)) return Option.some(held);
93
- if (depth > CONDITION_DEPTH_LIMIT) return Option.none();
94
- return Array.findFirst(conditionsOf(held), ([, nested]) => anyConditionIn(nested, depth + DEPTH_STEP));
95
- };
96
- const targetPathsOf = (target) => Array.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);
97
- const subpathTargetsOf = (exportsField) => {
98
- if (Predicate.isString(exportsField)) return [{
99
- subpath: ROOT_SUBPATH,
100
- target: exportsField
101
- }];
102
- const entries = conditionsOf(exportsField);
103
- if (!pipe(entries, Array.some(([subpath]) => String$1.startsWith(ROOT_SUBPATH)(subpath)))) return Array.match(entries, {
104
- onEmpty: () => [],
105
- onNonEmpty: () => [{
106
- subpath: ROOT_SUBPATH,
107
- target: exportsField
108
- }]
109
- });
110
- return pipe(entries, Array.filter(([subpath]) => subpath === ROOT_SUBPATH || String$1.startsWith(SUBPATH_PREFIX)(subpath)), Array.filter(([subpath]) => !String$1.includes(WILDCARD)(subpath)), Array.map(([subpath, target]) => ({
111
- subpath,
112
- target
113
- })));
114
- };
115
- const declarationsCandidateFor = (entryPath) => {
116
- if (DECLARATIONS_SUFFIX.test(entryPath)) return Option.some(entryPath);
117
- if (!SCRIPT_SUFFIX.test(entryPath)) return Option.none();
118
- return Option.some(String$1.replace(SCRIPT_SUFFIX, ".d.$<module>ts")(entryPath));
119
- };
120
- const firstDeclarationsAmong = Effect.fn("firstDeclarationsAmong")(function* firstDeclarations(directory, entryPaths) {
121
- const files = yield* RepositoryFiles;
122
- const candidates = Array.getSomes(pipe(entryPaths, Array.map((entryPath) => declarationsCandidateFor(entryPath))));
123
- const existing = yield* Effect.filter(pipe(candidates, Array.map((candidate) => files.join(directory, candidate))), (candidate) => files.exists(candidate));
124
- return yield* Option.match(Array.head(existing), {
125
- onNone: () => Effect.succeedNone,
126
- onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome)
127
- });
128
- });
129
- const importNameOf = (packageName) => {
130
- if (!String$1.startsWith(TYPES_SCOPE)(packageName)) return packageName;
131
- const unscoped = String$1.slice(7)(packageName);
132
- if (!String$1.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) return unscoped;
133
- return `@${String$1.replace(TYPES_SCOPE_SEPARATOR, "/")(unscoped)}`;
134
- };
135
- const specifierFor = (packageName, subpath) => {
136
- const importName = importNameOf(packageName);
137
- if (subpath === ROOT_SUBPATH) return importName;
138
- return `${importName}/${String$1.slice(2)(subpath)}`;
139
- };
140
- const rootEntryPaths = (manifest) => Array.getSomes([
141
- Option.fromUndefinedOr(manifest.types),
142
- Option.fromUndefinedOr(manifest.typings),
143
- Option.fromUndefinedOr(manifest.main)
144
- ]);
145
- const subpathEntriesOf = Effect.fn("subpathEntriesOf")(function* subpathEntriesOf(packageName, directory, manifest) {
146
- const found = yield* Effect.forEach(subpathTargetsOf(manifest.exports), ({ subpath, target }) => firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(Effect.map(Option.map((declarationsPath) => ({
147
- packageName,
148
- specifier: specifierFor(packageName, subpath),
149
- declarationsPath
150
- })))));
151
- return Array.getSomes(found);
152
- });
153
- const entriesOfDependency = Effect.fn("entriesOfDependency")(function* entriesOfDependency(packageName, directory) {
154
- const manifest = yield* readManifest(directory);
155
- if (Option.isNone(manifest)) return [];
156
- const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);
157
- const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);
158
- if (pipe(subpathEntries, Array.some((entry) => entry.specifier === rootSpecifier))) return subpathEntries;
159
- return [...(yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value))).pipe(Option.map((declarationsPath) => ({
160
- packageName,
161
- specifier: rootSpecifier,
162
- declarationsPath
163
- })), Option.toArray), ...subpathEntries];
164
- });
165
- const declaredDependencies = (manifest) => pipe(Record.toEntries({
166
- ...manifest.dependencies,
167
- ...manifest.devDependencies,
168
- ...manifest.peerDependencies
169
- }), Array.filter(([, range]) => !String$1.startsWith(WORKSPACE_PROTOCOL)(range)), Array.map(([packageName]) => packageName));
170
- const workspaceDependencies = (manifest) => pipe(Record.toEntries({
171
- ...manifest.dependencies,
172
- ...manifest.devDependencies
173
- }), Array.filter(([, range]) => String$1.startsWith(WORKSPACE_PROTOCOL)(range)), Array.map(([packageName]) => packageName));
174
- const entryOrder = Order.mapInput(Order.String, (entry) => entry.specifier);
175
- const dependencyEntries = Effect.fn("dependencyEntries")(function* dependencyEntries(packageDirectory) {
176
- const files = yield* RepositoryFiles;
177
- const manifest = yield* readManifest(packageDirectory);
178
- if (Option.isNone(manifest)) return [];
179
- const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) => entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)));
180
- return Array.sort(Array.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier), entryOrder);
181
- });
182
- // src/syntax.ts
183
- const NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;
184
- const uniqueByReference = (items) => Array.dedupeWith(items, (left, right) => left === right);
185
- const childrenOf = (node) => {
186
- const children = [];
187
- node.forEachChild((child) => {
188
- children.push(child);
189
- });
190
- return children;
191
- };
192
- const descendantsOf = (node) => pipe(childrenOf(node), Array.flatMap((child) => Array.prepend(descendantsOf(child), child)));
193
- const isExternalFile = (program) => (sourceFile) => String$1.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) || program.isSourceFileFromExternalLibrary(sourceFile);
194
- const isExternalDeclaration = (program) => (declaration) => isExternalFile(program)(declaration.getSourceFile());
195
- const ALIAS_KINDS = /* @__PURE__ */ new Set([
196
- SyntaxKind.ImportSpecifier,
197
- SyntaxKind.ImportClause,
198
- SyntaxKind.NamespaceImport,
199
- SyntaxKind.ExportSpecifier,
200
- SyntaxKind.ImportEqualsDeclaration,
201
- SyntaxKind.ExportAssignment
202
- ]);
203
- const declarationsOf = (symbol) => pipe(symbol.declarations, Array.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))));
204
- const isAliasDeclaration = (declaration) => ALIAS_KINDS.has(declaration.kind);
205
- const resolvedSymbol = (checker) => (symbol) => {
206
- if (!pipe(declarationsOf(symbol), Array.some((declaration) => isAliasDeclaration(declaration)))) return symbol;
207
- return checker.getAliasedSymbol(symbol);
208
- };
209
- const symbolAt = (checker) => (node) => Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(Option.map(resolvedSymbol(checker)));
210
- const referencedSymbols = (checker) => (node) => {
211
- const identifiers = pipe(Array.prepend(descendantsOf(node), node), Array.filter((candidate) => isIdentifier(candidate)));
212
- const symbols = pipe(checker.getSymbolAtLocation(identifiers), Array.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))), Array.map(resolvedSymbol(checker)));
213
- return uniqueByReference(symbols);
214
- };
215
- const lineOf = (node) => {
216
- const sourceFile = node.getSourceFile();
217
- return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
218
- };
219
- const columnOf = (node) => {
220
- const sourceFile = node.getSourceFile();
221
- return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + 1;
222
- };
223
- const contains = (outer) => (inner) => outer.getSourceFile().fileName === inner.getSourceFile().fileName && outer.getStart() <= inner.getStart() && inner.getEnd() <= outer.getEnd();
224
- const isTypeDeclaration = (declaration) => isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration) || isEnumDeclaration(declaration);
225
- const isGenericDeclaration = (declaration) => (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) && Array.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);
226
- const propertyNamesOf = (checker) => (type) => pipe(checker.getPropertiesOfType(type), Array.map((property) => property.name));
227
- const moduleSpecifierOf = (statement) => {
228
- if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) return Option.none();
229
- return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter((specifier) => isStringLiteral(specifier)), Option.map((specifier) => specifier.text));
230
- };
231
- const importedModulesOf = (sourceFile) => pipe(sourceFile.statements, Array.map((statement) => moduleSpecifierOf(statement)), Array.getSomes);
232
- // src/problem.ts
233
- const RuleNameSchema = Schema.Literals([
234
- "owner-annotation",
235
- "duplicate-value-set",
236
- "owner-value-set",
237
- "owner-extension",
238
- "owned-literal",
239
- "library-value-set",
240
- "library-shape",
241
- "unused-override",
242
- "removable-override",
243
- "hidden-unicode",
244
- "python-file",
245
- "python-command",
246
- "nested-docs",
247
- "stack-dependency",
248
- "install-size"
249
- ]);
250
- const ProblemSchema = Schema.Struct({
251
- file: Schema.String,
252
- line: Schema.Int,
253
- column: Schema.Int,
254
- rule: RuleNameSchema,
255
- message: Schema.String
256
- });
257
- const ProblemList = Schema.Array(ProblemSchema);
258
- const problemAt = ({ rule, message }) => (node) => ({
259
- file: node.getSourceFile().fileName,
260
- line: lineOf(node),
261
- column: columnOf(node),
262
- rule,
263
- message
264
- });
265
- const problemOrder = Order.combineAll([
266
- Order.mapInput(Order.String, (problem) => problem.file),
267
- Order.mapInput(Order.Number, (problem) => problem.line),
268
- Order.mapInput(Order.Number, (problem) => problem.column),
269
- Order.mapInput(Order.String, (problem) => problem.rule),
270
- Order.mapInput(Order.String, (problem) => problem.message)
271
- ]);
272
- const problemKey = (problem) => pipe([
273
- problem.file,
274
- String(problem.line),
275
- String(problem.column),
276
- problem.rule,
277
- problem.message
278
- ], Array.join("\0"));
279
- const sortProblems = (problems) => Array.sort(Array.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)), problemOrder);
280
- const describeFinding = (problem) => `[${problem.rule}] ${problem.message}`;
281
- const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;
282
- // src/cli-contract.ts
283
- const JSON_FLAG = "--json";
284
- export { isObjectLiteralExpression as $, nodeServicesLayer as A, isBinaryExpression as B, MANIFEST_FILE as C, workspaceDependencies as D, readManifest as E, getJSDocTags as F, isExportDeclaration as G, isClassDeclaration as H, getLeadingCommentRanges as I, isInterfaceDeclaration as J, isIdentifier as K, getNameOfDeclaration as L, IndexKind as M, InternalSymbolName as N, RepositoryFiles as O, SyntaxKind as P, isNumericLiteral as Q, getTextOfJSDocComment as R, uniqueByReference as S, dependencyEntries as T, isElementAccessExpression as U, isCallExpression as V, isEnumDeclaration as W, isModuleDeclaration as X, isModuleBlock as Y, isNewExpression as Z, lineOf as _, problemAt as a, isSpreadElement as at, resolvedSymbol as b, childrenOf as c, isTypeLiteralNode as ct, declarationsOf as d, isVariableDeclaration as dt, isPropertyAccessExpression as et, descendantsOf as f, isVariableDeclarationList as ft, isTypeDeclaration as g, isGenericDeclaration as h, formatProblem as i, isSourceFile as it, API as j, nodeRepositoryFiles as k, columnOf as l, isTypeReferenceNode as lt, isExternalDeclaration as m, ProblemList as n, isSatisfiesExpression as nt, sortProblems as o, isStringLiteral as ot, importedModulesOf as p, isVariableStatement as pt, isImportDeclaration as q, describeFinding as r, isSignatureDeclaration as rt, NODE_MODULES_SEGMENT as s, isTypeAliasDeclaration as st, JSON_FLAG as t, isPropertyAssignment as tt, contains as u, isUnionTypeNode as ut, propertyNamesOf as v, NODE_MODULES as w, symbolAt as x, referencedSymbols as y, isArrayLiteralExpression as z };
285
-
286
- //# sourceMappingURL=cli-contract-DpQurUwC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-contract-DpQurUwC.mjs","names":["Str","Arr","Rec","Arr","Str","Arr","Str","Arr"],"sources":["../src/node-services.ts","../src/repository-files.ts","../src/dependencies.ts","../src/syntax.ts","../src/problem.ts","../src/cli-contract.ts"],"sourcesContent":["import {\n NodeChildProcessSpawner,\n NodeFileSystem,\n NodePath,\n NodeStdio,\n} from \"@effect/platform-node-shared\";\nimport { Layer } from \"effect\";\n\nconst nodeServicesLayer = Layer.provideMerge(\n NodeChildProcessSpawner.layer,\n Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer),\n);\n\n/** @internal */\nexport { nodeServicesLayer };\n","import {\n Array as Arr,\n Context,\n Effect,\n FileSystem,\n Layer,\n Path,\n Stream,\n String as Str,\n pipe,\n} from \"effect\";\nimport type { Option } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\n\nimport { nodeServicesLayer } from \"./node-services.ts\";\n\nconst MISSING_SIZE = 0;\nconst GENERATED_PATHSPEC = \":(attr:linguist-generated)\";\nconst LISTED_ARGS = [\"--cached\", \"--others\", \"--exclude-standard\"];\n\nclass RepositoryFiles extends Context.Service<\n RepositoryFiles,\n {\n readonly readFile: (file: string) => Effect.Effect<Option.Option<string>>;\n readonly exists: (file: string) => Effect.Effect<boolean>;\n readonly realPath: (file: string) => Effect.Effect<string>;\n readonly readDirectory: (directory: string) => Effect.Effect<readonly string[]>;\n readonly generatedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly listedFiles: (root: string) => Effect.Effect<readonly string[]>;\n readonly isDirectory: (file: string) => Effect.Effect<Option.Option<boolean>>;\n readonly fileSize: (file: string) => Effect.Effect<number>;\n readonly join: (...segments: readonly string[]) => string;\n readonly resolve: (...segments: readonly string[]) => string;\n readonly relative: (from: string, to: string) => string;\n readonly dirname: (file: string) => string;\n readonly basename: (file: string) => string;\n }\n>()(\"@r_masseater/msch/repository-files/RepositoryFiles\") {}\n\nconst nodeRepositoryFiles = Layer.effect(\n RepositoryFiles,\n Effect.gen(function* nodeRepositoryFiles() {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n const gitFiles = (root: string, args: readonly string[]): Effect.Effect<readonly string[]> =>\n Effect.gen(function* listFiles() {\n const handle = yield* ChildProcess.make(\"git\", [\"ls-files\", \"-z\", ...args], {\n cwd: root,\n stdin: \"ignore\",\n });\n const listed = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);\n return pipe(Str.split(listed, \"\\0\"), Arr.filter(Str.isNonEmpty));\n }).pipe(\n Effect.scoped,\n Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),\n Effect.orElseSucceed((): readonly string[] => []),\n );\n return RepositoryFiles.of({\n generatedFiles: (root) =>\n gitFiles(root, [\"--\", GENERATED_PATHSPEC]).pipe(\n Effect.map(Arr.map((file) => path.join(root, file))),\n ),\n listedFiles: (root) => gitFiles(root, LISTED_ARGS),\n readFile: (file) => fs.readFileString(file).pipe(Effect.option),\n exists: (file) => fs.exists(file).pipe(Effect.orElseSucceed(() => false)),\n realPath: (file) => fs.realPath(file).pipe(Effect.orElseSucceed(() => file)),\n readDirectory: (directory) =>\n fs.readDirectory(directory).pipe(Effect.orElseSucceed((): readonly string[] => [])),\n isDirectory: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => info.type === \"Directory\"),\n Effect.option,\n ),\n fileSize: (file) =>\n fs.stat(file).pipe(\n Effect.map((info) => Number(info.size)),\n Effect.orElseSucceed(() => MISSING_SIZE),\n ),\n join: (...segments) => path.join(...segments),\n resolve: (...segments) => path.resolve(...segments),\n relative: (from, to) => path.relative(from, to),\n dirname: (file) => path.dirname(file),\n basename: (file) => path.basename(file),\n });\n }),\n).pipe(Layer.provide(nodeServicesLayer));\n\nexport { RepositoryFiles, nodeRepositoryFiles };\n","import {\n Array as Arr,\n Effect,\n Option,\n Order,\n Predicate,\n Schema,\n String as Str,\n Record as Rec,\n pipe,\n} from \"effect\";\n\nimport { RepositoryFiles } from \"./repository-files.ts\";\n\ninterface DependencyEntry {\n readonly packageName: string;\n readonly specifier: string;\n readonly declarationsPath: string;\n}\n\nconst DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));\n\nconst PackageManifest = Schema.Struct({\n name: Schema.optional(Schema.String),\n dependencies: DependencyMap,\n devDependencies: DependencyMap,\n peerDependencies: DependencyMap,\n exports: Schema.optional(Schema.Unknown),\n types: Schema.optional(Schema.String),\n typings: Schema.optional(Schema.String),\n main: Schema.optional(Schema.String),\n});\n\ntype Manifest = typeof PackageManifest.Type;\n\nconst MANIFEST_FILE = \"package.json\";\nconst NODE_MODULES = \"node_modules\";\nconst WORKSPACE_PROTOCOL = \"workspace:\";\nconst ROOT_SUBPATH = \".\";\nconst SUBPATH_PREFIX = \"./\";\nconst WILDCARD = \"*\";\nconst TYPES_CONDITION = \"types\";\nconst TYPES_SCOPE = \"@types/\";\nconst TYPES_SCOPE_SEPARATOR = \"__\";\nconst CONDITION_DEPTH_LIMIT = 8;\nconst ROOT_DEPTH = 0;\nconst DEPTH_STEP = 1;\nconst DECLARATIONS_SUFFIX = /\\.d\\.[cm]?ts$|\\.[cm]?tsx?$/u;\nconst SCRIPT_SUFFIX = /\\.(?<module>[cm]?)js$/u;\n\nconst readManifest = Effect.fn(\"readManifest\")(function* readManifest(directory: string) {\n const files = yield* RepositoryFiles;\n const manifestText = yield* files.readFile(files.join(directory, MANIFEST_FILE));\n const text = yield* Effect.fromOption(manifestText);\n return yield* Schema.decodeEffect(Schema.fromJsonString(PackageManifest))(text);\n}, Effect.option);\n\nconst conditionsOf = (held: unknown): readonly (readonly [string, unknown])[] => {\n if (!Predicate.isObject(held)) {\n return [];\n }\n return Rec.toEntries(held);\n};\n\nconst typesConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n const entries = conditionsOf(held);\n const declared = Arr.findFirst(entries, ([condition, target]) =>\n Option.liftPredicate(\n target,\n (candidate) => condition === TYPES_CONDITION && Predicate.isString(candidate),\n ),\n ).pipe(Option.filter(Predicate.isString));\n return Option.orElse(declared, () =>\n Arr.findFirst(entries, ([, nested]) => typesConditionIn(nested, depth + DEPTH_STEP)),\n );\n};\n\nconst anyConditionIn = (held: unknown, depth: number): Option.Option<string> => {\n if (Predicate.isString(held)) {\n return Option.some(held);\n }\n if (depth > CONDITION_DEPTH_LIMIT) {\n return Option.none();\n }\n return Arr.findFirst(conditionsOf(held), ([, nested]) =>\n anyConditionIn(nested, depth + DEPTH_STEP),\n );\n};\n\nconst targetPathsOf = (target: unknown): readonly string[] =>\n Arr.getSomes([typesConditionIn(target, ROOT_DEPTH), anyConditionIn(target, ROOT_DEPTH)]);\n\ninterface SubpathTarget {\n readonly subpath: string;\n readonly target: unknown;\n}\n\nconst subpathTargetsOf = (exportsField: unknown): readonly SubpathTarget[] => {\n if (Predicate.isString(exportsField)) {\n return [{ subpath: ROOT_SUBPATH, target: exportsField }];\n }\n const entries = conditionsOf(exportsField);\n if (\n !pipe(\n entries,\n Arr.some(([subpath]) => Str.startsWith(ROOT_SUBPATH)(subpath)),\n )\n ) {\n return Arr.match(entries, {\n onEmpty: () => [],\n onNonEmpty: () => [{ subpath: ROOT_SUBPATH, target: exportsField }],\n });\n }\n return pipe(\n entries,\n Arr.filter(([subpath]) => subpath === ROOT_SUBPATH || Str.startsWith(SUBPATH_PREFIX)(subpath)),\n Arr.filter(([subpath]) => !Str.includes(WILDCARD)(subpath)),\n Arr.map(([subpath, target]) => ({ subpath, target })),\n );\n};\n\nconst declarationsCandidateFor = (entryPath: string): Option.Option<string> => {\n if (DECLARATIONS_SUFFIX.test(entryPath)) {\n return Option.some(entryPath);\n }\n if (!SCRIPT_SUFFIX.test(entryPath)) {\n return Option.none();\n }\n return Option.some(Str.replace(SCRIPT_SUFFIX, \".d.$<module>ts\")(entryPath));\n};\n\nconst firstDeclarationsAmong = Effect.fn(\"firstDeclarationsAmong\")(function* firstDeclarations(\n directory: string,\n entryPaths: readonly string[],\n) {\n const files = yield* RepositoryFiles;\n const candidates = Arr.getSomes(\n pipe(\n entryPaths,\n Arr.map((entryPath) => declarationsCandidateFor(entryPath)),\n ),\n );\n const existing = yield* Effect.filter(\n pipe(\n candidates,\n Arr.map((candidate) => files.join(directory, candidate)),\n ),\n (candidate) => files.exists(candidate),\n );\n return yield* Option.match(Arr.head(existing), {\n onNone: (): Effect.Effect<Option.Option<string>> => Effect.succeedNone,\n onSome: (candidate) => files.realPath(candidate).pipe(Effect.asSome),\n });\n});\n\nconst importNameOf = (packageName: string): string => {\n if (!Str.startsWith(TYPES_SCOPE)(packageName)) {\n return packageName;\n }\n const unscoped = Str.slice(TYPES_SCOPE.length)(packageName);\n if (!Str.includes(TYPES_SCOPE_SEPARATOR)(unscoped)) {\n return unscoped;\n }\n return `@${Str.replace(TYPES_SCOPE_SEPARATOR, \"/\")(unscoped)}`;\n};\n\nconst specifierFor = (packageName: string, subpath: string): string => {\n const importName = importNameOf(packageName);\n if (subpath === ROOT_SUBPATH) {\n return importName;\n }\n return `${importName}/${Str.slice(SUBPATH_PREFIX.length)(subpath)}`;\n};\n\nconst rootEntryPaths = (manifest: Manifest): readonly string[] =>\n Arr.getSomes([\n Option.fromUndefinedOr(manifest.types),\n Option.fromUndefinedOr(manifest.typings),\n Option.fromUndefinedOr(manifest.main),\n ]);\n\nconst subpathEntriesOf = Effect.fn(\"subpathEntriesOf\")(function* subpathEntriesOf(\n packageName: string,\n directory: string,\n manifest: Manifest,\n) {\n const found = yield* Effect.forEach(subpathTargetsOf(manifest.exports), ({ subpath, target }) =>\n firstDeclarationsAmong(directory, targetPathsOf(target)).pipe(\n Effect.map(\n Option.map((declarationsPath) => ({\n packageName,\n specifier: specifierFor(packageName, subpath),\n declarationsPath,\n })),\n ),\n ),\n );\n return Arr.getSomes(found);\n});\n\nconst entriesOfDependency = Effect.fn(\"entriesOfDependency\")(function* entriesOfDependency(\n packageName: string,\n directory: string,\n) {\n const manifest = yield* readManifest(directory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const subpathEntries = yield* subpathEntriesOf(packageName, directory, manifest.value);\n const rootSpecifier = specifierFor(packageName, ROOT_SUBPATH);\n if (\n pipe(\n subpathEntries,\n Arr.some((entry) => entry.specifier === rootSpecifier),\n )\n ) {\n return subpathEntries;\n }\n const rootDeclarations = yield* firstDeclarationsAmong(directory, rootEntryPaths(manifest.value));\n const rootEntries = rootDeclarations.pipe(\n Option.map((declarationsPath) => ({ packageName, specifier: rootSpecifier, declarationsPath })),\n Option.toArray,\n );\n return [...rootEntries, ...subpathEntries];\n});\n\nconst declaredDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({\n ...manifest.dependencies,\n ...manifest.devDependencies,\n ...manifest.peerDependencies,\n }),\n Arr.filter(([, range]) => !Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst workspaceDependencies = (manifest: Manifest): readonly string[] =>\n pipe(\n Rec.toEntries({ ...manifest.dependencies, ...manifest.devDependencies }),\n Arr.filter(([, range]) => Str.startsWith(WORKSPACE_PROTOCOL)(range)),\n Arr.map(([packageName]) => packageName),\n );\n\nconst entryOrder = Order.mapInput(Order.String, (entry: DependencyEntry) => entry.specifier);\n\nconst dependencyEntries = Effect.fn(\"dependencyEntries\")(function* dependencyEntries(\n packageDirectory: string,\n) {\n const files = yield* RepositoryFiles;\n const manifest = yield* readManifest(packageDirectory);\n if (Option.isNone(manifest)) {\n return [];\n }\n const entries = yield* Effect.forEach(declaredDependencies(manifest.value), (packageName) =>\n entriesOfDependency(packageName, files.join(packageDirectory, NODE_MODULES, packageName)),\n );\n return Arr.sort(\n Arr.dedupeWith(entries.flat(), (left, right) => left.specifier === right.specifier),\n entryOrder,\n );\n});\n\nexport { MANIFEST_FILE, NODE_MODULES, dependencyEntries, readManifest, workspaceDependencies };\nexport type { DependencyEntry, Manifest };\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./dependencies.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nconst POSITION_BASE = 1;\n\nconst uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nconst childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile);\n\nconst isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nconst declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\n\nconst resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nconst symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nconst referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nconst lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nconst columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nconst contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nconst isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nconst propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nconst importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n\nexport {\n NODE_MODULES_SEGMENT,\n POSITION_BASE,\n childrenOf,\n columnOf,\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n isExternalDeclaration,\n isGenericDeclaration,\n isTypeDeclaration,\n lineOf,\n propertyNamesOf,\n referencedSymbols,\n resolvedSymbol,\n symbolAt,\n uniqueByReference,\n};\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"nested-docs\",\n \"stack-dependency\",\n \"install-size\",\n]);\n\ntype RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\ntype Problem = typeof ProblemSchema.Type;\n\nconst ProblemList = Schema.Array(ProblemSchema);\n\nconst CANDIDATE_LIMIT = 3;\n\ninterface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nconst problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nconst sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nconst describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nconst formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n\nexport { CANDIDATE_LIMIT, ProblemList, describeFinding, formatProblem, problemAt, sortProblems };\nexport type { Finding, Problem, RuleName };\n","const JSON_FLAG = \"--json\";\n\nexport { JSON_FLAG };\n"],"mappings":";;;;;;;AAQA,MAAM,oBAAoB,MAAM,aAC9B,wBAAwB,OACxB,MAAM,SAAS,eAAe,OAAO,SAAS,OAAO,UAAU,KAAK,CACtE;;ACKA,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,cAAc;CAAC;CAAY;CAAY;AAAoB;AAEjE,IAAM,kBAAN,cAA8B,QAAQ,QAiBpC,CAAC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