@kamaalio/codemod-kit 0.0.39 → 0.0.41
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/dist/codemods/index.d.ts +1 -1
- package/dist/codemods/types.d.ts +6 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/codemods/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { runCodemods, runCodemod, commitEditModifications, findAndReplace, findAndReplaceEdits, findAndReplaceConfig, findAndReplaceConfigModifications, traverseUp, runCodemodsOnProjects, } from './utils.js';
|
|
2
|
-
export type { Codemod, Modifications, FindAndReplaceConfig, RunCodemodOkResult, RunCodemodResult, CodemodRunnerCodemod, RepositoryToClone, } from './types.js';
|
|
2
|
+
export type { Codemod, Modifications, FindAndReplaceConfig, RunCodemodOkResult, RunCodemodResult, CodemodRunnerCodemod, RepositoryToClone, CodemodOptions, } from './types.js';
|
package/dist/codemods/types.d.ts
CHANGED
|
@@ -10,14 +10,18 @@ export type RunCodemodOkResult = {
|
|
|
10
10
|
root: string;
|
|
11
11
|
};
|
|
12
12
|
export type RunCodemodResult = Result<RunCodemodOkResult, Error>;
|
|
13
|
+
export type CodemodOptions = {
|
|
14
|
+
postTransform?: Record<string, unknown>;
|
|
15
|
+
};
|
|
13
16
|
export type Codemod = {
|
|
14
17
|
name: string;
|
|
15
18
|
languages: Set<NapiLang> | Array<NapiLang>;
|
|
16
|
-
|
|
19
|
+
options?: CodemodOptions;
|
|
20
|
+
transformer: (content: string, filename?: types.Optional<string>, codemod?: types.Optional<Codemod>) => Promise<string>;
|
|
17
21
|
postTransform?: (results: {
|
|
18
22
|
root: string;
|
|
19
23
|
results: Array<RunCodemodOkResult>;
|
|
20
|
-
}) => Promise<void>;
|
|
24
|
+
}, codemod: Codemod) => Promise<void>;
|
|
21
25
|
targetFiltering?: (filepath: string, codemod: Codemod) => boolean;
|
|
22
26
|
};
|
|
23
27
|
export type CodemodRunnerCodemod<Tag = string, C extends Codemod = Codemod> = C & {
|
package/dist/index.cjs
CHANGED
|
@@ -621,7 +621,7 @@ async function runCodemod(codemod, transformationPath, options) {
|
|
|
621
621
|
root,
|
|
622
622
|
results: successesGroupedByRoot[root] ?? []
|
|
623
623
|
}));
|
|
624
|
-
await Promise.all(rootPathsWithResults.map((r)=>(codemod.postTransform ?? (async ()=>{}))(r)));
|
|
624
|
+
await Promise.all(rootPathsWithResults.map((r)=>(codemod.postTransform ?? (async ()=>{}))(r, codemod)));
|
|
625
625
|
return results;
|
|
626
626
|
}
|
|
627
627
|
function traverseUp(node, until) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { runCodemods, runCodemod, commitEditModifications, findAndReplace, findAndReplaceEdits, findAndReplaceConfig, findAndReplaceConfigModifications, traverseUp, runCodemodsOnProjects, type Codemod, type Modifications, type FindAndReplaceConfig, type RunCodemodOkResult, type RunCodemodResult, type CodemodRunnerCodemod, type RepositoryToClone, } from './codemods/index.js';
|
|
1
|
+
export { runCodemods, runCodemod, commitEditModifications, findAndReplace, findAndReplaceEdits, findAndReplaceConfig, findAndReplaceConfigModifications, traverseUp, runCodemodsOnProjects, type Codemod, type Modifications, type FindAndReplaceConfig, type RunCodemodOkResult, type RunCodemodResult, type CodemodRunnerCodemod, type RepositoryToClone, type CodemodOptions, } from './codemods/index.js';
|
package/dist/index.js
CHANGED
|
@@ -572,7 +572,7 @@ async function runCodemod(codemod, transformationPath, options) {
|
|
|
572
572
|
root,
|
|
573
573
|
results: successesGroupedByRoot[root] ?? []
|
|
574
574
|
}));
|
|
575
|
-
await Promise.all(rootPathsWithResults.map((r)=>(codemod.postTransform ?? (async ()=>{}))(r)));
|
|
575
|
+
await Promise.all(rootPathsWithResults.map((r)=>(codemod.postTransform ?? (async ()=>{}))(r, codemod)));
|
|
576
576
|
return results;
|
|
577
577
|
}
|
|
578
578
|
function traverseUp(node, until) {
|