@bjmhe/automd 0.0.0 → 0.0.4

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","names":[],"sources":["../src/generator.ts"],"sourcesContent":["import type { Block } from \"./_parse.ts\";\nimport type { ResolvedConfig } from \"./config.ts\";\nimport type { TransformResult } from \"./transform.ts\";\n\nexport interface GenerateContext {\n args: Record<string, any>;\n config: ResolvedConfig;\n block: Block;\n url?: string;\n transform: (contents: string) => Promise<TransformResult>;\n}\n\n/** The result of generating a component. */\nexport interface GenerateResult {\n /** The generated component */\n contents: string;\n\n /** A list of issues that occurred during generation. */\n issues?: string[];\n\n /** Whether to unwrap the component. */\n unwrap?: boolean;\n}\n\nexport interface Generator {\n name: string;\n generate: (ctx: GenerateContext) => GenerateResult | Promise<GenerateResult>;\n}\n\n/** @internal */\nexport function defineGenerator(generator: Generator) {\n return generator;\n}\n"],"mappings":";;;AA8BA,SAAgB,gBAAgB,WAAsB;CACpD,OAAO;AACT"}
package/dist/index.d.ts CHANGED
@@ -1,197 +1,4 @@
1
1
  /*! Keep it simple, keep it free */
2
- //#region src/_parse.d.ts
3
- interface Block {
4
- /**
5
- * The name of the generator to use for updates.
6
- */
7
- generator: string;
8
- /**
9
- * The arguments that are passed to the generator.
10
- */
11
- rawArgs: string;
12
- /**
13
- * The current content of the block.
14
- */
15
- contents: string;
16
- /**
17
- * The location of the content in the original document.
18
- */
19
- loc: {
20
- start: number;
21
- end: number;
22
- };
23
- /**
24
- * The location including the automd comments.
25
- */
26
- _loc: {
27
- start: number;
28
- end: number;
29
- };
30
- }
31
- //#endregion
32
- //#region src/transform.d.ts
33
- interface TransformResult {
34
- /**
35
- * Wether if the document has been modified at all.
36
- */
37
- hasChanged: boolean;
38
- /**
39
- * Whether if there were any problems found in the document.
40
- */
41
- hasIssues: boolean;
42
- /**
43
- * The text of the document after it was transformed.
44
- */
45
- contents: string;
46
- /**
47
- * A list of specific parts that have been transformed in the document.
48
- */
49
- updates: {
50
- /**
51
- * The specific part of the document that has been transformed.
52
- */
53
- block: Block;
54
- /**
55
- * What the transform has done to this part of the document.
56
- */
57
- result: GenerateResult;
58
- }[];
59
- /**
60
- * How long the editing process took, measured in milliseconds.
61
- */
62
- time: number;
63
- }
64
- /**
65
- * Edits a markdown document based on certain rules and configurations.
66
- *
67
- * @param contents - The text of the markdown document you want to edit.
68
- * @param _config - Optional. The settings that affect how the document will be edited. See {@link Config}.
69
- * @param url - Optional. The URL associated with the document, if any.
70
- * @returns - The result of the transformation, including any changes made and how long it took. See {@link TransformResult}.
71
- */
72
- declare function transform(contents: string, _config?: Config, url?: string): Promise<TransformResult>;
73
- //#endregion
74
- //#region src/generator.d.ts
75
- interface GenerateContext {
76
- args: Record<string, any>;
77
- config: ResolvedConfig;
78
- block: Block;
79
- url?: string;
80
- transform: (contents: string) => Promise<TransformResult>;
81
- }
82
- /**
83
- * The result of generating a component.
84
- */
85
- interface GenerateResult {
86
- /**
87
- * The generated component
88
- */
89
- contents: string;
90
- /**
91
- * A list of issues that occurred during generation.
92
- */
93
- issues?: string[];
94
- /**
95
- * Whether to unwrap the component.
96
- */
97
- unwrap?: boolean;
98
- }
99
- interface Generator {
100
- name: string;
101
- generate: (ctx: GenerateContext) => GenerateResult | Promise<GenerateResult>;
102
- }
103
- /**
104
- * @internal
105
- */
106
- declare function defineGenerator(generator: Generator): Generator;
107
- //#endregion
108
- //#region src/config.d.ts
109
- interface Config {
110
- /**
111
- * The working directory
112
- *
113
- * @default "." (current directory)
114
- */
115
- dir?: string;
116
- /**
117
- * Name or path to the input file or files with glob patterns.
118
- *
119
- * @default "README.md"
120
- */
121
- input?: string | string[];
122
- /**
123
- * Name or path of the output files. If not provided, the input file will be overwritten.
124
- *
125
- * @default input
126
- */
127
- output?: string;
128
- /**
129
- * Ignore patterns if input is a glob pattern
130
- *
131
- * @default ["node_modules", "dist", "/.*"]
132
- */
133
- ignore?: string[];
134
- /**
135
- * Watch for changes in input files and regenerate output
136
- */
137
- watch?: boolean;
138
- /**
139
- * Watch callback
140
- */
141
- onWatch?: (event: {
142
- results: AutomdResult[];
143
- time: number;
144
- }) => void;
145
- /** Custom generators */
146
- generators?: Record<string, Generator>;
147
- }
148
- declare const RESOLVED_CONFIG_SYMBOL: unique symbol;
149
- type ResolvedConfig = { [P in keyof Config]-?: Config[P] } & {
150
- [RESOLVED_CONFIG_SYMBOL]: true;
151
- input: string[];
152
- output?: string;
153
- };
154
- declare function resolveConfig(config?: Config | ResolvedConfig): ResolvedConfig;
155
- declare function loadConfig(dir: string | undefined, overrides: Config): Promise<ResolvedConfig>;
156
- //#endregion
157
- //#region src/automd.d.ts
158
- interface AutomdResult extends TransformResult {
159
- input: string;
160
- output: string;
161
- }
162
- /**
163
- * Describes what you get back from the `automd` function.
164
- */
165
- interface AutomdReturn {
166
- /**
167
- * A list of the changes made to the file(s) by `automd`.
168
- */
169
- results: AutomdResult[];
170
- /**
171
- * How long it took to make the changes, in milliseconds.
172
- */
173
- time: number;
174
- /**
175
- * The resolved configuration that were used for these changes.
176
- */
177
- config: ResolvedConfig;
178
- /**
179
- * If you started watching the file(s) for changes, this function can be called to stop watching.
180
- */
181
- unwatch?: () => void | Promise<void>;
182
- }
183
- /**
184
- * Scans a markdown file looking for special comments.
185
- * These comments tell the function to add or update certain parts of the file automatically.
186
- * You can change how this works by giving it different settings in the `_config` option.
187
- *
188
- * @param _config - The settings to use for the update process. See {@link Config}.
189
- * @returns - An object containing the results of the update, including any changes made and any problems found. See {@link AutomdReturn}.
190
- *
191
- * @see https://automd.unjs.io/guide
192
- */
193
- declare function automd(_config?: Config): Promise<AutomdReturn>;
194
- //#endregion
2
+ import { a as ResolvedConfig, c as GenerateContext, d as defineGenerator, f as TransformResult, i as Config, l as GenerateResult, n as AutomdReturn, o as loadConfig, p as transform, r as automd, s as resolveConfig, t as AutomdResult, u as Generator } from "./automd-C2wjw_SG.js";
195
3
  export { AutomdResult, AutomdReturn, Config, GenerateContext, GenerateResult, Generator, ResolvedConfig, TransformResult, automd, defineGenerator, loadConfig, resolveConfig, transform };
196
- /*! Built with love & coffee ☕ */
197
- //# sourceMappingURL=index.d.ts.map
4
+ /*! Built with love & coffee ☕ */