@vc-shell/migrate 2.0.0-alpha.22 → 2.0.0-alpha.24
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/CHANGELOG.md +29 -0
- package/dist/transforms/nswag-class-to-interface-core.d.ts +24 -0
- package/dist/transforms/nswag-class-to-interface-core.js +224 -0
- package/dist/transforms/nswag-class-to-interface-core.js.map +1 -0
- package/dist/transforms/nswag-class-to-interface.d.ts +4 -0
- package/dist/transforms/nswag-class-to-interface.js +149 -0
- package/dist/transforms/nswag-class-to-interface.js.map +1 -0
- package/dist/transforms/registry.js +14 -0
- package/dist/transforms/registry.js.map +1 -1
- package/dist/transforms/use-assets-migration.d.ts +4 -0
- package/dist/transforms/use-assets-migration.js +171 -0
- package/dist/transforms/use-assets-migration.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# [2.0.0-alpha.24](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2026-03-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Documentation
|
|
5
|
+
|
|
6
|
+
* **assets-manager:** document blade options breaking change and enhance codemod ([69cc786](https://github.com/VirtoCommerce/vc-shell/commit/69cc7865a5678a093d972e6e39f955d722fcc133))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **api-client, migrate:** default to Interface for new API clients, add nswag class-to-interface migration ([569a1f7](https://github.com/VirtoCommerce/vc-shell/commit/569a1f79532d5ca2e1a9968e3b249b3d3ffeed71))
|
|
12
|
+
* **codemod:** add use-assets-migration transform ([57022ec](https://github.com/VirtoCommerce/vc-shell/commit/57022ec18d7d3f85e207377316222e32ad142520))
|
|
13
|
+
* **codemod:** register use-assets-migration in transform registry ([83fb018](https://github.com/VirtoCommerce/vc-shell/commit/83fb018a7afbfc924d21e595c312fb536d3d40b5))
|
|
14
|
+
* **codemod:** smart diagnostic for useAssets() migration patterns ([479defe](https://github.com/VirtoCommerce/vc-shell/commit/479defe6c57d6aa335c683e6aeec0f4941158749))
|
|
15
|
+
* **migrate:** add project-scope orchestrator and registry entry for nswag-class-to-interface ([7a8dcd6](https://github.com/VirtoCommerce/vc-shell/commit/7a8dcd66e65b427c9e94bc40aa1a9fbf4a6062f7))
|
|
16
|
+
* **migrate:** add Rules A/B — object literal and variable argument transforms ([0856d45](https://github.com/VirtoCommerce/vc-shell/commit/0856d457a7e3d6a1f9d05d392edea1f34578059b))
|
|
17
|
+
* **migrate:** add Rules D/E — IPrefix rename and import deduplication ([e988d87](https://github.com/VirtoCommerce/vc-shell/commit/e988d87733e023fbc7abbf460cf6b2e174e5edb3))
|
|
18
|
+
* **migrate:** scaffold nswag-class-to-interface core transform with Rule C ([2579e5b](https://github.com/VirtoCommerce/vc-shell/commit/2579e5bfe3840cafd8562ff466e8b58e47794524))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
* **assets-manager:** notice
|
|
24
|
+
- use-assets-migration codemod: detect openBlade("AssetsManager") with
|
|
25
|
+
old handler options and missing markRaw()
|
|
26
|
+
# [2.0.0-alpha.23](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2026-03-23)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @vc-shell/migrate
|
|
29
|
+
|
|
1
30
|
# [2.0.0-alpha.22](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2026-03-23)
|
|
2
31
|
|
|
3
32
|
**Note:** Version bump only for package @vc-shell/migrate
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { API, FileInfo, Options } from "jscodeshift";
|
|
2
|
+
import type { Transform } from "./types.js";
|
|
3
|
+
export interface NswagCoreOptions {
|
|
4
|
+
dtoClassNames: Set<string>;
|
|
5
|
+
interfaceToClass: Map<string, string>;
|
|
6
|
+
packageName?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the import source looks like an api_client import.
|
|
10
|
+
* Matches if source contains "api_client" or starts with the given packageName.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isApiClientImport(source: string, packageName?: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Collects all imported names from ImportDeclarations that match api_client sources.
|
|
15
|
+
*/
|
|
16
|
+
export declare function collectApiClientImportedNames(root: ReturnType<API["jscodeshift"]>, j: API["jscodeshift"], packageName?: string): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Core AST transform for nswag-class-to-interface migration.
|
|
19
|
+
* Rule C: Replace `new DtoClass()` (no args) with `{} as DtoClass`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function coreTransform(fileInfo: FileInfo, api: API, options: Options & NswagCoreOptions): string | null;
|
|
22
|
+
declare const _default: Transform;
|
|
23
|
+
export default _default;
|
|
24
|
+
export declare const parser = "tsx";
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the import source looks like an api_client import.
|
|
3
|
+
* Matches if source contains "api_client" or starts with the given packageName.
|
|
4
|
+
*/
|
|
5
|
+
export function isApiClientImport(source, packageName) {
|
|
6
|
+
if (source.includes("api_client"))
|
|
7
|
+
return true;
|
|
8
|
+
if (packageName && source.startsWith(packageName))
|
|
9
|
+
return true;
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Collects all imported names from ImportDeclarations that match api_client sources.
|
|
14
|
+
*/
|
|
15
|
+
export function collectApiClientImportedNames(root, j, packageName) {
|
|
16
|
+
const names = new Set();
|
|
17
|
+
root.find(j.ImportDeclaration).forEach((path) => {
|
|
18
|
+
const source = path.node.source.value;
|
|
19
|
+
if (typeof source === "string" && isApiClientImport(source, packageName)) {
|
|
20
|
+
for (const specifier of path.node.specifiers ?? []) {
|
|
21
|
+
if (specifier.type === "ImportSpecifier" && specifier.local) {
|
|
22
|
+
names.add(specifier.local.name);
|
|
23
|
+
}
|
|
24
|
+
else if (specifier.type === "ImportDefaultSpecifier" && specifier.local) {
|
|
25
|
+
names.add(specifier.local.name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return names;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Core AST transform for nswag-class-to-interface migration.
|
|
34
|
+
* Rule C: Replace `new DtoClass()` (no args) with `{} as DtoClass`.
|
|
35
|
+
*/
|
|
36
|
+
export function coreTransform(fileInfo, api, options) {
|
|
37
|
+
const j = api.jscodeshift;
|
|
38
|
+
const root = j(fileInfo.source);
|
|
39
|
+
const { dtoClassNames, interfaceToClass, packageName } = options;
|
|
40
|
+
// Collect names actually imported from api_client in this file
|
|
41
|
+
const importedNames = collectApiClientImportedNames(root, j, packageName);
|
|
42
|
+
if (importedNames.size === 0)
|
|
43
|
+
return null;
|
|
44
|
+
// Effective DTOs: intersection of dtoClassNames and actually-imported names
|
|
45
|
+
const effectiveDtos = new Set();
|
|
46
|
+
if (dtoClassNames) {
|
|
47
|
+
for (const name of importedNames) {
|
|
48
|
+
if (dtoClassNames.has(name)) {
|
|
49
|
+
effectiveDtos.add(name);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Effective renames: intersection of interfaceToClass keys and actually-imported names
|
|
54
|
+
const effectiveRenames = new Map();
|
|
55
|
+
if (interfaceToClass) {
|
|
56
|
+
for (const [iName, className] of interfaceToClass) {
|
|
57
|
+
if (importedNames.has(iName)) {
|
|
58
|
+
effectiveRenames.set(iName, className);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (effectiveDtos.size === 0 && effectiveRenames.size === 0)
|
|
63
|
+
return null;
|
|
64
|
+
let changed = false;
|
|
65
|
+
// Rule F: .fromJS() / .toJSON() diagnostic
|
|
66
|
+
root
|
|
67
|
+
.find(j.CallExpression, {
|
|
68
|
+
callee: { type: "MemberExpression", property: { type: "Identifier" } },
|
|
69
|
+
})
|
|
70
|
+
.forEach((path) => {
|
|
71
|
+
const prop = path.node.callee.property.name;
|
|
72
|
+
if (prop === "fromJS" || prop === "toJSON") {
|
|
73
|
+
api.report(`${fileInfo.path}: .${prop}() called — this method does not exist on interfaces. Manual migration required.`);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
// Rule F: Image DOM conflict warning
|
|
77
|
+
if (importedNames.has("Image") && effectiveDtos.has("Image")) {
|
|
78
|
+
api.report(`${fileInfo.path}: 'Image' imported from api_client conflicts with DOM global 'Image'. Consider: import { type Image } or import { Image as ApiImage }.`);
|
|
79
|
+
}
|
|
80
|
+
// Rule G: Clone-then-mutate detection — must run before NewExpression handler
|
|
81
|
+
const excludedVarNames = new Set();
|
|
82
|
+
root.find(j.VariableDeclarator).forEach((path) => {
|
|
83
|
+
const init = path.node.init;
|
|
84
|
+
if (!init || init.type !== "NewExpression" || init.callee.type !== "Identifier")
|
|
85
|
+
return;
|
|
86
|
+
if (!effectiveDtos.has(init.callee.name))
|
|
87
|
+
return;
|
|
88
|
+
if (path.node.id.type !== "Identifier")
|
|
89
|
+
return;
|
|
90
|
+
const varName = path.node.id.name;
|
|
91
|
+
// Check if parent is VariableDeclaration, and its parent has a body array
|
|
92
|
+
const declPath = path.parent;
|
|
93
|
+
const blockPath = declPath.parent;
|
|
94
|
+
if (!blockPath?.node?.body)
|
|
95
|
+
return;
|
|
96
|
+
const stmts = blockPath.node.body;
|
|
97
|
+
const declIdx = stmts.indexOf(declPath.node);
|
|
98
|
+
if (declIdx === -1)
|
|
99
|
+
return;
|
|
100
|
+
// Look at subsequent statements for x.prop = ...
|
|
101
|
+
for (let i = declIdx + 1; i < stmts.length && i <= declIdx + 10; i++) {
|
|
102
|
+
const stmt = stmts[i];
|
|
103
|
+
if (stmt.type === "ExpressionStatement" &&
|
|
104
|
+
stmt.expression.type === "AssignmentExpression" &&
|
|
105
|
+
stmt.expression.left.type === "MemberExpression" &&
|
|
106
|
+
stmt.expression.left.object.type === "Identifier" &&
|
|
107
|
+
stmt.expression.left.object.name === varName) {
|
|
108
|
+
excludedVarNames.add(varName);
|
|
109
|
+
api.report(`${fileInfo.path}: Clone-then-mutate pattern detected for ${init.callee.name}. Manual migration required.`);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
break; // Stop at first non-mutation statement
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
// Find all NewExpression where callee is an Identifier in effectiveDtos
|
|
118
|
+
root
|
|
119
|
+
.find(j.NewExpression, {
|
|
120
|
+
callee: { type: "Identifier" },
|
|
121
|
+
})
|
|
122
|
+
.forEach((path) => {
|
|
123
|
+
const callee = path.node.callee;
|
|
124
|
+
if (callee.type !== "Identifier")
|
|
125
|
+
return;
|
|
126
|
+
const className = callee.name;
|
|
127
|
+
if (!effectiveDtos.has(className))
|
|
128
|
+
return;
|
|
129
|
+
// Rule G: Skip if this new expression is the init of a clone-then-mutate variable
|
|
130
|
+
const parentDeclarator = path.parent;
|
|
131
|
+
if (parentDeclarator.node.type === "VariableDeclarator" &&
|
|
132
|
+
parentDeclarator.node.id.type === "Identifier" &&
|
|
133
|
+
excludedVarNames.has(parentDeclarator.node.id.name)) {
|
|
134
|
+
return; // Skip — Rule G diagnostic emitted
|
|
135
|
+
}
|
|
136
|
+
const args = path.node.arguments;
|
|
137
|
+
let replacement;
|
|
138
|
+
if (args.length === 0) {
|
|
139
|
+
// Rule C: no args → `{} as ClassName`
|
|
140
|
+
replacement = j.tsAsExpression(j.objectExpression([]), j.tsTypeReference(j.identifier(className)));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const arg = args[0];
|
|
144
|
+
if ((arg.type === "Identifier" && arg.name === "undefined") ||
|
|
145
|
+
arg.type === "NullLiteral" ||
|
|
146
|
+
(arg.type === "Literal" && arg.value === null)) {
|
|
147
|
+
// null/undefined literal → Rule C (empty object)
|
|
148
|
+
replacement = j.tsAsExpression(j.objectExpression([]), j.tsTypeReference(j.identifier(className)));
|
|
149
|
+
}
|
|
150
|
+
else if (arg.type === "ObjectExpression") {
|
|
151
|
+
// Rule A: new Dto({...}) → {...} as Dto
|
|
152
|
+
replacement = j.tsAsExpression(arg, j.tsTypeReference(j.identifier(className)));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
// Rule B: new Dto(variable) → { ...variable } as Dto
|
|
156
|
+
replacement = j.tsAsExpression(j.objectExpression([j.spreadElement(arg)]), j.tsTypeReference(j.identifier(className)));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Check parent for TSAsExpression — collapse double-cast
|
|
160
|
+
const parent = path.parent;
|
|
161
|
+
if (parent && parent.node.type === "TSAsExpression") {
|
|
162
|
+
// Parent is already `expr as SomeType`, replace with `{obj} as SomeType` using parent's type
|
|
163
|
+
parent.replace(j.tsAsExpression(replacement.expression, parent.node.typeAnnotation));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
path.replace(replacement);
|
|
167
|
+
}
|
|
168
|
+
changed = true;
|
|
169
|
+
});
|
|
170
|
+
// Rule D/E: Rename IPrefix → ClassName in imports and type references
|
|
171
|
+
// Collect renames that were applied so we can do text replacement for type positions
|
|
172
|
+
// (jscodeshift doesn't traverse into TSTypeParameterInstantiation on CallExpressions)
|
|
173
|
+
const appliedRenames = new Map();
|
|
174
|
+
if (effectiveRenames.size > 0) {
|
|
175
|
+
root
|
|
176
|
+
.find(j.ImportDeclaration)
|
|
177
|
+
.filter((path) => {
|
|
178
|
+
const source = path.node.source.value;
|
|
179
|
+
return typeof source === "string" && isApiClientImport(source, packageName);
|
|
180
|
+
})
|
|
181
|
+
.forEach((importPath) => {
|
|
182
|
+
const specifiers = importPath.node.specifiers ?? [];
|
|
183
|
+
const toRemove = [];
|
|
184
|
+
specifiers.forEach((spec, idx) => {
|
|
185
|
+
if (spec.type !== "ImportSpecifier" || spec.imported.type !== "Identifier")
|
|
186
|
+
return;
|
|
187
|
+
const importedName = spec.imported.name;
|
|
188
|
+
const targetName = effectiveRenames.get(importedName);
|
|
189
|
+
if (!targetName)
|
|
190
|
+
return;
|
|
191
|
+
// Rule E: Check if targetName already imported in same declaration
|
|
192
|
+
const alreadyImported = specifiers.some((s) => s.type === "ImportSpecifier" && s.imported.type === "Identifier" && s.imported.name === targetName);
|
|
193
|
+
if (alreadyImported) {
|
|
194
|
+
toRemove.push(idx); // Remove duplicate IPrefix specifier
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// Rule D: Rename the specifier
|
|
198
|
+
spec.imported = j.identifier(targetName);
|
|
199
|
+
if (spec.local && spec.local.name === importedName) {
|
|
200
|
+
spec.local = j.identifier(targetName);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
appliedRenames.set(importedName, targetName);
|
|
204
|
+
changed = true;
|
|
205
|
+
});
|
|
206
|
+
// Remove deduplicated specifiers (reverse to preserve indices)
|
|
207
|
+
for (const idx of toRemove.reverse()) {
|
|
208
|
+
specifiers.splice(idx, 1);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (!changed)
|
|
213
|
+
return null;
|
|
214
|
+
// Generate source from AST, then apply text-based renames for type references
|
|
215
|
+
// that jscodeshift cannot traverse (e.g. TSTypeParameterInstantiation in CallExpression)
|
|
216
|
+
let output = root.toSource();
|
|
217
|
+
for (const [oldName, newName] of appliedRenames) {
|
|
218
|
+
output = output.replace(new RegExp(`\\b${oldName}\\b`, "g"), newName);
|
|
219
|
+
}
|
|
220
|
+
return output;
|
|
221
|
+
}
|
|
222
|
+
export default coreTransform;
|
|
223
|
+
export const parser = "tsx";
|
|
224
|
+
//# sourceMappingURL=nswag-class-to-interface-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nswag-class-to-interface-core.js","sourceRoot":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/B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBACzC,IAAI,IAAI,CAAC,KAAK,IAAK,IAAI,CAAC,KAAa,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;wBAC5D,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;gBAED,cAAc,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;gBAC7C,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC,CAAC,CAAC;YAEH,+DAA+D;YAC/D,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;gBACrC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,8EAA8E;IAC9E,yFAAyF;IACzF,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,cAAc,EAAE,CAAC;QAChD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,MAAM,OAAO,KAAK,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,eAAe,aAA0B,CAAC;AAC1C,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, statSync, existsSync } from "node:fs";
|
|
2
|
+
import { join, relative } from "node:path";
|
|
3
|
+
import writeFileAtomic from "write-file-atomic";
|
|
4
|
+
import jscodeshift from "jscodeshift";
|
|
5
|
+
import { parse as parseSFC } from "@vue/compiler-sfc";
|
|
6
|
+
import { coreTransform } from "./nswag-class-to-interface-core.js";
|
|
7
|
+
/**
|
|
8
|
+
* Scans api_client/*.ts files to build a registry of DTO class names
|
|
9
|
+
* and interface-to-class mappings.
|
|
10
|
+
*/
|
|
11
|
+
function buildDtoRegistry(apiClientDir) {
|
|
12
|
+
const dtoClassNames = new Set();
|
|
13
|
+
const interfaceToClass = new Map();
|
|
14
|
+
let packageName;
|
|
15
|
+
// Try to read package.json for package name
|
|
16
|
+
const pkgJsonPath = join(apiClientDir, "package.json");
|
|
17
|
+
if (existsSync(pkgJsonPath)) {
|
|
18
|
+
try {
|
|
19
|
+
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
|
|
20
|
+
packageName = pkgJson.name;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// ignore
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const regex = /export class (\w+) implements I(\w+)/g;
|
|
27
|
+
const entries = readdirSync(apiClientDir);
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
if (!entry.endsWith(".ts"))
|
|
30
|
+
continue;
|
|
31
|
+
const filePath = join(apiClientDir, entry);
|
|
32
|
+
if (!statSync(filePath).isFile())
|
|
33
|
+
continue;
|
|
34
|
+
const content = readFileSync(filePath, "utf-8");
|
|
35
|
+
regex.lastIndex = 0;
|
|
36
|
+
let match;
|
|
37
|
+
while ((match = regex.exec(content)) !== null) {
|
|
38
|
+
const className = match[1];
|
|
39
|
+
// Skip client classes
|
|
40
|
+
if (className.endsWith("Client"))
|
|
41
|
+
continue;
|
|
42
|
+
dtoClassNames.add(className);
|
|
43
|
+
const interfaceName = `I${match[2]}`;
|
|
44
|
+
interfaceToClass.set(interfaceName, className);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { dtoClassNames, interfaceToClass, packageName };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Recursively finds consumer .ts and .vue files, skipping api_client dir,
|
|
51
|
+
* node_modules, dist, and dotfiles.
|
|
52
|
+
*/
|
|
53
|
+
function findConsumerFiles(dir, apiClientDir) {
|
|
54
|
+
const results = [];
|
|
55
|
+
const entries = readdirSync(dir);
|
|
56
|
+
for (const entry of entries) {
|
|
57
|
+
if (entry.startsWith("."))
|
|
58
|
+
continue;
|
|
59
|
+
if (entry === "node_modules" || entry === "dist")
|
|
60
|
+
continue;
|
|
61
|
+
const fullPath = join(dir, entry);
|
|
62
|
+
const resolvedApiClient = apiClientDir.endsWith("/") ? apiClientDir.slice(0, -1) : apiClientDir;
|
|
63
|
+
if (fullPath === resolvedApiClient)
|
|
64
|
+
continue;
|
|
65
|
+
const stat = statSync(fullPath);
|
|
66
|
+
if (stat.isDirectory()) {
|
|
67
|
+
results.push(...findConsumerFiles(fullPath, apiClientDir));
|
|
68
|
+
}
|
|
69
|
+
else if (stat.isFile()) {
|
|
70
|
+
if (entry.endsWith(".d.ts") || entry.endsWith(".generated.ts"))
|
|
71
|
+
continue;
|
|
72
|
+
if (entry.endsWith(".ts") || entry.endsWith(".vue")) {
|
|
73
|
+
results.push(fullPath);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return results;
|
|
78
|
+
}
|
|
79
|
+
const transform = (_fileInfo, api, options) => {
|
|
80
|
+
const cwd = options.cwd ?? ".";
|
|
81
|
+
const dryRun = options.dryRun ?? false;
|
|
82
|
+
const j = jscodeshift.withParser("tsx");
|
|
83
|
+
const srcDir = join(cwd, "src");
|
|
84
|
+
const apiClientDir = join(srcDir, "api_client");
|
|
85
|
+
if (!existsSync(apiClientDir)) {
|
|
86
|
+
api.report(`No api_client directory found at ${apiClientDir}`);
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const { dtoClassNames, interfaceToClass, packageName } = buildDtoRegistry(apiClientDir);
|
|
90
|
+
api.report(`Registry: ${dtoClassNames.size} DTO classes, ${interfaceToClass.size} interface→class mappings` +
|
|
91
|
+
(packageName ? `, package: ${packageName}` : ""));
|
|
92
|
+
if (dtoClassNames.size === 0) {
|
|
93
|
+
api.report("No DTO classes found in api_client — nothing to migrate.");
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const consumerFiles = findConsumerFiles(srcDir, apiClientDir);
|
|
97
|
+
api.report(`Found ${consumerFiles.length} consumer files to scan.`);
|
|
98
|
+
let totalModified = 0;
|
|
99
|
+
for (const filePath of consumerFiles) {
|
|
100
|
+
try {
|
|
101
|
+
const source = readFileSync(filePath, "utf-8");
|
|
102
|
+
const relPath = relative(cwd, filePath);
|
|
103
|
+
let result = null;
|
|
104
|
+
const fileApi = {
|
|
105
|
+
jscodeshift: j,
|
|
106
|
+
j,
|
|
107
|
+
stats: () => { },
|
|
108
|
+
report: api.report,
|
|
109
|
+
};
|
|
110
|
+
const coreOptions = {
|
|
111
|
+
...options,
|
|
112
|
+
dtoClassNames,
|
|
113
|
+
interfaceToClass,
|
|
114
|
+
packageName,
|
|
115
|
+
};
|
|
116
|
+
if (filePath.endsWith(".vue")) {
|
|
117
|
+
const { descriptor } = parseSFC(source, { filename: filePath });
|
|
118
|
+
const scriptBlock = descriptor.scriptSetup ?? descriptor.script;
|
|
119
|
+
if (!scriptBlock)
|
|
120
|
+
continue;
|
|
121
|
+
const scriptResult = coreTransform({ path: relPath, source: scriptBlock.content }, fileApi, coreOptions);
|
|
122
|
+
if (scriptResult !== null) {
|
|
123
|
+
const start = scriptBlock.loc.start.offset;
|
|
124
|
+
const end = scriptBlock.loc.end.offset;
|
|
125
|
+
result = source.substring(0, start) + scriptResult + source.substring(end);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
result = coreTransform({ path: relPath, source }, fileApi, coreOptions);
|
|
130
|
+
}
|
|
131
|
+
if (result !== null) {
|
|
132
|
+
if (!dryRun) {
|
|
133
|
+
writeFileAtomic.sync(filePath, result);
|
|
134
|
+
}
|
|
135
|
+
api.report(`${relPath}: modified`);
|
|
136
|
+
totalModified++;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
const relPath = relative(cwd, filePath);
|
|
141
|
+
api.report(`${relPath}: ERROR — ${err instanceof Error ? err.message : String(err)}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
api.report(`Done. ${totalModified} file(s) modified out of ${consumerFiles.length} scanned.`);
|
|
145
|
+
return null;
|
|
146
|
+
};
|
|
147
|
+
export default transform;
|
|
148
|
+
export const parser = "tsx";
|
|
149
|
+
//# sourceMappingURL=nswag-class-to-interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nswag-class-to-interface.js","sourceRoot":"","sources":["../../src/transforms/nswag-class-to-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAQnE;;;GAGG;AACH,SAAS,gBAAgB,CAAC,YAAoB;IAC5C,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,IAAI,WAA+B,CAAC;IAEpC,4CAA4C;IAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACvD,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC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,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBACzC,CAAC;gBACD,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,YAAY,CAAC,CAAC;gBACnC,aAAa,EAAE,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACxC,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,aAAa,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,SAAS,aAAa,4BAA4B,aAAa,CAAC,MAAM,WAAW,CAAC,CAAC;IAE9F,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -133,6 +133,20 @@ export const transforms = [
|
|
|
133
133
|
diagnosticOnly: true,
|
|
134
134
|
transformPath: t("manual-migration-audit"),
|
|
135
135
|
},
|
|
136
|
+
{
|
|
137
|
+
name: "nswag-class-to-interface",
|
|
138
|
+
description: "Migrate consumer code from NSwag class-based to interface-based DTOs",
|
|
139
|
+
introducedIn: "2.0.0-alpha.24",
|
|
140
|
+
scope: "project",
|
|
141
|
+
transformPath: t("nswag-class-to-interface"),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "use-assets-migration",
|
|
145
|
+
description: "ICommonAsset → AssetLike + detect useAssets() for manual migration to useAssetsManager()",
|
|
146
|
+
introducedIn: "2.0.0-alpha.24",
|
|
147
|
+
migrationGuideSection: "Guide 32",
|
|
148
|
+
transformPath: t("use-assets-migration"),
|
|
149
|
+
},
|
|
136
150
|
];
|
|
137
151
|
export function selectTransforms(currentVersion, targetVersion) {
|
|
138
152
|
const current = semver.parse(currentVersion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/transforms/registry.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG7C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,UAAU,GAAyB;IAC9C;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,0DAA0D;QACvE,YAAY,EAAE,eAAe;QAC7B,qBAAqB,EAAE,8BAA8B;QACrD,aAAa,EAAE,CAAC,CAAC,mBAAmB,CAAC;KACtC;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,qEAAqE;QAClF,YAAY,EAAE,eAAe;QAC7B,qBAAqB,EAAE,YAAY;QACnC,aAAa,EAAE,CAAC,CAAC,qBAAqB,CAAC;KACxC;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,0CAA0C;QACvD,YAAY,EAAE,gBAAgB;QAC9B,qBAAqB,EAAE,+BAA+B;QACtD,aAAa,EAAE,CAAC,CAAC,wBAAwB,CAAC;KAC3C;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,2DAA2D;QACxE,YAAY,EAAE,OAAO;QACrB,aAAa,EAAE,CAAC,CAAC,iBAAiB,CAAC;KACpC;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,wCAAwC;QACrD,YAAY,EAAE,O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AAY,EAAE,aAAa,CAAC,CAAC;IAChG,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { wrapForSFC } from "../utils/vue-sfc-wrapper.js";
|
|
2
|
+
const RENAME_MAP = {
|
|
3
|
+
ICommonAsset: "AssetLike",
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Detect which useAssets() usage pattern is present and provide specific guidance.
|
|
7
|
+
*
|
|
8
|
+
* Known patterns:
|
|
9
|
+
* 1. "handler-object" — destructure useAssets() + build assetsHandler/defaultImageHandlers object
|
|
10
|
+
* 2. "single-image" — useAssets() for a single image (iconUrl, logo, photo), often with computed get/set
|
|
11
|
+
* 3. "injectable" — Props accept custom imageHandlers with fallback to default
|
|
12
|
+
* 4. "composable" — useAssets() inside a composable (not a .vue file)
|
|
13
|
+
*/
|
|
14
|
+
function detectPattern(source, filePath) {
|
|
15
|
+
const isVue = filePath.endsWith(".vue");
|
|
16
|
+
const hasHandlerObject = /(?:assetsHandler|imageHandler|defaultImageHandler)\s*[=:]/.test(source);
|
|
17
|
+
const hasInjectableProps = /imageHandlers\??\s*[:{]/.test(source) || /props\.imageHandlers/.test(source);
|
|
18
|
+
const hasSingleImagePattern = /(?:iconUrl|logo|photo|avatar)\s*[=:]/.test(source) && !/\.images\s*[=]/.test(source);
|
|
19
|
+
if (hasInjectableProps)
|
|
20
|
+
return "injectable";
|
|
21
|
+
if (hasSingleImagePattern && !hasHandlerObject)
|
|
22
|
+
return "single-image";
|
|
23
|
+
if (hasHandlerObject)
|
|
24
|
+
return "handler-object";
|
|
25
|
+
if (!isVue)
|
|
26
|
+
return "composable";
|
|
27
|
+
return "handler-object"; // default
|
|
28
|
+
}
|
|
29
|
+
function extractUploadPath(source) {
|
|
30
|
+
// Match patterns like: upload(files, `some/path/${id}`) or upload(files, "some/path")
|
|
31
|
+
const match = source.match(/(?:upload|uploadImage)\s*\([^,]+,\s*(`[^`]+`|"[^"]+"|'[^']+')/);
|
|
32
|
+
return match ? match[1] : null;
|
|
33
|
+
}
|
|
34
|
+
function extractTargetRef(source) {
|
|
35
|
+
// Match patterns like: offer.value.images = [..., ...uploaded] or item.value.productData.images =
|
|
36
|
+
const match = source.match(/(\w+\.value(?:\.\w+)*\.(?:images|image|photo|iconUrl|logo))\s*=/);
|
|
37
|
+
return match ? match[1] : null;
|
|
38
|
+
}
|
|
39
|
+
function hasConfirmation(source) {
|
|
40
|
+
return /showConfirmation/.test(source) && /remove|delete/i.test(source);
|
|
41
|
+
}
|
|
42
|
+
function formatDiagnostic(filePath, pattern, uploadPath, targetRef, hasConfirm) {
|
|
43
|
+
const lines = [];
|
|
44
|
+
lines.push(` ⚠️ ${filePath}:`);
|
|
45
|
+
switch (pattern) {
|
|
46
|
+
case "handler-object":
|
|
47
|
+
lines.push(` Pattern: useAssets() + handler object (upload/remove/edit)`);
|
|
48
|
+
if (targetRef)
|
|
49
|
+
lines.push(` Target ref: ${targetRef}`);
|
|
50
|
+
if (uploadPath)
|
|
51
|
+
lines.push(` Upload path: ${uploadPath}`);
|
|
52
|
+
if (hasConfirm)
|
|
53
|
+
lines.push(` Has confirmation: yes`);
|
|
54
|
+
lines.push(` → Replace with: useAssetsManager(ref, { uploadPath: () => ..., ${hasConfirm ? "confirmRemove: () => showConfirmation(...)" : ""} })`);
|
|
55
|
+
lines.push(` → See migration guide #32, example 1`);
|
|
56
|
+
break;
|
|
57
|
+
case "single-image":
|
|
58
|
+
lines.push(` Pattern: useAssets() for single image (photo/logo/icon)`);
|
|
59
|
+
if (targetRef)
|
|
60
|
+
lines.push(` Target ref: ${targetRef}`);
|
|
61
|
+
if (uploadPath)
|
|
62
|
+
lines.push(` Upload path: ${uploadPath}`);
|
|
63
|
+
lines.push(` → Wrap single value in computed array ref, then use useAssetsManager()`);
|
|
64
|
+
lines.push(` → See migration guide #32, example 2`);
|
|
65
|
+
break;
|
|
66
|
+
case "injectable":
|
|
67
|
+
lines.push(` Pattern: useAssets() + injectable Props.imageHandlers with fallback`);
|
|
68
|
+
if (targetRef)
|
|
69
|
+
lines.push(` Target ref: ${targetRef}`);
|
|
70
|
+
lines.push(` → Complex: parent can override handlers. Create useAssetsManager() for defaults,`);
|
|
71
|
+
lines.push(` accept optional manager override in Props instead of raw handler functions.`);
|
|
72
|
+
lines.push(` → See migration guide #32, example 4`);
|
|
73
|
+
break;
|
|
74
|
+
case "composable":
|
|
75
|
+
lines.push(` Pattern: useAssets() inside a composable function`);
|
|
76
|
+
if (targetRef)
|
|
77
|
+
lines.push(` Target ref: ${targetRef}`);
|
|
78
|
+
if (uploadPath)
|
|
79
|
+
lines.push(` Upload path: ${uploadPath}`);
|
|
80
|
+
lines.push(` → Replace with useAssetsManager(ref, options) inside the composable`);
|
|
81
|
+
lines.push(` → Return the manager instance instead of separate upload/remove functions`);
|
|
82
|
+
lines.push(` → See migration guide #32, example 3`);
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return lines.join("\n");
|
|
86
|
+
}
|
|
87
|
+
function coreTransform(fileInfo, api, _options) {
|
|
88
|
+
const j = api.jscodeshift;
|
|
89
|
+
const root = j(fileInfo.source);
|
|
90
|
+
const frameworkImports = root.find(j.ImportDeclaration, {
|
|
91
|
+
source: { value: "@vc-shell/framework" },
|
|
92
|
+
});
|
|
93
|
+
if (frameworkImports.size() === 0)
|
|
94
|
+
return null;
|
|
95
|
+
// --- Automatic: rename ICommonAsset → AssetLike ---
|
|
96
|
+
const renames = [];
|
|
97
|
+
frameworkImports.find(j.ImportSpecifier).forEach((path) => {
|
|
98
|
+
const name = path.node.imported.type === "Identifier" ? path.node.imported.name : "";
|
|
99
|
+
if (RENAME_MAP[name]) {
|
|
100
|
+
renames.push({ old: name, new: RENAME_MAP[name] });
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (renames.length > 0) {
|
|
104
|
+
for (const r of renames) {
|
|
105
|
+
root.find(j.Identifier, { name: r.old }).forEach((path) => {
|
|
106
|
+
path.node.name = r.new;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// --- Smart diagnostic: detect useAssets() pattern and provide specific guidance ---
|
|
111
|
+
const hasUseAssets = frameworkImports
|
|
112
|
+
.find(j.ImportSpecifier)
|
|
113
|
+
.filter((path) => {
|
|
114
|
+
const name = path.node.imported.type === "Identifier" ? path.node.imported.name : "";
|
|
115
|
+
return name === "useAssets";
|
|
116
|
+
})
|
|
117
|
+
.size() > 0;
|
|
118
|
+
if (hasUseAssets) {
|
|
119
|
+
const source = fileInfo.source;
|
|
120
|
+
const pattern = detectPattern(source, fileInfo.path);
|
|
121
|
+
const uploadPath = extractUploadPath(source);
|
|
122
|
+
const targetRef = extractTargetRef(source);
|
|
123
|
+
const hasConfirm = hasConfirmation(source);
|
|
124
|
+
console.log(formatDiagnostic(fileInfo.path, pattern, uploadPath, targetRef, hasConfirm));
|
|
125
|
+
}
|
|
126
|
+
// --- Diagnostic: detect AssetsHandler type usage ---
|
|
127
|
+
frameworkImports.find(j.ImportSpecifier).forEach((path) => {
|
|
128
|
+
const name = path.node.imported.type === "Identifier" ? path.node.imported.name : "";
|
|
129
|
+
if (name === "AssetsHandler") {
|
|
130
|
+
console.log(` ⚠️ ${fileInfo.path}: AssetsHandler<T> detected — replace with UseAssetsManagerReturn. See migration guide #32.`);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// --- Diagnostic: detect AssetsManager blade handler options ---
|
|
134
|
+
const handlerPatterns = ["assetsEditHandler", "assetsUploadHandler", "assetsRemoveHandler"];
|
|
135
|
+
const source = fileInfo.source;
|
|
136
|
+
for (const pattern of handlerPatterns) {
|
|
137
|
+
if (source.includes(pattern)) {
|
|
138
|
+
console.log(` ⚠️ ${fileInfo.path}: AssetsManager handler options detected (${pattern}).`);
|
|
139
|
+
console.log(` → Replace options.assets/assetsUploadHandler/assetsEditHandler/assetsRemoveHandler`);
|
|
140
|
+
console.log(` with options.manager: markRaw(useAssetsManagerInstance). See migration guide #32, example 5.`);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// --- Diagnostic: detect openBlade calls that open AssetsManager/AssetsDetails with old options ---
|
|
145
|
+
const bladeCallPattern = /name:\s*["']AssetsManager["']/;
|
|
146
|
+
if (bladeCallPattern.test(source)) {
|
|
147
|
+
const hasOldOptions = /assetsUploadHandler|assetsEditHandler|assetsRemoveHandler|loading:\s*\w+Loading/.test(source);
|
|
148
|
+
if (hasOldOptions) {
|
|
149
|
+
console.log(` ⚠️ ${fileInfo.path}: openBlade("AssetsManager") uses old handler options.`);
|
|
150
|
+
console.log(` → Replace assets/loading/assetsUploadHandler/assetsEditHandler/assetsRemoveHandler`);
|
|
151
|
+
console.log(` with { manager: markRaw(useAssetsManagerInstance) }. See migration guide #32, example 5.`);
|
|
152
|
+
}
|
|
153
|
+
else if (!source.includes("markRaw") && /manager\s*:/.test(source)) {
|
|
154
|
+
console.log(` ⚠️ ${fileInfo.path}: openBlade("AssetsManager") passes manager without markRaw().`);
|
|
155
|
+
console.log(` → Wrap with markRaw() to prevent Vue reactive proxy unwrap. See migration guide #32.`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const detailsCallPattern = /name:\s*["']AssetsDetails["']/;
|
|
159
|
+
if (detailsCallPattern.test(source)) {
|
|
160
|
+
if (/ICommonAsset/.test(source)) {
|
|
161
|
+
console.log(` ⚠️ ${fileInfo.path}: openBlade("AssetsDetails") uses ICommonAsset type.`);
|
|
162
|
+
console.log(` → Replace ICommonAsset with AssetLike. See migration guide #32, example 6.`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (renames.length === 0)
|
|
166
|
+
return null;
|
|
167
|
+
return root.toSource();
|
|
168
|
+
}
|
|
169
|
+
export default wrapForSFC(coreTransform);
|
|
170
|
+
export const parser = "tsx";
|
|
171
|
+
//# sourceMappingURL=use-assets-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-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