@batijs/core 0.0.288 → 0.0.289
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.d.ts +56 -2
- package/dist/index.js +650 -600
- package/package.json +8 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { BatiSet } from '@batijs/features';
|
|
1
|
+
import { BatiSet, CategoryLabels, Flags } from '@batijs/features';
|
|
2
2
|
import * as yaml from 'yaml';
|
|
3
3
|
import { ParseOptions, DocumentOptions, SchemaOptions, Document } from 'yaml';
|
|
4
4
|
export { Document as YAMLDocument } from 'yaml';
|
|
5
|
+
import * as mdast from 'mdast';
|
|
6
|
+
import { Nodes, Parents, Root } from 'mdast';
|
|
7
|
+
import * as attributes_parser from 'attributes-parser';
|
|
5
8
|
import { ProxifiedModule } from 'magicast';
|
|
6
9
|
export { builders, generateCode, loadFile, parseModule } from 'magicast';
|
|
7
10
|
export { addVitePlugin, deepMergeObject } from 'magicast/helpers';
|
|
@@ -43,6 +46,56 @@ declare function formatCode(code: string, options: {
|
|
|
43
46
|
filepath: string;
|
|
44
47
|
}): Promise<string>;
|
|
45
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Parse a comment marker.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
declare function commentMarker(value: Nodes): {
|
|
54
|
+
name: string;
|
|
55
|
+
suffix: string;
|
|
56
|
+
attributes: string;
|
|
57
|
+
parameters: attributes_parser.Attributes;
|
|
58
|
+
node: mdast.Html;
|
|
59
|
+
} | undefined;
|
|
60
|
+
|
|
61
|
+
type MarkdownPosition = "before" | "after" | "replace";
|
|
62
|
+
type Sections = "document" | "intro" | "features" | "TOC";
|
|
63
|
+
type FilterHandler = (info: ReturnType<typeof commentMarker>) => boolean;
|
|
64
|
+
type FilterObject = {
|
|
65
|
+
section?: Sections;
|
|
66
|
+
category?: CategoryLabels;
|
|
67
|
+
flag?: Flags;
|
|
68
|
+
[key: string]: undefined | string | number | boolean;
|
|
69
|
+
};
|
|
70
|
+
type WrapperObject = FilterObject & {
|
|
71
|
+
name?: string;
|
|
72
|
+
};
|
|
73
|
+
type MarkdownOptions = {
|
|
74
|
+
filter?: FilterObject | FilterHandler;
|
|
75
|
+
position?: MarkdownPosition;
|
|
76
|
+
wrapper?: WrapperObject;
|
|
77
|
+
};
|
|
78
|
+
type classConfig = {
|
|
79
|
+
defaults?: MarkdownOptions;
|
|
80
|
+
};
|
|
81
|
+
type Info = {
|
|
82
|
+
parent: Parents;
|
|
83
|
+
start: number;
|
|
84
|
+
end: number;
|
|
85
|
+
};
|
|
86
|
+
type ZoneHandler = (start: Nodes, between: Nodes[], end: Nodes, info: Info) => Nodes[] | null | undefined | void;
|
|
87
|
+
|
|
88
|
+
declare function parseMarkdown(text: string, defaults?: MarkdownOptions): MarkdownV2;
|
|
89
|
+
declare class MarkdownV2 implements StringTransformer {
|
|
90
|
+
private tree;
|
|
91
|
+
private contents;
|
|
92
|
+
private config;
|
|
93
|
+
constructor(tree: Root, config?: classConfig);
|
|
94
|
+
addMarkdownFeature(markdown: string | ZoneHandler, flag: Flags): void;
|
|
95
|
+
addMarkdown(markdown: string | ZoneHandler, options?: MarkdownOptions): void;
|
|
96
|
+
finalize(): string;
|
|
97
|
+
}
|
|
98
|
+
|
|
46
99
|
declare function h1(text: string): string;
|
|
47
100
|
declare function h2(text: string): string;
|
|
48
101
|
declare function h3(text: string): string;
|
|
@@ -122,6 +175,7 @@ declare class PackageJsonTransformer<U extends PackageJsonDeps> implements Strin
|
|
|
122
175
|
}
|
|
123
176
|
|
|
124
177
|
declare function loadReadme({ readfile }: TransformerProps): Promise<Readme>;
|
|
178
|
+
declare function loadMarkdown({ readfile }: TransformerProps): Promise<MarkdownV2>;
|
|
125
179
|
declare function loadAsJson({ readfile, source, target }: TransformerProps): Promise<any>;
|
|
126
180
|
declare function loadPackageJson<U extends PackageJsonDeps>({ readfile, source, target }: TransformerProps, scopedPackageJson: U): Promise<PackageJsonTransformer<U>>;
|
|
127
181
|
declare function loadAsMagicast<Exports extends object>({ readfile, source, target, }: TransformerProps): Promise<ProxifiedModule<Exports>>;
|
|
@@ -142,4 +196,4 @@ declare function getVersion(): {
|
|
|
142
196
|
semver: string[];
|
|
143
197
|
};
|
|
144
198
|
|
|
145
|
-
export { type ContentGetter, type FileContext, Readme, type StringTransformer, type Transformer, type TransformerProps, type VikeMeta, appendToEnv, formatCode, getArgs, getVersion, loadAsJson, loadAsMagicast, loadPackageJson, loadReadme, loadRelativeFileAsMagicast, loadYaml, markdown, packageManager, parseReadme, transformAndFormat, withIcon };
|
|
199
|
+
export { type ContentGetter, type FileContext, MarkdownV2, Readme, type StringTransformer, type Transformer, type TransformerProps, type VikeMeta, appendToEnv, formatCode, getArgs, getVersion, loadAsJson, loadAsMagicast, loadMarkdown, loadPackageJson, loadReadme, loadRelativeFileAsMagicast, loadYaml, markdown, packageManager, parseMarkdown, parseReadme, transformAndFormat, withIcon };
|