This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 配置运行环境 | |
FROM node:alpine | |
# 配置工作目录 | |
WORKDIR /wwwroot | |
# 配置 Node 运行模式 | |
ENV NODE_ENV production | |
# 禁用 Next 数据遥测 | |
ENV NEXT_TELEMETRY_DISABLED 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 配置运行环境 | |
FROM node:alpine AS deps | |
# 配置工作目录 | |
WORKDIR /wwwroot | |
# 切换国内软件源 | |
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories | |
# 安装编译环境 | |
RUN apk update && apk upgrade -f && apk add --no-cache g++ make python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @function compose | |
* @description compose koa middlewares | |
* @param {function[]} middlewares | |
* @returns {function} | |
*/ | |
function compose(middlewares) { | |
const done = async () => {}; | |
const compose = middlewares.reduce((compose, middleware) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @function compose | |
* @description compose redux middlewares | |
* @param {function[]} funcs | |
* @returns {function} | |
*/ | |
function compose(middlewares) { | |
return middlewares.reduce((compose, middleware) => { | |
return (...args) => compose(middleware(...args)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module compose | |
*/ | |
export interface Next { | |
(): Promise<void>; | |
} | |
export interface Composed<C> { | |
(context: C, next?: Next): Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module compose | |
*/ | |
export type Next<C> = (context: C) => Promise<C>; | |
export type Middleware<C> = (context: C, next: Next<C>) => Promise<C> | C; | |
export type ComposedMiddleware<C> = (context: C, next?: Next<C>) => Promise<C>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module compose | |
*/ | |
export interface Next { | |
(): Promise<void>; | |
} | |
export interface Composed<C> { | |
(context: C, next?: Next): Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module useStateMachine | |
* @see https://github.com/cassiozen/useStateMachine | |
*/ | |
import { isFunction, isString } from '/js/utils'; | |
import { Dispatch, useEffect, useMemo, useReducer } from 'react'; | |
type ContextUpdate<C> = (context: C) => C; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module path | |
*/ | |
/** | |
* @function isURL | |
* @description 判断路径是否为 URL | |
* @param path 需要判断的路径 | |
*/ | |
function isURL(path: string): boolean { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @module DFSTree | |
*/ | |
type Resolve<T> = (node: T) => T[] | void; | |
type IteratorValue<T> = [node: T, parent: T | undefined]; | |
type Waiting<T> = [iterator: Iterator<T, undefined>, parent?: T]; |