vuetify-codemods 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +36 -36
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -47982,15 +47982,15 @@ function requireBack() {
|
|
|
47982
47982
|
back.default = arr_back;
|
|
47983
47983
|
return back;
|
|
47984
47984
|
}
|
|
47985
|
-
var matcher = {};
|
|
47985
|
+
var matcher$1 = {};
|
|
47986
47986
|
var hasRequiredMatcher;
|
|
47987
47987
|
function requireMatcher() {
|
|
47988
|
-
if (hasRequiredMatcher) return matcher;
|
|
47988
|
+
if (hasRequiredMatcher) return matcher$1;
|
|
47989
47989
|
hasRequiredMatcher = 1;
|
|
47990
|
-
var __importDefault2 = matcher && matcher.__importDefault || function(mod) {
|
|
47990
|
+
var __importDefault2 = matcher$1 && matcher$1.__importDefault || function(mod) {
|
|
47991
47991
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
47992
47992
|
};
|
|
47993
|
-
Object.defineProperty(matcher, "__esModule", { value: true });
|
|
47993
|
+
Object.defineProperty(matcher$1, "__esModule", { value: true });
|
|
47994
47994
|
const type_12 = __importDefault2(/* @__PURE__ */ requireType$1());
|
|
47995
47995
|
function isTag(node2) {
|
|
47996
47996
|
return node2 && node2.nodeType === type_12.default.ELEMENT_NODE;
|
|
@@ -48073,7 +48073,7 @@ function requireMatcher() {
|
|
|
48073
48073
|
}
|
|
48074
48074
|
return result2;
|
|
48075
48075
|
}
|
|
48076
|
-
matcher.default = {
|
|
48076
|
+
matcher$1.default = {
|
|
48077
48077
|
isTag,
|
|
48078
48078
|
getAttributeValue,
|
|
48079
48079
|
getName,
|
|
@@ -48087,7 +48087,7 @@ function requireMatcher() {
|
|
|
48087
48087
|
findOne,
|
|
48088
48088
|
findAll: findAll2
|
|
48089
48089
|
};
|
|
48090
|
-
return matcher;
|
|
48090
|
+
return matcher$1;
|
|
48091
48091
|
}
|
|
48092
48092
|
var voidTag = {};
|
|
48093
48093
|
var hasRequiredVoidTag;
|
|
@@ -95800,7 +95800,7 @@ const classProps = /* @__PURE__ */ new Map([
|
|
|
95800
95800
|
["VWindowItem", "selectedClass"]
|
|
95801
95801
|
]);
|
|
95802
95802
|
function findClassNodes(ast, utils2, match2) {
|
|
95803
|
-
const
|
|
95803
|
+
const matchingRegexp = new RegExp(String.raw`(^|\s)(?:${match2.join("|")})(?=$|\s)`);
|
|
95804
95804
|
const results = [];
|
|
95805
95805
|
const attrs = ast_helpers_exports.findAll(ast, { type: "VAttribute" });
|
|
95806
95806
|
for (const node2 of attrs) {
|
|
@@ -95823,15 +95823,15 @@ function findClassNodes(ast, utils2, match2) {
|
|
|
95823
95823
|
if (!node2.value) continue;
|
|
95824
95824
|
utils2.traverseTemplateAST(node2.value, {
|
|
95825
95825
|
enterNode(node22) {
|
|
95826
|
-
if ((node22.type === "VLiteral" || node22.type === "Literal") && typeof node22.value === "string" &&
|
|
95826
|
+
if ((node22.type === "VLiteral" || node22.type === "Literal") && typeof node22.value === "string" && matchingRegexp.test(node22.value)) {
|
|
95827
95827
|
results.push(node22);
|
|
95828
|
-
} else if (node22.type === "Property" && (node22.key.type === "Literal" || node22.key.type === "Identifier" && !node22.computed)) {
|
|
95828
|
+
} else if (node22.type === "Property" && (node22.key.type === "Literal" && typeof node22.key.value === "string" && matchingRegexp.test(node22.key.value) || node22.key.type === "Identifier" && !node22.computed && matchingRegexp.test(node22.key.name))) {
|
|
95829
95829
|
results.push(node22.key);
|
|
95830
95830
|
}
|
|
95831
95831
|
}
|
|
95832
95832
|
});
|
|
95833
95833
|
}
|
|
95834
|
-
return results;
|
|
95834
|
+
return { results, matchingRegexp: new RegExp(matchingRegexp, "g") };
|
|
95835
95835
|
}
|
|
95836
95836
|
function removeDotMember(ref, name) {
|
|
95837
95837
|
let current = ref;
|
|
@@ -95980,20 +95980,19 @@ const elevationComponents = /* @__PURE__ */ new Set([
|
|
|
95980
95980
|
]);
|
|
95981
95981
|
const mapping = [0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5];
|
|
95982
95982
|
const elevationMatch = String.raw`elevation-(\d{1,2})`;
|
|
95983
|
-
const elevationRegexp = new RegExp(String.raw`(^|\s)${elevationMatch}(?=$|\s)`, "g");
|
|
95984
95983
|
const v4ElevationPlugin = {
|
|
95985
95984
|
type: "codemod",
|
|
95986
95985
|
name: "vuetify-4-elevation",
|
|
95987
95986
|
transform({ sfcAST, utils: utils2 }) {
|
|
95988
95987
|
if (!sfcAST) return 0;
|
|
95989
95988
|
let count = 0;
|
|
95990
|
-
const
|
|
95991
|
-
for (const node2 of
|
|
95989
|
+
const { results, matchingRegexp } = findClassNodes(sfcAST, utils2, [elevationMatch]);
|
|
95990
|
+
for (const node2 of results) {
|
|
95992
95991
|
if (node2.type === "Identifier") {
|
|
95993
|
-
node2.name = node2.name.replaceAll(
|
|
95992
|
+
node2.name = node2.name.replaceAll(matchingRegexp, (_, s2, n2) => `${s2}elevation-${mapping[Number(n2)]}`);
|
|
95994
95993
|
count++;
|
|
95995
95994
|
} else if (typeof node2.value === "string") {
|
|
95996
|
-
node2.value = node2.value.replaceAll(
|
|
95995
|
+
node2.value = node2.value.replaceAll(matchingRegexp, (_, s2, n2) => `${s2}elevation-${mapping[Number(n2)]}`);
|
|
95997
95996
|
count++;
|
|
95998
95997
|
}
|
|
95999
95998
|
}
|
|
@@ -96034,7 +96033,7 @@ const v4FormSlotRefsPlugin = {
|
|
|
96034
96033
|
return count;
|
|
96035
96034
|
}
|
|
96036
96035
|
};
|
|
96037
|
-
const breakpoints = ["sm", "md", "lg", "xl", "xxl"];
|
|
96036
|
+
const breakpoints$1 = ["sm", "md", "lg", "xl", "xxl"];
|
|
96038
96037
|
const v4GridPlugin = {
|
|
96039
96038
|
type: "codemod",
|
|
96040
96039
|
name: "vuetify-4-grid",
|
|
@@ -96062,14 +96061,14 @@ const v4GridPlugin = {
|
|
|
96062
96061
|
}
|
|
96063
96062
|
for (const prop of ["align", "justify", "align-content"]) {
|
|
96064
96063
|
if (propToClass(el, prop, prop, builders2)) count++;
|
|
96065
|
-
for (const bp of breakpoints) {
|
|
96064
|
+
for (const bp of breakpoints$1) {
|
|
96066
96065
|
if (propToClass(el, `${prop}-${bp}`, `${prop}-${bp}`, builders2)) count++;
|
|
96067
96066
|
}
|
|
96068
96067
|
}
|
|
96069
96068
|
}
|
|
96070
96069
|
if (classify(tag) === "VCol") {
|
|
96071
96070
|
if (propToClass(el, "order", "order", builders2)) count++;
|
|
96072
|
-
for (const bp of breakpoints) {
|
|
96071
|
+
for (const bp of breakpoints$1) {
|
|
96073
96072
|
if (propToClass(el, `order-${bp}`, `order-${bp}`, builders2)) count++;
|
|
96074
96073
|
}
|
|
96075
96074
|
if (propToClass(el, "align-self", "align-self", builders2)) count++;
|
|
@@ -96166,35 +96165,36 @@ const v4SnackbarQueueSlotPlugin = {
|
|
|
96166
96165
|
return count;
|
|
96167
96166
|
}
|
|
96168
96167
|
};
|
|
96168
|
+
const breakpoints = ["sm", "md", "lg", "xl", "xxl"];
|
|
96169
96169
|
const replacements = {
|
|
96170
|
-
"
|
|
96171
|
-
"
|
|
96172
|
-
"
|
|
96173
|
-
"
|
|
96174
|
-
"
|
|
96175
|
-
"
|
|
96176
|
-
"
|
|
96177
|
-
"
|
|
96178
|
-
"
|
|
96179
|
-
"
|
|
96180
|
-
"
|
|
96181
|
-
"
|
|
96182
|
-
"
|
|
96170
|
+
"h1": "-display-large",
|
|
96171
|
+
"h2": "-display-medium",
|
|
96172
|
+
"h3": "-display-small",
|
|
96173
|
+
"h4": "-headline-large",
|
|
96174
|
+
"h5": "-headline-medium",
|
|
96175
|
+
"h6": "-headline-small",
|
|
96176
|
+
"subtitle-1": "-body-large",
|
|
96177
|
+
"subtitle-2": "-label-large",
|
|
96178
|
+
"body-1": "-body-large",
|
|
96179
|
+
"body-2": "-body-medium",
|
|
96180
|
+
"caption": "-body-small",
|
|
96181
|
+
"button": "-label-large",
|
|
96182
|
+
"overline": "-label-small"
|
|
96183
96183
|
};
|
|
96184
|
-
const
|
|
96184
|
+
const matcher = String.raw`text(-(?:${breakpoints.join("|")}))?-(${Object.keys(replacements).join("|")})`;
|
|
96185
96185
|
const v4TypographyPlugin = {
|
|
96186
96186
|
type: "codemod",
|
|
96187
96187
|
name: "vuetify-4-typography",
|
|
96188
96188
|
transform({ sfcAST, utils: utils2 }) {
|
|
96189
96189
|
if (!sfcAST) return 0;
|
|
96190
96190
|
let count = 0;
|
|
96191
|
-
const
|
|
96192
|
-
for (const node2 of
|
|
96191
|
+
const { results, matchingRegexp } = findClassNodes(sfcAST, utils2, [matcher]);
|
|
96192
|
+
for (const node2 of results) {
|
|
96193
96193
|
if (node2.type === "Identifier") {
|
|
96194
|
-
node2.name = node2.name.replaceAll(matchingRegexp, (_, s2, m) => `${s2}${replacements[m]}`);
|
|
96194
|
+
node2.name = node2.name.replaceAll(matchingRegexp, (_, s2, b, m) => `${s2}text${b || ""}${replacements[m]}`);
|
|
96195
96195
|
count++;
|
|
96196
96196
|
} else if (typeof node2.value === "string") {
|
|
96197
|
-
node2.value = node2.value.replaceAll(matchingRegexp, (_, s2, m) => `${s2}${replacements[m]}`);
|
|
96197
|
+
node2.value = node2.value.replaceAll(matchingRegexp, (_, s2, b, m) => `${s2}text${b || ""}${replacements[m]}`);
|
|
96198
96198
|
count++;
|
|
96199
96199
|
}
|
|
96200
96200
|
}
|