fixinx webpack
This commit is contained in:
parent
ce66d18fc0
commit
953a4647c2
63
lib/communication/getLayer.browser.ts
Normal file
63
lib/communication/getLayer.browser.ts
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @author Martin Karkowski
|
||||
* @email m.karkowski@zema.de
|
||||
* @create date 2021-03-23 07:30:19
|
||||
* @modify date 2021-04-09 09:28:02
|
||||
* @desc [description]
|
||||
*/
|
||||
|
||||
import { generateId } from "../helpers/idMethods";
|
||||
import { LoggerLevel } from "../logger/nopeLogger";
|
||||
import { ICommunicationBridge } from "../types/nope/nopeCommunication.interface";
|
||||
import { Bridge } from "./bridge";
|
||||
import { MQTTLayer } from "./layers/mqttLayer";
|
||||
import { IoSocketMirrorClient } from "./mirrors/ioSocketMirrorClient";
|
||||
|
||||
// Define the Valid Layers
|
||||
export type validLayerOrMirror = "event" | "mqtt";
|
||||
|
||||
export const validLayers = {
|
||||
event: Bridge,
|
||||
"io-client": IoSocketMirrorClient,
|
||||
mqtt: MQTTLayer
|
||||
};
|
||||
|
||||
export const layerDefaultParameters = {
|
||||
mqtt: "mqtt://localhost:1883"
|
||||
};
|
||||
|
||||
/**
|
||||
* Function, that will create a Bridge, based on the provided function.
|
||||
* Based on the parameter "layer", a corresponding layer or mirror will
|
||||
* be added to the bridge. You can provide custom parameters using the
|
||||
* parameter "parameter". This will receive either the uri or ports.
|
||||
* Additionally you are able to assign a log-level to the bridge.
|
||||
*
|
||||
* @export
|
||||
* @param {validLayerOrMirror} layer the layer to add
|
||||
* @param {(number | string)} [parameter=null] the parameter required for the additonal layer / mirror
|
||||
* @param {LoggerLevel} level the level of the debugger
|
||||
* @return {*} {ICommunicationBridge}
|
||||
*/
|
||||
export function getLayer(
|
||||
layer: validLayerOrMirror,
|
||||
parameter: number | string = null,
|
||||
level: LoggerLevel
|
||||
): ICommunicationBridge {
|
||||
// Create the Bridge
|
||||
const communicationBridge = new Bridge(generateId(), "communication", level);
|
||||
|
||||
// Assign the Default Setting for the Channel.
|
||||
const params = parameter !== null ? parameter : layerDefaultParameters[layer];
|
||||
|
||||
switch (layer) {
|
||||
case "event":
|
||||
break;
|
||||
case "mqtt":
|
||||
communicationBridge.addLayer(new MQTTLayer(params) as any);
|
||||
break;
|
||||
}
|
||||
|
||||
// Return the Bridge
|
||||
return communicationBridge as any as ICommunicationBridge;
|
||||
}
|
@ -35,8 +35,8 @@ export {
|
||||
ValidSelectorFunction
|
||||
} from "../types/nope/nopeDispatcher.interface";
|
||||
export { Bridge } from "./bridge";
|
||||
export { getLayer, validLayers } from "./getLayer";
|
||||
export { Layers, Mirrors };
|
||||
export { getLayer, validLayers } from "./getLayer.browser";
|
||||
export { Mirrors };
|
||||
|
||||
import * as Layers from "./layers/index.browser";
|
||||
// import * as Layers from "./layers/index.browser";
|
||||
import * as Mirrors from "./mirrors/index.browser";
|
||||
|
@ -35,7 +35,7 @@ export {
|
||||
ValidSelectorFunction
|
||||
} from "../types/nope/nopeDispatcher.interface";
|
||||
export { Bridge } from "./bridge";
|
||||
export { getLayer, validLayers } from "./getLayer";
|
||||
export { getLayer, validLayers } from "./getLayer.nodejs";
|
||||
export { Layers, Mirrors };
|
||||
|
||||
import * as Layers from "./layers/index.nodejs";
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
import * as arrays from "./arrayMethods";
|
||||
import * as async from "./async";
|
||||
import * as files from "./fileMethods";
|
||||
import * as ids from "./idMethods";
|
||||
import * as json from "./jsonMethods";
|
||||
import * as schema from "./jsonSchemaMethods";
|
||||
@ -29,6 +28,5 @@ export {
|
||||
schema,
|
||||
singletons,
|
||||
strings,
|
||||
runtime,
|
||||
files
|
||||
runtime
|
||||
};
|
||||
|
31024
package-lock.json
generated
31024
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
75
package.json
75
package.json
@ -2,7 +2,7 @@
|
||||
"name": "nope",
|
||||
"version": "0.9.7",
|
||||
"description": "Nodejs Backend, combining nextjs with openapi",
|
||||
"main": "dist/lib/index.nodejs.js",
|
||||
"main": "dist/lib/index.browser.js",
|
||||
"files": [
|
||||
"dist",
|
||||
"node_modules",
|
||||
@ -36,31 +36,31 @@
|
||||
},
|
||||
"homepage": "https://github.com/anti-held-333/nope-backend#readme",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.3",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
||||
"@fortawesome/react-fontawesome": "^0.1.14",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.4",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
||||
"@fortawesome/react-fontawesome": "^0.1.15",
|
||||
"@grpc/proto-loader": "^0.6.4",
|
||||
"@openapitools/openapi-generator-cli": "^2.3.7",
|
||||
"@rjsf/bootstrap-4": "^3.0.0",
|
||||
"@rjsf/core": "^3.0.0",
|
||||
"@openapitools/openapi-generator-cli": "^2.4.1",
|
||||
"@rjsf/bootstrap-4": "^3.1.0",
|
||||
"@rjsf/core": "^3.1.0",
|
||||
"@zeit/next-css": "^1.0.1",
|
||||
"ace-builds": "^1.4.12",
|
||||
"aedes": "^0.46.1",
|
||||
"ajv": "^8.6.2",
|
||||
"amqplib": "^0.8.0",
|
||||
"arangojs": "^7.5.0",
|
||||
"async": "^3.2.0",
|
||||
"async": "^3.2.1",
|
||||
"asyncjs": "0.0.13",
|
||||
"bootstrap": "^5.0.2",
|
||||
"bootswatch": "^5.0.2",
|
||||
"bootstrap": "^5.1.0",
|
||||
"bootswatch": "^5.1.0",
|
||||
"chroma-js": "^2.1.2",
|
||||
"comment-parser": "^1.1.5",
|
||||
"comment-parser": "^1.2.4",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"express-openapi": "^9.1.0",
|
||||
"gojs": "^2.1.46",
|
||||
"gojs-react": "^1.0.10",
|
||||
"express-openapi": "^9.3.0",
|
||||
"gojs": "^2.1.49",
|
||||
"gojs-react": "^1.1.0",
|
||||
"grpc": "^1.24.7",
|
||||
"handlebars": "^4.7.7",
|
||||
"inquirer": "^8.1.2",
|
||||
@ -69,57 +69,60 @@
|
||||
"inversify": "^5.1.1",
|
||||
"js-logger": "^1.6.1",
|
||||
"jsdocs": "^1.0.0",
|
||||
"jsoneditor": "^9.5.2",
|
||||
"jsoneditor": "^9.5.5",
|
||||
"jsoneditor-react": "^3.1.1",
|
||||
"lodash": "^4.17.21",
|
||||
"mathjs": "^9.4.4",
|
||||
"mqtt": "^4.2.8",
|
||||
"mqtt-pattern": "^1.2.0",
|
||||
"next": "^11.0.1",
|
||||
"next": "^11.1.2",
|
||||
"node-ads": "^1.5.1",
|
||||
"node-rest-client": "^3.1.0",
|
||||
"node-windows": "^1.0.0-beta.5",
|
||||
"node-wol": "^0.1.1",
|
||||
"npm": "^7.20.1",
|
||||
"npm": "^7.21.1",
|
||||
"npx": "^10.2.2",
|
||||
"openapi-typescript-codegen": "^0.9.3",
|
||||
"rctx-contextmenu": "^1.3.5",
|
||||
"react": "^17.0.2",
|
||||
"react-ace": "^9.4.1",
|
||||
"react-ace": "^9.4.3",
|
||||
"react-bootstrap": "^1.6.1",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-grid-layout": "^1.2.5",
|
||||
"react-grid-layout": "^1.3.0",
|
||||
"react-icons": "^4.2.0",
|
||||
"react-toastify": "^7.0.4",
|
||||
"react-toastify": "^8.0.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "^7.2.0",
|
||||
"simple-git": "^2.41.1",
|
||||
"rxjs": "^7.3.0",
|
||||
"simple-git": "^2.45.0",
|
||||
"simple-undo": "^1.0.2",
|
||||
"socket.io": "^2.3.0",
|
||||
"socket.io-client": "^2.3.1",
|
||||
"socket.io": "^4.2.0",
|
||||
"socket.io-client": "^4.2.0",
|
||||
"swagger-ts-client": "^0.9.6",
|
||||
"swagger-ui-react": "^3.51.1",
|
||||
"swagger-ui-react": "^3.52.0",
|
||||
"tinkerforge": "^2.1.33",
|
||||
"ts-morph": "^11.0.3",
|
||||
"ts-morph": "^12.0.0",
|
||||
"typescript-json-schema": "^0.50.1",
|
||||
"uuid": "^8.3.2",
|
||||
"websocket-stream": "^5.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/amqplib": "^0.8.1",
|
||||
"@types/amqplib": "^0.8.2",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/lodash": "^4.14.171",
|
||||
"@types/node": "^16.4.1",
|
||||
"@types/react": "^17.0.14",
|
||||
"@types/lodash": "^4.14.172",
|
||||
"@types/node": "^16.7.10",
|
||||
"@types/react": "^17.0.19",
|
||||
"@types/socket.io": "^3.0.1",
|
||||
"@types/socket.io-client": "^1.4.36",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
||||
"@typescript-eslint/parser": "^4.28.4",
|
||||
"eslint": "^7.31.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.30.0",
|
||||
"@typescript-eslint/parser": "^4.30.0",
|
||||
"dts-bundle-webpack": "^1.0.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-check-updates": "^11.8.3",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "^4.3.5"
|
||||
"typescript": "^4.4.2",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-cli": "^4.8.0"
|
||||
}
|
||||
}
|
38
tsconfigBrowser.json
Normal file
38
tsconfigBrowser.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"lib": [
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"allowUnusedLabels": true,
|
||||
"charset": "utf-8",
|
||||
"experimentalDecorators": true,
|
||||
"module": "ES2020",
|
||||
"moduleResolution": "node",
|
||||
"noFallthroughCasesInSwitch": false,
|
||||
"noImplicitReturns": true,
|
||||
"outDir": "./dist",
|
||||
"pretty": false,
|
||||
"removeComments": true,
|
||||
"rootDir": "./",
|
||||
"stripInternal": true,
|
||||
"downlevelIteration": true,
|
||||
"noImplicitAny": false,
|
||||
"declaration": true
|
||||
},
|
||||
"include": [
|
||||
"lib",
|
||||
"open-api",
|
||||
"src",
|
||||
"test"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"pages",
|
||||
"backend-api",
|
||||
"temp",
|
||||
".next",
|
||||
"dist"
|
||||
]
|
||||
}
|
@ -1,30 +1,21 @@
|
||||
const path = require("path");
|
||||
const nodeExternals = require("webpack-node-externals");
|
||||
const DtsBundleWebpack = require("dts-bundle-webpack");
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(__dirname, "dist", "generated", "test.js"),
|
||||
// devtool: 'inline-source-map',
|
||||
mode: "production",
|
||||
entry: path.resolve(__dirname, "dist", "lib", "index.browser.js"),
|
||||
devtool: "inline-source-map",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "build"),
|
||||
filename: "bundle.js"
|
||||
filename: "nope.js",
|
||||
library: "nope",
|
||||
// libraryTarget: "umd"
|
||||
},
|
||||
// externals: [
|
||||
// nodeExternals()
|
||||
// ],
|
||||
target: "node",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /rx\.lite\.aggregates\.js/,
|
||||
use: "imports-loader?define=>false"
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
modules: [
|
||||
path.resolve(__dirname),
|
||||
"node_modules"
|
||||
]
|
||||
},
|
||||
// node: { global: true, fs: 'empty' },
|
||||
plugins: [
|
||||
new DtsBundleWebpack({
|
||||
name: "nope",
|
||||
main: path.resolve(__dirname, "dist", "lib", "index.browser.d.ts"),
|
||||
baseDir: path.resolve(__dirname, "dist")
|
||||
})
|
||||
]
|
||||
};
|
Loading…
Reference in New Issue
Block a user