vue-repl-enhance 0.0.4 → 0.0.5
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/codemirror-editor.d.ts +55 -0
- package/dist/core.d.ts +293 -14
- package/dist/monaco-editor.d.ts +56 -0
- package/dist/vue-repl-enhance.d.ts +1085 -0
- package/package.json +7 -4
- package/dist/compiler/index.d.ts +0 -4
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/shared.d.ts +0 -16
- package/dist/compiler/shared.d.ts.map +0 -1
- package/dist/compiler/transform.d.ts +0 -15
- package/dist/compiler/transform.d.ts.map +0 -1
- package/dist/compiler/vue-jsx.d.ts +0 -11
- package/dist/compiler/vue-jsx.d.ts.map +0 -1
- package/dist/components/Message.vue.d.ts +0 -18
- package/dist/components/Message.vue.d.ts.map +0 -1
- package/dist/components/Repl.vue.d.ts +0 -373
- package/dist/components/Repl.vue.d.ts.map +0 -1
- package/dist/components/SplitPane.vue.d.ts +0 -26
- package/dist/components/SplitPane.vue.d.ts.map +0 -1
- package/dist/components/editor/EditorContainer.vue.d.ts +0 -106
- package/dist/components/editor/EditorContainer.vue.d.ts.map +0 -1
- package/dist/components/editor/FileSelector.vue.d.ts +0 -71
- package/dist/components/editor/FileSelector.vue.d.ts.map +0 -1
- package/dist/components/output/Output.vue.d.ts +0 -122
- package/dist/components/output/Output.vue.d.ts.map +0 -1
- package/dist/components/output/Preview.vue.d.ts +0 -62
- package/dist/components/output/Preview.vue.d.ts.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/editor/codemirror/CodeMirrorEditor.vue.d.ts +0 -46
- package/dist/editor/codemirror/CodeMirrorEditor.vue.d.ts.map +0 -1
- package/dist/editor/codemirror/index.d.ts +0 -4
- package/dist/editor/codemirror/index.d.ts.map +0 -1
- package/dist/editor/monaco/MonacoEditor.vue.d.ts +0 -47
- package/dist/editor/monaco/MonacoEditor.vue.d.ts.map +0 -1
- package/dist/editor/monaco/env.d.ts +0 -13
- package/dist/editor/monaco/env.d.ts.map +0 -1
- package/dist/editor/monaco/highlight.d.ts +0 -7
- package/dist/editor/monaco/highlight.d.ts.map +0 -1
- package/dist/editor/monaco/index.d.ts +0 -4
- package/dist/editor/monaco/index.d.ts.map +0 -1
- package/dist/editor/monaco/language-configs.d.ts +0 -6
- package/dist/editor/monaco/language-configs.d.ts.map +0 -1
- package/dist/editor/monaco/utils.d.ts +0 -3
- package/dist/editor/monaco/utils.d.ts.map +0 -1
- package/dist/editor/monaco/vue.worker.d.ts +0 -9
- package/dist/editor/monaco/vue.worker.d.ts.map +0 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +0 -1
- package/dist/output/PreviewProxy.d.ts +0 -46
- package/dist/output/PreviewProxy.d.ts.map +0 -1
- package/dist/output/index.d.ts +0 -5
- package/dist/output/index.d.ts.map +0 -1
- package/dist/output/moduleCompiler.d.ts +0 -16
- package/dist/output/moduleCompiler.d.ts.map +0 -1
- package/dist/store.d.ts +0 -65
- package/dist/store.d.ts.map +0 -1
- package/dist/template/examples/index.d.ts +0 -16
- package/dist/template/examples/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -54
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -55
- package/dist/utils.d.ts.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
import { ExtractPropTypes } from 'vue';
|
|
5
|
+
import { PublicProps } from 'vue';
|
|
6
|
+
import { Ref } from 'vue';
|
|
7
|
+
|
|
8
|
+
declare const _default: DefineComponent<ExtractPropTypes< {
|
|
9
|
+
value: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
filename: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
mode: {
|
|
18
|
+
type: StringConstructor;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
readonly: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
default: boolean;
|
|
24
|
+
};
|
|
25
|
+
}>, {
|
|
26
|
+
container: Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
27
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, "change"[], "change", PublicProps, Readonly<ExtractPropTypes< {
|
|
28
|
+
value: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
filename: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
mode: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
readonly: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
}>> & Readonly<{
|
|
45
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
46
|
+
}>, {
|
|
47
|
+
value: string;
|
|
48
|
+
filename: string;
|
|
49
|
+
mode: string;
|
|
50
|
+
readonly: boolean;
|
|
51
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
52
|
+
export { _default as CodeMirrorEditor }
|
|
53
|
+
export default _default;
|
|
54
|
+
|
|
55
|
+
export { }
|
package/dist/core.d.ts
CHANGED
|
@@ -1,14 +1,293 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { COMP_IDENTIFIER } from 'vue2-sfc-runner';
|
|
2
|
+
import { Component } from 'vue';
|
|
3
|
+
import { ToRefs } from 'vue';
|
|
4
|
+
import { UnwrapRef } from 'vue';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Add src/ prefix to filename if needed
|
|
8
|
+
*/
|
|
9
|
+
export declare function addSrcPrefix(filename: string): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Decompress and decode string from URL
|
|
13
|
+
* Automatically detects encoding type
|
|
14
|
+
*/
|
|
15
|
+
export declare function atou(encoded: string): string;
|
|
16
|
+
|
|
17
|
+
export { COMP_IDENTIFIER }
|
|
18
|
+
|
|
19
|
+
export declare interface CompiledModules {
|
|
20
|
+
modules: Record<string, string>;
|
|
21
|
+
mainModule: string;
|
|
22
|
+
css: string;
|
|
23
|
+
importMap: ImportMap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export declare type CompileError = Error[];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Compile a file (SFC, JS, TS, JSX, TSX, CSS, JSON)
|
|
30
|
+
*/
|
|
31
|
+
export declare function compileFile(filename: string, code: string): Promise<{
|
|
32
|
+
js: string;
|
|
33
|
+
css: string;
|
|
34
|
+
errors: (string | Error)[];
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Compile all files in store for preview
|
|
39
|
+
*/
|
|
40
|
+
export declare function compileModulesForPreview(store: ReplStore): CompiledModules;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Shared compiler types for Vue 2 SFC compilation
|
|
44
|
+
*/
|
|
45
|
+
export declare interface CompileOptions {
|
|
46
|
+
code: string;
|
|
47
|
+
filename: string;
|
|
48
|
+
id: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare type CompileResult = CompileError | CompileSuccess;
|
|
52
|
+
|
|
53
|
+
export declare interface CompileSuccess {
|
|
54
|
+
js: string;
|
|
55
|
+
css: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export declare interface ConsoleMessage {
|
|
59
|
+
level: 'log' | 'info' | 'warn' | 'error' | 'debug';
|
|
60
|
+
args: string[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare function createFile(filename: string, code?: string, hidden?: boolean): File_2;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Debounce function
|
|
67
|
+
*/
|
|
68
|
+
export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
69
|
+
|
|
70
|
+
export declare const defaultMainFile = "src/App.vue";
|
|
71
|
+
|
|
72
|
+
export declare type EditorComponentType = Component;
|
|
73
|
+
|
|
74
|
+
export declare interface EditorEmits {
|
|
75
|
+
(e: 'change', value: string): void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export declare interface EditorOptions {
|
|
79
|
+
showErrorText?: string | false;
|
|
80
|
+
autoSaveText?: string | false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare interface EditorProps {
|
|
84
|
+
value: string;
|
|
85
|
+
filename: string;
|
|
86
|
+
readonly?: boolean;
|
|
87
|
+
mode?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare interface File_2 {
|
|
91
|
+
filename: string;
|
|
92
|
+
code: string;
|
|
93
|
+
hidden: boolean;
|
|
94
|
+
compiled: {
|
|
95
|
+
js: string;
|
|
96
|
+
css: string;
|
|
97
|
+
};
|
|
98
|
+
readonly language: string;
|
|
99
|
+
}
|
|
100
|
+
export { File_2 as File }
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Generate import map script tag content
|
|
104
|
+
*/
|
|
105
|
+
export declare function generateImportMapScript(importMap: ImportMap): string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get file extension
|
|
109
|
+
*/
|
|
110
|
+
export declare function getExtension(filename: string): string;
|
|
111
|
+
|
|
112
|
+
export declare interface ImportMap {
|
|
113
|
+
imports?: Record<string, string>;
|
|
114
|
+
scopes?: Record<string, Record<string, string>>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export declare const importMapFile = "import-map.json";
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Check if filename is CSS
|
|
121
|
+
*/
|
|
122
|
+
export declare function isCSS(filename: string): boolean;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Check if filename is JavaScript/TypeScript
|
|
126
|
+
*/
|
|
127
|
+
export declare function isJS(filename: string): boolean;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Check if filename is JSON
|
|
131
|
+
*/
|
|
132
|
+
export declare function isJSON(filename: string): boolean;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Check if filename is JSX/TSX
|
|
136
|
+
*/
|
|
137
|
+
export declare function isJSX(filename: string): boolean;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Check if filename is TypeScript
|
|
141
|
+
*/
|
|
142
|
+
export declare function isTS(filename: string): boolean;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Check if filename is a Vue SFC
|
|
146
|
+
*/
|
|
147
|
+
export declare function isVueSFC(filename: string): boolean;
|
|
148
|
+
|
|
149
|
+
export declare type OutputModes = 'preview' | 'js' | 'css';
|
|
150
|
+
|
|
151
|
+
export declare interface PreviewError {
|
|
152
|
+
message: string;
|
|
153
|
+
source?: string;
|
|
154
|
+
line?: number;
|
|
155
|
+
column?: number;
|
|
156
|
+
stack?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Proxy for communicating with the preview iframe
|
|
161
|
+
*/
|
|
162
|
+
export declare interface PreviewMessage {
|
|
163
|
+
type: 'eval' | 'ready' | 'error' | 'console';
|
|
164
|
+
[key: string]: any;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export declare interface PreviewOptions {
|
|
168
|
+
headHTML?: string;
|
|
169
|
+
bodyHTML?: string;
|
|
170
|
+
placeholderHTML?: string;
|
|
171
|
+
customCode?: {
|
|
172
|
+
importCode?: string;
|
|
173
|
+
useCode?: string;
|
|
174
|
+
};
|
|
175
|
+
showRuntimeError?: boolean;
|
|
176
|
+
showRuntimeWarning?: boolean;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export declare class PreviewProxy {
|
|
180
|
+
private iframe;
|
|
181
|
+
private readyPromise;
|
|
182
|
+
private readyResolve;
|
|
183
|
+
private onError?;
|
|
184
|
+
private onConsole?;
|
|
185
|
+
private onReady?;
|
|
186
|
+
constructor(options?: {
|
|
187
|
+
onError?: (error: PreviewError) => void;
|
|
188
|
+
onConsole?: (message: ConsoleMessage) => void;
|
|
189
|
+
onReady?: () => void;
|
|
190
|
+
});
|
|
191
|
+
private handleMessage;
|
|
192
|
+
setIframe(iframe: HTMLIFrameElement): void;
|
|
193
|
+
private resetReady;
|
|
194
|
+
waitForReady(timeout?: number): Promise<boolean>;
|
|
195
|
+
/**
|
|
196
|
+
* Send compiled code to preview iframe
|
|
197
|
+
*/
|
|
198
|
+
eval(data: {
|
|
199
|
+
modules: Record<string, string>;
|
|
200
|
+
mainModule: string;
|
|
201
|
+
css: string;
|
|
202
|
+
importMapCode?: string;
|
|
203
|
+
}): void;
|
|
204
|
+
destroy(): void;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export declare interface ReplProps {
|
|
208
|
+
theme?: 'dark' | 'light';
|
|
209
|
+
previewTheme?: boolean;
|
|
210
|
+
autoResize?: boolean;
|
|
211
|
+
showCompileOutput?: boolean;
|
|
212
|
+
showImportMap?: boolean;
|
|
213
|
+
clearConsole?: boolean;
|
|
214
|
+
layout?: 'horizontal' | 'vertical';
|
|
215
|
+
layoutReverse?: boolean;
|
|
216
|
+
previewOptions?: PreviewOptions;
|
|
217
|
+
editorOptions?: EditorOptions;
|
|
218
|
+
splitPaneOptions?: SplitPaneOptions;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export declare interface ReplStore extends UnwrapRef<StoreState> {
|
|
222
|
+
activeFile: File_2;
|
|
223
|
+
init(): void;
|
|
224
|
+
setActive(filename: string): void;
|
|
225
|
+
addFile(filename: string | File_2): void;
|
|
226
|
+
deleteFile(filename: string): void;
|
|
227
|
+
renameFile(oldFilename: string, newFilename: string): void;
|
|
228
|
+
getImportMap(): ImportMap;
|
|
229
|
+
setImportMap(map: ImportMap, merge?: boolean): void;
|
|
230
|
+
serialize(): string;
|
|
231
|
+
deserialize(serializedState: string): void;
|
|
232
|
+
getFiles(): Record<string, string>;
|
|
233
|
+
setFiles(newFiles: Record<string, string>, mainFile?: string): Promise<void>;
|
|
234
|
+
compileFile(file: File_2): Promise<(string | Error)[]>;
|
|
235
|
+
markAsSaved(filename: string): void;
|
|
236
|
+
markAllAsSaved(): void;
|
|
237
|
+
isModified(filename: string): boolean;
|
|
238
|
+
getModifiedFiles(): File_2[];
|
|
239
|
+
clearSavedState(): void;
|
|
240
|
+
getTsConfig(): Record<string, any>;
|
|
241
|
+
reloadLanguageTools?: () => void;
|
|
242
|
+
dismissError(idx: number): void;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Generate a simple hash from string
|
|
247
|
+
*/
|
|
248
|
+
export declare function simpleHash(str: string): string;
|
|
249
|
+
|
|
250
|
+
export declare interface SplitPaneOptions {
|
|
251
|
+
codeTogglerText?: string;
|
|
252
|
+
outputTogglerText?: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export declare type Store = Pick<ReplStore, 'files' | 'activeFile' | 'mainFile' | 'errors' | 'showOutput' | 'outputMode' | 'init' | 'setActive' | 'addFile' | 'deleteFile' | 'renameFile' | 'getImportMap' | 'compileFile' | 'getTsConfig' | 'typescriptVersion' | 'reloadLanguageTools'>;
|
|
256
|
+
|
|
257
|
+
export declare type StoreState = ToRefs<{
|
|
258
|
+
files: Record<string, File_2>;
|
|
259
|
+
activeFilename: string;
|
|
260
|
+
mainFile: string;
|
|
261
|
+
template: {
|
|
262
|
+
welcomeSFC?: string;
|
|
263
|
+
newSFC?: string;
|
|
264
|
+
};
|
|
265
|
+
builtinImportMap: ImportMap;
|
|
266
|
+
errors: (string | Error)[];
|
|
267
|
+
showOutput: boolean;
|
|
268
|
+
outputMode: OutputModes;
|
|
269
|
+
loading: boolean;
|
|
270
|
+
trackFileChanges: boolean;
|
|
271
|
+
typescriptVersion: string;
|
|
272
|
+
locale?: string;
|
|
273
|
+
}>;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Strip src/ prefix from filename
|
|
277
|
+
*/
|
|
278
|
+
export declare function stripSrcPrefix(filename: string): string;
|
|
279
|
+
|
|
280
|
+
export declare function useReplStore({ files, activeFilename, mainFile, template, builtinImportMap, errors, showOutput, outputMode, loading, trackFileChanges, typescriptVersion, locale, }?: Partial<StoreState>, serializedState?: string): ReplStore;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Compress and encode string for URL
|
|
284
|
+
* Automatically chooses the shorter encoding (lz-string or base64)
|
|
285
|
+
*/
|
|
286
|
+
export declare function utoa(data: string): string;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Wait for Babel to be loaded
|
|
290
|
+
*/
|
|
291
|
+
export declare function waitForBabel(timeout?: number): Promise<void>;
|
|
292
|
+
|
|
293
|
+
export { }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
import { ExtractPropTypes } from 'vue';
|
|
5
|
+
import { PublicProps } from 'vue';
|
|
6
|
+
import { Ref } from 'vue';
|
|
7
|
+
|
|
8
|
+
declare const _default: DefineComponent<ExtractPropTypes< {
|
|
9
|
+
value: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
filename: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
mode: {
|
|
18
|
+
type: StringConstructor;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
readonly: {
|
|
22
|
+
type: BooleanConstructor;
|
|
23
|
+
default: boolean;
|
|
24
|
+
};
|
|
25
|
+
}>, {
|
|
26
|
+
container: Ref<HTMLDivElement | null, HTMLDivElement | null>;
|
|
27
|
+
emitChangeEvent: () => void;
|
|
28
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, "change"[], "change", PublicProps, Readonly<ExtractPropTypes< {
|
|
29
|
+
value: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
filename: {
|
|
34
|
+
type: StringConstructor;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
mode: {
|
|
38
|
+
type: StringConstructor;
|
|
39
|
+
default: string;
|
|
40
|
+
};
|
|
41
|
+
readonly: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{
|
|
46
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
value: string;
|
|
49
|
+
filename: string;
|
|
50
|
+
mode: string;
|
|
51
|
+
readonly: boolean;
|
|
52
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
53
|
+
export { _default as MonacoEditor }
|
|
54
|
+
export default _default;
|
|
55
|
+
|
|
56
|
+
export { }
|