adding ha addon support
This commit is contained in:
parent
0425f6e8df
commit
b00e9a4b65
3
.gitignore → matter-bridge/.gitignore
vendored
3
.gitignore → matter-bridge/.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
deviceData
|
deviceData
|
||||||
.env
|
.env
|
||||||
|
build
|
35
matter-bridge/Dockerfile
Normal file
35
matter-bridge/Dockerfile
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
ARG BUILD_FROM=ghcr.io/hassio-addons/base:15.0.3
|
||||||
|
|
||||||
|
FROM node:18.19.0-alpine as buildbase
|
||||||
|
|
||||||
|
COPY ./package.json ./
|
||||||
|
COPY ./package-lock.json ./
|
||||||
|
COPY ./src ./src
|
||||||
|
COPY ./tsconfig.json ./
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:18.19.0-alpine as deps
|
||||||
|
|
||||||
|
COPY ./package.json ./
|
||||||
|
COPY ./package-lock.json ./
|
||||||
|
COPY ./src ./src
|
||||||
|
COPY ./tsconfig.json ./
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
|
||||||
|
FROM ${BUILD_FROM} as runenv
|
||||||
|
|
||||||
|
COPY --from=buildbase /usr/lib /usr/lib
|
||||||
|
COPY --from=buildbase /usr/local/lib /usr/local/lib
|
||||||
|
COPY --from=buildbase /usr/local/include /usr/local/include
|
||||||
|
COPY --from=buildbase /usr/local/bin /usr/local/bin
|
||||||
|
COPY --from=buildbase ./build ./build
|
||||||
|
COPY --from=deps ./node_modules ./node_modules
|
||||||
|
COPY --from=deps ./package.json ./package.json
|
||||||
|
|
||||||
|
|
||||||
|
COPY run.sh /
|
||||||
|
RUN chmod a+x /run.sh
|
||||||
|
|
||||||
|
CMD [ "/run.sh" ]
|
13
matter-bridge/config.yml
Normal file
13
matter-bridge/config.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
name: 'HA Matter Bridge'
|
||||||
|
version: '1.0.0'
|
||||||
|
slug: ha-matter-bridge
|
||||||
|
description: This project serves as a proof of concept to connect HomeAssistant devices to Voice Assistants through the Matter Protocol.
|
||||||
|
init: false
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
ports:
|
||||||
|
5540/tcp: 5540
|
||||||
|
|
||||||
|
hassio_role: admin
|
||||||
|
hassio_api: true
|
5
matter-bridge/options.yml
Normal file
5
matter-bridge/options.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
message: "settings"
|
||||||
|
settings:
|
||||||
|
- HA_HOST: localhost
|
||||||
|
HA_PORT: 8123
|
||||||
|
HA_ACCESS_TOKEN: "your acces token"
|
@ -7,7 +7,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "ha-matter-bridge",
|
"name": "ha-matter-bridge",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@project-chip/matter-node.js": "^0.7.4",
|
"@project-chip/matter-node.js": "^0.7.4",
|
||||||
"@project-chip/matter.js-tools": "^0.7.4",
|
"@project-chip/matter.js-tools": "^0.7.4",
|
@ -4,10 +4,11 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "ts-node ./src/index.ts"
|
"build": "tsc",
|
||||||
|
"start": "node ./build/index.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@project-chip/matter-node.js": "^0.7.4",
|
"@project-chip/matter-node.js": "^0.7.4",
|
||||||
"@project-chip/matter.js-tools": "^0.7.4",
|
"@project-chip/matter.js-tools": "^0.7.4",
|
||||||
@ -24,4 +25,4 @@
|
|||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
3
matter-bridge/run.sh
Normal file
3
matter-bridge/run.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
|
||||||
|
npm run start
|
5
matter-bridge/schema.yml
Normal file
5
matter-bridge/schema.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
message: str
|
||||||
|
settings:
|
||||||
|
- HA_HOST: str
|
||||||
|
HA_PORT: int
|
||||||
|
HA_ACCESS_TOKEN: str
|
@ -36,8 +36,7 @@ export class HAMiddleware {
|
|||||||
subscribe() {
|
subscribe() {
|
||||||
this.hassClient.on('state_changed', (event) => {
|
this.hassClient.on('state_changed', (event) => {
|
||||||
this.logger.debug(event);
|
this.logger.debug(event);
|
||||||
const toDo =
|
const toDo = this.functionsToCallOnChange[event.data.entity_id];
|
||||||
this.functionsToCallOnChange[event.data.entity_id];
|
|
||||||
if (toDo) {
|
if (toDo) {
|
||||||
toDo(event.data);
|
toDo(event.data);
|
||||||
}
|
}
|
32
matter-bridge/src/index.ts
Normal file
32
matter-bridge/src/index.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { getParameter } from '@project-chip/matter-node.js/util';
|
||||||
|
import { Bridge, getBridge } from './matter';
|
||||||
|
import { Logger } from '@project-chip/matter-node.js/log';
|
||||||
|
import { HAMiddleware } from './home-assistant/HAmiddleware';
|
||||||
|
import { addAllDevicesToBridge } from './mapper/Mapper';
|
||||||
|
|
||||||
|
const LOGGER = new Logger('Main');
|
||||||
|
let HA_MIDDLEWARE: HAMiddleware;
|
||||||
|
let BRIDGE: Bridge;
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
const token = getParameter('SUPERVISOR_TOKEN');
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Missing auth token cannot run without it');
|
||||||
|
}
|
||||||
|
HA_MIDDLEWARE = await HAMiddleware.getInstance({
|
||||||
|
host: 'supervisor',
|
||||||
|
token: getParameter('HA_ACCESS_TOKEN'),
|
||||||
|
});
|
||||||
|
BRIDGE = getBridge();
|
||||||
|
await addAllDevicesToBridge(HA_MIDDLEWARE, BRIDGE);
|
||||||
|
BRIDGE.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
run().then().catch(LOGGER.error);
|
||||||
|
|
||||||
|
process.on('SIGINT', () => {
|
||||||
|
HA_MIDDLEWARE.stop();
|
||||||
|
BRIDGE.stop()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((err) => LOGGER.error(err));
|
||||||
|
});
|
@ -1,12 +1,15 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { addDimmerableLightDevice, addOnOffLightDevice } from './devices/lights';
|
import {
|
||||||
import { HassEntity } from '../HA/HAssTypes';
|
addDimmerableLightDevice,
|
||||||
import { Bridge, HAMiddleware } from '.';
|
addOnOffLightDevice,
|
||||||
|
} from './devices/lights';
|
||||||
|
import { HassEntity } from '../home-assistant/HAssTypes';
|
||||||
|
import { Bridge } from '../matter';
|
||||||
import { Logger } from '@project-chip/matter-node.js/log';
|
import { Logger } from '@project-chip/matter-node.js/log';
|
||||||
|
import { HAMiddleware } from '../home-assistant/HAmiddleware';
|
||||||
|
|
||||||
const LOGGER = new Logger('Mapper');
|
const LOGGER = new Logger('Mapper');
|
||||||
|
|
||||||
|
|
||||||
const lightsMap: Map<
|
const lightsMap: Map<
|
||||||
string,
|
string,
|
||||||
(haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge) => void
|
(haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge) => void
|
14
matter-bridge/src/mapper/devices/MapperType.ts
Normal file
14
matter-bridge/src/mapper/devices/MapperType.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { Device } from '@project-chip/matter-node.js/device';
|
||||||
|
import { HassEntity } from '../../home-assistant/HAssTypes';
|
||||||
|
|
||||||
|
import { HAMiddleware } from '../../home-assistant/HAmiddleware';
|
||||||
|
import { Bridge } from '../../matter';
|
||||||
|
|
||||||
|
export type AddHaDeviceToBridge = (
|
||||||
|
haEntity: HassEntity,
|
||||||
|
haMiddleware: HAMiddleware,
|
||||||
|
bridge: Bridge
|
||||||
|
) => Device;
|
||||||
|
|
||||||
|
export { HAMiddleware } from '../../home-assistant/HAmiddleware';
|
||||||
|
export { Bridge } from '../../matter';
|
@ -1,12 +1,21 @@
|
|||||||
import { Device, DimmableLightDevice } from "@project-chip/matter-node.js/device";
|
import {
|
||||||
import { MD5 } from "crypto-js";
|
Device,
|
||||||
import { HAMiddleware, Bridge } from "../..";
|
DimmableLightDevice,
|
||||||
import { HassEntity, StateChangedEvent } from "../../../HA/HAssTypes";
|
} from '@project-chip/matter-node.js/device';
|
||||||
import { AddHaDeviceToBridge } from "../MapperType";
|
import { MD5 } from 'crypto-js';
|
||||||
import { Logger } from "@project-chip/matter-node.js/log";
|
import {
|
||||||
|
HassEntity,
|
||||||
|
StateChangedEvent,
|
||||||
|
} from '../../../home-assistant/HAssTypes';
|
||||||
|
import { AddHaDeviceToBridge, Bridge, HAMiddleware } from '../MapperType';
|
||||||
|
import { Logger } from '@project-chip/matter-node.js/log';
|
||||||
|
|
||||||
const LOGGER = new Logger('DimmableLight');
|
const LOGGER = new Logger('DimmableLight');
|
||||||
export const addDimmerableLightDevice: AddHaDeviceToBridge = (haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge): Device => {
|
export const addDimmerableLightDevice: AddHaDeviceToBridge = (
|
||||||
|
haEntity: HassEntity,
|
||||||
|
haMiddleware: HAMiddleware,
|
||||||
|
bridge: Bridge
|
||||||
|
): Device => {
|
||||||
const device = new DimmableLightDevice();
|
const device = new DimmableLightDevice();
|
||||||
const serialFromId = MD5(haEntity.entity_id).toString();
|
const serialFromId = MD5(haEntity.entity_id).toString();
|
||||||
device.addOnOffListener((value, oldValue) => {
|
device.addOnOffListener((value, oldValue) => {
|
||||||
@ -36,7 +45,8 @@ export const addDimmerableLightDevice: AddHaDeviceToBridge = (haEntity: HassEnti
|
|||||||
(event: StateChangedEvent) => {
|
(event: StateChangedEvent) => {
|
||||||
device.setOnOff(event.data.new_state?.state === 'on');
|
device.setOnOff(event.data.new_state?.state === 'on');
|
||||||
device.setCurrentLevel(
|
device.setCurrentLevel(
|
||||||
(event.data.new_state?.attributes as never)['brightness']);
|
(event.data.new_state?.attributes as never)['brightness']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -46,4 +56,4 @@ export const addDimmerableLightDevice: AddHaDeviceToBridge = (haEntity: HassEnti
|
|||||||
serialNumber: serialFromId,
|
serialNumber: serialFromId,
|
||||||
});
|
});
|
||||||
return device;
|
return device;
|
||||||
}
|
};
|
@ -1,13 +1,19 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { Device, OnOffLightDevice } from "@project-chip/matter-node.js/device";
|
import { Device, OnOffLightDevice } from '@project-chip/matter-node.js/device';
|
||||||
import { MD5 } from "crypto-js";
|
import { MD5 } from 'crypto-js';
|
||||||
import { HAMiddleware, Bridge } from "../..";
|
import {
|
||||||
import { HassEntity, StateChangedEvent } from "../../../HA/HAssTypes";
|
HassEntity,
|
||||||
import { AddHaDeviceToBridge } from "../MapperType";
|
StateChangedEvent,
|
||||||
import { Logger } from "@project-chip/matter-node.js/log";
|
} from '../../../home-assistant/HAssTypes';
|
||||||
|
import { AddHaDeviceToBridge, Bridge, HAMiddleware } from '../MapperType';
|
||||||
|
import { Logger } from '@project-chip/matter-node.js/log';
|
||||||
|
|
||||||
const LOGGER = new Logger('OnOfflIght');
|
const LOGGER = new Logger('OnOfflIght');
|
||||||
export const addOnOffLightDevice: AddHaDeviceToBridge = (haEntity: HassEntity, haMiddleware: HAMiddleware, bridge: Bridge): Device => {
|
export const addOnOffLightDevice: AddHaDeviceToBridge = (
|
||||||
|
haEntity: HassEntity,
|
||||||
|
haMiddleware: HAMiddleware,
|
||||||
|
bridge: Bridge
|
||||||
|
): Device => {
|
||||||
const device = new OnOffLightDevice();
|
const device = new OnOffLightDevice();
|
||||||
const serialFromId = MD5(haEntity.entity_id).toString();
|
const serialFromId = MD5(haEntity.entity_id).toString();
|
||||||
device.addOnOffListener((value, oldValue) => {
|
device.addOnOffListener((value, oldValue) => {
|
||||||
@ -36,4 +42,4 @@ export const addOnOffLightDevice: AddHaDeviceToBridge = (haEntity: HassEntity, h
|
|||||||
serialNumber: serialFromId,
|
serialNumber: serialFromId,
|
||||||
});
|
});
|
||||||
return device;
|
return device;
|
||||||
}
|
};
|
@ -1,2 +1,2 @@
|
|||||||
export * from './DimmerableLightDevice';
|
export * from './DimmerableLightDevice';
|
||||||
export * from './OnOffLightDevice';
|
export * from './OnOffLightDevice';
|
@ -10,7 +10,7 @@ import {
|
|||||||
} from '@project-chip/matter-node.js/device';
|
} from '@project-chip/matter-node.js/device';
|
||||||
import { Logger } from '@project-chip/matter-node.js/log';
|
import { Logger } from '@project-chip/matter-node.js/log';
|
||||||
import { StorageManager } from '@project-chip/matter-node.js/storage';
|
import { StorageManager } from '@project-chip/matter-node.js/storage';
|
||||||
import { getIntParameter, getParameter } from '../../utils/utils';
|
import { getIntParameter, getParameter } from '../utils/utils';
|
||||||
import { Time } from '@project-chip/matter-node.js/time';
|
import { Time } from '@project-chip/matter-node.js/time';
|
||||||
import { VendorId } from '@project-chip/matter-node.js/datatype';
|
import { VendorId } from '@project-chip/matter-node.js/datatype';
|
||||||
import { QrCode } from '@project-chip/matter-node.js/schema';
|
import { QrCode } from '@project-chip/matter-node.js/schema';
|
||||||
@ -24,7 +24,7 @@ export class Bridge {
|
|||||||
getParameter('name') || 'Matter Bridge';
|
getParameter('name') || 'Matter Bridge';
|
||||||
private static readonly deviceType = DeviceTypes.AGGREGATOR.code;
|
private static readonly deviceType = DeviceTypes.AGGREGATOR.code;
|
||||||
private static readonly vendorName = getParameter('vendor') || 'Jatus';
|
private static readonly vendorName = getParameter('vendor') || 'Jatus';
|
||||||
private static readonly productName = 'node-matter OnOff-Bridge';
|
private static readonly productName = 'HomeAssistant';
|
||||||
private static readonly port = getIntParameter('port') ?? 5540;
|
private static readonly port = getIntParameter('port') ?? 5540;
|
||||||
|
|
||||||
private matterServer: MatterServer;
|
private matterServer: MatterServer;
|
||||||
@ -136,5 +136,9 @@ export class Bridge {
|
|||||||
|
|
||||||
async stop() {
|
async stop() {
|
||||||
this.matterServer.close();
|
this.matterServer.close();
|
||||||
|
this.storageManager
|
||||||
|
.close()
|
||||||
|
.then(() => process.exit(0))
|
||||||
|
.catch((err) => this.logger.error(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,8 @@ import {
|
|||||||
StorageManager,
|
StorageManager,
|
||||||
} from '@project-chip/matter-node.js/storage';
|
} from '@project-chip/matter-node.js/storage';
|
||||||
import { getParameter, hasParameter } from '@project-chip/matter-node.js/util';
|
import { getParameter, hasParameter } from '@project-chip/matter-node.js/util';
|
||||||
|
export { Bridge } from './Bridge';
|
||||||
|
import { Bridge } from './Bridge';
|
||||||
|
|
||||||
let MATTER_SERVER: MatterServer;
|
let MATTER_SERVER: MatterServer;
|
||||||
let STORAGE: StorageBackendDisk;
|
let STORAGE: StorageBackendDisk;
|
||||||
@ -27,3 +29,12 @@ export function serverSetup(): {
|
|||||||
}
|
}
|
||||||
return { matterServer: MATTER_SERVER, storageManager: STORAGE_MANAGER };
|
return { matterServer: MATTER_SERVER, storageManager: STORAGE_MANAGER };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBridge(): Bridge {
|
||||||
|
const serverData = serverSetup();
|
||||||
|
const bridge = Bridge.getInstance(
|
||||||
|
serverData.matterServer,
|
||||||
|
serverData.storageManager
|
||||||
|
);
|
||||||
|
return bridge;
|
||||||
|
}
|
13
matter-bridge/tsconfig.json
Normal file
13
matter-bridge/tsconfig.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||||
|
"module": "Node16" /* Specify what module code is generated. */,
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./build", /* Specify the root folder within your source files. */
|
||||||
|
"moduleResolution": "node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||||
|
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
||||||
|
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||||
|
"strict": true /* Enable all strict type-checking options. */,
|
||||||
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
||||||
|
},
|
||||||
|
}
|
1
repository.yml
Normal file
1
repository.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
name: ha-matter-bridge
|
37
src/index.ts
37
src/index.ts
@ -1,37 +0,0 @@
|
|||||||
import { Bridge, HAMiddleware, addAllDevicesToBridge } from './matter';
|
|
||||||
import { serverSetup } from './matter/server';
|
|
||||||
import { Logger } from '@project-chip/matter-node.js/log';
|
|
||||||
|
|
||||||
let LOGGER = new Logger('Main');
|
|
||||||
let BRIDGE: Bridge;
|
|
||||||
let HA_MIDDLEWARE: HAMiddleware;
|
|
||||||
const SERVER_DATA = serverSetup();
|
|
||||||
|
|
||||||
async function run() {
|
|
||||||
HA_MIDDLEWARE = await HAMiddleware.getInstance({
|
|
||||||
host: process.env.HA_HOST,
|
|
||||||
port: Number(process.env.HA_PORT),
|
|
||||||
token: process.env.HA_ACCESS_TOKEN,
|
|
||||||
});
|
|
||||||
BRIDGE = Bridge.getInstance(
|
|
||||||
SERVER_DATA.matterServer,
|
|
||||||
SERVER_DATA.storageManager
|
|
||||||
);
|
|
||||||
await addAllDevicesToBridge(HA_MIDDLEWARE, BRIDGE);
|
|
||||||
BRIDGE.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
run().then().catch(LOGGER.error);
|
|
||||||
|
|
||||||
process.on('SIGINT', () => {
|
|
||||||
HA_MIDDLEWARE.stop();
|
|
||||||
BRIDGE.stop()
|
|
||||||
.then(() => {
|
|
||||||
// Pragmatic way to make sure the storage is correctly closed before the process ends.
|
|
||||||
SERVER_DATA.storageManager
|
|
||||||
.close()
|
|
||||||
.then(() => process.exit(0))
|
|
||||||
.catch((err) => LOGGER.error(err));
|
|
||||||
})
|
|
||||||
.catch((err) => LOGGER.error(err));
|
|
||||||
});
|
|
@ -1,7 +0,0 @@
|
|||||||
import { Device } from "@project-chip/matter-node.js/device";
|
|
||||||
import { HAMiddleware, Bridge } from "..";
|
|
||||||
import { HassEntity } from "../../HA/HAssTypes";
|
|
||||||
|
|
||||||
export type AddHaDeviceToBridge = (haEntity: HassEntity,
|
|
||||||
haMiddleware: HAMiddleware,
|
|
||||||
bridge: Bridge) => Device
|
|
@ -1,3 +0,0 @@
|
|||||||
export * from './server/Bridge';
|
|
||||||
export * from '../HA/HAmiddleware';
|
|
||||||
export * from './Mapper';
|
|
102
tsconfig.json
102
tsconfig.json
@ -1,102 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
||||||
/* Projects */
|
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
||||||
/* Language and Environment */
|
|
||||||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
||||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
||||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
||||||
/* Modules */
|
|
||||||
// "module": "commonjs", /* Specify what module code is generated. */
|
|
||||||
"module": "Node16" /* Specify what module code is generated. */,
|
|
||||||
// // "rootDir": "./", /* Specify the root folder within your source files. */
|
|
||||||
"moduleResolution": "node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
||||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
||||||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
||||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
||||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
||||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
||||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
||||||
/* JavaScript Support */
|
|
||||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
||||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
||||||
/* Emit */
|
|
||||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
||||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
||||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
||||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
||||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
||||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
||||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
||||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
||||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
||||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
||||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
||||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
||||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
||||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
||||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
||||||
/* Interop Constraints */
|
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
||||||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
||||||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
||||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
||||||
/* Type Checking */
|
|
||||||
"strict": true /* Enable all strict type-checking options. */,
|
|
||||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
||||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
||||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
||||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
||||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
||||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
||||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
||||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
||||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
||||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
||||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
||||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
||||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
||||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
||||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
||||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
||||||
/* Completeness */
|
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
||||||
},
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user