-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use dynamic import for external JS
- Loading branch information
Showing
14 changed files
with
712 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
...nal_converters/mock-external-converter.js → ...converters/cjs/mock-external-converter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
test/assets/external_converters/mjs/mock-external-converter-multiple.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default [ | ||
{ | ||
mock: 1, | ||
model: 'external_converters_device_1', | ||
zigbeeModel: ['external_converter_device_1'], | ||
vendor: 'external_1', | ||
description: 'external_1', | ||
fromZigbee: [], | ||
toZigbee: [], | ||
exposes: [], | ||
}, | ||
{ | ||
mock: 2, | ||
model: 'external_converters_device_2', | ||
zigbeeModel: ['external_converter_device_2'], | ||
vendor: 'external_2', | ||
description: 'external_2', | ||
fromZigbee: [], | ||
toZigbee: [], | ||
exposes: [], | ||
}, | ||
]; |
12 changes: 12 additions & 0 deletions
12
test/assets/external_converters/mjs/mock-external-converter.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {posix} from 'node:path'; | ||
|
||
export default { | ||
mock: true, | ||
zigbeeModel: ['external_converter_device'], | ||
vendor: 'external', | ||
model: 'external_converter_device', | ||
description: posix.join('external', 'converter'), | ||
fromZigbee: [], | ||
toZigbee: [], | ||
exposes: [], | ||
}; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Example2 { | ||
constructor(zigbee, mqtt, state, publishEntityState, eventBus) { | ||
this.mqtt = mqtt; | ||
this.mqtt.publish('example2/extension', 'call2 from constructor'); | ||
} | ||
|
||
start() { | ||
this.mqtt.publish('example2/extension', 'call2 from start'); | ||
} | ||
|
||
stop() { | ||
this.mqtt.publish('example/extension', 'call2 from stop'); | ||
} | ||
} | ||
|
||
export default Example2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Example { | ||
constructor(zigbee, mqtt, state, publishEntityState, eventBus) { | ||
this.mqtt = mqtt; | ||
this.mqtt.publish('example/extension', 'call from constructor'); | ||
} | ||
|
||
start() { | ||
this.mqtt.publish('example/extension', 'call from start'); | ||
} | ||
|
||
stop() { | ||
this.mqtt.publish('example/extension', 'call from stop'); | ||
} | ||
} | ||
|
||
export default Example; |
Oops, something went wrong.