Compare commits

..

No commits in common. "master" and "v1.0.9" have entirely different histories.

31 changed files with 26971 additions and 7221 deletions

View File

@ -1,66 +0,0 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -1,124 +0,0 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

17
.gitignore vendored
View File

@ -1,20 +1,5 @@
.nogit/
# artifacts
node_modules/
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,16 +1,16 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
# ====================
# security stage
@ -18,104 +18,114 @@ stages:
mirror:
stage: security
script:
- npmci git mirror
- npmci git mirror
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
snyk:
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
- npmci command snyk test
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
# ====================
# test stage
# ====================
testStable:
testLEGACY:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
- npmci npm prepare
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
- docker
- notpriv
allow_failure: true
testBuild:
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
- npmci node install stable
- npmci npm publish
only:
- tags
- tags
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- lossless
- docker
- priv
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- lossless
- docker
- notpriv
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @git.zone/tsdoc
- npmci command npm install -g typedoc typescript
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- lossless
- docker
- notpriv
only:
@ -123,5 +133,15 @@ pages:
artifacts:
expire_in: 1 week
paths:
- public
- public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

15
.snyk Normal file
View File

@ -0,0 +1,15 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.1
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
'npm:chownr:20180731':
- chokidar > fsevents > node-pre-gyp > tar > chownr:
reason: None given
expires: '2018-12-13T00:39:40.332Z'
- fswatcher-child > chokidar > fsevents > node-pre-gyp > tar > chownr:
reason: None given
expires: '2018-12-13T00:39:40.332Z'
- parcel-bundler > fswatcher-child > chokidar > fsevents > node-pre-gyp > tar > chownr:
reason: None given
expires: '2018-12-13T00:39:40.332Z'
patch: {}

11
.vscode/launch.json vendored
View File

@ -1,11 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored
View File

@ -1,26 +0,0 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

468
dist/browsertest.d8c67eb9.js vendored Normal file
View File

