@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.
- package/build/cjs/lib/_Types.d.ts +2 -2
- package/build/cjs/lib/adapter/adapter.js +12 -6
- package/build/cjs/lib/adapter/adapter.js.map +2 -2
- package/build/cjs/lib/adapter/utils.d.ts +6 -0
- package/build/cjs/lib/adapter/utils.js +11 -2
- package/build/cjs/lib/adapter/utils.js.map +2 -2
- package/build/esm/lib/_Types.d.ts +2 -2
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/adapter/adapter.d.ts.map +1 -1
- package/build/esm/lib/adapter/adapter.js +15 -9
- package/build/esm/lib/adapter/adapter.js.map +1 -1
- package/build/esm/lib/adapter/utils.d.ts +6 -0
- package/build/esm/lib/adapter/utils.d.ts.map +1 -1
- package/build/esm/lib/adapter/utils.js +13 -1
- package/build/esm/lib/adapter/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -10
|
@@ -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
|
-
|
|
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(
|
|
331
|
-
import_validator.Validator.assertString(
|
|
330
|
+
installNodeModule(moduleNameOrUrl, options) {
|
|
331
|
+
import_validator.Validator.assertString(moduleNameOrUrl, "moduleNameOrUrl");
|
|
332
332
|
import_validator.Validator.assertObject(options, "options");
|
|
333
|
-
return this._installNodeModule({ ...options,
|
|
333
|
+
return this._installNodeModule({ ...options, moduleNameOrUrl });
|
|
334
334
|
}
|
|
335
|
-
_installNodeModule(options) {
|
|
336
|
-
const {
|
|
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
|
-
|
|
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);
|