Skip to content

Commit

Permalink
renamed: packages/vue-script-setup-converter/src/lib/helper.ts -> pac…
Browse files Browse the repository at this point in the history
…kages/vue-script-setup-converter/src/lib/helpers/node.ts
  • Loading branch information
inouetakuya committed May 6, 2024
1 parent cbadbf5 commit 3834058
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/vue-script-setup-converter/src/lib/convertSrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ts,
} from "ts-morph";
import { parse } from "@vue/compiler-sfc";
import { getNodeByKind } from "./helper";
import { getNodeByKind } from "./helpers/node";
import { hasNamedImportIdentifier } from "./helpers/module";
import { convertImportDeclaration } from "./converter/importDeclarationConverter";
import { convertPageMeta } from "./converter/pageMetaConverter";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CallExpression, ScriptTarget, SyntaxKind, Project } from "ts-morph";
import { parse } from "@vue/compiler-sfc";
import prettier from "prettier";
import parserTypeScript from "prettier/parser-typescript";
import { getNodeByKind } from "../helper";
import { getNodeByKind } from "../helpers/node";
import { convertEmits } from "./emitsConverter";

const parseScript = (input: string, lang: "js" | "ts" = "js") => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SyntaxKind,
ArrowFunction,
} from "ts-morph";
import { getOptionsNode } from "../helper";
import { getOptionsNode } from "../helpers/node";

// ctx.emit('event') -> emit('event')
export const replaceEmit = (expression: string, contextName: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CallExpression, ScriptTarget, SyntaxKind, Project } from "ts-morph";
import { parse } from "@vue/compiler-sfc";
import prettier from "prettier";
import parserTypeScript from "prettier/parser-typescript";
import { getNodeByKind } from "../helper";
import { getNodeByKind } from "../helpers/node";
import { convertPageMeta } from "./pageMetaConverter";

const parseScript = (input: string, lang: "js" | "ts" = "js") => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CallExpression, PropertyAssignment } from "ts-morph";
import { getOptionsNode } from "../helper";
import { getOptionsNode } from "../helpers/node";

export const convertPageMeta = (node: CallExpression, lang: string = "js") => {
const nameNode = getOptionsNode(node, "name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CallExpression, ScriptTarget, SyntaxKind, Project } from "ts-morph";
import { parse } from "@vue/compiler-sfc";
import prettier from "prettier";
import parserTypeScript from "prettier/parser-typescript";
import { getNodeByKind } from "../helper";
import { getNodeByKind } from "../helpers/node";
import { convertProps } from "./propsConverter";

const parseScript = (input: string, lang: "js" | "ts" = "js") => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
AsExpression,
ArrowFunction,
} from "ts-morph";
import { getNodeByKind, getOptionsNode } from "../helper";
import { getNodeByKind, getOptionsNode } from "../helpers/node";

export const convertProps = (node: CallExpression, lang: string = "js") => {
const propsNode = getOptionsNode(node, "props");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parse } from "@vue/compiler-sfc";
import prettier from "prettier";
import parserTypeScript from "prettier/parser-typescript";
import optionsApi from "../../samples/composition-api.txt?raw";
import { getNodeByKind } from "../helper";
import { getNodeByKind } from "../helpers/node";

test("setup statements", () => {
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getNodeByKind } from "./../helper";
import { getNodeByKind } from "../helpers/node";
import { CallExpression, SyntaxKind, MethodDeclaration } from "ts-morph";
import { replaceEmit } from "./emitsConverter";

Expand Down Expand Up @@ -27,7 +27,7 @@ export const convertSetup = (node: CallExpression) => {
if (!contextName) {
return x.getFullText();
}
return replaceEmit(x.getFullText(), contextName)
return replaceEmit(x.getFullText(), contextName);
})
.join("");
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// TODO: Move to helpers/node.ts
import { SyntaxKind, Node, PropertyAssignment, CallExpression } from "ts-morph";

export const getNodeByKind = (
Expand Down

0 comments on commit 3834058

Please sign in to comment.