@ -0,0 +1,468 @@
// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
// eslint-disable-next-line no-global-assign
parcelRequire = (function (modules, cache, entry, globalName) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
var nodeRequire = typeof require === 'function' && require;
function newRequire(name, jumped) {
if (!cache[name]) {
if (!modules[name]) {
// if we cannot find the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
if (!jumped && currentRequire) {
return currentRequire(name, true);
}
// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) {
return previousRequire(name, true);
}
// Try the node require function if it exists.
if (nodeRequire && typeof name === 'string') {
return nodeRequire(name);
}
var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}
localRequire.resolve = resolve;
localRequire.cache = {};
var module = cache[name] = new newRequire.Module(name);
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
}
return cache[name].exports;
function localRequire(x){
return newRequire(localRequire.resolve(x));
}
function resolve(x){
return modules[name][1][x] || x;
}
}
function Module(moduleName) {
this.id = moduleName;
this.bundle = newRequire;
this.exports = {};
}
newRequire.isParcelRequire = true;
newRequire.Module = Module;
newRequire.modules = modules;
newRequire.cache = cache;
newRequire.parent = previousRequire;
newRequire.register = function (id, exports) {
modules[id] = [function (require, module) {
module.exports = exports;
}, {}];
};
for (var i = 0; i < entry.length; i++) {
newRequire(entry[i]);
}
if (entry.length) {
// Expose entry point to Node, AMD or browser globals
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
var mainExports = newRequire(entry[entry.length - 1]);
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = mainExports;
// RequireJS
} else if (typeof define === "function" && define.amd) {
define(function () {
return mainExports;
});
// <script>
} else if (globalName) {
this[globalName] = mainExports;
}
}
// Override the current require with this new one
return newRequire;
})({"../node_modules/@pushrocks/smartlog/dist/smartlog.classes.logrouter.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class LogRouter {
constructor() {
/**
* all log destinations
*/
this.logDestinations = [];
}
addLogDestination(logDestination) {
this.logDestinations.push(logDestination);
}
// routes the log according to added logDestinations
routeLog(logPackageArg) {
for (const logDestination of this.logDestinations) {
logDestination.handleLog(logPackageArg);
}
}
}
exports.LogRouter = LogRouter;
},{}],"../node_modules/@pushrocks/smartlog/dist/smartlog.classes.smartlog.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartlog_classes_logrouter_1 = require("./smartlog.classes.logrouter");
class Smartlog {
constructor(optionsArg) {
this.logRouter = new smartlog_classes_logrouter_1.LogRouter();
this.logContext = optionsArg.logContext;
this.minimumLogLevel = optionsArg.minimumLogLevel;
}
addLogDestination(logDestinationArg) {
this.logRouter.addLogDestination(logDestinationArg);
}
// ============
// Logger Setup
// ============
/**
* enables console logging
*/
enableConsole() {
this.consoleEnabled = true;
}
// =============
// log functions
// =============
/**
* main log method
* @param logLevelArg - the log level
* @param logMessageArg - the log message
* @param logDataArg - any additional log data
*/
log(logLevelArg, logMessageArg, logDataArg) {
if (this.consoleEnabled) {
console.log(`LOG: ${logLevelArg}: ${logMessageArg}`);
}
const logPackage = {
timestamp: Date.now(),
type: 'log',
context: this.logContext,
level: logLevelArg,
message: logMessageArg
};
if (logDataArg) {
logPackage.data = logDataArg;
}
this.logRouter.routeLog(logPackage);
}
increment(logLevelArg, logMessageArg) {
if (this.consoleEnabled) {
console.log(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);
}
this.logRouter.routeLog({
timestamp: Date.now(),
type: 'increment',
context: this.logContext,
level: logLevelArg,
message: logMessageArg
});
}
handleLogPackage(logPackageArg) {
this.logRouter.routeLog(logPackageArg);
}
}
exports.Smartlog = Smartlog;
},{"./smartlog.classes.logrouter":"../node_modules/@pushrocks/smartlog/dist/smartlog.classes.logrouter.js"}],"../node_modules/@pushrocks/smartlog/dist/index.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartlog_classes_smartlog_1 = require("./smartlog.classes.smartlog");
exports.Smartlog = smartlog_classes_smartlog_1.Smartlog;
const defaultLogger = new smartlog_classes_smartlog_1.Smartlog({
logContext: {
company: 'undefined',
companyunit: 'undefefined',
containerName: 'undefined',
environment: 'local',
runtime: 'node',
zone: 'undefined'
}
});
exports.defaultLogger = defaultLogger;
},{"./smartlog.classes.smartlog":"../node_modules/@pushrocks/smartlog/dist/smartlog.classes.smartlog.js"}],"../ts/index.ts":[function(require,module,exports) {
"use strict";
exports.__esModule = true;
var SmartlogDestinationDevtools =
/** @class */
function () {
function SmartlogDestinationDevtools() {}
SmartlogDestinationDevtools.prototype.handleLog = function (logPackageArg) {
this.logInBrowser(logPackageArg);
};
SmartlogDestinationDevtools.prototype.logInBrowser = function (logPackage) {
switch (logPackage.level) {
case 'error':
console.log("%c Error: %c " + logPackage.message, 'background:#000000;color:#800000;', 'color:#000000;');
break;
case 'info':
console.log("%c Info: %c " + logPackage.message, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;');
break;
case 'ok':
console.log("%c OK: %c " + logPackage.message, 'background:#000000;color:#8BC34A;', 'color:#000000;');
break;
case 'success':
console.log("%c Success: %c " + logPackage.message, 'background:#8BC34A;color:#ffffff;', 'color:#8BC34A;');
break;
case 'warn':
console.log("%c Warn: %c " + logPackage.message, 'background:#000000;color:#FB8C00;', 'color:#000000;');
break;
case 'note':
console.log("%c Note: %c " + logPackage.message, 'background:#42A5F5;color:#ffffff', 'color:#42A5F5;');
break;
default:
console.log("unknown logType for \"" + logPackage.message + "\"");
break;
}
};
return SmartlogDestinationDevtools;
}();
exports.SmartlogDestinationDevtools = SmartlogDestinationDevtools;
},{}],"browsertest.ts":[function(require,module,exports) {
"use strict";
var __importStar = this && this.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) {
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}
result["default"] = mod;
return result;
};
exports.__esModule = true;
var smartlog = __importStar(require("@pushrocks/smartlog"));
var logger = smartlog.defaultLogger;
var logContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'testContainer',
environment: 'staging',
runtime: 'chrome',
zone: 'servezone'
}; // import the module to test
var smartlogDestinationDevtools = __importStar(require("../ts/index"));
var testDestination = new smartlogDestinationDevtools.SmartlogDestinationDevtools();
testDestination.handleLog({
timestamp: Date.now(),
type: 'log',
context: logContext,
level: 'info',
message: 'wait, what? Hi, this is a message!'
});
},{"@pushrocks/smartlog":"../node_modules/@pushrocks/smartlog/dist/index.js","../ts/index":"../ts/index.ts"}],"../node_modules/parcel-bundler/src/builtins/hmr-runtime.js":[function(require,module,exports) {
var global = arguments[3];
var OVERLAY_ID = '__parcel__error__overlay__';
var OldModule = module.bundle.Module;
function Module(moduleName) {
OldModule.call(this, moduleName);
this.hot = {
data: module.bundle.hotData,
_acceptCallbacks: [],
_disposeCallbacks: [],
accept: function (fn) {
this._acceptCallbacks.push(fn || function () {});
},
dispose: function (fn) {
this._disposeCallbacks.push(fn);
}
};
module.bundle.hotData = null;
}
module.bundle.Module = Module;
var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "61118" + '/');
ws.onmessage = function (event) {
var data = JSON.parse(event.data);
if (data.type === 'update') {
console.clear();
data.assets.forEach(function (asset) {
hmrApply(global.parcelRequire, asset);
});
data.assets.forEach(function (asset) {
if (!asset.isNew) {
hmrAccept(global.parcelRequire, asset.id);
}
});
}
if (data.type === 'reload') {
ws.close();
ws.onclose = function () {
location.reload();
};
}
if (data.type === 'error-resolved') {
console.log('[parcel] ✨ Error resolved');
removeErrorOverlay();
}
if (data.type === 'error') {
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
removeErrorOverlay();
var overlay = createErrorOverlay(data);
document.body.appendChild(overlay);
}
};
}
function removeErrorOverlay() {
var overlay = document.getElementById(OVERLAY_ID);
if (overlay) {
overlay.remove();
}
}
function createErrorOverlay(data) {
var overlay = document.createElement('div');
overlay.id = OVERLAY_ID; // html encode message and stack trace
var message = document.createElement('div');
var stackTrace = document.createElement('pre');
message.innerText = data.error.message;
stackTrace.innerText = data.error.stack;
overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';
return overlay;
}
function getParents(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return [];
}
var parents = [];
var k, d, dep;
for (k in modules) {
for (d in modules[k][1]) {
dep = modules[k][1][d];
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
parents.push(k);
}
}
}
if (bundle.parent) {
parents = parents.concat(getParents(bundle.parent, id));
}
return parents;
}
function hmrApply(bundle, asset) {
var modules = bundle.modules;
if (!modules) {
return;
}
if (modules[asset.id] || !bundle.parent) {
var fn = new Function('require', 'module', 'exports', asset.generated.js);
asset.isNew = !modules[asset.id];
modules[asset.id] = [fn, asset.deps];
} else if (bundle.parent) {
hmrApply(bundle.parent, asset);
}
}
function hmrAccept(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return;
}
if (!modules[id] && bundle.parent) {
return hmrAccept(bundle.parent, id);
}
var cached = bundle.cache[id];
bundle.hotData = {};
if (cached) {
cached.hot.data = bundle.hotData;
}
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
cached.hot._disposeCallbacks.forEach(function (cb) {
cb(bundle.hotData);
});
}
delete bundle.cache[id];
bundle(id);
cached = bundle.cache[id];
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
cached.hot._acceptCallbacks.forEach(function (cb) {
cb();
});
return true;
}
return getParents(global.parcelRequire, id).some(function (id) {
return hmrAccept(global.parcelRequire, id);
});
}
},{}]},{},["../node_modules/parcel-bundler/src/builtins/hmr-runtime.js","browsertest.ts"], null)
//# sourceMappingURL=/browsertest.d8c67eb9.map

