@vc-shell/migrate 2.0.0-alpha.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 +359 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +45 -0
- package/dist/cli.js.map +1 -0
- package/dist/runner.d.ts +8 -0
- package/dist/runner.js +154 -0
- package/dist/runner.js.map +1 -0
- package/dist/transforms/banner-variants.d.ts +4 -0
- package/dist/transforms/banner-variants.js +21 -0
- package/dist/transforms/banner-variants.js.map +1 -0
- package/dist/transforms/blade-props-simplification.d.ts +4 -0
- package/dist/transforms/blade-props-simplification.js +315 -0
- package/dist/transforms/blade-props-simplification.js.map +1 -0
- package/dist/transforms/composable-return-types.d.ts +4 -0
- package/dist/transforms/composable-return-types.js +50 -0
- package/dist/transforms/composable-return-types.js.map +1 -0
- package/dist/transforms/define-app-module.d.ts +4 -0
- package/dist/transforms/define-app-module.js +73 -0
- package/dist/transforms/define-app-module.js.map +1 -0
- package/dist/transforms/icon-audit.d.ts +4 -0
- package/dist/transforms/icon-audit.js +38 -0
- package/dist/transforms/icon-audit.js.map +1 -0
- package/dist/transforms/icon-container-prop.d.ts +4 -0
- package/dist/transforms/icon-container-prop.js +14 -0
- package/dist/transforms/icon-container-prop.js.map +1 -0
- package/dist/transforms/menu-group-config.d.ts +4 -0
- package/dist/transforms/menu-group-config.js +22 -0
- package/dist/transforms/menu-group-config.js.map +1 -0
- package/dist/transforms/notification-migration.d.ts +4 -0
- package/dist/transforms/notification-migration.js +31 -0
- package/dist/transforms/notification-migration.js.map +1 -0
- package/dist/transforms/registry.d.ts +3 -0
- package/dist/transforms/registry.js +129 -0
- package/dist/transforms/registry.js.map +1 -0
- package/dist/transforms/remove-deprecated-aliases.d.ts +4 -0
- package/dist/transforms/remove-deprecated-aliases.js +36 -0
- package/dist/transforms/remove-deprecated-aliases.js.map +1 -0
- package/dist/transforms/rewrite-imports.d.ts +4 -0
- package/dist/transforms/rewrite-imports.js +62 -0
- package/dist/transforms/rewrite-imports.js.map +1 -0
- package/dist/transforms/scss-safe-use.d.ts +4 -0
- package/dist/transforms/scss-safe-use.js +50 -0
- package/dist/transforms/scss-safe-use.js.map +1 -0
- package/dist/transforms/shims-to-globals.d.ts +4 -0
- package/dist/transforms/shims-to-globals.js +64 -0
- package/dist/transforms/shims-to-globals.js.map +1 -0
- package/dist/transforms/switch-tooltip-prop.d.ts +4 -0
- package/dist/transforms/switch-tooltip-prop.js +12 -0
- package/dist/transforms/switch-tooltip-prop.js.map +1 -0
- package/dist/transforms/types.d.ts +30 -0
- package/dist/transforms/types.js +2 -0
- package/dist/transforms/types.js.map +1 -0
- package/dist/transforms/use-blade-migration.d.ts +4 -0
- package/dist/transforms/use-blade-migration.js +50 -0
- package/dist/transforms/use-blade-migration.js.map +1 -0
- package/dist/transforms/widgets-migration.d.ts +4 -0
- package/dist/transforms/widgets-migration.js +38 -0
- package/dist/transforms/widgets-migration.js.map +1 -0
- package/dist/utils/import-rewriter.d.ts +3 -0
- package/dist/utils/import-rewriter.js +22 -0
- package/dist/utils/import-rewriter.js.map +1 -0
- package/dist/utils/template-transform.d.ts +13 -0
- package/dist/utils/template-transform.js +37 -0
- package/dist/utils/template-transform.js.map +1 -0
- package/dist/utils/test-helpers.d.ts +32 -0
- package/dist/utils/test-helpers.js +49 -0
- package/dist/utils/test-helpers.js.map +1 -0
- package/dist/utils/vue-sfc-wrapper.d.ts +24 -0
- package/dist/utils/vue-sfc-wrapper.js +61 -0
- package/dist/utils/vue-sfc-wrapper.js.map +1 -0
- package/dist/version-detector.d.ts +1 -0
- package/dist/version-detector.js +32 -0
- package/dist/version-detector.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import semver from "semver";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { resolve, dirname } from "node:path";
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const t = (name) => resolve(__dirname, `${name}.js`);
|
|
6
|
+
export const transforms = [
|
|
7
|
+
{
|
|
8
|
+
name: "define-app-module",
|
|
9
|
+
description: "createAppModule(pages, locales) → defineAppModule({...})",
|
|
10
|
+
introducedIn: "2.0.0-alpha.5",
|
|
11
|
+
migrationGuideSection: "Migrating to defineAppModule",
|
|
12
|
+
transformPath: t("define-app-module"),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "use-blade-migration",
|
|
16
|
+
description: "useBladeNavigation() → useBlade() + onBeforeClose boolean inversion",
|
|
17
|
+
introducedIn: "2.0.0-alpha.8",
|
|
18
|
+
migrationGuideSection: "Section 10",
|
|
19
|
+
transformPath: t("use-blade-migration"),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "notification-migration",
|
|
23
|
+
description: "useNotifications → useBladeNotifications",
|
|
24
|
+
introducedIn: "2.0.0-alpha.10",
|
|
25
|
+
migrationGuideSection: "Notifications System Redesign",
|
|
26
|
+
transformPath: t("notification-migration"),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "rewrite-imports",
|
|
30
|
+
description: "Remap imports for symbols moved to /ai-agent, /extensions",
|
|
31
|
+
introducedIn: "2.0.0",
|
|
32
|
+
transformPath: t("rewrite-imports"),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "remove-deprecated-aliases",
|
|
36
|
+
description: "BladeInstance → BladeInstanceKey, etc.",
|
|
37
|
+
introducedIn: "2.0.0",
|
|
38
|
+
transformPath: t("remove-deprecated-aliases"),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "blade-props-simplification",
|
|
42
|
+
description: "Remove boilerplate expanded/closable props and blade event emits",
|
|
43
|
+
introducedIn: "2.0.0",
|
|
44
|
+
transformPath: t("blade-props-simplification"),
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "icon-audit",
|
|
48
|
+
description: "Detect Font Awesome icons, report with suggested replacements (diagnostic-only)",
|
|
49
|
+
introducedIn: "2.0.0",
|
|
50
|
+
diagnosticOnly: true,
|
|
51
|
+
migrationGuideSection: "Section 2",
|
|
52
|
+
transformPath: t("icon-audit"),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "scss-safe-use",
|
|
56
|
+
description: "@import → @use for safe mechanical cases only",
|
|
57
|
+
introducedIn: "2.0.0",
|
|
58
|
+
migrationGuideSection: "Section 3.2",
|
|
59
|
+
scope: "project",
|
|
60
|
+
transformPath: t("scss-safe-use"),
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "widgets-migration",
|
|
64
|
+
description: "useWidgets() → useBladeWidgets() with manual migration warnings",
|
|
65
|
+
introducedIn: "2.0.0",
|
|
66
|
+
migrationGuideSection: "Registering Widgets in Blades",
|
|
67
|
+
transformPath: t("widgets-migration"),
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "composable-return-types",
|
|
71
|
+
description: "IUsePermissions → UsePermissionsReturn and 19 other type alias renames (20 total)",
|
|
72
|
+
introducedIn: "2.0.0",
|
|
73
|
+
migrationGuideSection: "Guide 23",
|
|
74
|
+
transformPath: t("composable-return-types"),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "banner-variants",
|
|
78
|
+
description: 'VcBanner variant="light-danger" → "danger", etc.',
|
|
79
|
+
introducedIn: "2.0.0",
|
|
80
|
+
migrationGuideSection: "Guide 24",
|
|
81
|
+
transformPath: t("banner-variants"),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "switch-tooltip-prop",
|
|
85
|
+
description: "VcSwitch tooltip → hint prop rename",
|
|
86
|
+
introducedIn: "2.0.0",
|
|
87
|
+
migrationGuideSection: "Guide 25",
|
|
88
|
+
transformPath: t("switch-tooltip-prop"),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "icon-container-prop",
|
|
92
|
+
description: "VcIcon useContainer prop removal",
|
|
93
|
+
introducedIn: "2.0.0",
|
|
94
|
+
migrationGuideSection: "Guide 26",
|
|
95
|
+
transformPath: t("icon-container-prop"),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "menu-group-config",
|
|
99
|
+
description: "Detect deprecated group/groupIcon/inGroupPriority menu properties",
|
|
100
|
+
introducedIn: "2.0.0",
|
|
101
|
+
diagnosticOnly: true,
|
|
102
|
+
migrationGuideSection: "Guide 27",
|
|
103
|
+
transformPath: t("menu-group-config"),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "shims-to-globals",
|
|
107
|
+
description: "Replace manual shims-vue.d.ts / vue-i18n.d.ts with @vc-shell/framework/globals",
|
|
108
|
+
introducedIn: "2.0.0",
|
|
109
|
+
migrationGuideSection: "Guide 30",
|
|
110
|
+
scope: "project",
|
|
111
|
+
transformPath: t("shims-to-globals"),
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
export function selectTransforms(currentVersion, targetVersion) {
|
|
115
|
+
const current = semver.parse(currentVersion);
|
|
116
|
+
const target = semver.parse(targetVersion);
|
|
117
|
+
if (!current || !target)
|
|
118
|
+
return [];
|
|
119
|
+
if (semver.gte(currentVersion, targetVersion))
|
|
120
|
+
return [];
|
|
121
|
+
return transforms.filter((t) => {
|
|
122
|
+
const introduced = semver.parse(t.introducedIn);
|
|
123
|
+
if (!introduced)
|
|
124
|
+
return false;
|
|
125
|
+
return (semver.lt(currentVersion, t.introducedIn) &&
|
|
126
|
+
semver.lte(t.introducedIn, targetVersion));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +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,C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AAC;KACtC;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,gFAAgF;QAC7F,YAAY,EAAE,OAAO;QACrB,qBAAqB,EAAE,UAAU;QACjC,KAAK,EAAE,SAAS;QAChB,aAAa,EAAE,CAAC,CAAC,kBAAkB,CAAC;KACrC;CACF,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAC9B,cAAsB,EACtB,aAAqB;IAErB,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAE3C,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACnC,IAAI,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,CAAC;IAEzD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QAC9B,OAAO,CACL,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,CAAC;YACzC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC,CAC1C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { wrapForSFC } from "../utils/vue-sfc-wrapper.js";
|
|
2
|
+
const RENAME_MAP = {
|
|
3
|
+
navigationViewLocation: "NavigationViewLocationKey",
|
|
4
|
+
BladeInstance: "BladeInstanceKey",
|
|
5
|
+
NotificationTemplatesSymbol: "NotificationTemplatesKey",
|
|
6
|
+
BLADE_BACK_BUTTON: "BladeBackButtonKey",
|
|
7
|
+
TOOLBAR_SERVICE: "ToolbarServiceKey",
|
|
8
|
+
EMBEDDED_MODE: "EmbeddedModeKey",
|
|
9
|
+
};
|
|
10
|
+
function coreTransform(fileInfo, api, _options) {
|
|
11
|
+
const j = api.jscodeshift;
|
|
12
|
+
const root = j(fileInfo.source);
|
|
13
|
+
const frameworkImports = root.find(j.ImportDeclaration, {
|
|
14
|
+
source: { value: "@vc-shell/framework" },
|
|
15
|
+
});
|
|
16
|
+
if (frameworkImports.size() === 0)
|
|
17
|
+
return null;
|
|
18
|
+
const renames = [];
|
|
19
|
+
frameworkImports.find(j.ImportSpecifier).forEach((path) => {
|
|
20
|
+
const name = path.node.imported.type === "Identifier" ? path.node.imported.name : "";
|
|
21
|
+
if (RENAME_MAP[name]) {
|
|
22
|
+
renames.push({ old: name, new: RENAME_MAP[name] });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (renames.length === 0)
|
|
26
|
+
return null;
|
|
27
|
+
for (const r of renames) {
|
|
28
|
+
root.find(j.Identifier, { name: r.old }).forEach((path) => {
|
|
29
|
+
path.node.name = r.new;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return root.toSource();
|
|
33
|
+
}
|
|
34
|
+
export default wrapForSFC(coreTransform);
|
|
35
|
+
export const parser = "tsx";
|
|
36
|
+
//# sourceMappingURL=remove-deprecated-aliases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-deprecated-aliases.js","sourceRoot":"","sources":["../../src/transforms/remove-deprecated-aliases.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,MAAM,UAAU,GAA2B;IACzC,sBAAsB,EAAE,2BAA2B;IACnD,aAAa,EAAE,kBAAkB;IACjC,2BAA2B,EAAE,0BAA0B;IACvD,iBAAiB,EAAE,oBAAoB;IACvC,eAAe,EAAE,mBAAmB;IACpC,aAAa,EAAE,iBAAiB;CACjC,CAAC;AAEF,SAAS,aAAa,CAAC,QAAkB,EAA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AO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AAED,eAAe,UAAU,CAAC,aAAa,CAAc,CAAC;AACtD,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { wrapForSFC } from "../utils/vue-sfc-wrapper.js";
|
|
2
|
+
import { SYMBOL_TO_ENTRY } from "../utils/import-rewriter.js";
|
|
3
|
+
function coreTransform(fileInfo, api, _options) {
|
|
4
|
+
const j = api.jscodeshift;
|
|
5
|
+
const root = j(fileInfo.source);
|
|
6
|
+
const frameworkImports = root.find(j.ImportDeclaration, {
|
|
7
|
+
source: { value: "@vc-shell/framework" },
|
|
8
|
+
});
|
|
9
|
+
if (frameworkImports.size() === 0)
|
|
10
|
+
return null;
|
|
11
|
+
let modified = false;
|
|
12
|
+
frameworkImports.forEach((importPath) => {
|
|
13
|
+
const specifiers = importPath.node.specifiers ?? [];
|
|
14
|
+
const toMove = new Map();
|
|
15
|
+
const toKeep = [];
|
|
16
|
+
for (const spec of specifiers) {
|
|
17
|
+
if (spec.type !== "ImportSpecifier") {
|
|
18
|
+
toKeep.push(spec);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const importedName = spec.imported.type === "Identifier" ? spec.imported.name : "";
|
|
22
|
+
const localName = spec.local?.name ?? importedName;
|
|
23
|
+
const targetEntry = SYMBOL_TO_ENTRY.get(importedName);
|
|
24
|
+
if (targetEntry) {
|
|
25
|
+
if (!toMove.has(targetEntry))
|
|
26
|
+
toMove.set(targetEntry, []);
|
|
27
|
+
toMove.get(targetEntry).push({ imported: importedName, local: localName });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
toKeep.push(spec);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (toMove.size === 0)
|
|
34
|
+
return;
|
|
35
|
+
modified = true;
|
|
36
|
+
// Insert new import declarations for each sub-entry point after current import
|
|
37
|
+
for (const [entryPoint, symbols] of toMove) {
|
|
38
|
+
const newSpecifiers = symbols.map((s) => {
|
|
39
|
+
const spec = j.importSpecifier(j.identifier(s.imported));
|
|
40
|
+
if (s.local !== s.imported) {
|
|
41
|
+
spec.local = j.identifier(s.local);
|
|
42
|
+
}
|
|
43
|
+
return spec;
|
|
44
|
+
});
|
|
45
|
+
const newImport = j.importDeclaration(newSpecifiers, j.literal(entryPoint));
|
|
46
|
+
j(importPath).insertAfter(newImport);
|
|
47
|
+
}
|
|
48
|
+
// Update or remove original import
|
|
49
|
+
if (toKeep.length === 0) {
|
|
50
|
+
j(importPath).remove();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
importPath.node.specifiers = toKeep;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (!modified)
|
|
57
|
+
return null;
|
|
58
|
+
return root.toSource();
|
|
59
|
+
}
|
|
60
|
+
export default wrapForSFC(coreTransform);
|
|
61
|
+
export const parser = "tsx";
|
|
62
|
+
//# sourceMappingURL=rewrite-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite-imports.js","sourceRoot":"","sources":["../../src/transforms/rewrite-imports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,SAAS,aAAa,CAAC,QAAkB,EAAE,GAAQ,EAAE,QAAiB;IACpE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE;QACtD,MAAM,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE;KACzC,CAAC,CAAC;IACH,IAAI,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,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+
function collectScssFiles(dir) {
|
|
5
|
+
const files = [];
|
|
6
|
+
let entries;
|
|
7
|
+
try {
|
|
8
|
+
entries = readdirSync(dir, { encoding: "utf-8" });
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return files;
|
|
12
|
+
}
|
|
13
|
+
for (const entry of entries) {
|
|
14
|
+
const full = join(dir, entry);
|
|
15
|
+
let stat;
|
|
16
|
+
try {
|
|
17
|
+
stat = statSync(full);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (stat.isDirectory()) {
|
|
23
|
+
if (entry === "node_modules" || entry.startsWith("."))
|
|
24
|
+
continue;
|
|
25
|
+
files.push(...collectScssFiles(full));
|
|
26
|
+
}
|
|
27
|
+
else if (entry.endsWith(".scss")) {
|
|
28
|
+
files.push(full);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return files;
|
|
32
|
+
}
|
|
33
|
+
const transform = (_fileInfo, api, options) => {
|
|
34
|
+
const cwd = options.cwd ?? ".";
|
|
35
|
+
const srcDir = join(cwd, "src");
|
|
36
|
+
const scssFiles = collectScssFiles(srcDir);
|
|
37
|
+
for (const filePath of scssFiles) {
|
|
38
|
+
const content = readFileSync(filePath, "utf-8");
|
|
39
|
+
const importLines = content.split("\n").filter((line) => /^@import\s/.test(line.trim()));
|
|
40
|
+
for (const line of importLines) {
|
|
41
|
+
if (SAFE_IMPORT_PATTERN.test(line))
|
|
42
|
+
continue;
|
|
43
|
+
api.report(`${filePath}: ${line.trim()} — consider @use/@forward migration`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null; // Never modify
|
|
47
|
+
};
|
|
48
|
+
export default transform;
|
|
49
|
+
export const parser = "tsx";
|
|
50
|
+
//# sourceMappingURL=scss-safe-use.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss-safe-use.js","sourceRoot":"","sources":["../../src/transforms/scss-safe-use.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IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAE3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAEzF,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC/B,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,SAAS;YAC7C,GAAG,CAAC,MAAM,CAAC,GAAG,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE,qCAAqC,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,eAAe;AAC9B,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, unlinkSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { parse, modify, applyEdits } from "jsonc-parser";
|
|
4
|
+
const GLOBALS_ENTRY = "@vc-shell/framework/globals";
|
|
5
|
+
// Markers that identify standard boilerplate shim files
|
|
6
|
+
const BOILERPLATE_MARKERS = [
|
|
7
|
+
"$mergeLocaleMessage",
|
|
8
|
+
"CoreBladeAdditionalSettings",
|
|
9
|
+
"*.vue",
|
|
10
|
+
];
|
|
11
|
+
function isStandardBoilerplate(content) {
|
|
12
|
+
return BOILERPLATE_MARKERS.some((marker) => content.includes(marker));
|
|
13
|
+
}
|
|
14
|
+
const transform = (_fileInfo, api, options) => {
|
|
15
|
+
const cwd = options.cwd ?? ".";
|
|
16
|
+
const dryRun = options.dryRun ?? false;
|
|
17
|
+
// Find tsconfig — prefer tsconfig.app.json, fallback to tsconfig.json
|
|
18
|
+
const tsconfigAppPath = join(cwd, "tsconfig.app.json");
|
|
19
|
+
const tsconfigPath = join(cwd, "tsconfig.json");
|
|
20
|
+
const targetPath = existsSync(tsconfigAppPath) ? tsconfigAppPath : tsconfigPath;
|
|
21
|
+
if (!existsSync(targetPath)) {
|
|
22
|
+
api.report(`No tsconfig.json found in ${cwd}`);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const content = readFileSync(targetPath, "utf-8");
|
|
26
|
+
const json = parse(content);
|
|
27
|
+
// Check if already has the globals entry
|
|
28
|
+
const currentTypes = json?.compilerOptions?.types ?? [];
|
|
29
|
+
if (currentTypes.includes(GLOBALS_ENTRY)) {
|
|
30
|
+
api.report(`${targetPath}: already has ${GLOBALS_ENTRY} in types`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// Add to compilerOptions.types
|
|
34
|
+
const newTypes = [...currentTypes, GLOBALS_ENTRY];
|
|
35
|
+
const edits = modify(content, ["compilerOptions", "types"], newTypes, {});
|
|
36
|
+
const newContent = applyEdits(content, edits);
|
|
37
|
+
if (!dryRun) {
|
|
38
|
+
writeFileSync(targetPath, newContent, "utf-8");
|
|
39
|
+
}
|
|
40
|
+
api.report(`${targetPath}: added ${GLOBALS_ENTRY} to compilerOptions.types`);
|
|
41
|
+
}
|
|
42
|
+
// Check for shim files
|
|
43
|
+
const shimFiles = ["shims-vue.d.ts", "vue-i18n.d.ts"];
|
|
44
|
+
const srcDir = join(cwd, "src");
|
|
45
|
+
for (const shimName of shimFiles) {
|
|
46
|
+
const shimPath = join(srcDir, shimName);
|
|
47
|
+
if (!existsSync(shimPath))
|
|
48
|
+
continue;
|
|
49
|
+
const shimContent = readFileSync(shimPath, "utf-8");
|
|
50
|
+
if (isStandardBoilerplate(shimContent)) {
|
|
51
|
+
if (!dryRun) {
|
|
52
|
+
unlinkSync(shimPath);
|
|
53
|
+
}
|
|
54
|
+
api.report(`${shimPath}: standard boilerplate — deleted`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
api.report(`${shimPath}: contains custom augmentations — review manually, do NOT delete`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null; // tsconfig changes are done via direct file I/O, not through jscodeshift
|
|
61
|
+
};
|
|
62
|
+
export default transform;
|
|
63
|
+
export const parser = "tsx";
|
|
64
|
+
//# sourceMappingURL=shims-to-globals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shims-to-globals.js","sourceRoot":"","sources":["../../src/transforms/shims-to-globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIzD,MAAM,aAAa,GAAG,6BAA6B,CAAC;AAEpD,wDAAwD;AACxD,MAAM,mBAAmB,GAAG;IAC1B,qBAAqB;IACrB,6BAA6B;IAC7B,OAAO;CACR,CAAC;AAEF,SAAS,qBAAqB,CAAC,OAAe;IAC5C,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,SAAS,GAAc,CAAC,SAAmB,EAAE,GAAQ,EAAE,OAAgB,EAAiB,EAAE;IAC9F,MAAM,GAAG,GAAI,OAAe,CAAC,GAAG,IAAI,GAAG,CAAC;IACxC,MAAM,MAAM,GAAI,OAAe,CAAC,MAAM,IAAI,KAAK,CAAC;IAEhD,sEAAsE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AuB;IACvB,MAAM,SAAS,GAAG,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEhC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,SAAS;QAEpC,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,qBAAqB,CAAC,WAAW,CAAC,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,UAAU,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;YACD,GAAG,CAAC,MAAM,CAAC,GAAG,QAAQ,kCAAkC,CAAC,CAAC;QAC5D,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,GAAG,QAAQ,kEAAkE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,yEAAyE;AACxF,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC;AACzB,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { wrapForSFCTemplate } from "../utils/vue-sfc-wrapper.js";
|
|
2
|
+
function templateTransform(template, _filePath) {
|
|
3
|
+
const tagRe = /(<(?:VcSwitch|vc-switch)\b[^>]*?)((?::)?tooltip=)/gs;
|
|
4
|
+
const modified = template.replace(tagRe, (_match, before, attr) => {
|
|
5
|
+
const replacement = attr.startsWith(":") ? ":hint=" : "hint=";
|
|
6
|
+
return before + replacement;
|
|
7
|
+
});
|
|
8
|
+
return { content: modified, changed: modified !== template };
|
|
9
|
+
}
|
|
10
|
+
export default wrapForSFCTemplate(templateTransform);
|
|
11
|
+
export const parser = "tsx";
|
|
12
|
+
//# sourceMappingURL=switch-tooltip-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-tooltip-prop.js","sourceRoot":"","sources":["../../src/transforms/switch-tooltip-prop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,SAAS,iBAAiB,CAAC,QAAgB,EAAE,SAAiB;IAC5D,MAAM,KAAK,GAAG,qDAAqD,CAAC;IACpE,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAChE,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9D,OAAO,MAAM,GAAG,WAAW,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,KAAK,QAAQ,EAAE,CAAC;AAC/D,CAAC;AAED,eAAe,kBAAkB,CAAC,iBAAiB,CAAc,CAAC;AAClE,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { API, FileInfo, Options } from "jscodeshift";
|
|
2
|
+
export type Transform = (fileInfo: FileInfo, api: API, options: Options & {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
}) => string | null;
|
|
6
|
+
export interface TransformModule {
|
|
7
|
+
default: Transform;
|
|
8
|
+
parser?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface VersionedTransform {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
introducedIn: string;
|
|
14
|
+
migrationGuideSection?: string;
|
|
15
|
+
diagnosticOnly?: boolean;
|
|
16
|
+
/** "file" = called once per file (default), "project" = called once with cwd */
|
|
17
|
+
scope?: "file" | "project";
|
|
18
|
+
/** Absolute path to transform file for dynamic import */
|
|
19
|
+
transformPath: string;
|
|
20
|
+
}
|
|
21
|
+
export interface TransformReport {
|
|
22
|
+
name: string;
|
|
23
|
+
filesModified: string[];
|
|
24
|
+
filesSkipped: string[];
|
|
25
|
+
filesErrored: Array<{
|
|
26
|
+
path: string;
|
|
27
|
+
error: string;
|
|
28
|
+
}>;
|
|
29
|
+
reports: string[];
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/transforms/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { wrapForSFC } from "../utils/vue-sfc-wrapper.js";
|
|
2
|
+
const OLD_NAME = "useBladeNavigation";
|
|
3
|
+
const NEW_NAME = "useBlade";
|
|
4
|
+
function coreTransform(fileInfo, api, _options) {
|
|
5
|
+
const j = api.jscodeshift;
|
|
6
|
+
const root = j(fileInfo.source);
|
|
7
|
+
const frameworkImports = root.find(j.ImportDeclaration, {
|
|
8
|
+
source: { value: "@vc-shell/framework" },
|
|
9
|
+
});
|
|
10
|
+
const hasTarget = frameworkImports.find(j.ImportSpecifier, { imported: { name: OLD_NAME } }).size() > 0;
|
|
11
|
+
if (!hasTarget)
|
|
12
|
+
return null;
|
|
13
|
+
// Step 1: Rename all useBladeNavigation identifiers
|
|
14
|
+
root.find(j.Identifier, { name: OLD_NAME }).forEach((path) => {
|
|
15
|
+
path.node.name = NEW_NAME;
|
|
16
|
+
});
|
|
17
|
+
// Step 2: Find onBeforeClose callbacks and invert returns
|
|
18
|
+
root.find(j.CallExpression, { callee: { name: "onBeforeClose" } }).forEach((callPath) => {
|
|
19
|
+
const args = callPath.node.arguments;
|
|
20
|
+
if (args.length === 0)
|
|
21
|
+
return;
|
|
22
|
+
const callback = args[0];
|
|
23
|
+
// Must be inline arrow/function
|
|
24
|
+
if (callback.type !== "ArrowFunctionExpression" && callback.type !== "FunctionExpression") {
|
|
25
|
+
api.report(`${fileInfo.path}: onBeforeClose with non-inline callback, manual review needed`);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Find return statements inside this callback
|
|
29
|
+
const callbackCollection = j(callback);
|
|
30
|
+
const returnStatements = callbackCollection.find(j.ReturnStatement);
|
|
31
|
+
if (returnStatements.size() === 0)
|
|
32
|
+
return;
|
|
33
|
+
if (returnStatements.size() > 1) {
|
|
34
|
+
api.report(`${fileInfo.path}: Complex onBeforeClose callback with multiple returns, manual review needed`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Single return — invert it
|
|
38
|
+
returnStatements.forEach((retPath) => {
|
|
39
|
+
const arg = retPath.node.argument;
|
|
40
|
+
if (!arg)
|
|
41
|
+
return;
|
|
42
|
+
// Wrap with unary negation: !expr or !(expr)
|
|
43
|
+
retPath.node.argument = j.unaryExpression("!", arg);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
return root.toSource();
|
|
47
|
+
}
|
|
48
|
+
export default wrapForSFC(coreTransform);
|
|
49
|
+
export const parser = "tsx";
|
|
50
|
+
//# sourceMappingURL=use-blade-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-blade-migration.js","sourceRoot":"","sources":["../../src/transforms/use-blade-migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AACtC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,SAAS,aAAa,CAAC,QAAkB,EAAE,GAAQ,EAAE,QAAiB;IACpE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,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AAe,CAAC,CAAC;QAEpE,IAAI,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC;YAAE,OAAO;QAE1C,IAAI,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YAChC,GAAG,CAAC,MAAM,CACR,GAAG,QAAQ,CAAC,IAAI,8EAA8E,CAC/F,CAAC;YACF,OAAO;QACT,CAAC;QAED,4BAA4B;QAC5B,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACnC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;YAClC,IAAI,CAAC,GAAG;gBAAE,OAAO;YAEjB,6CAA6C;YAC7C,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AAED,eAAe,UAAU,CAAC,aAAa,CAAc,CAAC;AACtD,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { wrapForSFC } from "../utils/vue-sfc-wrapper.js";
|
|
2
|
+
const RENAME_MAP = {
|
|
3
|
+
useWidgets: "useBladeWidgets",
|
|
4
|
+
};
|
|
5
|
+
function coreTransform(fileInfo, api, _options) {
|
|
6
|
+
const j = api.jscodeshift;
|
|
7
|
+
const root = j(fileInfo.source);
|
|
8
|
+
const frameworkImports = root.find(j.ImportDeclaration, {
|
|
9
|
+
source: { value: "@vc-shell/framework" },
|
|
10
|
+
});
|
|
11
|
+
if (frameworkImports.size() === 0)
|
|
12
|
+
return null;
|
|
13
|
+
const renames = [];
|
|
14
|
+
frameworkImports.find(j.ImportSpecifier).forEach((path) => {
|
|
15
|
+
const name = path.node.imported.type === "Identifier" ? path.node.imported.name : "";
|
|
16
|
+
if (RENAME_MAP[name]) {
|
|
17
|
+
renames.push({ old: name, new: RENAME_MAP[name] });
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
if (renames.length === 0)
|
|
21
|
+
return null;
|
|
22
|
+
for (const r of renames) {
|
|
23
|
+
root.find(j.Identifier, { name: r.old }).forEach((path) => {
|
|
24
|
+
path.node.name = r.new;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
// Check for registerWidget/unregisterWidget usage requiring manual review
|
|
28
|
+
const hasRegister = root.find(j.Identifier, { name: "registerWidget" }).size() > 0 ||
|
|
29
|
+
root.find(j.Identifier, { name: "unregisterWidget" }).size() > 0;
|
|
30
|
+
if (hasRegister) {
|
|
31
|
+
api.report(`${fileInfo.path}: useWidgets → useBladeWidgets renamed. ` +
|
|
32
|
+
`registerWidget/unregisterWidget calls require manual review.`);
|
|
33
|
+
}
|
|
34
|
+
return root.toSource();
|
|
35
|
+
}
|
|
36
|
+
export default wrapForSFC(coreTransform);
|
|
37
|
+
export const parser = "tsx";
|
|
38
|
+
//# sourceMappingURL=widgets-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgets-migration.js","sourceRoot":"","sources":["../../src/transforms/widgets-migration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,MAAM,UAAU,GAA2B;IACzC,UAAU,EAAE,iBAAiB;CAC9B,CAAC;AAEF,SAAS,aAAa,CAAC,QAAkB,EAAE,GAAQ,EAAE,QAAiB;IACpE,MAAM,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE;QACtD,MAAM,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE;KACzC,CAAC,CAAC;IACH,IAAI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AAE,CAAC;QAChB,GAAG,CAAC,MAAM,CACR,GAAG,QAAQ,CAAC,IAAI,0CAA0C;YAC1D,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AAED,eAAe,UAAU,CAAC,aAAa,CAAc,CAAC;AACtD,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const AI_AGENT_SYMBOLS = new Set([
|
|
2
|
+
"aiAgentPlugin",
|
|
3
|
+
"useAiAgent",
|
|
4
|
+
"useAiAgentContext",
|
|
5
|
+
"VcAiAgentPanel",
|
|
6
|
+
"IAiAgentConfig",
|
|
7
|
+
"AiAgentPluginOptions",
|
|
8
|
+
]);
|
|
9
|
+
export const EXTENSIONS_SYMBOLS = new Set([
|
|
10
|
+
"defineExtensionPoint",
|
|
11
|
+
"useExtensionPoint",
|
|
12
|
+
"ExtensionPoint",
|
|
13
|
+
"ExtensionPoints",
|
|
14
|
+
]);
|
|
15
|
+
export const SYMBOL_TO_ENTRY = new Map();
|
|
16
|
+
for (const sym of AI_AGENT_SYMBOLS) {
|
|
17
|
+
SYMBOL_TO_ENTRY.set(sym, "@vc-shell/framework/ai-agent");
|
|
18
|
+
}
|
|
19
|
+
for (const sym of EXTENSIONS_SYMBOLS) {
|
|
20
|
+
SYMBOL_TO_ENTRY.set(sym, "@vc-shell/framework/extensions");
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=import-rewriter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-rewriter.js","sourceRoot":"","sources":["../../src/utils/import-rewriter.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IACtC,eAAe;IACf,YAAY;IACZ,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACxC,sBAAsB;IACtB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAwB,IAAI,GAAG,EAAE,CAAC;AAE9D,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACnC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,8BAA8B,CAAC,CAAC;AAC3D,CAAC;AACD,KAAK,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACrC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,gCAAgC,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String-based template attribute removal utility.
|
|
3
|
+
* Removes specific attributes from Vue template tags without full AST parsing.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Remove a list of attribute patterns from a specific tag in a template string.
|
|
7
|
+
* Each pattern is matched as a regex against attributes on the given tag.
|
|
8
|
+
*/
|
|
9
|
+
export declare function removeAttributesFromTag(template: string, tagName: string, attributePatterns: RegExp[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Remove blade boilerplate attributes from <VcBlade> in a template string.
|
|
12
|
+
*/
|
|
13
|
+
export declare function removeBladeBoilerplateFromTemplate(template: string): string;
|