@venizia/dev-configs 0.5.0-10 → 0.5.0-12
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 +3 -3
- package/dist/cli/codemod/async-context.d.ts +22 -0
- package/dist/cli/codemod/async-context.js +146 -0
- package/dist/cli/codemod/async-context.js.map +1 -0
- package/dist/cli/codemod/class-renames.d.ts +63 -0
- package/dist/cli/codemod/class-renames.js +208 -17
- package/dist/cli/codemod/class-renames.js.map +1 -1
- package/dist/cli/codemod/execution-class.d.ts +14 -0
- package/dist/cli/codemod/execution-class.js +46 -0
- package/dist/cli/codemod/execution-class.js.map +1 -0
- package/dist/cli/codemod/execution-scope.d.ts +68 -0
- package/dist/cli/codemod/execution-scope.js +727 -0
- package/dist/cli/codemod/execution-scope.js.map +1 -0
- package/dist/cli/codemod/index.js +25 -0
- package/dist/cli/codemod/index.js.map +1 -1
- package/dist/cli/codemod/namespace-functions/mapping.d.ts +6 -0
- package/dist/cli/codemod/namespace-functions/mapping.js.map +1 -1
- package/dist/cli/codemod/namespace-functions/mappings/connectors.d.ts +2 -0
- package/dist/cli/codemod/namespace-functions/mappings/connectors.js +19 -1
- package/dist/cli/codemod/namespace-functions/mappings/connectors.js.map +1 -1
- package/dist/cli/codemod/namespace-functions/mappings/guards.d.ts +4 -0
- package/dist/cli/codemod/namespace-functions/mappings/guards.js +15 -0
- package/dist/cli/codemod/namespace-functions/mappings/guards.js.map +1 -0
- package/dist/cli/codemod/namespace-functions/mappings/helpers.d.ts +3 -2
- package/dist/cli/codemod/namespace-functions/mappings/helpers.js +30 -9
- package/dist/cli/codemod/namespace-functions/mappings/helpers.js.map +1 -1
- package/dist/cli/codemod/namespace-functions/mappings/inversion.d.ts +6 -2
- package/dist/cli/codemod/namespace-functions/mappings/inversion.js +42 -3
- package/dist/cli/codemod/namespace-functions/mappings/inversion.js.map +1 -1
- package/dist/cli/codemod/namespace-functions/mappings/kernel.d.ts +4 -2
- package/dist/cli/codemod/namespace-functions/mappings/kernel.js +16 -3
- package/dist/cli/codemod/namespace-functions/mappings/kernel.js.map +1 -1
- package/dist/cli/codemod/namespace-functions/rewriter.d.ts +7 -0
- package/dist/cli/codemod/namespace-functions/rewriter.js +75 -8
- package/dist/cli/codemod/namespace-functions/rewriter.js.map +1 -1
- package/dist/cli/codemod/public-names.d.ts +25 -0
- package/dist/cli/codemod/public-names.js +134 -0
- package/dist/cli/codemod/public-names.js.map +1 -0
- package/dist/cli/index.js +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/compilers/bun.js +8 -1
- package/dist/compilers/bun.js.map +1 -1
- package/dist/linters/eslint.js.map +1 -1
- package/dist/linters/house/configs.js +8 -4
- package/dist/linters/house/configs.js.map +1 -1
- package/dist/linters/house/execution-support.d.ts +66 -0
- package/dist/linters/house/execution-support.js +161 -0
- package/dist/linters/house/execution-support.js.map +1 -0
- package/dist/linters/house/framework-api-patterns.js +1 -1
- package/dist/linters/house/framework-api-patterns.js.map +1 -1
- package/dist/linters/house/index.d.ts +3 -1
- package/dist/linters/house/index.js +3 -1
- package/dist/linters/house/index.js.map +1 -1
- package/dist/linters/house/no-shadow-framework-type.rule.d.ts +1 -1
- package/dist/linters/house/no-shadow-framework-type.rule.js +1 -1
- package/dist/linters/house/no-shadow-framework-type.rule.js.map +1 -1
- package/dist/linters/house/plugin.js +6 -2
- package/dist/linters/house/plugin.js.map +1 -1
- package/dist/linters/house/prefer-execution-sleep.rule.d.ts +31 -0
- package/dist/linters/house/{prefer-promise-sleep.rule.js → prefer-execution-sleep.rule.js} +57 -20
- package/dist/linters/house/prefer-execution-sleep.rule.js.map +1 -0
- package/dist/linters/house/prefer-http-method.rule.d.ts +6 -3
- package/dist/linters/house/prefer-http-method.rule.js +116 -9
- package/dist/linters/house/prefer-http-method.rule.js.map +1 -1
- package/dist/linters/house/restrict-execution-call-sites.rule.d.ts +30 -0
- package/dist/linters/house/restrict-execution-call-sites.rule.js +142 -0
- package/dist/linters/house/restrict-execution-call-sites.rule.js.map +1 -0
- package/dist/linters/house/static-execution-reason.rule.d.ts +27 -0
- package/dist/linters/house/static-execution-reason.rule.js +152 -0
- package/dist/linters/house/static-execution-reason.rule.js.map +1 -0
- package/dist/linters/rules/naming-convention.rule.js +1 -1
- package/dist/linters/rules/naming-convention.rule.js.map +1 -1
- package/dist/linters/rules/no-restricted-imports.rule.d.ts +4 -2
- package/dist/linters/rules/no-restricted-imports.rule.js.map +1 -1
- package/dist/linters/rules/no-unused-vars.rule.d.ts +13 -2
- package/dist/linters/rules/no-unused-vars.rule.js.map +1 -1
- package/package.json +2 -2
- package/dist/linters/house/prefer-promise-sleep.rule.d.ts +0 -26
- package/dist/linters/house/prefer-promise-sleep.rule.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type ICodemodRewrite } from './class-renames';
|
|
2
|
+
/** What a helper of the map is. */
|
|
3
|
+
export type TExecutionScopeEntry = ({
|
|
4
|
+
mode: 'system';
|
|
5
|
+
} | {
|
|
6
|
+
mode: 'scoped';
|
|
7
|
+
values?: Readonly<Record<string, string>>;
|
|
8
|
+
}) & {
|
|
9
|
+
/** The module the helper is imported from. Without it, only a module of the application is read. */
|
|
10
|
+
from?: string;
|
|
11
|
+
};
|
|
12
|
+
/** The helpers of an application, by exported name or "Class.method". */
|
|
13
|
+
export type TExecutionScopeMap = Readonly<Record<string, TExecutionScopeEntry>>;
|
|
14
|
+
/** What `ExecutionScopeRewrite.rewrite` did to one file; `info` is always there. */
|
|
15
|
+
export interface IExecutionScopeRewrite extends ICodemodRewrite {
|
|
16
|
+
info: NonNullable<ICodemodRewrite['info']>;
|
|
17
|
+
}
|
|
18
|
+
/** Reads and checks the JSON of `--map`. */
|
|
19
|
+
export declare class ExecutionScopeMapReader {
|
|
20
|
+
private static isRecord;
|
|
21
|
+
/** The values of a scoped entry, or `undefined` when one is not an option name. */
|
|
22
|
+
private static readValues;
|
|
23
|
+
private static readEntry;
|
|
24
|
+
/** The map in `text`, or why it is not one. */
|
|
25
|
+
static parse(opts: {
|
|
26
|
+
text: string;
|
|
27
|
+
}): {
|
|
28
|
+
map: TExecutionScopeMap;
|
|
29
|
+
} | {
|
|
30
|
+
error: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Rewrites the calls of one file. */
|
|
34
|
+
export declare class ExecutionScopeRewrite {
|
|
35
|
+
/** Whether a helper imported from `module` is the one the entry means: another package may use the same name. */
|
|
36
|
+
private static isHelperModule;
|
|
37
|
+
/** Whether `node` names a member or a property, and is no use of a binding. */
|
|
38
|
+
private static isMemberName;
|
|
39
|
+
/** The mapped helpers this file defines itself: its calls are the helper's own, and stay. */
|
|
40
|
+
private static definitions;
|
|
41
|
+
/** The event handlers and queue consumers of the file: they ran with their starter's rights, and no longer do. */
|
|
42
|
+
private static listeners;
|
|
43
|
+
/** The method or function a node stands in; without one, the variable or property it is written under. */
|
|
44
|
+
private static methodOf;
|
|
45
|
+
/** Whether a comment stands in a part of the call that the rewrite replaces. */
|
|
46
|
+
private static hasComment;
|
|
47
|
+
/** The task and the values of a call, or why the call cannot be read. */
|
|
48
|
+
private static readCall;
|
|
49
|
+
static rewrite(opts: {
|
|
50
|
+
typescript: typeof import('typescript');
|
|
51
|
+
fileName: string;
|
|
52
|
+
/** The file as the reason of a system call names it. */
|
|
53
|
+
shownName: string;
|
|
54
|
+
source: string;
|
|
55
|
+
map: TExecutionScopeMap;
|
|
56
|
+
isNestedRewritten: boolean;
|
|
57
|
+
}): IExecutionScopeRewrite;
|
|
58
|
+
}
|
|
59
|
+
/** `devz codemod execution-scope`: an application's own scope helpers to `Execution.run`. */
|
|
60
|
+
export declare class ExecutionScopeCommand {
|
|
61
|
+
static readonly USAGE = "Usage: devz codemod execution-scope --map <file.json> [paths...] [--write [--all] | --check] [--rewrite-nested]\n\nAn application's own scope helpers become Execution.run (@venizia/ignis). The map names them:\n\n {\n \"runElevated\": { \"mode\": \"system\" },\n \"runPinned\": { \"mode\": \"scoped\", \"values\": { \"tenantIds\": \"tenantIds\" } }\n }\n\nA key is the exported name of a helper, or \"Class.method\". \"values\" names the value of the frame (left) and the\noption of the helper that holds it (right). A helper is read when it is imported from a module of the application\n(a path starting \".\", \"@/\", \"~/\" or \"#\"); for one that comes from a package, name the package with \"from\":\n\n { \"runElevated\": { \"mode\": \"system\", \"from\": \"@acme/core\" } }\n\nWith \"from\", only that module is read. The same name imported from anywhere else is listed. It reads a call of an imported helper, an aliased import included, in\none of these shapes, where the task is an arrow or a function with no parameter, written in the call:\n\n helper(task) a helper with no \"values\"\n helper({ tenantIds, task }) the options of \"values\" and one other property, the task\n helper({ tenantIds }, task) the options of \"values\", then the task\n\nA system call gets the reason \"TODO: reason (<file>:<method>)\" for you to write. It lists by file and line what it\nleaves for you: those reasons, every call it cannot read (a helper passed as a value, a spread argument, a task by\nreference), and every system call lexically inside a scoped one, which would see more under \"the innermost frame\nwins\". It does not follow calls across functions. A file that defines a mapped helper is not touched. Event\nhandlers and queue consumers are listed as \"review\": they no longer inherit system rights.\n\nExecution.run always returns a promise: where a helper was synchronous, your typecheck and tests must confirm the call.\n\n --map the JSON file of your helpers (required), relative to the working directory\n --write write the changed files (without it, nothing is written); it needs a path, or --all\n --all with --write and no path: rewrite every source file under the working directory\n --check dry run that exits 1 while a file would change or a line is left for you (for CI)\n --rewrite-nested rewrite the system calls inside scoped ones too, after you reviewed them\n --help print this text and exit\n\nThere is no --reverse: a downgrade restores the files from git.";
|
|
62
|
+
private static refuse;
|
|
63
|
+
static run(opts: {
|
|
64
|
+
root: string;
|
|
65
|
+
args: string[];
|
|
66
|
+
}): Promise<number>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=execution-scope.d.ts.map
|