1
dist/browsertest.d8c67eb9.map vendored Normal file

File diff suppressed because one or more lines are too long

468
dist/browsertest.ebe08f22.js vendored Normal file
View File

@ -0,0 +1,468 @@
// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
// eslint-disable-next-line no-global-assign
parcelRequire = (function (modules, cache, entry, globalName) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
var nodeRequire = typeof require === 'function' && require;
function newRequire(name, jumped) {
if (!cache[name]) {
if (!modules[name]) {
// if we cannot find the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
if (!jumped && currentRequire) {
return currentRequire(name, true);
}
// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) {
return previousRequire(name, true);
}
// Try the node require function if it exists.
if (nodeRequire && typeof name === 'string') {
return nodeRequire(name);
}
var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}
localRequire.resolve = resolve;
localRequire.cache = {};
var module = cache[name] = new newRequire.Module(name);
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
}
return cache[name].exports;
function localRequire(x){
return newRequire(localRequire.resolve(x));
}
function resolve(x){
return modules[name][1][x] || x;
}
}
function Module(moduleName) {
this.id = moduleName;
this.bundle = newRequire;
this.exports = {};
}
newRequire.isParcelRequire = true;
newRequire.Module = Module;
newRequire.modules = modules;
newRequire.cache = cache;
newRequire.parent = previousRequire;
newRequire.register = function (id, exports) {
modules[id] = [function (require, module) {
module.exports = exports;
}, {}];
};
for (var i = 0; i < entry.length; i++) {
newRequire(entry[i]);
}
if (entry.length) {
// Expose entry point to Node, AMD or browser globals
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
var mainExports = newRequire(entry[entry.length - 1]);
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = mainExports;
// RequireJS
} else if (typeof define === "function" && define.amd) {
define(function () {
return mainExports;
});
// <script>
} else if (globalName) {
this[globalName] = mainExports;
}
}
// Override the current require with this new one
return newRequire;
})({"node_modules/@pushrocks/smartlog/dist/smartlog.classes.logrouter.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class LogRouter {
constructor() {
/**
* all log destinations
*/
this.logDestinations = [];
}
addLogDestination(logDestination) {
this.logDestinations.push(logDestination);
}
// routes the log according to added logDestinations
routeLog(logPackageArg) {
for (const logDestination of this.logDestinations) {
logDestination.handleLog(logPackageArg);
}
}
}
exports.LogRouter = LogRouter;
},{}],"node_modules/@pushrocks/smartlog/dist/smartlog.classes.smartlog.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartlog_classes_logrouter_1 = require("./smartlog.classes.logrouter");
class Smartlog {
constructor(optionsArg) {
this.logRouter = new smartlog_classes_logrouter_1.LogRouter();
this.logContext = optionsArg.logContext;
this.minimumLogLevel = optionsArg.minimumLogLevel;
}
addLogDestination(logDestinationArg) {
this.logRouter.addLogDestination(logDestinationArg);
}
// ============
// Logger Setup
// ============
/**
* enables console logging
*/
enableConsole() {
this.consoleEnabled = true;
}
// =============
// log functions
// =============
/**
* main log method
* @param logLevelArg - the log level
* @param logMessageArg - the log message
* @param logDataArg - any additional log data
*/
log(logLevelArg, logMessageArg, logDataArg) {
if (this.consoleEnabled) {
console.log(`LOG: ${logLevelArg}: ${logMessageArg}`);
}
const logPackage = {
timestamp: Date.now(),
type: 'log',
context: this.logContext,
level: logLevelArg,
message: logMessageArg
};
if (logDataArg) {
logPackage.data = logDataArg;
}
this.logRouter.routeLog(logPackage);
}
increment(logLevelArg, logMessageArg) {
if (this.consoleEnabled) {
console.log(`INCREMENT: ${logLevelArg}: ${logMessageArg}`);
}
this.logRouter.routeLog({
timestamp: Date.now(),
type: 'increment',
context: this.logContext,
level: logLevelArg,
message: logMessageArg
});
}
handleLogPackage(logPackageArg) {
this.logRouter.routeLog(logPackageArg);
}
}
exports.Smartlog = Smartlog;
},{"./smartlog.classes.logrouter":"node_modules/@pushrocks/smartlog/dist/smartlog.classes.logrouter.js"}],"node_modules/@pushrocks/smartlog/dist/index.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartlog_classes_smartlog_1 = require("./smartlog.classes.smartlog");
exports.Smartlog = smartlog_classes_smartlog_1.Smartlog;
const defaultLogger = new smartlog_classes_smartlog_1.Smartlog({
logContext: {
company: 'undefined',
companyunit: 'undefefined',
containerName: 'undefined',
environment: 'local',
runtime: 'node',
zone: 'undefined'
}
});
exports.defaultLogger = defaultLogger;
},{"./smartlog.classes.smartlog":"node_modules/@pushrocks/smartlog/dist/smartlog.classes.smartlog.js"}],"ts/index.ts":[function(require,module,exports) {
"use strict";
exports.__esModule = true;
var SmartlogDestinationDevtools =
/** @class */
function () {
function SmartlogDestinationDevtools() {}
SmartlogDestinationDevtools.prototype.handleLog = function (logPackageArg) {
this.logInBrowser(logPackageArg);
};
SmartlogDestinationDevtools.prototype.logInBrowser = function (logPackage) {
switch (logPackage.level) {
case 'error':
console.log("%c Error: %c " + logPackage.message, 'background:#000000;color:#800000;', 'color:#000000;');
break;
case 'info':
console.log("%c Info: %c " + logPackage.message, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;');
break;
case 'ok':
console.log("%c OK: %c " + logPackage.message, 'background:#000000;color:#8BC34A;', 'color:#000000;');
break;
case 'success':
console.log("%c Success: %c " + logPackage.message, 'background:#8BC34A;color:#ffffff;', 'color:#8BC34A;');
break;
case 'warn':
console.log("%c Warn: %c " + logPackage.message, 'background:#000000;color:#FB8C00;', 'color:#000000;');
break;
case 'note':
console.log("%c Note: %c " + logPackage.message, 'background:#42A5F5;color:#ffffff', 'color:#42A5F5;');
break;
default:
console.log("unknown logType for \"" + logPackage.message + "\"");
break;
}
};
return SmartlogDestinationDevtools;
}();
exports.SmartlogDestinationDevtools = SmartlogDestinationDevtools;
},{}],"test/browsertest.ts":[function(require,module,exports) {
"use strict";
var __importStar = this && this.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) {
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}
result["default"] = mod;
return result;
};
exports.__esModule = true;
var smartlog = __importStar(require("@pushrocks/smartlog"));
var logger = smartlog.defaultLogger;
var logContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'testContainer',
environment: 'staging',
runtime: 'chrome',
zone: 'servezone'
}; // import the module to test
var smartlogDestinationDevtools = __importStar(require("../ts/index"));
var testDestination = new smartlogDestinationDevtools.SmartlogDestinationDevtools();
testDestination.handleLog({
timestamp: Date.now(),
type: 'log',
context: logContext,
level: 'info',
message: 'wait, what? Hi, this is a message!'
});
},{"@pushrocks/smartlog":"node_modules/@pushrocks/smartlog/dist/index.js","../ts/index":"ts/index.ts"}],"../../../.nvm/versions/node/v10.13.0/lib/node_modules/parcel-bundler/src/builtins/hmr-runtime.js":[function(require,module,exports) {
var global = arguments[3];
var OVERLAY_ID = '__parcel__error__overlay__';
var OldModule = module.bundle.Module;
function Module(moduleName) {
OldModule.call(this, moduleName);
this.hot = {
data: module.bundle.hotData,
_acceptCallbacks: [],
_disposeCallbacks: [],
accept: function (fn) {
this._acceptCallbacks.push(fn || function () {});
},
dispose: function (fn) {
this._disposeCallbacks.push(fn);
}
};
module.bundle.hotData = null;
}
module.bundle.Module = Module;
var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "57186" + '/');
ws.onmessage = function (event) {
var data = JSON.parse(event.data);
if (data.type === 'update') {
console.clear();
data.assets.forEach(function (asset) {
hmrApply(global.parcelRequire, asset);
});
data.assets.forEach(function (asset) {
if (!asset.isNew) {
hmrAccept(global.parcelRequire, asset.id);
}
});
}
if (data.type === 'reload') {
ws.close();
ws.onclose = function () {
location.reload();
};
}
if (data.type === 'error-resolved') {
console.log('[parcel] ✨ Error resolved');
removeErrorOverlay();
}
if (data.type === 'error') {
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
removeErrorOverlay();
var overlay = createErrorOverlay(data);
document.body.appendChild(overlay);
}
};
}
function removeErrorOverlay() {
var overlay = document.getElementById(OVERLAY_ID);
if (overlay) {
overlay.remove();
}
}
function createErrorOverlay(data) {
var overlay = document.createElement('div');
overlay.id = OVERLAY_ID; // html encode message and stack trace
var message = document.createElement('div');
var stackTrace = document.createElement('pre');
message.innerText = data.error.message;
stackTrace.innerText = data.error.stack;
overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';
return overlay;
}
function getParents(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return [];
}
var parents = [];
var k, d, dep;
for (k in modules) {
for (d in modules[k][1]) {
dep = modules[k][1][d];
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
parents.push(k);
}
}
}
if (bundle.parent) {
parents = parents.concat(getParents(bundle.parent, id));
}
return parents;
}
function hmrApply(bundle, asset) {
var modules = bundle.modules;
if (!modules) {
return;
}
if (modules[asset.id] || !bundle.parent) {
var fn = new Function('require', 'module', 'exports', asset.generated.js);
asset.isNew = !modules[asset.id];
modules[asset.id] = [fn, asset.deps];
} else if (bundle.parent) {
hmrApply(bundle.parent, asset);
}
}
function hmrAccept(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return;
}
if (!modules[id] && bundle.parent) {
return hmrAccept(bundle.parent, id);
}
var cached = bundle.cache[id];
bundle.hotData = {};
if (cached) {
cached.hot.data = bundle.hotData;
}
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
cached.hot._disposeCallbacks.forEach(function (cb) {
cb(bundle.hotData);
});
}
delete bundle.cache[id];
bundle(id);
cached = bundle.cache[id];
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
cached.hot._acceptCallbacks.forEach(function (cb) {
cb();
});
return true;
}
return getParents(global.parcelRequire, id).some(function (id) {
return hmrAccept(global.parcelRequire, id);
});
}
},{}]},{},["../../../.nvm/versions/node/v10.13.0/lib/node_modules/parcel-bundler/src/builtins/hmr-runtime.js","test/browsertest.ts"], null)
//# sourceMappingURL=/browsertest.ebe08f22.map

