@microtronics/studio-cli 0.60.0 → 0.62.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.
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DloFileSequencer = void 0;
4
- const vscode_uri_1 = require("vscode-uri");
5
- const helper_1 = require("../helper");
6
- class DloFileSequencer {
7
- dloFileMap = {};
8
- rootUri = vscode_uri_1.URI.parse('');
9
- constructor() { }
10
- set workspacePath(workspacePath) {
11
- this.rootUri = workspacePath;
12
- }
13
- getSequenceForFile(filePath) {
14
- let relativePath = filePath.substring(this.rootUri.path.length || 0);
15
- if (this.rootUri.scheme !== 'file') {
16
- const workspaceRoot = this.rootUri.toString();
17
- relativePath = filePath.substring(workspaceRoot.length + 1);
18
- }
19
- if (Object.hasOwn(this.dloFileMap, relativePath)) {
20
- return this.dloFileMap[relativePath];
21
- }
22
- const filePathCrc = helper_1.Helper.generateHashForFilePath(relativePath);
23
- this.dloFileMap[relativePath] = filePathCrc;
24
- return filePathCrc;
25
- }
26
- getFilePathForSequence(sequenceId) {
27
- const sequenceMap = Object.entries(this.dloFileMap).find(([, /*filePath*/ fileId]) => {
28
- return fileId === sequenceId;
29
- });
30
- if (sequenceMap) {
31
- const extendedPath = vscode_uri_1.URI.parse(`${this.rootUri.path}${sequenceMap[0]}`);
32
- return extendedPath.path;
33
- }
34
- else {
35
- return null;
36
- }
37
- }
38
- }
39
- exports.DloFileSequencer = DloFileSequencer;
40
- //# sourceMappingURL=fileSequencer.js.map
@@ -1,442 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DloPreCompiler = void 0;
4
- const vscode_uri_1 = require("vscode-uri");
5
- const fileSequencer_1 = require("./fileSequencer");
6
- const manifest_1 = require("../manifest");
7
- const defaultFiles_1 = require("../defaultFiles");
8
- const helper_1 = require("../helper");
9
- // #options "..." - line starts with "#options "
10
- const rxpOptions = /^(?:\s*#options\s+)(.*)(?:\s*)$/;
11
- // #preinclude "..." - line starts with "#preinclude "
12
- const rxpPreinclude = /^(?:\s*#preinclude\s+)(.*)(?:\s*)$/;
13
- // #ifdef ... - line starts with "#ifdef "
14
- const rxpIfdef = /^(?:\s*#ifdef\s+)(.*)$/;
15
- // #ifndef ... - line starts with "#ifndef "
16
- const rxpIfndef = /^(?:\s*#ifndef\s+)(.*)$/;
17
- // #elseifdef ... - line starts with "#elseifdef "
18
- const rxpElseifdef = /^(?:\s*#elseifdef\s+)(.*)$/;
19
- // #elseifndef ... - line starts with "#elseifndef "
20
- const rxpElseifndef = /^(?:\s*#elseifndef\s+)(.*)$/;
21
- // #callback( params...) {... - line starts with "#callback(" and ends with ")" or "){"
22
- const rxpCallback = /^(\s*)(?:#callback\s+)(\w*)(?:\s*\(\s*)(.*?)(?:\s*\)\s*)(\{*){1}(?:\s*)$/;
23
- // assert( cond, params...); - line contains "assert ( cond," and ends with ")" or ");"
24
- const rxpAssert = /^(.*)(^|\s+)(?:assert\s*\(\s*)(.*?)(?:\s*,\s*)(.*?)(?:\s*\)\s*;*\s*)$/;
25
- // assert( cond); - line contains "assert ( cond" and ends with ")" or ");"
26
- const rxpAssert0 = /^(.*)(^|\s+)(?:assert\s*\(\s*)(.*?)(?:\s*\)\s*;*\s*)$/;
27
- // assert(); - line ends with "assert ( )" or "assert ( );"
28
- const rxpAssertF = /^(.*)(^|\s+)(?:assert\s*\(\s*\);*\s*)$/;
29
- // catch( params...); - line contains "catch (" and ends with ")" or ");"
30
- const rxpCatch = /^(.*)(^|\s+)(?:catch\s*\(\s*)(.*?)(?:\s*\)\s*;*\s*)$/;
31
- // line starts with "#include <"
32
- const rxpIncludesClib = /^\s*#include\s*</;
33
- // line starts with "#endinput "
34
- const rxpEndinputClib = /^\s*#endinput\s*/;
35
- // #pragma dynamic - line contains "#pragma dynamic
36
- const rxpPragmaDynamic = /^\s*#pragma\s+dynamic\s+(\S+)\s*(\/\/.*|\/\*.*|)$/;
37
- /*applog( prio_code, format, params...); - line contains "applog ( prio_code," and ends with ")" or ");"
38
- applog_<level>( prio_code, format, params...); - line contains "applog_<level> ( prio_code," and ends with ")" or ");"*/
39
- const rxpApplog = /^(.*)(^|\s+)(?:applog(|_ok|_warning|_alarm|_debug|_fatal)\s*\(\s*)(.*?)(?:\s*,\s*)(.*?)(?:\s*\)\s*;*\s*)$/;
40
- // applog( prio_code); - line contains "applog ( prio_code" and ends with ")" or ");"
41
- // applog_<level>( prio_code); - line contains "aspplog_<level> ( prio_code" and ends with ")" or ");"
42
- const rxpApplog0 = /^(.*)(^|\s*)(?:applog(|_ok|_warning|_alarm|_debug|_fatal)\s*\(\s*)(.*?)(?:\s*\)\s*;*\s*)$/;
43
- //function to parse the log prio (if any) from the prio_code string or match the given level to the correct prio
44
- function parseApplogPriority(priorityCode, level = '') {
45
- let priority = ' '; //default prio is space!
46
- let code = priorityCode;
47
- if (level.length) {
48
- priority =
49
- {
50
- fatal: '§',
51
- alarm: '!',
52
- warning: '?',
53
- debug: '~',
54
- ok: '$'
55
- }[level] || null;
56
- }
57
- else {
58
- if (['!', '?', '~', '$', '§'].includes(priorityCode.substring(1, 1))) {
59
- priority = priorityCode.substring(1, 1);
60
- code = `"${priorityCode.substring(2, priorityCode.length - 1)}"`;
61
- }
62
- }
63
- return { priority: `'${priority}'`, code };
64
- }
65
- const rxpLogBackend = /^(.*)(^|\s+)(?:log(|_debug|_info|_warn|_error)\s*\(\s*)(.*?)(?:\s*\)\s*;*\s*)$/;
66
- var LogLevel;
67
- (function (LogLevel) {
68
- LogLevel[LogLevel["debug"] = 0] = "debug";
69
- LogLevel[LogLevel["info"] = 1] = "info";
70
- LogLevel[LogLevel["warn"] = 2] = "warn";
71
- LogLevel[LogLevel["error"] = 3] = "error";
72
- })(LogLevel || (LogLevel = {}));
73
- // const rxpDDE =/^(.*)(^|\s+)DDE_(up|down)_(state|control)_(persist|update)\(\)/;
74
- const rxpDDE = /^(.*)(^|\s*)DDE_(state|result|aloha|volatile|setting|command)_/;
75
- const rxpUplinkRestore = /^(.*)(^|\s*)onUplink(Restore|Apply)_(state|result|aloha|volatile|setting|command)/;
76
- const rxpUplinkEvent = /^(.*)(^|\s*)onUplinkEvent/;
77
- // Regex to detect start of function-like statements that may span multiple lines
78
- const rxpMultilineFuncStart = /(?:^|\s)(?:assert|catch|applog(?:_ok|_warning|_alarm|_debug|_fatal)?|log(?:_debug|_info|_warn|_error)?)\s*\(/;
79
- const rxpMultilineCallbackStart = /^\s*#callback\s+\w+\s*\(/;
80
- /**
81
- * Count unbalanced parentheses depth in text, respecting string literals.
82
- * Returns a positive number if there are more opening than closing parens.
83
- */
84
- function getParenthesisDepth(text) {
85
- let depth = 0;
86
- let inString = false;
87
- let stringChar = '';
88
- for (let i = 0; i < text.length; i++) {
89
- const ch = text[i];
90
- if (inString) {
91
- if (ch === '\\') {
92
- i++;
93
- continue;
94
- }
95
- if (ch === stringChar) {
96
- inString = false;
97
- }
98
- continue;
99
- }
100
- if (ch === '"' || ch === "'") {
101
- inString = true;
102
- stringChar = ch;
103
- continue;
104
- }
105
- if (ch === '(') {
106
- depth++;
107
- }
108
- else if (ch === ')') {
109
- depth--;
110
- }
111
- }
112
- return depth;
113
- }
114
- /**
115
- * Check if a line matches any of the multiline-capable replacement patterns.
116
- */
117
- function matchesAnyMultilineCapablePattern(line) {
118
- return (rxpCallback.test(line) ||
119
- rxpAssertF.test(line) ||
120
- rxpAssert.test(line) ||
121
- rxpAssert0.test(line) ||
122
- rxpCatch.test(line) ||
123
- rxpApplog.test(line) ||
124
- rxpApplog0.test(line) ||
125
- rxpLogBackend.test(line));
126
- }
127
- /**
128
- * Try to accumulate a multiline statement starting at the given line index.
129
- * Returns null if the line is not a multiline statement start, or if the
130
- * accumulated joined line doesn't match any replacement pattern.
131
- */
132
- function tryAccumulateMultilineStatement(fileBlob, startIndex, startStripped) {
133
- // Check if this line could start a multiline statement
134
- const isCandidate = rxpMultilineFuncStart.test(startStripped) || rxpMultilineCallbackStart.test(startStripped);
135
- if (!isCandidate) {
136
- return null;
137
- }
138
- // Check if parentheses are unbalanced (indicating continuation on next lines)
139
- const depth = getParenthesisDepth(startStripped);
140
- if (depth <= 0) {
141
- return null;
142
- }
143
- // Accumulate lines until parentheses are balanced
144
- let totalDepth = depth;
145
- const originalLines = [fileBlob[startIndex]];
146
- const strippedLines = [startStripped];
147
- let nextIndex = startIndex + 1;
148
- const maxAccumulation = 100; // Safety limit
149
- while (totalDepth > 0 && nextIndex < fileBlob.length && nextIndex - startIndex < maxAccumulation) {
150
- const nextOriginal = fileBlob[nextIndex];
151
- const nextStripped = nextOriginal.split('//', 1)[0];
152
- originalLines.push(nextOriginal);
153
- strippedLines.push(nextStripped);
154
- totalDepth += getParenthesisDepth(nextStripped);
155
- nextIndex++;
156
- }
157
- // If we couldn't balance the parens or only have one line, abort
158
- if (originalLines.length <= 1 || totalDepth > 0) {
159
- return null;
160
- }
161
- const joinedOriginal = originalLines.map((l, i) => (i === 0 ? l : l.trim())).join(' ');
162
- const joinedStripped = strippedLines.map((l, i) => (i === 0 ? l : l.trim())).join(' ');
163
- // Only use multiline if the joined line actually matches a replacement pattern
164
- if (!matchesAnyMultilineCapablePattern(joinedStripped)) {
165
- return null;
166
- }
167
- return {
168
- joinedOriginal,
169
- joinedStripped,
170
- extraLineCount: originalLines.length - 1
171
- };
172
- }
173
- class DloPreCompiler {
174
- pragmaDynamic = null;
175
- dloFileSequencer = new fileSequencer_1.DloFileSequencer();
176
- constructor() { }
177
- get pragmaDynamicFlag() {
178
- if (!this.pragmaDynamic) {
179
- return null;
180
- }
181
- else {
182
- return `-S${this.pragmaDynamic}`;
183
- }
184
- }
185
- // eslint-disable-next-line sonarjs/cognitive-complexity
186
- preCompileDloFile(cwd, logger, manifest, fileUri, fileBlob) {
187
- this.dloFileSequencer.workspacePath = cwd;
188
- const fileDiagnostics = [];
189
- const filePath = fileUri.path;
190
- let mangleDDEFunctions = false;
191
- const baseName = vscode_uri_1.Utils.basename(fileUri);
192
- // look for autogenerated xxx-dde.inc files
193
- if (filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.auto.dlo.path)) {
194
- const ddeIncSource = baseName.substring(0, baseName.length - 8);
195
- if (!['app', 'main'].includes(ddeIncSource) && baseName.endsWith('-dde.inc')) {
196
- // this is a library specific file!
197
- mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(ddeIncSource);
198
- // console.log('MANGLED LIB DDE', baseName, ddeIncSource, mangleDDEFunctions);
199
- }
200
- }
201
- else if (filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.libdeps)) {
202
- const libPath = filePath.split('libdeps/')[1];
203
- const [libName] = libPath.split('/');
204
- if (!['dlo-core'].includes(libName)) {
205
- mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(libName);
206
- // console.log('MANGLED LIB', baseName, mangleDDEFunctions);
207
- }
208
- }
209
- else if (manifest_1.Manifest.isLibrary(manifest)) {
210
- // mangle dde functions within the project files if the current project is a library project
211
- // exclude main.dlo and /example and /test folder
212
- if (baseName.endsWith('.dlo') || filePath.includes('/dlo/examples/') || filePath.includes('/dlo/test/')) {
213
- logger.log('Skipping dde mangling for project file', baseName);
214
- }
215
- else {
216
- mangleDDEFunctions = helper_1.Helper.generateHashForLibraryName(manifest.name);
217
- // console.log('MANGLED PROJECT LIB', baseName, mangleDDEFunctions);
218
- }
219
- }
220
- if (filePath.endsWith('.auto/default.inc')) {
221
- return {
222
- data: fileBlob.join(`\n`),
223
- diagnostics: fileDiagnostics
224
- };
225
- }
226
- const precompiledData = [];
227
- const fileSequence = this.dloFileSequencer.getSequenceForFile(filePath);
228
- precompiledData.push(`stock static __file{} = "${fileSequence}";`);
229
- precompiledData.push(`stock static __refid{} = "${fileSequence}";`);
230
- const appLogSrcId = `A\\0\\0\\0\\0\\0\\0\\0`;
231
- precompiledData.push(`stock static __applog_src_id{} = "${appLogSrcId}";`);
232
- precompiledData.push('#line 0'); // manually reset pawns line counter to ignore header lines injected above
233
- let outLineNumber = 0;
234
- // !!!
235
- // !!! output is always single-line to keep line numbers equal to original source!
236
- // !!! multiline statements are joined into a single line, with empty lines emitted
237
- // !!! for consumed continuation lines to preserve line number alignment.
238
- // !!!
239
- for (let lineNumber = 0; lineNumber < fileBlob.length; lineNumber++) {
240
- let newLine = fileBlob[lineNumber];
241
- let currentLine = newLine.split('//', 1)[0]; // todo dirty solution! strip-off "end of line" comments
242
- let h = null;
243
- let consumedExtraLines = 0;
244
- // Detect multiline statements: if the current single line doesn't match any
245
- // multiline-capable pattern, try accumulating continuation lines.
246
- if (!matchesAnyMultilineCapablePattern(currentLine)) {
247
- const multiline = tryAccumulateMultilineStatement(fileBlob, lineNumber, currentLine);
248
- if (multiline) {
249
- newLine = multiline.joinedOriginal;
250
- currentLine = multiline.joinedStripped;
251
- consumedExtraLines = multiline.extraLineCount;
252
- }
253
- }
254
- // #options
255
- if ((h = rxpOptions.exec(currentLine))) {
256
- newLine = '// ' + newLine;
257
- fileDiagnostics.push({
258
- file: fileUri,
259
- level: 'error',
260
- line: lineNumber,
261
- message: `#options is not supported here. Use the DLO settings instead.`
262
- });
263
- }
264
- // #preinclude
265
- else if ((h = rxpPreinclude.exec(currentLine))) {
266
- newLine = '// ' + newLine;
267
- fileDiagnostics.push({
268
- file: fileUri,
269
- level: 'error',
270
- line: lineNumber,
271
- message: `#preinclude is not supported here. Use the DLO settings instead.`
272
- });
273
- }
274
- // #pragma dynamic
275
- else if ((h = rxpPragmaDynamic.exec(currentLine))) {
276
- const pragmaDynamic = Number(h[1].startsWith('(') ? h[1].substring(1, h[1].length - 1) : h[1]);
277
- if (!Number.isInteger(pragmaDynamic) || pragmaDynamic < 64) {
278
- fileDiagnostics.push({
279
- file: fileUri,
280
- level: 'error',
281
- line: lineNumber,
282
- message: `#pragma dynamic only supports integer values and must be greater than 63`
283
- });
284
- }
285
- else if (!this.pragmaDynamic || pragmaDynamic > this.pragmaDynamic) {
286
- this.pragmaDynamic = pragmaDynamic;
287
- }
288
- }
289
- // #ifdef
290
- else if ((h = rxpIfdef.exec(currentLine))) {
291
- newLine = newLine.replace('#ifdef ', '#if defined ');
292
- }
293
- // #ifndef
294
- else if ((h = rxpIfndef.exec(currentLine))) {
295
- newLine = newLine.replace('#ifndef ', '#if !defined ');
296
- }
297
- // #elseifdef
298
- else if ((h = rxpElseifdef.exec(currentLine))) {
299
- newLine = newLine.replace('#elseifdef ', '#elseif defined ');
300
- }
301
- // #elseifndef
302
- else if ((h = rxpElseifndef.exec(currentLine))) {
303
- newLine = newLine.replace('#elseifndef ', '#elseif !defined ');
304
- }
305
- // #callback
306
- else if ((h = rxpCallback.exec(currentLine))) {
307
- const [, indent, name, params, curly] = h;
308
- newLine =
309
- `${indent}` +
310
- `#define ${name} _catch_funcidx( "___${name}")\n` +
311
- `forward ___${name}( ${params});\n` +
312
- `#line\n${outLineNumber}\n` + // re-adjust line numbering to hide inserted #define line
313
- // ^-- workaround for pawncc bug: extra \n to avoid error 58 when #line is inside #if
314
- `public ___${name}( ${params})${curly}`;
315
- }
316
- // assert()
317
- else if ((h = rxpAssertF.exec(currentLine))) {
318
- const [, prefix, spaces] = h;
319
- newLine = `${prefix}${spaces}{_log_string="";_assert(__refid,__line);}`;
320
- }
321
- // assert(cond,param) - incl. workaround printf%%
322
- else if ((h = rxpAssert.exec(currentLine))) {
323
- const [, prefix, spaces, cond, params] = h;
324
- newLine =
325
- `${prefix}${spaces}{ ` +
326
- `if (!(${cond})) { ` +
327
- `sprintf(_log_string,_,${params.replace(/%%/g, '\xff')});` +
328
- `_assert(__refid,__line);` +
329
- ` }}`;
330
- }
331
- // assert(cond)
332
- else if ((h = rxpAssert0.exec(currentLine))) {
333
- const [, prefix, spaces, cond] = h;
334
- newLine =
335
- `${prefix}${spaces}{ ` + `if (!(${cond})) { ` + `_log_string="";` + `_assert(__refid,__line);` + ` }}`;
336
- }
337
- // catch(cond[,xe[,xs]])
338
- else if ((h = rxpCatch.exec(currentLine))) {
339
- const [, prefix, spaces, params] = h;
340
- newLine = `${prefix}${spaces}_catch(__refid,__line,${params});`;
341
- }
342
- // applog(prio_code, params)
343
- else if ((h = rxpApplog.exec(currentLine))) {
344
- const [, prefix, spaces, level, priorityCode, formatParams] = h;
345
- const { priority, code } = parseApplogPriority(priorityCode, level.substring(1));
346
- if (priority !== null) {
347
- newLine =
348
- `${prefix}${spaces}{` +
349
- `new params_str{DDE_APPLOG_SIZE_PARAMS};` +
350
- `sprintf(params_str,_,${formatParams});` +
351
- `DDE_applog_write(${priority}, ${code}, params_str, __applog_src_id);` +
352
- `}`;
353
- }
354
- }
355
- // applog(prio_code)
356
- else if ((h = rxpApplog0.exec(currentLine))) {
357
- const [, prefix, spaces, level, priorityCode] = h;
358
- const { priority, code } = parseApplogPriority(priorityCode, level.substring(1));
359
- if (priority !== null) {
360
- newLine = `${prefix}${spaces}DDE_applog_write(${priority}, ${code}, "", __applog_src_id);`;
361
- }
362
- }
363
- // log_xxx
364
- else if ((h = rxpLogBackend.exec(currentLine))) {
365
- const [, prefix, spaces, level, params] = h;
366
- const logLevel = level.substring(1);
367
- const levelNumber = LogLevel[logLevel];
368
- newLine =
369
- `${prefix}${spaces}{ ` +
370
- `if(_log_level <= ${levelNumber}){ ` +
371
- `sprintf(_log_string,_,${params.replace(/%%/g, '\xff')}); ` +
372
- `_log${level}(__refid,__line); ` +
373
- `}` +
374
- `}`;
375
- }
376
- // #include <
377
- else if ((h = rxpIncludesClib.exec(currentLine)) && !filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.auto.path)) {
378
- //silently ignore this warning if this is a library dependency
379
- if (!filePath.includes(defaultFiles_1.DefaultFiles.filePaths.studio.libdeps)) {
380
- fileDiagnostics.push({
381
- file: fileUri,
382
- level: 'warning',
383
- line: lineNumber,
384
- message: `Libraries are included automatically - remove this #include line`
385
- });
386
- }
387
- newLine = '// Libraries are included automatically! - ' + currentLine;
388
- }
389
- // #endinput
390
- else if ((h = rxpEndinputClib.exec(currentLine))) {
391
- fileDiagnostics.push({
392
- file: fileUri,
393
- level: 'error',
394
- line: lineNumber,
395
- message: `#endinput is not supported - use #if/#endif instead`
396
- });
397
- newLine = currentLine;
398
- }
399
- if (mangleDDEFunctions && !manifest.legacyProject) {
400
- // DDE_(up|down)_(state|control)_(persist|update)
401
- if (rxpDDE.exec(currentLine)) {
402
- newLine = newLine.replaceAll('DDE_', `_${mangleDDEFunctions}`);
403
- }
404
- // onUplink(Restore|Apply)_(up|down)_(state|control)
405
- if (rxpUplinkRestore.exec(currentLine)) {
406
- newLine = newLine.replace('onUplink', `_${mangleDDEFunctions}`);
407
- }
408
- // onUplinkEvent
409
- if (rxpUplinkEvent.exec(currentLine)) {
410
- newLine = newLine.replace('onUplink', `_${mangleDDEFunctions}Uplink`);
411
- }
412
- }
413
- precompiledData.push(newLine);
414
- outLineNumber++;
415
- // Emit empty lines for consumed multiline continuation lines
416
- for (let i = 0; i < consumedExtraLines; i++) {
417
- precompiledData.push('');
418
- outLineNumber++;
419
- lineNumber++;
420
- }
421
- }
422
- // add undef of file include
423
- if (baseName !== 'main.dlo') {
424
- const undefFileName = baseName.split('.')[0].replace(/[^a-zA-Z0-9]/g, '_');
425
- const incName = `_inc_${undefFileName}`.substring(0, 31);
426
- const incNameInc = `_inc_${undefFileName}_inc`.substring(0, 31);
427
- //add special handling for defines with .inc and without
428
- precompiledData.push(`#if defined ${incName}`);
429
- precompiledData.push(`#undef ${incName}`);
430
- precompiledData.push(`#endif`);
431
- precompiledData.push(`#if defined ${incNameInc}`);
432
- precompiledData.push(`#undef ${incNameInc}`);
433
- precompiledData.push(`#endif`);
434
- }
435
- return {
436
- data: precompiledData.join('\n'),
437
- diagnostics: fileDiagnostics
438
- };
439
- }
440
- }
441
- exports.DloPreCompiler = DloPreCompiler;
442
- //# sourceMappingURL=preCompiler.js.map
package/out/dotenv.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ENV = void 0;
7
- const dotenv_1 = __importDefault(require("dotenv"));
8
- const vscode_uri_1 = require("vscode-uri");
9
- const helper_1 = require("./helper");
10
- const envLocalFile = '.env.local';
11
- var ENV;
12
- (function (ENV) {
13
- /**
14
- * Read/parse the supported .env file
15
- * @param cwd
16
- * @param fs
17
- */
18
- async function read(cwd, fs) {
19
- const envPath = vscode_uri_1.Utils.joinPath(cwd, envLocalFile);
20
- if (await fs.stat(envPath)) {
21
- const envData = await fs.readFile(envPath);
22
- return dotenv_1.default.parse(helper_1.Helper.convertBlobToString(envData));
23
- }
24
- return {};
25
- }
26
- ENV.read = read;
27
- })(ENV || (exports.ENV = ENV = {}));
28
- //# sourceMappingURL=dotenv.js.map