einsteinjs 0.1.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.d.ts +90 -0
- package/dist/index.js +14675 -0
- package/package.json +29 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
type Scope = 'typescriptreact' | 'javascriptreact' | 'typescript' | 'javascript' | 'html' | 'json';
|
|
2
|
+
interface Snippet {
|
|
3
|
+
name: string;
|
|
4
|
+
scope: Scope[];
|
|
5
|
+
prefix: string;
|
|
6
|
+
body: string[];
|
|
7
|
+
tags: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Builder Pattern
|
|
12
|
+
*
|
|
13
|
+
* Responsabilidade:
|
|
14
|
+
* Apenas armazenar dados.
|
|
15
|
+
*
|
|
16
|
+
* NÃO valida.
|
|
17
|
+
* NÃO compila.
|
|
18
|
+
* NÃO transforma.
|
|
19
|
+
*/
|
|
20
|
+
declare class SnippetBuilder {
|
|
21
|
+
/**
|
|
22
|
+
* Partial permite criar o objeto aos poucos.
|
|
23
|
+
*/
|
|
24
|
+
private snippet;
|
|
25
|
+
/**
|
|
26
|
+
* Nome do snippet.
|
|
27
|
+
*
|
|
28
|
+
* Ex:
|
|
29
|
+
* "React Functional Component"
|
|
30
|
+
*/
|
|
31
|
+
it(name: string): this;
|
|
32
|
+
/**
|
|
33
|
+
* Escopos do VSCode.
|
|
34
|
+
*/
|
|
35
|
+
scope(scope: Scope[]): this;
|
|
36
|
+
/**
|
|
37
|
+
* Prefixo digitado pelo usuário.
|
|
38
|
+
*/
|
|
39
|
+
prefix(prefix: string): this;
|
|
40
|
+
/**
|
|
41
|
+
* Corpo do snippet.
|
|
42
|
+
*/
|
|
43
|
+
body(body: string[]): this;
|
|
44
|
+
/**
|
|
45
|
+
* Tags para futuras features:
|
|
46
|
+
* documentação, filtros, busca etc.
|
|
47
|
+
*/
|
|
48
|
+
tag(tags: string[]): this;
|
|
49
|
+
/**
|
|
50
|
+
* Constrói o objeto final.
|
|
51
|
+
*/
|
|
52
|
+
build(): Snippet;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface Config {
|
|
56
|
+
output: string;
|
|
57
|
+
snippets: SnippetBuilder[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Apenas ajuda no autocomplete.
|
|
61
|
+
*/
|
|
62
|
+
declare function defineConfig(config: Config): Config;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Processo completo:
|
|
66
|
+
*
|
|
67
|
+
* builder
|
|
68
|
+
* ↓
|
|
69
|
+
* schema validation
|
|
70
|
+
* ↓
|
|
71
|
+
* semantic validation
|
|
72
|
+
* ↓
|
|
73
|
+
* compilation
|
|
74
|
+
* ↓
|
|
75
|
+
* output
|
|
76
|
+
*/
|
|
77
|
+
declare function build(config: Config): Promise<void>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* API pública:
|
|
81
|
+
*
|
|
82
|
+
* registry
|
|
83
|
+
* .it("RFC")
|
|
84
|
+
* .scope(...)
|
|
85
|
+
*/
|
|
86
|
+
declare const registry: {
|
|
87
|
+
it(name: string): SnippetBuilder;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { type Snippet, build, defineConfig, registry };
|