1
dist/browsertest.ebe08f22.map vendored Normal file

File diff suppressed because one or more lines are too long

4
dist/index.html vendored Normal file
View File

@ -0,0 +1,4 @@
<head>
<script src="/browsertest.d8c67eb9.js"></script>
</head>
<body></body>

14616
dist/test.e222d9ca.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
dist/test.e222d9ca.map vendored Normal file

File diff suppressed because one or more lines are too long

2
dist_ts/beautybrowser.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
export { smartlogInterfaces };

View File

@ -0,0 +1,25 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.smartlogInterfaces = void 0;
const smartlogInterfaces = __importStar(require("@pushrocks/smartlog-interfaces"));
exports.smartlogInterfaces = smartlogInterfaces;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5YnJvd3Nlci5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvYmVhdXR5YnJvd3Nlci5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSxtRkFBcUU7QUFDNUQsZ0RBQWtCIn0=

5
dist_ts/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
export declare class SmartlogDestinationDevtools implements ILogDestination {
handleLog(logPackageArg: ILogPackage): Promise<void>;
private logInBrowser;
}

35
dist_ts/index.js Normal file
View File

@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmartlogDestinationDevtools = void 0;
class SmartlogDestinationDevtools {
async handleLog(logPackageArg) {
await this.logInBrowser(logPackageArg);
}
async logInBrowser(logPackage) {
switch (logPackage.level) {
case 'error':
console.log(`%c Error: %c ${logPackage.message}`, 'background:#000000;color:#800000;', 'color:#000000;');
break;
case 'info':
console.log(`%c Info: %c ${logPackage.message}`, 'background:#EC407A;color:#ffffff;', 'color:#EC407A;');
break;
case 'ok':
console.log(`%c OK: %c ${logPackage.message}`, 'background:#000000;color:#8BC34A;', 'color:#000000;');
break;
case 'success':
console.log(`%c Success: %c ${logPackage.message}`, 'background:#8BC34A;color:#ffffff;', 'color:#8BC34A;');
break;
case 'warn':
console.log(`%c Warn: %c ${logPackage.message}`, 'background:#000000;color:#FB8C00;', 'color:#000000;');
break;
case 'note':
console.log(`%c Note: %c ${logPackage.message}`, 'background:#42A5F5;color:#ffffff', 'color:#42A5F5;');
break;
default:
console.log(`unknown logType for "${logPackage.message}"`);
break;
}
}
}
exports.SmartlogDestinationDevtools = SmartlogDestinationDevtools;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSxNQUFhLDJCQUEyQjtJQUMvQixLQUFLLENBQUMsU0FBUyxDQUFDLGFBQTBCO1FBQy9DLE1BQU0sSUFBSSxDQUFDLFlBQVksQ0FBQyxhQUFhLENBQUMsQ0FBQztJQUN6QyxDQUFDO0lBRU8sS0FBSyxDQUFDLFlBQVksQ0FBQyxVQUF1QjtRQUNoRCxRQUFRLFVBQVUsQ0FBQyxLQUFLLEVBQUU7WUFDeEIsS0FBSyxPQUFPO2dCQUNWLE9BQU8sQ0FBQyxHQUFHLENBQ1QsZ0JBQWdCLFVBQVUsQ0FBQyxPQUFPLEVBQUUsRUFDcEMsbUNBQW1DLEVBQ25DLGdCQUFnQixDQUNqQixDQUFDO2dCQUNGLE1BQU07WUFDUixLQUFLLE1BQU07Z0JBQ1QsT0FBTyxDQUFDLEdBQUcsQ0FDVCxlQUFlLFVBQVUsQ0FBQyxPQUFPLEVBQUUsRUFDbkMsbUNBQW1DLEVBQ25DLGdCQUFnQixDQUNqQixDQUFDO2dCQUNGLE1BQU07WUFDUixLQUFLLElBQUk7Z0JBQ1AsT0FBTyxDQUFDLEdBQUcsQ0FDVCxhQUFhLFVBQVUsQ0FBQyxPQUFPLEVBQUUsRUFDakMsbUNBQW1DLEVBQ25DLGdCQUFnQixDQUNqQixDQUFDO2dCQUNGLE1BQU07WUFDUixLQUFLLFNBQVM7Z0JBQ1osT0FBTyxDQUFDLEdBQUcsQ0FDVCxrQkFBa0IsVUFBVSxDQUFDLE9BQU8sRUFBRSxFQUN0QyxtQ0FBbUMsRUFDbkMsZ0JBQWdCLENBQ2pCLENBQUM7Z0JBQ0YsTUFBTTtZQUNSLEtBQUssTUFBTTtnQkFDVCxPQUFPLENBQUMsR0FBRyxDQUNULGVBQWUsVUFBVSxDQUFDLE9BQU8sRUFBRSxFQUNuQyxtQ0FBbUMsRUFDbkMsZ0JBQWdCLENBQ2pCLENBQUM7Z0JBQ0YsTUFBTTtZQUNSLEtBQUssTUFBTTtnQkFDVCxPQUFPLENBQUMsR0FBRyxDQUNULGVBQWUsVUFBVSxDQUFDLE9BQU8sRUFBRSxFQUNuQyxrQ0FBa0MsRUFDbEMsZ0JBQWdCLENBQ2pCLENBQUM7Z0JBQ0YsTUFBTTtZQUNSO2dCQUNFLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLFVBQVUsQ0FBQyxPQUFPLEdBQUcsQ0FBQyxDQUFDO2dCQUMzRCxNQUFNO1NBQ1Q7SUFDSCxDQUFDO0NBQ0Y7QUF0REQsa0VBc0RDIn0=

