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 getFiles | |
*/ | |
import { Dirent } from 'fs'; | |
import { join, resolve } from 'path'; | |
import { readdir } from 'fs/promises'; | |
type Waiting = [ | |
// Current dirname |
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 import-meta-glob | |
*/ | |
import path from 'path'; | |
import glob from 'fast-glob'; | |
import { Plugin } from 'rollup'; | |
import MagicString from 'magic-string'; | |
import { stripLiteral } from 'strip-literal'; | |
import acorn, { parseExpressionAt } from 'acorn'; |
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
// 使用位运算将数字转换为8位有符号整数 | |
function toInt8(value: number): number { | |
return (value << 24) >> 24; | |
} | |
// 使用位运算将数字转换为8位无符号整数 | |
function toUint8(value: number): number { | |
return value & 0xff; | |
} |
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
// prettier-ignore | |
// @see https://github.com/soldair/node-qrcode/blob/master/helper/to-sjis.js | |
// @see https://github.com/soldair/node-qrcode/pull/319 | |
// @see http://ash.jp/code/unitbl21.htm | |
// @see https://seiai.ed.jp/sys/text/java/shiftjis_table.html | |
const SJIS_TABLE: [offset: number, sjis: string][] = [ | |
[0x8140, ' 、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/\~∥|…‥‘’“”()〔〕[]{}〈〉《》「」『』【】+-±×'], | |
[0x8180, '÷=≠<>≦≧∞∴♂♀°′″℃¥$¢£%#&*@§☆★○●◎◇◆□■△▲▽▼※〒→←↑↓〓'], | |
[0x81b8, '∈∋⊆⊇⊂⊃∪∩'], | |
[0x81c8, '∧∨¬⇒⇔∀∃'], |
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 BitArray | |
*/ | |
const LOAD_FACTOR = 0.75; | |
function toUInt32(uint32: number): number { | |
// 防止溢出 0-0xffffffff | |
return uint32 >>> 0; | |
} |
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 BitMatrix | |
*/ | |
function toUint32(uint32: number): number { | |
// 防止溢出 0-0xffffffff | |
return uint32 >>> 0; | |
} | |
export class BitMatrix { |
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 | |
*/ | |
interface CallStack { | |
index: number; | |
} | |
export interface 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
/** | |
* @function normalize | |
* @description Normalize the path. | |
* @param path The path to normalize. | |
*/ | |
export function normalize(path: string): string { | |
if (path === '') return '.'; | |
const parts = path.split(/[\\/]+/); | |
const { length } = parts; |
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]; |
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 { |
NewerOlder