ts-codemod-lib 1.4.2 → 2.0.1
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 +10 -7
- package/dist/cmd/append-as-const.mjs +5 -4
- package/dist/cmd/append-as-const.mjs.map +1 -1
- package/dist/cmd/convert-interface-to-type.mjs +5 -4
- package/dist/cmd/convert-interface-to-type.mjs.map +1 -1
- package/dist/cmd/convert-to-readonly.mjs +6 -5
- package/dist/cmd/convert-to-readonly.mjs.map +1 -1
- package/dist/cmd/replace-any-with-unknown.mjs +5 -4
- package/dist/cmd/replace-any-with-unknown.mjs.map +1 -1
- package/dist/cmd/replace-record-with-unknown-record.mjs +5 -4
- package/dist/cmd/replace-record-with-unknown-record.mjs.map +1 -1
- package/dist/cmd/run-transformer-cli.d.mts.map +1 -1
- package/dist/cmd/run-transformer-cli.mjs +1 -2
- package/dist/cmd/run-transformer-cli.mjs.map +1 -1
- package/dist/entry-point.mjs +2 -2
- package/dist/functions/ast-transformers/append-as-const.d.mts +3 -0
- package/dist/functions/ast-transformers/append-as-const.d.mts.map +1 -1
- package/dist/functions/ast-transformers/append-as-const.mjs +90 -168
- package/dist/functions/ast-transformers/append-as-const.mjs.map +1 -1
- package/dist/functions/ast-transformers/convert-interface-to-type.d.mts.map +1 -1
- package/dist/functions/ast-transformers/convert-interface-to-type.mjs +12 -7
- package/dist/functions/ast-transformers/convert-interface-to-type.mjs.map +1 -1
- package/dist/functions/ast-transformers/{convert-to-readonly-type.d.mts → convert-to-readonly.d.mts} +2 -2
- package/dist/functions/ast-transformers/convert-to-readonly.d.mts.map +1 -0
- package/dist/functions/ast-transformers/{convert-to-readonly-type.mjs → convert-to-readonly.mjs} +23 -18
- package/dist/functions/ast-transformers/convert-to-readonly.mjs.map +1 -0
- package/dist/functions/ast-transformers/index.d.mts +1 -1
- package/dist/functions/ast-transformers/index.d.mts.map +1 -1
- package/dist/functions/ast-transformers/index.mjs +1 -1
- package/dist/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mjs +2 -3
- package/dist/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mjs.map +1 -1
- package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.d.mts +2 -2
- package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.d.mts.map +1 -1
- package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.mjs +2 -2
- package/dist/functions/ast-transformers/readonly-transformer-helpers/group-union-types.mjs.map +1 -1
- package/dist/functions/ast-transformers/readonly-transformer-helpers/readonly-context.d.mts.map +1 -1
- package/dist/functions/ast-transformers/readonly-transformer-helpers/readonly-context.mjs.map +1 -1
- package/dist/functions/ast-transformers/replace-any-with-unknown.d.mts.map +1 -1
- package/dist/functions/ast-transformers/replace-any-with-unknown.mjs +28 -34
- package/dist/functions/ast-transformers/replace-any-with-unknown.mjs.map +1 -1
- package/dist/functions/ast-transformers/replace-record-with-unknown-record.d.mts.map +1 -1
- package/dist/functions/ast-transformers/replace-record-with-unknown-record.mjs +154 -150
- package/dist/functions/ast-transformers/replace-record-with-unknown-record.mjs.map +1 -1
- package/dist/functions/ast-transformers/transform-source-code.d.mts.map +1 -1
- package/dist/functions/ast-transformers/transform-source-code.mjs +4 -6
- package/dist/functions/ast-transformers/transform-source-code.mjs.map +1 -1
- package/dist/functions/ast-transformers/types.d.mts +5 -5
- package/dist/functions/ast-transformers/types.d.mts.map +1 -1
- package/dist/functions/functions/index.d.mts +1 -1
- package/dist/functions/functions/index.d.mts.map +1 -1
- package/dist/functions/functions/index.mjs +1 -1
- package/dist/functions/functions/{is-primitive-type-node.d.mts → is-atomic-type-node.d.mts} +3 -3
- package/dist/functions/functions/is-atomic-type-node.d.mts.map +1 -0
- package/dist/functions/functions/{is-primitive-type-node.mjs → is-atomic-type-node.mjs} +5 -5
- package/dist/functions/functions/is-atomic-type-node.mjs.map +1 -0
- package/dist/functions/functions/is-readonly-node.d.mts +4 -4
- package/dist/functions/functions/is-readonly-node.d.mts.map +1 -1
- package/dist/functions/functions/is-readonly-node.mjs +2 -2
- package/dist/functions/functions/is-readonly-node.mjs.map +1 -1
- package/dist/functions/functions/wrap-with-parentheses.d.mts +1 -1
- package/dist/functions/functions/wrap-with-parentheses.d.mts.map +1 -1
- package/dist/functions/index.mjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +17 -5
- package/src/cmd/append-as-const.mts +5 -3
- package/src/cmd/convert-interface-to-type.mts +5 -3
- package/src/cmd/convert-to-readonly.mts +6 -4
- package/src/cmd/replace-any-with-unknown.mts +5 -3
- package/src/cmd/replace-record-with-unknown-record.mts +5 -3
- package/src/cmd/run-transformer-cli.mts +0 -1
- package/src/functions/ast-transformers/append-as-const.mts +143 -266
- package/src/functions/ast-transformers/append-as-const.test.mts +67 -56
- package/src/functions/ast-transformers/convert-interface-to-type.mts +96 -89
- package/src/functions/ast-transformers/convert-interface-to-type.test.mts +20 -20
- package/src/functions/ast-transformers/{convert-to-readonly-type.mts → convert-to-readonly.mts} +32 -30
- package/src/functions/ast-transformers/{convert-to-readonly-type.test.mts → convert-to-readonly.test.mts} +36 -10
- package/src/functions/ast-transformers/index.mts +1 -1
- package/src/functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mts +7 -8
- package/src/functions/ast-transformers/readonly-transformer-helpers/group-union-types.mts +5 -5
- package/src/functions/ast-transformers/readonly-transformer-helpers/readonly-context.mts +4 -4
- package/src/functions/ast-transformers/replace-any-with-unknown.mts +31 -40
- package/src/functions/ast-transformers/replace-record-with-unknown-record.mts +183 -182
- package/src/functions/ast-transformers/transform-source-code.mts +3 -4
- package/src/functions/ast-transformers/transformer-specific-ignore.test.mts +6 -6
- package/src/functions/ast-transformers/types.mts +7 -7
- package/src/functions/functions/index.mts +1 -1
- package/src/functions/functions/{is-primitive-type-node.mts → is-atomic-type-node.mts} +11 -10
- package/src/functions/functions/is-readonly-node.mts +6 -6
- package/src/functions/functions/wrap-with-parentheses.mts +2 -2
- package/dist/functions/ast-transformers/convert-to-readonly-type.d.mts.map +0 -1
- package/dist/functions/ast-transformers/convert-to-readonly-type.mjs.map +0 -1
- package/dist/functions/functions/is-primitive-type-node.d.mts.map +0 -1
- package/dist/functions/functions/is-primitive-type-node.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ const arr2 = [1, 2, 3] as const;
|
|
|
62
62
|
const obj2 = { a: 1, b: 2 } as const;
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
### 2. `
|
|
65
|
+
### 2. `convertToReadonlyTransformer`
|
|
66
66
|
|
|
67
67
|
Converts TypeScript type definitions to readonly types. This transformer helps in creating more type-safe code by making types readonly where appropriate. It also normalizes nested readonly types (e.g., `Readonly<Readonly<T>>` becomes `Readonly<T>`).
|
|
68
68
|
|
|
@@ -103,6 +103,8 @@ Example:
|
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
105
|
// Before
|
|
106
|
+
// embed-sample-code-ignore-above
|
|
107
|
+
// Before
|
|
106
108
|
interface User {
|
|
107
109
|
id: number;
|
|
108
110
|
name: string;
|
|
@@ -179,9 +181,10 @@ type Config = {
|
|
|
179
181
|
settings: { timeout: number };
|
|
180
182
|
};
|
|
181
183
|
|
|
182
|
-
// After applying
|
|
184
|
+
// After applying convertToReadonlyTransformer
|
|
183
185
|
type Config2 = Readonly<{
|
|
184
186
|
apiKey: string;
|
|
187
|
+
// transformer-ignore-next-line
|
|
185
188
|
mutableOptions: string[]; // Not made Readonly because it was skipped
|
|
186
189
|
settings: Readonly<{ timeout: number }>;
|
|
187
190
|
}>;
|
|
@@ -263,7 +266,7 @@ import dedent from 'dedent';
|
|
|
263
266
|
import {
|
|
264
267
|
appendAsConstTransformer,
|
|
265
268
|
convertInterfaceToTypeTransformer,
|
|
266
|
-
|
|
269
|
+
convertToReadonlyTransformer,
|
|
267
270
|
replaceAnyWithUnknownTransformer,
|
|
268
271
|
replaceRecordWithUnknownRecordTransformer,
|
|
269
272
|
transformSourceCode,
|
|
@@ -301,7 +304,7 @@ const isTsx = false;
|
|
|
301
304
|
const transformedCode = transformSourceCode(originalCode, isTsx, [
|
|
302
305
|
convertInterfaceToTypeTransformer(),
|
|
303
306
|
replaceRecordWithUnknownRecordTransformer(),
|
|
304
|
-
|
|
307
|
+
convertToReadonlyTransformer(),
|
|
305
308
|
appendAsConstTransformer(),
|
|
306
309
|
replaceAnyWithUnknownTransformer(),
|
|
307
310
|
]);
|
|
@@ -349,7 +352,7 @@ import * as fs from 'node:fs/promises';
|
|
|
349
352
|
import {
|
|
350
353
|
appendAsConstTransformer,
|
|
351
354
|
convertInterfaceToTypeTransformer,
|
|
352
|
-
|
|
355
|
+
convertToReadonlyTransformer,
|
|
353
356
|
replaceAnyWithUnknownTransformer,
|
|
354
357
|
replaceRecordWithUnknownRecordTransformer,
|
|
355
358
|
transformSourceCode,
|
|
@@ -372,7 +375,7 @@ for await (const filePath of fs.glob('path/to/src/**/*.{mts,tsx}')) {
|
|
|
372
375
|
const transformedCode = transformSourceCode(originalCode, isTsx, [
|
|
373
376
|
convertInterfaceToTypeTransformer(),
|
|
374
377
|
replaceRecordWithUnknownRecordTransformer(),
|
|
375
|
-
|
|
378
|
+
convertToReadonlyTransformer(),
|
|
376
379
|
appendAsConstTransformer(),
|
|
377
380
|
replaceAnyWithUnknownTransformer(),
|
|
378
381
|
]);
|
|
@@ -406,7 +409,7 @@ node codemod.mjs
|
|
|
406
409
|
return { success: true };
|
|
407
410
|
}
|
|
408
411
|
|
|
409
|
-
// After applying
|
|
412
|
+
// After applying convertToReadonlyTransformer
|
|
410
413
|
/**
|
|
411
414
|
* Processes user data.
|
|
412
415
|
* @param {object} user - The user object. // JSDoc type is not changed
|
|
@@ -4,13 +4,14 @@ import { Result } from 'ts-data-forge';
|
|
|
4
4
|
import 'ts-repo-utils';
|
|
5
5
|
import { appendAsConstTransformer } from '../functions/ast-transformers/append-as-const.mjs';
|
|
6
6
|
import 'ts-morph';
|
|
7
|
-
import '../functions/functions/is-
|
|
7
|
+
import '../functions/functions/is-atomic-type-node.mjs';
|
|
8
8
|
import '../functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
9
9
|
import { runTransformerCLI } from './run-transformer-cli.mjs';
|
|
10
10
|
|
|
11
|
+
const transformer = appendAsConstTransformer();
|
|
11
12
|
const cmdDef = cmd.command({
|
|
12
|
-
name:
|
|
13
|
-
version: '
|
|
13
|
+
name: transformer.name,
|
|
14
|
+
version: '2.0.1',
|
|
14
15
|
args: {
|
|
15
16
|
baseDir: cmd.positional({
|
|
16
17
|
type: cmd.string,
|
|
@@ -40,7 +41,7 @@ const cmdDef = cmd.command({
|
|
|
40
41
|
exclude: args.exclude ?? [],
|
|
41
42
|
uncommitted: args.uncommitted ?? false,
|
|
42
43
|
silent: args.silent ?? false,
|
|
43
|
-
}, [
|
|
44
|
+
}, [transformer]);
|
|
44
45
|
if (Result.isErr(result)) {
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"append-as-const.mjs","sources":["../../src/cmd/append-as-const.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"append-as-const.mjs","sources":["../../src/cmd/append-as-const.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,WAAW,GAAG,wBAAwB,EAAE;AAE9C,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC;YACtB,IAAI,EAAE,GAAG,CAAC,MAAM;AAChB,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,WAAW,EAAE,uDAAuD;SACrE,CAAC;AACF,QAAA,OAAO,EAAE,GAAG,CAAC,WAA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;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -3,14 +3,15 @@ import * as cmd from 'cmd-ts';
|
|
|
3
3
|
import { Result } from 'ts-data-forge';
|
|
4
4
|
import 'ts-repo-utils';
|
|
5
5
|
import 'ts-morph';
|
|
6
|
-
import '../functions/functions/is-
|
|
6
|
+
import '../functions/functions/is-atomic-type-node.mjs';
|
|
7
7
|
import { convertInterfaceToTypeTransformer } from '../functions/ast-transformers/convert-interface-to-type.mjs';
|
|
8
8
|
import '../functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
9
9
|
import { runTransformerCLI } from './run-transformer-cli.mjs';
|
|
10
10
|
|
|
11
|
+
const transformer = convertInterfaceToTypeTransformer();
|
|
11
12
|
const cmdDef = cmd.command({
|
|
12
|
-
name:
|
|
13
|
-
version: '
|
|
13
|
+
name: transformer.name,
|
|
14
|
+
version: '2.0.1',
|
|
14
15
|
args: {
|
|
15
16
|
baseDir: cmd.positional({
|
|
16
17
|
type: cmd.string,
|
|
@@ -40,7 +41,7 @@ const cmdDef = cmd.command({
|
|
|
40
41
|
exclude: args.exclude ?? [],
|
|
41
42
|
uncommitted: args.uncommitted ?? false,
|
|
42
43
|
silent: args.silent ?? false,
|
|
43
|
-
}, [
|
|
44
|
+
}, [transformer]);
|
|
44
45
|
if (Result.isErr(result)) {
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-interface-to-type.mjs","sources":["../../src/cmd/convert-interface-to-type.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"convert-interface-to-type.mjs","sources":["../../src/cmd/convert-interface-to-type.mts"],"sourcesContent":[null],"names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tC,gBAAA,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;AAC7B,aAAA,EACD,CAAC,WAAW,CAAC,CACd;AAED,YAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,gBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YACjB;QACF,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAC5B,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAE1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -3,14 +3,15 @@ import * as cmd from 'cmd-ts';
|
|
|
3
3
|
import { Result } from 'ts-data-forge';
|
|
4
4
|
import 'ts-repo-utils';
|
|
5
5
|
import 'ts-morph';
|
|
6
|
-
import '../functions/functions/is-
|
|
7
|
-
import {
|
|
6
|
+
import '../functions/functions/is-atomic-type-node.mjs';
|
|
7
|
+
import { convertToReadonlyTransformer } from '../functions/ast-transformers/convert-to-readonly.mjs';
|
|
8
8
|
import '../functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
9
9
|
import { runTransformerCLI } from './run-transformer-cli.mjs';
|
|
10
10
|
|
|
11
|
+
const transformer = convertToReadonlyTransformer();
|
|
11
12
|
const cmdDef = cmd.command({
|
|
12
|
-
name:
|
|
13
|
-
version: '
|
|
13
|
+
name: transformer.name,
|
|
14
|
+
version: '2.0.1',
|
|
14
15
|
args: {
|
|
15
16
|
baseDir: cmd.positional({
|
|
16
17
|
type: cmd.string,
|
|
@@ -40,7 +41,7 @@ const cmdDef = cmd.command({
|
|
|
40
41
|
exclude: args.exclude ?? [],
|
|
41
42
|
uncommitted: args.uncommitted ?? false,
|
|
42
43
|
silent: args.silent ?? false,
|
|
43
|
-
}, [
|
|
44
|
+
}, [transformer]);
|
|
44
45
|
if (Result.isErr(result)) {
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-to-readonly.mjs","sources":["../../src/cmd/convert-to-readonly.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"convert-to-readonly.mjs","sources":["../../src/cmd/convert-to-readonly.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,WAAW,GAAG,4BAA4B,EAAE;AAElD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC;YACtB,IAAI,EAAE,GAAG,CAAC,MAAM;AAChB,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,WAAW,EAAE,uDAAuD;SACrE,CAAC;AACF,QAAA,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC;AACvB,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,YAAA,WAAW,EACT,4FAA4F;SAC/F,CAAC;AACF,QAAA,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC;AACpB,YAAA,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,oFAAoF;SACvF,CAAC;AACF,QAAA,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;AACf,YAAA,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EAAE,sDAAsD;SACpE,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,CAAC,YAA0B;AACzB,YAAA,MAAM,MAAM,GAAG,MAAM,iBAAiB,CACpC;gBACE,OAAO,EAAE,IAAI,CAAC,OAAO;AACrB,gBAAA,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;AAC3B,gBAAA,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,KAAK;AACtC,gBAAA,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;AAC7B,aAAA,EACD,CAAC,WAAW,CAAC,CACd;AAED,YAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,gBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YACjB;QACF,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAC5B,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAE1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -3,14 +3,15 @@ import * as cmd from 'cmd-ts';
|
|
|
3
3
|
import { Result } from 'ts-data-forge';
|
|
4
4
|
import 'ts-repo-utils';
|
|
5
5
|
import 'ts-morph';
|
|
6
|
-
import '../functions/functions/is-
|
|
6
|
+
import '../functions/functions/is-atomic-type-node.mjs';
|
|
7
7
|
import '../functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
8
8
|
import { replaceAnyWithUnknownTransformer } from '../functions/ast-transformers/replace-any-with-unknown.mjs';
|
|
9
9
|
import { runTransformerCLI } from './run-transformer-cli.mjs';
|
|
10
10
|
|
|
11
|
+
const transformer = replaceAnyWithUnknownTransformer();
|
|
11
12
|
const cmdDef = cmd.command({
|
|
12
|
-
name:
|
|
13
|
-
version: '
|
|
13
|
+
name: transformer.name,
|
|
14
|
+
version: '2.0.1',
|
|
14
15
|
args: {
|
|
15
16
|
baseDir: cmd.positional({
|
|
16
17
|
type: cmd.string,
|
|
@@ -40,7 +41,7 @@ const cmdDef = cmd.command({
|
|
|
40
41
|
exclude: args.exclude ?? [],
|
|
41
42
|
uncommitted: args.uncommitted ?? false,
|
|
42
43
|
silent: args.silent ?? false,
|
|
43
|
-
}, [
|
|
44
|
+
}, [transformer]);
|
|
44
45
|
if (Result.isErr(result)) {
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace-any-with-unknown.mjs","sources":["../../src/cmd/replace-any-with-unknown.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"replace-any-with-unknown.mjs","sources":["../../src/cmd/replace-any-with-unknown.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,WAAW,GAAG,gCAAgC,EAAE;AAEtD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC,IAAI;AACtB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC;YACtB,IAAI,EAAE,GAAG,CAAC,MAAM;AAChB,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,WAAW,EAAE,uDAAuD;SACrE,CAAC;AACF,QAAA,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC;AACvB,YAAA,IAAI,EAAE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AEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -3,14 +3,15 @@ import * as cmd from 'cmd-ts';
|
|
|
3
3
|
import { Result } from 'ts-data-forge';
|
|
4
4
|
import 'ts-repo-utils';
|
|
5
5
|
import 'ts-morph';
|
|
6
|
-
import '../functions/functions/is-
|
|
6
|
+
import '../functions/functions/is-atomic-type-node.mjs';
|
|
7
7
|
import '../functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
8
8
|
import { replaceRecordWithUnknownRecordTransformer } from '../functions/ast-transformers/replace-record-with-unknown-record.mjs';
|
|
9
9
|
import { runTransformerCLI } from './run-transformer-cli.mjs';
|
|
10
10
|
|
|
11
|
+
const transformer = replaceRecordWithUnknownRecordTransformer();
|
|
11
12
|
const cmdDef = cmd.command({
|
|
12
|
-
name:
|
|
13
|
-
version: '
|
|
13
|
+
name: transformer.name,
|
|
14
|
+
version: '2.0.1',
|
|
14
15
|
args: {
|
|
15
16
|
baseDir: cmd.positional({
|
|
16
17
|
type: cmd.string,
|
|
@@ -40,7 +41,7 @@ const cmdDef = cmd.command({
|
|
|
40
41
|
exclude: args.exclude ?? [],
|
|
41
42
|
uncommitted: args.uncommitted ?? false,
|
|
42
43
|
silent: args.silent ?? false,
|
|
43
|
-
}, [
|
|
44
|
+
}, [transformer]);
|
|
44
45
|
if (Result.isErr(result)) {
|
|
45
46
|
process.exit(1);
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replace-record-with-unknown-record.mjs","sources":["../../src/cmd/replace-record-with-unknown-record.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"replace-record-with-unknown-record.mjs","sources":["../../src/cmd/replace-record-with-unknown-record.mts"],"sourcesContent":[null],"names":[],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gBAAA,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;AAC7B,aAAA,EACD,CAAC,WAAW,CAAC,CACd;AAED,YAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,gBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YACjB;QACF,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAC5B,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAE1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-transformer-cli.d.mts","sourceRoot":"","sources":["../../src/cmd/run-transformer-cli.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-transformer-cli.d.mts","sourceRoot":"","sources":["../../src/cmd/run-transformer-cli.mts"],"names":[],"mappings":"AAGA,OAAO,EAAO,MAAM,EAAmB,MAAM,eAAe,CAAC;AAM7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,KAAK,eAAe,GAAG,QAAQ,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC,CAAC;AAEH,KAAK,qBAAqB,GAAG,eAAe,CAAC;AAE7C,eAAO,MAAM,iBAAiB,GAC5B,SAAS,qBAAqB,EAC9B,cAAc,SAAS,kBAAkB,EAAE,KAC1C,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CA8DtC,CAAC"}
|
|
@@ -2,11 +2,10 @@ import dedent from 'dedent';
|
|
|
2
2
|
import { Result, Arr, unknownToString } from 'ts-data-forge';
|
|
3
3
|
import { getUntrackedFiles, getModifiedFiles, getStagedFiles } from 'ts-repo-utils';
|
|
4
4
|
import 'ts-morph';
|
|
5
|
-
import '../functions/functions/is-
|
|
5
|
+
import '../functions/functions/is-atomic-type-node.mjs';
|
|
6
6
|
import '../functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
7
7
|
import { transformSourceCode } from '../functions/ast-transformers/transform-source-code.mjs';
|
|
8
8
|
|
|
9
|
-
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
10
9
|
/* eslint-disable no-await-in-loop */
|
|
11
10
|
const runTransformerCLI = async (options, transformers) => {
|
|
12
11
|
const echoIfNotSilent = options.silent ? () => { } : echo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-transformer-cli.mjs","sources":["../../src/cmd/run-transformer-cli.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAAA;
|
|
1
|
+
{"version":3,"file":"run-transformer-cli.mjs","sources":["../../src/cmd/run-transformer-cli.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAAA;AAuBO,MAAM,iBAAiB,GAAG,OAC/B,OAA8B,EAC9B,YAA2C,KACF;AACzC,IAAA,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,QAAO,CAAC,GAAG,IAAI;AAExD,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,MAAK,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK;AAElE,IAAA,MAAM,WAAW,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC;AAE5D,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;QAC7B,gBAAgB,CACd,OAAO,CAAC;AACN,cAAE;AACF,cAAE,uCAAuC,EAC3C,WAAW,CAAC,KAAK,CAClB;AAED,Q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MAAM,CAAC;IAC3B;AACF,CAAC;;;;"}
|
package/dist/entry-point.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { appendAsConstTransformer } from './functions/ast-transformers/append-as-const.mjs';
|
|
2
2
|
export { convertInterfaceToTypeTransformer } from './functions/ast-transformers/convert-interface-to-type.mjs';
|
|
3
|
-
export {
|
|
3
|
+
export { convertToReadonlyTransformer } from './functions/ast-transformers/convert-to-readonly.mjs';
|
|
4
4
|
export { compareUnionIntersectionTypes } from './functions/ast-transformers/readonly-transformer-helpers/compare-union-types.mjs';
|
|
5
5
|
export { invalidDeepReadonlyTypeName } from './functions/ast-transformers/readonly-transformer-helpers/constants.mjs';
|
|
6
6
|
export { groupUnionIntersectionTypes } from './functions/ast-transformers/readonly-transformer-helpers/group-union-types.mjs';
|
|
@@ -11,7 +11,7 @@ export { transformSourceCode } from './functions/ast-transformers/transform-sour
|
|
|
11
11
|
export { IGNORE_FILE_COMMENT_PREFIX, IGNORE_LINE_COMMENT_PREFIX } from './functions/constants/ignore-comment-text.mjs';
|
|
12
12
|
export { hasDisableNextLineComment } from './functions/functions/has-disable-next-line-comment.mjs';
|
|
13
13
|
export { isAsConstNode } from './functions/functions/is-as-const-node.mjs';
|
|
14
|
-
export {
|
|
14
|
+
export { isAtomicTypeNode } from './functions/functions/is-atomic-type-node.mjs';
|
|
15
15
|
export { isReadonlyArrayTypeNode, isReadonlyTupleOrArrayTypeNode, isReadonlyTupleTypeNode, isReadonlyTypeReferenceNode, isShallowReadonlyTypeNode } from './functions/functions/is-readonly-node.mjs';
|
|
16
16
|
export { isSpreadNamedTupleMemberNode, isSpreadParameterNode } from './functions/functions/is-spread-parameter-node.mjs';
|
|
17
17
|
export { removeParentheses } from './functions/functions/remove-parentheses.mjs';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type TsMorphTransformer } from './types.mjs';
|
|
2
2
|
export declare const appendAsConstTransformer: (options?: AppendAsConstTransformerOptions) => TsMorphTransformer;
|
|
3
3
|
export type AppendAsConstTransformerOptions = DeepReadonly<{
|
|
4
|
+
/**
|
|
5
|
+
* @default "avoidInFunctionArgs"
|
|
6
|
+
*/
|
|
4
7
|
applyLevel?: 'all' | 'avoidInFunctionArgs';
|
|
5
8
|
/**
|
|
6
9
|
* A mute keywords to ignore the readonly conversion.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"append-as-const.d.mts","sourceRoot":"","sources":["../../../src/functions/ast-transformers/append-as-const.mts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD,eAAO,MAAM,wBAAwB,GACnC,UAAU,+BAA+B,KACxC,
|
|
1
|
+
{"version":3,"file":"append-as-const.d.mts","sourceRoot":"","sources":["../../../src/functions/ast-transformers/append-as-const.mts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD,eAAO,MAAM,wBAAwB,GACnC,UAAU,+BAA+B,KACxC,kBAiCF,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,YAAY,CAAC;IACzD;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,qBAAqB,CAAC;IAE3C;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAK1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC,CAAC"}
|