View File

@ -2,32 +2,5 @@
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartlog-destination-devtools",
"shortDescription": "beautiful logging for the browser",
"npmPackagename": "@push.rocks/smartlog-destination-devtools",
"license": "MIT",
"description": "A library enabling enhanced logging in browser development tools.",
"keywords": [
"logging",
"browser",
"development tools",
"typescript",
"npm package",
"browser console",
"log management",
"visual logging",
"smartlog",
"devtools"
]
}
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}
}

11202
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +1,28 @@
{
"name": "@push.rocks/smartlog-destination-devtools",
"version": "1.0.12",
"name": "@pushrocks/smartlog-destination-devtools",
"version": "1.0.9",
"private": false,
"description": "A library enabling enhanced logging in browser development tools.",
"description": "beautiful logging for the browser",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)",
"buildDocs": "tsdoc"
"testBrowser": "(parcel ./test/index.html)",
"build": "(tsbuild --web)"
},
"devDependencies": {
"@git.zone/tsbuild": "^2.1.66",
"@git.zone/tstest": "^1.0.77",
"@push.rocks/smartlog": "^3.0.2",
"@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^20.12.12"
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.40",
"@pushrocks/smartlog": "^2.0.35",
"@pushrocks/tapbundle": "^3.2.7",
"@types/node": "^14.0.20",
"parcel-bundler": "^1.12.4",
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@push.rocks/smartlog-interfaces": "^3.0.0"
},
"browserslist": [
"last 1 chrome versions"
],
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"keywords": [
"logging",
"browser",
"development tools",
"typescript",
"npm package",
"browser console",
"log management",
"visual logging",
"smartlog",
"devtools"
],
"repository": {
"type": "git",
"url": "git+https://code.foss.global/push.rocks/smartlog-destination-devtools.git"
},
"bugs": {
"url": "https://code.foss.global/push.rocks/smartlog-destination-devtools/issues"
},
"homepage": "https://code.foss.global/push.rocks/smartlog-destination-devtools#readme",
"type": "module"
"@pushrocks/smartlog-interfaces": "^2.0.20"
}
}

