Skip to content

Commit 29762e7

Browse files
use ESM JSON imports
1 parent f6c448d commit 29762e7

8 files changed

Lines changed: 10 additions & 23 deletions

File tree

dist/actions.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "allenheath-avantis",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"type": "module",
55
"keywords": [
66
"Software",

src/actions.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ import {
66
type CompanionOptionValues,
77
type DropdownChoice,
88
} from '@companion-module/base'
9-
import { createRequire } from 'node:module'
9+
import avantisConfig from './avantisconfig.json' with { type: 'json' }
10+
import fader from './fader.json' with { type: 'json' }
1011
import type ModuleInstance from './main.js'
1112

12-
const require = createRequire(import.meta.url)
13-
const fader = require('./fader.json') as { level: [string, string][] }
14-
const avantisConfig = require('./avantisconfig.json') as typeof import('./avantisconfig.json')
15-
1613
type ChoiceGroup = {
1714
name: string
1815
offset: number

src/main.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
type CompanionOptionValues,
55
type SomeCompanionConfigField,
66
} from '@companion-module/base'
7-
import { createRequire } from 'node:module'
87
import * as net from 'net'
98
import UpdateActions from './actions.js'
9+
import avantisConfig from './avantisconfig.json' with { type: 'json' }
1010
import { GetConfigFields, type ModuleConfig } from './config.js'
1111
import UpdateFeedbacks from './feedbacks.js'
1212
import type { ActionsSchema } from './actions.js'
@@ -15,9 +15,6 @@ import UpdatePresets from './presets.js'
1515
import { UpgradeScripts } from './upgrades.js'
1616
import UpdateVariableDefinitions, { type VariablesSchema } from './variables.js'
1717

18-
const require = createRequire(import.meta.url)
19-
const avantisConfig = require('./avantisconfig.json') as typeof import('./avantisconfig.json')
20-
2118
const PORT = 51325
2219
const SysExHeader = [0xf0, 0x00, 0x00, 0x1a, 0x50, 0x10, 0x01, 0x00]
2320
const configFields = GetConfigFields()

src/presets.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import {
44
type CompanionPresetSection,
55
type CompanionSimplePresetDefinition,
66
} from '@companion-module/base'
7-
import { createRequire } from 'node:module'
7+
import avantisConfig from './avantisconfig.json' with { type: 'json' }
88
import type ModuleInstance from './main.js'
99
import type { ModuleSchema } from './main.js'
1010

11-
const require = createRequire(import.meta.url)
12-
const avantisConfig = require('./avantisconfig.json') as typeof import('./avantisconfig.json')
13-
1411
function buildMutePreset(
1512
id: string,
1613
name: string,

0 commit comments

Comments
 (0)