@yaasl/utils 0.7.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/index.d.ts +3 -0
- package/dist/@types/log.d.ts +5 -0
- package/dist/@types/mockConsole.d.ts +6 -0
- package/dist/@types/utilTypes.d.ts +5 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/log.js +10 -0
- package/dist/cjs/mockConsole.js +11 -0
- package/dist/cjs/utilTypes.js +2 -0
- package/dist/mjs/index.js +3 -0
- package/dist/mjs/log.js +6 -0
- package/dist/mjs/mockConsole.js +7 -0
- package/dist/mjs/utilTypes.js +1 -0
- package/package.json +49 -0
- package/tsconfig.json +3 -0
- package/tsconfig.node.json +9 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./log"), exports);
|
|
18
|
+
__exportStar(require("./utilTypes"), exports);
|
|
19
|
+
__exportStar(require("./mockConsole"), exports);
|
package/dist/cjs/log.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.log = exports.consoleMessage = void 0;
|
|
4
|
+
const consoleMessage = (text) => `${text} (yaasl)`;
|
|
5
|
+
exports.consoleMessage = consoleMessage;
|
|
6
|
+
const logger = (type, text, value) => console[type]((0, exports.consoleMessage)(text), ...(!value ? [] : ["\n\n", value]));
|
|
7
|
+
exports.log = {
|
|
8
|
+
warn: (text, value) => logger("warn", text, value),
|
|
9
|
+
error: (text, value) => logger("error", text, value),
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockConsole = void 0;
|
|
4
|
+
const mockConsole = () => {
|
|
5
|
+
const oldConsole = global.console;
|
|
6
|
+
const error = jest.fn();
|
|
7
|
+
const warn = jest.fn();
|
|
8
|
+
global.console = Object.assign(Object.assign({}, global.console), { error, warn });
|
|
9
|
+
return { error, warn, resetConsole: () => (global.console = oldConsole) };
|
|
10
|
+
};
|
|
11
|
+
exports.mockConsole = mockConsole;
|
package/dist/mjs/log.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const consoleMessage = (text) => `${text} (yaasl)`;
|
|
2
|
+
const logger = (type, text, value) => console[type](consoleMessage(text), ...(!value ? [] : ["\n\n", value]));
|
|
3
|
+
export const log = {
|
|
4
|
+
warn: (text, value) => logger("warn", text, value),
|
|
5
|
+
error: (text, value) => logger("error", text, value),
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yaasl/utils",
|
|
3
|
+
"version": "0.7.0-alpha.0",
|
|
4
|
+
"description": "Utilities for @yaasl packages",
|
|
5
|
+
"author": "PrettyCoffee",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/PrettyCoffee/yaasl#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/PrettyCoffee/yaasl.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/PrettyCoffee/yaasl/issues"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/cjs/index.js",
|
|
16
|
+
"types": "./dist/@types/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"types": "./dist/@types/index.d.ts",
|
|
19
|
+
"import": "./dist/mjs/index.js",
|
|
20
|
+
"require": "./dist/cjs/index.js"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "run-s clean compile",
|
|
24
|
+
"clean": "rimraf ./dist",
|
|
25
|
+
"compile": "run-p compile:mjs compile:cjs compile:types",
|
|
26
|
+
"compile:mjs": "tsc -p ./tsconfig.node.json --outDir ./dist/mjs -m es2020 -t es2020",
|
|
27
|
+
"compile:cjs": "tsc -p ./tsconfig.node.json --outDir ./dist/cjs -m commonjs -t es2015",
|
|
28
|
+
"compile:types": "tsc -p ./tsconfig.node.json --outDir ./dist/@types --declaration --emitDeclarationOnly",
|
|
29
|
+
"test": "jest --testMatch ./**/*.test.* --passWithNoTests",
|
|
30
|
+
"test:watch": "npm run test -- --watchAll",
|
|
31
|
+
"lint": "eslint ./src",
|
|
32
|
+
"lint:fix": "eslint ./src --fix",
|
|
33
|
+
"validate": "run-s lint test build"
|
|
34
|
+
},
|
|
35
|
+
"jest": {
|
|
36
|
+
"preset": "ts-jest",
|
|
37
|
+
"testEnvironment": "jsdom"
|
|
38
|
+
},
|
|
39
|
+
"eslintConfig": {
|
|
40
|
+
"extends": [
|
|
41
|
+
"../../.eslintrc"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"lint-staged": {
|
|
45
|
+
"*.{ts,tsx}": [
|
|
46
|
+
"npm run lint:fix"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
package/tsconfig.json
ADDED