@ynor/ynor 1.0.1
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/README.md +16 -0
- package/bin/ynor.js +519 -0
- package/package.json +93 -0
- package/src/lib/core/compiler.d.ts +294 -0
- package/src/lib/core/compiler.js +472 -0
- package/src/lib/core/index.js +43 -0
- package/src/lib/core/plugin.js +114 -0
- package/src/lib/core/runtime.js +138 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// src/lib/core/compiler.d.ts
|
|
2
|
+
export const VERSION: string;
|
|
3
|
+
|
|
4
|
+
export interface CompileOptions {
|
|
5
|
+
filename?: string;
|
|
6
|
+
generate?: 'dom' | 'ssr' | 'server';
|
|
7
|
+
dev?: boolean;
|
|
8
|
+
css?: boolean;
|
|
9
|
+
hydratable?: boolean;
|
|
10
|
+
immutable?: boolean;
|
|
11
|
+
accessors?: boolean;
|
|
12
|
+
customElement?: boolean;
|
|
13
|
+
namespace?: string;
|
|
14
|
+
preserveWhitespace?: boolean;
|
|
15
|
+
preserveComments?: boolean;
|
|
16
|
+
sourcemap?: boolean | 'both' | 'inline';
|
|
17
|
+
name?: string;
|
|
18
|
+
format?: 'esm' | 'cjs' | 'iife';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CompileResult {
|
|
22
|
+
js: {
|
|
23
|
+
code: string;
|
|
24
|
+
map: any;
|
|
25
|
+
};
|
|
26
|
+
css: {
|
|
27
|
+
code: string;
|
|
28
|
+
map: any;
|
|
29
|
+
};
|
|
30
|
+
ast: any;
|
|
31
|
+
warnings: any[];
|
|
32
|
+
vars: any[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function compile(source: string, options?: CompileOptions): CompileResult;
|
|
36
|
+
export function compileModule(source: string, options?: any): CompileResult;
|
|
37
|
+
|
|
38
|
+
export interface MigrateOptions {
|
|
39
|
+
filename?: string;
|
|
40
|
+
use_ts?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function migrate(source: string, options?: MigrateOptions): { code: string };
|
|
44
|
+
|
|
45
|
+
export interface ParseOptions {
|
|
46
|
+
filename?: string;
|
|
47
|
+
modern?: boolean;
|
|
48
|
+
loose?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function parse(source: string, options?: ParseOptions): any;
|
|
52
|
+
export function parseCss(source: string): any;
|
|
53
|
+
|
|
54
|
+
export interface PreprocessorGroup {
|
|
55
|
+
script?: ({ content, filename }: any) => any;
|
|
56
|
+
style?: ({ content, filename }: any) => any;
|
|
57
|
+
markup?: ({ content, filename }: any) => any;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function preprocess(
|
|
61
|
+
source: string,
|
|
62
|
+
preprocessor: PreprocessorGroup | PreprocessorGroup[],
|
|
63
|
+
options?: { filename?: string }
|
|
64
|
+
): Promise<{ code: string; toString: () => string }>;
|
|
65
|
+
|
|
66
|
+
export function print(ast: any, options?: any): { code: string; map: any };
|
|
67
|
+
export function walk(ast: any, options?: any): void;
|
|
68
|
+
|
|
69
|
+
export namespace AST {
|
|
70
|
+
// AST Node definitions
|
|
71
|
+
export interface BaseNode {
|
|
72
|
+
type: string;
|
|
73
|
+
start: number;
|
|
74
|
+
end: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface Root extends BaseNode {
|
|
78
|
+
type: 'Root';
|
|
79
|
+
options: any;
|
|
80
|
+
fragment: Fragment;
|
|
81
|
+
css: any;
|
|
82
|
+
instance: Script;
|
|
83
|
+
module: Script;
|
|
84
|
+
comments: any[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface Fragment extends BaseNode {
|
|
88
|
+
type: 'Fragment';
|
|
89
|
+
nodes: any[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface Text extends BaseNode {
|
|
93
|
+
type: 'Text';
|
|
94
|
+
data: string;
|
|
95
|
+
raw: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ExpressionTag extends BaseNode {
|
|
99
|
+
type: 'ExpressionTag';
|
|
100
|
+
expression: any;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface HtmlTag extends BaseNode {
|
|
104
|
+
type: 'HtmlTag';
|
|
105
|
+
expression: any;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface Comment extends BaseNode {
|
|
109
|
+
type: 'Comment';
|
|
110
|
+
data: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ConstTag extends BaseNode {
|
|
114
|
+
type: 'ConstTag';
|
|
115
|
+
declaration: any;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface DebugTag extends BaseNode {
|
|
119
|
+
type: 'DebugTag';
|
|
120
|
+
identifiers: any[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface RenderTag extends BaseNode {
|
|
124
|
+
type: 'RenderTag';
|
|
125
|
+
expression: any;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface Attribute extends BaseNode {
|
|
129
|
+
type: 'Attribute';
|
|
130
|
+
name: string;
|
|
131
|
+
value: any;
|
|
132
|
+
name_loc: any;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface SpreadAttribute extends BaseNode {
|
|
136
|
+
type: 'SpreadAttribute';
|
|
137
|
+
expression: any;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface Script extends BaseNode {
|
|
141
|
+
type: 'Script';
|
|
142
|
+
context: 'default' | 'module';
|
|
143
|
+
content: any;
|
|
144
|
+
attributes: Attribute[];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface RegularElement extends BaseNode {
|
|
148
|
+
type: 'RegularElement';
|
|
149
|
+
name: string;
|
|
150
|
+
name_loc: any;
|
|
151
|
+
attributes: any[];
|
|
152
|
+
fragment: Fragment;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface Component extends BaseNode {
|
|
156
|
+
type: 'Component';
|
|
157
|
+
name: string;
|
|
158
|
+
name_loc: any;
|
|
159
|
+
attributes: any[];
|
|
160
|
+
fragment: Fragment;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface IfBlock extends BaseNode {
|
|
164
|
+
type: 'IfBlock';
|
|
165
|
+
test: any;
|
|
166
|
+
consequent: Fragment;
|
|
167
|
+
alternate: Fragment | null;
|
|
168
|
+
elseif: boolean;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface EachBlock extends BaseNode {
|
|
172
|
+
type: 'EachBlock';
|
|
173
|
+
expression: any;
|
|
174
|
+
context: any;
|
|
175
|
+
body: Fragment;
|
|
176
|
+
fallback: Fragment | null;
|
|
177
|
+
index: string | null;
|
|
178
|
+
key: any;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface AwaitBlock extends BaseNode {
|
|
182
|
+
type: 'AwaitBlock';
|
|
183
|
+
expression: any;
|
|
184
|
+
value: any;
|
|
185
|
+
error: any;
|
|
186
|
+
pending: Fragment | null;
|
|
187
|
+
then: Fragment | null;
|
|
188
|
+
catch: Fragment | null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface KeyBlock extends BaseNode {
|
|
192
|
+
type: 'KeyBlock';
|
|
193
|
+
expression: any;
|
|
194
|
+
fragment: Fragment;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface SnippetBlock extends BaseNode {
|
|
198
|
+
type: 'SnippetBlock';
|
|
199
|
+
expression: any;
|
|
200
|
+
parameters: any[];
|
|
201
|
+
body: Fragment;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface OnDirective extends BaseNode {
|
|
205
|
+
type: 'OnDirective';
|
|
206
|
+
name: string;
|
|
207
|
+
expression: any;
|
|
208
|
+
modifiers: string[];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface BindDirective extends BaseNode {
|
|
212
|
+
type: 'BindDirective';
|
|
213
|
+
name: string;
|
|
214
|
+
expression: any;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface ClassDirective extends BaseNode {
|
|
218
|
+
type: 'ClassDirective';
|
|
219
|
+
name: string;
|
|
220
|
+
expression: any;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface StyleDirective extends BaseNode {
|
|
224
|
+
type: 'StyleDirective';
|
|
225
|
+
name: string;
|
|
226
|
+
value: any;
|
|
227
|
+
modifiers: string[];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface TransitionDirective extends BaseNode {
|
|
231
|
+
type: 'TransitionDirective';
|
|
232
|
+
name: string;
|
|
233
|
+
expression: any;
|
|
234
|
+
modifiers: string[];
|
|
235
|
+
intro: boolean;
|
|
236
|
+
outro: boolean;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface UseDirective extends BaseNode {
|
|
240
|
+
type: 'UseDirective';
|
|
241
|
+
name: string;
|
|
242
|
+
expression: any;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface LetDirective extends BaseNode {
|
|
246
|
+
type: 'LetDirective';
|
|
247
|
+
name: string;
|
|
248
|
+
expression: any;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface AnimateDirective extends BaseNode {
|
|
252
|
+
type: 'AnimateDirective';
|
|
253
|
+
name: string;
|
|
254
|
+
expression: any;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface SvelteOptions extends BaseNode {
|
|
258
|
+
type: 'SvelteOptions';
|
|
259
|
+
runes?: boolean;
|
|
260
|
+
immutable?: boolean;
|
|
261
|
+
accessors?: boolean;
|
|
262
|
+
preserveWhitespace?: boolean;
|
|
263
|
+
namespace?: string;
|
|
264
|
+
css?: string;
|
|
265
|
+
customElement?: any;
|
|
266
|
+
attributes: Attribute[];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export namespace CSS {
|
|
270
|
+
export interface StyleSheet {
|
|
271
|
+
type: 'StyleSheet';
|
|
272
|
+
nodes: any[];
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface Rule {
|
|
276
|
+
type: 'Rule';
|
|
277
|
+
selector: string;
|
|
278
|
+
nodes: any[];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface Declaration {
|
|
282
|
+
type: 'Declaration';
|
|
283
|
+
property: string;
|
|
284
|
+
value: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface AtRule {
|
|
288
|
+
type: 'AtRule';
|
|
289
|
+
name: string;
|
|
290
|
+
params: string;
|
|
291
|
+
nodes: any[];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|