6699
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@

107
readme.md
View File

@ -1,107 +0,0 @@
# @push.rocks/smartlog-destination-devtools
beautiful logging for the browser
## Install
To install `@push.rocks/smartlog-destination-devtools`, use the following command in your project:
```sh
npm install @push.rocks/smartlog-destination-devtools --save
```
This will add `smartlog-destination-devtools` as a dependency to your project and you can start using it to enhance your logging in the browser.
## Usage
`@push.rocks/smartlog-destination-devtools` provides a seamless way to output beautified log messages directly to your browser's console, making use of the `@push.rocks/smartlog` ecosystem for structured and meaningful logging.
### Getting Started
First, ensure you have `@push.rocks/smartlog` installed in your project. If not, install it alongside `smartlog-destination-devtools`:
```sh
npm install @push.rocks/smartlog @push.rocks/smartlog-destination-devtools --save
```
Now, let's set up the basic usage of `smartlog-destination-devtools` within a TypeScript project.
### Initialization
Import the required modules and initialize `Smartlog` and `SmartlogDestinationDevtools`.
```typescript
import { Smartlog, ISmartlogOptions, ILogContext } from '@push.rocks/smartlog';
import { SmartlogDestinationDevtools } from '@push.rocks/smartlog-destination-devtools';
// Define your log context
const logContext: ILogContext = {
company: 'Your Company',
companyunit: 'Your Company Unit',
containerName: 'YourContainerName',
environment: 'development',
runtime: 'browser',
zone: 'frontend',
};
// Set up Smartlog options
const smartlogOptions: ISmartlogOptions = {
minimumLogLevel: 'info',
logContext: logContext,
};
// Initialize Smartlog with options
const smartlogInstance = new Smartlog(smartlogOptions);
// Initialize the DevTools destination
const devtoolsDestination = new SmartlogDestinationDevtools();
// Add the DevTools destination to Smartlog
smartlogInstance.addDestination(devtoolsDestination);
```
### Logging
Now that setup is complete, you can start logging messages. `@push.rocks/smartlog` uses a structured format for logs, which `@push.rocks/smartlog-destination-devtools` will beautifully display in the console.
```typescript
// Log an information message
smartlogInstance.info('This is an informational message', { optional: 'additional data' });
// Log a warning
smartlogInstance.warn('This is a warning message', { check: 'some warning data' });
// Log an error
smartlogInstance.error('This is an error message', new Error('Something went wrong'));
```
### Customization
`SmartlogDestinationDevtools` class is designed to automatically handle log messages sent through `@push.rocks/smartlog` and print them to the browser's console in a visually structured and highlighted manner. Currently, it translates different log levels (`info`, `warn`, `error`, `note`, `success`) to different styles in the DevTools console.
Since the core feature of `smartlog-destination-devtools` is to enhance the visual feedback of logs in the development environment, further customization can be achieved by altering the source code of the `handleLog` method within the class to fit your styling needs or by extending the class with your own implementation.
### Advanced Usage
For more advanced scenarios like filtering logs or integrating with other logging systems, refer to the `@push.rocks/smartlog` documentation, as `smartlog-destination-devtools` acts as a destination for the logs managed by `@push.rocks/smartlog`.
---
By integrating `@push.rocks/smartlog-destination-devtools`, you're equipped to make your browser-based debugging and logging more effective and visually appealing, leveraging the structured logging capabilities of `@push.rocks/smartlog`.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -1,8 +1,8 @@
import { expect, tap } from '@push.rocks/tapbundle';
import { expect, tap } from '@pushrocks/tapbundle';
// preparation
import { type ILogContext } from '@push.rocks/smartlog-interfaces';
import * as smartlog from '@push.rocks/smartlog';
import { ILogContext } from '@pushrocks/smartlog-interfaces';
import * as smartlog from '@pushrocks/smartlog';
const logContext: ILogContext = {
company: 'Lossless GmbH',
@ -10,15 +10,15 @@ const logContext: ILogContext = {
containerName: 'testContainer',
environment: 'staging',
runtime: 'chrome',
zone: 'servezone',
zone: 'servezone'
};
const logger = new smartlog.Smartlog({
logContext,
logContext
});
// import the module to test
import * as smartlogDestinationDevtools from '../ts/index.js';
import * as smartlogDestinationDevtools from '../ts/index';
let testDestination: smartlogDestinationDevtools.SmartlogDestinationDevtools;
@ -35,8 +35,8 @@ tap.test('should log a normal message', async () => {
message: 'wait, what? Hi, this is a message!',
correlation: {
id: '123',
type: 'none',
},
type: 'none'
}
});
});
@ -49,8 +49,8 @@ tap.test('should log a success message', async () => {
message: 'success: Hi, this is a message!',
correlation: {
id: '123',
type: 'none',
},
type: 'none'
}
});
});

View File

@ -1,8 +0,0 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartlog-destination-devtools',
version: '1.0.12',
description: 'A library enabling enhanced logging in browser development tools.'
}

View File

@ -0,0 +1,2 @@
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
export { smartlogInterfaces };

View File

@ -1,5 +1,6 @@
import * as plugins from './plugins.js';
import type { ILogDestination, ILogPackage } from '@push.rocks/smartlog-interfaces';
import * as plugins from './beautybrowser.plugins';
import { ILogDestination, ILogPackage } from '@pushrocks/smartlog-interfaces';
export class SmartlogDestinationDevtools implements ILogDestination {
public async handleLog(logPackageArg: ILogPackage) {

View File

@ -1,2 +0,0 @@
import * as smartlogInterfaces from '@push.rocks/smartlog-interfaces';
export { smartlogInterfaces };

View File

@ -1,14 +0,0 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}