mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
feat(babel-utils): add basic types
This commit is contained in:
parent
1e890574bd
commit
61900a0d11
3
packages/babel-types/index.d.ts
vendored
3
packages/babel-types/index.d.ts
vendored
@ -4,5 +4,6 @@ declare module "./dist/types" {
|
||||
export const MARKO_TYPES: string[];
|
||||
}
|
||||
|
||||
export * from "./dist/traverse";
|
||||
export type * from "./dist/traverse";
|
||||
export type * from "./dist/types";
|
||||
export { types };
|
||||
|
||||
85
packages/babel-utils/index.d.ts
vendored
Normal file
85
packages/babel-utils/index.d.ts
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
import type {
|
||||
Node,
|
||||
NodePath,
|
||||
MarkoTag,
|
||||
Identifier,
|
||||
Expression,
|
||||
TemplateElement,
|
||||
TemplateLiteral,
|
||||
Program,
|
||||
} from "@marko/babel-types";
|
||||
|
||||
import type { File } from "@babel/core";
|
||||
|
||||
export function assetAllowedAttributes(path: NodePath<MarkoTag>, allowed: string[]): void;
|
||||
export function assertNoArgs(path: NodePath<MarkoTag>): void;
|
||||
export function assertNoAttributes(path: NodePath<MarkoTag>): void;
|
||||
export function assertNoParams(path: NodePath<MarkoTag>): void;
|
||||
export function assertNoAttributeTags(path: NodePath<MarkoTag>): void;
|
||||
|
||||
export function isNativeTag(path: NodePath<MarkoTag>): boolean;
|
||||
export function isMacroTag(path: NodePath<MarkoTag>): boolean;
|
||||
export function isDynamicTag(path: NodePath<MarkoTag>): boolean;
|
||||
export function isAttributeTag(path: NodePath<MarkoTag>): boolean;
|
||||
export function isTransparentTag(path: NodePath<MarkoTag>): boolean;
|
||||
export function isLoopTag(path: NodePath<MarkoTag>): boolean;
|
||||
|
||||
export function getMacroIdentifier(
|
||||
path: NodePath<MarkoTag>
|
||||
): Identifier | undefined;
|
||||
export function getTagDef(path: NodePath<MarkoTag>): unknown;
|
||||
export function getFullyResolvedTagName(path: NodePath<MarkoTag>): string;
|
||||
|
||||
export function findParentTag(
|
||||
path: NodePath<MarkoTag>
|
||||
): NodePath<MarkoTag> | undefined;
|
||||
export function findAttributeTags(
|
||||
path: NodePath<MarkoTag>
|
||||
): Array<NodePath<MarkoTag>>;
|
||||
|
||||
export function getArgOrSequence(path: NodePath<MarkoTag>): Expression;
|
||||
|
||||
export function loadFileForTag(path: NodePath<MarkoTag>): File | undefined;
|
||||
|
||||
export function normalizeTemplateString(
|
||||
quasis: Array<string | TemplateElement>,
|
||||
expressions: Expression[]
|
||||
): TemplateLiteral;
|
||||
|
||||
type Loc = { line: number; column: number };
|
||||
type LocRange = { start: Loc; end: Loc };
|
||||
|
||||
export function getLoc(file: unknown, pos: number): Loc;
|
||||
export function getLocRange(file: unknown, pos: number): LocRange;
|
||||
export function withLoc<T extends Node>(
|
||||
file: unknown,
|
||||
node: T,
|
||||
start: number,
|
||||
end: number
|
||||
): T;
|
||||
|
||||
export function parseScript(
|
||||
file: unknown,
|
||||
str: string,
|
||||
start?: number
|
||||
): Program;
|
||||
export function parseExpression(
|
||||
file: unknown,
|
||||
str: string,
|
||||
start?: number
|
||||
): Expression;
|
||||
|
||||
export function resolveRelativePath(file: unknown, request: string): string;
|
||||
export function importDefault(
|
||||
file: unknown,
|
||||
request: string,
|
||||
nameHint?: string
|
||||
): Identifier;
|
||||
export function importNamed(
|
||||
file: unknown,
|
||||
request: string,
|
||||
nameHint?: string
|
||||
): Identifier;
|
||||
|
||||
export function getTaglibLookup(file: unknown): unknown;
|
||||
export function getTagDefForTagName(file: unknown, tagName: string): unknown;
|
||||
@ -11,7 +11,8 @@
|
||||
"jsesc": "^2.5.2"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
"dist",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/marko-js/marko/blob/master/packages/babel-utils/README.md",
|
||||
"keywords": [
|
||||
@ -26,6 +27,7 @@
|
||||
"main": "src/index.js",
|
||||
"main:dev": "src/index.js",
|
||||
"main:npm": "dist/index.js",
|
||||
"types": "index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/marko-js/marko/tree/master/packages/babel-utils"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user