codemod 2.0.0-alpha.2 → 2.0.0-alpha.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/README.md +1 -2
- package/package.json +14 -16
- package/register.d.mts +2 -11
- package/register.mjs +53 -46
- package/runtime/addon.d.mts +119 -0
- package/runtime/addon.mjs +36 -40
- package/runtime/ast-grep.d.mts +20 -0
- package/runtime/ast-grep.mjs +50 -61
- package/runtime/context.d.mts +25 -0
- package/runtime/context.mjs +10 -64
- package/runtime/hooks.d.mts +2 -0
- package/runtime/hooks.mjs +4 -6
- package/runtime/host.d.mts +81 -81
- package/runtime/host.mjs +428 -326
- package/runtime/llm.d.mts +2 -0
- package/runtime/llm.mjs +1 -7
- package/runtime/modules.d.mts +3 -0
- package/runtime/modules.mjs +7 -10
- package/runtime/orchestrator-version.d.mts +2 -0
- package/runtime/orchestrator-version.mjs +3 -0
- package/runtime/orchestrator.d.mts +261 -0
- package/runtime/orchestrator.mjs +823 -608
- package/runtime/runtime.d.mts +15 -0
- package/runtime/runtime.mjs +18 -26
- package/runtime/workflow.d.mts +24 -0
- package/runtime/workflow.mjs +42 -121
- package/testing/index.d.mts +107 -155
- package/testing/index.mjs +552 -545
- package/types/index.d.ts +0 -1
- package/types/langs/package.json +3 -0
- package/types/modules/ast-grep.d.ts +22 -1
- package/types/modules/workflow.d.ts +386 -231
- package/vite.d.mts +4 -21
- package/vite.mjs +23 -17
- package/runtime/metrics.mjs +0 -45
- package/types/metrics.d.ts +0 -5
- package/types/modules/metrics.d.ts +0 -107
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/// <reference path="llrt/index.d.ts" />
|
|
3
3
|
/// <reference path="modules/ast-grep.d.ts" />
|
|
4
4
|
/// <reference path="modules/llm.d.ts" />
|
|
5
|
-
/// <reference path="modules/metrics.d.ts" />
|
|
6
5
|
/// <reference path="modules/runtime.d.ts" />
|
|
7
6
|
/// <reference path="modules/workflow.d.ts" />
|
|
8
7
|
/// <reference path="modules/langs.d.ts" />
|
|
@@ -589,10 +589,31 @@ declare module "codemod:ast-grep" {
|
|
|
589
589
|
*/
|
|
590
590
|
export type Transform<T extends TypesMap> = Codemod<T>;
|
|
591
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Any JSON a transform reports about its file. A `jssg` step's `data`
|
|
594
|
+
* lists it per file, or folds it with the step's reducer. Explicit `null`
|
|
595
|
+
* is reported; missing or `undefined` data is omitted.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```ts
|
|
599
|
+
* return { edit: null, data: { props: props.map((p) => p.text()) } };
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
export type TransformData =
|
|
603
|
+
| string
|
|
604
|
+
| number
|
|
605
|
+
| boolean
|
|
606
|
+
| null
|
|
607
|
+
| readonly TransformData[]
|
|
608
|
+
| { readonly [key: string]: TransformData };
|
|
609
|
+
|
|
610
|
+
/** The new text (`edit`, or `null` for no change), and data to report. */
|
|
611
|
+
export type TransformResult = { edit?: string | null; data?: TransformData };
|
|
612
|
+
|
|
592
613
|
export type Codemod<T extends TypesMap> = (
|
|
593
614
|
root: SgRoot<T>,
|
|
594
615
|
options: TransformOptions<T>,
|
|
595
|
-
) => Promise<string | null>;
|
|
616
|
+
) => Promise<string | null | TransformResult>;
|
|
596
617
|
|
|
597
618
|
export type GetSelectorOptions<_T extends TypesMap> = {
|
|
598
619
|
params: Record<string, string>;
|