@kusto/monaco-kusto 3.2.4 → 3.2.7
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/package.json +88 -88
- package/release/dev/kustoMode.js +1070 -1070
- package/release/dev/kustoWorker.js +1856 -1833
- package/release/dev/monaco.contribution.js +310 -306
- package/release/esm/commandFormatter.js +32 -32
- package/release/esm/commandHighlighter.js +44 -44
- package/release/esm/extendedEditor.js +38 -38
- package/release/esm/kusto.worker.js +8 -8
- package/release/esm/kustoMode.js +98 -98
- package/release/esm/kustoWorker.js +199 -199
- package/release/esm/languageFeatures.js +778 -778
- package/release/esm/languageService/kustoLanguageService.js +1585 -1562
- package/release/esm/languageService/kustoMonarchLanguageDefinition.js +76 -76
- package/release/esm/languageService/schema.js +64 -64
- package/release/esm/monaco.contribution.d.ts +12 -12
- package/release/esm/monaco.contribution.js +180 -176
- package/release/esm/monaco.d.ts +232 -224
- package/release/esm/workerManager.js +101 -101
- package/release/min/kustoMode.js +1 -1
- package/release/min/kustoWorker.js +2 -2
- package/release/min/monaco.contribution.d.ts +12 -12
- package/release/min/monaco.contribution.js +2 -2
- package/release/min/monaco.d.ts +232 -224
- package/scripts/bundle.js +65 -65
- package/scripts/release.js +25 -25
package/release/min/monaco.d.ts
CHANGED
|
@@ -1,224 +1,232 @@
|
|
|
1
|
-
// This file gets bundled as is with monaco-kusto.
|
|
2
|
-
// Everything that needs to be exposed to consumers should be typed here.
|
|
3
|
-
// This means that all declarations here are duplicated from the actual definitions around the code.
|
|
4
|
-
// TODO: think about turning this around - have all other code dependent on this file thus not needing the duplication.
|
|
5
|
-
// this was done like this because that's the standard way all other monaco extensions work for some reason.
|
|
6
|
-
|
|
7
|
-
declare module monaco.editor {
|
|
8
|
-
export interface ICodeEditor {
|
|
9
|
-
getCurrentCommandRange(cursorPosition: monaco.Position): monaco.Range;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare module monaco.languages.kusto {
|
|
14
|
-
export interface LanguageSettings {
|
|
15
|
-
includeControlCommands?: boolean;
|
|
16
|
-
newlineAfterPipe?: boolean;
|
|
17
|
-
openSuggestionDialogAfterPreviousSuggestionAccepted?: boolean;
|
|
18
|
-
useIntellisenseV2?: boolean;
|
|
19
|
-
useSemanticColorization?: boolean;
|
|
20
|
-
useTokenColorization?: boolean;
|
|
21
|
-
disabledCompletionItems?: string[];
|
|
22
|
-
onDidProvideCompletionItems?: monaco.languages.kusto.OnDidProvideCompletionItems;
|
|
23
|
-
enableHover?: boolean;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* statement.
|
|
94
|
-
*
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Get
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
(
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
export interface
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
export
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
| '
|
|
185
|
-
| '
|
|
186
|
-
| '
|
|
187
|
-
| '
|
|
188
|
-
| '
|
|
189
|
-
| '
|
|
190
|
-
| '
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
1
|
+
// This file gets bundled as is with monaco-kusto.
|
|
2
|
+
// Everything that needs to be exposed to consumers should be typed here.
|
|
3
|
+
// This means that all declarations here are duplicated from the actual definitions around the code.
|
|
4
|
+
// TODO: think about turning this around - have all other code dependent on this file thus not needing the duplication.
|
|
5
|
+
// this was done like this because that's the standard way all other monaco extensions work for some reason.
|
|
6
|
+
|
|
7
|
+
declare module monaco.editor {
|
|
8
|
+
export interface ICodeEditor {
|
|
9
|
+
getCurrentCommandRange(cursorPosition: monaco.Position): monaco.Range;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module monaco.languages.kusto {
|
|
14
|
+
export interface LanguageSettings {
|
|
15
|
+
includeControlCommands?: boolean;
|
|
16
|
+
newlineAfterPipe?: boolean;
|
|
17
|
+
openSuggestionDialogAfterPreviousSuggestionAccepted?: boolean;
|
|
18
|
+
useIntellisenseV2?: boolean;
|
|
19
|
+
useSemanticColorization?: boolean;
|
|
20
|
+
useTokenColorization?: boolean;
|
|
21
|
+
disabledCompletionItems?: string[];
|
|
22
|
+
onDidProvideCompletionItems?: monaco.languages.kusto.OnDidProvideCompletionItems;
|
|
23
|
+
enableHover?: boolean;
|
|
24
|
+
formatter?: FormatterOptions;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface FormatterOptions {
|
|
28
|
+
indentationSize?: number;
|
|
29
|
+
pipeOperatorStyle?: FormatterPlacementStyle;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type FormatterPlacementStyle = 'None' | 'NewLine' | 'Smart';
|
|
33
|
+
|
|
34
|
+
export interface LanguageServiceDefaults {
|
|
35
|
+
readonly onDidChange: IEvent<LanguageServiceDefaults>;
|
|
36
|
+
readonly languageSettings: LanguageSettings;
|
|
37
|
+
/**
|
|
38
|
+
* Configure language service settings.
|
|
39
|
+
*/
|
|
40
|
+
setLanguageSettings(options: LanguageSettings): void;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Configure when the worker shuts down. By default that is 2mins.
|
|
44
|
+
*
|
|
45
|
+
* @param value The maximum idle time in milliseconds. Values less than one
|
|
46
|
+
* mean never shut down.
|
|
47
|
+
*/
|
|
48
|
+
setMaximumWorkerIdleTime(value: number): void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export var kustoDefaults: LanguageServiceDefaults;
|
|
52
|
+
|
|
53
|
+
export interface KustoWorker {
|
|
54
|
+
/**
|
|
55
|
+
* Sets an array of ambient parameters to be known by the language service.
|
|
56
|
+
* Language service assumes that these parameters will be provided externaly when query gets executed and does
|
|
57
|
+
* not error-out when they are being referenced in the query.
|
|
58
|
+
* @param parameters the array of parameters
|
|
59
|
+
*/
|
|
60
|
+
setParameter(parameters: ScalarParameter[]);
|
|
61
|
+
setSchema(schema: Schema): Promise<void>;
|
|
62
|
+
setSchemaFromShowSchema(
|
|
63
|
+
schema: any,
|
|
64
|
+
clusterConnectionString: string,
|
|
65
|
+
databaseInContextName: string,
|
|
66
|
+
globalParameters: ScalarParameter[]
|
|
67
|
+
): Promise<void>;
|
|
68
|
+
normalizeSchema(
|
|
69
|
+
schema: any,
|
|
70
|
+
clusterConnectionString: string,
|
|
71
|
+
databaseInContextName: string
|
|
72
|
+
): Promise<EngineSchema>;
|
|
73
|
+
getCommandInContext(uri: string, cursorOffest: number): Promise<string | null>;
|
|
74
|
+
getCommandAndLocationInContext(
|
|
75
|
+
uri: string,
|
|
76
|
+
offset: number
|
|
77
|
+
): Promise<{ text: string; range: monaco.Range } | null>;
|
|
78
|
+
getCommandsInDocument(uri: string): Promise<{ absoluteStart: number; absoluteEnd: number; text: string }[]>;
|
|
79
|
+
getClientDirective(
|
|
80
|
+
text: string
|
|
81
|
+
): Promise<{ isClientDirective: boolean; directiveWithoutLeadingComments: string }>;
|
|
82
|
+
getAdminCommand(text: string): Promise<{ isAdminCommand: boolean; adminCommandWithoutLeadingComments: string }>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get all declared query parameters declared in current block if any.
|
|
86
|
+
*/
|
|
87
|
+
getQueryParams(uri: string, cursorOffest: number): Promise<{ name: string; type: string }[]>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get all the ambient parameters defind in global scope.
|
|
91
|
+
* Ambient parameters are parameters that are not defined in the syntax such as in a query paramter declaration.
|
|
92
|
+
* These are parameters that are injected from outside, usually by a UX application that would like to offer
|
|
93
|
+
* the user intellisense for a symbol, without forcing them to write a query declaration statement.
|
|
94
|
+
* Usually the same application injects the query declaration statement and the parameter values when
|
|
95
|
+
* executing the query (so it will execute correctly)
|
|
96
|
+
*/
|
|
97
|
+
getGlobalParams(uri: string): Promise<{ name: string; type: string }[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Get the global parameters that are actually being referenced in query.
|
|
100
|
+
* This is different from getQueryParams that will return the parameters declare using a query declaration
|
|
101
|
+
* statement.
|
|
102
|
+
* It is also different from getGlobalParams that will return all global parameters whether used or not.
|
|
103
|
+
*/
|
|
104
|
+
getReferencedGlobalParams(uri: string): Promise<{ name: string; type: string }[]>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get visualization options in render command if present (null otherwise).
|
|
108
|
+
*/
|
|
109
|
+
getRenderInfo(uri: string, cursorOffset: number): Promise<RenderInfo | null>;
|
|
110
|
+
doDocumentFormat(uri: string): Promise<ls.TextEdit[]>;
|
|
111
|
+
doRangeFormat(uri: string, range: ls.Range): Promise<ls.TextEdit[]>;
|
|
112
|
+
doCurrentCommandFormat(uri: string, caretPosition: ls.Position): Promise<ls.TextEdit[]>;
|
|
113
|
+
doValidation(uri: string, intervals: { start: number; end: number }[]): Promise<ls.Diagnostic[]>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A function that get a model Uri and returns a kusto worker that knows how to work
|
|
118
|
+
* with that document.
|
|
119
|
+
*/
|
|
120
|
+
export interface WorkerAccessor {
|
|
121
|
+
(first: Uri, ...more: Uri[]): Promise<KustoWorker>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface Column {
|
|
125
|
+
name: string;
|
|
126
|
+
type: string;
|
|
127
|
+
docstring?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface Table {
|
|
130
|
+
name: string;
|
|
131
|
+
columns: Column[];
|
|
132
|
+
docstring?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ScalarParameter {
|
|
135
|
+
name: string;
|
|
136
|
+
type?: string;
|
|
137
|
+
cslType?: string;
|
|
138
|
+
cslDefaultValue?: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// an input parameter either be a scalar in which case it has a name, type and cslType, or it can be columnar, in which case
|
|
142
|
+
// it will have a name, and a list of scalar types which are the column types.
|
|
143
|
+
export type InputParameter = ScalarParameter & { columns?: ScalarParameter[] };
|
|
144
|
+
|
|
145
|
+
export interface Function {
|
|
146
|
+
name: string;
|
|
147
|
+
body: string;
|
|
148
|
+
docstring?: string;
|
|
149
|
+
inputParameters: InputParameter[];
|
|
150
|
+
}
|
|
151
|
+
export interface Database {
|
|
152
|
+
name: string;
|
|
153
|
+
tables: Table[];
|
|
154
|
+
functions: Function[];
|
|
155
|
+
majorVersion: number;
|
|
156
|
+
minorVersion: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface EngineSchema {
|
|
160
|
+
clusterType: 'Engine';
|
|
161
|
+
cluster: {
|
|
162
|
+
connectionString: string;
|
|
163
|
+
databases: Database[];
|
|
164
|
+
};
|
|
165
|
+
database: Database | undefined; // a reference to the database that's in current context.
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface ClusterMangerSchema {
|
|
169
|
+
clusterType: 'ClusterManager';
|
|
170
|
+
accounts: string[];
|
|
171
|
+
services: string[];
|
|
172
|
+
connectionString: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface DataManagementSchema {
|
|
176
|
+
clusterType: 'DataManagement';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export type Schema = EngineSchema | ClusterMangerSchema | DataManagementSchema;
|
|
180
|
+
|
|
181
|
+
export var getKustoWorker: () => Promise<WorkerAccessor>;
|
|
182
|
+
|
|
183
|
+
export declare type VisualizationType =
|
|
184
|
+
| 'anomalychart'
|
|
185
|
+
| 'areachart'
|
|
186
|
+
| 'barchart'
|
|
187
|
+
| 'columnchart'
|
|
188
|
+
| 'ladderchart'
|
|
189
|
+
| 'linechart'
|
|
190
|
+
| 'piechart'
|
|
191
|
+
| 'pivotchart'
|
|
192
|
+
| 'scatterchart'
|
|
193
|
+
| 'stackedareachart'
|
|
194
|
+
| 'timechart'
|
|
195
|
+
| 'table'
|
|
196
|
+
| 'timeline'
|
|
197
|
+
| 'timepivot'
|
|
198
|
+
| 'card';
|
|
199
|
+
|
|
200
|
+
export declare type Scale = 'linear' | 'log';
|
|
201
|
+
export declare type LegendVisibility = 'visible' | 'hidden';
|
|
202
|
+
export declare type YSplit = 'none' | 'axes' | 'panels';
|
|
203
|
+
export declare type Kind = 'default' | 'unstacked' | 'stacked' | 'stacked100' | 'map';
|
|
204
|
+
|
|
205
|
+
export interface RenderOptions {
|
|
206
|
+
visualization?: VisualizationType;
|
|
207
|
+
title?: string;
|
|
208
|
+
xcolumn?: string;
|
|
209
|
+
series?: string[];
|
|
210
|
+
ycolumns?: string[];
|
|
211
|
+
xtitle?: string;
|
|
212
|
+
ytitle?: string;
|
|
213
|
+
xaxis?: Scale;
|
|
214
|
+
yaxis?: Scale;
|
|
215
|
+
legend?: LegendVisibility;
|
|
216
|
+
ySplit?: YSplit;
|
|
217
|
+
accumulate?: boolean;
|
|
218
|
+
kind?: Kind;
|
|
219
|
+
anomalycolumns?: string[];
|
|
220
|
+
ymin?: number;
|
|
221
|
+
ymax?: number;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface RenderInfo {
|
|
225
|
+
options: RenderOptions;
|
|
226
|
+
location: { startOffset: number; endOffset: number };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export type RenderOptionKeys = keyof RenderOptions;
|
|
230
|
+
|
|
231
|
+
export type OnDidProvideCompletionItems = (list: ls.CompletionList) => Promise<ls.CompletionList>;
|
|
232
|
+
}
|
package/scripts/bundle.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
const requirejs = require('requirejs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const Terser = require("terser");
|
|
5
|
-
const helpers = require('monaco-plugin-helpers');
|
|
6
|
-
|
|
7
|
-
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
8
|
-
|
|
9
|
-
const sha1 = helpers.getGitVersion(REPO_ROOT);
|
|
10
|
-
const semver = require('../package.json').version;
|
|
11
|
-
const headerVersion = semver + '(' + sha1 + ')';
|
|
12
|
-
|
|
13
|
-
const BUNDLED_FILE_HEADER = [
|
|
14
|
-
'/*!-----------------------------------------------------------------------------',
|
|
15
|
-
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
|
16
|
-
' * monaco-kusto version: ' + headerVersion,
|
|
17
|
-
' * Released under the MIT license',
|
|
18
|
-
' * https://https://github.com/Azure/monaco-kusto/blob/master/README.md',
|
|
19
|
-
' *-----------------------------------------------------------------------------*/',
|
|
20
|
-
''
|
|
21
|
-
].join('\n');
|
|
22
|
-
|
|
23
|
-
bundleOne('monaco.contribution', ['vs/language/kusto/kustoMode']),
|
|
24
|
-
bundleOne('kustoMode'),
|
|
25
|
-
bundleOne('kustoWorker')
|
|
26
|
-
|
|
27
|
-
function bundleOne(moduleId, exclude) {
|
|
28
|
-
requirejs.optimize({
|
|
29
|
-
baseUrl: './',
|
|
30
|
-
name: 'vs/language/kusto/' + moduleId,
|
|
31
|
-
out: 'release/dev/' + moduleId + '.js',
|
|
32
|
-
exclude: exclude,
|
|
33
|
-
paths: {
|
|
34
|
-
'vs/language/kusto': REPO_ROOT + '/out/amd'
|
|
35
|
-
},
|
|
36
|
-
optimize: 'none',
|
|
37
|
-
packages: [{
|
|
38
|
-
name: 'vscode-languageserver-types',
|
|
39
|
-
location: path.join(REPO_ROOT, '/node_modules/vscode-languageserver-types/lib/umd'),
|
|
40
|
-
main: 'main'
|
|
41
|
-
}, {
|
|
42
|
-
name: 'xregexp',
|
|
43
|
-
location: path.join(REPO_ROOT, '/node_modules/xregexp'),
|
|
44
|
-
main: 'xregexp-all.js'
|
|
45
|
-
}, {
|
|
46
|
-
name: 'lodash',
|
|
47
|
-
location: path.join(REPO_ROOT, '/node_modules/lodash'),
|
|
48
|
-
main: 'lodash.min.js'
|
|
49
|
-
}],
|
|
50
|
-
}, function (buildResponse) {
|
|
51
|
-
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
|
|
52
|
-
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
|
|
53
|
-
const fileContents = fs.readFileSync(devFilePath).toString();
|
|
54
|
-
console.log();
|
|
55
|
-
console.log(`Minifying ${devFilePath}...`);
|
|
56
|
-
const result = Terser.minify(fileContents, {
|
|
57
|
-
output: {
|
|
58
|
-
comments: 'some'
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
console.log(`Done.`);
|
|
62
|
-
try { fs.mkdirSync(path.join(REPO_ROOT, 'release/min')) } catch (err) { }
|
|
63
|
-
fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
|
|
64
|
-
})
|
|
65
|
-
}
|
|
1
|
+
const requirejs = require('requirejs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const Terser = require("terser");
|
|
5
|
+
const helpers = require('monaco-plugin-helpers');
|
|
6
|
+
|
|
7
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
8
|
+
|
|
9
|
+
const sha1 = helpers.getGitVersion(REPO_ROOT);
|
|
10
|
+
const semver = require('../package.json').version;
|
|
11
|
+
const headerVersion = semver + '(' + sha1 + ')';
|
|
12
|
+
|
|
13
|
+
const BUNDLED_FILE_HEADER = [
|
|
14
|
+
'/*!-----------------------------------------------------------------------------',
|
|
15
|
+
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
|
16
|
+
' * monaco-kusto version: ' + headerVersion,
|
|
17
|
+
' * Released under the MIT license',
|
|
18
|
+
' * https://https://github.com/Azure/monaco-kusto/blob/master/README.md',
|
|
19
|
+
' *-----------------------------------------------------------------------------*/',
|
|
20
|
+
''
|
|
21
|
+
].join('\n');
|
|
22
|
+
|
|
23
|
+
bundleOne('monaco.contribution', ['vs/language/kusto/kustoMode']),
|
|
24
|
+
bundleOne('kustoMode'),
|
|
25
|
+
bundleOne('kustoWorker')
|
|
26
|
+
|
|
27
|
+
function bundleOne(moduleId, exclude) {
|
|
28
|
+
requirejs.optimize({
|
|
29
|
+
baseUrl: './',
|
|
30
|
+
name: 'vs/language/kusto/' + moduleId,
|
|
31
|
+
out: 'release/dev/' + moduleId + '.js',
|
|
32
|
+
exclude: exclude,
|
|
33
|
+
paths: {
|
|
34
|
+
'vs/language/kusto': REPO_ROOT + '/out/amd'
|
|
35
|
+
},
|
|
36
|
+
optimize: 'none',
|
|
37
|
+
packages: [{
|
|
38
|
+
name: 'vscode-languageserver-types',
|
|
39
|
+
location: path.join(REPO_ROOT, '/node_modules/vscode-languageserver-types/lib/umd'),
|
|
40
|
+
main: 'main'
|
|
41
|
+
}, {
|
|
42
|
+
name: 'xregexp',
|
|
43
|
+
location: path.join(REPO_ROOT, '/node_modules/xregexp'),
|
|
44
|
+
main: 'xregexp-all.js'
|
|
45
|
+
}, {
|
|
46
|
+
name: 'lodash',
|
|
47
|
+
location: path.join(REPO_ROOT, '/node_modules/lodash'),
|
|
48
|
+
main: 'lodash.min.js'
|
|
49
|
+
}],
|
|
50
|
+
}, function (buildResponse) {
|
|
51
|
+
const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js');
|
|
52
|
+
const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js');
|
|
53
|
+
const fileContents = fs.readFileSync(devFilePath).toString();
|
|
54
|
+
console.log();
|
|
55
|
+
console.log(`Minifying ${devFilePath}...`);
|
|
56
|
+
const result = Terser.minify(fileContents, {
|
|
57
|
+
output: {
|
|
58
|
+
comments: 'some'
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
console.log(`Done.`);
|
|
62
|
+
try { fs.mkdirSync(path.join(REPO_ROOT, 'release/min')) } catch (err) { }
|
|
63
|
+
fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code);
|
|
64
|
+
})
|
|
65
|
+
}
|
package/scripts/release.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const helpers = require('monaco-plugin-helpers');
|
|
3
|
-
|
|
4
|
-
const REPO_ROOT = path.join(__dirname, '../');
|
|
5
|
-
|
|
6
|
-
helpers.packageESM({
|
|
7
|
-
repoRoot: REPO_ROOT,
|
|
8
|
-
esmSource: 'out/esm',
|
|
9
|
-
esmDestination: 'release/esm',
|
|
10
|
-
entryPoints: [
|
|
11
|
-
'monaco.contribution.js',
|
|
12
|
-
'kustoMode.js',
|
|
13
|
-
'kusto.worker.js',
|
|
14
|
-
],
|
|
15
|
-
resolveAlias: {
|
|
16
|
-
},
|
|
17
|
-
resolveSkip: [
|
|
18
|
-
'monaco-editor-core'
|
|
19
|
-
],
|
|
20
|
-
destinationFolderSimplification: {
|
|
21
|
-
'node_modules': '_deps',
|
|
22
|
-
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
|
|
23
|
-
'/node_modules/xregexp': 'xregexp',
|
|
24
|
-
'/node_modules/lodash': 'lodash'
|
|
25
|
-
}
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const helpers = require('monaco-plugin-helpers');
|
|
3
|
+
|
|
4
|
+
const REPO_ROOT = path.join(__dirname, '../');
|
|
5
|
+
|
|
6
|
+
helpers.packageESM({
|
|
7
|
+
repoRoot: REPO_ROOT,
|
|
8
|
+
esmSource: 'out/esm',
|
|
9
|
+
esmDestination: 'release/esm',
|
|
10
|
+
entryPoints: [
|
|
11
|
+
'monaco.contribution.js',
|
|
12
|
+
'kustoMode.js',
|
|
13
|
+
'kusto.worker.js',
|
|
14
|
+
],
|
|
15
|
+
resolveAlias: {
|
|
16
|
+
},
|
|
17
|
+
resolveSkip: [
|
|
18
|
+
'monaco-editor-core'
|
|
19
|
+
],
|
|
20
|
+
destinationFolderSimplification: {
|
|
21
|
+
'node_modules': '_deps',
|
|
22
|
+
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
|
|
23
|
+
'/node_modules/xregexp': 'xregexp',
|
|
24
|
+
'/node_modules/lodash': 'lodash'
|
|
25
|
+
}
|
|
26
26
|
});
|