Open orangecoding opened 2 years ago
What version are you trying this with? The package is supposedly compatible with ESM and CommonJS, I have done some testing on this from the typescript
branch, but it is a complete minefield with these settings in package.json
and a continuous moving target currently.
If you can provide more context as to where and how you are trying to consume this as ESM then I can validate and test against this in the future updates.
Same for me, it's saying
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import 'node_modules/node-hue-api/dist/esm/api/discovery' is not supported resolving ES modules imported from node_modules/node-hue-api/dist/esm/index.js
at new NodeError (node:internal/errors:371:5)
at finalizeResolution (node:internal/modules/esm/resolve:414:17)
at moduleResolve (node:internal/modules/esm/resolve:981:10)
at defaultResolve (node:internal/modules/esm/resolve:1078:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///node-hue-api/dist/esm/api/discovery'
}
when I try to import anything. Node v16.14.0
I ran into this exact problem, so +1. This branch shows this problem, wherein just by importing the library, I get the above error.
Looking into this example you provided, adding --experimental-specifier-resolution=node
to the start
script allowed the library to load correctly using the esm module variant. The code then has errors as there is no default export, but with some minor tweaks it would run in the example branch you provided.
--experimental-specifier-resolution=node
did not work for me with Node v19.0.0.
What worked was using this custom loader: https://github.com/nodejs/loaders-test/tree/main/commonjs-extension-resolution-loader, e.g. node --loader=./loader.js app.js
However, it seems the issue is because Mandatory file extensions is not followed, i.e. relative imports don't specify file extensions. Adding .js
to all relative imports, as well as fully specifying directory indexes fixes the issue as well.
The invalid JavaScript is emitted by TypeScript and there's a discussion about that here: https://github.com/microsoft/TypeScript/issues/42151
Seems like the only viable solution today is to add the .js
extension to all relative imports in TypeScript. TypeScript will understand and will then emit valid JavaScript. It's also documented in the TypeScript docs: https://www.typescriptlang.org/docs/handbook/esm-node.html
Unfortunately I couldn't get it to work at all as is... (using js
exlusively)
It seems we have to go through the complete source and add .js
extensions to all relative import
statements (as @Saduff already stated).
Did anyone find a solution for this? Or will there be a fix? (I'm using v5 beta 15
on node 19.6
.
Are you loading the cjs
or esm
variant? So I can work out how I might resolve this.
Oh yes - sorry... I'm trying to use the esm
variant using imports
and have everything setup as type="module"
The problem seems to only occur, if you run js
instead of ts
I have done a "quick" pass on this with Node 19 and the refactoring required and using it within another project as a module and it works, but it is no longer backward compatible with Node.js 18.
Also some of the libraries start to generate issues between commonjs and ESmodules...
I think this would require a line in the sand and conversion to Node.js 19 and ESmodule for the whole library to make the work, Not to mention a lot of work to convert the tests into TypeScript as that is also causing issues.
I have parked the changes on this branch for now; https://github.com/peter-murray/node-hue-api/tree/esmodule if you get the time to check if that works under your use cases, it would help me to decide if this is a sensible direction.
I have to work out what the path forward looks like for the updated library as Hue have started to push towards to the new CLIP v2 version now (although it is still missing some functionality, it brings more features).
It seems the branch is missing something. All I get when trying to build is this error:
...node-hue-api/src/customTypings/node-dns-sd.d.ts' not found.
The file is in the program because:
Part of 'files' list in tsconfig.json
tsconfig.json:17:5
17 "src/customTypings/node-dns-sd.d.ts"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File is matched by 'files' list specified here.
Found 1 error.
Apologies, the .gitignore file excluded the custom type definition I needed to add, please try again now that I have forcibly added it,
@peter-murray this one builds fine and now it works as esm
modules!!
Great & thanks!
If I can help you with anything on this project, just drop me a note.
I'm mostly eager to try out the eventstream
API to see if that improves the picky bridge's replies
@peter-murray I just did a fresh start from scratch using the esmodule
branch.
It still doesn't work properly for me.
Here's a detailed STR:
npm init
npm install "https://github.com/peter-murray/node-hue-api.git#esmodule" --save
cd node_modules/node-hue-api/
npm install
npm run build
logs this:
node-hue-api@5.0.0-beta.16 build
> tsc -p tsconfig.json && tsc -p tsconfig_esm.json
src/v3.ts:9:7 - error TS2742: The inferred type of 'v3' cannot be named without a reference to 'node-hue-api/node_modules/@peter-murray/hue-bridge-model/dist/esm/time.js'. This is likely not portable. A type annotation is necessary.
9 const v3 = {
~~
Found 1 error in src/v3.ts:9
Isn't that supposed to work?
patch for current version to be runnable in esm environment:
diff --git a/node_modules/node-hue-api/dist/esm/ApiError.js b/node_modules/node-hue-api/dist/esm/ApiError.js
index b4058d2..9a55c22 100644
--- a/node_modules/node-hue-api/dist/esm/ApiError.js
+++ b/node_modules/node-hue-api/dist/esm/ApiError.js
@@ -1,4 +1,4 @@
-import { HueError } from './HueError';
+import { HueError } from './HueError.js';
export class ApiError extends Error {
constructor(message, error) {
if (message instanceof HueError) {
diff --git a/node_modules/node-hue-api/dist/esm/api/Api.js b/node_modules/node-hue-api/dist/esm/api/Api.js
index d052e1b..01ed930 100644
--- a/node_modules/node-hue-api/dist/esm/api/Api.js
+++ b/node_modules/node-hue-api/dist/esm/api/Api.js
@@ -1,16 +1,16 @@
-import { Remote } from './Remote';
-import { Cache } from './Cache';
-import { HueApiConfig } from './HueApiConfig';
-import { Capabilities } from './Capabilities';
-import { Configuration } from './Configuration';
-import { Groups } from './Groups';
-import { Lights } from './Lights';
-import { ResourceLinks } from './ResourceLinks';
-import { Rules } from './Rules';
-import { Scenes } from './Scenes';
-import { Schedules } from './Schedules';
-import { Sensors } from './Sensors';
-import { Users } from './Users';
+import { Remote } from './Remote.js';
+import { Cache } from './Cache.js';
+import { HueApiConfig } from './HueApiConfig.js';
+import { Capabilities } from './Capabilities.js';
+import { Configuration } from './Configuration.js';
+import { Groups } from './Groups.js';
+import { Lights } from './Lights.js';
+import { ResourceLinks } from './ResourceLinks.js';
+import { Rules } from './Rules.js';
+import { Scenes } from './Scenes.js';
+import { Schedules } from './Schedules.js';
+import { Sensors } from './Sensors.js';
+import { Users } from './Users.js';
export class Api {
constructor(config, transport, rateLimits, remote) {
this._lastSyncTime = -1;
diff --git a/node_modules/node-hue-api/dist/esm/api/Cache.js b/node_modules/node-hue-api/dist/esm/api/Cache.js
index 756e2bd..6d77dc0 100644
--- a/node_modules/node-hue-api/dist/esm/api/Cache.js
+++ b/node_modules/node-hue-api/dist/esm/api/Cache.js
@@ -1,5 +1,5 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { LightIdPlaceholder } from './placeholders/LightIdPlaceholder';
+import { LightIdPlaceholder } from './placeholders/LightIdPlaceholder.js';
const LIGHT_ID_PLACEHOLDER = new LightIdPlaceholder();
export class Cache {
constructor(data) {
diff --git a/node_modules/node-hue-api/dist/esm/api/Capabilities.js b/node_modules/node-hue-api/dist/esm/api/Capabilities.js
index 09e19d1..3965ccd 100644
--- a/node_modules/node-hue-api/dist/esm/api/Capabilities.js
+++ b/node_modules/node-hue-api/dist/esm/api/Capabilities.js
@@ -1,5 +1,5 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { capabilitiesApi } from './http/endpoints/capabilities';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { capabilitiesApi } from './http/endpoints/capabilities.js';
export class Capabilities extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/Configuration.js b/node_modules/node-hue-api/dist/esm/api/Configuration.js
index e39abf2..def0561 100644
--- a/node_modules/node-hue-api/dist/esm/api/Configuration.js
+++ b/node_modules/node-hue-api/dist/esm/api/Configuration.js
@@ -1,5 +1,5 @@
-import { configurationApi } from './http/endpoints/configuration';
-import { ApiDefinition } from './http/ApiDefinition';
+import { configurationApi } from './http/endpoints/configuration.js';
+import { ApiDefinition } from './http/ApiDefinition.js';
export class Configuration extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/Groups.js b/node_modules/node-hue-api/dist/esm/api/Groups.js
index b2bdf12..b0c222d 100644
--- a/node_modules/node-hue-api/dist/esm/api/Groups.js
+++ b/node_modules/node-hue-api/dist/esm/api/Groups.js
@@ -1,6 +1,6 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { groupsApi } from './http/endpoints/groups';
-import { HueRateLimiter } from './HueRateLimiter';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { groupsApi } from './http/endpoints/groups.js';
+import { HueRateLimiter } from './HueRateLimiter.js';
export class Groups extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/HueApiConfig.js b/node_modules/node-hue-api/dist/esm/api/HueApiConfig.js
index 2ea4d1a..efaff1f 100644
--- a/node_modules/node-hue-api/dist/esm/api/HueApiConfig.js
+++ b/node_modules/node-hue-api/dist/esm/api/HueApiConfig.js
@@ -1,4 +1,4 @@
-import { ApiError } from '../ApiError';
+import { ApiError } from '../ApiError.js';
export class HueApiConfig {
constructor(config, transport, remoteApi) {
this._config = config;
diff --git a/node_modules/node-hue-api/dist/esm/api/HueRateLimiter.js b/node_modules/node-hue-api/dist/esm/api/HueRateLimiter.js
index 0f3e67c..0b8a5d9 100644
--- a/node_modules/node-hue-api/dist/esm/api/HueRateLimiter.js
+++ b/node_modules/node-hue-api/dist/esm/api/HueRateLimiter.js
@@ -1,5 +1,5 @@
import Bottleneck from 'bottleneck';
-import { HueApiRateLimitLogger } from './HueApiRateLimitLogger';
+import { HueApiRateLimitLogger } from './HueApiRateLimitLogger.js';
export class HueRateLimiter {
constructor(bridgeName, name, rateLimit) {
this.id = 0;
diff --git a/node_modules/node-hue-api/dist/esm/api/Lights.js b/node_modules/node-hue-api/dist/esm/api/Lights.js
index 86e7d75..e342479 100644
--- a/node_modules/node-hue-api/dist/esm/api/Lights.js
+++ b/node_modules/node-hue-api/dist/esm/api/Lights.js
@@ -1,8 +1,8 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { ApiError } from '../ApiError';
-import { lightsApi } from './http/endpoints/lights';
-import { LightIdPlaceholder } from './placeholders/LightIdPlaceholder';
-import { HueRateLimiter } from './HueRateLimiter';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { ApiError } from '../ApiError.js';
+import { lightsApi } from './http/endpoints/lights.js';
+import { LightIdPlaceholder } from './placeholders/LightIdPlaceholder.js';
+import { HueRateLimiter } from './HueRateLimiter.js';
const LIGHT_ID_PARSER = new LightIdPlaceholder();
export class Lights extends ApiDefinition {
constructor(hueApi) {
diff --git a/node_modules/node-hue-api/dist/esm/api/Remote.js b/node_modules/node-hue-api/dist/esm/api/Remote.js
index 793bdbd..2b13d15 100644
--- a/node_modules/node-hue-api/dist/esm/api/Remote.js
+++ b/node_modules/node-hue-api/dist/esm/api/Remote.js
@@ -1,4 +1,4 @@
-import { ApiError } from '../ApiError';
+import { ApiError } from '../ApiError.js';
export class Remote {
constructor(hueApi) {
this._hueApi = hueApi;
diff --git a/node_modules/node-hue-api/dist/esm/api/ResourceLinks.js b/node_modules/node-hue-api/dist/esm/api/ResourceLinks.js
index c2b192c..18cdbb0 100644
--- a/node_modules/node-hue-api/dist/esm/api/ResourceLinks.js
+++ b/node_modules/node-hue-api/dist/esm/api/ResourceLinks.js
@@ -1,5 +1,5 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { resourceLinksApi } from './http/endpoints/resourceLinks';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { resourceLinksApi } from './http/endpoints/resourceLinks.js';
export class ResourceLinks extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/Rules.js b/node_modules/node-hue-api/dist/esm/api/Rules.js
index 9cd107f..6bb9f10 100644
--- a/node_modules/node-hue-api/dist/esm/api/Rules.js
+++ b/node_modules/node-hue-api/dist/esm/api/Rules.js
@@ -1,5 +1,5 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { rulesApi } from './http/endpoints/rules';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { rulesApi } from './http/endpoints/rules.js';
export class Rules extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/Scenes.js b/node_modules/node-hue-api/dist/esm/api/Scenes.js
index b96ed1d..5cd6949 100644
--- a/node_modules/node-hue-api/dist/esm/api/Scenes.js
+++ b/node_modules/node-hue-api/dist/esm/api/Scenes.js
@@ -1,6 +1,6 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { scenesApi } from './http/endpoints/scenes';
-import { SceneIdPlaceholder } from './placeholders/SceneIdPlaceholder';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { scenesApi } from './http/endpoints/scenes.js';
+import { SceneIdPlaceholder } from './placeholders/SceneIdPlaceholder.js';
import { model } from '@peter-murray/hue-bridge-model';
const SCENE_ID_PLACEHOLDER = new SceneIdPlaceholder();
export class Scenes extends ApiDefinition {
diff --git a/node_modules/node-hue-api/dist/esm/api/Schedules.js b/node_modules/node-hue-api/dist/esm/api/Schedules.js
index 96bb19a..be5018f 100644
--- a/node_modules/node-hue-api/dist/esm/api/Schedules.js
+++ b/node_modules/node-hue-api/dist/esm/api/Schedules.js
@@ -1,5 +1,5 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { schedulesApi } from './http/endpoints/schedules';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { schedulesApi } from './http/endpoints/schedules.js';
export class Schedules extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/Sensors.js b/node_modules/node-hue-api/dist/esm/api/Sensors.js
index cecfc7c..4bb1adf 100644
--- a/node_modules/node-hue-api/dist/esm/api/Sensors.js
+++ b/node_modules/node-hue-api/dist/esm/api/Sensors.js
@@ -1,5 +1,5 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { sensorsApi } from './http/endpoints/sensors';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { sensorsApi } from './http/endpoints/sensors.js';
export class Sensors extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/Users.js b/node_modules/node-hue-api/dist/esm/api/Users.js
index d98463e..38946d5 100644
--- a/node_modules/node-hue-api/dist/esm/api/Users.js
+++ b/node_modules/node-hue-api/dist/esm/api/Users.js
@@ -1,5 +1,5 @@
-import { ApiDefinition } from './http/ApiDefinition';
-import { configurationApi } from './http/endpoints/configuration';
+import { ApiDefinition } from './http/ApiDefinition.js';
+import { configurationApi } from './http/endpoints/configuration.js';
export class Users extends ApiDefinition {
constructor(hueApi) {
super(hueApi);
diff --git a/node_modules/node-hue-api/dist/esm/api/discovery/bridge-validation.js b/node_modules/node-hue-api/dist/esm/api/discovery/bridge-validation.js
index b3d0438..d88b99a 100644
--- a/node_modules/node-hue-api/dist/esm/api/discovery/bridge-validation.js
+++ b/node_modules/node-hue-api/dist/esm/api/discovery/bridge-validation.js
@@ -1,5 +1,5 @@
-import { request } from '../http/HttpClientFetch';
-import { ApiError } from '../../ApiError';
+import { request } from '../http/HttpClientFetch.js';
+import { ApiError } from '../../ApiError.js';
const FRIENDLY_NAME = /<friendlyName>(.*)<\/friendlyName/sm, MODEL_NAME = /<modelName>(.*)<\/modelName/sm, MODEL_NUMBER = /<modelNumber>(.*)<\/modelNumber/sm, MODEL_DESCRIPTION = /<modelDescription>(.*)<\/modelDescription>/sm, MANUFACTURER = /<manufacturer>(.*)<\/manufacturer>/sm, SERIAL_NUMBER = /<serialNumber>(.*)<\/serialNumber/sm, IP_ADDRESS = /<URLBase>http[s]?:\/\/(.*):.*<\/URLBase/sm, SPEC_VERSION = /<specVersion>.*<major>(.*)<\/.*<minor>(.*)<\/.*<\/specVersion/sm, ICON_LIST = /<iconList>(.*)<\/iconList>/sm, ICON_MIME_TYPE = /<mimetype>(.*)<\/mimetype>/sm, ICON_HEIGHT = /<height>(.*)<\/height>/sm, ICON_WIDTH = /<width>(.*)<\/width>/sm, ICON_DEPTH = /<depth>(.*)<\/depth>/sm, ICON_URL = /<url>(.*)<\/url>/sm;
const DATA_TIMEOUT = 6000;
export function getBridgeConfig(bridge, timeout) {
diff --git a/node_modules/node-hue-api/dist/esm/api/discovery/index.js b/node_modules/node-hue-api/dist/esm/api/discovery/index.js
index a4e5175..40084c2 100644
--- a/node_modules/node-hue-api/dist/esm/api/discovery/index.js
+++ b/node_modules/node-hue-api/dist/esm/api/discovery/index.js
@@ -1,6 +1,6 @@
-import * as bridgeValidator from './bridge-validation';
-import { nupnp } from './nupnp';
-import { mDNSSearch } from './mDNS';
+import * as bridgeValidator from './bridge-validation.js';
+import { nupnp } from './nupnp.js';
+import { mDNSSearch } from './mDNS.js';
export function mdnsSearch(timeout) {
const mDNSearch = new mDNSSearch();
return mDNSearch.search(timeout)
diff --git a/node_modules/node-hue-api/dist/esm/api/discovery/mDNS.js b/node_modules/node-hue-api/dist/esm/api/discovery/mDNS.js
index 6c8a0d7..6add838 100644
--- a/node_modules/node-hue-api/dist/esm/api/discovery/mDNS.js
+++ b/node_modules/node-hue-api/dist/esm/api/discovery/mDNS.js
@@ -1,4 +1,4 @@
-const mDnsSd = require('node-dns-sd');
+import mDnsSd from 'node-dns-sd';
export class mDNSSearch {
constructor() {
}
diff --git a/node_modules/node-hue-api/dist/esm/api/discovery/nupnp.js b/node_modules/node-hue-api/dist/esm/api/discovery/nupnp.js
index d4332cb..73aa522 100644
--- a/node_modules/node-hue-api/dist/esm/api/discovery/nupnp.js
+++ b/node_modules/node-hue-api/dist/esm/api/discovery/nupnp.js
@@ -1,6 +1,6 @@
-import { request } from '../http/HttpClientFetch';
-import { getDiscoveryMeetHueHttpsAgent } from './ca-chain';
-import { ApiError } from '../../ApiError';
+import { request } from '../http/HttpClientFetch.js';
+import { getDiscoveryMeetHueHttpsAgent } from './ca-chain.js';
+import { ApiError } from '../../ApiError.js';
export function nupnp() {
return request({
url: 'https://discovery.meethue.com',
diff --git a/node_modules/node-hue-api/dist/esm/api/http/HttpClientFetch.js b/node_modules/node-hue-api/dist/esm/api/http/HttpClientFetch.js
index 2c832fa..3eb7df0 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/HttpClientFetch.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/HttpClientFetch.js
@@ -1,6 +1,6 @@
import fetch from 'node-fetch';
import { URLSearchParams } from 'url';
-import HttpError from './HttpError';
+import HttpError from './HttpError.js';
export class HttpClientFetch {
constructor(config) {
this._config = config || {};
diff --git a/node_modules/node-hue-api/dist/esm/api/http/LocalBootstrap.js b/node_modules/node-hue-api/dist/esm/api/http/LocalBootstrap.js
index 0dcb508..7af2f16 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/LocalBootstrap.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/LocalBootstrap.js
@@ -1,10 +1,10 @@
import * as https from 'https';
-import { Api } from '../Api';
-import * as httpClient from './HttpClientFetch';
-import { ApiError } from '../../ApiError';
-import { Transport } from './Transport';
-import { getSSLCertificate } from './sslCertificate';
-import { cleanHostname, getHttpsUrl } from './urlUtil';
+import { Api } from '../Api.js';
+import * as httpClient from './HttpClientFetch.js';
+import { ApiError } from '../../ApiError.js';
+import { Transport } from './Transport.js';
+import { getSSLCertificate } from './sslCertificate.js';
+import { cleanHostname, getHttpsUrl } from './urlUtil.js';
const DEBUG = /node-hue-api/.test(process.env.NODE_DEBUG || '');
const INITIAL_HTTPS_AGENT = new https.Agent({
rejectUnauthorized: false
diff --git a/node_modules/node-hue-api/dist/esm/api/http/LocalInsecureBootstrap.js b/node_modules/node-hue-api/dist/esm/api/http/LocalInsecureBootstrap.js
index 865fab5..d77c45c 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/LocalInsecureBootstrap.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/LocalInsecureBootstrap.js
@@ -1,7 +1,7 @@
-import { Transport } from './Transport';
-import { Api } from '../Api';
-import { request, create } from './HttpClientFetch';
-import { getHttpUrl } from './urlUtil';
+import { Transport } from './Transport.js';
+import { Api } from '../Api.js';
+import { request, create } from './HttpClientFetch.js';
+import { getHttpUrl } from './urlUtil.js';
const SUPPRESS_WARNING = process.env.NODE_HUE_API_USE_INSECURE_CONNECTION != null;
export class LocalInsecureBootstrap {
constructor(hostname, rateLimits, port) {
diff --git a/node_modules/node-hue-api/dist/esm/api/http/RemoteApi.js b/node_modules/node-hue-api/dist/esm/api/http/RemoteApi.js
index a493f91..c24b25b 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/RemoteApi.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/RemoteApi.js
@@ -1,7 +1,7 @@
-import * as httpClient from './HttpClientFetch';
-import { ApiError } from '../../ApiError';
-import { OAuthTokens } from './OAuthTokens';
-import { wasSuccessful } from '../../util';
+import * as httpClient from './HttpClientFetch.js';
+import { ApiError } from '../../ApiError.js';
+import { OAuthTokens } from './OAuthTokens.js';
+import { wasSuccessful } from '../../util.js';
import { createHash } from 'crypto';
// This class is a bit different to the other endpoints currently as they operate in a digest challenge for the most
// part and also operate off a different base url compared with the local/remote endpoints that make up the rest of the
diff --git a/node_modules/node-hue-api/dist/esm/api/http/RemoteBootstrap.js b/node_modules/node-hue-api/dist/esm/api/http/RemoteBootstrap.js
index 1853c64..fdb4116 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/RemoteBootstrap.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/RemoteBootstrap.js
@@ -1,7 +1,7 @@
-import { create } from './HttpClientFetch';
-import { RemoteApi } from './RemoteApi';
-import { Api } from '../Api';
-import { Transport } from './Transport';
+import { create } from './HttpClientFetch.js';
+import { RemoteApi } from './RemoteApi.js';
+import { Api } from '../Api.js';
+import { Transport } from './Transport.js';
export class RemoteBootstrap {
constructor(clientId, clientSecret, rateLimits) {
this.clientId = clientId;
diff --git a/node_modules/node-hue-api/dist/esm/api/http/Transport.js b/node_modules/node-hue-api/dist/esm/api/http/Transport.js
index f03e6d5..1a696da 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/Transport.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/Transport.js
@@ -1,7 +1,7 @@
-import { ApiError } from '../../ApiError';
-import { parseErrors } from '../../util';
-import { HueError } from '../../HueError';
-import { HueRateLimiter } from '../HueRateLimiter';
+import { ApiError } from '../../ApiError.js';
+import { parseErrors } from '../../util.js';
+import { HueError } from '../../HueError.js';
+import { HueRateLimiter } from '../HueRateLimiter.js';
export class Transport {
constructor(client, rateLimiterConfig, username) {
this._username = username;
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/ApiEndpoint.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/ApiEndpoint.js
index ae92c43..fd27fa4 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/ApiEndpoint.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/ApiEndpoint.js
@@ -1,4 +1,4 @@
-import { UsernamePlaceholder } from '../../placeholders/UsernamePlaceholder';
+import { UsernamePlaceholder } from '../../placeholders/UsernamePlaceholder.js';
const DEBUG = /node-hue-api/.test(process.env['NODE_DEBUG'] || '');
export class ApiEndpoint {
// private _version?: string;
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/capabilities.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/capabilities.js
index 7026969..88397a0 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/capabilities.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/capabilities.js
@@ -1,4 +1,4 @@
-import { ApiEndpoint } from './ApiEndpoint';
+import { ApiEndpoint } from './ApiEndpoint.js';
import { model } from '@peter-murray/hue-bridge-model';
function getAllCapabilities() {
return new ApiEndpoint()
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/configuration.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/configuration.js
index b893bfa..29dd571 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/configuration.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/configuration.js
@@ -1,8 +1,8 @@
-import { ApiEndpoint } from './ApiEndpoint';
-import { UsernamePlaceholder } from '../../placeholders/UsernamePlaceholder';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { UsernamePlaceholder } from '../../placeholders/UsernamePlaceholder.js';
import { model } from '@peter-murray/hue-bridge-model';
-import { ApiError } from '../../../ApiError';
-import { wasSuccessful } from '../../../util';
+import { ApiError } from '../../../ApiError.js';
+import { wasSuccessful } from '../../../util.js';
const instanceChecks = model.instanceChecks;
const configurationApi = {
createUser: new ApiEndpoint()
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/groups.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/groups.js
index 9bc0ea4..c5d06fc 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/groups.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/groups.js
@@ -1,8 +1,8 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { ApiEndpoint } from './ApiEndpoint';
-import { GroupIdPlaceholder } from '../../placeholders/GroupIdPlaceholder';
-import { ApiError } from '../../../ApiError';
-import { parseErrors, wasSuccessful } from '../../../util';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { GroupIdPlaceholder } from '../../placeholders/GroupIdPlaceholder.js';
+import { ApiError } from '../../../ApiError.js';
+import { parseErrors, wasSuccessful } from '../../../util.js';
const GroupState = model.GroupState, instanceChecks = model.instanceChecks;
const GROUP_ID_PLACEHOLDER = new GroupIdPlaceholder();
const groupsApi = {
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/lights.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/lights.js
index 96eee12..431a2d4 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/lights.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/lights.js
@@ -1,9 +1,9 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { LightIdPlaceholder } from '../../placeholders/LightIdPlaceholder';
-import { ApiEndpoint } from './ApiEndpoint';
-import { rgbToXY } from '../../../rgb';
-import { ApiError } from '../../../ApiError';
-import { parseErrors, wasSuccessful } from '../../../util';
+import { LightIdPlaceholder } from '../../placeholders/LightIdPlaceholder.js';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { rgbToXY } from '../../../rgb.js';
+import { ApiError } from '../../../ApiError.js';
+import { parseErrors, wasSuccessful } from '../../../util.js';
const LIGHT_ID_PLACEHOLDER = new LightIdPlaceholder();
const lightsApi = {
getAllLights: new ApiEndpoint()
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/resourceLinks.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/resourceLinks.js
index 0fdf0cb..ea32c9f 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/resourceLinks.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/resourceLinks.js
@@ -1,8 +1,8 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util';
-import { ResourceLinkPlaceholder } from '../../placeholders/ResourceLinkPlaceholder';
-import { ApiEndpoint } from './ApiEndpoint';
-import { ApiError } from '../../../ApiError';
+import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util.js';
+import { ResourceLinkPlaceholder } from '../../placeholders/ResourceLinkPlaceholder.js';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { ApiError } from '../../../ApiError.js';
const instanceChecks = model.instanceChecks;
const RESOURCELINK_PLACEHOLDER = new ResourceLinkPlaceholder();
const resourceLinksApi = {
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/rules.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/rules.js
index 8fc8cba..39d9b59 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/rules.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/rules.js
@@ -1,8 +1,8 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { RuleIdPlaceholder } from '../../placeholders/RuleIdPlaceholder';
-import { ApiEndpoint } from './ApiEndpoint';
-import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util';
-import { ApiError } from '../../../ApiError';
+import { RuleIdPlaceholder } from '../../placeholders/RuleIdPlaceholder.js';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util.js';
+import { ApiError } from '../../../ApiError.js';
const instanceChecks = model.instanceChecks;
const RULE_ID_PLACEHOLDER = new RuleIdPlaceholder();
const rulesApi = {
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/scenes.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/scenes.js
index ab994b8..c192f9e 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/scenes.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/scenes.js
@@ -1,9 +1,9 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util';
-import { SceneIdPlaceholder } from '../../placeholders/SceneIdPlaceholder';
-import { LightIdPlaceholder } from '../../placeholders/LightIdPlaceholder';
-import { ApiEndpoint } from './ApiEndpoint';
-import { ApiError } from '../../../ApiError';
+import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util.js';
+import { SceneIdPlaceholder } from '../../placeholders/SceneIdPlaceholder.js';
+import { LightIdPlaceholder } from '../../placeholders/LightIdPlaceholder.js';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { ApiError } from '../../../ApiError.js';
const SCENE_ID_PLACEHOLDER = new SceneIdPlaceholder();
const instanceChecks = model.instanceChecks;
const SceneLightState = model.SceneLightState;
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/schedules.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/schedules.js
index 2b76bc6..a3dd559 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/schedules.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/schedules.js
@@ -1,8 +1,8 @@
import { model, time } from '@peter-murray/hue-bridge-model';
-import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util';
-import { ApiEndpoint } from './ApiEndpoint';
-import { ScheduleIdPlaceholder } from '../../placeholders/ScheduleIdPlaceholder';
-import { ApiError } from '../../../ApiError';
+import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util.js';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { ScheduleIdPlaceholder } from '../../placeholders/ScheduleIdPlaceholder.js';
+import { ApiError } from '../../../ApiError.js';
const SCHEDULE_ID_PLACEHOLDER = new ScheduleIdPlaceholder();
const instanceChecks = model.instanceChecks;
const schedulesApi = {
diff --git a/node_modules/node-hue-api/dist/esm/api/http/endpoints/sensors.js b/node_modules/node-hue-api/dist/esm/api/http/endpoints/sensors.js
index 2b8e622..97d861f 100644
--- a/node_modules/node-hue-api/dist/esm/api/http/endpoints/sensors.js
+++ b/node_modules/node-hue-api/dist/esm/api/http/endpoints/sensors.js
@@ -1,8 +1,8 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { SensorIdPlaceholder } from '../../placeholders/SensorIdPlaceholder';
-import { ApiEndpoint } from './ApiEndpoint';
-import { ApiError } from '../../../ApiError';
-import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util';
+import { SensorIdPlaceholder } from '../../placeholders/SensorIdPlaceholder.js';
+import { ApiEndpoint } from './ApiEndpoint.js';
+import { ApiError } from '../../../ApiError.js';
+import { extractUpdatedAttributes, parseErrors, wasSuccessful } from '../../../util.js';
const SENSOR_ID_PLACEHOLDER = new SensorIdPlaceholder();
const instanceChecks = model.instanceChecks;
const sensorsApi = {
diff --git a/node_modules/node-hue-api/dist/esm/api/index.js b/node_modules/node-hue-api/dist/esm/api/index.js
index 5b133dd..8dd1722 100644
--- a/node_modules/node-hue-api/dist/esm/api/index.js
+++ b/node_modules/node-hue-api/dist/esm/api/index.js
@@ -1,7 +1,7 @@
-import { LocalBootstrap } from './http/LocalBootstrap';
-import { LocalInsecureBootstrap } from './http/LocalInsecureBootstrap';
-import { RemoteBootstrap } from './http/RemoteBootstrap';
-import { HueApiRateLimits } from './HueApiRateLimits';
+import { LocalBootstrap } from './http/LocalBootstrap.js';
+import { LocalInsecureBootstrap } from './http/LocalInsecureBootstrap.js';
+import { RemoteBootstrap } from './http/RemoteBootstrap.js';
+import { HueApiRateLimits } from './HueApiRateLimits.js';
const DEFAULT_RATE_LIMIT_CONFIG = new HueApiRateLimits();
/**
* Creates a remote bootstrap to connect with a Hue bridge remotely
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/GroupIdPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/GroupIdPlaceholder.js
index 8065048..b152943 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/GroupIdPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/GroupIdPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class GroupIdPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/LightIdPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/LightIdPlaceholder.js
index d9b4295..ecb8656 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/LightIdPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/LightIdPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class LightIdPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/Placeholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/Placeholder.js
index 39367ca..0db23aa 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/Placeholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/Placeholder.js
@@ -1,4 +1,4 @@
-import { ApiError } from '../../ApiError';
+import { ApiError } from '../../ApiError.js';
export class Placeholder {
constructor(type, defaultName, name) {
this._name = name || defaultName;
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/ResourceLinkPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/ResourceLinkPlaceholder.js
index 96f232f..3dbd884 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/ResourceLinkPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/ResourceLinkPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class ResourceLinkPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/RuleIdPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/RuleIdPlaceholder.js
index 6090217..f38fb41 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/RuleIdPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/RuleIdPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class RuleIdPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/SceneIdPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/SceneIdPlaceholder.js
index dd41e79..d0156d8 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/SceneIdPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/SceneIdPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class SceneIdPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/ScheduleIdPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/ScheduleIdPlaceholder.js
index 4908bd7..2815a76 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/ScheduleIdPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/ScheduleIdPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class ScheduleIdPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/SensorIdPlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/SensorIdPlaceholder.js
index 81dbf10..ae955a0 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/SensorIdPlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/SensorIdPlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { model, types } from '@peter-murray/hue-bridge-model';
export class SensorIdPlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/api/placeholders/UsernamePlaceholder.js b/node_modules/node-hue-api/dist/esm/api/placeholders/UsernamePlaceholder.js
index 82711ea..1dab639 100644
--- a/node_modules/node-hue-api/dist/esm/api/placeholders/UsernamePlaceholder.js
+++ b/node_modules/node-hue-api/dist/esm/api/placeholders/UsernamePlaceholder.js
@@ -1,4 +1,4 @@
-import { Placeholder } from './Placeholder';
+import { Placeholder } from './Placeholder.js';
import { types } from '@peter-murray/hue-bridge-model';
export class UsernamePlaceholder extends Placeholder {
constructor(name) {
diff --git a/node_modules/node-hue-api/dist/esm/index.js b/node_modules/node-hue-api/dist/esm/index.js
index 4a25902..b6a3fca 100644
--- a/node_modules/node-hue-api/dist/esm/index.js
+++ b/node_modules/node-hue-api/dist/esm/index.js
@@ -1,12 +1,12 @@
//
// This wrapper is to provide some continuity in the modifications of the APIs over time
//
-import * as discovery from './api/discovery';
+import * as discovery from './api/discovery/index.js';
export { discovery };
-import { ApiError } from './ApiError';
+import { ApiError } from './ApiError.js';
export { ApiError };
-export * from './v3';
-import * as api_1 from './api';
+export * from './v3.js';
+import * as api_1 from './api/index.js';
export { api_1 as api };
// Export raw implementation of bridge model
export { model, time } from '@peter-murray/hue-bridge-model';
diff --git a/node_modules/node-hue-api/dist/esm/rgb.js b/node_modules/node-hue-api/dist/esm/rgb.js
index 8e00761..a072abd 100644
--- a/node_modules/node-hue-api/dist/esm/rgb.js
+++ b/node_modules/node-hue-api/dist/esm/rgb.js
@@ -1,4 +1,4 @@
-import { ApiError } from './ApiError';
+import { ApiError } from './ApiError.js';
export function rgbToXY(rgb, colorGamut) {
if (!colorGamut) {
throw new ApiError('No color gamut provided, cannot perform conversion of RGB');
diff --git a/node_modules/node-hue-api/dist/esm/util.js b/node_modules/node-hue-api/dist/esm/util.js
index c0ac7d8..9c21b4e 100644
--- a/node_modules/node-hue-api/dist/esm/util.js
+++ b/node_modules/node-hue-api/dist/esm/util.js
@@ -1,5 +1,5 @@
-import { HueError } from './HueError';
-import { ApiError } from './ApiError';
+import { HueError } from './HueError.js';
+import { ApiError } from './ApiError.js';
const suppressDeprecationWarnings = process.env.NODE_HUE_API_SUPPRESS_DEPRICATION_WARNINGS || false;
/**
* Parses a JSON response looking for the errors in the result(s) returned.
diff --git a/node_modules/node-hue-api/dist/esm/v3.js b/node_modules/node-hue-api/dist/esm/v3.js
index a91c286..06a2a00 100644
--- a/node_modules/node-hue-api/dist/esm/v3.js
+++ b/node_modules/node-hue-api/dist/esm/v3.js
@@ -1,8 +1,8 @@
import { model } from '@peter-murray/hue-bridge-model';
-import { v3Model } from './v3Model';
-import { deprecatedFunction } from './util';
-import * as api from './api';
-import { description, nupnpSearch, mdnsSearch } from './api/discovery';
+import { v3Model } from './v3Model.js';
+import { deprecatedFunction } from './util.js';
+import * as api from './api/index.js';
+import { description, nupnpSearch, mdnsSearch } from './api/discovery/index.js';
// Definition of the v3 API for node-hue-api
const v3 = {
api: api,
@mo22 Did you apply the patch to the master-branch (installed via npm install node-hue-api
or to the esmodule
branch?
@tiptronic to node-hue-api/dist/esm in the master branch installed via npm install
@mo22 Thanks - just found out it works on the master
branch :) just fine.
Please allow me 1 question - since you're messing with Hue under NodeJS:
Do you know a reliable way finding the Hue bridge outside MeetHue
or node-hue-api
's own discovery?
I tried all kinds of pure Javascript dns-sd
, mDNS
, etc.. but once in a while the hue bridge simply isn't found
I don't understand how to use this esm patch. What do i use in "npm install ..." ?
And when installed, do i just do import { v3 } from 'node-hue-api'?
I tried to use these two on the dafault npm project: import { v3 } from 'node-hue-api' import { v3 } from 'node-hue-api/dist/esm/index.js' But both gives errors
To use the https://github.com/peter-murray/node-hue-api/issues/220#issuecomment-1646561635 you just have to copy/paste into a new file, for example hue.diff
then you execute the command like this in the root of project :
patch < hue.diff
Then your build should not have any warning anymore
PS: on my config I'm using pnpm and i just had to replace all occurrences of /node_modules/node-hue-api/dist/esm/
to /node_modules/.pnpm/node-hue-api@5.0.0-beta.16/node_modules/node-hue-api/dist/esm/
then do the patch
Thank you abalam666,
However I just had to convert to using cjs withing my esmproject, and will jsut run with that for now.
Hopefully project gets picked up and version 5 pushed out of beta with esm working out of the box in the future :)
I cannot import node-hue-api as ESM module. It would be nice if you can support both, ESM as well as Common Modules.
Thanks.