diff --git a/packages/core/package.json b/packages/core/package.json
index d5972017..b011e66c 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/core",
- "version": "0.21.0",
+ "version": "0.21.1",
"description": "The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS)",
"author": "AlexPlex",
"license": "MIT",
diff --git a/packages/core/src/component/component.ts b/packages/core/src/component/component.ts
index 285bc322..ff5c149b 100644
--- a/packages/core/src/component/component.ts
+++ b/packages/core/src/component/component.ts
@@ -4,8 +4,6 @@ import { error, detectIsEmpty } from '../helpers';
import type { Ref } from '../ref';
import type { CreateElement, ComponentFactory, ComponentOptions, ShouldUpdate, StandardComponentProps } from './types';
-const __DEV__ = process.env.NODE_ENV === 'development';
-
const $$component = Symbol('component');
class Component
{
public type: CreateElement
;
@@ -39,7 +37,7 @@ function component
(type: CreateElement
, options: Component
if (!keepRef && props.ref) {
delete props.ref;
- if (__DEV__) {
+ if (process.env.NODE_ENV !== 'production') {
error(`[Dark]: To use ref you need to wrap the component with forwardRef!`);
}
}
diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts
index a53feaff..02dc8353 100644
--- a/packages/core/src/constants.ts
+++ b/packages/core/src/constants.ts
@@ -1,4 +1,4 @@
-export const VERSION = '0.21.0';
+export const VERSION = '0.21.1';
export const ROOT = 'root';
export const REPLACER = 'dark:matter';
export const INDEX_KEY = 'dark:idx';
diff --git a/packages/core/src/fiber/fiber.ts b/packages/core/src/fiber/fiber.ts
index 3d68d3d8..0fd4e8f2 100644
--- a/packages/core/src/fiber/fiber.ts
+++ b/packages/core/src/fiber/fiber.ts
@@ -54,8 +54,6 @@ import { unmountFiber } from '../unmount';
import { Text } from '../view';
import { Fragment, detectIsFragment } from '../fragment';
-const __DEV__ = process.env.NODE_ENV === 'development';
-
const cloneTagMap = {
[EffectTag.CREATE]: true,
};
@@ -431,33 +429,33 @@ function performAlternate(alternate: Fiber, instance: DarkElementInstance) {
if (nextKey !== prevKey) {
if (nextKey !== null && !prevKeysMap[nextKey]) {
if (prevKey !== null && !nextKeysMap[prevKey]) {
- __DEV__ && result.push([[nextKey, prevKey], 'replace']);
+ process.env.NODE_ENV !== 'production' && result.push([[nextKey, prevKey], 'replace']);
nextKeyFiber.effectTag = EffectTag.CREATE;
prevKeyFiber.effectTag = EffectTag.DELETE;
deletionsStore.add(prevKeyFiber);
} else {
- __DEV__ && result.push([nextKey, 'insert']);
+ process.env.NODE_ENV !== 'production' && result.push([nextKey, 'insert']);
nextKeyFiber.effectTag = EffectTag.CREATE;
p++;
size++;
}
nextFiber = insertToFiber(i, nextFiber, nextKeyFiber);
} else if (!nextKeysMap[prevKey]) {
- __DEV__ && result.push([prevKey, 'remove']);
+ process.env.NODE_ENV !== 'production' && result.push([prevKey, 'remove']);
prevKeyFiber.effectTag = EffectTag.DELETE;
deletionsStore.add(prevKeyFiber);
n++;
idx--;
size++;
} else if (nextKeysMap[prevKey] && nextKeysMap[nextKey]) {
- __DEV__ && result.push([[nextKey, prevKey], 'move']);
+ process.env.NODE_ENV !== 'production' && result.push([[nextKey, prevKey], 'move']);
nextKeyFiber.effectTag = EffectTag.UPDATE;
prevKeyFiber.effectTag = EffectTag.UPDATE;
nextKeyFiber.move = true;
nextFiber = insertToFiber(i, nextFiber, nextKeyFiber);
}
} else if (nextKey !== null) {
- __DEV__ && result.push([nextKey, 'stable']);
+ process.env.NODE_ENV !== 'production' && result.push([nextKey, 'stable']);
nextKeyFiber.effectTag = EffectTag.UPDATE;
nextFiber = insertToFiber(i, nextFiber, nextKeyFiber);
}
@@ -471,7 +469,7 @@ function performAlternate(alternate: Fiber, instance: DarkElementInstance) {
}
function performMemo(fiber: Fiber) {
- if (__DEV__) {
+ if (process.env.NODE_ENV !== 'production') {
if (hot.get()) return;
}
@@ -607,7 +605,7 @@ function extractKeys(alternate: Fiber, children: Array) {
const key = getElementKey(instance);
const nextKey = detectIsEmpty(key) ? createIndexKey(idx) : key;
- if (__DEV__) {
+ if (process.env.NODE_ENV !== 'production') {
if (usedKeysMap[nextKey]) {
error(`[Dark]: The key of node [${nextKey}] already has been used!`, [instance]);
}
@@ -702,8 +700,8 @@ function detectAreSameInstanceTypes(
nextInstance: DarkElementInstance,
isComponentFactories = false,
) {
- if (__DEV__) {
- if (hot.get()) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (process.env.NODE_ENV === 'development' && hot.get()) {
if (detectIsComponent(prevInstance) && detectIsComponent(nextInstance)) {
return prevInstance.displayName === nextInstance.displayName;
}
@@ -732,8 +730,8 @@ function createHook(): Hook {
}
function commitChanges() {
- if (__DEV__) {
- hot.set(false);
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV === 'development' && hot.set(false);
}
if (isHydrateZone.get() && detectHasRegisteredLazy()) return flush(null); // important order
const wipFiber = wipRootStore.get();
diff --git a/packages/core/src/hot/hot.ts b/packages/core/src/hot/hot.ts
index b9c68833..1f920035 100644
--- a/packages/core/src/hot/hot.ts
+++ b/packages/core/src/hot/hot.ts
@@ -1,10 +1,8 @@
import { hot } from '../scope';
-const __DEV__ = process.env.NODE_ENV === 'development';
-
function hot$(update: () => void) {
- if (__DEV__) {
- hot.set(true);
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV === 'development' && hot.set(true);
}
update();
}
diff --git a/packages/native-navigation/package.json b/packages/native-navigation/package.json
index bd483162..273d1cd5 100644
--- a/packages/native-navigation/package.json
+++ b/packages/native-navigation/package.json
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/native-navigation",
- "version": "0.21.0",
+ "version": "0.21.1",
"description": "Dark navigation for NativeScript platform",
"author": "AlexPlex",
"license": "MIT",
diff --git a/packages/native-navigation/src/constants.ts b/packages/native-navigation/src/constants.ts
index 178680a0..431f0817 100644
--- a/packages/native-navigation/src/constants.ts
+++ b/packages/native-navigation/src/constants.ts
@@ -1,4 +1,4 @@
-export const VERSION = '0.21.0';
+export const VERSION = '0.21.1';
export const SLASH = '/';
export enum TransitionName {
diff --git a/packages/platform-browser/package.json b/packages/platform-browser/package.json
index a7ba77d5..0e31a6e5 100644
--- a/packages/platform-browser/package.json
+++ b/packages/platform-browser/package.json
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/platform-browser",
- "version": "0.21.0",
+ "version": "0.21.1",
"description": "Dark renderer for browser",
"author": "AlexPlex",
"license": "MIT",
diff --git a/packages/platform-browser/src/constants.ts b/packages/platform-browser/src/constants.ts
index 989360ba..0a1c9656 100644
--- a/packages/platform-browser/src/constants.ts
+++ b/packages/platform-browser/src/constants.ts
@@ -1,4 +1,4 @@
-export const VERSION = '0.21.0';
+export const VERSION = '0.21.1';
export const SVG_TAG_NAMES =
'svg,animate,animateMotion,animateTransform,circle,clipPath,defs,desc,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,image,line,linearGradient,marker,mask,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,stop,switch,symbol,text,textPath,tspan,use,view';
export const VOID_TAG_NAMES = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
diff --git a/packages/platform-native/package.json b/packages/platform-native/package.json
index 2e50ec27..31455680 100644
--- a/packages/platform-native/package.json
+++ b/packages/platform-native/package.json
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/platform-native",
- "version": "0.21.0",
+ "version": "0.21.1",
"description": "Dark renderer to native platforms like Android and iOS via NativeScript",
"author": "AlexPlex",
"license": "MIT",
diff --git a/packages/platform-native/src/constants.ts b/packages/platform-native/src/constants.ts
index 4f82cd70..1f0cf40c 100644
--- a/packages/platform-native/src/constants.ts
+++ b/packages/platform-native/src/constants.ts
@@ -1,4 +1,4 @@
-export const VERSION = '0.21.0';
+export const VERSION = '0.21.1';
export const ANDROID = 'android';
export const IOS = 'ios';
export const ATTR_TEXT = 'text';
diff --git a/packages/platform-server/package.json b/packages/platform-server/package.json
index 87638324..8436871c 100644
--- a/packages/platform-server/package.json
+++ b/packages/platform-server/package.json
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/platform-server",
- "version": "0.21.0",
+ "version": "0.21.1",
"description": "Dark renderer for server",
"author": "AlexPlex",
"license": "MIT",
diff --git a/packages/platform-server/src/constants.ts b/packages/platform-server/src/constants.ts
index fcce7ca0..67bd363e 100644
--- a/packages/platform-server/src/constants.ts
+++ b/packages/platform-server/src/constants.ts
@@ -1,2 +1,2 @@
-export const VERSION = '0.21.0';
+export const VERSION = '0.21.1';
export const VOID_TAG_NAMES = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
diff --git a/packages/web-router/package.json b/packages/web-router/package.json
index 0817c1d7..571ca470 100644
--- a/packages/web-router/package.json
+++ b/packages/web-router/package.json
@@ -1,6 +1,6 @@
{
"name": "@dark-engine/web-router",
- "version": "0.21.0",
+ "version": "0.21.1",
"description": "The isomorphic Dark router designed for rendering universal web applications that work both on the client and on the server",
"author": "AlexPlex",
"license": "MIT",
diff --git a/packages/web-router/src/constants.ts b/packages/web-router/src/constants.ts
index 67239ea2..44b1af41 100644
--- a/packages/web-router/src/constants.ts
+++ b/packages/web-router/src/constants.ts
@@ -1,4 +1,4 @@
-export const VERSION = '0.21.0';
+export const VERSION = '0.21.1';
export const SLASH = '/';
export const PARAMETER = ':';
export const WILDCARD = '**';