@domql/utils 2.27.0 → 2.27.10
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/component.js +2 -3
- package/dist/cjs/component.js +2 -2
- package/dist/cjs/env.js +14 -5
- package/dist/cjs/object.js +2 -2
- package/dist/esm/component.js +2 -2
- package/dist/esm/env.js +14 -5
- package/dist/esm/object.js +2 -2
- package/env.js +8 -6
- package/object.js +2 -3
- package/package.json +6 -6
package/component.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
import { isNotProduction } from './env.js'
|
|
3
4
|
import { joinArrays } from './array.js'
|
|
4
5
|
import { deepClone, exec } from './object.js'
|
|
5
6
|
import { isArray, isFunction, isObject, isString } from './types.js'
|
|
6
7
|
|
|
7
|
-
const ENV = process.env.NODE_ENV
|
|
8
|
-
|
|
9
8
|
export const checkIfKeyIsComponent = key => {
|
|
10
9
|
const isFirstKeyString = isString(key)
|
|
11
10
|
if (!isFirstKeyString) return
|
|
@@ -176,7 +175,7 @@ export const applyComponentFromContext = (element, parent, options) => {
|
|
|
176
175
|
components[execExtend] || components['smbls.' + execExtend]
|
|
177
176
|
if (componentExists) element.extend = componentExists
|
|
178
177
|
else {
|
|
179
|
-
if ((
|
|
178
|
+
if (isNotProduction() && options.verbose) {
|
|
180
179
|
console.warn(execExtend, 'is not in library', components, element)
|
|
181
180
|
console.warn('replacing with ', {})
|
|
182
181
|
}
|
package/dist/cjs/component.js
CHANGED
|
@@ -35,10 +35,10 @@ __export(component_exports, {
|
|
|
35
35
|
setContentKey: () => setContentKey
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(component_exports);
|
|
38
|
+
var import_env = require("./env.js");
|
|
38
39
|
var import_array = require("./array.js");
|
|
39
40
|
var import_object = require("./object.js");
|
|
40
41
|
var import_types = require("./types.js");
|
|
41
|
-
const ENV = "development";
|
|
42
42
|
const checkIfKeyIsComponent = (key) => {
|
|
43
43
|
const isFirstKeyString = (0, import_types.isString)(key);
|
|
44
44
|
if (!isFirstKeyString) return;
|
|
@@ -177,7 +177,7 @@ const applyComponentFromContext = (element, parent, options) => {
|
|
|
177
177
|
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
178
178
|
if (componentExists) element.extend = componentExists;
|
|
179
179
|
else {
|
|
180
|
-
if ((
|
|
180
|
+
if ((0, import_env.isNotProduction)() && options.verbose) {
|
|
181
181
|
console.warn(execExtend, "is not in library", components, element);
|
|
182
182
|
console.warn("replacing with ", {});
|
|
183
183
|
}
|
package/dist/cjs/env.js
CHANGED
|
@@ -18,15 +18,24 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var env_exports = {};
|
|
20
20
|
__export(env_exports, {
|
|
21
|
+
ENV: () => ENV,
|
|
21
22
|
NODE_ENV: () => NODE_ENV,
|
|
22
23
|
getNev: () => getNev,
|
|
23
24
|
isDevelopment: () => isDevelopment,
|
|
25
|
+
isNotProduction: () => isNotProduction,
|
|
24
26
|
isProduction: () => isProduction,
|
|
25
|
-
|
|
27
|
+
isStaging: () => isStaging,
|
|
28
|
+
isTest: () => isTest,
|
|
29
|
+
isTesting: () => isTesting
|
|
26
30
|
});
|
|
27
31
|
module.exports = __toCommonJS(env_exports);
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
+
// @preserve-env
|
|
33
|
+
const NODE_ENV = process.env.NODE_ENV;
|
|
34
|
+
const ENV = NODE_ENV;
|
|
35
|
+
const isProduction = (env = NODE_ENV) => env === "production";
|
|
36
|
+
const isTest = (env = NODE_ENV) => env === "testing" || env === "test";
|
|
37
|
+
const isTesting = isTest;
|
|
38
|
+
const isStaging = (env = NODE_ENV) => env === "staging";
|
|
39
|
+
const isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev" || env === "local";
|
|
32
40
|
const getNev = (key, env = NODE_ENV) => env[key];
|
|
41
|
+
const isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
package/dist/cjs/object.js
CHANGED
|
@@ -63,7 +63,7 @@ var import_types = require("./types.js");
|
|
|
63
63
|
var import_array = require("./array.js");
|
|
64
64
|
var import_string = require("./string.js");
|
|
65
65
|
var import_node = require("./node.js");
|
|
66
|
-
|
|
66
|
+
var import_env = require("./env.js");
|
|
67
67
|
const exec = (param, element, state, context) => {
|
|
68
68
|
if ((0, import_types.isFunction)(param)) {
|
|
69
69
|
return param.call(
|
|
@@ -694,7 +694,7 @@ const detectInfiniteLoop = (arr) => {
|
|
|
694
694
|
repeatCount = 1;
|
|
695
695
|
}
|
|
696
696
|
if (repeatCount >= maxRepeats * 2) {
|
|
697
|
-
if (
|
|
697
|
+
if ((0, import_env.isNotProduction)()) {
|
|
698
698
|
console.warn(
|
|
699
699
|
"Warning: Potential infinite loop detected due to repeated sequence:",
|
|
700
700
|
pattern
|
package/dist/esm/component.js
CHANGED
|
@@ -17,10 +17,10 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { isNotProduction } from "./env.js";
|
|
20
21
|
import { joinArrays } from "./array.js";
|
|
21
22
|
import { deepClone, exec } from "./object.js";
|
|
22
23
|
import { isArray, isFunction, isObject, isString } from "./types.js";
|
|
23
|
-
const ENV = "development";
|
|
24
24
|
const checkIfKeyIsComponent = (key) => {
|
|
25
25
|
const isFirstKeyString = isString(key);
|
|
26
26
|
if (!isFirstKeyString) return;
|
|
@@ -158,7 +158,7 @@ const applyComponentFromContext = (element, parent, options) => {
|
|
|
158
158
|
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
159
159
|
if (componentExists) element.extend = componentExists;
|
|
160
160
|
else {
|
|
161
|
-
if ((
|
|
161
|
+
if (isNotProduction() && options.verbose) {
|
|
162
162
|
console.warn(execExtend, "is not in library", components, element);
|
|
163
163
|
console.warn("replacing with ", {});
|
|
164
164
|
}
|
package/dist/esm/env.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
// @preserve-env
|
|
2
|
+
const NODE_ENV = process.env.NODE_ENV;
|
|
3
|
+
const ENV = NODE_ENV;
|
|
4
|
+
const isProduction = (env = NODE_ENV) => env === "production";
|
|
5
|
+
const isTest = (env = NODE_ENV) => env === "testing" || env === "test";
|
|
6
|
+
const isTesting = isTest;
|
|
7
|
+
const isStaging = (env = NODE_ENV) => env === "staging";
|
|
8
|
+
const isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev" || env === "local";
|
|
5
9
|
const getNev = (key, env = NODE_ENV) => env[key];
|
|
10
|
+
const isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
6
11
|
export {
|
|
12
|
+
ENV,
|
|
7
13
|
NODE_ENV,
|
|
8
14
|
getNev,
|
|
9
15
|
isDevelopment,
|
|
16
|
+
isNotProduction,
|
|
10
17
|
isProduction,
|
|
11
|
-
|
|
18
|
+
isStaging,
|
|
19
|
+
isTest,
|
|
20
|
+
isTesting
|
|
12
21
|
};
|
package/dist/esm/object.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import { mergeAndCloneIfArray, mergeArray } from "./array.js";
|
|
33
33
|
import { stringIncludesAny } from "./string.js";
|
|
34
34
|
import { isDOMNode } from "./node.js";
|
|
35
|
-
|
|
35
|
+
import { isNotProduction } from "./env.js";
|
|
36
36
|
const exec = (param, element, state, context) => {
|
|
37
37
|
if (isFunction(param)) {
|
|
38
38
|
return param.call(
|
|
@@ -662,7 +662,7 @@ const detectInfiniteLoop = (arr) => {
|
|
|
662
662
|
repeatCount = 1;
|
|
663
663
|
}
|
|
664
664
|
if (repeatCount >= maxRepeats * 2) {
|
|
665
|
-
if (
|
|
665
|
+
if (isNotProduction()) {
|
|
666
666
|
console.warn(
|
|
667
667
|
"Warning: Potential infinite loop detected due to repeated sequence:",
|
|
668
668
|
pattern
|
package/env.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// @preserve-env
|
|
3
4
|
export const NODE_ENV = process.env.NODE_ENV
|
|
5
|
+
export const ENV = NODE_ENV
|
|
4
6
|
|
|
5
|
-
export const isProduction = (env = NODE_ENV) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const
|
|
7
|
+
export const isProduction = (env = NODE_ENV) => env === 'production'
|
|
8
|
+
export const isTest = (env = NODE_ENV) => env === 'testing' || env === 'test'
|
|
9
|
+
export const isTesting = isTest
|
|
10
|
+
export const isStaging = (env = NODE_ENV) => env === 'staging'
|
|
9
11
|
export const isDevelopment = (env = NODE_ENV) =>
|
|
10
|
-
env === 'development' || env === 'dev'
|
|
11
|
-
|
|
12
|
+
env === 'development' || env === 'dev' || env === 'local'
|
|
12
13
|
export const getNev = (key, env = NODE_ENV) => env[key]
|
|
14
|
+
export const isNotProduction = (env = NODE_ENV) => !isProduction(env)
|
package/object.js
CHANGED
|
@@ -15,8 +15,7 @@ import {
|
|
|
15
15
|
import { mergeAndCloneIfArray, mergeArray } from './array.js'
|
|
16
16
|
import { stringIncludesAny } from './string.js'
|
|
17
17
|
import { isDOMNode } from './node.js'
|
|
18
|
-
|
|
19
|
-
const ENV = process.env.NODE_ENV
|
|
18
|
+
import { isNotProduction } from './env.js'
|
|
20
19
|
|
|
21
20
|
export const exec = (param, element, state, context) => {
|
|
22
21
|
if (isFunction(param)) {
|
|
@@ -888,7 +887,7 @@ export const detectInfiniteLoop = arr => {
|
|
|
888
887
|
|
|
889
888
|
// If the pattern repeats more than `maxRepeats`, throw a warning
|
|
890
889
|
if (repeatCount >= maxRepeats * 2) {
|
|
891
|
-
if (
|
|
890
|
+
if (isNotProduction()) {
|
|
892
891
|
console.warn(
|
|
893
892
|
'Warning: Potential infinite loop detected due to repeated sequence:',
|
|
894
893
|
pattern
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"default": "./dist/esm/index.js",
|
|
11
10
|
"import": "./dist/esm/index.js",
|
|
12
|
-
"require": "./dist/cjs/index.js"
|
|
11
|
+
"require": "./dist/cjs/index.js",
|
|
12
|
+
"default": "./dist/esm/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"source": "index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
|
|
22
|
-
"build:esm": "npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm",
|
|
23
|
-
"build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
|
|
22
|
+
"build:esm": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV",
|
|
23
|
+
"build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs --define:process.env.NODE_ENV=process.env.NODE_ENV",
|
|
24
24
|
"build": "npx rimraf -I dist; npm run build:cjs; npm run build:esm",
|
|
25
25
|
"prepublish": "npm run build; npm run copy:package:cjs"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "668d24f518bdb163357897504c5912c085638d3e",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/core": "^7.26.0"
|
|
30
30
|
}
|