@domql/utils 2.27.0 → 2.27.11
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 -1
- package/dist/cjs/component.js +3 -2
- package/dist/cjs/env.js +12 -5
- package/dist/cjs/object.js +3 -2
- package/dist/esm/component.js +3 -2
- package/dist/esm/env.js +12 -5
- package/dist/esm/object.js +3 -2
- package/env.js +7 -6
- package/object.js +2 -1
- package/package.json +6 -6
package/component.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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'
|
|
@@ -176,7 +177,7 @@ export const applyComponentFromContext = (element, parent, options) => {
|
|
|
176
177
|
components[execExtend] || components['smbls.' + execExtend]
|
|
177
178
|
if (componentExists) element.extend = componentExists
|
|
178
179
|
else {
|
|
179
|
-
if ((ENV
|
|
180
|
+
if (isNotProduction(ENV) && options.verbose) {
|
|
180
181
|
console.warn(execExtend, 'is not in library', components, element)
|
|
181
182
|
console.warn('replacing with ', {})
|
|
182
183
|
}
|
package/dist/cjs/component.js
CHANGED
|
@@ -35,10 +35,11 @@ __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 =
|
|
42
|
+
const ENV = process.env.NODE_ENV;
|
|
42
43
|
const checkIfKeyIsComponent = (key) => {
|
|
43
44
|
const isFirstKeyString = (0, import_types.isString)(key);
|
|
44
45
|
if (!isFirstKeyString) return;
|
|
@@ -177,7 +178,7 @@ const applyComponentFromContext = (element, parent, options) => {
|
|
|
177
178
|
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
178
179
|
if (componentExists) element.extend = componentExists;
|
|
179
180
|
else {
|
|
180
|
-
if ((
|
|
181
|
+
if ((0, import_env.isNotProduction)(ENV) && options.verbose) {
|
|
181
182
|
console.warn(execExtend, "is not in library", components, element);
|
|
182
183
|
console.warn("replacing with ", {});
|
|
183
184
|
}
|
package/dist/cjs/env.js
CHANGED
|
@@ -21,12 +21,19 @@ __export(env_exports, {
|
|
|
21
21
|
NODE_ENV: () => NODE_ENV,
|
|
22
22
|
getNev: () => getNev,
|
|
23
23
|
isDevelopment: () => isDevelopment,
|
|
24
|
+
isNotProduction: () => isNotProduction,
|
|
24
25
|
isProduction: () => isProduction,
|
|
25
|
-
|
|
26
|
+
isStaging: () => isStaging,
|
|
27
|
+
isTest: () => isTest,
|
|
28
|
+
isTesting: () => isTesting
|
|
26
29
|
});
|
|
27
30
|
module.exports = __toCommonJS(env_exports);
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
31
|
+
// @preserve-env
|
|
32
|
+
const NODE_ENV = process.env.NODE_ENV;
|
|
33
|
+
const isProduction = (env = NODE_ENV) => env === "production";
|
|
34
|
+
const isTest = (env = NODE_ENV) => env === "testing" || env === "test";
|
|
35
|
+
const isTesting = isTest;
|
|
36
|
+
const isStaging = (env = NODE_ENV) => env === "staging";
|
|
37
|
+
const isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev" || env === "local";
|
|
32
38
|
const getNev = (key, env = NODE_ENV) => env[key];
|
|
39
|
+
const isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
package/dist/cjs/object.js
CHANGED
|
@@ -63,7 +63,8 @@ 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
|
+
const ENV = process.env.NODE_ENV;
|
|
67
68
|
const exec = (param, element, state, context) => {
|
|
68
69
|
if ((0, import_types.isFunction)(param)) {
|
|
69
70
|
return param.call(
|
|
@@ -694,7 +695,7 @@ const detectInfiniteLoop = (arr) => {
|
|
|
694
695
|
repeatCount = 1;
|
|
695
696
|
}
|
|
696
697
|
if (repeatCount >= maxRepeats * 2) {
|
|
697
|
-
if (
|
|
698
|
+
if ((0, import_env.isNotProduction)(ENV)) {
|
|
698
699
|
console.warn(
|
|
699
700
|
"Warning: Potential infinite loop detected due to repeated sequence:",
|
|
700
701
|
pattern
|
package/dist/esm/component.js
CHANGED
|
@@ -17,10 +17,11 @@ 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 =
|
|
24
|
+
const ENV = process.env.NODE_ENV;
|
|
24
25
|
const checkIfKeyIsComponent = (key) => {
|
|
25
26
|
const isFirstKeyString = isString(key);
|
|
26
27
|
if (!isFirstKeyString) return;
|
|
@@ -158,7 +159,7 @@ const applyComponentFromContext = (element, parent, options) => {
|
|
|
158
159
|
const componentExists = components[execExtend] || components["smbls." + execExtend];
|
|
159
160
|
if (componentExists) element.extend = componentExists;
|
|
160
161
|
else {
|
|
161
|
-
if ((ENV
|
|
162
|
+
if (isNotProduction(ENV) && options.verbose) {
|
|
162
163
|
console.warn(execExtend, "is not in library", components, element);
|
|
163
164
|
console.warn("replacing with ", {});
|
|
164
165
|
}
|
package/dist/esm/env.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
// @preserve-env
|
|
2
|
+
const NODE_ENV = process.env.NODE_ENV;
|
|
3
|
+
const isProduction = (env = NODE_ENV) => env === "production";
|
|
4
|
+
const isTest = (env = NODE_ENV) => env === "testing" || env === "test";
|
|
5
|
+
const isTesting = isTest;
|
|
6
|
+
const isStaging = (env = NODE_ENV) => env === "staging";
|
|
7
|
+
const isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev" || env === "local";
|
|
5
8
|
const getNev = (key, env = NODE_ENV) => env[key];
|
|
9
|
+
const isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
6
10
|
export {
|
|
7
11
|
NODE_ENV,
|
|
8
12
|
getNev,
|
|
9
13
|
isDevelopment,
|
|
14
|
+
isNotProduction,
|
|
10
15
|
isProduction,
|
|
11
|
-
|
|
16
|
+
isStaging,
|
|
17
|
+
isTest,
|
|
18
|
+
isTesting
|
|
12
19
|
};
|
package/dist/esm/object.js
CHANGED
|
@@ -32,7 +32,8 @@ 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
|
+
const ENV = process.env.NODE_ENV;
|
|
36
37
|
const exec = (param, element, state, context) => {
|
|
37
38
|
if (isFunction(param)) {
|
|
38
39
|
return param.call(
|
|
@@ -662,7 +663,7 @@ const detectInfiniteLoop = (arr) => {
|
|
|
662
663
|
repeatCount = 1;
|
|
663
664
|
}
|
|
664
665
|
if (repeatCount >= maxRepeats * 2) {
|
|
665
|
-
if (ENV
|
|
666
|
+
if (isNotProduction(ENV)) {
|
|
666
667
|
console.warn(
|
|
667
668
|
"Warning: Potential infinite loop detected due to repeated sequence:",
|
|
668
669
|
pattern
|
package/env.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
// @preserve-env
|
|
3
4
|
export const NODE_ENV = process.env.NODE_ENV
|
|
4
5
|
|
|
5
|
-
export const isProduction = (env = NODE_ENV) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const
|
|
6
|
+
export const isProduction = (env = NODE_ENV) => env === 'production'
|
|
7
|
+
export const isTest = (env = NODE_ENV) => env === 'testing' || env === 'test'
|
|
8
|
+
export const isTesting = isTest
|
|
9
|
+
export const isStaging = (env = NODE_ENV) => env === 'staging'
|
|
9
10
|
export const isDevelopment = (env = NODE_ENV) =>
|
|
10
|
-
env === 'development' || env === 'dev'
|
|
11
|
-
|
|
11
|
+
env === 'development' || env === 'dev' || env === 'local'
|
|
12
12
|
export const getNev = (key, env = NODE_ENV) => env[key]
|
|
13
|
+
export const isNotProduction = (env = NODE_ENV) => !isProduction(env)
|
package/object.js
CHANGED
|
@@ -15,6 +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
|
+
import { isNotProduction } from './env.js'
|
|
18
19
|
|
|
19
20
|
const ENV = process.env.NODE_ENV
|
|
20
21
|
|
|
@@ -888,7 +889,7 @@ export const detectInfiniteLoop = arr => {
|
|
|
888
889
|
|
|
889
890
|
// If the pattern repeats more than `maxRepeats`, throw a warning
|
|
890
891
|
if (repeatCount >= maxRepeats * 2) {
|
|
891
|
-
if (ENV
|
|
892
|
+
if (isNotProduction(ENV)) {
|
|
892
893
|
console.warn(
|
|
893
894
|
'Warning: Potential infinite loop detected due to repeated sequence:',
|
|
894
895
|
pattern
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/utils",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.11",
|
|
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": "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": "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": "0189e4620f901c763754d06de65bcf6075c05618",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/core": "^7.26.0"
|
|
30
30
|
}
|