Skip to content

Commit

Permalink
version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
atellmer committed Mar 26, 2023
1 parent 51871ba commit 20a8e26
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/component/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<P extends StandardComponentProps = any, R = any> {
public type: CreateElement<P>;
Expand Down Expand Up @@ -39,7 +37,7 @@ function component<P, R = unknown>(type: CreateElement<P, R>, 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!`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
24 changes: 11 additions & 13 deletions packages/core/src/fiber/fiber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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);
}
Expand All @@ -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;
}

Expand Down Expand Up @@ -607,7 +605,7 @@ function extractKeys(alternate: Fiber, children: Array<DarkElementInstance>) {
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]);
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/hot/hot.ts
Original file line number Diff line number Diff line change
@@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/native-navigation/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/native-navigation/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const VERSION = '0.21.0';
export const VERSION = '0.21.1';
export const SLASH = '/';

export enum TransitionName {
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-browser/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-browser/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion packages/platform-native/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-native/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion packages/platform-server/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-server/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion packages/web-router/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/web-router/src/constants.ts
Original file line number Diff line number Diff line change
@@ -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 = '**';
Expand Down

0 comments on commit 20a8e26

Please sign in to comment.