@code-inspector/core 1.4.5 → 1.5.0
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/index.js +4 -4
- package/dist/index.mjs +62658 -62065
- package/package.json +1 -1
- package/types/server/transform/transform-jsx.d.ts +33 -0
- package/types/server/transform/transform-vue-pug.d.ts +15 -0
- package/types/server/transform/transform-vue.d.ts +3 -0
- package/types/shared/utils.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
1
2
|
import { EscapeTags } from '../../shared';
|
|
3
|
+
type RootTarget = {
|
|
4
|
+
type: 'jsx';
|
|
5
|
+
node: any;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'createElement';
|
|
8
|
+
node: any;
|
|
9
|
+
};
|
|
2
10
|
export declare function transformJsx(content: string, filePath: string, escapeTags: EscapeTags): string;
|
|
11
|
+
declare function hasExportDefaultAncestor(path: any): boolean;
|
|
12
|
+
declare function getPropagatedPathExpression(path: any, s: MagicString, content: string): string;
|
|
13
|
+
declare function getObjectPatternPathBinding(param: any): string;
|
|
14
|
+
declare function getObjectPropertyName(node: any): string;
|
|
15
|
+
declare function getEmptyParamsInsertPosition(node: any, content: string): any;
|
|
16
|
+
declare function collectRootTargets(node: any, scope: any, visitedBindings?: Set<string>): RootTarget[];
|
|
17
|
+
declare function shouldPropagatePathToExpression(node: any, scope: any, visitedBindings?: Set<string>): boolean;
|
|
18
|
+
declare function estimateRootCount(node: any, scope: any, visitedBindings: Set<string>): number;
|
|
19
|
+
export declare function injectCreateElementPath(node: any, s: MagicString, content: string, pathExpression: string): void;
|
|
20
|
+
export declare function getJsxNodeName(node: any): string;
|
|
21
|
+
export declare function getCallExpressionName(node: any): string;
|
|
22
|
+
export declare function getExpressionName(node: any): string;
|
|
23
|
+
declare function isEscapedJsxTag(escapeTags: EscapeTags, nodeName: string): boolean;
|
|
24
|
+
export declare const __TEST__: {
|
|
25
|
+
hasExportDefaultAncestor: typeof hasExportDefaultAncestor;
|
|
26
|
+
getPropagatedPathExpression: typeof getPropagatedPathExpression;
|
|
27
|
+
getObjectPatternPathBinding: typeof getObjectPatternPathBinding;
|
|
28
|
+
getObjectPropertyName: typeof getObjectPropertyName;
|
|
29
|
+
getEmptyParamsInsertPosition: typeof getEmptyParamsInsertPosition;
|
|
30
|
+
shouldPropagatePathToExpression: typeof shouldPropagatePathToExpression;
|
|
31
|
+
estimateRootCount: typeof estimateRootCount;
|
|
32
|
+
collectRootTargets: typeof collectRootTargets;
|
|
33
|
+
isEscapedJsxTag: typeof isEscapedJsxTag;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import MagicString from 'magic-string';
|
|
2
2
|
import { EscapeTags } from '../../shared';
|
|
3
3
|
import type { ElementNode } from '@vue/compiler-dom';
|
|
4
|
+
import * as pug from 'volar-service-pug/lib/languageService';
|
|
5
|
+
interface AstLocation {
|
|
6
|
+
column: number;
|
|
7
|
+
line: number;
|
|
8
|
+
}
|
|
4
9
|
export interface PugFileInfo {
|
|
5
10
|
content: string;
|
|
6
11
|
offsets: number[];
|
|
7
12
|
}
|
|
8
13
|
export declare const pugMap: Map<string, PugFileInfo>;
|
|
14
|
+
export declare function belongTemplate(target: AstLocation, start: AstLocation, end: AstLocation): boolean;
|
|
15
|
+
interface TransformPugParams {
|
|
16
|
+
node: pug.Node | null | undefined;
|
|
17
|
+
templateNode: ElementNode;
|
|
18
|
+
s: MagicString;
|
|
19
|
+
escapeTags: EscapeTags;
|
|
20
|
+
filePath: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function transformPugAst(params: TransformPugParams): void;
|
|
9
23
|
/**
|
|
10
24
|
* Check if a template node uses Pug syntax
|
|
11
25
|
* @param templateNode - The template element node to check
|
|
@@ -27,3 +41,4 @@ export declare function calculateLineOffsets(content: string): number[];
|
|
|
27
41
|
* @param s - MagicString instance for code transformation
|
|
28
42
|
*/
|
|
29
43
|
export declare function transformPugTemplate(content: string, filePath: string, templateNode: ElementNode, escapeTags: EscapeTags, s: MagicString): void;
|
|
44
|
+
export {};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { EscapeTags } from '../../shared';
|
|
2
|
+
type VueCompilerDom = Pick<typeof import('@vue/compiler-dom'), 'parse' | 'transform'>;
|
|
3
|
+
export declare function resolveVueCompilerDom(mod: any): VueCompilerDom;
|
|
2
4
|
export declare function transformVue(content: string, filePath: string, escapeTags: EscapeTags): Promise<string>;
|
|
5
|
+
export {};
|
package/types/shared/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CodeOptions, Condition, EscapeTags } from './type';
|
|
2
2
|
export declare function getIP(ip: boolean | string): string;
|
|
3
|
-
export declare function fileURLToPath(fileURL: string): string;
|
|
4
3
|
export declare function isJsTypeFile(file: string): boolean;
|
|
5
4
|
export declare function getFilePathWithoutExt(filePath: string): string;
|
|
6
5
|
export declare function normalizePath(filepath: string): string;
|