iobroker.javascript 10.0.0 → 10.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.
Files changed (157) hide show
  1. package/README.md +41 -6
  2. package/admin/assets/AiChatPanel-C4kuqP2U.js +237 -0
  3. package/admin/assets/AiDiffView-zJTEnv05.js +1 -0
  4. package/admin/assets/BlocklyEditor-BB77aFJI.js +84 -0
  5. package/admin/assets/ContextWrapper-C2yvd2Tn.css +1 -0
  6. package/admin/assets/ContextWrapper-W2H0z6zD.js +136 -0
  7. package/admin/assets/Debugger-DCMWjeGm.js +15 -0
  8. package/admin/assets/Error-CBC2oZzb.js +1 -0
  9. package/admin/assets/Import-B-F9IhZ-.js +1 -0
  10. package/admin/assets/RulesEditor-ByjgEaVo.js +1 -0
  11. package/admin/assets/RulesEditor-k-DMHotH.css +1 -0
  12. package/admin/assets/{ScriptEditor-BGIuoNei.js → ScriptEditor-CMYUt5S4.js} +2 -2
  13. package/admin/assets/{ScriptEditorVanillaMonaco-DyMQtoTQ.js → ScriptEditorVanillaMonaco-v12-gORS.js} +3 -3
  14. package/admin/assets/Send-CChqR5Oy.js +1 -0
  15. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-7EPUlgCk.js +1 -0
  16. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-DuplUOZN.js +1243 -0
  17. package/admin/assets/{_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BBAXJaqI.js → _virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-JkwfVf8d.js} +1 -1
  18. package/admin/assets/{aiCodeLensProvider-hyAmut0e.js → aiCodeLensProvider-BGvIu6hH.js} +1 -1
  19. package/admin/assets/blockly-C4zJerWL.js +1047 -0
  20. package/admin/assets/blocks_action-CvnOHXwt.js +1 -0
  21. package/admin/assets/blocks_convert-BZlKcd02.js +3 -0
  22. package/admin/assets/blocks_logic-B33Pypxr.js +1 -0
  23. package/admin/assets/blocks_number-k2IjE7OH.js +1 -0
  24. package/admin/assets/blocks_object-B64vSfel.js +1 -0
  25. package/admin/assets/blocks_procedures-BpvNI5dO.js +3 -0
  26. package/admin/assets/blocks_sendto-pwZchfe0.js +5 -0
  27. package/admin/assets/blocks_switch-DViYCmQd.js +2 -0
  28. package/admin/assets/blocks_system-BZZcGqTJ.js +1 -0
  29. package/admin/assets/blocks_text-BOvtHN2r.js +1 -0
  30. package/admin/assets/blocks_time-BH2F-ylT.js +1 -0
  31. package/admin/assets/blocks_timeout-C3BoW4XJ.js +1 -0
  32. package/admin/assets/blocks_trigger-gwXvuAHV.js +2 -0
  33. package/admin/assets/blocks_words-D8PL_nSE.js +1 -0
  34. package/admin/assets/{cronHoverProvider-pKJkSevo.js → cronHoverProvider-DjY3jLvQ.js} +1 -1
  35. package/admin/assets/dist-D6o4h8Pd.js +4 -0
  36. package/admin/assets/field_cron-BMQWPb61.js +1 -0
  37. package/admin/assets/field_oid-BGIMv9gw.js +1 -0
  38. package/admin/assets/field_script-CdzYBCe6.js +1 -0
  39. package/admin/assets/helpers-Crmcgphg.js +1 -0
  40. package/admin/assets/hostInit-DBlZi_Kt.js +1 -0
  41. package/admin/assets/index-BvPVHv3P.js +192 -0
  42. package/admin/assets/{inlineChatWidget-ZaisTOLh.js → inlineChatWidget-SDoyVtOR.js} +2 -2
  43. package/admin/assets/{inlineDiffController-hTwHHqcc.js → inlineDiffController-CnHE3Rwd.js} +2 -2
  44. package/admin/assets/javascript-DVIhlTDr.js +218 -0
  45. package/admin/assets/{mf-entry-bootstrap-0-d6052b31.js → mf-entry-bootstrap-0-a03ecebd.js} +6 -2
  46. package/admin/assets/{mjs-DWqivHEk.js → mjs-Bh7xFIpd.js} +2 -2
  47. package/admin/assets/{stateHoverProvider-C7DawIs-.js → stateHoverProvider-D0iXo6YF.js} +3 -3
  48. package/admin/assets/{virtualExposes-Ed0lGq7k.js → virtualExposes-DgGB-18P.js} +1 -1
  49. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-DYEYnOkt.js +1 -0
  50. package/admin/assets/virtual_mf-exposes___mfe_internal__iobroker_javascript__remoteEntry_js-ChiJXsfH.js +1 -0
  51. package/admin/custom/assets/Components-CuFt9lAY.js +1 -0
  52. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-DljJyQQg.js +1 -0
  53. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-D0M1SjIE.js +1 -0
  54. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-CGb5Cofy.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-BD2OkSge.js} +1 -1
  55. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BVCIAgbo.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-pM642JFd.js} +91 -91
  56. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-BkB0anQX.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-BLelmJ7Y.js} +74 -74
  57. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BotqDuw-.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BGiB1l5e.js} +1 -1
  58. package/admin/custom/assets/{_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-Cb5TR7FB.js → _virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-D5hqXJXI.js} +1 -1
  59. package/admin/custom/assets/hostInit-0DGPuZTB.js +1 -0
  60. package/admin/custom/assets/{index-uEKAoVT7.js → index-DcFI5r-g.js} +1 -1
  61. package/admin/custom/assets/{lib-Yj8cfN0A.js → lib-BlUjuGH7.js} +1 -1
  62. package/admin/custom/assets/{mf-entry-bootstrap-0-77793feb.js → mf-entry-bootstrap-0-efd847a6.js} +6 -2
  63. package/admin/custom/assets/{setYear-DJ9FbdkO.js → setYear-BaCcPbbI.js} +1 -1
  64. package/admin/custom/assets/virtualExposes-DGxNcyb6.js +1 -0
  65. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-DVNwFcUr.js +1 -0
  66. package/admin/custom/assets/virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-DPck7zEs.js +2 -0
  67. package/admin/custom/customComponents.js +1 -1
  68. package/admin/google-blockly/VERSION +1 -0
  69. package/admin/google-blockly/media/drop.mp3 +0 -0
  70. package/admin/google-blockly/msg/js/de.js +332 -56
  71. package/admin/google-blockly/msg/js/en.js +319 -43
  72. package/admin/google-blockly/msg/js/es.js +319 -42
  73. package/admin/google-blockly/msg/js/fr.js +315 -39
  74. package/admin/google-blockly/msg/js/it.js +327 -51
  75. package/admin/google-blockly/msg/js/nl.js +376 -100
  76. package/admin/google-blockly/msg/js/pl.js +318 -42
  77. package/admin/google-blockly/msg/js/pt.js +318 -42
  78. package/admin/google-blockly/msg/js/ru.js +320 -44
  79. package/admin/google-blockly/msg/js/uk.js +326 -50
  80. package/admin/google-blockly/msg/js/zh-cn.js +322 -46
  81. package/admin/i18n/de.json +48 -26
  82. package/admin/i18n/en.json +47 -25
  83. package/admin/i18n/es.json +48 -18
  84. package/admin/i18n/fr.json +47 -17
  85. package/admin/i18n/it.json +47 -17
  86. package/admin/i18n/nl.json +47 -17
  87. package/admin/i18n/pl.json +48 -18
  88. package/admin/i18n/pt.json +47 -17
  89. package/admin/i18n/ru.json +47 -17
  90. package/admin/i18n/uk.json +47 -17
  91. package/admin/i18n/zh-cn.json +47 -17
  92. package/admin/jsonConfig.json +367 -0
  93. package/admin/mf-manifest.json +1 -1
  94. package/admin/mf-stats.json +1 -1
  95. package/admin/remoteEntry.js +1 -1
  96. package/admin/tab.html +12 -95
  97. package/build/lib/mirror.js +9 -0
  98. package/build/lib/mirror.js.map +1 -1
  99. package/build/lib/sandbox.js +35 -0
  100. package/build/lib/sandbox.js.map +1 -1
  101. package/build/lib/typescriptSettings.js +112 -2
  102. package/build/lib/typescriptSettings.js.map +1 -1
  103. package/build/lib/typescriptTools.js +168 -43
  104. package/build/lib/typescriptTools.js.map +1 -1
  105. package/build/main.js +10 -5
  106. package/build/main.js.map +1 -1
  107. package/build/types.d.ts +41 -0
  108. package/docs/en/javascript.md +16 -0
  109. package/docs/en/upgrade-guide.md +3 -0
  110. package/io-package.json +45 -15
  111. package/package.json +8 -3
  112. package/admin/assets/AiChatPanel-p0KAg6Cs.js +0 -237
  113. package/admin/assets/AiDiffView-BPTLnNx1.js +0 -1
  114. package/admin/assets/BlocklyEditor-CAjVMhYT.js +0 -81
  115. package/admin/assets/ContextWrapper-BVc8wTK_.css +0 -1
  116. package/admin/assets/ContextWrapper-D9CrnNKs.js +0 -127
  117. package/admin/assets/Debugger-SjROokFI.js +0 -15
  118. package/admin/assets/Error-DDfrxAt2.js +0 -1
  119. package/admin/assets/Import-DpTg1Jow.js +0 -1
  120. package/admin/assets/RulesEditor-BSRFWpEm.css +0 -1
  121. package/admin/assets/RulesEditor-D0hgrcBc.js +0 -1
  122. package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-DWJotR1B.js +0 -1
  123. package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CxICLr5Z.js +0 -1243
  124. package/admin/assets/dist-uw5orDgd.js +0 -4
  125. package/admin/assets/hostInit-BFg5u9hY.js +0 -1
  126. package/admin/assets/index-B1gICjdq.js +0 -192
  127. package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-BYs71IQF.js +0 -1
  128. package/admin/assets/virtual_mf-exposes___mfe_internal__iobroker_javascript__remoteEntry_js-DnnXQRkG.js +0 -1
  129. package/admin/custom/assets/Components-BrDyDHXh.js +0 -1
  130. package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-CyYJM2-v.js +0 -1
  131. package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-BdzCssLn.js +0 -1
  132. package/admin/custom/assets/hostInit-DJx2uXXy.js +0 -1
  133. package/admin/custom/assets/virtualExposes-CxDjLoYu.js +0 -1
  134. package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-BU-ugy_7.js +0 -1
  135. package/admin/custom/assets/virtual_mf-exposes-ssr___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-BEfZbrf7.js +0 -2
  136. package/admin/custom/assets/virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-CTeZ0Jpm.js +0 -2
  137. package/admin/google-blockly/blockly_compressed.js +0 -1679
  138. package/admin/google-blockly/blocks_compressed.js +0 -193
  139. package/admin/google-blockly/javascript_compressed.js +0 -264
  140. package/admin/google-blockly/msg/messages.js +0 -1630
  141. package/admin/google-blockly/own/blocks_action.js +0 -765
  142. package/admin/google-blockly/own/blocks_convert.js +0 -480
  143. package/admin/google-blockly/own/blocks_logic.js +0 -459
  144. package/admin/google-blockly/own/blocks_number.js +0 -30
  145. package/admin/google-blockly/own/blocks_object.js +0 -402
  146. package/admin/google-blockly/own/blocks_procedures.js +0 -688
  147. package/admin/google-blockly/own/blocks_sendto.js +0 -702
  148. package/admin/google-blockly/own/blocks_switch.js +0 -257
  149. package/admin/google-blockly/own/blocks_system.js +0 -1409
  150. package/admin/google-blockly/own/blocks_text.js +0 -104
  151. package/admin/google-blockly/own/blocks_time.js +0 -639
  152. package/admin/google-blockly/own/blocks_timeout.js +0 -551
  153. package/admin/google-blockly/own/blocks_trigger.js +0 -1791
  154. package/admin/google-blockly/own/blocks_words.js +0 -708
  155. package/admin/google-blockly/own/field_cron.js +0 -158
  156. package/admin/google-blockly/own/field_oid.js +0 -642
  157. package/admin/google-blockly/own/field_script.js +0 -159
