iobroker.javascript 7.0.5 → 7.0.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/README.md +6 -8
- package/admin/asset-manifest.json +5 -5
- package/admin/google-blockly/own/blocks_trigger.js +12 -10
- package/admin/google-blockly/own/field_script.js +122 -168
- package/admin/static/js/759.7f25ba6c.chunk.js.map +1 -1
- package/admin/static/js/{98.3bc0a67c.chunk.js → 98.f78be4fc.chunk.js} +2 -2
- package/admin/static/js/98.f78be4fc.chunk.js.map +1 -0
- package/admin/static/js/{main.eee05982.js → main.d86fb9de.js} +2 -2
- package/admin/static/js/{main.eee05982.js.map → main.d86fb9de.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/admin-config/vsFont/codicon.json +1 -1
- package/io-package.json +27 -27
- package/lib/typescriptTools.js +29 -30
- package/main.js +4 -4
- package/package.json +3 -3
- package/admin/static/js/98.3bc0a67c.chunk.js.map +0 -1
package/lib/typescriptTools.js
CHANGED
|
@@ -203,25 +203,25 @@ function addExportModifier(s) {
|
|
|
203
203
|
let modifiers;
|
|
204
204
|
// Add export modifiers
|
|
205
205
|
if (!s.modifiers) {
|
|
206
|
-
modifiers = [ts.createModifier(ts.SyntaxKind.ExportKeyword)];
|
|
206
|
+
modifiers = [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)];
|
|
207
207
|
} else if (!s.modifiers.some(m => m.kind === ts.SyntaxKind.ExportKeyword)) {
|
|
208
|
-
modifiers = [...s.modifiers, ts.createModifier(ts.SyntaxKind.ExportKeyword)];
|
|
208
|
+
modifiers = [...s.modifiers, ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)];
|
|
209
209
|
} else {
|
|
210
210
|
return s;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
if (ts.isVariableStatement(s)) {
|
|
214
|
-
return ts.updateVariableStatement(s, modifiers, s.declarationList);
|
|
214
|
+
return ts.factory.updateVariableStatement(s, modifiers, s.declarationList);
|
|
215
215
|
} else if (ts.isTypeAliasDeclaration(s)) {
|
|
216
|
-
return ts.updateTypeAliasDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.type);
|
|
216
|
+
return ts.factory.updateTypeAliasDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.type);
|
|
217
217
|
} else if (ts.isInterfaceDeclaration(s)) {
|
|
218
|
-
return ts.updateInterfaceDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
218
|
+
return ts.factory.updateInterfaceDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
219
219
|
} else if (ts.isEnumDeclaration(s)) {
|
|
220
|
-
return ts.updateEnumDeclaration(s, s.decorators, modifiers, s.name, s.members);
|
|
220
|
+
return ts.factory.updateEnumDeclaration(s, s.decorators, modifiers, s.name, s.members);
|
|
221
221
|
} else if (ts.isClassDeclaration(s)) {
|
|
222
|
-
return ts.updateClassDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
222
|
+
return ts.factory.updateClassDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
223
223
|
} else if (ts.isFunctionDeclaration(s)) {
|
|
224
|
-
return ts.updateFunctionDeclaration(s, s.decorators, modifiers, s.asteriskToken, s.name, s.typeParameters, s.parameters, s.type, s.body);
|
|
224
|
+
return ts.factory.updateFunctionDeclaration(s, s.decorators, modifiers, s.asteriskToken, s.name, s.typeParameters, s.parameters, s.type, s.body);
|
|
225
225
|
}
|
|
226
226
|
return s;
|
|
227
227
|
}
|
|
@@ -240,17 +240,17 @@ function removeDeclareModifier(s) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
if (ts.isVariableStatement(s)) {
|
|
243
|
-
return ts.updateVariableStatement(s, modifiers, s.declarationList);
|
|
243
|
+
return ts.factory.updateVariableStatement(s, modifiers, s.declarationList);
|
|
244
244
|
} else if (ts.isTypeAliasDeclaration(s)) {
|
|
245
|
-
return ts.updateTypeAliasDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.type);
|
|
245
|
+
return ts.factory.updateTypeAliasDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.type);
|
|
246
246
|
} else if (ts.isInterfaceDeclaration(s)) {
|
|
247
|
-
return ts.updateInterfaceDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
247
|
+
return ts.factory.updateInterfaceDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
248
248
|
} else if (ts.isEnumDeclaration(s)) {
|
|
249
|
-
return ts.updateEnumDeclaration(s, s.decorators, modifiers, s.name, s.members);
|
|
249
|
+
return ts.factory.updateEnumDeclaration(s, s.decorators, modifiers, s.name, s.members);
|
|
250
250
|
} else if (ts.isClassDeclaration(s)) {
|
|
251
|
-
return ts.updateClassDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
251
|
+
return ts.factory.updateClassDeclaration(s, s.decorators, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);
|
|
252
252
|
} else if (ts.isFunctionDeclaration(s)) {
|
|
253
|
-
return ts.updateFunctionDeclaration(s, s.decorators, modifiers, s.asteriskToken, s.name, s.typeParameters, s.parameters, s.type, s.body);
|
|
253
|
+
return ts.factory.updateFunctionDeclaration(s, s.decorators, modifiers, s.asteriskToken, s.name, s.typeParameters, s.parameters, s.type, s.body);
|
|
254
254
|
}
|
|
255
255
|
return s;
|
|
256
256
|
}
|
|
@@ -334,11 +334,10 @@ function isGlobalAugmentation(s) {
|
|
|
334
334
|
|
|
335
335
|
/** @param {import("typescript").Statement[]} statements */
|
|
336
336
|
function wrapInDeclareGlobal(statements) {
|
|
337
|
-
return ts.createModuleDeclaration(
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
ts.
|
|
341
|
-
ts.createModuleBlock(statements),
|
|
337
|
+
return ts.factory.createModuleDeclaration(
|
|
338
|
+
[ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword)],
|
|
339
|
+
ts.factory.createIdentifier('global'),
|
|
340
|
+
ts.factory.createModuleBlock(statements),
|
|
342
341
|
ts.NodeFlags.GlobalAugmentation
|
|
343
342
|
);
|
|
344
343
|
}
|
|
@@ -365,7 +364,7 @@ function transformScriptBeforeCompilation(source, isGlobal) {
|
|
|
365
364
|
// If there is no top level await, don't move all the statements around
|
|
366
365
|
const hasTLA = node.statements.some(s => ts.isExpressionStatement(s) && s.expression.kind === ts.SyntaxKind.AwaitExpression);
|
|
367
366
|
// Move all statements to the top of the file that cannot appear in a function body
|
|
368
|
-
let hoistedStatements = hasTLA ? ts.createNodeArray(nonAugmentations.filter((s) => mustBeHoisted(s, isGlobal))) : ts.createNodeArray(nonAugmentations);
|
|
367
|
+
let hoistedStatements = hasTLA ? ts.factory.createNodeArray(nonAugmentations.filter((s) => mustBeHoisted(s, isGlobal))) : ts.factory.createNodeArray(nonAugmentations);
|
|
369
368
|
|
|
370
369
|
// The rest gets wrapped
|
|
371
370
|
const wrappedStatements = hasTLA ? nonAugmentations.filter(s => !mustBeHoisted(s, isGlobal)) : [];
|
|
@@ -390,7 +389,7 @@ function transformScriptBeforeCompilation(source, isGlobal) {
|
|
|
390
389
|
|| !!augmentations
|
|
391
390
|
);
|
|
392
391
|
|
|
393
|
-
return ts.
|
|
392
|
+
return ts.factory.updateSourceFile(node, [
|
|
394
393
|
// Put the hoisted statements at the top (or all of them if there's no top level await)
|
|
395
394
|
...hoistedStatements,
|
|
396
395
|
// Then add everything that augments the global scope
|
|
@@ -398,11 +397,11 @@ function transformScriptBeforeCompilation(source, isGlobal) {
|
|
|
398
397
|
...(hasTLA
|
|
399
398
|
? // If there is a top-level await, wrap all non-hoisted statements in (async () => { ... })();
|
|
400
399
|
[
|
|
401
|
-
ts.createExpressionStatement(
|
|
400
|
+
ts.factory.createExpressionStatement(
|
|
402
401
|
ts.createCall(
|
|
403
|
-
ts.createArrowFunction(
|
|
402
|
+
ts.factory.createArrowFunction(
|
|
404
403
|
[
|
|
405
|
-
ts.createModifier(
|
|
404
|
+
ts.factory.createModifier(
|
|
406
405
|
ts.SyntaxKind.AsyncKeyword
|
|
407
406
|
),
|
|
408
407
|
],
|
|
@@ -410,7 +409,7 @@ function transformScriptBeforeCompilation(source, isGlobal) {
|
|
|
410
409
|
[],
|
|
411
410
|
undefined,
|
|
412
411
|
undefined,
|
|
413
|
-
ts.createBlock(wrappedStatements)
|
|
412
|
+
ts.factory.createBlock(wrappedStatements)
|
|
414
413
|
),
|
|
415
414
|
undefined,
|
|
416
415
|
undefined
|
|
@@ -421,10 +420,10 @@ function transformScriptBeforeCompilation(source, isGlobal) {
|
|
|
421
420
|
...(needsEmptyExport
|
|
422
421
|
? [
|
|
423
422
|
// Put an empty export {}; at the bottom to force TypeScript to treat the script as a module
|
|
424
|
-
ts.createExportDeclaration(
|
|
423
|
+
ts.factory.createExportDeclaration(
|
|
425
424
|
undefined,
|
|
426
425
|
undefined,
|
|
427
|
-
ts.createNamedExports([]),
|
|
426
|
+
ts.factory.createNamedExports([]),
|
|
428
427
|
undefined,
|
|
429
428
|
undefined
|
|
430
429
|
),
|
|
@@ -469,17 +468,17 @@ function transformGlobalDeclarations(decl) {
|
|
|
469
468
|
const hasExportStatements = exportStatements.length > 0;
|
|
470
469
|
const hasImport = otherStatements.some(s => ts.isImportDeclaration(s) || ts.isImportEqualsDeclaration(s));
|
|
471
470
|
|
|
472
|
-
return ts.
|
|
471
|
+
return ts.factory.updateSourceFile(node, [
|
|
473
472
|
...otherStatements,
|
|
474
473
|
...(hasExportStatements ? [wrapInDeclareGlobal(exportStatements.map((s) => removeDeclareModifier(s)))] : []),
|
|
475
474
|
...(hasImport
|
|
476
475
|
? [] // If there is an import, the script is already treated as a module
|
|
477
476
|
: [
|
|
478
477
|
// Otherwise put an empty export {}; at the bottom to force TypeScript to treat the script as a module
|
|
479
|
-
ts.createExportDeclaration(
|
|
478
|
+
ts.factory.createExportDeclaration(
|
|
480
479
|
undefined,
|
|
481
480
|
undefined,
|
|
482
|
-
ts.createNamedExports([]),
|
|
481
|
+
ts.factory.createNamedExports([]),
|
|
483
482
|
undefined,
|
|
484
483
|
undefined,
|
|
485
484
|
),
|
package/main.js
CHANGED
|
@@ -2437,18 +2437,18 @@ async function patchFont() {
|
|
|
2437
2437
|
dbFile = dbFile.file;
|
|
2438
2438
|
}
|
|
2439
2439
|
|
|
2440
|
-
if (!stat || stat.size !==
|
|
2440
|
+
if (!stat || stat.size !== 73452 || !dbFile || dbFile.byteLength !== 73452) {
|
|
2441
2441
|
try {
|
|
2442
|
-
const buffer = Buffer.from(JSON.parse(nodeFS.readFileSync(`${__dirname}/admin-config/vsFont/codicon.json`)));
|
|
2442
|
+
const buffer = Buffer.from(JSON.parse(nodeFS.readFileSync(`${__dirname}/admin-config/vsFont/codicon.json`)), 'base64');
|
|
2443
2443
|
|
|
2444
2444
|
const zip = await require('jszip').loadAsync(buffer);
|
|
2445
2445
|
const data = await zip.file('codicon.ttf').async('arraybuffer');
|
|
2446
|
-
if (data.byteLength !==
|
|
2446
|
+
if (data.byteLength !== 73452) {
|
|
2447
2447
|
throw new Error('invalid font file!');
|
|
2448
2448
|
}
|
|
2449
2449
|
nodeFS.writeFileSync(`${__dirname}/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf`, Buffer.from(data));
|
|
2450
2450
|
// upload this file
|
|
2451
|
-
await adapter.writeFileAsync('javascript.admin', 'vs/base/browser/ui/codicons/codicon/codicon.ttf', data);
|
|
2451
|
+
await adapter.writeFileAsync('javascript.admin', 'vs/base/browser/ui/codicons/codicon/codicon.ttf', Buffer.from(data));
|
|
2452
2452
|
return true;
|
|
2453
2453
|
} catch (error) {
|
|
2454
2454
|
adapter.log.error(`Cannot patch font: ${error}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.javascript",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.7",
|
|
4
4
|
"description": "Rules Engine for ioBroker",
|
|
5
5
|
"author": "bluefox <dogafox@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@iobroker/adapter-core": "^2.6.8",
|
|
34
|
-
"@types/node": "^20.
|
|
34
|
+
"@types/node": "^20.3.0",
|
|
35
35
|
"@types/request": "^2.48.8",
|
|
36
36
|
"axios": "^1.4.0",
|
|
37
|
-
"coffeescript": "^
|
|
37
|
+
"coffeescript": "^1.12.7",
|
|
38
38
|
"jsonata": "^2.0.3",
|
|
39
39
|
"jszip": "^3.10.1",
|
|
40
40
|
"node-inspect": "^2.0.0",
|