@domql/report 2.5.162 → 3.0.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/cjs/index.js CHANGED
@@ -16,12 +16,12 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var report_exports = {};
20
- __export(report_exports, {
19
+ var index_exports = {};
20
+ __export(index_exports, {
21
21
  ERRORS_REGISTRY: () => ERRORS_REGISTRY,
22
22
  report: () => report
23
23
  });
24
- module.exports = __toCommonJS(report_exports);
24
+ module.exports = __toCommonJS(index_exports);
25
25
  const ERRORS_REGISTRY = {
26
26
  en: {
27
27
  DocumentNotDefined: {
@@ -77,8 +77,7 @@ const ERRORS_REGISTRY = {
77
77
  const report = (err, arg, element) => {
78
78
  const currentLang = "en";
79
79
  let errObj;
80
- if (err && typeof err === "string")
81
- errObj = ERRORS_REGISTRY[currentLang][err];
80
+ if (err && typeof err === "string") errObj = ERRORS_REGISTRY[currentLang][err];
82
81
  return new Error(
83
82
  `"${err}", "${arg}"
84
83
 
@@ -0,0 +1,70 @@
1
+ const ERRORS_REGISTRY = {
2
+ en: {
3
+ DocumentNotDefined: {
4
+ title: "Document is undefined",
5
+ description: "To tweak with DOM, you should use browser."
6
+ },
7
+ OverwriteToBuiltin: {
8
+ title: "Overwriting to builtin method",
9
+ description: "Overwriting a builtin method in the window define is not possible, please choose different name"
10
+ },
11
+ BrowserNotDefined: {
12
+ title: "Can't recognize environment",
13
+ description: "Environment should be browser application, that can run Javascript"
14
+ },
15
+ SetQuickPreferancesIsNotObject: {
16
+ title: "Quick preferances object is required",
17
+ description: 'Please pass a plain object with "lang", "culture" and "area" properties'
18
+ },
19
+ InvalidParams: {
20
+ title: "Params are invalid",
21
+ description: 'Please pass a plain object with "lang", "culture" and "area" properties'
22
+ },
23
+ CantCreateWithoutNode: {
24
+ title: "You must provide node",
25
+ description: "Can't create DOM element without setting node or text"
26
+ },
27
+ HTMLInvalidTag: {
28
+ title: "Element tag name (or DOM nodeName) is invalid",
29
+ description: "To create element, you must provide valid DOM node. See full list of them at here: http://www.w3schools.com/tags/"
30
+ },
31
+ HTMLInvalidAttr: {
32
+ title: "Attibutes object is invalid",
33
+ description: "Please pass a valid plain object to apply as an attributes for a DOM node"
34
+ },
35
+ HTMLInvalidData: {
36
+ title: "Data object is invalid",
37
+ description: "Please pass a valid plain object to apply as an dataset for a DOM node"
38
+ },
39
+ HTMLInvalidStyles: {
40
+ title: "Styles object is invalid",
41
+ description: "Please pass a valid plain object to apply as an style for a DOM node"
42
+ },
43
+ HTMLInvalidText: {
44
+ title: "Text string is invalid",
45
+ description: "Please pass a valid string to apply text to DOM node"
46
+ },
47
+ ElementOnStateIsNotDefined: {
48
+ title: "Element on state is not defined",
49
+ description: "Please check the element object"
50
+ }
51
+ }
52
+ };
53
+ const report = (err, arg, element) => {
54
+ const currentLang = "en";
55
+ let errObj;
56
+ if (err && typeof err === "string") errObj = ERRORS_REGISTRY[currentLang][err];
57
+ return new Error(
58
+ `"${err}", "${arg}"
59
+
60
+ `,
61
+ `${errObj.description}`,
62
+ element ? `
63
+
64
+ ${element}` : ""
65
+ );
66
+ };
67
+ export {
68
+ ERRORS_REGISTRY,
69
+ report
70
+ };
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "@domql/report",
3
- "version": "2.5.162",
3
+ "version": "3.0.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "module": "dist/esm/index.js",
7
- "unpkg": "dist/iife/index.js",
8
- "jsdelivr": "dist/iife/index.js",
9
- "main": "dist/esm/index.js",
10
- "exports": "./dist/cjs/index.js",
6
+ "module": "index.js",
7
+ "main": "index.js",
11
8
  "source": "index.js",
9
+ "exports": {
10
+ ".": {
11
+ "default": "./dist/esm/index.js",
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/cjs/index.js"
14
+ }
15
+ },
12
16
  "files": [
13
17
  "*.js",
14
18
  "dist"
@@ -18,8 +22,8 @@
18
22
  "build:esm": "npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm",
19
23
  "build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
20
24
  "build:iife": "npx esbuild *.js --target=node16 --format=iife --outdir=dist/iife",
21
- "build": "npm run build:cjs",
25
+ "build": "rimraf -I dist; npm run build:cjs; npm run build:esm",
22
26
  "prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
23
27
  },
24
- "gitHead": "0aeb25f284d863a57821a0a74937c2b9babb7969"
28
+ "gitHead": "bcbdc271a602b958de6a60ab387ea7715a935dc1"
25
29
  }