@iobroker/js-controller-adapter 6.0.1 → 6.0.2

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.
@@ -502,8 +502,8 @@ export interface InstallNodeModuleOptions {
502
502
  version: string;
503
503
  }
504
504
  export interface InternalInstallNodeModuleOptions extends InstallNodeModuleOptions {
505
- /** Name of the npm module */
506
- moduleName: string;
505
+ /** Name of the npm module or an installable url ẁorking with `npm install` */
506
+ moduleNameOrUrl: string;
507
507
  }
508
508
  export {};
509
509
  //# sourceMappingURL=_Types.d.ts.map
@@ -327,15 +327,21 @@ class AdapterClass extends import_node_events.EventEmitter {
327
327
  this.setExecutableCapabilities = import_js_controller_common.tools.setExecutableCapabilities;
328
328
  this._init();
329
329
  }
330
- installNodeModule(moduleName, options) {
331
- import_validator.Validator.assertString(moduleName, "moduleName");
330
+ installNodeModule(moduleNameOrUrl, options) {
331
+ import_validator.Validator.assertString(moduleNameOrUrl, "moduleNameOrUrl");
332
332
  import_validator.Validator.assertObject(options, "options");
333
- return this._installNodeModule({ ...options, moduleName });
333
+ return this._installNodeModule({ ...options, moduleNameOrUrl });
334
334
  }
335
- _installNodeModule(options) {
336
- const { moduleName, version } = options;
335
+ async _installNodeModule(options) {
336
+ const { moduleNameOrUrl, version } = options;
337
+ let moduleName = moduleNameOrUrl;
338
+ const isUrl = URL.canParse(moduleNameOrUrl);
339
+ if (isUrl) {
340
+ moduleName = await (0, import_utils.requestModuleNameByUrl)(moduleNameOrUrl);
341
+ }
337
342
  const internalModuleName = (0, import_utils.getAdapterScopedPackageIdentifier)({ moduleName, namespace: this.namespace });
338
- return import_js_controller_common.tools.installNodeModule(`${internalModuleName}@npm:${moduleName}@${version}`);
343
+ const packageIdentifier = isUrl ? moduleNameOrUrl : `npm:${moduleName}@${version}`;
344
+ return import_js_controller_common.tools.installNodeModule(`${internalModuleName}@${packageIdentifier}`);
339
345
  }
340
346
  listInstalledNodeModules() {
341
347
  return (0, import_utils.listInstalledNodeModules)(this.namespace);