@@ -1 +1 @@
1
- {"version":3,"file":"typescriptTools.js","sourceRoot":"","sources":["../../src/lib/typescriptTools.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AA4Cb,sDAyBC;AAwBD,wCA+GC;AAoND,4EA2FC;AAOD,kEA2CC;AAOD,oDAEC;AApjBD,qCAAmD;AACnD,yCAA+D;AAC/D,2CAgCoB;AACpB,mCAAmC;AAEnC;;;;GAIG;AACH,SAAgB,qBAAqB,CACjC,SAAqF;IAErF,MAAM,iBAAiB,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAC9E,MAAM,GAAG,GAA2B,EAAE,CAAC;IAEvC,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;IACxE,MAAM,YAAY,GAAG,CAAC,GAAW,EAAY,EAAE,CAAC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AAQ,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAC9F,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,QAAgB;IACjD,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;AAC3E,CAAC","sourcesContent":["'use strict';\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, normalize, relative } from 'node:path';\nimport {\n type Statement,\n isImportDeclaration,\n isImportEqualsDeclaration,\n isExportDeclaration,\n isExportAssignment,\n isTypeAliasDeclaration,\n isInterfaceDeclaration,\n isModuleDeclaration,\n isEnumDeclaration,\n isClassDeclaration,\n isFunctionDeclaration,\n isVariableStatement,\n isExpressionStatement,\n createSourceFile,\n createPrinter,\n transform,\n ScriptTarget,\n factory,\n SyntaxKind,\n type Modifier,\n NodeFlags,\n type ModuleDeclaration,\n visitNode,\n visitNodes,\n isSourceFile,\n EmitHint,\n type NodeArray,\n type TransformerFactory,\n type SourceFile,\n type TransformationContext,\n type Transformer,\n} from 'typescript';\nimport { matchAll } from './tools';\n\n/**\n * Resolves all TypeScript lib files for the editor\n *\n * @param targetLib The lib to target (e.g., es2017)\n */\nexport function resolveTypescriptLibs(\n targetLib: 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext',\n): Record<string, string> {\n const typescriptLibRoot = dirname(require.resolve(`typescript/lib/lib.d.ts`));\n const ret: Record<string, string> = {};\n\n const libReferenceRegex = /\\/\\/\\/ <reference lib=[\"']([^\"']+)[\"'] \\/>/g;\n const matchAllLibs = (str: string): string[] => matchAll(libReferenceRegex, str).map(groups => groups[0]);\n\n const libQueue: string[] = [targetLib];\n while (libQueue.length > 0) {\n const libName = libQueue.shift();\n const filename = `lib.${libName}.d.ts`;\n // Read the file and remember it in the return dictionary\n const fileContent = readFileSync(join(typescriptLibRoot, filename), 'utf8');\n ret[filename] = fileContent;\n // If this file references another lib file, we need to load that too.\n // A reference looks like this: /// <reference lib=\"es2015.core\" />\n // Find all libs we have not loaded yet\n matchAllLibs(fileContent)\n .filter(lib => !(`lib.${lib}.d.ts` in ret))\n .forEach(lib => libQueue.push(lib));\n }\n\n return ret;\n}\n\nfunction normalizeDTSImport(filename: string): string {\n // An import is either...\n // a normal import\n if (filename.endsWith('.d.ts')) {\n return filename;\n }\n // an extensionless import\n if (existsSync(`${filename}.d.ts`)) {\n return `${filename}.d.ts`;\n }\n // or a directory import\n return join(filename, 'index.d.ts');\n}\n\n/**\n * Resolves the type declarations of a 3rd party package for the editor\n *\n * @param pkg The package whose typings we're interested in\n * @param adapterScopedPackageName the package name on the system\n * @param wrapInDeclareModule Whether the root file should be wrapped in `declare module \"<pkg>\" { ... }`\n * @returns The found declarations or undefined if none were found\n */\nexport function resolveTypings(\n pkg: string,\n adapterScopedPackageName: string,\n wrapInDeclareModule?: boolean,\n): Record<string, string> | undefined {\n let packageJsonPath: string | undefined;\n let packageJson: Record<string, any> | undefined;\n let rootTypings: string | undefined;\n let pkgIncludesTypings = true;\n\n function tryToLoadPackage(path: string): void {\n try {\n packageJsonPath = require.resolve(path);\n packageJson = require(packageJsonPath);\n rootTypings =\n typeof (packageJson as Record<string, any>).types === 'string'\n ? (packageJson as Record<string, any>).types\n : typeof (packageJson as Record<string, any>).typings === 'string'\n ? (packageJson as Record<string, any>).typings\n : undefined;\n } catch {\n /* ignore */\n }\n }\n\n // First, try to resolve the package itself in case it brings its own typings\n tryToLoadPackage(`${adapterScopedPackageName}/package.json`);\n\n if (!rootTypings) {\n tryToLoadPackage(`${pkg}/package.json`);\n }\n // If that didn't work, try again with the @types version of the package\n if (!rootTypings) {\n tryToLoadPackage(`@types/${pkg}/package.json`);\n pkgIncludesTypings = false;\n }\n\n // TODO: If that didn't work, download @types/<packagename> and retry the previous step\n\n // Nothing to do here since we found no packages\n if (!rootTypings) {\n return undefined;\n }\n\n if (!packageJsonPath) {\n return undefined;\n }\n\n const packageRoot: string = dirname(packageJsonPath);\n const normalizeImportPath = (filename: string): string =>\n normalize(\n `node_modules/${pkgIncludesTypings ? adapterScopedPackageName : `@types/${pkg}`}/${relative(packageRoot, filename)}`,\n ).replace(/\\\\/g, '/');\n\n const ret: Record<string, string> = {};\n\n // We need to look at `import/export ... from 'modulename'` and `/// <reference path='...' />`\n const importDtsRegex = /^\\s*(?:import|export) .+ from [\"'](\\.+\\/[^\"']+)[\"']/g;\n const pathReferenceRegex = /\\/\\/\\/ <reference path=[\"']([^\"']+)[\"'] \\/>/g;\n const matchAllImports = (str: string): string[] =>\n [...matchAll(importDtsRegex, str), ...matchAll(pathReferenceRegex, str)].map(groups => groups[0]);\n\n // the paths are relative to the package.json - we need an absolute path to read the files\n rootTypings = join(packageRoot, rootTypings);\n // some @types packages specify `index` as their typings file instead of `index.d.ts`\n rootTypings = normalizeDTSImport(rootTypings);\n\n // include package.json in typings, so TypeScript can look up the correct entry point\n const relativePath = `node_modules/${pkgIncludesTypings ? '' : '@types/'}${pkg}/package.json`.replace(/\\\\/g, '/');\n ret[relativePath] = JSON.stringify(packageJson);\n\n // Used to test whether a .d.ts file already uses \"declare module\" or not\n const declareModuleRegex = /^\\s*declare module/gm;\n\n // recursively load all typings\n const definitionQueue = [rootTypings];\n while (definitionQueue.length > 0) {\n const filename: string = definitionQueue.shift() as string;\n const dirName = dirname(filename);\n // Read the file and remember it in the return dictionary\n let fileContent: string;\n try {\n fileContent = readFileSync(filename, 'utf8');\n } catch (e: any) {\n // The typings are malformed\n console.error(`Failed to load definitions for ${pkg}: ${e.toString()}`);\n // Since we cannot use them, return undefined\n return undefined;\n }\n // We need to store the filename relative to the base dir\n const relativePath = normalizeImportPath(filename);\n // If necessary, wrap the root typings (only those!)\n ret[relativePath] =\n wrapInDeclareModule && filename === rootTypings && !declareModuleRegex.test(fileContent)\n ? `declare module \"${pkg}\" { ${fileContent} }`\n : fileContent;\n // If this file references another .d.ts file, we need to load that too\n matchAllImports(fileContent)\n // resolve the file relative to the current directory\n .map(file => join(dirName, file))\n // find out the correct path of the file we want to import\n .map(normalizeDTSImport)\n // Find all libs we have not loaded yet\n .filter(file => !(normalizeImportPath(file) in ret))\n .forEach(file => definitionQueue.push(file));\n }\n // Avoid returning empty declarations\n if (Object.keys(ret).length === 0) {\n return undefined;\n }\n return ret;\n}\n\n/**\n * @param s Statement to check whether it must be hoisted to the top of the file\n * @param isGlobal Whether this is a global script or a normal one\n */\nfunction mustBeHoisted(s: Statement & { modifiers?: Modifier[] }, isGlobal?: boolean): boolean {\n return !!(\n // Import/export statements must be moved to the top\n isImportDeclaration(s) ||\n isImportEqualsDeclaration(s) ||\n isExportDeclaration(s) ||\n isExportAssignment(s) ||\n // as well as many declarations\n isTypeAliasDeclaration(s) ||\n isInterfaceDeclaration(s) ||\n isModuleDeclaration(s) ||\n isEnumDeclaration(s) ||\n (isGlobal &&\n // in global scripts we don't wrap classes and functions, so they can be accessed from non-global scripts\n (isClassDeclaration(s) || isFunctionDeclaration(s))) ||\n // and declare ... / export ... statements\n s.modifiers?.some(s => s.kind === SyntaxKind.DeclareKeyword || s.kind === SyntaxKind.ExportKeyword)\n );\n}\n\nfunction canBeExported(s: Statement): boolean {\n return (\n // const, let, var\n isVariableStatement(s) ||\n // type, interface, enum, class, function\n isTypeAliasDeclaration(s) ||\n isInterfaceDeclaration(s) ||\n isEnumDeclaration(s) ||\n isClassDeclaration(s) ||\n isFunctionDeclaration(s)\n );\n}\n\nfunction addExportModifier(s: Statement & { modifiers?: Modifier[] }): Statement {\n let modifiers: Modifier[] | undefined;\n // Add export modifiers\n if (!s.modifiers) {\n modifiers = [factory.createModifier(SyntaxKind.ExportKeyword)];\n } else if (!s.modifiers.some(m => m.kind === SyntaxKind.ExportKeyword)) {\n modifiers = [...s.modifiers, factory.createModifier(SyntaxKind.ExportKeyword)];\n } else {\n return s;\n }\n\n if (isVariableStatement(s)) {\n return factory.updateVariableStatement(s, modifiers, s.declarationList);\n }\n if (isTypeAliasDeclaration(s)) {\n return factory.updateTypeAliasDeclaration(s, modifiers, s.name, s.typeParameters, s.type);\n }\n if (isInterfaceDeclaration(s)) {\n return factory.updateInterfaceDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isEnumDeclaration(s)) {\n return factory.updateEnumDeclaration(s, modifiers, s.name, s.members);\n }\n if (isClassDeclaration(s)) {\n return factory.updateClassDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isFunctionDeclaration(s)) {\n return factory.updateFunctionDeclaration(\n s,\n modifiers,\n s.asteriskToken,\n s.name,\n s.typeParameters,\n s.parameters,\n s.type,\n s.body,\n );\n }\n return s;\n}\n\nfunction removeDeclareModifier(s: Statement & { modifiers?: Modifier[] }): Statement {\n let modifiers: Modifier[] | undefined;\n // Remove declare modifiers\n if (s.modifiers) {\n modifiers = s.modifiers.filter(m => m.kind !== SyntaxKind.DeclareKeyword);\n } else {\n return s;\n }\n\n if (isVariableStatement(s)) {\n return factory.updateVariableStatement(s, modifiers, s.declarationList);\n }\n if (isTypeAliasDeclaration(s)) {\n return factory.updateTypeAliasDeclaration(s, modifiers, s.name, s.typeParameters, s.type);\n }\n if (isInterfaceDeclaration(s)) {\n return factory.updateInterfaceDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isEnumDeclaration(s)) {\n return factory.updateEnumDeclaration(s, modifiers, s.name, s.members);\n }\n if (isClassDeclaration(s)) {\n return factory.updateClassDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isFunctionDeclaration(s)) {\n return factory.updateFunctionDeclaration(\n s,\n modifiers,\n s.asteriskToken,\n s.name,\n s.typeParameters,\n s.parameters,\n s.type,\n s.body,\n );\n }\n\n return s;\n}\n\n// taken from node_modules\\@types\\node\\globals.d.ts\n// the globally available things must be wrapped in `declare global` if the user wants to augment them\nconst NodeJSGlobals = [\n 'Array',\n 'ArrayBuffer',\n 'Boolean',\n 'Buffer',\n 'DataView',\n 'Date',\n 'Error',\n 'EvalError',\n 'Float32Array',\n 'Float64Array',\n 'Function',\n 'GLOBAL',\n 'Infinity',\n 'Int16Array',\n 'Int32Array',\n 'Int8Array',\n 'Intl',\n 'JSON',\n 'Map',\n 'Math',\n 'NaN',\n 'Number',\n 'Object',\n 'Promise',\n 'RangeError',\n 'ReferenceError',\n 'RegExp',\n 'Set',\n 'String',\n 'Symbol',\n 'SyntaxError',\n 'TypeError',\n 'URIError',\n 'Uint16Array',\n 'Uint32Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'WeakMap',\n 'WeakSet',\n 'clearImmediate',\n 'clearInterval',\n 'clearTimeout',\n 'console',\n 'decodeURI',\n 'decodeURIComponent',\n 'encodeURI',\n 'encodeURIComponent',\n 'escape',\n 'eval',\n 'global',\n 'isFinite',\n 'isNaN',\n 'parseFloat',\n 'parseInt',\n 'process',\n 'root',\n 'setImmediate',\n 'setInterval',\n 'setTimeout',\n 'queueMicrotask',\n 'undefined',\n 'unescape',\n 'gc',\n 'v8debug',\n];\n\nfunction isGlobalAugmentation(s: Statement): boolean {\n return !!(\n (isInterfaceDeclaration(s) || isClassDeclaration(s) || isFunctionDeclaration(s)) &&\n s.name &&\n NodeJSGlobals.includes(s.name.text)\n );\n}\n\nfunction wrapInDeclareGlobal(statements: Statement[]): ModuleDeclaration {\n return factory.createModuleDeclaration(\n [factory.createModifier(SyntaxKind.DeclareKeyword)],\n factory.createIdentifier('global'),\n factory.createModuleBlock(statements),\n NodeFlags.GlobalAugmentation,\n );\n}\n\n/**\n * Takes a TypeScript script and does the necessary transformations, so it can be compiled properly\n *\n * @param source The original TypeScript source\n * @param isGlobal Whether the transformed script is a global script or not\n */\nexport function transformScriptBeforeCompilation(source: string, isGlobal?: boolean): string {\n const transformer: TransformerFactory<SourceFile> = (_context: TransformationContext): Transformer<SourceFile> => {\n return (sourceFile: SourceFile) =>\n visitNode(sourceFile, (node: SourceFile): any => {\n if (isSourceFile(node)) {\n // Wrap all declarations that augment global interfaces in `declare global`\n const augmentations = node.statements.filter(s => isGlobalAugmentation(s));\n const nonAugmentations = node.statements.filter(s => !isGlobalAugmentation(s));\n\n // If there is no top level await, don't move all the statements around\n const hasTLA = node.statements.some(\n s => isExpressionStatement(s) && s.expression.kind === SyntaxKind.AwaitExpression,\n );\n // Move all statements to the top of the file that cannot appear in a function body\n let hoistedStatements = hasTLA\n ? factory.createNodeArray(nonAugmentations.filter(s => mustBeHoisted(s, isGlobal)))\n : factory.createNodeArray(nonAugmentations);\n\n // The rest gets wrapped\n const wrappedStatements = hasTLA ? nonAugmentations.filter(s => !mustBeHoisted(s, isGlobal)) : [];\n\n // When transforming global scripts, we need to do a couple of things\n if (isGlobal) {\n // 1. We need to add an export modifier to everything at the top level that can be exported\n hoistedStatements = visitNodes(\n hoistedStatements,\n // @ts-expect-error s is definitely a Statement\n s => (canBeExported(s) ? addExportModifier(s) : s),\n ) as NodeArray<Statement>;\n // 3. We need to transform the generated declarations to use `declare global` (this will happen in transformGlobalDeclarations)\n }\n const needsEmptyExport =\n // An empty export is necessary when there is no import declaration\n !node.statements.some(s => isImportDeclaration(s) || isImportEqualsDeclaration(s)) &&\n // And there is no statement in a global script which had an export modifier added\n (!(\n isGlobal &&\n hoistedStatements.some(\n // @ts-expect-error s should have modifiers\n s => s.modifiers?.some(m => m.kind === SyntaxKind.ExportKeyword),\n )\n ) ||\n // Or if there is a `declare global` statement\n !!augmentations);\n\n return factory.updateSourceFile(node, [\n // Put the hoisted statements at the top (or all of them if there's no top level await)\n ...hoistedStatements,\n // Then add everything that augments the global scope\n ...(augmentations && augmentations.length ? [wrapInDeclareGlobal(augmentations)] : []),\n ...(hasTLA\n ? // If there is a top-level await, wrap all non-hoisted statements in (async () => { ... })();\n [\n factory.createExpressionStatement(\n factory.createCallExpression(\n factory.createArrowFunction(\n [factory.createModifier(SyntaxKind.AsyncKeyword)],\n undefined,\n [],\n undefined,\n undefined,\n factory.createBlock(wrappedStatements),\n ),\n undefined,\n undefined,\n ),\n ),\n ]\n : []),\n ...(needsEmptyExport\n ? [\n // Put an empty export {}; at the bottom to force TypeScript to treat the script as a module\n factory.createExportDeclaration(\n undefined, // ModifierLike[] | undefined\n false, // isTypeOnly\n factory.createNamedExports([]), // NamedExportBindings | undefined\n undefined, // moduleSpecifier\n undefined, // attributes\n ),\n ]\n : []),\n ]);\n }\n return node;\n });\n };\n\n const sourceFile = createSourceFile('index.ts', source, ScriptTarget.ESNext, /* setParentNodes */ true);\n\n const result = transform(sourceFile, [transformer]);\n return createPrinter().printNode(EmitHint.Unspecified, result.transformed[0], sourceFile);\n}\n\n/**\n * Takes the global declarations for a TypeScript and wraps export statements in `declare global`\n *\n * @param decl The untransformed global declarations\n */\nexport function transformGlobalDeclarations(decl: string): string {\n const transformer: TransformerFactory<SourceFile> = (_context: TransformationContext): any => {\n return (sourceFile: SourceFile) =>\n visitNode(sourceFile, (node: SourceFile): SourceFile => {\n if (isSourceFile(node)) {\n // All non-export-statements stay at the root level, the rest is wrapped in `declare global`\n const exportStatements = node.statements.filter(\n // @ts-expect-error s should have modifiers\n s => s.modifiers?.some(m => m.kind === SyntaxKind.ExportKeyword),\n );\n const otherStatements = node.statements.filter(s => !exportStatements.includes(s));\n\n const hasExportStatements = exportStatements.length > 0;\n const hasImport = otherStatements.some(s => isImportDeclaration(s) || isImportEqualsDeclaration(s));\n\n return factory.updateSourceFile(node, [\n ...otherStatements,\n ...(hasExportStatements\n ? [wrapInDeclareGlobal(exportStatements.map(s => removeDeclareModifier(s)))]\n : []),\n ...(hasImport\n ? [] // If there is an import, the script is already treated as a module\n : [\n // Otherwise, put an empty export {}; at the bottom to force TypeScript to treat the script as a module\n factory.createExportDeclaration(\n undefined,\n false,\n factory.createNamedExports([]),\n undefined,\n undefined,\n ),\n ]),\n ]);\n }\n\n return node;\n });\n };\n\n const sourceFile = createSourceFile('index.d.ts', decl, ScriptTarget.ESNext, /* setParentNodes */ true);\n\n const result = transform(sourceFile, [transformer]);\n return createPrinter().printNode(EmitHint.Unspecified, result.transformed[0], sourceFile);\n}\n\n/**\n * Translates a script ID to a filename for the compiler\n *\n * @param scriptID The ID of the script\n */\nexport function scriptIdToTSFilename(scriptID: string): string {\n return `${scriptID.replace(/^script.js./, '').replace(/\\./g, '/')}.ts`;\n}\n"]}
1
+ {"version":3,"file":"typescriptTools.js","sourceRoot":"","sources":["../../src/lib/typescriptTools.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAqDb,sDAuBC;AA6GD,wCAqJC;AAoND,4EA2FC;AAOD,kEA2CC;AAOD,oDAEC;AAtrBD,qCAAmD;AACnD,yCAA+D;AAC/D,2CAiCoB;AACpB,mCAAmC;AAGnC;;;;GAIG;AACH,MAAM,eAAe,GAAG,EAAE,OAAO,EAAE,wBAAW,CAAC,QAAQ,EAAE,CAAC;AAE1D;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,SAAmB;IACrD,MAAM,iBAAiB,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAC9E,MAAM,GAAG,GAA2B,EAAE,CAAC;IAEvC,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;IACxE,MAAM,YAAY,GAAG,CAAC,GAAW,EAAY,EAAE,CAAC,IAAA,gBAAQ,EAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1G,MAAM,QAAQ,GAAa,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,OAAO,OAAO,OAAO,CAAC;QACvC,yDAAyD;QACzD,MAAM,WAAW,GAAG,I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BAClC,GAAG,eAAe;oBAClB,GAAG,CAAC,mBAAmB;wBACnB,CAAC,CAAC,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC5E,CAAC,CAAC,EAAE,CAAC;oBACT,GAAG,CAAC,SAAS;wBACT,CAAC,CAAC,EAAE,CAAC,mEAAmE;wBACxE,CAAC,CAAC;4BACI,uGAAuG;4BACvG,oBAAO,CAAC,uBAAuB,CAC3B,SAAS,EACT,KAAK,EACL,oBAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAC9B,SAAS,EACT,SAAS,CACZ;yBACJ,CAAC;iBACX,CAAC,CAAC;YACP,CAAC;YAED,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACX,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,6BAAgB,EAAC,YAAY,EAAE,IAAI,EAAE,yBAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAExG,MAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,UAAU,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,OAAO,IAAA,0BAAa,EAAC,eAAe,CAAC,CAAC,SAAS,CAAC,qBAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAC7G,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,QAAgB;IACjD,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;AAC3E,CAAC","sourcesContent":["'use strict';\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, normalize, relative } from 'node:path';\nimport {\n type Statement,\n isImportDeclaration,\n isImportEqualsDeclaration,\n isExportDeclaration,\n isExportAssignment,\n isTypeAliasDeclaration,\n isInterfaceDeclaration,\n isModuleDeclaration,\n isEnumDeclaration,\n isClassDeclaration,\n isFunctionDeclaration,\n isVariableStatement,\n isExpressionStatement,\n createSourceFile,\n createPrinter,\n transform,\n ScriptTarget,\n factory,\n SyntaxKind,\n type Modifier,\n NodeFlags,\n NewLineKind,\n type ModuleDeclaration,\n visitNode,\n visitNodes,\n isSourceFile,\n EmitHint,\n type NodeArray,\n type TransformerFactory,\n type SourceFile,\n type TransformationContext,\n type Transformer,\n} from 'typescript';\nimport { matchAll } from './tools';\nimport type { TsTarget } from '../types';\n\n/**\n * The transformed sources are stored in the ioBroker database and mirrored to disk, so they must\n * not depend on the platform or on a TypeScript default. TypeScript 5 printed CRLF here and\n * TypeScript 6 prints LF - pinning it keeps a compiler update from silently rewriting every script.\n */\nconst PRINTER_OPTIONS = { newLine: NewLineKind.LineFeed };\n\n/**\n * Resolves all TypeScript lib files for the editor\n *\n * @param targetLib The lib to target (e.g., es2017)\n */\nexport function resolveTypescriptLibs(targetLib: TsTarget): Record<string, string> {\n const typescriptLibRoot = dirname(require.resolve(`typescript/lib/lib.d.ts`));\n const ret: Record<string, string> = {};\n\n const libReferenceRegex = /\\/\\/\\/ <reference lib=[\"']([^\"']+)[\"'] \\/>/g;\n const matchAllLibs = (str: string): string[] => matchAll(libReferenceRegex, str).map(groups => groups[0]);\n\n const libQueue: string[] = [targetLib];\n while (libQueue.length > 0) {\n const libName = libQueue.shift();\n const filename = `lib.${libName}.d.ts`;\n // Read the file and remember it in the return dictionary\n const fileContent = readFileSync(join(typescriptLibRoot, filename), 'utf8');\n ret[filename] = fileContent;\n // If this file references another lib file, we need to load that too.\n // A reference looks like this: /// <reference lib=\"es2015.core\" />\n // Find all libs we have not loaded yet\n matchAllLibs(fileContent)\n .filter(lib => !(`lib.${lib}.d.ts` in ret))\n .forEach(lib => libQueue.push(lib));\n }\n\n return ret;\n}\n\nfunction normalizeDTSImport(filename: string): string {\n // An import is either...\n // a normal import\n if (filename.endsWith('.d.ts')) {\n return filename;\n }\n // an extensionless import\n if (existsSync(`${filename}.d.ts`)) {\n return `${filename}.d.ts`;\n }\n // or a directory import\n return join(filename, 'index.d.ts');\n}\n\n/**\n * Wraps a package's root declarations in `declare module \"<pkg>\"` if - and only if - they are not a\n * module themselves.\n *\n * This used to be applied to every package. That broke all of them that ship real typings: inside an\n * ambient module declaration TypeScript does not resolve the relative paths a barrel file re-exports\n * from, so every name the package exported became `any` - which is why type inference never worked\n * for e.g. rxjs (https://github.com/ioBroker/ioBroker.javascript/issues/2341). Such a file is now\n * left alone and found through ordinary module resolution.\n *\n * A declaration file without any top-level `import`/`export` is a script, not a module, and\n * `import ... from \"<pkg>\"` would not accept it. Those still need the wrapper - and having no\n * imports, they cannot suffer from the problem above.\n *\n * A file that only points at other files (`@types/node` is nothing but `/// <reference path>` lines)\n * is left alone as well: the wrapper would cut those references off from the global scope they are\n * meant to populate.\n *\n * @param pkg The package the declarations belong to\n * @param content The content of the root declaration file\n */\nfunction wrapRootTypingsIfNeeded(pkg: string, content: string): string {\n const isModule = /^\\s*(?:import|export)\\b/m.test(content);\n const isAmbientDeclaration = /^\\s*declare module/m.test(content);\n const referencesOtherFiles = /\\/\\/\\/\\s*<reference path=/.test(content);\n\n return isModule || isAmbientDeclaration || referencesOtherFiles\n ? content\n : `declare module \"${pkg}\" { ${content} }`;\n}\n\n/**\n * Finds the package.json of a package on disk.\n *\n * `require.resolve(\"<pkg>/package.json\")` goes through Node's module resolution, and a package with\n * an `exports` map that does not list `./package.json` makes that throw - which is common enough\n * among modern packages to matter. The directories Node would have searched are then looked at\n * directly, which no `exports` map can hide.\n *\n * @param pkg The package to look for\n */\nfunction findPackageJson(pkg: string): string | undefined {\n try {\n return require.resolve(`${pkg}/package.json`);\n } catch {\n // the package may be there but refuse to hand out its manifest\n }\n\n return (require.resolve.paths(pkg) || [])\n .map(dir => join(dir, pkg, 'package.json'))\n .find(candidate => existsSync(candidate));\n}\n\n/**\n * Finds the declaration entry point of a package.\n *\n * A package that ships an `exports` map often keeps the legacy `types` field only as a stub - rxjs 7\n * declares `\"types\": \"index.d.ts\"` although no such file exists and the real declarations sit in\n * `./dist/types/`. A candidate therefore only counts if the file is really there\n * (https://github.com/ioBroker/ioBroker.javascript/issues/928).\n *\n * @param packageJson The parsed package.json\n * @param packageRoot The directory that package.json lives in\n */\nfunction findRootTypings(packageJson: Record<string, any>, packageRoot: string): string | undefined {\n const mainExport: unknown = packageJson.exports?.['.'];\n const fromExports =\n mainExport && typeof mainExport === 'object'\n ? ((mainExport as Record<string, any>).types ??\n (mainExport as Record<string, any>).require?.types ??\n (mainExport as Record<string, any>).import?.types ??\n (mainExport as Record<string, any>).default?.types)\n : undefined;\n\n // the legacy fields come first: they are what a package without an `exports` map has, and where\n // both exist they agree\n return [packageJson.types, packageJson.typings, fromExports].find(\n candidate => typeof candidate === 'string' && existsSync(normalizeDTSImport(join(packageRoot, candidate))),\n );\n}\n\n/**\n * Resolves the type declarations of a 3rd party package for the editor and the compiler\n *\n * The declarations are handed to TypeScript as a virtual file system. They are placed under the name\n * the *scripts* import - `node_modules/rxjs/...` - not under the name the package has on disk: the\n * js-controller installs script libraries under an adapter-scoped alias, and TypeScript has to\n * resolve `import ... from \"rxjs\"` against these files.\n *\n * @param pkg The package whose typings we're interested in\n * @param adapterScopedPackageName the package name on the system\n * @returns The found declarations or undefined if none were found\n */\nexport function resolveTypings(pkg: string, adapterScopedPackageName: string): Record<string, string> | undefined {\n let packageJsonPath: string | undefined;\n let packageJson: Record<string, any> | undefined;\n let rootTypings: string | undefined;\n let pkgIncludesTypings = true;\n\n function tryToLoadPackage(name: string): void {\n const found = findPackageJson(name);\n if (!found) {\n return;\n }\n try {\n packageJsonPath = found;\n packageJson = require(found);\n rootTypings = findRootTypings(packageJson as Record<string, any>, dirname(found));\n } catch {\n /* ignore */\n }\n }\n\n // First, try to resolve the package itself in case it brings its own typings\n tryToLoadPackage(adapterScopedPackageName);\n\n if (!rootTypings) {\n tryToLoadPackage(pkg);\n }\n // If that didn't work, try again with the @types version of the package\n if (!rootTypings) {\n tryToLoadPackage(`@types/${pkg}`);\n pkgIncludesTypings = false;\n }\n\n // TODO: If that didn't work, download @types/<packagename> and retry the previous step\n\n // Nothing to do here since we found no packages\n if (!rootTypings) {\n return undefined;\n }\n\n if (!packageJsonPath) {\n return undefined;\n }\n\n const packageRoot: string = dirname(packageJsonPath);\n /**\n * The directory the declarations get in the virtual file system. It has to be the one the\n * `package.json` below is written to, otherwise TypeScript reads that file, follows its `types`\n * entry and finds nothing - which used to leave every import from the package typed as `any`.\n */\n const virtualPackageDir = `node_modules/${pkgIncludesTypings ? '' : '@types/'}${pkg}`;\n\n // We need to look at everything that names another file of the package: `import ... from \"./x\"`,\n // `export ... from \"./x\"`, the side effect import `import \"./x\"`, `import x = require(\"./x\")`,\n // and `/// <reference path='...' />`.\n //\n // The `m` flag is what makes `^` match every line instead of only the start of the file. Without\n // it, exactly one import per file was followed - and only if it happened to be the first thing in\n // it. For rxjs 6 that collected 6 of its ~800 declaration files.\n //\n // Everything between the keyword and the path is skipped, so the shape of the import does not\n // matter and it may span several lines. `[^;]` stops that at the statement's semicolon, so a\n // match can never run into the next statement.\n const importDtsRegex = /^\\s*(?:import|export)\\s[^;]*?[\"'](\\.+\\/[^\"']+)[\"']/gm;\n const pathReferenceRegex = /\\/\\/\\/ <reference path=[\"']([^\"']+)[\"'] \\/>/g;\n const matchAllImports = (str: string): string[] =>\n [...matchAll(importDtsRegex, str), ...matchAll(pathReferenceRegex, str)].map(groups => groups[0]);\n\n // the paths are relative to the package.json - we need an absolute path to read the files\n rootTypings = join(packageRoot, rootTypings);\n // some @types packages specify `index` as their typings file instead of `index.d.ts`\n rootTypings = normalizeDTSImport(rootTypings);\n\n // recursively load all typings, keyed by their location on disk\n const collected = new Map<string, string>();\n const definitionQueue = [rootTypings];\n while (definitionQueue.length > 0) {\n const filename: string = definitionQueue.shift() as string;\n if (collected.has(filename)) {\n continue;\n }\n let fileContent: string;\n try {\n fileContent = readFileSync(filename, 'utf8');\n } catch (e: any) {\n // Without the entry point there is nothing to hand to TypeScript\n if (filename === rootTypings) {\n console.error(`Failed to load definitions for ${pkg}: ${e.toString()}`);\n return undefined;\n }\n // A referenced file was there a moment ago but cannot be read now. Dropping every\n // declaration of the package over one unreadable file would be out of proportion.\n console.warn(`Skipped a definition file of ${pkg}: ${e.toString()}`);\n continue;\n }\n collected.set(filename, fileContent);\n // If this file references another .d.ts file, we need to load that too\n matchAllImports(fileContent)\n // resolve the file relative to the current directory\n .map(file => join(dirname(filename), file))\n // find out the correct path of the file we want to import\n .map(normalizeDTSImport)\n // A package may import something it does not ship declarations for, and the matcher\n // above may pick up a string that only looks like a path\n .filter(file => existsSync(file))\n // Find all libs we have not loaded yet\n .filter(file => !collected.has(file))\n .forEach(file => definitionQueue.push(file));\n }\n\n /**\n * The directory that becomes `node_modules/<pkg>` in the virtual file system.\n *\n * `virtual-tsc` resolves with `moduleResolution: node10`, which looks the entry point up next to\n * the package - so laying the files out around the entry point rather than around the\n * package.json is what makes a package work whose declarations sit in a subdirectory. For a\n * package whose entry point is at its root - the usual case - this is the package root and\n * nothing changes.\n */\n let virtualRoot = dirname(rootTypings);\n if ([...collected.keys()].some(file => relative(virtualRoot, file).startsWith('..'))) {\n // Declarations reach above the entry point. Moving them would break the relative imports\n // between them, so the layout of the package is kept as it is.\n virtualRoot = packageRoot;\n }\n\n const toVirtualPath = (filename: string): string =>\n normalize(`${virtualPackageDir}/${relative(virtualRoot, filename)}`).replace(/\\\\/g, '/');\n\n const ret: Record<string, string> = {};\n for (const [filename, fileContent] of collected) {\n ret[toVirtualPath(filename)] =\n filename === rootTypings ? wrapRootTypingsIfNeeded(pkg, fileContent) : fileContent;\n }\n\n // Include a package.json, so TypeScript can look up the entry point. It describes the layout\n // above, not the one the package has on disk - and it is deliberately minimal: the original\n // `exports` map refers to paths that do not exist here, and TypeScript refuses to resolve the\n // package at all when it finds one it cannot follow under `moduleResolution: node10`.\n ret[`${virtualPackageDir}/package.json`] = JSON.stringify({\n name: pkg,\n version: packageJson?.version,\n types: `./${relative(virtualRoot, rootTypings).replace(/\\\\/g, '/')}`,\n });\n\n // Avoid returning empty declarations\n if (!collected.size) {\n return undefined;\n }\n return ret;\n}\n\n/**\n * @param s Statement to check whether it must be hoisted to the top of the file\n * @param isGlobal Whether this is a global script or a normal one\n */\nfunction mustBeHoisted(s: Statement & { modifiers?: Modifier[] }, isGlobal?: boolean): boolean {\n return !!(\n // Import/export statements must be moved to the top\n isImportDeclaration(s) ||\n isImportEqualsDeclaration(s) ||\n isExportDeclaration(s) ||\n isExportAssignment(s) ||\n // as well as many declarations\n isTypeAliasDeclaration(s) ||\n isInterfaceDeclaration(s) ||\n isModuleDeclaration(s) ||\n isEnumDeclaration(s) ||\n (isGlobal &&\n // in global scripts we don't wrap classes and functions, so they can be accessed from non-global scripts\n (isClassDeclaration(s) || isFunctionDeclaration(s))) ||\n // and declare ... / export ... statements\n s.modifiers?.some(s => s.kind === SyntaxKind.DeclareKeyword || s.kind === SyntaxKind.ExportKeyword)\n );\n}\n\nfunction canBeExported(s: Statement): boolean {\n return (\n // const, let, var\n isVariableStatement(s) ||\n // type, interface, enum, class, function\n isTypeAliasDeclaration(s) ||\n isInterfaceDeclaration(s) ||\n isEnumDeclaration(s) ||\n isClassDeclaration(s) ||\n isFunctionDeclaration(s)\n );\n}\n\nfunction addExportModifier(s: Statement & { modifiers?: Modifier[] }): Statement {\n let modifiers: Modifier[] | undefined;\n // Add export modifiers\n if (!s.modifiers) {\n modifiers = [factory.createModifier(SyntaxKind.ExportKeyword)];\n } else if (!s.modifiers.some(m => m.kind === SyntaxKind.ExportKeyword)) {\n modifiers = [...s.modifiers, factory.createModifier(SyntaxKind.ExportKeyword)];\n } else {\n return s;\n }\n\n if (isVariableStatement(s)) {\n return factory.updateVariableStatement(s, modifiers, s.declarationList);\n }\n if (isTypeAliasDeclaration(s)) {\n return factory.updateTypeAliasDeclaration(s, modifiers, s.name, s.typeParameters, s.type);\n }\n if (isInterfaceDeclaration(s)) {\n return factory.updateInterfaceDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isEnumDeclaration(s)) {\n return factory.updateEnumDeclaration(s, modifiers, s.name, s.members);\n }\n if (isClassDeclaration(s)) {\n return factory.updateClassDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isFunctionDeclaration(s)) {\n return factory.updateFunctionDeclaration(\n s,\n modifiers,\n s.asteriskToken,\n s.name,\n s.typeParameters,\n s.parameters,\n s.type,\n s.body,\n );\n }\n return s;\n}\n\nfunction removeDeclareModifier(s: Statement & { modifiers?: Modifier[] }): Statement {\n let modifiers: Modifier[] | undefined;\n // Remove declare modifiers\n if (s.modifiers) {\n modifiers = s.modifiers.filter(m => m.kind !== SyntaxKind.DeclareKeyword);\n } else {\n return s;\n }\n\n if (isVariableStatement(s)) {\n return factory.updateVariableStatement(s, modifiers, s.declarationList);\n }\n if (isTypeAliasDeclaration(s)) {\n return factory.updateTypeAliasDeclaration(s, modifiers, s.name, s.typeParameters, s.type);\n }\n if (isInterfaceDeclaration(s)) {\n return factory.updateInterfaceDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isEnumDeclaration(s)) {\n return factory.updateEnumDeclaration(s, modifiers, s.name, s.members);\n }\n if (isClassDeclaration(s)) {\n return factory.updateClassDeclaration(s, modifiers, s.name, s.typeParameters, s.heritageClauses, s.members);\n }\n if (isFunctionDeclaration(s)) {\n return factory.updateFunctionDeclaration(\n s,\n modifiers,\n s.asteriskToken,\n s.name,\n s.typeParameters,\n s.parameters,\n s.type,\n s.body,\n );\n }\n\n return s;\n}\n\n// taken from node_modules\\@types\\node\\globals.d.ts\n// the globally available things must be wrapped in `declare global` if the user wants to augment them\nconst NodeJSGlobals = [\n 'Array',\n 'ArrayBuffer',\n 'Boolean',\n 'Buffer',\n 'DataView',\n 'Date',\n 'Error',\n 'EvalError',\n 'Float32Array',\n 'Float64Array',\n 'Function',\n 'GLOBAL',\n 'Infinity',\n 'Int16Array',\n 'Int32Array',\n 'Int8Array',\n 'Intl',\n 'JSON',\n 'Map',\n 'Math',\n 'NaN',\n 'Number',\n 'Object',\n 'Promise',\n 'RangeError',\n 'ReferenceError',\n 'RegExp',\n 'Set',\n 'String',\n 'Symbol',\n 'SyntaxError',\n 'TypeError',\n 'URIError',\n 'Uint16Array',\n 'Uint32Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'WeakMap',\n 'WeakSet',\n 'clearImmediate',\n 'clearInterval',\n 'clearTimeout',\n 'console',\n 'decodeURI',\n 'decodeURIComponent',\n 'encodeURI',\n 'encodeURIComponent',\n 'escape',\n 'eval',\n 'global',\n 'isFinite',\n 'isNaN',\n 'parseFloat',\n 'parseInt',\n 'process',\n 'root',\n 'setImmediate',\n 'setInterval',\n 'setTimeout',\n 'queueMicrotask',\n 'undefined',\n 'unescape',\n 'gc',\n 'v8debug',\n];\n\nfunction isGlobalAugmentation(s: Statement): boolean {\n return !!(\n (isInterfaceDeclaration(s) || isClassDeclaration(s) || isFunctionDeclaration(s)) &&\n s.name &&\n NodeJSGlobals.includes(s.name.text)\n );\n}\n\nfunction wrapInDeclareGlobal(statements: Statement[]): ModuleDeclaration {\n return factory.createModuleDeclaration(\n [factory.createModifier(SyntaxKind.DeclareKeyword)],\n factory.createIdentifier('global'),\n factory.createModuleBlock(statements),\n NodeFlags.GlobalAugmentation,\n );\n}\n\n/**\n * Takes a TypeScript script and does the necessary transformations, so it can be compiled properly\n *\n * @param source The original TypeScript source\n * @param isGlobal Whether the transformed script is a global script or not\n */\nexport function transformScriptBeforeCompilation(source: string, isGlobal?: boolean): string {\n const transformer: TransformerFactory<SourceFile> = (_context: TransformationContext): Transformer<SourceFile> => {\n return (sourceFile: SourceFile) =>\n visitNode(sourceFile, (node: SourceFile): any => {\n if (isSourceFile(node)) {\n // Wrap all declarations that augment global interfaces in `declare global`\n const augmentations = node.statements.filter(s => isGlobalAugmentation(s));\n const nonAugmentations = node.statements.filter(s => !isGlobalAugmentation(s));\n\n // If there is no top level await, don't move all the statements around\n const hasTLA = node.statements.some(\n s => isExpressionStatement(s) && s.expression.kind === SyntaxKind.AwaitExpression,\n );\n // Move all statements to the top of the file that cannot appear in a function body\n let hoistedStatements = hasTLA\n ? factory.createNodeArray(nonAugmentations.filter(s => mustBeHoisted(s, isGlobal)))\n : factory.createNodeArray(nonAugmentations);\n\n // The rest gets wrapped\n const wrappedStatements = hasTLA ? nonAugmentations.filter(s => !mustBeHoisted(s, isGlobal)) : [];\n\n // When transforming global scripts, we need to do a couple of things\n if (isGlobal) {\n // 1. We need to add an export modifier to everything at the top level that can be exported\n hoistedStatements = visitNodes(\n hoistedStatements,\n // @ts-expect-error s is definitely a Statement\n s => (canBeExported(s) ? addExportModifier(s) : s),\n ) as NodeArray<Statement>;\n // 3. We need to transform the generated declarations to use `declare global` (this will happen in transformGlobalDeclarations)\n }\n const needsEmptyExport =\n // An empty export is necessary when there is no import declaration\n !node.statements.some(s => isImportDeclaration(s) || isImportEqualsDeclaration(s)) &&\n // And there is no statement in a global script which had an export modifier added\n (!(\n isGlobal &&\n hoistedStatements.some(\n // @ts-expect-error s should have modifiers\n s => s.modifiers?.some(m => m.kind === SyntaxKind.ExportKeyword),\n )\n ) ||\n // Or if there is a `declare global` statement\n !!augmentations);\n\n return factory.updateSourceFile(node, [\n // Put the hoisted statements at the top (or all of them if there's no top level await)\n ...hoistedStatements,\n // Then add everything that augments the global scope\n ...(augmentations && augmentations.length ? [wrapInDeclareGlobal(augmentations)] : []),\n ...(hasTLA\n ? // If there is a top-level await, wrap all non-hoisted statements in (async () => { ... })();\n [\n factory.createExpressionStatement(\n factory.createCallExpression(\n factory.createArrowFunction(\n [factory.createModifier(SyntaxKind.AsyncKeyword)],\n undefined,\n [],\n undefined,\n undefined,\n factory.createBlock(wrappedStatements),\n ),\n undefined,\n undefined,\n ),\n ),\n ]\n : []),\n ...(needsEmptyExport\n ? [\n // Put an empty export {}; at the bottom to force TypeScript to treat the script as a module\n factory.createExportDeclaration(\n undefined, // ModifierLike[] | undefined\n false, // isTypeOnly\n factory.createNamedExports([]), // NamedExportBindings | undefined\n undefined, // moduleSpecifier\n undefined, // attributes\n ),\n ]\n : []),\n ]);\n }\n return node;\n });\n };\n\n const sourceFile = createSourceFile('index.ts', source, ScriptTarget.ESNext, /* setParentNodes */ true);\n\n const result = transform(sourceFile, [transformer]);\n return createPrinter(PRINTER_OPTIONS).printNode(EmitHint.Unspecified, result.transformed[0], sourceFile);\n}\n\n/**\n * Takes the global declarations for a TypeScript and wraps export statements in `declare global`\n *\n * @param decl The untransformed global declarations\n */\nexport function transformGlobalDeclarations(decl: string): string {\n const transformer: TransformerFactory<SourceFile> = (_context: TransformationContext): any => {\n return (sourceFile: SourceFile) =>\n visitNode(sourceFile, (node: SourceFile): SourceFile => {\n if (isSourceFile(node)) {\n // All non-export-statements stay at the root level, the rest is wrapped in `declare global`\n const exportStatements = node.statements.filter(\n // @ts-expect-error s should have modifiers\n s => s.modifiers?.some(m => m.kind === SyntaxKind.ExportKeyword),\n );\n const otherStatements = node.statements.filter(s => !exportStatements.includes(s));\n\n const hasExportStatements = exportStatements.length > 0;\n const hasImport = otherStatements.some(s => isImportDeclaration(s) || isImportEqualsDeclaration(s));\n\n return factory.updateSourceFile(node, [\n ...otherStatements,\n ...(hasExportStatements\n ? [wrapInDeclareGlobal(exportStatements.map(s => removeDeclareModifier(s)))]\n : []),\n ...(hasImport\n ? [] // If there is an import, the script is already treated as a module\n : [\n // Otherwise, put an empty export {}; at the bottom to force TypeScript to treat the script as a module\n factory.createExportDeclaration(\n undefined,\n false,\n factory.createNamedExports([]),\n undefined,\n undefined,\n ),\n ]),\n ]);\n }\n\n return node;\n });\n };\n\n const sourceFile = createSourceFile('index.d.ts', decl, ScriptTarget.ESNext, /* setParentNodes */ true);\n\n const result = transform(sourceFile, [transformer]);\n return createPrinter(PRINTER_OPTIONS).printNode(EmitHint.Unspecified, result.transformed[0], sourceFile);\n}\n\n/**\n * Translates a script ID to a filename for the compiler\n *\n * @param scriptID The ID of the script\n */\nexport function scriptIdToTSFilename(scriptID: string): string {\n return `${scriptID.replace(/^script.js./, '').replace(/\\./g, '/')}.ts`;\n}\n"]}
package/build/main.js CHANGED
@@ -89,7 +89,11 @@ const crypto_1 = require("./lib/crypto");
89
89
  /**
90
90
  * List of forbidden Locations for a mirror directory
91
91
  * relative to the default data directory
92
- * ATTENTION: the same list is also located in index_m.html!!
92
+ *
93
+ * ATTENTION: the same list is also in the `validator` of `mirrorPath` in `admin/jsonConfig.json`,
94
+ * which rejects such a path before it is saved. That one has to assume the default installation
95
+ * directory, because the browser cannot know where the data directory of the host is - so this check
96
+ * here is the authoritative one and stays.
93
97
  */
94
98
  const forbiddenMirrorLocations = [
95
99
  'backup-objects',
@@ -982,7 +986,7 @@ class JavaScript extends adapter_core_1.Adapter {
982
986
  const typings = {};
983
987
  // try to load TypeScript lib files from disk
984
988
  try {
985
- const typescriptLibs = (0, typescriptTools_1.resolveTypescriptLibs)(typescriptSettings_1.targetTsLib);
989
+ const typescriptLibs = (0, typescriptTools_1.resolveTypescriptLibs)((0, typescriptSettings_1.getTargetTsLib)(this.config));
986
990
  Object.assign(typings, typescriptLibs);
987
991
  }
988
992
  catch {
@@ -1546,6 +1550,9 @@ class JavaScript extends adapter_core_1.Adapter {
1546
1550
  this.activeStr = `${this.namespace}.scriptEnabled.`;
1547
1551
  this.mods.fs = new protectFs_1.default(this.log, (0, adapter_core_1.getAbsoluteDefaultDataDir)());
1548
1552
  this.mods['fs/promises'] = this.mods.fs.promises; // to avoid require('fs/promises');
1553
+ // The instance configuration is only available now, so the compiler has to be created again
1554
+ // with the options the user has selected in the "TypeScript" tab
1555
+ this.tsServer = new virtual_tsc_1.Server((0, typescriptSettings_1.getTsCompilerOptions)(this.config), this.tsLog);
1549
1556
  // try to read TS declarations
1550
1557
  try {
1551
1558
  tsAmbient = {
@@ -1794,9 +1801,7 @@ class JavaScript extends adapter_core_1.Adapter {
1794
1801
  }
1795
1802
  }
1796
1803
  for (const pkg of packages) {
1797
- let pkgTypings = (0, typescriptTools_1.resolveTypings)(pkg, this.getAdapterScopedPackageIdentifier ? this.getAdapterScopedPackageIdentifier(pkg) : pkg,
1798
- // node needs ambient typings, so we don't wrap it in declare module
1799
- pkg !== 'node');
1804
+ let pkgTypings = (0, typescriptTools_1.resolveTypings)(pkg, this.getAdapterScopedPackageIdentifier ? this.getAdapterScopedPackageIdentifier(pkg) : pkg);
1800
1805
  if (!pkgTypings) {
1801
1806
  // Create the empty dummy declarations so users don't get the "not found" error
1802
1807
  // for installed packages